Reconciliation: clear any uncleared item regardless of billed date

A transaction's billed date no longer gates which reconciliation it can clear
in — items billed in one period frequently clear the bank in another. The
reconcile list now shows every uncleared, non-voided item for the account
(reconciliation_id is null), dropping the date <= statement_end_date ceiling.
Finalized items still carry a reconciliation_id and drop off.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-13 11:02:06 -04:00
parent 6bf9da5482
commit 6ad7688fbd
@@ -137,20 +137,20 @@ export default function AccountingReconcileDetailPage() {
}); });
const { data: txs = [] } = useQuery({ const { data: txs = [] } = useQuery({
queryKey: ["recon-txs", accountId, active?.statement_end_date, priorReconDate], queryKey: ["recon-txs", accountId],
enabled: !!accountId && !!active, enabled: !!accountId && !!active,
queryFn: async () => { queryFn: async () => {
// Show every item not yet tied to a completed reconciliation, on/before the // Show EVERY uncleared item for this account, regardless of its (billed)
// statement date — INCLUDING outstanding items from prior periods. Items // date — a transaction billed in one period often clears the bank in
// that were finalized get a reconciliation_id and drop off; uncleared ones // another, so the transaction date must not gate which reconciliation it
// carry forward until they clear. Voided items are excluded entirely. // can be cleared in. The only constraints: not already finalized into a
// completed reconciliation (reconciliation_id is null) and not voided.
const { data } = await accounting const { data } = await accounting
.from("transactions") .from("transactions")
.select("id,date,description,reference,amount,type,cleared,reconciliation_id,voided") .select("id,date,description,reference,amount,type,cleared,reconciliation_id,voided")
.eq("account_id", accountId) .eq("account_id", accountId)
.is("reconciliation_id", null) .is("reconciliation_id", null)
.eq("voided", false) .eq("voided", false)
.lte("date", active!.statement_end_date)
.order("date"); .order("date");
return (data ?? []) as Tx[]; return (data ?? []) as Tx[];
}, },
@@ -514,7 +514,7 @@ export default function AccountingReconcileDetailPage() {
})} })}
{filtered.length === 0 && ( {filtered.length === 0 && (
<TableRow><TableCell colSpan={7} className="text-center text-muted-foreground py-8"> <TableRow><TableCell colSpan={7} className="text-center text-muted-foreground py-8">
No unreconciled transactions in this period. No unreconciled transactions for this account.
</TableCell></TableRow> </TableCell></TableRow>
)} )}
</TableBody> </TableBody>