AccountingNext/Schaad.Accounting.UI/Components/Pages/Dialogs/WaterHeatingBillDialog.razor
Claudio Schaad a58f08e82a Wasser & Heizung: plausibility checks in the bill dialog
The dialog shows a "Kontrolle" section (WaterHeatingBillChecks): the NeoVac
per-mille shares against the optional ones of the property manager,
optional meter readings continuing from the previous bill, the property
totals implied by the own share, and the prices per unit compared with
the previous bill (flagged above ±25 %).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 19:33:21 +01:00

117 lines
6.2 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@implements IDialogContentComponent<Schaad.Accounting.Models.WaterHeatingBill>
@rendermode InteractiveServer
@using Schaad.Accounting.Models
<FluentDialogHeader ShowDismiss="true">
<FluentStack VerticalAlignment="VerticalAlignment.Center">
<FluentIcon Value="@(new Icons.Regular.Size24.WindowApps())" />
<FluentLabel Typo="Typography.PaneHeader">
@Dialog.Instance.Parameters.Title
</FluentLabel>
</FluentStack>
</FluentDialogHeader>
<FluentDialogBody>
<EditForm EditContext="@editContext">
<DataAnnotationsValidator />
<FluentStack Orientation="Orientation.Horizontal">
<FluentDatePicker @bind-Value="@periodFrom" @bind-Value:after="SyncPeriod" Label="Von" Style="width: 210px;" />
<FluentDatePicker @bind-Value="@periodTo" @bind-Value:after="SyncPeriod" Label="Bis" Style="width: 210px;" />
</FluentStack>
<div style="@SectionStyle">NeoVac – Ablesequittung</div>
<FluentStack Orientation="Orientation.Horizontal">
<FluentNumberField @bind-Value="@Content.WarmWaterM3" @bind-Value:after="Content.CalculateCosts" Label="Warmwasser (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;" />
</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>
<FluentStack Orientation="Orientation.Horizontal">
<FluentNumberField @bind-Value="@Content.WaterBasePermille" @bind-Value:after="Content.CalculateCosts" Label="Wasser Grund (‰)" Style="width: 210px;" />
<FluentNumberField @bind-Value="@Content.WaterConsumptionPermille" @bind-Value:after="Content.CalculateCosts" Label="Wasser Verbrauch (‰)" Style="width: 210px;" />
</FluentStack>
<FluentStack Orientation="Orientation.Horizontal">
<FluentNumberField @bind-Value="@Content.HeatingPermille" @bind-Value:after="Content.CalculateCosts" Label="Heizung total (‰)" Style="width: 210px;" />
<FluentNumberField @bind-Value="@Content.WarmWaterHeatingPermille" @bind-Value:after="Content.CalculateCosts" Label="Heizung WW (‰)" Style="width: 210px;" />
</FluentStack>
<div style="@SectionStyle">Verwaltung – Ihr Anteil</div>
<FluentStack Orientation="Orientation.Horizontal">
<FluentNumberField @bind-Value="@Content.WaterCostsChf" @bind-Value:after="Content.CalculateCosts" Label="Wasserkosten (CHF)" Style="width: 210px;" />
<FluentNumberField @bind-Value="@Content.HeatingCostsChf" @bind-Value:after="Content.CalculateCosts" Label="Heizkosten (CHF)" Style="width: 210px;" />
</FluentStack>
<FluentStack Orientation="Orientation.Horizontal">
<FluentNumberField @bind-Value="@Content.ManagerWaterPermille" Label="Wasser (‰, optional)" Style="width: 210px;" />
<FluentNumberField @bind-Value="@Content.ManagerHeatingPermille" Label="Heizung (‰, optional)" Style="width: 210px;" />
</FluentStack>
<div>
<FluentValidationSummary />
</div>
</EditForm>
<div style="margin-top: 12px; font-size: 13px; color: #52514e;">
Wasser: Grundkosten <strong>@Chf(Content.BaseCostsChf)</strong>
· Warmwasser <strong>@Chf(Content.WarmWaterChf)</strong>
· Kaltwasser <strong>@Chf(Content.ColdWaterChf)</strong>
</div>
<div style="margin-top: 4px; font-size: 13px; color: #52514e;">
Heizung: Warmwasser <strong>@Chf(Content.WarmWaterHeatingChf)</strong>
· Räume <strong>@Chf(Content.RoomHeatingChf)</strong>
</div>
<div style="margin-top: 4px; font-size: 13px; color: #52514e;">
Total <strong>@M3(Content.TotalM3)</strong> · <strong>@Mwh(Content.HeatingMwh)</strong> · <strong>@Chf(Content.TotalChf)</strong>
</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">
Woher kommen die Werte? (NeoVac-Abrechnung)
</FluentButton>
</FluentDialogBody>
<FluentDialogFooter>
<FluentButton Appearance="Appearance.Neutral"
OnClick="@CancelAsync">
Abbrechen
</FluentButton>
<FluentButton Appearance="Appearance.Accent"
Disabled="@(periodFrom is null || periodTo is null)"
OnClick="@SaveAsync">
Speichern
</FluentButton>
</FluentDialogFooter>
@code {
private const string SectionStyle = "margin-top: 14px; margin-bottom: 4px; font-size: 11px; font-weight: bold; color: #898781; text-transform: uppercase;";
// Shown in its own dialog (see ShowGuideAsync) instead of expanding inline: this dialog has a
// fixed Height, and FluentDialogBody doesn't resize to fit growing content.
private RenderFragment GuideImage =>
@<img src="/images/water-heating-bill-guide.svg"
alt="Beispiel-Abrechnung mit Markierungen, welcher Wert in welches Feld gehört"
style="width: 100%; height: auto; display: block;" />;
private static string CheckSymbol(BillCheckResult result) => result switch
{
BillCheckResult.Ok => "✓",
BillCheckResult.Warning => "⚠",
_ => "·"
};
private static string CheckColor(BillCheckResult result) => result switch
{
BillCheckResult.Ok => "#1a7f37",
BillCheckResult.Warning => "#c4314b",
_ => "#52514e"
};
}