[#49] PaymentVariantSummary: Add modifier statistics
All checks were successful
Test / Run tests (push) Successful in 2m18s

This commit is contained in:
2024-06-28 21:07:55 +02:00
parent 157d0b75a2
commit 9478f2a1ab
6 changed files with 93 additions and 3 deletions

View File

@ -1,6 +1,8 @@
using Elwig.Helpers.Billing;
using Elwig.Helpers;
using Elwig.Helpers.Billing;
using Elwig.Models.Dtos;
using Elwig.Models.Entities;
using System.Collections.Generic;
using System.Linq;
namespace Elwig.Documents {
@ -15,6 +17,8 @@ namespace Elwig.Documents {
public int MemberNum;
public int DeliveryNum;
public int DeliveryPartNum;
public List<ModifierStat> ModifierStat;
public Dictionary<string, Modifier> Modifiers;
public PaymentVariantSummary(PaymentVar v, PaymentVariantSummaryData data) :
base($"{Name} {v.Year} - {v.Name}") {
@ -25,6 +29,8 @@ namespace Elwig.Documents {
MemberNum = v.Credits.Count;
DeliveryNum = v.DeliveryPartPayments.DistinctBy(p => p.DeliveryPart.Delivery).Count();
DeliveryPartNum = v.DeliveryPartPayments.Count;
ModifierStat = AppDbContext.GetModifierStats(v.Year, v.AvNr).GetAwaiter().GetResult();
Modifiers = v.Season.Modifiers.ToDictionary(m => m.ModId);
}
}
}

View File

@ -167,6 +167,45 @@
</tr>
</tbody>
</table>
<table class="payment-variant border">
<colgroup>
<col style="width: 35mm;"/>
<col style="width: 30mm;"/>
<col style="width: 25mm;"/>
<col style="width: 25mm;"/>
<col style="width: 25mm;"/>
<col style="width: 25mm;"/>
</colgroup>
<thead>
<tr>
<th rowspan="2">Name</th>
<th rowspan="2">Zu-/Abschlag</th>
<th>Lieferungen</th>
<th>Minimum</th>
<th>Maximum</th>
<th>Betrag</th>
</tr>
<tr>
<th>[#]</th>
<th>[@Model.CurrencySymbol]</th>
<th>[@Model.CurrencySymbol]</th>
<th>[@Model.CurrencySymbol]</th>
</tr>
</thead>
<tbody>
@foreach (var m in Model.ModifierStat) {
var mod = Model.Modifiers[m.ModId];
<tr>
<th>@mod.Name</th>
<td class="number">@mod.ValueStr</td>
<td class="number">@($"{m.Count:N0}")</td>
<td class="number">@($"{m.Min:N2}")</td>
<td class="number">@($"{m.Max:N2}")</td>
<td class="number">@($"{m.Sum:N2}")</td>
</tr>
}
</tbody>
</table>
<table class="payment-variant-data">
<colgroup>
<col style="width: 30mm;"/>