Compare commits
3 commits
034bc4e0f0
...
ca4a67f20a
| Author | SHA1 | Date | |
|---|---|---|---|
| ca4a67f20a | |||
| df52237420 | |||
| 52870bb089 |
12 changed files with 204 additions and 114 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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")]
|
||||
|
|
|
|||
73
Schaad.Accounting.Common/Models/ElectricityHalfYear.cs
Normal file
73
Schaad.Accounting.Common/Models/ElectricityHalfYear.cs
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Schaad.Accounting.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// One calendar half-year (January–June or July–December) of electricity bills, for the
|
||||
/// charts on the Strom page. <see cref="Bill"/> holds the bill values that fall into this
|
||||
/// half-year, or is null if no bill covers it.
|
||||
/// </summary>
|
||||
public class ElectricityHalfYear
|
||||
{
|
||||
public DateOnly From { get; init; }
|
||||
|
||||
public ElectricityBill Bill { get; init; }
|
||||
|
||||
/// <summary>Short label for a chart axis, e.g. "H2 23".</summary>
|
||||
public string Label => $"H{(From.Month <= 6 ? 1 : 2)} {From:yy}";
|
||||
|
||||
/// <summary>
|
||||
/// Splits the bills into calendar half-years, from the first to the last covered one
|
||||
/// (half-years in between that no bill covers are included with a null Bill). 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.
|
||||
/// </summary>
|
||||
public static List<ElectricityHalfYear> FromBills(IEnumerable<ElectricityBill> bills)
|
||||
{
|
||||
var sums = new SortedDictionary<DateOnly, ElectricityBill>();
|
||||
foreach (var bill in bills)
|
||||
{
|
||||
var months = MonthIndex(bill.PeriodTo) - MonthIndex(bill.PeriodFrom) + 1;
|
||||
if (months <= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var monthsPerHalf = Enumerable.Range(0, months)
|
||||
.Select(m => HalfYearStart(bill.PeriodFrom.AddMonths(m)))
|
||||
.GroupBy(start => start);
|
||||
foreach (var half in monthsPerHalf)
|
||||
{
|
||||
var share = (decimal)half.Count() / months;
|
||||
if (!sums.TryGetValue(half.Key, out var sum))
|
||||
{
|
||||
sum = new ElectricityBill { PeriodFrom = half.Key, PeriodTo = half.Key.AddMonths(6).AddDays(-1) };
|
||||
sums[half.Key] = sum;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
var result = new List<ElectricityHalfYear>();
|
||||
if (sums.Count == 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
for (var start = sums.Keys.First(); start <= sums.Keys.Last(); start = start.AddMonths(6))
|
||||
{
|
||||
result.Add(new ElectricityHalfYear { From = start, Bill = sums.GetValueOrDefault(start) });
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int MonthIndex(DateOnly date) => date.Year * 12 + date.Month - 1;
|
||||
|
||||
private static DateOnly HalfYearStart(DateOnly date) => new(date.Year, date.Month <= 6 ? 1 : 7, 1);
|
||||
}
|
||||
}
|
||||
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
{
|
||||
|
|
|
|||
79
Schaad.Accounting.Tests/ElectricityHalfYearTestShould.cs
Normal file
79
Schaad.Accounting.Tests/ElectricityHalfYearTestShould.cs
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
using Schaad.Accounting.Models;
|
||||
using Shouldly;
|
||||
|
||||
namespace Schaad.Accounting.Tests;
|
||||
|
||||
public class ElectricityHalfYearTestShould
|
||||
{
|
||||
[Fact]
|
||||
public void SplitYearlyBillIntoTwoHalvesWhenPeriodRunsJulyToJune()
|
||||
{
|
||||
var bill = Bill(new DateOnly(2023, 7, 1), new DateOnly(2024, 6, 30));
|
||||
bill.GridKwh = 3000m;
|
||||
bill.PvKwh = 2000m;
|
||||
bill.GridChf = 900m;
|
||||
bill.PvChf = 400m;
|
||||
bill.SideCostsChf = 100m;
|
||||
|
||||
var halves = ElectricityHalfYear.FromBills([bill]);
|
||||
|
||||
halves.Count.ShouldBe(2);
|
||||
halves[0].From.ShouldBe(new DateOnly(2023, 7, 1));
|
||||
halves[1].From.ShouldBe(new DateOnly(2024, 1, 1));
|
||||
foreach (var half in halves)
|
||||
{
|
||||
half.Bill.GridKwh.ShouldBe(1500m);
|
||||
half.Bill.PvKwh.ShouldBe(1000m);
|
||||
half.Bill.GridChf.ShouldBe(450m);
|
||||
half.Bill.PvChf.ShouldBe(200m);
|
||||
half.Bill.SideCostsChf.ShouldBe(50m);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void KeepPricePerKwhOfTheBillWhenSplittingIt()
|
||||
{
|
||||
var bill = Bill(new DateOnly(2023, 7, 1), new DateOnly(2024, 6, 30));
|
||||
bill.GridKwh = 3000m;
|
||||
bill.GridChf = 900m;
|
||||
|
||||
var halves = ElectricityHalfYear.FromBills([bill]);
|
||||
|
||||
halves.ShouldAllBe(h => h.Bill.GridChfPerKwh == 0.3m);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AddUpBillsWhenTheyShareAHalfYear()
|
||||
{
|
||||
var first = Bill(new DateOnly(2024, 1, 1), new DateOnly(2024, 3, 31));
|
||||
first.GridKwh = 100m;
|
||||
var second = Bill(new DateOnly(2024, 4, 1), new DateOnly(2024, 6, 30));
|
||||
second.GridKwh = 200m;
|
||||
|
||||
var halves = ElectricityHalfYear.FromBills([first, second]);
|
||||
|
||||
halves.Count.ShouldBe(1);
|
||||
halves[0].Bill.GridKwh.ShouldBe(300m);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IncludeEmptyHalfYearWhenNoBillCoversIt()
|
||||
{
|
||||
var first = Bill(new DateOnly(2022, 7, 1), new DateOnly(2023, 6, 30));
|
||||
var later = Bill(new DateOnly(2024, 7, 1), new DateOnly(2025, 6, 30));
|
||||
|
||||
var halves = ElectricityHalfYear.FromBills([later, first]);
|
||||
|
||||
halves.Select(h => h.Label).ShouldBe(["H2 22", "H1 23", "H2 23", "H1 24", "H2 24", "H1 25"]);
|
||||
halves[2].Bill.ShouldBeNull();
|
||||
halves[3].Bill.ShouldBeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReturnEmptyListWhenThereAreNoBills()
|
||||
{
|
||||
ElectricityHalfYear.FromBills([]).ShouldBeEmpty();
|
||||
}
|
||||
|
||||
private static ElectricityBill Bill(DateOnly from, DateOnly to) => new() { PeriodFrom = from, PeriodTo = to };
|
||||
}
|
||||
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -9,6 +9,32 @@
|
|||
<FluentButton IconStart="@(new Icons.Regular.Size16.Add())" Appearance="Appearance.Neutral" OnClick="AddAsync">Neue Abrechnung hinzufügen</FluentButton>
|
||||
</FluentStack>
|
||||
|
||||
@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 Halbjahr</div>
|
||||
<ChartJsChart Kind="stackedBar" Data="@barData" Height="360px"
|
||||
AriaLabel="Netzbezug und PV-Produktion pro Halbjahr, 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 für Netz, PV und Total pro Halbjahr" />
|
||||
</FluentCard>
|
||||
</div>
|
||||
|
||||
<FluentCard class="chart-card">
|
||||
<div class="card-title">Gesamtkosten pro Halbjahr</div>
|
||||
<ChartJsChart Kind="line" Data="@costData" Height="320px"
|
||||
AriaLabel="Gesamtkosten pro Halbjahr" />
|
||||
</FluentCard>
|
||||
}
|
||||
|
||||
<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" />
|
||||
|
|
@ -21,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>
|
||||
|
|
@ -34,30 +55,4 @@
|
|||
</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 für Netz, PV und Total über die Abrechnungsperioden" />
|
||||
</FluentCard>
|
||||
</div>
|
||||
|
||||
<FluentCard class="chart-card">
|
||||
<div class="card-title">Gesamtkosten pro Periode</div>
|
||||
<ChartJsChart Kind="line" Data="@costData" Height="320px"
|
||||
AriaLabel="Gesamtkosten pro Abrechnungsperiode" />
|
||||
</FluentCard>
|
||||
}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using System.Globalization;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.FluentUI.AspNetCore.Components;
|
||||
using Schaad.Accounting.Interfaces;
|
||||
|
|
@ -11,13 +10,11 @@ namespace Schaad.Accounting.UI.Components.Pages;
|
|||
/// <summary>
|
||||
/// 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
|
||||
/// <see cref="IElectricityBillRepository"/>). Grid for entering/editing, plus two charts:
|
||||
/// consumption split grid/PV per period, and the resulting price per kWh.
|
||||
/// <see cref="IElectricityBillRepository"/>). Grid for entering/editing, plus charts per half-year
|
||||
/// (see <see cref="ElectricityHalfYear"/>): consumption grid/PV, price per kWh and total costs.
|
||||
/// </summary>
|
||||
public partial class Electricity : ComponentBase
|
||||
{
|
||||
private static readonly CultureInfo SwissNumbers = CreateSwissNumbers();
|
||||
|
||||
[Inject]
|
||||
private IElectricityBillRepository electricityBillRepository { get; set; } = null!;
|
||||
|
||||
|
|
@ -48,14 +45,16 @@ public partial class Electricity : ComponentBase
|
|||
|
||||
private void BuildCharts()
|
||||
{
|
||||
var labels = source.Select(ChartLabel).ToList();
|
||||
// One entry per half-year; a yearly bill is split evenly into its two halves.
|
||||
var halves = ElectricityHalfYear.FromBills(source);
|
||||
var labels = halves.Select(h => h.Label).ToList();
|
||||
barData = new
|
||||
{
|
||||
labels,
|
||||
series = new object[]
|
||||
{
|
||||
new { name = "Netz", color = ChartTheme.ColorAt(0), values = source.Select(b => b.GridKwh).ToList(), clickable = false },
|
||||
new { name = "PV", color = ChartTheme.ColorAt(1), values = source.Select(b => b.PvKwh).ToList(), clickable = false }
|
||||
new { name = "Netz", color = ChartTheme.ColorAt(0), values = halves.Select(h => h.Bill?.GridKwh).ToList(), clickable = false },
|
||||
new { name = "PV", color = ChartTheme.ColorAt(1), values = halves.Select(h => h.Bill?.PvKwh).ToList(), clickable = false }
|
||||
},
|
||||
unit = "kWh"
|
||||
};
|
||||
|
|
@ -64,9 +63,9 @@ public partial class Electricity : ComponentBase
|
|||
labels,
|
||||
series = new object[]
|
||||
{
|
||||
new { name = "Netz", color = ChartTheme.ColorAt(0), values = source.Select(b => b.GridChfPerKwh).ToList(), width = 2 },
|
||||
new { name = "PV", color = ChartTheme.ColorAt(1), values = source.Select(b => b.PvChfPerKwh).ToList(), width = 2 },
|
||||
new { name = "Total", color = ChartTheme.OtherColor, values = source.Select(b => (decimal?)b.ChfPerKwh).ToList(), width = 2 }
|
||||
new { name = "Netz", color = ChartTheme.ColorAt(0), values = halves.Select(h => h.Bill?.GridChfPerKwh).ToList(), width = 2 },
|
||||
new { name = "PV", color = ChartTheme.ColorAt(1), values = halves.Select(h => h.Bill?.PvChfPerKwh).ToList(), width = 2 },
|
||||
new { name = "Total", color = ChartTheme.OtherColor, values = halves.Select(h => h.Bill?.ChfPerKwh).ToList(), width = 2 }
|
||||
},
|
||||
unit = "CHF/kWh",
|
||||
axisDecimals = 2
|
||||
|
|
@ -76,7 +75,7 @@ public partial class Electricity : ComponentBase
|
|||
labels,
|
||||
series = new object[]
|
||||
{
|
||||
new { name = "Total", color = ChartTheme.ColorAt(2), values = source.Select(b => (decimal?)b.TotalChf).ToList(), width = 2 }
|
||||
new { name = "Total", color = ChartTheme.ColorAt(2), values = halves.Select(h => h.Bill?.TotalChf).ToList(), width = 2 }
|
||||
},
|
||||
unit = "CHF"
|
||||
};
|
||||
|
|
@ -135,17 +134,5 @@ public partial class Electricity : ComponentBase
|
|||
}
|
||||
}
|
||||
|
||||
// Short label for the chart axis, e.g. "23/24".
|
||||
private static string ChartLabel(ElectricityBill bill) => $"{bill.PeriodFrom:yy}/{bill.PeriodTo:yy}";
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@
|
|||
}
|
||||
},
|
||||
"Settings": {
|
||||
"DataPath": "/home/schaad/Documents/Developer/Data/Accounting/",
|
||||
"DataPath_": "/home/schaad/Documents/Developer/Data/Accounting/",
|
||||
"DataPath": "D:\\Developer\\AccountingData",
|
||||
"FixerIoApiKey": "ee23142f1120bb1223b0e76f98abfa97",
|
||||
"DefaultMandator": "Claudio Schaad"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 |
Loading…
Reference in a new issue