mirror of
https://github.com/renee-png/acmcc.git
synced 2026-06-21 01:40:01 +00:00
04d1bdfb49
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>