Files
HOA_Financial_Platform/backend
olsch01 72161f81f5 fix: monthly actuals equity offset (Option A) + scenario activation creates accounts
Monthly Actuals — Option A:
- Replace operating cash account offset with per-fund equity account clearing
- Equity accounts 3000/3100 now absorb the net P&L from actuals entries
- Cash account is never touched by monthly actuals, eliminating the balance
  discrepancy that required manual cash adjustments
- Per-fund routing: operating income/expense clears to 3000, reserve to 3100
- Falls back gracefully if only one equity account exists

Scenario Activation (Issue 4):
- updateScenario now accepts userId and triggers materialisation when
  status transitions to 'active'
- Each pending scenario investment is created as a real investment_accounts
  record dated to its purchase_date (future dates are supported)
- Journal entries are posted at the purchase_date using the fund's primary
  cash account and equity offset (matching manual account creation)
- Rollover detection: if an existing active investment matures within 7 days
  of the new investment's purchase_date and shares the same fund_type, the
  system creates a maturity JE (proceeds → cash) and a reinvestment JE
  (cash → new CD) rather than a fresh cash deduction, then retires the
  source investment
- Per-investment failures are logged but do not abort the rest of the batch

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-21 14:36:17 -04:00
..