From 2da46a2a86b0bec62fba5231ef28b0f084dd0539 Mon Sep 17 00:00:00 2001 From: yueyang <2495544247@qq.com> Date: Sat, 10 Oct 2026 15:38:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=9A=E7=BB=A9=E6=98=8E=E7=BB=86=EF=BC=9A?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=87=BA=E3=80=8C=E5=B7=AE=E9=A2=9D?= =?UTF-8?q?=E3=80=8D=E5=88=97=E6=8A=8A=E6=9C=AA=E5=8C=B9=E9=85=8D=E8=A1=8C?= =?UTF-8?q?=E5=86=99=E6=88=90=200=20=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 未匹配行的差额在库里是 NULL,导出取值用了 ?? '' 变成空字符串,原判断只认 null, 这些行被导成 0.00,导出合计只剩已匹配行的差额(2026-07 只有 14.7 万) - 现在空差额按「比对基准金额=0」补算 收入+优惠+冲减,与页面/统计卡口径一致 - 验证:2026-07 全部平台导出 300,707 行,差额列合计 1,354,719.44(与页面同值); 只看未匹配 3,968 行,差额列合计 1,207,560.77 --- app/Http/Controllers/Business/Pages.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Business/Pages.php b/app/Http/Controllers/Business/Pages.php index 7f5527ed..5a6e7875 100644 --- a/app/Http/Controllers/Business/Pages.php +++ b/app/Http/Controllers/Business/Pages.php @@ -1207,8 +1207,9 @@ class Pages extends Controller if ($key === 'remark') { $value = self::receiptDifferenceRemark($row) ?? ''; } - // 未匹配行(差额为空)按比对基准金额=0 计入差额,与页面口径一致 - if ($key === 'difference' && $value === null) { + // 未匹配行(差额为空)按比对基准金额=0 计入差额,与页面口径一致。 + // 注意:上面取值用了 ?? '',空差值是空字符串而不是 null,这里两种都要认。 + if ($key === 'difference' && ($value === null || $value === '')) { $value = round( (float) ($row->income_amount ?? 0) + (float) ($row->discount_amount ?? 0) + (float) ($row->offset_amount ?? 0), 2