DeliveryNote: Rework according to Herbert

This commit is contained in:
2023-10-10 16:24:16 +02:00
parent 9df8056616
commit 0e9bae4ec9
6 changed files with 41 additions and 15 deletions

View File

@ -5,9 +5,6 @@
<link rel="stylesheet" href="file:///@Raw(Model.DataPath)\resources\style-deliverynote.css" /> <link rel="stylesheet" href="file:///@Raw(Model.DataPath)\resources\style-deliverynote.css" />
<main> <main>
<h1>@Model.Title</h1> <h1>@Model.Title</h1>
@{
bool displayStats = true; // Model.Delivery.Year == Model.CurrentNextSeason
}
<script> <script>
document.addEventListener("DOMContentLoaded", () => { document.addEventListener("DOMContentLoaded", () => {
const hidden = document.getElementsByClassName("hidden")[0]; const hidden = document.getElementsByClassName("hidden")[0];
@ -113,9 +110,9 @@
@if (Model.Delivery.Comment != null) { @if (Model.Delivery.Comment != null) {
<p class="comment">Amerkung zur Lieferung: @Model.Delivery.Comment</p> <p class="comment">Amerkung zur Lieferung: @Model.Delivery.Comment</p>
} }
@if (displayStats) { @if (Model.DisplayStats > 0) {
<div id="delivery-stats"> <div id="delivery-stats">
<table class="delivery-stats"> <table class="delivery-stats @(Model.DisplayStats > 2 ? "expanded" : "")">
<colgroup> <colgroup>
<col style="width: 45mm;"/> <col style="width: 45mm;"/>
<col style="width: 20mm;"/> <col style="width: 20mm;"/>
@ -150,9 +147,13 @@
var buckets = Model.MemberBuckets.GroupBy(b => b.Item1[..2]).ToDictionary(g => g.Key, g => g.Count()); var buckets = Model.MemberBuckets.GroupBy(b => b.Item1[..2]).ToDictionary(g => g.Key, g => g.Count());
} }
<tr> <tr>
<th>Gesamtlieferung</th> <th>Gesamtlieferung lt. gez. GA</th>
@Raw(FormatRow(Model.Member.DeliveryObligation, Model.Member.DeliveryRight, Model.Member.Deliveries.Where(d => d.Year == Model.Delivery.Year).Sum(d => d.Weight))) @Raw(FormatRow(Model.Member.DeliveryObligation, Model.Member.DeliveryRight, Model.Member.Deliveries.Where(d => d.Year == Model.Delivery.Year).Sum(d => d.Weight)))
</tr> </tr>
@if (Model.DisplayStats > 1) {
<tr class="subheading">
<th>Flächenbindungen:</th>
</tr>
@foreach (var (id, name, right, obligation, sum) in Model.MemberBuckets.OrderBy(b => b.Item1)) { @foreach (var (id, name, right, obligation, sum) in Model.MemberBuckets.OrderBy(b => b.Item1)) {
if (right > 0 || obligation > 0 || (sum > 0 && buckets[id[..2]] > 1 && !id.EndsWith('_'))) { if (right > 0 || obligation > 0 || (sum > 0 && buckets[id[..2]] > 1 && !id.EndsWith('_'))) {
<tr class="@(sortids.Contains(id[..2]) ? "" : "optional")"> <tr class="@(sortids.Contains(id[..2]) ? "" : "optional")">
@ -161,6 +162,7 @@
</tr> </tr>
} }
} }
}
</tbody> </tbody>
</table> </table>
</div> </div>

View File

@ -9,6 +9,12 @@ namespace Elwig.Documents {
public string? Text; public string? Text;
public IEnumerable<(string, string, int, int, int)> MemberBuckets; public IEnumerable<(string, string, int, int, int)> MemberBuckets;
// 0 - none
// 1 - only business shares
// 2 - only business shares and area commitments of varieties from delivery note
// 3 - full
public int DisplayStats = 2;
public DeliveryNote(Delivery d, AppDbContext ctx) : base($"Traubenübernahmeschein Nr. {d.LsNr}", d.Member) { public DeliveryNote(Delivery d, AppDbContext ctx) : base($"Traubenübernahmeschein Nr. {d.LsNr}", d.Member) {
UseBillingAddress = true; UseBillingAddress = true;
ShowDateAndLocation = true; ShowDateAndLocation = true;

View File

@ -29,7 +29,7 @@ namespace Elwig.Documents {
CurrentNextSeason = Utils.CurrentNextSeason; CurrentNextSeason = Utils.CurrentNextSeason;
Title = title; Title = title;
Author = c.NameFull; Author = c.NameFull;
Header = $"<div class='name'>{c.Name}</div><div class='suffix'>{c.NameSuffix}</div>"; Header = $"<div class='name'>{c.Name}</div><div class='suffix'>{c.NameSuffix}</div><div class='type'>{c.NameTypeFull}</div>";
Footer = Utils.GenerateFooter("<br/>", " \u00b7 ") Footer = Utils.GenerateFooter("<br/>", " \u00b7 ")
.Item(c.NameFull).NextLine() .Item(c.NameFull).NextLine()
.Item(c.Address).Item($"{c.Plz} {c.Ort}").Item("Österreich").Item("Tel.", c.PhoneNr).Item("Fax", c.FaxNr).NextLine() .Item(c.Address).Item($"{c.Plz} {c.Ort}").Item("Österreich").Item("Tel.", c.PhoneNr).Item("Fax", c.FaxNr).NextLine()

View File

@ -74,6 +74,15 @@ table.delivery-stats:not(.expanded) tr.optional {
display: none; display: none;
} }
table.delivery-stats tr.subheading th {
text-align: left;
}
table.delivery.expanded tr.subheading:not(:has(~ tr)),
table.delivery tr.subheading:not(:has(~ tr:not(.optional))) {
display: none;
}
table.delivery-stats thead th { table.delivery-stats thead th {
font-weight: normal; font-weight: normal;
font-style: italic; font-style: italic;

View File

@ -40,15 +40,20 @@ header {
header .name { header .name {
font-size: 18pt; font-size: 18pt;
margin-top: 10mm; margin-top: 8mm;
font-weight: bold; font-weight: bold;
} }
header .suffix { header .suffix {
font-size: 12pt; font-size: 14pt;
font-weight: bold; font-weight: bold;
} }
header .type {
font-size: 12pt;
font-weight: normal;
}
.footer-wrapper { .footer-wrapper {
position: running(page-footer); position: running(page-footer);
width: 165mm; width: 165mm;

View File

@ -20,6 +20,10 @@ namespace Elwig.Helpers {
public string Name; public string Name;
public string? NameSuffix; public string? NameSuffix;
public string NameType; public string NameType;
public string NameTypeFull => NameType.Replace(".", "").Replace(" ", "").ToLower() switch {
"reggenmbh" => "registrierte Genossenschaft mit beschränkter Haftung",
_ => NameType,
};
public string NameFull => NameSuffix == null ? $"{Name} {NameType}" : $"{Name}, {NameSuffix}, {NameType}"; public string NameFull => NameSuffix == null ? $"{Name} {NameType}" : $"{Name}, {NameSuffix}, {NameType}";
public Type? Client; public Type? Client;