From 028adb47cb5dc31a197f3d1ff0790fc9c0b26078 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 18 Nov 2024 17:52:52 +0800 Subject: [PATCH] =?UTF-8?q?feat(warehouse):=20=E4=BB=93=E5=BA=93=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=AF=BC=E5=87=BA=E5=A2=9E=E5=8A=A0=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E5=92=8C=E9=87=91=E9=A2=9D=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在仓库订单导出功能中添加了支付方式(赊账、现款)的统计 - 新增了赊账金额和现款金额的计算和显示 - 在订单详情中增加了支付方式的名称显示 - 调整了导出表格的格式,增加了支付方式相关列和合计金额显示 --- .../WarehouseOrderController.php | 13 +++++++ .../BeforehandOrderCartInfoLogic.php | 1 + .../WarehouseProductLogic.php | 1 + .../service/xlsx/WarehouseOrdeRentry.php | 35 ++++++++++++------- 4 files changed, 37 insertions(+), 13 deletions(-) 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 下