From 1e9e19ebad1c178e295506ac7c5584fc34018474 Mon Sep 17 00:00:00 2001 From: Claudio Schaad Date: Fri, 30 Oct 2026 20:56:18 +0100 Subject: [PATCH] Add "Wasser" page for the water bills Same layout as the Strom page: grid and dialog for the bills (warm and cold water in m3 and CHF, base costs; total m3 and CHF are computed), stored per mandator in water.json, and charts for consumption and total costs with the period toggle (bill, calendar year, half-year). The period grouping is now generic: ElectricityPeriod becomes BillPeriod over IPeriodBill, implemented by ElectricityBill and WaterBill. water.json can be edited in the JSON editor. Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 8 +- .../Interfaces/ISettingsService.cs | 2 +- .../Interfaces/IWaterBillRepository.cs | 17 ++ .../{ElectricityPeriod.cs => BillPeriod.cs} | 40 ++--- .../Models/ElectricityBill.cs | 11 +- .../Models/IPeriodBill.cs | 18 ++ Schaad.Accounting.Common/Models/WaterBill.cs | 63 +++++++ .../Repositories/RawDataRepository.cs | 11 +- .../Repositories/WaterBillRepository.cs | 56 +++++++ ...dTestShould.cs => BillPeriodTestShould.cs} | 39 +++-- .../RawDataRepositoryTestShould.cs | 18 ++ .../WaterBillRepositoryTestShould.cs | 94 +++++++++++ .../WaterBillTestShould.cs | 53 ++++++ .../Components/Layout/NavMenu.razor | 1 + .../Pages/Dialogs/WaterBillDialog.razor | 51 ++++++ .../Pages/Dialogs/WaterBillDialog.razor.cs | 66 ++++++++ .../Components/Pages/Electricity.razor.cs | 22 +-- .../Components/Pages/Water.razor | 67 ++++++++ .../Components/Pages/Water.razor.cs | 154 ++++++++++++++++++ .../Components/Pages/Water.razor.css | 43 +++++ Schaad.Accounting.UI/Extensions.cs | 1 + 21 files changed, 779 insertions(+), 56 deletions(-) create mode 100644 Schaad.Accounting.Common/Interfaces/IWaterBillRepository.cs rename Schaad.Accounting.Common/Models/{ElectricityPeriod.cs => BillPeriod.cs} (70%) create mode 100644 Schaad.Accounting.Common/Models/IPeriodBill.cs create mode 100644 Schaad.Accounting.Common/Models/WaterBill.cs create mode 100644 Schaad.Accounting.Db/Repositories/WaterBillRepository.cs rename Schaad.Accounting.Tests/{ElectricityPeriodTestShould.cs => BillPeriodTestShould.cs} (66%) create mode 100644 Schaad.Accounting.Tests/WaterBillRepositoryTestShould.cs create mode 100644 Schaad.Accounting.Tests/WaterBillTestShould.cs create mode 100644 Schaad.Accounting.UI/Components/Pages/Dialogs/WaterBillDialog.razor create mode 100644 Schaad.Accounting.UI/Components/Pages/Dialogs/WaterBillDialog.razor.cs create mode 100644 Schaad.Accounting.UI/Components/Pages/Water.razor create mode 100644 Schaad.Accounting.UI/Components/Pages/Water.razor.cs create mode 100644 Schaad.Accounting.UI/Components/Pages/Water.razor.css diff --git a/CLAUDE.md b/CLAUDE.md index 8497e0d..ae03263 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -47,13 +47,14 @@ Data is multi-mandator and multi-year. The layout below `DataPath` (configured i ``` {DataPath}/{mandator}/{year}/*.json data files {DataPath}/{mandator}/electricity.json electricity bills (not per year, see below) +{DataPath}/{mandator}/water.json water bills (not per year, see below) {DataPath}/uploads/{mandator}/{year}/ imported bank statements (+ creditCard/) {DataPath}/backup/{mandator}/{year}/ backup zips ``` When a new year is opened, the previous year's data is copied as the starting point. -`electricity.json` is the one data file kept per mandator instead of per year (`ISettingsService.GetMandatorPath()`), because the NeoVac billing period runs 1 July–30 June and doesn't align with calendar years. +`electricity.json` and `water.json` are the data files kept per mandator instead of per year (`ISettingsService.GetMandatorPath()`), because the NeoVac billing period runs 1 July–30 June and doesn't align with calendar years. ### Key services @@ -61,10 +62,11 @@ When a new year is opened, the previous year's data is copied as the starting po - **FileService** — imports bank statements (MT940, CAMT053 via external `Schaad.Finance.dll`), parses PDFs, manages backups - **ChartService** — produces data for the Plotly booking-text charts on the transactions page - **SettingsService** — manages the active year, mandator, and file paths -- **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 +- **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` and `water.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; `TotalKwh`, `PvShare`, `TotalChf`, `ChfPerKwh` are computed); three Chart.js charts via `ChartJsChart` (stacked kWh, CHF/kWh lines, total CHF), grouped by a toggle per bill (default), calendar year or half-year (`ElectricityPeriod.FromBills`; a bill reaching over several periods is spread evenly over its months and the page shows a note) +- **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` (stacked kWh, CHF/kWh lines, total CHF), grouped by a toggle per bill (default), calendar year or half-year (`BillPeriod.FromBills` over `IPeriodBill`; a bill reaching over several periods is spread evenly over its months and the page shows a note) +- **Wasser** page (`Water`, `/water`) — same layout as Strom over `IWaterBillRepository`'s `WaterBill` records (warm/cold water m³ and CHF, base costs; `TotalM3`, `WarmWaterShare`, `TotalChf` are computed); two charts (stacked m³, total CHF) with the same period toggle ### UI structure diff --git a/Schaad.Accounting.Common/Interfaces/ISettingsService.cs b/Schaad.Accounting.Common/Interfaces/ISettingsService.cs index ec1f6d8..c20f398 100644 --- a/Schaad.Accounting.Common/Interfaces/ISettingsService.cs +++ b/Schaad.Accounting.Common/Interfaces/ISettingsService.cs @@ -28,7 +28,7 @@ namespace Schaad.Accounting.Interfaces /// /// The mandator's folder, above the per-year folders. For data that is not kept per - /// year (e.g. the electricity bills, whose period doesn't align with calendar years). + /// year (e.g. the electricity and water bills, whose period doesn't align with calendar years). /// string GetMandatorPath(); diff --git a/Schaad.Accounting.Common/Interfaces/IWaterBillRepository.cs b/Schaad.Accounting.Common/Interfaces/IWaterBillRepository.cs new file mode 100644 index 0000000..0f62585 --- /dev/null +++ b/Schaad.Accounting.Common/Interfaces/IWaterBillRepository.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Schaad.Accounting.Models; + +namespace Schaad.Accounting.Interfaces +{ + public interface IWaterBillRepository + { + Task> GetWaterBillListAsync(); + + Task SaveWaterBillAsync(WaterBill bill); + + Task GetWaterBillAsync(string id); + + Task DeleteWaterBillAsync(string id); + } +} diff --git a/Schaad.Accounting.Common/Models/ElectricityPeriod.cs b/Schaad.Accounting.Common/Models/BillPeriod.cs similarity index 70% rename from Schaad.Accounting.Common/Models/ElectricityPeriod.cs rename to Schaad.Accounting.Common/Models/BillPeriod.cs index 244452e..7f1c539 100644 --- a/Schaad.Accounting.Common/Models/ElectricityPeriod.cs +++ b/Schaad.Accounting.Common/Models/BillPeriod.cs @@ -4,8 +4,8 @@ using System.Linq; namespace Schaad.Accounting.Models { - /// How the electricity bills are grouped for the charts on the Strom page. - public enum ElectricityPeriodKind + /// How bills are grouped for the charts on the Strom and Wasser pages. + public enum BillPeriodKind { /// One entry per bill, exactly as entered. Bill, @@ -18,18 +18,18 @@ namespace Schaad.Accounting.Models } /// - /// One period of electricity bills, for the charts on the Strom page. holds + /// One period of bills, for the charts on the Strom and Wasser pages. holds /// the bill values that fall into this period, or is null if no bill covers it. /// - public class ElectricityPeriod + public class BillPeriod where T : class, IPeriodBill, new() { - public ElectricityPeriodKind Kind { get; init; } + public BillPeriodKind Kind { get; init; } public DateOnly From { get; init; } public DateOnly To { get; init; } - public ElectricityBill Bill { get; init; } + public T Bill { get; init; } /// /// True if the values were (partly) spread from a bill whose period reaches beyond this one, @@ -40,32 +40,32 @@ namespace Schaad.Accounting.Models /// Short label for a chart axis, e.g. "23/24", "2024" or "H2 23". public string Label => Kind switch { - ElectricityPeriodKind.Year => From.Year.ToString(), - ElectricityPeriodKind.HalfYear => $"H{(From.Month <= 6 ? 1 : 2)} {From:yy}", + BillPeriodKind.Year => From.Year.ToString(), + BillPeriodKind.HalfYear => $"H{(From.Month <= 6 ? 1 : 2)} {From:yy}", _ => IsWholeBillingYear ? $"{From:yy}/{To:yy}" : $"{From:dd.MM.yy}–{To:dd.MM.yy}" }; private bool IsWholeBillingYear => From.Day == 1 && To == From.AddYears(1).AddDays(-1); /// - /// Groups the bills by . With + /// Groups the bills by . With /// each bill is its own period. Otherwise the result runs from the first to the last covered /// calendar period (periods in between that no bill covers are included with a null Bill), /// and a bill's values are spread evenly over the months of its period, so a yearly bill /// (1 July – 30 June) contributes exactly half to each of its two half-years or calendar years. /// - public static List FromBills(IEnumerable bills, ElectricityPeriodKind kind) + public static List> FromBills(IEnumerable bills, BillPeriodKind kind) { - if (kind == ElectricityPeriodKind.Bill) + if (kind == BillPeriodKind.Bill) { return bills .OrderBy(b => b.PeriodFrom) - .Select(b => new ElectricityPeriod { Kind = kind, From = b.PeriodFrom, To = b.PeriodTo, Bill = b }) + .Select(b => new BillPeriod { Kind = kind, From = b.PeriodFrom, To = b.PeriodTo, Bill = b }) .ToList(); } - var length = kind == ElectricityPeriodKind.Year ? 12 : 6; - var sums = new SortedDictionary(); + var length = kind == BillPeriodKind.Year ? 12 : 6; + var sums = new SortedDictionary(); var split = new HashSet(); foreach (var bill in bills) { @@ -84,29 +84,25 @@ namespace Schaad.Accounting.Models var share = (decimal)period.Count() / months; if (!sums.TryGetValue(period.Key, out var sum)) { - sum = new ElectricityBill { PeriodFrom = period.Key, PeriodTo = period.Key.AddMonths(length).AddDays(-1) }; + sum = new T { PeriodFrom = period.Key, PeriodTo = period.Key.AddMonths(length).AddDays(-1) }; sums[period.Key] = sum; } if (monthsPerPeriod.Count > 1) { split.Add(period.Key); } - sum.GridKwh += bill.GridKwh * share; - sum.PvKwh += bill.PvKwh * share; - sum.GridChf += bill.GridChf * share; - sum.PvChf += bill.PvChf * share; - sum.SideCostsChf += bill.SideCostsChf * share; + sum.AddShare(bill, share); } } - var result = new List(); + var result = new List>(); if (sums.Count == 0) { return result; } for (var start = sums.Keys.First(); start <= sums.Keys.Last(); start = start.AddMonths(length)) { - result.Add(new ElectricityPeriod + result.Add(new BillPeriod { Kind = kind, From = start, diff --git a/Schaad.Accounting.Common/Models/ElectricityBill.cs b/Schaad.Accounting.Common/Models/ElectricityBill.cs index 04edc59..da12877 100644 --- a/Schaad.Accounting.Common/Models/ElectricityBill.cs +++ b/Schaad.Accounting.Common/Models/ElectricityBill.cs @@ -9,7 +9,7 @@ namespace Schaad.Accounting.Models /// 1 July – 30 June, so these are not stored per calendar year like the other data files /// (see ElectricityBillRepository in Schaad.Accounting.Db). /// - public class ElectricityBill + public class ElectricityBill : IPeriodBill { public string Id { get; set; } @@ -65,5 +65,14 @@ namespace Schaad.Accounting.Models [JsonIgnore] [Display(Name = "CHF/kWh PV")] public decimal? PvChfPerKwh => PvKwh == 0 ? null : PvChf / PvKwh; + + public void AddShare(ElectricityBill other, decimal share) + { + GridKwh += other.GridKwh * share; + PvKwh += other.PvKwh * share; + GridChf += other.GridChf * share; + PvChf += other.PvChf * share; + SideCostsChf += other.SideCostsChf * share; + } } } diff --git a/Schaad.Accounting.Common/Models/IPeriodBill.cs b/Schaad.Accounting.Common/Models/IPeriodBill.cs new file mode 100644 index 0000000..1008787 --- /dev/null +++ b/Schaad.Accounting.Common/Models/IPeriodBill.cs @@ -0,0 +1,18 @@ +using System; + +namespace Schaad.Accounting.Models +{ + /// + /// A bill over a period (e.g. the yearly NeoVac electricity or water bill), so it can be + /// grouped into calendar periods by . + /// + public interface IPeriodBill + { + DateOnly PeriodFrom { get; set; } + + DateOnly PeriodTo { get; set; } + + /// Adds (0..1) of the other bill's values to this one. + void AddShare(T other, decimal share); + } +} diff --git a/Schaad.Accounting.Common/Models/WaterBill.cs b/Schaad.Accounting.Common/Models/WaterBill.cs new file mode 100644 index 0000000..430a2e1 --- /dev/null +++ b/Schaad.Accounting.Common/Models/WaterBill.cs @@ -0,0 +1,63 @@ +using System; +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; + +namespace Schaad.Accounting.Models +{ + /// + /// One water bill for the apartment. Like the electricity bills, these are stored once per + /// mandator instead of per calendar year, because the billing period (e.g. 1 July – 30 June) + /// doesn't align with calendar years (see WaterBillRepository in Schaad.Accounting.Db). + /// + public class WaterBill : IPeriodBill + { + public string Id { get; set; } + + [Display(Name = "Von")] + [Required] + public DateOnly PeriodFrom { get; set; } + + [Display(Name = "Bis")] + [Required] + public DateOnly PeriodTo { get; set; } + + [Display(Name = "Warmwasser")] + public decimal WarmWaterM3 { get; set; } + + [Display(Name = "Kaltwasser")] + public decimal ColdWaterM3 { get; set; } + + [Display(Name = "Warmwasser")] + public decimal WarmWaterChf { get; set; } + + [Display(Name = "Kaltwasser")] + public decimal ColdWaterChf { get; set; } + + [Display(Name = "Grundkosten")] + public decimal BaseCostsChf { get; set; } + + /// Warm plus cold water, in m³. + [JsonIgnore] + [Display(Name = "Total")] + public decimal TotalM3 => WarmWaterM3 + ColdWaterM3; + + /// Share of the consumption that was warm water, 0..1. + [JsonIgnore] + [Display(Name = "Warmwasser-Anteil")] + public decimal WarmWaterShare => TotalM3 == 0 ? 0 : WarmWaterM3 / TotalM3; + + /// Warm water, cold water and base costs added up. + [JsonIgnore] + [Display(Name = "Total")] + public decimal TotalChf => WarmWaterChf + ColdWaterChf + BaseCostsChf; + + public void AddShare(WaterBill other, decimal share) + { + WarmWaterM3 += other.WarmWaterM3 * share; + ColdWaterM3 += other.ColdWaterM3 * share; + WarmWaterChf += other.WarmWaterChf * share; + ColdWaterChf += other.ColdWaterChf * share; + BaseCostsChf += other.BaseCostsChf * share; + } + } +} diff --git a/Schaad.Accounting.Db/Repositories/RawDataRepository.cs b/Schaad.Accounting.Db/Repositories/RawDataRepository.cs index fa85658..aefde5e 100644 --- a/Schaad.Accounting.Db/Repositories/RawDataRepository.cs +++ b/Schaad.Accounting.Db/Repositories/RawDataRepository.cs @@ -26,6 +26,7 @@ namespace Schaad.Accounting.Repositories private const string ACCOUNTS = "Accounts.json"; private const string TRANSACTIONS = "Transactions.json"; private const string ELECTRICITY = "electricity.json"; + private const string WATER = "water.json"; private const int MaxErrors = 20; // Like the normal options, but property names that don't exist (typos) are errors instead @@ -49,7 +50,8 @@ namespace Schaad.Accounting.Repositories "BookingTexts.json", "SplitPredefinitions.json", "SubClasses.json", - ELECTRICITY + ELECTRICITY, + WATER ]; public async Task LoadAsync(string fileName) @@ -69,6 +71,7 @@ namespace Schaad.Accounting.Repositories "SplitPredefinitions.json" => SaveAsync(fileName, text, loadedHash), "SubClasses.json" => SaveAsync(fileName, text, loadedHash), ELECTRICITY => SaveAsync(fileName, text, loadedHash), + WATER => SaveAsync(fileName, text, loadedHash), _ => throw new ArgumentException($"Unknown data file '{fileName}'", nameof(fileName)) }; @@ -239,10 +242,10 @@ namespace Schaad.Accounting.Repositories return Path.Combine(DirectoryOf(fileName), fileName); } - // electricity.json lives at the mandator level, not per year (its period runs 1 July – - // 30 June, so it doesn't align with calendar years). + // electricity.json and water.json live at the mandator level, not per year (their period + // runs 1 July – 30 June, so it doesn't align with calendar years). private string DirectoryOf(string fileName) - => fileName == ELECTRICITY ? settingsService.GetMandatorPath() : settingsService.GetDbPath(); + => fileName is ELECTRICITY or WATER ? settingsService.GetMandatorPath() : settingsService.GetDbPath(); private static string Hash(byte[] bytes) => Convert.ToHexString(SHA256.HashData(bytes)); diff --git a/Schaad.Accounting.Db/Repositories/WaterBillRepository.cs b/Schaad.Accounting.Db/Repositories/WaterBillRepository.cs new file mode 100644 index 0000000..8a6091f --- /dev/null +++ b/Schaad.Accounting.Db/Repositories/WaterBillRepository.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using Schaad.Accounting.Interfaces; +using Schaad.Accounting.Models; + +namespace Schaad.Accounting.Repositories +{ + /// + /// Water bills of the current mandator, stored once per mandator (not per year like the + /// other data files) because the billing period doesn't align with calendar years. + /// + public class WaterBillRepository : BaseRepository, IWaterBillRepository + { + private const string WATER = "water.json"; + + public WaterBillRepository(ISettingsService settingsService, RepositoryCache cache, ILogger logger) + : base(settingsService, cache, logger) + { + } + + public Task> GetWaterBillListAsync() + => LoadListAsync(settingsService.GetMandatorPath(), WATER); + + public async Task SaveWaterBillAsync(WaterBill bill) + { + var bills = await GetWaterBillListAsync(); + var idx = bills.FindIndex(b => b.Id == bill.Id); + if (idx >= 0) + { + bills[idx] = bill; + } + else + { + bill.Id = Guid.NewGuid().ToString(); + bills.Add(bill); + } + await SaveAsync(bills, settingsService.GetMandatorPath(), WATER); + } + + public async Task GetWaterBillAsync(string id) + { + var bills = await GetWaterBillListAsync(); + return bills.FirstOrDefault(b => b.Id == id); + } + + public async Task DeleteWaterBillAsync(string id) + { + var bills = await GetWaterBillListAsync(); + bills.RemoveAll(b => b.Id == id); + await SaveAsync(bills, settingsService.GetMandatorPath(), WATER); + } + } +} diff --git a/Schaad.Accounting.Tests/ElectricityPeriodTestShould.cs b/Schaad.Accounting.Tests/BillPeriodTestShould.cs similarity index 66% rename from Schaad.Accounting.Tests/ElectricityPeriodTestShould.cs rename to Schaad.Accounting.Tests/BillPeriodTestShould.cs index ee2cd48..c471ebb 100644 --- a/Schaad.Accounting.Tests/ElectricityPeriodTestShould.cs +++ b/Schaad.Accounting.Tests/BillPeriodTestShould.cs @@ -3,7 +3,7 @@ using Shouldly; namespace Schaad.Accounting.Tests; -public class ElectricityPeriodTestShould +public class BillPeriodTestShould { [Fact] public void KeepEachBillUnchangedWhenGroupingPerBill() @@ -11,7 +11,7 @@ public class ElectricityPeriodTestShould var later = YearlyBill(2024); var first = YearlyBill(2023); - var periods = ElectricityPeriod.FromBills([later, first], ElectricityPeriodKind.Bill); + var periods = BillPeriod.FromBills([later, first], BillPeriodKind.Bill); periods.Select(p => p.Bill).ShouldBe([first, later]); periods.ShouldAllBe(p => !p.IsSplit); @@ -20,7 +20,7 @@ public class ElectricityPeriodTestShould [Fact] public void LabelBillAsBillingYearWhenItCoversAWholeYear() { - var periods = ElectricityPeriod.FromBills([YearlyBill(2023)], ElectricityPeriodKind.Bill); + var periods = BillPeriod.FromBills([YearlyBill(2023)], BillPeriodKind.Bill); periods[0].Label.ShouldBe("23/24"); } @@ -30,7 +30,7 @@ public class ElectricityPeriodTestShould { var bill = Bill(new DateOnly(2024, 1, 1), new DateOnly(2024, 6, 30)); - var periods = ElectricityPeriod.FromBills([bill], ElectricityPeriodKind.Bill); + var periods = BillPeriod.FromBills([bill], BillPeriodKind.Bill); periods[0].Label.ShouldBe("01.01.24–30.06.24"); } @@ -45,7 +45,7 @@ public class ElectricityPeriodTestShould bill.PvChf = 400m; bill.SideCostsChf = 100m; - var halves = ElectricityPeriod.FromBills([bill], ElectricityPeriodKind.HalfYear); + var halves = BillPeriod.FromBills([bill], BillPeriodKind.HalfYear); halves.Count.ShouldBe(2); halves[0].From.ShouldBe(new DateOnly(2023, 7, 1)); @@ -69,13 +69,24 @@ public class ElectricityPeriodTestShould var second = YearlyBill(2024); second.GridKwh = 5000m; - var years = ElectricityPeriod.FromBills([first, second], ElectricityPeriodKind.Year); + var years = BillPeriod.FromBills([first, second], BillPeriodKind.Year); years.Select(y => y.Label).ShouldBe(["2023", "2024", "2025"]); years.Select(y => y.Bill.GridKwh).ShouldBe([1500m, 4000m, 2500m]); years.ShouldAllBe(y => y.IsSplit); } + [Fact] + public void SplitWaterBillIntoTwoHalvesWhenPeriodRunsJulyToJune() + { + var bill = new WaterBill { PeriodFrom = new DateOnly(2023, 7, 1), PeriodTo = new DateOnly(2024, 6, 30), WarmWaterM3 = 10m, ColdWaterM3 = 30m, BaseCostsChf = 200m }; + + var halves = BillPeriod.FromBills([bill], BillPeriodKind.HalfYear); + + halves.Select(h => h.Label).ShouldBe(["H2 23", "H1 24"]); + halves.ShouldAllBe(h => h.Bill.WarmWaterM3 == 5m && h.Bill.ColdWaterM3 == 15m && h.Bill.BaseCostsChf == 100m); + } + [Fact] public void KeepPricePerKwhOfTheBillWhenSplittingIt() { @@ -83,7 +94,7 @@ public class ElectricityPeriodTestShould bill.GridKwh = 3000m; bill.GridChf = 900m; - var halves = ElectricityPeriod.FromBills([bill], ElectricityPeriodKind.HalfYear); + var halves = BillPeriod.FromBills([bill], BillPeriodKind.HalfYear); halves.ShouldAllBe(h => h.Bill.GridChfPerKwh == 0.3m); } @@ -96,7 +107,7 @@ public class ElectricityPeriodTestShould var second = Bill(new DateOnly(2024, 4, 1), new DateOnly(2024, 6, 30)); second.GridKwh = 200m; - var halves = ElectricityPeriod.FromBills([first, second], ElectricityPeriodKind.HalfYear); + var halves = BillPeriod.FromBills([first, second], BillPeriodKind.HalfYear); halves.Count.ShouldBe(1); halves[0].Bill.GridKwh.ShouldBe(300m); @@ -109,7 +120,7 @@ public class ElectricityPeriodTestShould var first = YearlyBill(2022); var later = YearlyBill(2024); - var halves = ElectricityPeriod.FromBills([later, first], ElectricityPeriodKind.HalfYear); + var halves = BillPeriod.FromBills([later, first], BillPeriodKind.HalfYear); halves.Select(h => h.Label).ShouldBe(["H2 22", "H1 23", "H2 23", "H1 24", "H2 24", "H1 25"]); halves[2].Bill.ShouldBeNull(); @@ -117,12 +128,12 @@ public class ElectricityPeriodTestShould } [Theory] - [InlineData(ElectricityPeriodKind.Bill)] - [InlineData(ElectricityPeriodKind.Year)] - [InlineData(ElectricityPeriodKind.HalfYear)] - public void ReturnEmptyListWhenThereAreNoBills(ElectricityPeriodKind kind) + [InlineData(BillPeriodKind.Bill)] + [InlineData(BillPeriodKind.Year)] + [InlineData(BillPeriodKind.HalfYear)] + public void ReturnEmptyListWhenThereAreNoBills(BillPeriodKind kind) { - ElectricityPeriod.FromBills([], kind).ShouldBeEmpty(); + BillPeriod.FromBills([], kind).ShouldBeEmpty(); } private static ElectricityBill YearlyBill(int startYear) => Bill(new DateOnly(startYear, 7, 1), new DateOnly(startYear + 1, 6, 30)); diff --git a/Schaad.Accounting.Tests/RawDataRepositoryTestShould.cs b/Schaad.Accounting.Tests/RawDataRepositoryTestShould.cs index 6df8a7f..d74d8ce 100644 --- a/Schaad.Accounting.Tests/RawDataRepositoryTestShould.cs +++ b/Schaad.Accounting.Tests/RawDataRepositoryTestShould.cs @@ -190,6 +190,24 @@ public class RawDataRepositoryTestShould : IDisposable File.Exists(Path.Combine(dbDir, "electricity.json")).ShouldBeFalse(); } + [Fact] + public async Task ReadAndWriteWaterFileInMandatorFolderNotYearFolderWhenEditing() + { + File.WriteAllText(Path.Combine(mandatorDir, "water.json"), """ + [ { "Id": "w1", "PeriodFrom": "2023-07-01", "PeriodTo": "2024-06-30", "WarmWaterM3": 100 } ] + """); + var loaded = await sut.LoadAsync("water.json"); + loaded.Text.ShouldContain("\"WarmWaterM3\": 100"); + + var result = await sut.SaveAsync("water.json", loaded.Text.Replace("100", "150"), loaded.Hash); + + result.Errors.ShouldBeEmpty(); + result.Saved.ShouldBeTrue(); + File.Exists(Path.Combine(mandatorDir, "water.json")).ShouldBeTrue(); + File.ReadAllText(Path.Combine(mandatorDir, "water.json")).ShouldContain("150"); + File.Exists(Path.Combine(dbDir, "water.json")).ShouldBeFalse(); + } + [Fact] public async Task RejectUnknownFileNameWhenLoading() { diff --git a/Schaad.Accounting.Tests/WaterBillRepositoryTestShould.cs b/Schaad.Accounting.Tests/WaterBillRepositoryTestShould.cs new file mode 100644 index 0000000..8dcc87f --- /dev/null +++ b/Schaad.Accounting.Tests/WaterBillRepositoryTestShould.cs @@ -0,0 +1,94 @@ +using Microsoft.Extensions.Logging.Abstractions; +using NSubstitute; +using Schaad.Accounting.Interfaces; +using Schaad.Accounting.Models; +using Schaad.Accounting.Repositories; +using Shouldly; + +namespace Schaad.Accounting.Tests; + +public class WaterBillRepositoryTestShould : IDisposable +{ + private readonly string mandatorDir; + private readonly ISettingsService settingsService; + private readonly WaterBillRepository sut; + + public WaterBillRepositoryTestShould() + { + mandatorDir = Path.Combine(Path.GetTempPath(), "AccountingNext-tests-" + Guid.NewGuid().ToString("N")); + Directory.CreateDirectory(mandatorDir); + + settingsService = Substitute.For(); + settingsService.GetMandatorPath().Returns(mandatorDir); + + sut = new WaterBillRepository(settingsService, new RepositoryCache(), NullLogger.Instance); + } + + public void Dispose() + { + if (Directory.Exists(mandatorDir)) + { + Directory.Delete(mandatorDir, recursive: true); + } + } + + [Fact] + public async Task ReturnEmptyListWhenFileDoesNotExistYet() + { + (await sut.GetWaterBillListAsync()).ShouldBeEmpty(); + } + + [Fact] + public async Task AssignNewIdWhenSavingBillWithoutId() + { + var bill = new WaterBill + { + PeriodFrom = new DateOnly(2023, 7, 1), + PeriodTo = new DateOnly(2024, 6, 30), + WarmWaterM3 = 12.345m, + ColdWaterM3 = 30.5m, + WarmWaterChf = 250.40m, + ColdWaterChf = 98.15m, + BaseCostsChf = 120m + }; + + await sut.SaveWaterBillAsync(bill); + + var stored = (await sut.GetWaterBillListAsync()).Single(); + stored.Id.ShouldNotBeNullOrEmpty(); + stored.TotalM3.ShouldBe(42.845m); + stored.TotalChf.ShouldBe(468.55m); + } + + [Fact] + public async Task UpdateInPlaceWhenSavingBillWithExistingId() + { + await sut.SaveWaterBillAsync(new WaterBill { PeriodFrom = new DateOnly(2023, 7, 1), PeriodTo = new DateOnly(2024, 6, 30), WarmWaterM3 = 10m }); + var id = (await sut.GetWaterBillListAsync()).Single().Id; + + await sut.SaveWaterBillAsync(new WaterBill { Id = id, PeriodFrom = new DateOnly(2023, 7, 1), PeriodTo = new DateOnly(2024, 6, 30), WarmWaterM3 = 13m }); + + var bills = await sut.GetWaterBillListAsync(); + bills.Count.ShouldBe(1); + bills[0].WarmWaterM3.ShouldBe(13m); + } + + [Fact] + public async Task RemoveBillWhenDeletingById() + { + await sut.SaveWaterBillAsync(new WaterBill { PeriodFrom = new DateOnly(2023, 7, 1), PeriodTo = new DateOnly(2024, 6, 30) }); + var id = (await sut.GetWaterBillListAsync()).Single().Id; + + await sut.DeleteWaterBillAsync(id); + + (await sut.GetWaterBillListAsync()).ShouldBeEmpty(); + } + + [Fact] + public async Task StoreFileDirectlyInMandatorFolderWithoutYearSubfolder() + { + await sut.SaveWaterBillAsync(new WaterBill { PeriodFrom = new DateOnly(2023, 7, 1), PeriodTo = new DateOnly(2024, 6, 30) }); + + File.Exists(Path.Combine(mandatorDir, "water.json")).ShouldBeTrue(); + } +} diff --git a/Schaad.Accounting.Tests/WaterBillTestShould.cs b/Schaad.Accounting.Tests/WaterBillTestShould.cs new file mode 100644 index 0000000..8052446 --- /dev/null +++ b/Schaad.Accounting.Tests/WaterBillTestShould.cs @@ -0,0 +1,53 @@ +using Schaad.Accounting.Models; +using Shouldly; + +namespace Schaad.Accounting.Tests; + +public class WaterBillTestShould +{ + [Fact] + public void AddWarmAndColdWaterWhenCalculatingTotalM3() + { + var bill = new WaterBill { WarmWaterM3 = 12.345m, ColdWaterM3 = 30.5m }; + + bill.TotalM3.ShouldBe(42.845m); + } + + [Fact] + public void DivideWarmWaterByTotalWhenCalculatingWarmWaterShare() + { + var bill = new WaterBill { WarmWaterM3 = 10m, ColdWaterM3 = 30m }; + + bill.WarmWaterShare.ShouldBe(0.25m); + } + + [Fact] + public void ReturnZeroWarmWaterShareWhenThereIsNoConsumption() + { + var bill = new WaterBill { WarmWaterM3 = 0m, ColdWaterM3 = 0m }; + + bill.WarmWaterShare.ShouldBe(0m); + } + + [Fact] + public void AddWarmColdAndBaseCostsWhenCalculatingTotalChf() + { + var bill = new WaterBill { WarmWaterChf = 250.40m, ColdWaterChf = 98.15m, BaseCostsChf = 120m }; + + bill.TotalChf.ShouldBe(468.55m); + } + + [Fact] + public void AddShareOfAllValuesWhenAddingShareOfOtherBill() + { + var sum = new WaterBill { WarmWaterM3 = 1m, ColdWaterM3 = 2m, WarmWaterChf = 4m, ColdWaterChf = 5m, BaseCostsChf = 3m }; + + sum.AddShare(new WaterBill { WarmWaterM3 = 10m, ColdWaterM3 = 20m, WarmWaterChf = 40m, ColdWaterChf = 50m, BaseCostsChf = 300m }, 0.5m); + + sum.WarmWaterM3.ShouldBe(6m); + sum.ColdWaterM3.ShouldBe(12m); + sum.WarmWaterChf.ShouldBe(24m); + sum.ColdWaterChf.ShouldBe(30m); + sum.BaseCostsChf.ShouldBe(153m); + } +} diff --git a/Schaad.Accounting.UI/Components/Layout/NavMenu.razor b/Schaad.Accounting.UI/Components/Layout/NavMenu.razor index 6696f58..90da4a2 100644 --- a/Schaad.Accounting.UI/Components/Layout/NavMenu.razor +++ b/Schaad.Accounting.UI/Components/Layout/NavMenu.razor @@ -10,6 +10,7 @@ Transaktionen Bank Transaktionen Strom + Wasser Buchungsregeln Buchungstexte diff --git a/Schaad.Accounting.UI/Components/Pages/Dialogs/WaterBillDialog.razor b/Schaad.Accounting.UI/Components/Pages/Dialogs/WaterBillDialog.razor new file mode 100644 index 0000000..52b2531 --- /dev/null +++ b/Schaad.Accounting.UI/Components/Pages/Dialogs/WaterBillDialog.razor @@ -0,0 +1,51 @@ +@implements IDialogContentComponent +@rendermode InteractiveServer + + + + + + @Dialog.Instance.Parameters.Title + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ Total @M3(Content.TotalM3) · @Chf(Content.TotalChf) +
+
+ + + + Abbrechen + + + Speichern + + diff --git a/Schaad.Accounting.UI/Components/Pages/Dialogs/WaterBillDialog.razor.cs b/Schaad.Accounting.UI/Components/Pages/Dialogs/WaterBillDialog.razor.cs new file mode 100644 index 0000000..7e724ec --- /dev/null +++ b/Schaad.Accounting.UI/Components/Pages/Dialogs/WaterBillDialog.razor.cs @@ -0,0 +1,66 @@ +using System.Globalization; +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components.Forms; +using Microsoft.FluentUI.AspNetCore.Components; +using Schaad.Accounting.Interfaces; +using Schaad.Accounting.Models; + +namespace Schaad.Accounting.UI.Components.Pages.Dialogs; + +public partial class WaterBillDialog : ComponentBase +{ + private static readonly CultureInfo SwissNumbers = CreateSwissNumbers(); + + private EditContext editContext = null!; + + // FluentDatePicker needs DateTime?; the model stores DateOnly (see WaterBill). + private DateTime? periodFrom; + private DateTime? periodTo; + + [CascadingParameter] + public FluentDialog Dialog { get; set; } = null!; + + [Parameter] + public WaterBill Content { get; set; } = null!; + + [Inject] + private IWaterBillRepository waterBillRepository { get; set; } = null!; + + protected override void OnInitialized() + { + periodFrom = Content.PeriodFrom == default ? null : Content.PeriodFrom.ToDateTime(TimeOnly.MinValue); + periodTo = Content.PeriodTo == default ? null : Content.PeriodTo.ToDateTime(TimeOnly.MinValue); + editContext = new EditContext(Content); + } + + private async Task SaveAsync() + { + if (periodFrom is null || periodTo is null) + { + return; + } + Content.PeriodFrom = DateOnly.FromDateTime(periodFrom.Value); + Content.PeriodTo = DateOnly.FromDateTime(periodTo.Value); + if (editContext.Validate()) + { + await waterBillRepository.SaveWaterBillAsync(Content); + await Dialog.CloseAsync(Content); + } + } + + private async Task CancelAsync() + { + await Dialog.CancelAsync(); + } + + private static string M3(decimal value) => value.ToString("#,0.00", SwissNumbers) + " m³"; + + 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.cs b/Schaad.Accounting.UI/Components/Pages/Electricity.razor.cs index d58c68c..f9ccc9b 100644 --- a/Schaad.Accounting.UI/Components/Pages/Electricity.razor.cs +++ b/Schaad.Accounting.UI/Components/Pages/Electricity.razor.cs @@ -11,7 +11,7 @@ namespace Schaad.Accounting.UI.Components.Pages; /// Yearly NeoVac electricity bills for the apartment (billing period 1 July – 30 June, so the /// bills are stored once per mandator, not per calendar year; see /// ). Grid for entering/editing, plus charts per bill, -/// calendar year or half-year (see ): consumption grid/PV, price +/// calendar year or half-year (see ): consumption grid/PV, price /// per kWh and total costs. /// public partial class Electricity : ComponentBase @@ -25,12 +25,12 @@ public partial class Electricity : ComponentBase [Inject] private IToastService toastService { get; set; } = null!; - private static readonly ElectricityPeriodKind[] PeriodKinds = - [ElectricityPeriodKind.Bill, ElectricityPeriodKind.Year, ElectricityPeriodKind.HalfYear]; + private static readonly BillPeriodKind[] PeriodKinds = + [BillPeriodKind.Bill, BillPeriodKind.Year, BillPeriodKind.HalfYear]; private IReadOnlyList source = []; - private ElectricityPeriodKind periodKind = ElectricityPeriodKind.Bill; + private BillPeriodKind periodKind = BillPeriodKind.Bill; // True if a bill had to be spread over several periods of the selected kind. private bool isSplit; @@ -52,7 +52,7 @@ public partial class Electricity : ComponentBase BuildCharts(); } - private void SetPeriodKind(ElectricityPeriodKind kind) + private void SetPeriodKind(BillPeriodKind kind) { periodKind = kind; BuildCharts(); @@ -61,7 +61,7 @@ public partial class Electricity : ComponentBase private void BuildCharts() { // A bill reaching over several periods is spread evenly over its months. - var periods = ElectricityPeriod.FromBills(source, periodKind); + var periods = BillPeriod.FromBills(source, periodKind); isSplit = periods.Any(p => p.IsSplit); var labels = periods.Select(p => p.Label).ToList(); barData = new @@ -150,17 +150,17 @@ public partial class Electricity : ComponentBase } } - private static string PeriodKindName(ElectricityPeriodKind kind) => kind switch + private static string PeriodKindName(BillPeriodKind kind) => kind switch { - ElectricityPeriodKind.Year => "Kalenderjahr", - ElectricityPeriodKind.HalfYear => "Halbjahr", + BillPeriodKind.Year => "Kalenderjahr", + BillPeriodKind.HalfYear => "Halbjahr", _ => "Abrechnung" }; private string PerPeriod => periodKind switch { - ElectricityPeriodKind.Year => "pro Jahr", - ElectricityPeriodKind.HalfYear => "pro Halbjahr", + BillPeriodKind.Year => "pro Jahr", + BillPeriodKind.HalfYear => "pro Halbjahr", _ => "pro Abrechnung" }; diff --git a/Schaad.Accounting.UI/Components/Pages/Water.razor b/Schaad.Accounting.UI/Components/Pages/Water.razor new file mode 100644 index 0000000..ff7e8e0 --- /dev/null +++ b/Schaad.Accounting.UI/Components/Pages/Water.razor @@ -0,0 +1,67 @@ +@page "/water" +@rendermode InteractiveServer +@using Schaad.Accounting.UI.Components.Pages.Analytics + +Wasser + +
+ + Neue Abrechnung hinzufügen + + + @if (source.Count == 0) + { + Noch keine Abrechnungen erfasst. + } + else + { + +
+ @foreach (var kind in PeriodKinds) + { + @PeriodKindName(kind) + } +
+ @if (isSplit) + { + Werte anteilig auf die Monate der Abrechnungsperiode verteilt + } +
+ +
+ +
Verbrauch @PerPeriod
+ +
+ +
Gesamtkosten @PerPeriod
+ +
+
+ } + +
+ + + + + + + + + + + + + + + + + + +
+
diff --git a/Schaad.Accounting.UI/Components/Pages/Water.razor.cs b/Schaad.Accounting.UI/Components/Pages/Water.razor.cs new file mode 100644 index 0000000..091c415 --- /dev/null +++ b/Schaad.Accounting.UI/Components/Pages/Water.razor.cs @@ -0,0 +1,154 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.FluentUI.AspNetCore.Components; +using Schaad.Accounting.Interfaces; +using Schaad.Accounting.Models; +using Schaad.Accounting.UI.Components.Pages.Charts; +using Schaad.Accounting.UI.Components.Pages.Dialogs; + +namespace Schaad.Accounting.UI.Components.Pages; + +/// +/// Water bills for the apartment, laid out like the Strom page (): the +/// bills are stored once per mandator, not per calendar year (see ). +/// Grid for entering/editing, plus charts per bill, calendar year or half-year (see +/// ): warm/cold water consumption and total costs. +/// +public partial class Water : ComponentBase +{ + [Inject] + private IWaterBillRepository waterBillRepository { get; set; } = null!; + + [Inject] + private IDialogService dialogService { get; set; } = null!; + + [Inject] + private IToastService toastService { get; set; } = null!; + + private static readonly BillPeriodKind[] PeriodKinds = + [BillPeriodKind.Bill, BillPeriodKind.Year, BillPeriodKind.HalfYear]; + + private IReadOnlyList source = []; + + private BillPeriodKind periodKind = BillPeriodKind.Bill; + + // True if a bill had to be spread over several periods of the selected kind. + private bool isSplit; + + private object barData = new(); + private object costData = new(); + + protected override async Task OnInitializedAsync() + { + await LoadAsync(); + } + + private async Task LoadAsync() + { + source = (await waterBillRepository.GetWaterBillListAsync()) + .OrderBy(b => b.PeriodFrom) + .ToList(); + BuildCharts(); + } + + private void SetPeriodKind(BillPeriodKind kind) + { + periodKind = kind; + BuildCharts(); + } + + private void BuildCharts() + { + // A bill reaching over several periods is spread evenly over its months. + var periods = BillPeriod.FromBills(source, periodKind); + isSplit = periods.Any(p => p.IsSplit); + var labels = periods.Select(p => p.Label).ToList(); + barData = new + { + labels, + series = new object[] + { + new { name = "Warmwasser", color = ChartTheme.ColorAt(0), values = periods.Select(p => p.Bill?.WarmWaterM3).ToList(), clickable = false }, + new { name = "Kaltwasser", color = ChartTheme.ColorAt(1), values = periods.Select(p => p.Bill?.ColdWaterM3).ToList(), clickable = false } + }, + unit = "m³" + }; + costData = new + { + labels, + series = new object[] + { + new { name = "Total", color = ChartTheme.ColorAt(2), values = periods.Select(p => p.Bill?.TotalChf).ToList(), width = 2 } + }, + unit = "CHF" + }; + } + + private async Task AddAsync() + { + var data = new WaterBill(); + var dialog = await dialogService.ShowDialogAsync(data, new DialogParameters() + { + Width = "560px", + Height = "460px", + Title = "Abrechnung hinzufügen", + PreventDismissOnOverlayClick = true, + PreventScroll = true, + }); + + var result = await dialog.Result; + if (!result.Cancelled && result.Data != null) + { + await LoadAsync(); + toastService.ShowToast(ToastIntent.Success, "Abrechnung gespeichert", 3000); + } + } + + private async Task EditAsync(string id) + { + var data = await waterBillRepository.GetWaterBillAsync(id); + var dialog = await dialogService.ShowDialogAsync(data, new DialogParameters() + { + Width = "560px", + Height = "460px", + Title = "Abrechnung bearbeiten", + PreventDismissOnOverlayClick = true, + PreventScroll = true, + }); + + var result = await dialog.Result; + if (!result.Cancelled && result.Data != null) + { + await LoadAsync(); + toastService.ShowToast(ToastIntent.Success, "Abrechnung gespeichert", 3000); + } + } + + private async Task DeleteAsync(string id) + { + var bill = source.First(b => b.Id == id); + var dialog = await dialogService.ShowConfirmationAsync($"Abrechnung {FullLabel(bill)} wirklich löschen?", "Ja", "Nein", "Abrechnung löschen"); + var result = await dialog.Result; + if (!result.Cancelled) + { + await waterBillRepository.DeleteWaterBillAsync(id); + await LoadAsync(); + toastService.ShowToast(ToastIntent.Success, "Abrechnung gelöscht", 3000); + } + } + + private static string PeriodKindName(BillPeriodKind kind) => kind switch + { + BillPeriodKind.Year => "Kalenderjahr", + BillPeriodKind.HalfYear => "Halbjahr", + _ => "Abrechnung" + }; + + private string PerPeriod => periodKind switch + { + BillPeriodKind.Year => "pro Jahr", + BillPeriodKind.HalfYear => "pro Halbjahr", + _ => "pro Abrechnung" + }; + + private static string FullLabel(WaterBill bill) => $"{bill.PeriodFrom:dd.MM.yyyy} – {bill.PeriodTo:dd.MM.yyyy}"; +} diff --git a/Schaad.Accounting.UI/Components/Pages/Water.razor.css b/Schaad.Accounting.UI/Components/Pages/Water.razor.css new file mode 100644 index 0000000..452abd3 --- /dev/null +++ b/Schaad.Accounting.UI/Components/Pages/Water.razor.css @@ -0,0 +1,43 @@ +.water { + display: flex; + flex-direction: column; + gap: 16px; +} + +.table-scroll { + overflow-x: auto; +} + +.pair { + display: grid; + grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); + gap: 12px; +} + +@media (max-width: 1100px) { + .pair { + grid-template-columns: minmax(0, 1fr); + } +} + +::deep .chart-card { + padding: 16px; + min-width: 0; +} + +.card-title { + font-weight: 600; + font-size: 15px; + margin-bottom: 12px; +} + +.segmented { + display: flex; + flex-wrap: wrap; + gap: 2px; +} + +.split-note { + font-size: 12px; + color: var(--neutral-foreground-hint); +} diff --git a/Schaad.Accounting.UI/Extensions.cs b/Schaad.Accounting.UI/Extensions.cs index 697e699..817e02e 100644 --- a/Schaad.Accounting.UI/Extensions.cs +++ b/Schaad.Accounting.UI/Extensions.cs @@ -22,6 +22,7 @@ namespace Schaad.Accounting.UI services.AddScoped(); services.AddScoped(); services.AddScoped(); + services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped();