feat(analytics): cashflow view with income/investment/net — split-adjusted + multi-currency

- Add 'investment' category (shares, ETFs, super)
- Analytics API: separate income, investment, expense queries; use amount_aud for FX-aware sums
- Analytics page: cashflow summary (income/expenses/invested/net cash), grouped bar chart,
  income + invested rows in 6-month trend table
- MonthlyAnalytics interface: add income, investments, net fields to totals
- DB: amount_aud + exchange_rate_to_aud columns added and backfilled (in prior migration)
This commit is contained in:
2026-03-08 19:15:20 +11:00
parent 5dbeb0cb87
commit d1a0eedf03
4 changed files with 206 additions and 91 deletions
+1
View File
@@ -16,6 +16,7 @@ export const CATEGORIES = [
"rent",
"transfers",
"income",
"investment",
"personal_care",
"pets",
"gifts",
+3 -1
View File
@@ -451,7 +451,9 @@ export interface MonthlyAnalyticsRow {
export interface MonthlyAnalytics {
months: string[];
rows: MonthlyAnalyticsRow[];
totals: Record<string, { spent: number; budget: number }>;
income: Record<string, number>;
investments: Record<string, number>;
totals: Record<string, { spent: number; income: number; investments: number; net: number }>;
}
export function useBudgets(month: string) {