diff --git a/app/admin/controller/warehouse_order/WarehouseOrderController.php b/app/admin/controller/warehouse_order/WarehouseOrderController.php index 7c20b1dc0..190a18e3f 100644 --- a/app/admin/controller/warehouse_order/WarehouseOrderController.php +++ b/app/admin/controller/warehouse_order/WarehouseOrderController.php @@ -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]); diff --git a/app/admin/logic/beforehand_order_cart_info/BeforehandOrderCartInfoLogic.php b/app/admin/logic/beforehand_order_cart_info/BeforehandOrderCartInfoLogic.php index 85654a84d..b5850549e 100644 --- a/app/admin/logic/beforehand_order_cart_info/BeforehandOrderCartInfoLogic.php +++ b/app/admin/logic/beforehand_order_cart_info/BeforehandOrderCartInfoLogic.php @@ -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']; diff --git a/app/admin/logic/warehouse_product/WarehouseProductLogic.php b/app/admin/logic/warehouse_product/WarehouseProductLogic.php index 84f8892e4..b1ea9e6fc 100644 --- a/app/admin/logic/warehouse_product/WarehouseProductLogic.php +++ b/app/admin/logic/warehouse_product/WarehouseProductLogic.php @@ -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'] != '') { diff --git a/app/common/service/xlsx/WarehouseOrdeRentry.php b/app/common/service/xlsx/WarehouseOrdeRentry.php index 05af5bdda..93c84ca36 100644 --- a/app/common/service/xlsx/WarehouseOrdeRentry.php +++ b/app/common/service/xlsx/WarehouseOrdeRentry.php @@ -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 下