Remove Akonto and Saldo from the electricity bills

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>
This commit is contained in:
Claudio Schaad 2026-10-27 19:33:52 +01:00
parent df52237420
commit ca4a67f20a
11 changed files with 13 additions and 78 deletions

View file

@ -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

View file

@ -36,9 +36,6 @@ namespace Schaad.Accounting.Models
[Display(Name = "Nebenkosten")]
public decimal SideCostsChf { get; set; }
[Display(Name = "Akonto")]
public decimal AdvanceChf { get; set; }
/// <summary>Grid draw plus own PV consumption, in kWh.</summary>
[JsonIgnore]
[Display(Name = "Total")]
@ -49,16 +46,11 @@ namespace Schaad.Accounting.Models
[Display(Name = "PV-Anteil")]
public decimal PvShare => TotalKwh == 0 ? 0 : PvKwh / TotalKwh;
/// <summary>Grid, PV and side costs added up, before the advance payment.</summary>
/// <summary>Grid, PV and side costs added up.</summary>
[JsonIgnore]
[Display(Name = "Total")]
public decimal TotalChf => GridChf + PvChf + SideCostsChf;
/// <summary>What is still owed (positive) or was overpaid (negative) after the advance.</summary>
[JsonIgnore]
[Display(Name = "Saldo")]
public decimal Balance => TotalChf - AdvanceChf;
/// <summary>Average price per kWh over the whole period.</summary>
[JsonIgnore]
[Display(Name = "CHF/kWh")]

View file

@ -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;
}
}

View file

@ -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]

View file

@ -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()
{

View file

@ -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);
}
}

View file

@ -27,7 +27,6 @@
</FluentStack>
<FluentStack Orientation="Orientation.Horizontal">
<FluentNumberField @bind-Value="@Content.SideCostsChf" Label="Nebenkosten (CHF)" Style="width: 170px;" />
<FluentNumberField @bind-Value="@Content.AdvanceChf" Label="Akonto (CHF)" Style="width: 170px;" />
</FluentStack>
<div>
<FluentValidationSummary />
@ -35,8 +34,7 @@
</EditForm>
<div style="margin-top: 12px; font-size: 13px; color: #52514e;">
Total @Chf(Content.TotalChf), Akonto @Chf(Content.AdvanceChf) → Saldo <strong>@Chf(Content.Balance)</strong>
(@(Content.Balance >= 0 ? "Nachzahlung" : "Gutschrift"))
Total <strong>@Chf(Content.TotalChf)</strong>
</div>
<FluentButton Appearance="Appearance.Lightweight" Style="margin-top: 12px; padding: 0; font-size: 13px;" OnClick="ShowGuideAsync">

View file

@ -47,11 +47,6 @@
<PropertyColumn Title="PV CHF" Property="@(p => p.PvChf)" Format="C2" Align="Align.End" />
<PropertyColumn Title="Nebenkosten" Property="@(p => p.SideCostsChf)" Format="C2" Align="Align.End" />
<PropertyColumn Title="Total CHF" Property="@(p => p.TotalChf)" Format="C2" Align="Align.End" />
<PropertyColumn Title="Akonto" Property="@(p => p.AdvanceChf)" Format="C2" Align="Align.End" />
<TemplateColumn Title="Saldo" Align="Align.End">
<span class="@(context.Balance >= 0 ? "due" : "credit")">@Chf(context.Balance)</span>
</TemplateColumn>
<PropertyColumn Title="CHF/kWh" Property="@(p => p.ChfPerKwh)" Format="0.000" Align="Align.End" />
<TemplateColumn Align="Align.Center" Width="50px">
<FluentButton IconEnd="@(new Icons.Regular.Size16.Delete())" Appearance="Appearance.Neutral" title="Löschen" aria-label="Löschen" OnClick="@(() => DeleteAsync(context.Id))" />
</TemplateColumn>

View file

@ -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;
/// </summary>
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;
}
}

View file

@ -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);

View file

@ -1,7 +1,7 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 620" role="img" aria-labelledby="guide-title">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 532" role="img" aria-labelledby="guide-title">
<title id="guide-title">Beispiel-Abrechnung: Wo stehen die Werte?</title>
<rect x="8" y="8" width="624" height="604" rx="10" fill="#fcfcfb" stroke="#e1e0d9" />
<rect x="8" y="8" width="624" height="516" rx="10" fill="#fcfcfb" stroke="#e1e0d9" />
<text x="24" y="38" font-family="'Helvetica Neue', Helvetica, Arial, sans-serif" font-size="16" font-weight="bold" fill="#0b0b0b">Beispiel: Wo stehen die Werte auf der Abrechnung?</text>
<text x="24" y="58" font-family="'Helvetica Neue', Helvetica, Arial, sans-serif" font-size="12" fill="#52514e">Platzhalterwerte – der Aufbau entspricht dem Abschnitt „Ihre Abrechnung vom …“ der NeoVac-Abrechnung.</text>
@ -44,18 +44,9 @@
<text x="604" y="440" text-anchor="end" font-family="'Helvetica Neue', Helvetica, Arial, sans-serif" font-size="13" font-weight="bold" fill="#0b0b0b">80.00</text>
<text x="604" y="458" text-anchor="end" font-family="'Helvetica Neue', Helvetica, Arial, sans-serif" font-size="11" font-weight="bold" fill="#1baf7a">→ Nebenkosten (CHF)</text>
<!-- Akonto CHF -->
<text x="24" y="510" font-family="'Helvetica Neue', Helvetica, Arial, sans-serif" font-size="13" fill="#0b0b0b">Akontozahlungen Strom</text>
<rect x="380" y="490" width="232" height="22" rx="4" fill="none" stroke="#eda100" stroke-width="2" />
<text x="604" y="506" text-anchor="end" font-family="'Helvetica Neue', Helvetica, Arial, sans-serif" font-size="13" font-weight="bold" fill="#0b0b0b">-600.00</text>
<text x="604" y="524" text-anchor="end" font-family="'Helvetica Neue', Helvetica, Arial, sans-serif" font-size="11" font-weight="bold" fill="#eda100">→ Akonto (CHF), ohne Minus eingeben</text>
<line x1="24" y1="546" x2="616" y2="546" stroke="#e1e0d9" stroke-width="1" />
<line x1="24" y1="480" x2="616" y2="480" stroke="#e1e0d9" stroke-width="1" />
<!-- Computed, informational only -->
<text x="24" y="572" font-family="'Helvetica Neue', Helvetica, Arial, sans-serif" font-size="12" fill="#898781">Stromkosten (wird berechnet)</text>
<text x="604" y="572" text-anchor="end" font-family="'Helvetica Neue', Helvetica, Arial, sans-serif" font-size="12" fill="#898781">680.00</text>
<text x="24" y="594" font-family="'Helvetica Neue', Helvetica, Arial, sans-serif" font-size="12" fill="#898781">Saldo (wird berechnet)</text>
<text x="604" y="594" text-anchor="end" font-family="'Helvetica Neue', Helvetica, Arial, sans-serif" font-size="12" fill="#898781">80.00</text>
<text x="24" y="506" font-family="'Helvetica Neue', Helvetica, Arial, sans-serif" font-size="12" fill="#898781">Stromkosten (wird berechnet)</text>
<text x="604" y="506" text-anchor="end" font-family="'Helvetica Neue', Helvetica, Arial, sans-serif" font-size="12" fill="#898781">680.00</text>
</svg>

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB