Analyse page: income, net and assets views; narrow-screen layout #6

Merged
clayschaad merged 2 commits from analytics-income-assets into main 2026-10-22 16:42:43 +00:00
Owner

Summary

Step 4 of the analytics plan, items 2, 4 and 5: income, net and assets views on the Analyse page (replacing the old Vermögen chart page) and a narrow-screen layout pass.

Views

A switch at the top selects Ausgaben | Einnahmen | Netto | Vermögen, stored in the URL as view=. Switching starts the drill-down from the top, because the subclasses differ per view.

  • Einnahmen: works like Ausgaben. Bookings from an income account count positive, bookings to one (corrections) negative.
  • Netto: income minus expenses. Income subclasses are positive and expense subclasses negative.
    • The bar chart stacks income up and expenses down, with a black line for the net result per period; the tooltip total is left out there.
    • Categories are ordered by size, so the big expense groups aren't folded into "Andere".
    • The fourth tile shows the savings rate (net / income).
    • No treemap, since areas can't show negative amounts.
  • Vermögen: month-end balances of the asset accounts (class 1) in CHF. It is a stock, not a flow:
    • A month, quarter or year shows the balance at its end, and the total is the balance at the end of the range.
    • Tiles show that balance, the change since the start of the range (with the opening balance), and the comparison with the same month a year earlier.
    • The year table shows year-end balances; the drill-down ends at the account.
    • The year comparison shows month-end balances, without the cumulative switch.
    • Foreign-currency balances are computed like the balance sheet (ViewService): kept in the account currency and converted with IFxConverter, which is asked once per currency.
  • Colours follow the view: more expenses are red; more income, surplus or assets green. The CSS classes are now worse / better instead of up / down.

Code

  • ExpenseAnalysis → AccountingAnalysis with AnalyticsView (Expenses, Income, Net, Assets), and GetExpenseAnalysisAsync → GetAnalysisAsync. The running year's last month now comes from all bookings, not just expenses.
  • AnalyticsResult.Opening gives the balance at the start of the range for Vermögen.
  • charts.js: the stacked bar chart takes an optional totalLine.

Removed

  • The Vermögen chart page (/Assets) and its menu entry. Plotly is now only used by the booking-text charts on the Transactions page.

Narrow screens

At 400 px the page was wider than the screen.

  • App-wide: the side menu took half the screen. It now starts collapsed to icons below 700 px (wwwroot/js/viewport.js); the ☰ toggle still opens it. The header dropdowns are narrower, and the app name hides below 520 px.
  • Analyse page: button groups wrap, the tiles sit two per row, and in the year table the name column is narrower and pinned while the years scroll, with the full name as a tooltip.

Test plan

  • dotnet build: no warnings
  • dotnet test: 88/88 pass, including 7 new AccountingAnalysisTestShould tests (income signs, net ordering, month-end balances with opening, balance at period end, FX conversion asked once, comparison at the same month, assets drill-down ends at the account)
  • Against a copy of the real data, all matching the app's own reports:
    • Einnahmen 2026 = 109'865.13 ("Total Einkünfte" in the profit-and-loss report)
    • Netto 2026 = 32'859.06 (= 109'865.13 − 77'006.07)
    • Vermögen end of Oct 2026 = 263'994.98 ("Total Aktiven" in the Bilanz)
  • Headless Chrome at 400, 820 and 1500 px: no horizontal overflow; menu collapsed at 400 px and expanded at 820 / 1500 px; pinned table column scrolls correctly; all charts render without console errors

Note on the data (not a code issue)

