Van Stock Reconciliation (VRS Fix)

{{-- Summary header --}}
@if ($fixedCount > 0)
@else
@endif

@if ($fixedCount > 0) {{ $fixedCount }} discrepanc{{ $fixedCount === 1 ? 'y' : 'ies' }} found and fixed @else All van stock records are in sync @endif

{{ $okCount }} OK  •  {{ $fixedCount }} Fixed  •  {{ $okCount + $fixedCount }} total vehicle-product pairs checked

@if (count($rows) === 0)
No van stock records found. Nothing to reconcile.
@else
@foreach ($rows as $i => $row) @endforeach
# Vehicle Product Ledger (Truth) Was (Batches) Was (Agg) Status
{{ $i + 1 }} {{ $row['vehicle'] }} {{ $row['product'] }} {{ number_format($row['ledger'], 3) }} {{ number_format($row['was_vsb'], 3) }} {{ $row['was_agg'] !== null ? number_format($row['was_agg'], 3) : '—' }} @if ($row['status'] === 'OK') OK @else Fixed @endif
@endif

Ledger (Truth) = SUM(debit_qty - credit_qty) from inventory_ledger_entries. Re-run at any time — this operation is safe and idempotent.

Run Again