Add "Strom" page for the yearly NeoVac electricity bills #9

Merged
clayschaad merged 6 commits from add-electricity-page into main 2026-10-27 18:40:53 +00:00
Owner

New Strom page (/electricity) for the yearly NeoVac electricity bills of the apartment.

What's in it

  • ElectricityBill model: period (Von/Bis), grid and PV kWh, grid and PV CHF, side costs. Computed: TotalKwh, PvShare, TotalChf, ChfPerKwh, GridChfPerKwh, PvChfPerKwh.
  • Stored per mandator, not per year: {DataPath}/{mandator}/electricity.json, because the billing period runs 1 July to 30 June. New ISettingsService.GetMandatorPath() and a BaseRepository.SaveAsync overload that takes a directory.
  • ElectricityBillRepository (list, get, save, delete) and support for electricity.json in the JSON editor (RawDataRepository reads and writes it in the mandator folder).
  • Page layout: "Neue Abrechnung hinzufügen" button, then the charts, then the list of bills. The add/edit dialog has a help image ("Woher kommen die Werte?") showing where each value is on the NeoVac bill.
  • Charts per calendar half-year (ElectricityHalfYear): each bill is spread evenly over the months of its period, so a yearly bill gives half to each of its two half-years. Half-years without a bill show as gaps.
    • kWh per half-year, stacked Netz/PV
    • CHF/kWh for Netz, PV and Total
    • total CHF per half-year
  • charts.js: stackedBar and line accept an optional unit and axisDecimals; without them they still show whole CHF, so the Analyse charts are unchanged.
  • Akonto and Saldo were removed again from the model and the UI.

Also in this branch

  • Directory.Build.props targets net10.0 instead of net9.0.
  • appsettings.Development.json: DataPath points to D:\Developer\AccountingData (Windows), the Linux path is kept as DataPath_.

Tests

New ElectricityBillTestShould, ElectricityBillRepositoryTestShould and ElectricityHalfYearTestShould; RawDataRepositoryTestShould and SettingsServiceTestShould extended. All 133 tests pass.

🤖 Generated with Claude Code

New **Strom** page (`/electricity`) for the yearly NeoVac electricity bills of the apartment. ## What's in it - **`ElectricityBill`** model: period (Von/Bis), grid and PV kWh, grid and PV CHF, side costs. Computed: `TotalKwh`, `PvShare`, `TotalChf`, `ChfPerKwh`, `GridChfPerKwh`, `PvChfPerKwh`. - **Stored per mandator**, not per year: `{DataPath}/{mandator}/electricity.json`, because the billing period runs 1 July to 30 June. New `ISettingsService.GetMandatorPath()` and a `BaseRepository.SaveAsync` overload that takes a directory. - **`ElectricityBillRepository`** (list, get, save, delete) and support for `electricity.json` in the JSON editor (`RawDataRepository` reads and writes it in the mandator folder). - **Page layout:** "Neue Abrechnung hinzufügen" button, then the charts, then the list of bills. The add/edit dialog has a help image ("Woher kommen die Werte?") showing where each value is on the NeoVac bill. - **Charts per calendar half-year** (`ElectricityHalfYear`): each bill is spread evenly over the months of its period, so a yearly bill gives half to each of its two half-years. Half-years without a bill show as gaps. - kWh per half-year, stacked Netz/PV - CHF/kWh for Netz, PV and Total - total CHF per half-year - `charts.js`: `stackedBar` and `line` accept an optional `unit` and `axisDecimals`; without them they still show whole CHF, so the Analyse charts are unchanged. - Akonto and Saldo were removed again from the model and the UI. ## Also in this branch - `Directory.Build.props` targets **net10.0** instead of net9.0. - `appsettings.Development.json`: `DataPath` points to `D:\Developer\AccountingData` (Windows), the Linux path is kept as `DataPath_`. ## Tests New `ElectricityBillTestShould`, `ElectricityBillRepositoryTestShould` and `ElectricityHalfYearTestShould`; `RawDataRepositoryTestShould` and `SettingsServiceTestShould` extended. All 133 tests pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
clayschaad added 6 commits 2026-10-27 18:36:42 +00:00
A new page (/electricity) to record one electricity bill per billing
period (1 July-30 June) with a grid, add/edit dialog, and two Chart.js
charts (kWh split grid/PV per period, CHF/kWh as a line).

- ElectricityBill (Common): Grid/PV kWh and CHF, side costs, advance
  payment; computed TotalKwh, PvShare, TotalChf, Balance, ChfPerKwh.
- Stored once per mandator at {DataPath}/{mandator}/electricity.json
  instead of per year, since the billing period doesn't align with
  calendar years (new ISettingsService.GetMandatorPath(),
  BaseRepository gets a directory-aware SaveAsync overload).
- electricity.json is also editable through the JSON editor
  (RawDataRepository).
- charts.js: stackedBar/line charts can now show a unit other than
  CHF (defaults to CHF, so the Analyse page is unaffected).
- The add/edit dialog links to an annotated example (SVG, placeholder
  data) showing which value on the real NeoVac bill goes into which
  field; opens in its own dialog since the main dialog has a fixed
  height.
- Tests for the computed properties and the new repositories.

Also bumps the TargetFramework to net10.0 and updates the local
DataPath in appsettings.Development.json.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The price-per-kWh line only showed the blended total; add GridChfPerKwh
and PvChfPerKwh (null when there was no draw/consumption of that kind,
so the chart shows a gap instead of a misleading 0) and plot Netz, PV
and Total as separate lines.

Also fixes the y-axis: ticks used a fixed 0-decimal formatter, so
CHF/kWh values (well under 1) all rounded to "0". charts.js now takes
an optional data.axisDecimals (defaults to 0, so the Analyse page is
unaffected); the Strom page passes 2 for its CHF/kWh chart.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
A third chart below the existing pair, plotting ElectricityBill.TotalChf
per period.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each bill's values are spread evenly over the months of its period and
summed per calendar half-year, so a yearly July-June bill contributes
half to each of its two halves. Half-years without a bill appear as gaps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drop the advance payment (AdvanceChf) and the computed Balance from
ElectricityBill, the Strom list, the edit dialog and the help image.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clayschaad merged commit a6e479094e into main 2026-10-27 18:40:53 +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#9
No description provided.