feat(finance): per-flat statement of account (#96)#100
Merged
Conversation
A dated, running-balance ledger per apartment — the "My Statement" every benchmark app has and auditors expect. - buildStatement (shared): merges charges (bills + interest = debits) and payments (credits) into a chronological running balance. Debit-positive (what the flat owes); closing = opening + Σdebit − Σcredit, reconciling to outstanding dues. Opening carries in everything before the window. - API GET /apartments/:id/statement?from=&to= — role-scoped (residents only their flats, ADMIN any), excludes CANCELLED bills, tags auto interest bills as INTEREST via the shared title prefix. - Shared INTEREST_BILL_TITLE_PREFIX constant (bills.ts now reuses it). - Tests: buildStatement (running balance, opening, sort, empty) + statement route (401/403 scoping, admin running balance). Suite 340 green. Web (billing statement view) + mobile (bills.tsx) UI land in the consolidated M3.5 admin-UI pass.
ankitsejwal
added a commit
that referenced
this pull request
Jul 16, 2026
Backend for the admin finance dashboard (tiles + charts land in the M3.5 admin-UI pass). - shared: agingBucketFor + bucketAging (0-30 / 31-60 / 61-90 / 90+ days past due; not-yet-due counts current, cleared balances skipped) + AGING_BUCKETS. - API GET /reports/aging?asOf= — buckets outstanding per-bill dues, total and per flat (sorted by exposure), for the defaulter report. - /reports/finance now also returns cashBankBalance (ledger 10xx accounts) for the dashboard tile; FinanceReport type + the finance-shape test updated. - Tests: aging bucket boundaries + summation + not-yet-due/cleared handling; /aging route (auth + a two-flat bucketing case). Suite 366 green; web typechecks.
ankitsejwal
added a commit
that referenced
this pull request
Jul 16, 2026
Surfaces the M3.5 accounting backend in the admin app (extends existing pages — no new routes). - admin/index.tsx: finance tiles — outstanding dues, collection rate, cash+bank. - admin/reports.tsx: statutory statements (Balance Sheet, I&E with mutual/ taxable split, Receipts & Payments, Trial Balance with balanced badges) each with PDF/Excel/CSV export buttons + a Tally XML export; and an aging section (0-30/31-60/61-90/90+ buckets + per-flat breakdown). - api.ts: getTrialBalance/getIncomeExpenditure/getBalanceSheet/ getReceiptsPayments/getAging + reportExportObjectUrl (auth-fetch downloads). - i18n: ~33 new keys (en + hi, parity test green). - Validated: web check-types, vite build, lint (0 errors), web tests 27 green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
M3.5 · Task #96 — Per-flat statement (backend)
Transaction-level running balance per flat (today there's only an aggregate dues row). Needed before the Balance Sheet (member dues = an asset) and expected by residents + auditors.
Domain (shared, unit-tested)
buildStatement(rows, opening)— merges charges (bills + interest → debits) and payments (credits) into a dated running balance. Debit-positive (what the flat owes);closing = opening + Σdebit − Σcredit, which reconciles to outstanding dues.API
GET /apartments/:id/statement?from=&to=— ordered entries{date, type, description, debit, credit, balance, ref}+ opening/closing/totals. Role-scoped (residents only their own flats, ADMIN any), excludes CANCELLED bills, tags auto-generated interest bills asINTEREST(sharedINTEREST_BILL_TITLE_PREFIX, now reused bybills.ts).Acceptance
from).Tests / notes
buildStatement(running balance, opening carry-in, out-of-order sort, empty-safe) + statement route tests (401/403 scoping, admin running balance). Suite 340 green. Web (billing statement view) + mobile (bills.tsx) read-only statement land in the M3.5 admin-UI pass.