fix(warehouse_order): 修复仓库订单导出功能并优化供应商显示

- 在导出功能中添加供应商名称显示
- 修复订单详情导出时的单价计算问题
- 优化导出表格的列标题和内容显示
- 增加对不支持的操作类型进行提示
This commit is contained in:
mkm 2024-11-14 15:17:21 +08:00
parent 7f5eeeb71e
commit f93a8d8a1f
2 changed files with 12 additions and 3 deletions

View File

@ -13,6 +13,7 @@ use app\common\model\store_branch_product\StoreBranchProduct;
use app\common\model\store_order\StoreOrder;
use app\common\model\store_product\StoreProduct;
use app\common\model\store_product_unit\StoreProductUnit;
use app\common\model\supplier\Supplier;
use app\common\model\system_store\SystemStore;
use app\common\model\warehouse_order\WarehouseOrder;
use app\common\model\warehouse_product\WarehouseProduct;
@ -209,6 +210,7 @@ class WarehouseOrderController extends BaseAdminController
$value->unit_name = '';
}
$order['total_num'] += $value->nums;
$value->supplier_name= Supplier::where('id', $value->supplier_id)->value('mer_name');
}
$file_path = $xlsx->export($data, $order);
@ -222,6 +224,9 @@ class WarehouseOrderController extends BaseAdminController
{
$id = $this->request->post('id');
$type = $this->request->post('type');
if(in_array($type, [2,3])){
return $this->fail('暂不支持此操作');
}
$xlsx = new OrderDetail();
$order = WarehouseOrder::where('id', $id)->findOrEmpty();
$system_store = SystemStore::where('id', $order['store_id'])->value('name');
@ -249,8 +254,12 @@ class WarehouseOrderController extends BaseAdminController
// $value->total_price=bcmul($find['price'],$value['nums'],2);
// $total_price+=$value->total_price;
// }else{
if($type==1){
$value->price = $value['purchase'];
$value->total_price=bcmul($value['purchase'],$value['nums'],2);
$total_price+=$value->total_price;
}
// }
$value->cart_num = $value['nums'];

View File

@ -34,7 +34,7 @@ class WarehouseOrdeRentry
$sheet->setCellValue('G2', $order['code']??'');
$sheet->setCellValue('A3', '序号');
$sheet->setCellValue('B3', '商品名称');
$sheet->setCellValue('D3', '规格');
$sheet->setCellValue('D3', '供应商');
$sheet->setCellValue('F3', '单位');
$sheet->setCellValue('G3', '单价');
$sheet->setCellValue('H3', '数量');
@ -53,10 +53,10 @@ class WarehouseOrdeRentry
$spreadsheet->getDefaultStyle()->applyFromArray($defaultStyle);
foreach ($data as $k => $v) {
$sheet->setCellValue('A' . ($k + 4), $k+1 );
$sheet->setCellValue('A' . ($k + 4), $v['product_id'] );
$sheet->setCellValue('B' . ($k + 4), $v['store_name']);
$sheet->mergeCells('B' . ($k + 4) . ':C' . $k + 4);
$sheet->setCellValue('D' . ($k + 4), $v['store_info']);
$sheet->setCellValue('D' . ($k + 4), $v['supplier_name']);
$sheet->mergeCells('D' . ($k + 4) . ':E' . $k + 4);
$sheet->setCellValue('F' . ($k + 4), $v['unit_name']);
$sheet->setCellValue('G' . ($k + 4), $v['purchase']);