[#32] Documents: Add PaymentVariantSummary

This commit is contained in:
2024-05-07 12:32:53 +02:00
parent 384f7c9ec0
commit 30536819e7
7 changed files with 196 additions and 4 deletions

View File

@ -0,0 +1,70 @@
@using RazorLight
@using Elwig.Helpers
@inherits TemplatePage<Elwig.Documents.PaymentVariantSummary>
@model Elwig.Documents.PaymentVariantSummary
@{ Layout = "Document"; }
<link rel="stylesheet" href="file:///@Raw(Model.DataPath)\resources\PaymentVariantSummary.css" />
<main>
<h1>Auszahlungsvariante</h1>
<h2>@Model.Variant.Name</h2>
<!-- TODO -->
<table class="payment-variant">
<colgroup>
<col style="width: 30mm;"/>
<col style="width: 20mm;"/>
<col style="width: 25mm;"/>
<col style="width: 20mm;"/>
<col style="width: 25mm;"/>
<col style="width: 20mm;"/>
<col style="width: 25mm;"/>
</colgroup>
<thead>
<tr>
<th rowspan="2" style="text-align: left;">Qualitätsstufe</th>
<th>Gradation</th>
<th colspan="2">ungebunden</th>
<th colspan="2">gebunden</th>
<th>Gesamt</th>
</tr>
<tr>
<th>[@(true ? "°Oe" : "°KMW")]</th>
<th>[kg]</th>
<th>[@(Model.CurrencySymbol)/kg]</th>
<th>[kg]</th>
<th>[@(Model.CurrencySymbol)/kg]</th>
<th>[@(Model.CurrencySymbol)]</th>
</tr>
</thead>
<tbody>
@{
string? lastHdr = null;
}
@foreach (var row in Model.Data.Rows) {
var hdr = $"{row.Variety}{(row.Attribute != null ? " / " : "")}{row.Attribute}{(row.Cultivation != null ? " / " : "")}{row.Cultivation}";
if (lastHdr != hdr) {
var rows = Model.Data.Rows
.Where(r => r.Variety == row.Variety && r.Attribute == row.Attribute && r.Cultivation == row.Cultivation)
.ToList();
<tr class="subheading @(hdr != lastHdr && lastHdr != null ? "new" : "")">
<th colspan="2">@hdr</th>
<td class="number">@($"{rows.Sum(r => r.WeightUngeb):N0}")</td>
<td></td>
<td class="number">@($"{rows.Sum(r => r.WeightGeb):N0}")</td>
<td></td>
<td class="number">@($"{rows.Sum(r => r.Amount):N2}")</td>
</tr>
}
<tr>
<td>@(row.QualityLevel)</td>
<td class="center">@($"{row.Oe:N0}")</td>
<td class="number">@(row.WeightUngeb != 0 ? $"{row.WeightUngeb:N0}" : "-")</td>
<td class="number">@(row.PriceUngeb != null ? $"{row.PriceUngeb:N4}" : "-")</td>
<td class="number">@(row.WeightGeb != 0 ? $"{row.WeightGeb:N0}" : "-")</td>
<td class="number">@(row.PriceGeb != null ? $"{row.PriceGeb:N4}" : "-")</td>
<td class="number">@($"{row.Amount:N2}")</td>
</tr>
lastHdr = hdr;
}
</tbody>
</table>
</main>