37cf745ca18306a411d8b97a2b4cb160f7fe91fb
CFO-style summary that pulls everything together: cash position, P&L by period, 12-month trend, top customers, expense breakdown, loans, cards, outstanding invoices. Aggregator (lib/appwrite/finance-report-queries.ts): - getFinancialReport(tenantId, period). Period: month / quarter / year / all. Pulls all relevant tables in parallel (customers, invoices, finance entries, bank accounts, loans, installments, cards, statements). - KPIs: period income, period expense, period net, current cash position (bank balances + receivables − loan remaining − card outstanding). - Cash composition: separates the four pieces of net cash position with links to drill in. - Trend: 12-month income/expense series. - Top customers: paid invoice totals, period-bound. - Expense breakdown: heuristic split using financeEntryId backrefs from loan_installments and credit_card_statements — lets us bucket auto- generated expenses (loan vs card vs manual) without needing a new category column. - Active loans summary: top 8 by remaining balance. - Card statements: pending + overdue, sorted by due date. - Outstanding invoices: top 12 unpaid (overdue first). Page (/finance/reports): - Period selector (?period=month|quarter|year|all). Default 'month'; default URL drops the param. - KPI row → composition card → 12-month trend → top customers + expense breakdown → loans + cards tables → outstanding invoices. - Trend chart loaded via next/dynamic with ssr: false (recharts is heavy and only runs client-side anyway). Sidebar Finans submenu: added Rapor → /finance/reports.
Description
No description provided
Languages
TypeScript
99.5%
CSS
0.5%