The Vermögen view shows each year as its books say. In the real data, some closing balances don't match the next year's opening balances. These are probably bookings added to a year after the next one was opened:

  • End of 2024 → 2025: Bargeld CHF (+40.75)
  • End of 2025 → 2026: Bargeld CHF (+98.50), TKB Privatkonto (+200.00), account 1042 (2'030.40 at the end of 2025, missing in 2026), Durchlaufskonto (−7.29)

🤖 Generated with Claude Code

## Summary Step 4 of the analytics plan, items 2, 4 and 5: **income, net and assets views** on the Analyse page (replacing the old Vermögen chart page) and a **narrow-screen layout** pass. ### Views A switch at the top selects **Ausgaben | Einnahmen | Netto | Vermögen**, stored in the URL as `view=`. Switching starts the drill-down from the top, because the subclasses differ per view. - **Einnahmen:** works like Ausgaben. Bookings *from* an income account count positive, bookings *to* one (corrections) negative. - **Netto:** income minus expenses. Income subclasses are positive and expense subclasses negative. - The bar chart stacks income up and expenses down, with a black line for the net result per period; the tooltip total is left out there. - Categories are ordered by size, so the big expense groups aren't folded into "Andere". - The fourth tile shows the **savings rate** (net / income). - No treemap, since areas can't show negative amounts. - **Vermögen:** month-end balances of the asset accounts (class 1) in CHF. It is a stock, not a flow: - A month, quarter or year shows the balance at its end, and the total is the balance at the end of the range. - Tiles show that balance, the change since the start of the range (with the opening balance), and the comparison with the same month a year earlier. - The year table shows year-end balances; the drill-down ends at the account. - The year comparison shows month-end balances, without the cumulative switch. - Foreign-currency balances are computed like the balance sheet (`ViewService`): kept in the account currency and converted with `IFxConverter`, which is asked once per currency. - **Colours follow the view:** more expenses are red; more income, surplus or assets green. The CSS classes are now `worse` / `better` instead of `up` / `down`. ### Code - `ExpenseAnalysis` → **`AccountingAnalysis`** with `AnalyticsView` (Expenses, Income, Net, Assets), and `GetExpenseAnalysisAsync` → `GetAnalysisAsync`. The running year's last month now comes from all bookings, not just expenses. - `AnalyticsResult.Opening` gives the balance at the start of the range for Vermögen. - `charts.js`: the stacked bar chart takes an optional `totalLine`. ### Removed - The **Vermögen** chart page (`/Assets`) and its menu entry. Plotly is now only used by the booking-text charts on the Transactions page. ### Narrow screens At 400 px the page was wider than the screen. - **App-wide:** the side menu took half the screen. It now starts collapsed to icons below 700 px (`wwwroot/js/viewport.js`); the ☰ toggle still opens it. The header dropdowns are narrower, and the app name hides below 520 px. - **Analyse page:** button groups wrap, the tiles sit two per row, and in the year table the name column is narrower and pinned while the years scroll, with the full name as a tooltip. ## Test plan - [x] `dotnet build`: no warnings - [x] `dotnet test`: 88/88 pass, including 7 new `AccountingAnalysisTestShould` tests (income signs, net ordering, month-end balances with opening, balance at period end, FX conversion asked once, comparison at the same month, assets drill-down ends at the account) - [x] Against a copy of the real data, all matching the app's own reports: - Einnahmen 2026 = 109'865.13 ("Total Einkünfte" in the profit-and-loss report) - Netto 2026 = 32'859.06 (= 109'865.13 − 77'006.07) - Vermögen end of Oct 2026 = 263'994.98 ("Total Aktiven" in the Bilanz) - [x] Headless Chrome at 400, 820 and 1500 px: no horizontal overflow; menu collapsed at 400 px and expanded at 820 / 1500 px; pinned table column scrolls correctly; all charts render without console errors ## Note on the data (not a code issue) The Vermögen view shows each year as its books say. In the real data, some closing balances don't match the next year's opening balances. These are probably bookings added to a year after the next one was opened: - End of 2024 → 2025: Bargeld CHF (+40.75) - End of 2025 → 2026: Bargeld CHF (+98.50), TKB Privatkonto (+200.00), account 1042 (2'030.40 at the end of 2025, missing in 2026), Durchlaufskonto (−7.29) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
clayschaad added 1 commit 2026-10-22 16:39:03 +00:00
- View switch Ausgaben | Einnahmen | Netto | Vermögen (URL: view=).
  ExpenseAnalysis becomes AccountingAnalysis:
  - Income: bookings from income accounts positive, to them negative
  - Net: income positive, expenses negative, ordered by size; bar chart with
    a net line, savings-rate tile, no treemap (areas can't be negative)
  - Assets: month-end balances of asset accounts in CHF (foreign balances
    converted once per currency, like the balance sheet); periods take their
    last balance, drill-down ends at the account
- Change colours follow the view: more expenses red, more income/assets green
- Old Vermögen chart page and its menu entry removed
- Narrow screens: side menu starts collapsed below 700px, slimmer header,
  wrapping button groups, two KPI tiles per row, pinned name column in the
  year table

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clayschaad added 1 commit 2026-10-22 16:42:05 +00:00
Fluent sets a fixed 20px line height; the 24px tile values overflowed their
box by 6px, and the ellipsis-truncated "Grösster Posten" value cut off the
lower part of g, p, y. Use a relative line height for tile values.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clayschaad merged commit 9138f08287 into main 2026-10-22 16:42:43 +00:00
clayschaad deleted branch analytics-income-assets 2026-10-22 16:42:43 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: clayschaad/AccountingNext#6
No description provided.