Documents: Make business documents more compact

This commit is contained in:
2023-09-14 20:44:48 +02:00
parent 470f092482
commit ba691f4d17
10 changed files with 36 additions and 16 deletions

View File

@ -4,7 +4,6 @@
@{ Layout = "BusinessDocument"; }
<link rel="stylesheet" href="file:///@Raw(Model.DataPath)\resources\style-deliverynote.css" />
<main>
<div class="date">@Model.Location, am @($"{Model.Date:dd.MM.yyyy}")</div>
<h1>@Model.Title</h1>
@{
bool displayStats = true; // Model.Delivery.Year == Model.CurrentNextSeason
@ -127,7 +126,7 @@
</colgroup>
<thead>
<tr>
<th><b>Gesamtlieferung</b> [kg]</th>
<th><b>Lese @Model.Delivery.Year</b> per @($"{Model.Date:dd.MM.yyyy}") [kg]</th>
<th>Lieferpflicht</th>
<th>Lieferrecht</th>
<th>Unterliefert</th>
@ -147,13 +146,14 @@
$"<td>{sum:N0}</td>";
}
var sortids = Model.Delivery.Parts.Select(p => p.SortId).ToList();
var buckets = Model.MemberBuckets.GroupBy(b => b.Item1[..2]).ToDictionary(g => g.Key, g => g.Count());
}
<tr>
<th>Geschäftsanteile</th>
<th>Gesamtlieferung</th>
@Raw(FormatRow(Model.Member.DeliveryObligation, Model.Member.DeliveryRight, Model.Member.Deliveries.Where(d => d.Year == Model.Delivery.Year).Sum(d => d.Weight)))
</tr>
@foreach (var (id, name, right, obligation, sum) in Model.MemberBuckets.OrderBy(b => b.Item1)) {
if (right > 0 && obligation > 0) {
if (right > 0 || obligation > 0 || (sum > 0 && buckets[id[..2]] > 1)) {
<tr class="@(sortids.Contains(id[..2]) ? "" : "optional")">
<th>@name</th>
@Raw(FormatRow(obligation, right, sum))