Wasser & Heizung: remove the optional meter readings

The "Stand neu" fields for warm water, cold water and heat and their
continuity checks are gone; the per-mille, property total and price
checks stay. The "Kontrolle" heading is only shown when there is a check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Claudio Schaad 2026-11-01 19:36:39 +01:00
parent a58f08e82a
commit 9a4f9a9010
8 changed files with 14 additions and 96 deletions

View file

@ -67,7 +67,7 @@ When a new year is opened, the previous year's data is copied as the starting po
- **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 - **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`, under "Charts" in the menu) — 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), filtered by the shared `BillChartToolbar` (`BillChartFilter`): grouped per bill, calendar year (default) or half-year (`BillPeriod<T>.FromBills` over `IPeriodBill<T>`; a bill reaching over several periods is spread evenly over its months and the page shows a note) and limited to a from/to year range (periods overlapping it are kept whole) - **Strom** page (`Electricity`, `/electricity`, under "Charts" in the menu) — 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), filtered by the shared `BillChartToolbar` (`BillChartFilter`): grouped per bill, calendar year (default) or half-year (`BillPeriod<T>.FromBills` over `IPeriodBill<T>`; a bill reaching over several periods is spread evenly over its months and the page shows a note) and limited to a from/to year range (periods overlapping it are kept whole)
- **Wasser** page (`Water`, `/water`, under "Charts" in the menu) — 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 `BillChartToolbar` - **Wasser** page (`Water`, `/water`, under "Charts" in the menu) — 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 `BillChartToolbar`
- **Wasser & Heizung** page (`WaterHeating`, `/water-heating`, under "Charts" in the menu) — same layout for NeoVac bills where only per-mille shares are known, over `IWaterHeatingBillRepository`'s `WaterHeatingBill` records: consumption (warm/cold m³, heat MWh) and ‰ shares from NeoVac, own water/heating costs in CHF from the property manager's statement; `WaterHeatingBillDialog` calls `CalculateCosts`, which stores the CHF parts (water split into base/consumption by ‰, consumption split by m³, warm water part of the heating), so `AddShare` can sum them per period; `RoomHeatingChf` is the rest of the heating. The dialog shows plausibility checks from `WaterHeatingBillChecks` (NeoVac ‰ vs. the optional ‰ of the property manager, optional meter readings continuing from the previous bill, implied property totals, prices per unit vs. the previous bill, flagged above ±25 %). Three charts (stacked m³, MWh, stacked CHF) and a guide image (`water-heating-bill-guide.svg`) - **Wasser & Heizung** page (`WaterHeating`, `/water-heating`, under "Charts" in the menu) — same layout for NeoVac bills where only per-mille shares are known, over `IWaterHeatingBillRepository`'s `WaterHeatingBill` records: consumption (warm/cold m³, heat MWh) and ‰ shares from NeoVac, own water/heating costs in CHF from the property manager's statement; `WaterHeatingBillDialog` calls `CalculateCosts`, which stores the CHF parts (water split into base/consumption by ‰, consumption split by m³, warm water part of the heating), so `AddShare` can sum them per period; `RoomHeatingChf` is the rest of the heating. The dialog shows plausibility checks from `WaterHeatingBillChecks` (NeoVac ‰ vs. the optional ‰ of the property manager, implied property totals, prices per unit vs. the previous bill, flagged above ±25 %). Three charts (stacked m³, MWh, stacked CHF) and a guide image (`water-heating-bill-guide.svg`)
### UI structure ### UI structure

View file

@ -35,18 +35,6 @@ namespace Schaad.Accounting.Models
[Display(Name = "Wärme")] [Display(Name = "Wärme")]
public decimal HeatingMwh { get; set; } public decimal HeatingMwh { get; set; }
// Optional meter readings ("Stand neu"), only for the checks (see WaterHeatingBillChecks):
// the previous bill's reading plus this consumption must give this reading.
[Display(Name = "Zählerstand Warmwasser")]
public decimal? WarmWaterMeter { get; set; }
[Display(Name = "Zählerstand Kaltwasser")]
public decimal? ColdWaterMeter { get; set; }
[Display(Name = "Zählerstand Wärme")]
public decimal? HeatingMeter { get; set; }
// NeoVac per-mille shares of the property, column "Anteil (‰)". // NeoVac per-mille shares of the property, column "Anteil (‰)".
[Display(Name = "Wasser Grundkosten-Anteil")] [Display(Name = "Wasser Grundkosten-Anteil")]
@ -132,10 +120,7 @@ namespace Schaad.Accounting.Models
private static decimal Round(decimal value) => Math.Round(value, 2, MidpointRounding.AwayFromZero); private static decimal Round(decimal value) => Math.Round(value, 2, MidpointRounding.AwayFromZero);
/// <summary> /// <summary>Adds up consumption and CHF values; the per-mille shares don't add up and are left out.</summary>
/// Adds up consumption and CHF values; the per-mille shares and meter readings don't add up
/// and are left out.
/// </summary>
public void AddShare(WaterHeatingBill other, decimal share) public void AddShare(WaterHeatingBill other, decimal share)
{ {
WarmWaterM3 += other.WarmWaterM3 * share; WarmWaterM3 += other.WarmWaterM3 * share;

View file

@ -17,9 +17,8 @@ namespace Schaad.Accounting.Models
/// <summary> /// <summary>
/// Plausibility checks for a <see cref="WaterHeatingBill"/>, shown in its dialog: the NeoVac and /// Plausibility checks for a <see cref="WaterHeatingBill"/>, shown in its dialog: the NeoVac and
/// property manager's per-mille shares must match, the meter readings must continue from the /// property manager's per-mille shares must match, and the prices per unit shouldn't jump
/// previous bill, and the prices per unit shouldn't jump. Checks whose optional inputs are /// against the previous bill. Checks whose optional inputs are missing are left out.
/// missing are left out.
/// </summary> /// </summary>
public static class WaterHeatingBillChecks public static class WaterHeatingBillChecks
{ {
@ -27,7 +26,6 @@ namespace Schaad.Accounting.Models
public const decimal MaxPriceChange = 0.25m; public const decimal MaxPriceChange = 0.25m;
private const decimal PermilleTolerance = 0.005m; private const decimal PermilleTolerance = 0.005m;
private const decimal MeterTolerance = 0.0005m;
private static readonly CultureInfo SwissNumbers = CreateSwissNumbers(); private static readonly CultureInfo SwissNumbers = CreateSwissNumbers();
@ -58,10 +56,6 @@ namespace Schaad.Accounting.Models
$"Heizung WW {N(bill.WarmWaterHeatingPermille)} ‰ ist grösser als Heizung total {N(bill.HeatingPermille)} ‰")); $"Heizung WW {N(bill.WarmWaterHeatingPermille)} ‰ ist grösser als Heizung total {N(bill.HeatingPermille)} ‰"));
} }
AddMeterCheck(checks, "Warmwasser", bill.WarmWaterMeter, bill.WarmWaterM3, previous?.WarmWaterMeter);
AddMeterCheck(checks, "Kaltwasser", bill.ColdWaterMeter, bill.ColdWaterM3, previous?.ColdWaterMeter);
AddMeterCheck(checks, "Wärme", bill.HeatingMeter, bill.HeatingMwh, previous?.HeatingMeter);
// The own share divided by the per-mille share gives the costs of the whole property, // The own share divided by the per-mille share gives the costs of the whole property,
// which are on the property manager's statement. // which are on the property manager's statement.
if (waterPermille != 0 && bill.HeatingPermille != 0) if (waterPermille != 0 && bill.HeatingPermille != 0)
@ -77,26 +71,6 @@ namespace Schaad.Accounting.Models
return checks; return checks;
} }
private static void AddMeterCheck(List<BillCheck> checks, string name, decimal? reading, decimal consumption, decimal? previousReading)
{
if (reading is not decimal now)
{
return;
}
if (previousReading is decimal before)
{
var expected = before + consumption;
var ok = Math.Abs(expected - now) < MeterTolerance;
checks.Add(new BillCheck(Result(ok),
$"Zähler {name}: {M(before)} (Vorperiode) + {M(consumption)} = {M(expected)}" + (ok ? "" : $", Stand neu ist {M(now)}")));
}
else
{
checks.Add(new BillCheck(BillCheckResult.Info,
$"Zähler {name}: Stand alt = {M(now)} − {M(consumption)} = {M(now - consumption)}"));
}
}
private static void AddPriceCheck(List<BillCheck> checks, string name, string unit, decimal? price, decimal? previousPrice) private static void AddPriceCheck(List<BillCheck> checks, string name, string unit, decimal? price, decimal? previousPrice)
{ {
if (price is not decimal now) if (price is not decimal now)
@ -129,8 +103,6 @@ namespace Schaad.Accounting.Models
private static string N(decimal value) => value.ToString("#,0.00", SwissNumbers); private static string N(decimal value) => value.ToString("#,0.00", SwissNumbers);
private static string M(decimal value) => value.ToString("#,0.000", SwissNumbers);
private static CultureInfo CreateSwissNumbers() private static CultureInfo CreateSwissNumbers()
{ {
var culture = new CultureInfo("de-CH"); var culture = new CultureInfo("de-CH");

View file

@ -70,43 +70,6 @@ public class WaterHeatingBillChecksTestShould
checks.ShouldContain(c => c.Result == BillCheckResult.Warning && c.Text.StartsWith("Heizung WW 70.00 ‰")); checks.ShouldContain(c => c.Result == BillCheckResult.Warning && c.Text.StartsWith("Heizung WW 70.00 ‰"));
} }
[Fact]
public void PassWhenMeterContinuesFromPreviousBill()
{
var previous = Bill();
previous.WarmWaterMeter = 134.151m;
var bill = Bill();
bill.WarmWaterMeter = 150.550m;
var checks = WaterHeatingBillChecks.Check(bill, previous);
checks.ShouldContain(new BillCheck(BillCheckResult.Ok, "Zähler Warmwasser: 134.151 (Vorperiode) + 16.399 = 150.550"));
}
[Fact]
public void WarnWhenMeterDoesNotContinueFromPreviousBill()
{
var previous = Bill();
previous.ColdWaterMeter = 333.273m;
var bill = Bill();
bill.ColdWaterMeter = 384.740m;
var checks = WaterHeatingBillChecks.Check(bill, previous);
checks.ShouldContain(new BillCheck(BillCheckResult.Warning, "Zähler Kaltwasser: 333.273 (Vorperiode) + 51.464 = 384.737, Stand neu ist 384.740"));
}
[Fact]
public void ShowOldMeterReadingWhenThereIsNoPreviousReading()
{
var bill = Bill();
bill.HeatingMeter = 21.575m;
var checks = WaterHeatingBillChecks.Check(bill, null);
checks.ShouldContain(new BillCheck(BillCheckResult.Info, "Zähler Wärme: Stand alt = 21.575 − 2.458 = 19.117"));
}
[Fact] [Fact]
public void ShowPropertyCostsDerivedFromOwnShare() public void ShowPropertyCostsDerivedFromOwnShare()
{ {

View file

@ -25,11 +25,6 @@
<FluentNumberField @bind-Value="@Content.ColdWaterM3" @bind-Value:after="Content.CalculateCosts" Label="Kaltwasser (m³)" Style="width: 210px;" /> <FluentNumberField @bind-Value="@Content.ColdWaterM3" @bind-Value:after="Content.CalculateCosts" Label="Kaltwasser (m³)" Style="width: 210px;" />
<FluentNumberField @bind-Value="@Content.HeatingMwh" Label="Wärme (MWh)" Style="width: 210px;" /> <FluentNumberField @bind-Value="@Content.HeatingMwh" Label="Wärme (MWh)" Style="width: 210px;" />
</FluentStack> </FluentStack>
<FluentStack Orientation="Orientation.Horizontal">
<FluentNumberField @bind-Value="@Content.WarmWaterMeter" Label="Stand neu WW (optional)" Style="width: 210px;" />
<FluentNumberField @bind-Value="@Content.ColdWaterMeter" Label="Stand neu KW (optional)" Style="width: 210px;" />
<FluentNumberField @bind-Value="@Content.HeatingMeter" Label="Stand neu Wärme (optional)" Style="width: 210px;" />
</FluentStack>
<div style="@SectionStyle">NeoVac – Anteil (‰)</div> <div style="@SectionStyle">NeoVac – Anteil (‰)</div>
<FluentStack Orientation="Orientation.Horizontal"> <FluentStack Orientation="Orientation.Horizontal">
@ -68,10 +63,13 @@
Total <strong>@M3(Content.TotalM3)</strong> · <strong>@Mwh(Content.HeatingMwh)</strong> · <strong>@Chf(Content.TotalChf)</strong> Total <strong>@M3(Content.TotalM3)</strong> · <strong>@Mwh(Content.HeatingMwh)</strong> · <strong>@Chf(Content.TotalChf)</strong>
</div> </div>
<div style="@SectionStyle">Kontrolle</div> @if (Checks is { Count: > 0 } checks)
@foreach (var check in Checks)
{ {
<div style="font-size: 13px; color: @CheckColor(check.Result);">@CheckSymbol(check.Result) @check.Text</div> <div style="@SectionStyle">Kontrolle</div>
@foreach (var check in checks)
{
<div style="font-size: 13px; color: @CheckColor(check.Result);">@CheckSymbol(check.Result) @check.Text</div>
}
} }
<FluentButton Appearance="Appearance.Lightweight" Style="margin-top: 12px; padding: 0; font-size: 13px;" OnClick="ShowGuideAsync"> <FluentButton Appearance="Appearance.Lightweight" Style="margin-top: 12px; padding: 0; font-size: 13px;" OnClick="ShowGuideAsync">

View file

@ -22,7 +22,7 @@ public partial class WaterHeatingBillDialog : ComponentBase
private DateTime? periodFrom; private DateTime? periodFrom;
private DateTime? periodTo; private DateTime? periodTo;
// The other bills, to find the previous one for the checks (meter readings, prices). // The other bills, to find the previous one for the price checks.
private List<WaterHeatingBill> bills = []; private List<WaterHeatingBill> bills = [];
[CascadingParameter] [CascadingParameter]

View file

@ -111,7 +111,7 @@ public partial class WaterHeating : ComponentBase
var dialog = await dialogService.ShowDialogAsync<WaterHeatingBillDialog>(data, new DialogParameters() var dialog = await dialogService.ShowDialogAsync<WaterHeatingBillDialog>(data, new DialogParameters()
{ {
Width = "760px", Width = "760px",
Height = "880px", Height = "820px",
Title = "Abrechnung hinzufügen", Title = "Abrechnung hinzufügen",
PreventDismissOnOverlayClick = true, PreventDismissOnOverlayClick = true,
PreventScroll = true, PreventScroll = true,
@ -131,7 +131,7 @@ public partial class WaterHeating : ComponentBase
var dialog = await dialogService.ShowDialogAsync<WaterHeatingBillDialog>(data, new DialogParameters() var dialog = await dialogService.ShowDialogAsync<WaterHeatingBillDialog>(data, new DialogParameters()
{ {
Width = "760px", Width = "760px",
Height = "880px", Height = "820px",
Title = "Abrechnung bearbeiten", Title = "Abrechnung bearbeiten",
PreventDismissOnOverlayClick = true, PreventDismissOnOverlayClick = true,
PreventScroll = true, PreventScroll = true,

View file

@ -27,7 +27,7 @@
<rect x="380" y="239" width="232" height="22" rx="4" fill="none" stroke="#e34948" stroke-width="2" /> <rect x="380" y="239" width="232" height="22" rx="4" fill="none" stroke="#e34948" stroke-width="2" />
<text x="604" y="255" text-anchor="end" font-family="'Helvetica Neue', Helvetica, Arial, sans-serif" font-size="13" font-weight="bold" fill="#0b0b0b">2.400</text> <text x="604" y="255" text-anchor="end" font-family="'Helvetica Neue', Helvetica, Arial, sans-serif" font-size="13" font-weight="bold" fill="#0b0b0b">2.400</text>
<text x="604" y="273" text-anchor="end" font-family="'Helvetica Neue', Helvetica, Arial, sans-serif" font-size="11" font-weight="bold" fill="#e34948">→ Wärme (MWh)</text> <text x="604" y="273" text-anchor="end" font-family="'Helvetica Neue', Helvetica, Arial, sans-serif" font-size="11" font-weight="bold" fill="#e34948">→ Wärme (MWh)</text>
<text x="24" y="298" font-family="'Helvetica Neue', Helvetica, Arial, sans-serif" font-size="12" fill="#52514e">„Stand neu“ ist der Zählerstand: optional in „Stand neu …“ für die Kontrolle, nicht als Verbrauch.</text> <text x="24" y="298" font-family="'Helvetica Neue', Helvetica, Arial, sans-serif" font-size="12" fill="#52514e">Den Verbrauch übernehmen, nicht „Stand neu“ – das ist der Zählerstand.</text>
<line x1="24" y1="312" x2="616" y2="312" stroke="#e1e0d9" stroke-width="1" /> <line x1="24" y1="312" x2="616" y2="312" stroke="#e1e0d9" stroke-width="1" />
<text x="24" y="338" font-family="'Helvetica Neue', Helvetica, Arial, sans-serif" font-size="11" font-weight="bold" fill="#898781">NEOVAC – WASSERKOSTEN / WÄRMEKOSTEN, SPALTE „ANTEIL (‰)“</text> <text x="24" y="338" font-family="'Helvetica Neue', Helvetica, Arial, sans-serif" font-size="11" font-weight="bold" fill="#898781">NEOVAC – WASSERKOSTEN / WÄRMEKOSTEN, SPALTE „ANTEIL (‰)“</text>
<!-- Wasser Grund (‰) --> <!-- Wasser Grund (‰) -->

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB