"use client"; import { ReconciliationRow } from "@/lib/types"; interface Props { rows: ReconciliationRow[]; showBranchColumn: boolean; } function VarianceBadge({ row }: { row: ReconciliationRow }) { if (row.eveningPhysicalCount == null) { return ( Awaiting count ); } if (row.reconciledOk) { return ( ✓ Reconciled ); } const diff = row.eveningPhysicalCount - row.expectedRemaining; return ( ⚠ {diff > 0 ? "+" + diff + " surplus" : diff + " SHORT"} ); } export default function ReconciliationGrid({ rows, showBranchColumn }: Props) { const hasVariance = rows.some((r) => r.eveningPhysicalCount != null && !r.reconciledOk); return (

Automated reconciliation

Dispatched − sold = expected, vs. physical evening count

{hasVariance && ( Variance detected )}
{showBranchColumn && } {rows.map((r) => { const flagged = r.eveningPhysicalCount != null && !r.reconciledOk; return ( {showBranchColumn && } ); })} {rows.length === 0 && ( )}
BranchSize Dispatched Sold Expected Physical Status
{r.branchName}{r.sizeLiters}L {r.morningDispatched} {r.totalSold} {r.expectedRemaining} {r.eveningPhysicalCount ?? "—"}
No stock data for the selected filter. Enter this morning's dispatched counts to begin tracking.
); }