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>
- post_transaction_gl counter priority fixed: customer->A/R, then coa->that
account (direct categorized expense/income), then uncategorized vendor->A/P.
Previously any vendor payment went to A/P, driving A/P negative and hiding the
real expense account. The 38 direct vendor payments now post to their expense
accounts; A/P went from -5,895.79 to +3,099.29 (real open payables).
- sync_public_bill now maps the public bill's expense_account_id to the matching
accounting expense account (by name) on the bill line item, so synced bills
stop defaulting to "Administrative". Expenses now spread across Attorneys Fees,
Electric, Lawn Service, Management Fees, Water, etc.
- Verified managed companies: R1=0, R7=0. R8 surfaces a real $1,029.17 residual
(bills marked paid whose payments were entered as direct expenses, not A/P
settlements) — surfaced in the Reconciliation report, not plugged.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Root cause: accounting.transactions (deposits, transfers, bank payments) never
posted to the GL, and the GL's cash came only from synthesized legs that
hard-coded Undeposited Funds. So the balance sheet ignored transfers (#1) and
showed directly-deposited funds as Undeposited (#2), with banks going negative.
- Post the bank register to the GL: customer receipt -> Dr bank/Cr A/R, vendor
payment -> Dr A/P/Cr bank, categorized -> Dr/Cr bank+COA, transfer -> Dr dest/
Cr source, deposit -> Dr bank/Cr Undeposited; payments_received -> Undeposited.
Retire the synthesized invoice/bill cash legs (acmacc_invpay/billpay) so cash is
sourced once, from the register. Triggers on transactions/deposits keep it live.
- Fix gl_managed: make it an explicit accounting.companies.gl_auto_post flag
instead of inferring from null-source journal entries (a single manual journal
entry had silently disabled all automation for Ashley Manor).
Verified (Ashley Manor): transfer reflected (Cogent +47,127 vs prior -3,521),
deposits land in BOA (Undeposited cleared), R1=0, R7=0, no negative banks.
Imported companies (Bridgewater/Bent Oak) untouched; their residuals stay
surfaced in the Reconciliation report.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Per the Financial Reports Master Spec:
- §1.5 A/R fix: invoice settlements now post to the GL (Dr Undeposited / Cr A/R
from invoice.paid_amount); payments are the cash sub-ledger only and no longer
separately credit A/R (avoids double-count). A/R control = open balance, so
recon R7 passes for managed companies (Ashley Manor 39,248 -> 0). Bills already
settled (R8 ok). Migration applied + backfilled managed companies.
- §9/§10: add a "Reconciliation Checks" report that surfaces R1/R2/R7/R8
residuals (never plugged) so imbalances are visible — e.g. Bridgewater's
imported GL is unbalanced (R1) and its sub-ledgers don't tie (R7/R8).
Imported companies (Bridgewater/Bent Oak) left untouched per decision; their
residuals now surface in the Reconciliation report.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add a "Allow document & bid/quote uploads" toggle on board member profiles
(board_members.can_upload). When enabled, that board member can upload
association documents and create/manage bids & quotes for their association(s);
otherwise the board portal stays read-only for them.
- Migration (prod): board_members.can_upload column; tighten the documents
insert + storage 'files' upload policies to require can_upload; add a
bids_quotes board policy gated on can_upload.
- BoardMembersPage: permission switch (load/save).
- BoardAssociationContext: expose canUpload for the selected association.
- DocumentsPage: board upload gated by the flag (was always-on for board).
- BidsQuotesPage: permitted board members can add/manage bids (was hidden);
board inserts target the board's association.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Opening balances now post a single "Opening Balances" journal entry to the GL
(migration applied to prod), scoped to managed companies (imported-GL
associations already carry theirs). Triggers on opening_balances /
opening_balances_setup keep it in sync; Ashley Manor backfilled.
- Balance Sheet: read balances from the GL only (drop the separate opening add,
which also double-counted imported companies).
- Trial Balance: compute balances from journal_entry_lines as of the report date
(was accounts.balance).
- General Ledger report: read from journal_entry_lines (was transactions); opening
rolls in from the GL.
All four reports now share one source. Verified Ashley Manor TB balances
(debits = credits = $90,073.23) with opening cash (BOA +$47,304.31) flowing through.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The P&L and Balance Sheet are GL-driven, but invoices/payments/bills never
posted to journal_entries (the referenced syncBillsInvoicesToLedger was never
built), so accounts with no GL activity showed $0 and were hidden.
Adds an idempotent GL posting engine (migration applied to prod), scoped to
companies whose GL is "managed" (no imported/foreign journal entries) to avoid
double-counting Bridgewater/Bent Oak:
- invoice -> Dr Accounts Receivable / Cr income (keyword-mapped, default Assessment Fees)
- payment -> Dr Undeposited Funds / Cr Accounts Receivable
- bill -> Dr expense (bill_items) / Cr Accounts Payable (+ paid leg to bank)
Auto-creates AR (1100) / AP (2000) where missing. AFTER triggers on
invoices/payments_received/bills keep the GL in sync; existing docs backfilled.
Verified debits=credits and the balance-sheet invariant holds.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Migration applied to prod: approved/paid public.bills mirror into
accounting.bills (Payables) with find-or-create vendor + line item
(external_source='acmacc_bill'/'acmacc_vendor'). When an accounting bill is
marked paid (paid_amount>=total), the linked public.bills is set status=paid
(+paid_date, amount_paid) and its bill_approvals marked paid. Loop-guarded
with is-distinct-from. Backfilled 370 bills/45 vendors; totals reconcile.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds DB triggers + backfill so accounting.customers is driven by the
public units/owners roster: one customer per unit, all owners combined,
Units/Owners as source of truth for contact fields. Balances and ledger
links (invoices, payments_received, transactions, work_orders, estimates)
are always preserved. Scoped to associations with an accounting company.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>