From 84edec2b54b9c19a9034ebca7896f97a4ee12a80 Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Mon, 14 Aug 2023 23:51:34 +0200 Subject: [PATCH] =?UTF-8?q?Added=20Zu-/Abschl=C3=A4ge=20to=20Delivery=20No?= =?UTF-8?q?te?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Elwig/Documents/DeliveryNote.cshtml | 38 +++++++++++++++++++++-------- Elwig/Documents/style.css | 27 +++++++++++++++++++- Elwig/Models/Delivery.cs | 11 +++++++++ 3 files changed, 65 insertions(+), 11 deletions(-) diff --git a/Elwig/Documents/DeliveryNote.cshtml b/Elwig/Documents/DeliveryNote.cshtml index bcd9976..7815ab2 100644 --- a/Elwig/Documents/DeliveryNote.cshtml +++ b/Elwig/Documents/DeliveryNote.cshtml @@ -15,8 +15,10 @@ - - + + + + @@ -25,8 +27,8 @@ - - + + @@ -41,24 +43,40 @@ @foreach (var part in Model.Delivery.Parts.OrderBy(p => p.DPNr)) { - - + + - - + @if (part.Modifiers.Count() > 0) { + var first = true; + foreach (var mod in part.Modifiers) { + + first = false; + } + } + @if (part.Comment != null) { - + } @if (part.Temperature != null || part.Acid != null) { - + } } + @if (Model.Delivery.Parts.Count() > 1) { + + + + + + + + }
Pos.SorteAttribut(e)SorteAttribut(e) Qualitätsstufe Gradation Gewicht
@part.DPNr@part.Variant.Name@string.Join(" / ", part.Attributes)@part.Variant.Name@string.Join(" / ", part.Attributes) @part.Quality.Name @($"{part.Oe:N0}") @($"{part.Kmw:N1}") @($"{part.Weight:N0}")
Herkunft: @part.OriginString
+
Herkunft: @part.OriginString
@Raw(first ? "Zu-/Abschläge:" : "")@mod.Name@mod.ValueStr
@(part.ManualWeighing ? "Handwiegung" : $"Waage: {part.ScaleId ?? "?"}, ID: {part.WeighingId ?? "?"}") (@(part.IsGerebelt ? "gerebelt gewogen" : "nicht gerebelt gewogen"))
Anmerkung: @part.Comment
Anmerkung: @part.Comment
@(part.Temperature != null ? $"Temperatur: {part.Temperature:N1} °C" : "")@(part.Temperature != null && part.Acid != null ? ", " : "")@(part.Acid != null ? $"Säure: {part.Acid:N1} g/l" : "")
@Raw(part.Temperature != null ? $"Temperatur: {part.Temperature:N1} °C" : "")@(part.Temperature != null && part.Acid != null ? ", " : "")@Raw(part.Acid != null ? $"Säure: {part.Acid:N1} g/l" : "")
@($"{Model.Delivery.Oe:N0}")@($"{Model.Delivery.Kmw:N1}")@($"{Model.Delivery.Weight:N0}")
@if (Model.Delivery.Comment != null) { diff --git a/Elwig/Documents/style.css b/Elwig/Documents/style.css index fc1a25b..184d261 100644 --- a/Elwig/Documents/style.css +++ b/Elwig/Documents/style.css @@ -83,6 +83,11 @@ address { font-style: normal; } +table td, +table th { + padding: 0.5mm 1mm; +} + aside { height: 40mm; width: 75mm; @@ -110,7 +115,6 @@ aside table thead th { aside table tbody th, aside table tbody td { - padding: 0.5mm 1mm; text-align: left; font-size: 10pt; } @@ -220,6 +224,27 @@ table.delivery tr.main td { padding-top: 2mm; } +table.delivery tbody tr:not(.main) td { + font-size: 8pt; +} + +table.delivery tr.tight:not(.first) td { + padding-top: 0; + padding-bottom: 0; +} + +table.delivery tr.tight.first td { + padding-bottom: 0; +} + +table.delivery tr.tight:has(+ tr:not(.tight)) td { + padding-bottom: 0.5mm !important; +} + +table.delivery tr.sum { + border-top: 1pt solid black; +} + .hidden { visibility: hidden; } diff --git a/Elwig/Models/Delivery.cs b/Elwig/Models/Delivery.cs index 2735ad2..5594713 100644 --- a/Elwig/Models/Delivery.cs +++ b/Elwig/Models/Delivery.cs @@ -84,6 +84,17 @@ namespace Elwig.Models { public string SortIdString => string.Join(", ", SortIds); + public double Kmw => Parts.Aggregate( + (Weight: 0, Kmw: 0.0), + (sum, item) => ( + sum.Weight + item.Weight, + (sum.Kmw * sum.Weight + item.Kmw * item.Weight) / (sum.Weight + item.Weight) + ), + sum => sum.Kmw + ); + + public double Oe => Utils.KmwToOe(Kmw); + public int SearchScore(IEnumerable keywords) { var list = new string?[] { LsNr, Year.ToString(), Date.ToString("dd.MM.yyyy"), Time?.ToString("HH:mm"),