Add Balance Sheet report

New first-tab report showing a full breakdown of where money sits:
- Three KPI cards: total assets, total liabilities, net worth
- Proportional stacked bars showing asset and liability composition
- Side-by-side account lists grouped by type (Cash, Savings, ISAs,
  Investments, Pension, Crypto vs Credit Cards, Loans, Mortgages)
- Backend endpoint GET /api/v1/reports/balance-sheet with typed schema
- Balance Sheet is now the default tab on the Reports page

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
megaproxy 2026-04-21 15:33:34 +00:00
parent 70db18e89f
commit dd66b2d5fe
5 changed files with 337 additions and 5 deletions

View file

@ -121,3 +121,32 @@ export async function getSpendingTrends(months = 6): Promise<SpendingTrendsRepor
const r = await api.get("/api/v1/reports/spending-trends", { params: { months } });
return r.data;
}
export interface BalanceSheetAccount {
id: string;
name: string;
type: string;
balance: number;
currency: string;
}
export interface BalanceSheetGroup {
label: string;
type_keys: string[];
accounts: BalanceSheetAccount[];
subtotal: number;
}
export interface BalanceSheetReport {
asset_groups: BalanceSheetGroup[];
liability_groups: BalanceSheetGroup[];
total_assets: number;
total_liabilities: number;
net_worth: number;
currency: string;
}
export async function getBalanceSheet(): Promise<BalanceSheetReport> {
const r = await api.get("/api/v1/reports/balance-sheet");
return r.data;
}