[#32] Documents: Add PaymentVariantSummary
This commit is contained in:
@ -88,6 +88,8 @@ namespace Elwig.Documents {
|
||||
name = "MemberList";
|
||||
} else if (this is WineQualityStatistics) {
|
||||
name = "WineQualityStatistics";
|
||||
} else if (this is PaymentVariantSummary) {
|
||||
name = "PaymentVariantSummary";
|
||||
} else {
|
||||
throw new InvalidOperationException("Invalid document object");
|
||||
}
|
||||
|
19
Elwig/Documents/PaymentVariantSummary.cs
Normal file
19
Elwig/Documents/PaymentVariantSummary.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using Elwig.Models.Dtos;
|
||||
using Elwig.Models.Entities;
|
||||
|
||||
namespace Elwig.Documents {
|
||||
public class PaymentVariantSummary : Document {
|
||||
|
||||
public new static string Name => "Auszahlungsvariante";
|
||||
|
||||
public PaymentVariantSummaryData Data;
|
||||
public PaymentVar Variant;
|
||||
public string CurrencySymbol;
|
||||
|
||||
public PaymentVariantSummary(PaymentVar v, PaymentVariantSummaryData data) : base(v.Name) {
|
||||
Variant = v;
|
||||
Data = data;
|
||||
CurrencySymbol = v.Season.Currency.Symbol ?? v.Season.Currency.Code;
|
||||
}
|
||||
}
|
||||
}
|
70
Elwig/Documents/PaymentVariantSummary.cshtml
Normal file
70
Elwig/Documents/PaymentVariantSummary.cshtml
Normal 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>
|
17
Elwig/Documents/PaymentVariantSummary.css
Normal file
17
Elwig/Documents/PaymentVariantSummary.css
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
font-size: 24pt;
|
||||
margin-top: 10mm;
|
||||
margin-bottom: 2mm;
|
||||
}
|
||||
|
||||
h2 {
|
||||
text-align: center;
|
||||
font-size: 14pt;
|
||||
margin-top: 2mm;
|
||||
}
|
||||
|
||||
table.payment-variant {
|
||||
break-before: page;
|
||||
}
|
Reference in New Issue
Block a user