@using RazorLight @inherits TemplatePage<Elwig.Documents.DeliveryConfirmation> @model Elwig.Documents.DeliveryConfirmation @{ Layout = "BusinessDocument"; } <link rel="stylesheet" href="file:///@Raw(Model.DataPath)\resources\style-deliveryconfirmation.css"/> <main> <h1>@Model.Title</h1> <table class="delivery-confirmation"> <colgroup> <col style="width: 25mm;"/> <col style="width: 5mm;"/> <col style="width: 20mm;"/> <col style="width: 21mm;"/> <col style="width: 19mm;"/> <col style="width: 10mm;"/> <col style="width: 10mm;"/> <col style="width: 15mm;"/> <col style="width: 12mm;"/> <col style="width: 14mm;"/> <col style="width: 14mm;"/> </colgroup> <thead> <tr> <th rowspan="2" style="text-align: left;">Lieferschein-Nr.</th> <th rowspan="2">Pos.</th> <th rowspan="2" style="text-align: left;">Sorte</th> <th rowspan="2" style="text-align: left;">Attribut(e)</th> <th rowspan="2" style="text-align: left;">Qualitätsstufe</th> <th colspan="2">Gradation</th> <th colspan="2">Flächenbindung</th> <th>Gewicht</th> <th>Davon<br/>abzuwerten</th> </tr> <tr> <th>[°Oe]</th> <th>[°KMW]</th> <th colspan="2">[kg]</th> <th>[kg]</th> <th>[kg]</th> </tr> </thead> <tbody> @{ var lastSortId = ""; } @foreach (var p in Model.Deliveries) { var bins = p.Bins.Where(b => b.Value > 0).OrderByDescending(b => b.BinNr).ToArray(); var rowsBins = bins.Length; var mods = p.Modifiers.Select(m => m.Name).ToArray(); var rowsMod = mods.Length + 1; var rows = Math.Max(rowsBins, rowsMod); var first = true; @for (int i = 0; i < rows; i++) { <tr class="@(first ? "first" : "") @(p.SortId != lastSortId && lastSortId != "" ? "new": "") @(rows > i + 1 ? "trailing" : "")"> @if (first) { <td rowspan="@rows">@p.Delivery.LsNr</td> <td rowspan="@rows">@p.DPNr</td> <td class="small">@p.Variant.Name</td> <td class="small">@p.AttributesString</td> <td class="small">@p.Quality.Name</td> <td rowspan="@rows" class="grad">@($"{p.Oe:N0}")</td> <td rowspan="@rows" class="grad">@($"{p.Kmw:N1}")</td> } @if (i > 0 && i <= mods.Length) { <td colspan="3" class="mod">@(mods[i - 1])</td> } else if (i > 0) { <td colspan="3"></td> } @if (i < bins.Length) { var bin = bins[i]; <td class="geb">@(bin.Discr == "_" ? "ungeb." : $"geb. {p.SortId}{bin.Discr}"):</td> <td class="weight">@($"{bin.Value:N0}")</td> } else { <td colspan="2"></td> } @if (first) { <td rowspan="@rows" class="weight">@($"{p.Weight:N0}")</td> <td rowspan="@rows" class="weight"></td> first = false; } </tr> lastSortId = p.SortId; } } <tr class="sum"> <td colspan="8">Gesamt:</td> <td colspan="2" style="text-align: right;">@($"{Model.Deliveries.Sum(p => p.Weight):N0}")</td> <td></td> </tr> </tbody> </table> <!-- TODO add Gesamtlieferung tabelle --> <div class="text" style="margin-top: 2em;"> @if (Model.Text != null) { <p class="comment" style="white-space: pre-wrap; break-inside: avoid;">@Model.Text</p> } </div> </main>