入库明细新增“总计”列(=金额+预估金额),页面与导出一致

This commit is contained in:
chenxi 2026-09-30 17:04:44 +08:00
parent 5ee0813490
commit cf07ad499f
2 changed files with 9 additions and 1 deletions

View File

@ -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;
}

View File

@ -1605,6 +1605,7 @@
<th scope="col" class="is-number">金额</th>
<th scope="col" class="is-number">预估单价</th>
<th scope="col" class="is-number">预估金额</th>
<th scope="col" class="is-number">总计</th>
<th scope="col">供应商条码</th>
<th scope="col">备注</th>
<th scope="col">仓库</th>
@ -1631,6 +1632,7 @@
<td class="is-number">{{ $inboundRow->amount === null ? '—' : number_format((float) $inboundRow->amount, 2) }}</td>
<td class="is-number">{{ $inboundRow->estimated_unit_price === null ? '—' : number_format((float) $inboundRow->estimated_unit_price, 2) }}</td>
<td class="is-number">{{ $inboundRow->estimated_amount === null ? '—' : number_format((float) $inboundRow->estimated_amount, 2) }}</td>
<td class="is-number">{{ ($inboundRow->amount === null && $inboundRow->estimated_amount === null) ? '—' : number_format((float) ($inboundRow->amount ?? 0) + (float) ($inboundRow->estimated_amount ?? 0), 2) }}</td>
<td>{{ $inboundRow->supplier_barcode ?? '—' }}</td>
<td>{{ $inboundRow->remark ?? '—' }}</td>
<td>{{ $inboundRow->warehouse ?? '—' }}</td>
@ -1643,7 +1645,7 @@
</tr>
@empty
<tr class="is-empty">
<td colspan="21">
<td colspan="22">
<div class="directory-table-empty">
<span class="material-icons-outlined" aria-hidden="true">inbox</span>
<span>尚未导入入库明细数据。</span>