diff --git a/app/Http/Controllers/Business/Pages.php b/app/Http/Controllers/Business/Pages.php index be7ea85cd..675dbcb91 100644 --- a/app/Http/Controllers/Business/Pages.php +++ b/app/Http/Controllers/Business/Pages.php @@ -562,6 +562,7 @@ class Pages extends Controller 'supplier' => '供应商', 'item_no' => '货号', 'barcode' => '条码', 'spec_name' => '规格名', 'quantity' => '库存变动量', 'unit_price' => '单价', 'amount' => '金额', 'estimated_unit_price' => '预估单价', 'estimated_amount' => '预估金额', + 'total' => '总计', 'supplier_barcode' => '供应商条码', 'remark' => '备注', 'warehouse' => '仓库', 'warehouse_short_name' => '仓库简称', 'created_at_raw' => '创建时间(实际)', 'express_name' => '快递名称', 'express_no' => '快递单号', 'not_sent' => '未发出', 'owner_name' => '负责人', @@ -594,6 +595,11 @@ class Pages extends Controller foreach ($rows as $row) { $line = []; foreach (array_keys($labels) as $column) { + if ($column === 'total') { + // 总计 = 金额 + 预估金额 + $line[] = number_format((float) ($row->amount ?? 0) + (float) ($row->estimated_amount ?? 0), 2); + continue; + } $value = $row->{$column} ?? ''; $line[] = is_string($value) ? $value : (string) $value; } diff --git a/resources/views/business/pages/partials/directory-table.blade.php b/resources/views/business/pages/partials/directory-table.blade.php index d49eb666d..223900f9c 100644 --- a/resources/views/business/pages/partials/directory-table.blade.php +++ b/resources/views/business/pages/partials/directory-table.blade.php @@ -1605,6 +1605,7 @@ 金额 预估单价 预估金额 + 总计 供应商条码 备注 仓库 @@ -1631,6 +1632,7 @@ {{ $inboundRow->amount === null ? '—' : number_format((float) $inboundRow->amount, 2) }} {{ $inboundRow->estimated_unit_price === null ? '—' : number_format((float) $inboundRow->estimated_unit_price, 2) }} {{ $inboundRow->estimated_amount === null ? '—' : number_format((float) $inboundRow->estimated_amount, 2) }} + {{ ($inboundRow->amount === null && $inboundRow->estimated_amount === null) ? '—' : number_format((float) ($inboundRow->amount ?? 0) + (float) ($inboundRow->estimated_amount ?? 0), 2) }} {{ $inboundRow->supplier_barcode ?? '—' }} {{ $inboundRow->remark ?? '—' }} {{ $inboundRow->warehouse ?? '—' }} @@ -1643,7 +1645,7 @@ @empty - +
尚未导入入库明细数据。