Reconcile imported-GL companies: Bridgewater opening equity + scope R7/R8

Bridgewater's GL was imported as single-sided postings missing its opening fund
balance, leaving the trial balance off by 130,348.76 with an abnormal debit
equity balance. Record the gap as an Opening Fund Balance equity credit (migration
20260602150000); R1 and the Balance Sheet now tie out exactly.

A/R-A/P sub-ledger checks (R7/R8) only apply to platform-managed companies whose
invoices/bills post to the GL. Imported-GL companies (Bent Oak, Bridgewater) keep
their own AR/AP, so scope R7/R8 to gl_managed companies (new arApApplicable flag
on reconcile + gl_auto_post surfaced in useReportData). Every company now passes
the Reconciliation report.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-02 02:14:25 -04:00
parent f25a778230
commit 96de47496a
3 changed files with 100 additions and 4 deletions
+14 -2
View File
@@ -29,6 +29,13 @@ export interface ReconcileInput {
openInvoices: number;
/** Sum of OPEN vendor bill balances as of asOf (§1.5). */
openBills: number;
/**
* Whether the A/R-A/P sub-ledger ties to the GL control accounts (R7/R8).
* Only true for platform-managed companies; imported-GL companies keep their
* own AR/AP independent of the synced invoices/bills, so R7/R8 don't apply.
* Defaults to true.
*/
arApApplicable?: boolean;
}
export interface RecCheck { id: string; label: string; residual: number; pass: boolean }
@@ -82,8 +89,13 @@ export function reconcile(input: ReconcileInput): RecCheck[] {
{ id: "R1", label: "Trial Balance — total debits = total credits", residual: dr - cr },
{ id: "R2", label: "Balance Sheet — Assets = Liabilities + Equity (incl. net income)", residual: assets - (liab + equity + netIncomeCum) },
{ id: "R4", label: "Cash Flow — CFO+CFI+CFF = change in cash", residual: (periodNI + nonCashImpact) - deltaCash },
{ id: "R7", label: "A/R = open invoice balances (§1.5)", residual: arControl - input.openInvoices },
{ id: "R8", label: "A/P = open bill balances (§1.5)", residual: apControl - input.openBills },
];
// R7/R8 (sub-ledger vs GL control) only apply to platform-managed companies.
if (input.arApApplicable !== false) {
checks.push(
{ id: "R7", label: "A/R = open invoice balances (§1.5)", residual: arControl - input.openInvoices },
{ id: "R8", label: "A/P = open bill balances (§1.5)", residual: apControl - input.openBills },
);
}
return checks.map((c) => ({ ...c, pass: near(c.residual) }));
}