A new page (/electricity) to record one electricity bill per billing
period (1 July-30 June) with a grid, add/edit dialog, and two Chart.js
charts (kWh split grid/PV per period, CHF/kWh as a line).
- ElectricityBill (Common): Grid/PV kWh and CHF, side costs, advance
payment; computed TotalKwh, PvShare, TotalChf, Balance, ChfPerKwh.
- Stored once per mandator at {DataPath}/{mandator}/electricity.json
instead of per year, since the billing period doesn't align with
calendar years (new ISettingsService.GetMandatorPath(),
BaseRepository gets a directory-aware SaveAsync overload).
- electricity.json is also editable through the JSON editor
(RawDataRepository).
- charts.js: stackedBar/line charts can now show a unit other than
CHF (defaults to CHF, so the Analyse page is unaffected).
- The add/edit dialog links to an annotated example (SVG, placeholder
data) showing which value on the real NeoVac bill goes into which
field; opens in its own dialog since the main dialog has a fixed
height.
- Tests for the computed properties and the new repositories.
Also bumps the TargetFramework to net10.0 and updates the local
DataPath in appsettings.Development.json.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
57 lines
3.5 KiB
Text
57 lines
3.5 KiB
Text
@page "/electricity"
|
|
@rendermode InteractiveServer
|
|
@using Schaad.Accounting.UI.Components.Pages.Analytics
|
|
|
|
<PageTitle>Strom</PageTitle>
|
|
|
|
<div class="electricity">
|
|
<FluentStack Orientation="Orientation.Horizontal" VerticalAlignment="VerticalAlignment.Center">
|
|
<FluentButton IconStart="@(new Icons.Regular.Size16.Add())" Appearance="Appearance.Neutral" OnClick="AddAsync">Neue Abrechnung hinzufügen</FluentButton>
|
|
</FluentStack>
|
|
|
|
<div class="table-scroll">
|
|
<FluentDataGrid Items="@source.AsQueryable()" RowSize="DataGridRowSize.Medium">
|
|
<PropertyColumn Title="Von" Property="@(p => p.PeriodFrom)" Format="dd.MM.yyyy" Sortable="true" IsDefaultSortColumn="true" InitialSortDirection="SortDirection.Descending" />
|
|
<PropertyColumn Title="Bis" Property="@(p => p.PeriodTo)" Format="dd.MM.yyyy" Sortable="true" />
|
|
<PropertyColumn Title="Netz kWh" Property="@(p => p.GridKwh)" Format="#,0.0" Align="Align.End" />
|
|
<PropertyColumn Title="PV kWh" Property="@(p => p.PvKwh)" Format="#,0.0" Align="Align.End" />
|
|
<PropertyColumn Title="Total kWh" Property="@(p => p.TotalKwh)" Format="#,0.0" Align="Align.End" />
|
|
<PropertyColumn Title="PV-Anteil" Property="@(p => p.PvShare)" Format="P1" Align="Align.End" />
|
|
<PropertyColumn Title="Netz CHF" Property="@(p => p.GridChf)" Format="C2" Align="Align.End" />
|
|
<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>
|
|
<TemplateColumn Align="Align.Center" Width="50px">
|
|
<FluentButton IconEnd="@(new Icons.Regular.Size16.Edit())" Appearance="Appearance.Neutral" title="Bearbeiten" aria-label="Bearbeiten" OnClick="@(() => EditAsync(context.Id))" />
|
|
</TemplateColumn>
|
|
</FluentDataGrid>
|
|
</div>
|
|
|
|
@if (source.Count == 0)
|
|
{
|
|
<FluentMessageBar Intent="MessageIntent.Info" AllowDismiss="false">Noch keine Abrechnungen erfasst.</FluentMessageBar>
|
|
}
|
|
else
|
|
{
|
|
<div class="pair">
|
|
<FluentCard class="chart-card">
|
|
<div class="card-title">Verbrauch pro Periode</div>
|
|
<ChartJsChart Kind="stackedBar" Data="@barData" Height="360px"
|
|
AriaLabel="Netzbezug und PV-Produktion pro Abrechnungsperiode, gestapelte Balken in kWh" />
|
|
</FluentCard>
|
|
<FluentCard class="chart-card">
|
|
<div class="card-title">Preis pro kWh</div>
|
|
<ChartJsChart Kind="line" Data="@lineData" Height="360px"
|
|
AriaLabel="Preis pro kWh über die Abrechnungsperioden" />
|
|
</FluentCard>
|
|
</div>
|
|
}
|
|
</div>
|