diff --git a/CLAUDE.md b/CLAUDE.md index c25b8da..735af40 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -64,7 +64,7 @@ When a new year is opened, the previous year's data is copied as the starting po - **RawDataRepository** — plain-text load/save of the data files for the JSON editor page; validates (strict JSON, unique Ids, account references), refuses if the file changed since loading, and backs up the old version to `backup/{mandator}/{year}/json-{timestamp}/`; for `electricity.json` it reads/writes the mandator folder instead of the year folder - **Texte bereinigen** page (`TextCleanup`) — edits only the `Text` of one account's bookings in the selected year (inline, search/replace via `TextReplacement`, bulk set); saves through `RawDataRepository.SaveTransactionTextsAsync` - **AnalyticsService** — loads all years of the current mandator (via `MultiYearRepository`) into an `AccountingAnalysis` (expenses, income, net, assets) for the Analyse page; queries run in memory -- **Strom** page (`Electricity`, `/electricity`) — grid and dialog (FluentDataGrid/`ElectricityBillDialog`) over `IElectricityBillRepository`'s `ElectricityBill` records (one yearly NeoVac bill each: kWh/CHF for grid and PV, side costs, advance payment; `TotalKwh`, `PvShare`, `TotalChf`, `Balance`, `ChfPerKwh` are computed); two Chart.js charts via `ChartJsChart` (stacked kWh per period, CHF/kWh line) +- **Strom** page (`Electricity`, `/electricity`) — grid and dialog (FluentDataGrid/`ElectricityBillDialog`) over `IElectricityBillRepository`'s `ElectricityBill` records (one yearly NeoVac bill each: kWh/CHF for grid and PV, side costs; `TotalKwh`, `PvShare`, `TotalChf`, `ChfPerKwh` are computed); three Chart.js charts via `ChartJsChart`, one value per calendar half-year (`ElectricityHalfYear` spreads each bill evenly over its months): stacked kWh, CHF/kWh lines, total CHF ### UI structure diff --git a/Schaad.Accounting.Common/Models/ElectricityBill.cs b/Schaad.Accounting.Common/Models/ElectricityBill.cs index fd1d8de..04edc59 100644 --- a/Schaad.Accounting.Common/Models/ElectricityBill.cs +++ b/Schaad.Accounting.Common/Models/ElectricityBill.cs @@ -36,9 +36,6 @@ namespace Schaad.Accounting.Models [Display(Name = "Nebenkosten")] public decimal SideCostsChf { get; set; } - [Display(Name = "Akonto")] - public decimal AdvanceChf { get; set; } - /// Grid draw plus own PV consumption, in kWh. [JsonIgnore] [Display(Name = "Total")] @@ -49,16 +46,11 @@ namespace Schaad.Accounting.Models [Display(Name = "PV-Anteil")] public decimal PvShare => TotalKwh == 0 ? 0 : PvKwh / TotalKwh; - /// Grid, PV and side costs added up, before the advance payment. + /// Grid, PV and side costs added up. [JsonIgnore] [Display(Name = "Total")] public decimal TotalChf => GridChf + PvChf + SideCostsChf; - /// What is still owed (positive) or was overpaid (negative) after the advance. - [JsonIgnore] - [Display(Name = "Saldo")] - public decimal Balance => TotalChf - AdvanceChf; - /// Average price per kWh over the whole period. [JsonIgnore] [Display(Name = "CHF/kWh")] diff --git a/Schaad.Accounting.Common/Models/ElectricityHalfYear.cs b/Schaad.Accounting.Common/Models/ElectricityHalfYear.cs index c03758c..3742efc 100644 --- a/Schaad.Accounting.Common/Models/ElectricityHalfYear.cs +++ b/Schaad.Accounting.Common/Models/ElectricityHalfYear.cs @@ -51,7 +51,6 @@ namespace Schaad.Accounting.Models sum.GridChf += bill.GridChf * share; sum.PvChf += bill.PvChf * share; sum.SideCostsChf += bill.SideCostsChf * share; - sum.AdvanceChf += bill.AdvanceChf * share; } } diff --git a/Schaad.Accounting.Tests/ElectricityBillRepositoryTestShould.cs b/Schaad.Accounting.Tests/ElectricityBillRepositoryTestShould.cs index 3b2e687..016eaba 100644 --- a/Schaad.Accounting.Tests/ElectricityBillRepositoryTestShould.cs +++ b/Schaad.Accounting.Tests/ElectricityBillRepositoryTestShould.cs @@ -49,28 +49,27 @@ public class ElectricityBillRepositoryTestShould : IDisposable PvKwh = 1936.328m, GridChf = 1009.55m, PvChf = 544.10m, - SideCostsChf = 134.30m, - AdvanceChf = 1212.00m + SideCostsChf = 134.30m }; await sut.SaveElectricityBillAsync(bill); var stored = (await sut.GetElectricityBillListAsync()).Single(); stored.Id.ShouldNotBeNullOrEmpty(); - stored.Balance.ShouldBe(475.95m); + stored.TotalChf.ShouldBe(1687.95m); } [Fact] public async Task UpdateInPlaceWhenSavingBillWithExistingId() { - await sut.SaveElectricityBillAsync(new ElectricityBill { PeriodFrom = new DateOnly(2023, 7, 1), PeriodTo = new DateOnly(2024, 6, 30), AdvanceChf = 1000m }); + await sut.SaveElectricityBillAsync(new ElectricityBill { PeriodFrom = new DateOnly(2023, 7, 1), PeriodTo = new DateOnly(2024, 6, 30), GridKwh = 1000m }); var id = (await sut.GetElectricityBillListAsync()).Single().Id; - await sut.SaveElectricityBillAsync(new ElectricityBill { Id = id, PeriodFrom = new DateOnly(2023, 7, 1), PeriodTo = new DateOnly(2024, 6, 30), AdvanceChf = 1300m }); + await sut.SaveElectricityBillAsync(new ElectricityBill { Id = id, PeriodFrom = new DateOnly(2023, 7, 1), PeriodTo = new DateOnly(2024, 6, 30), GridKwh = 1300m }); var bills = await sut.GetElectricityBillListAsync(); bills.Count.ShouldBe(1); - bills[0].AdvanceChf.ShouldBe(1300m); + bills[0].GridKwh.ShouldBe(1300m); } [Fact] diff --git a/Schaad.Accounting.Tests/ElectricityBillTestShould.cs b/Schaad.Accounting.Tests/ElectricityBillTestShould.cs index 2119756..22ea132 100644 --- a/Schaad.Accounting.Tests/ElectricityBillTestShould.cs +++ b/Schaad.Accounting.Tests/ElectricityBillTestShould.cs @@ -37,23 +37,6 @@ public class ElectricityBillTestShould bill.TotalChf.ShouldBe(1687.95m); } - [Fact] - public void CalculateBalanceWhenAdvanceIsSubtractedFromTotal() - { - var bill = new ElectricityBill - { - GridKwh = 3419.432m, - PvKwh = 1936.328m, - GridChf = 1009.55m, - PvChf = 544.10m, - SideCostsChf = 134.30m, - AdvanceChf = 1212.00m - }; - - bill.TotalChf.ShouldBe(1687.95m); - bill.Balance.ShouldBe(475.95m); - } - [Fact] public void DivideTotalChfByTotalKwhWhenCalculatingChfPerKwh() { diff --git a/Schaad.Accounting.Tests/ElectricityHalfYearTestShould.cs b/Schaad.Accounting.Tests/ElectricityHalfYearTestShould.cs index 8a8b525..febdd09 100644 --- a/Schaad.Accounting.Tests/ElectricityHalfYearTestShould.cs +++ b/Schaad.Accounting.Tests/ElectricityHalfYearTestShould.cs @@ -14,7 +14,6 @@ public class ElectricityHalfYearTestShould bill.GridChf = 900m; bill.PvChf = 400m; bill.SideCostsChf = 100m; - bill.AdvanceChf = 1200m; var halves = ElectricityHalfYear.FromBills([bill]); @@ -28,7 +27,6 @@ public class ElectricityHalfYearTestShould half.Bill.GridChf.ShouldBe(450m); half.Bill.PvChf.ShouldBe(200m); half.Bill.SideCostsChf.ShouldBe(50m); - half.Bill.AdvanceChf.ShouldBe(600m); } } diff --git a/Schaad.Accounting.UI/Components/Pages/Dialogs/ElectricityBillDialog.razor b/Schaad.Accounting.UI/Components/Pages/Dialogs/ElectricityBillDialog.razor index 20dbb4d..76e588f 100644 --- a/Schaad.Accounting.UI/Components/Pages/Dialogs/ElectricityBillDialog.razor +++ b/Schaad.Accounting.UI/Components/Pages/Dialogs/ElectricityBillDialog.razor @@ -27,7 +27,6 @@ -
@@ -35,8 +34,7 @@
- Total @Chf(Content.TotalChf), Akonto @Chf(Content.AdvanceChf) → Saldo @Chf(Content.Balance) - (@(Content.Balance >= 0 ? "Nachzahlung" : "Gutschrift")) + Total @Chf(Content.TotalChf)
diff --git a/Schaad.Accounting.UI/Components/Pages/Electricity.razor b/Schaad.Accounting.UI/Components/Pages/Electricity.razor index f598099..71f582a 100644 --- a/Schaad.Accounting.UI/Components/Pages/Electricity.razor +++ b/Schaad.Accounting.UI/Components/Pages/Electricity.razor @@ -47,11 +47,6 @@ - - - @Chf(context.Balance) - - diff --git a/Schaad.Accounting.UI/Components/Pages/Electricity.razor.cs b/Schaad.Accounting.UI/Components/Pages/Electricity.razor.cs index 695a92e..6482c3e 100644 --- a/Schaad.Accounting.UI/Components/Pages/Electricity.razor.cs +++ b/Schaad.Accounting.UI/Components/Pages/Electricity.razor.cs @@ -1,4 +1,3 @@ -using System.Globalization; using Microsoft.AspNetCore.Components; using Microsoft.FluentUI.AspNetCore.Components; using Schaad.Accounting.Interfaces; @@ -16,8 +15,6 @@ namespace Schaad.Accounting.UI.Components.Pages; /// public partial class Electricity : ComponentBase { - private static readonly CultureInfo SwissNumbers = CreateSwissNumbers(); - [Inject] private IElectricityBillRepository electricityBillRepository { get; set; } = null!; @@ -138,13 +135,4 @@ public partial class Electricity : ComponentBase } private static string FullLabel(ElectricityBill bill) => $"{bill.PeriodFrom:dd.MM.yyyy} – {bill.PeriodTo:dd.MM.yyyy}"; - - private static string Chf(decimal value) => value.ToString("#,0.00", SwissNumbers) + " CHF"; - - private static CultureInfo CreateSwissNumbers() - { - var culture = new CultureInfo("de-CH"); - culture.NumberFormat.NumberGroupSeparator = "'"; - return culture; - } } diff --git a/Schaad.Accounting.UI/Components/Pages/Electricity.razor.css b/Schaad.Accounting.UI/Components/Pages/Electricity.razor.css index 3b2b4a5..658a09f 100644 --- a/Schaad.Accounting.UI/Components/Pages/Electricity.razor.css +++ b/Schaad.Accounting.UI/Components/Pages/Electricity.razor.css @@ -8,14 +8,6 @@ overflow-x: auto; } -.due { - color: #c50f1f; -} - -.credit { - color: #107c10; -} - .pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); diff --git a/Schaad.Accounting.UI/wwwroot/images/electricity-bill-guide.svg b/Schaad.Accounting.UI/wwwroot/images/electricity-bill-guide.svg index 1e3c619..de41d40 100644 --- a/Schaad.Accounting.UI/wwwroot/images/electricity-bill-guide.svg +++ b/Schaad.Accounting.UI/wwwroot/images/electricity-bill-guide.svg @@ -1,7 +1,7 @@ - + Beispiel-Abrechnung: Wo stehen die Werte? - + Beispiel: Wo stehen die Werte auf der Abrechnung? Platzhalterwerte – der Aufbau entspricht dem Abschnitt „Ihre Abrechnung vom …“ der NeoVac-Abrechnung. @@ -44,18 +44,9 @@ 80.00 → Nebenkosten (CHF) - - Akontozahlungen Strom - - -600.00 - → Akonto (CHF), ohne Minus eingeben - - + - Stromkosten (wird berechnet) - 680.00 - - Saldo (wird berechnet) - 80.00 + Stromkosten (wird berechnet) + 680.00