对账明细导出:摘要增加 reconcile_mismatch 标记

This commit is contained in:
萝卜
2026-03-13 21:12:31 +00:00
parent 49c4226872
commit f5e51f5485
2 changed files with 7 additions and 0 deletions

View File

@@ -471,10 +471,16 @@ class PlatformOrderController extends Controller
$tol = (float) config('saasshop.amounts.tolerance', 0.01);
$tolCents = (int) round($tol * 100);
$tolCents = max(1, $tolCents);
$deltaCents = (int) round($delta * 100);
$reconcileMismatch = $receiptTotal > 0 && abs($deltaCents) >= $tolCents;
fputcsv($out, ['receipt_total', number_format($receiptTotal, 2, '.', '')]);
fputcsv($out, ['refund_total', number_format($refundTotal, 2, '.', '')]);
fputcsv($out, ['reconcile_delta', number_format($delta, 2, '.', '')]);
fputcsv($out, ['amount_tolerance', number_format($tol, 2, '.', '')]);
fputcsv($out, ['reconcile_mismatch', $reconcileMismatch ? '1' : '0']);
fputcsv($out, ['placed_at', (string) (optional($order->placed_at)->format('Y-m-d H:i:s') ?? '')]);
fputcsv($out, ['paid_at', (string) (optional($order->paid_at)->format('Y-m-d H:i:s') ?? '')]);