Merge pull request 'feat(warehouse): 仓库订单导出增加支付方式和金额分类' (#347) from dev into main

Reviewed-on: #347
This commit is contained in:
mkm 2024-11-18 17:53:23 +08:00
commit f5bff25d95
4 changed files with 37 additions and 13 deletions

View File

@ -200,6 +200,8 @@ class WarehouseOrderController extends BaseAdminController
$order = WarehouseOrder::where('id', $id)->findOrEmpty();
$data = WarehouseProduct::where('oid', $id)->select();
$order['total_num'] = 0;
$credit_pay = 0;
$cash_pay = 0;
foreach ($data as $key => &$value) {
$find = StoreProduct::where('id', $value->product_id)->find();
$value->store_name = $find['store_name'] ?? '';
@ -211,7 +213,18 @@ class WarehouseOrderController extends BaseAdminController
}
$order['total_num'] += $value->nums;
$value->supplier_name= Supplier::where('id', $value->supplier_id)->value('mer_name');
if($value->pay_type==1){
$credit_pay += $value->total_price;
$value->pay_type_name='赊账';
}elseif($value->pay_type==2){
$cash_pay += $value->total_price;
$value->pay_type_name='现款';
}else{
$value->pay_type_name='未设置';
}
}
$order['credit_pay']=$credit_pay;
$order['cash_pay']=$cash_pay;
$file_path = $xlsx->export($data, $order);
return $this->success('导出成功', ['url' => $file_path]);

View File

@ -185,6 +185,7 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
$data['admin_id'] = $params['admin_id'];
$data['order_type'] = $beforehandOrder['order_type'];
$data['store_id'] = 0;
$data['pay_type'] = $v['pay_type'];
$data['oid'] = $res['id'];
$data['supplier_id'] = $v['supplier_id'];
$data['warehouse_id'] = $params['warehouse_id'];

View File

@ -98,6 +98,7 @@ class WarehouseProductLogic extends BaseLogic
'admin_id' => $params['admin_id'],
'code' => $params['code'] ?? '',
'status' => 1,
'pay_type' => $params['pay_type'] ?? 0,
'mark' => $params['mark'] ?? '',
];
if (isset($params['manufacture']) && $params['manufacture'] != '') {

View File

@ -39,7 +39,7 @@ class WarehouseOrdeRentry
$sheet->setCellValue('G3', '单价');
$sheet->setCellValue('H3', '数量');
$sheet->setCellValue('I3', '总价');
$sheet->setCellValue('J3', '备注');
$sheet->setCellValue('J3', '支付方式');
// 设置默认的单元格样式
$defaultStyle = [
@ -62,32 +62,41 @@ class WarehouseOrdeRentry
$sheet->setCellValue('G' . ($k + 4), $v['purchase']);
$sheet->setCellValue('H' . ($k + 4), $v['nums']);
$sheet->setCellValue('I' . ($k + 4), $v['total_price']);
$sheet->setCellValue('J' . ($k + 4), $v['pay_type_name']??'');
}
$count = count($data);
$sheet->mergeCells('A' . ($count + 4) . ':J' . $count + 4);
$sheet->mergeCells('B' . ($count + 5) . ':E' . $count + 5);
$sheet->setCellValue('A' . $count + 5, '合计数量');
$sheet->setCellValue('B' . $count + 5,$order['total_num']);
$sheet->setCellValue('A' . $count + 5, '赊账金额');
$sheet->setCellValue('B' . $count + 5,$order['credit_pay']);
$sheet->mergeCells('G' . ($count + 5) . ':J' . $count + 5);
$sheet->setCellValue('F' . $count + 5, '合计价格');
$sheet->setCellValue('G' . $count + 5, $order['total_price']);
$sheet->setCellValue('F' . $count + 5, '现金金额');
$sheet->setCellValue('G' . $count + 5, $order['cash_pay']);
$sheet->mergeCells('B' . ($count + 6) . ':E' . $count + 6);
$sheet->setCellValue('A' . $count + 6, '合计数量');
$sheet->setCellValue('B' . $count + 6,$order['total_num']);
$sheet->mergeCells('G' . ($count + 6) . ':J' . $count + 6);
$sheet->setCellValue('F' . $count + 6, '合计价格');
$sheet->setCellValue('G' . $count + 6, $order['total_price']);
// $sheet->mergeCells('C' . ($count + 7) . ':F' . $count + 7);
// $sheet->mergeCells('C' . ($count + 8) . ':F' . $count + 8);
// $sheet->mergeCells('H' . ($count + 7) . ':J' . ($count + 7));
// $sheet->mergeCells('H' . ($count + 8) . ':J' . $count + 8);
$sheet->mergeCells('A' . ($count + 6) . ':J' . $count + 6);
$sheet->mergeCells('A' . ($count + 7) . ':J' . $count + 7);
$sheet->setCellValue('A' . $count + 7, '录入人',);
$sheet->setCellValue('A' . $count + 8, '录入人',);
// $sheet->setCellValue('B' . $count + 11, $this->warehouse);
$sheet->mergeCells('B' . ($count + 7) . ':C' . $count + 7);
$sheet->setCellValue('D' . $count + 7, '采购人');
$sheet->mergeCells('E' . ($count + 7) . ':F' . $count + 7);
$sheet->setCellValue('G' . $count + 7, '审核人');
$sheet->mergeCells('H' . ($count + 7) . ':J' . $count + 7);
$sheet->mergeCells('B' . ($count + 8) . ':C' . $count + 8);
$sheet->setCellValue('D' . $count + 8, '采购人');
$sheet->mergeCells('E' . ($count + 8) . ':F' . $count + 8);
$sheet->setCellValue('G' . $count + 8, '审核人');
$sheet->mergeCells('H' . ($count + 8) . ':J' . $count + 8);
// 设置单元格的样式
$styleArray = [
@ -106,7 +115,7 @@ class WarehouseOrdeRentry
],
],
];
$sheet->getStyle('A1:J' . ($count + 7))->applyFromArray($styleArray);
$sheet->getStyle('A1:J' . ($count + 8))->applyFromArray($styleArray);
// 保存文件到 public 下