Lieferscheine

This commit is contained in:
2023-08-09 22:41:00 +02:00
parent f4c24d9578
commit 7af27ab5de
16 changed files with 269 additions and 39 deletions

View File

@ -13,7 +13,7 @@
</div>
<address>@Model.Address</address>
</div>
<aside></aside>
<aside>@Raw(Model.Aside)</aside>
</div>
<main>
@RenderBody()

View File

@ -5,10 +5,20 @@ namespace Elwig.Documents {
public Member Member;
public bool IncludeSender = false;
public string Aside { get; set; }
public string? Location { get; set; }
public BusinessDocument(string title, Member m, bool includeSender = false) : base(title) {
Member = m;
Location = App.BranchName;
IncludeSender = includeSender;
var uid = (m.UstId ?? "-") + (m.IsBuchführend ? "" : " <i>(pauschaliert)</i>");
Aside = $"<table><colgroup><col span='1' style='width: 2.25cm;'/><col span='1' style='width: 100%;'/></colgroup>" +
$"<thead><tr><th colspan='2'>Mitglied</th></tr></thead><tbody>" +
$"<tr><th>Mitglieds-Nr.</th><td>{m.MgNr}</td></tr>" +
$"<tr><th>Betriebs-Nr.</th><td>{m.LfbisNr}</td></tr>" +
$"<tr><th>UID</th><td>{uid}</td></tr>" +
$"</tbody></table>";
}
public string Address {
@ -16,9 +26,9 @@ namespace Elwig.Documents {
var b = Member.BillingAddress;
var plz = (b == null) ? Member.PostalDest.AtPlz : b.PostalDest.AtPlz;
if (b != null) {
return $"{b.Name}\n{b.Address}\n{plz.Plz} {plz.Dest}";
return $"{b.Name}\n{Member.AdministrativeName}\n{b.Address}\n{plz.Plz} {plz.Dest}\nÖsterreich";
} else {
return $"{Member.AdministrativeName}\n{Member.Address}\n{plz.Plz} {plz.Dest}";
return $"{Member.AdministrativeName}\n{Member.Address}\n{plz.Plz} {plz.Dest}\nÖsterreich";
}
}
}

View File

@ -2,8 +2,6 @@ using Elwig.Models;
namespace Elwig.Documents {
public class BusinessLetter : BusinessDocument {
public BusinessLetter(string title, Member m) : base(title, m) {
}
public BusinessLetter(string title, Member m) : base(title, m) { }
}
}

View File

@ -3,30 +3,67 @@
@model Elwig.Documents.DeliveryNote
@{ Layout = "BusinessDocument"; }
<h1>Traubenübernahmeschein Nr. @Model.Delivery.LsNr</h1>
<table>
<div class="date">@Model.Location, am @($"{Model.Date:dd.MM.yyyy}")</div>
<h1>@Model.Title</h1>
<table class="delivery">
<colgroup>
<col span="1" style="width: 1cm;"/>
<col span="1" style="width: 50%;"/>
<col span="1" style="width: 50%;"/>
<col span="1" style="width: 3cm;"/>
<col span="1" style="width: 1.25cm;"/>
<col span="1" style="width: 1.25cm;"/>
<col span="1" style="width: 1.5cm;"/>
</colgroup>
<thead>
<tr>
<th rowspan="2">Sorte</th>
<th rowspan="2">Qualitätsstufe</th>
<th class="main" rowspan="2" style="text-align: center;">Pos.</th>
<th class="main" rowspan="2">Sorte</th>
<th class="main" rowspan="2">Attribut(e)</th>
<th class="main" rowspan="2">Qualitätsstufe</th>
<th colspan="2">Gradation</th>
<th>Gewicht</th>
</tr>
<tr>
<th>°KMW</th>
<th>°Oe</th>
<th>kg</th>
<th style="font-size: 8pt">[°Oe]</th>
<th style="font-size: 8pt">[°KMW]</th>
<th style="font-size: 8pt">[kg]</th>
</tr>
</thead>
<tbody>
@foreach (var part in Model.Delivery.Parts.OrderBy(p => p.DPNr)) {
<tr>
<tr class="main">
<td style="text-align: center;">@part.DPNr</td>
<td>@part.Variant.Name</td>
<td>@string.Join(" / ", part.Attributes)</td>
<td>@part.Quality.Name</td>
<td>@part.Kmw</td>
<td>@part.Oe</td>
<td>@part.Weight</td>
<td class="narrow" style="text-align: center;">@($"{part.Oe:N0}")</td>
<td class="narrow" style="text-align: center;">@($"{part.Kmw:N1}")</td>
<td class="narrow" style="text-align: right;">@($"{part.Weight:N0}")</td>
</tr>
}
<tr><td></td><td colspan="3" style="font-size: 8pt; white-space: pre">Herkunft: @part.OriginString</td></tr>
<tr><td></td><td colspan="3" style="font-size: 8pt;">
@(part.ManualWeighing ? "Handwiegung" : $"Waage: {part.ScaleId ?? "?"}, ID: {part.WeighingId ?? "?"}") (@(part.IsGerebelt ? "gerebelt gewogen" : "nicht gerebelt gewogen"))
</td></tr>
@if (part.Comment != null) {
<tr><td></td><td colspan="3" style="font-size: 8pt;">Anmerkung: @part.Comment</td></tr>
}
@if (part.Temperature != null || part.Acid != null) {
<tr><td></td><td colspan="3" style="font-size: 8pt;">@(part.Temperature != null ? $"Temperatur: {part.Temperature:N1} °C" : "")@(part.Temperature != null && part.Acid != null ? ", " : "")@(part.Acid != null ? $"Säure: {part.Acid:N1} g/l" : "")</td></tr>
}
}
</tbody>
</table>
@if (Model.Delivery.Comment != null) {
<p class="comment">Amerkung zur Lieferung: @Model.Delivery.Comment</p>
}
<div class="bottom">
<!-- FIXME page breaking -->
@if (Model.Text != null) {
<p class="comment">@Model.Text</p>
}
<div class="signatures">
<div>Genossenschaft</div>
<div>Mitglied</div>
</div>
</div>

View File

@ -4,9 +4,17 @@ namespace Elwig.Documents {
public class DeliveryNote : BusinessDocument {
public Delivery Delivery;
public string? Text;
public DeliveryNote(Delivery d) : base($"Lieferschein {d.LsNr}", d.Member) {
public DeliveryNote(Delivery d) : base($"Traubenübernahmeschein Nr. {d.LsNr}", d.Member) {
Delivery = d;
Aside = Aside.Replace("</table>", "") +
$"<thead><tr><th colspan='2'>Lieferung</th></tr></thead><tbody>" +
$"<tr><th>LS-Nr.</th><td>{d.LsNr}</td></tr>" +
$"<tr><th>Datum/Zeit</th><td>{d.Date:dd.MM.yyyy} / {d.Time:HH:mm}</td></tr>" +
$"<tr><th>Zweigstelle</th><td>{d.Branch.Name}</td></tr>" +
$"</tbody></table>";
Text = App.Client.DeliveryNoteText;
}
}
}

View File

@ -24,7 +24,7 @@
<header>@Raw(Model.Header)</header>
<div class="footer-wrapper">
<div class="pre-footer">
<span class="date">@Model.FullDateString</span>
<span class="date">@($"{Model.Date:dddd, d. MMMM yyyy}")</span>
<span class="page"></span>
</div>
<footer>@Raw(Model.Footer)</footer>

View File

@ -9,10 +9,15 @@ namespace Elwig.Documents {
private TempFile? PdfFile = null;
public Document(string title) {
var c = App.Client;
DataPath = App.DataPath;
Title = title;
Header = $"<h1>{App.Client.Name}</h1>";
Footer = App.Client.NameFull;
Header = $"<h1>{c.Name}</h1>";
Footer = $"{c.NameFull}<br/>" +
$"{c.Address} \u00b7 {c.Plz} {c.Ort} \u00b7 Österreich \u00b7 " +
$"Tel.: {c.PhoneNr} \u00b7 Fax: {c.FaxNr}<br/>{c.EmailAddress} \u00b7 {c.Website} \u00b7 " +
$"Betriebs-Nr.: {c.LfbisNr} \u00b7 UID: {c.UstId}<br/>" +
$"BIC: {c.Bic} \u00b7 IBAN: {c.Iban}";
Date = DateTime.Today;
}
@ -23,20 +28,13 @@ namespace Elwig.Documents {
public void Dispose() {
PdfFile?.Dispose();
PdfFile = null;
GC.SuppressFinalize(this);
}
public string DataPath { get; set; }
public string Title { get; set; }
public string Header { get; set; }
public string Footer { get; set; }
public string FullDateString {
get => Date.ToString("dddd, d. MMMM yyyy");
}
public DateTime Date { get; set; }
private async Task<string> Render() {
@ -57,7 +55,7 @@ namespace Elwig.Documents {
await File.WriteAllTextAsync(tmpHtml.FilePath, await Render());
await Pdf.Convert(tmpHtml.FilePath, pdf.FilePath);
}
Pdf.UpdateMetadata(pdf.FilePath, Title, "Winzergenossenschaft für Matzen und Umgebung reg. Gen.m.b.H.");
Pdf.UpdateMetadata(pdf.FilePath, Title, App.Client.NameFull);
PdfFile = pdf;
}

View File

@ -10,6 +10,7 @@
body {
margin: 0;
break-inside: avoid;
}
.m1, .m2, .m3 {
@ -24,6 +25,10 @@ body {
.m2 {top: 148.5mm;}
.m3 {top: 210mm;}
header, .address-wrapper, aside, main {
overflow: hidden;
}
header {
height: 45mm;
padding: 5mm;
@ -33,7 +38,14 @@ header {
right: 0;
text-align: center;
}
header h1{
font-size: 18pt;
margin-top: 1cm;
}
.spacing {height: 20mm;}
.info-wrapper {
width: 100%;
height:45mm;
@ -79,6 +91,38 @@ aside {
top: 5mm;
}
aside table {
border-collapse: collapse;
border: 1pt solid #808080;
width: calc(100% - 1cm);
margin-right: 1cm;
}
aside table thead:not(:first-child) tr {
border-top: 1pt solid #808080;
}
aside table thead th {
background-color: #E0E0E0;
font-size: 10pt;
}
aside table tbody th,
aside table tbody td {
padding: 0.5mm 1mm;
text-align: left;
font-size: 10pt;
}
aside table tbody th {
font-weight: normal;
}
.main-wrapper,
.main-wrapper * {
break-inside: auto;
}
main {
margin: 8.46mm 20mm 4.23mm 25mm;
}
@ -104,6 +148,11 @@ main h1 {
margin-bottom: 2em;
}
main p.comment {
font-size: 10pt;
hyphens: auto;
}
.footer-wrapper {
padding: 0 20mm 0 25mm;
position: running(page-footer);
@ -139,6 +188,48 @@ footer {
table {
width: 100%;
border-collapse: collapse;
table-layout: fixed;
}
table.delivery {
margin-bottom: 1cm;
}
table.delivery th {
font-weight: normal;
font-style: italic;
font-size: 10pt;
}
table.delivery th.main {
text-align: left;
}
table.delivery tr.main td {
font-weight: bold;
padding-top: 2mm;
}
main .bottom {
bottom: 0;
position: absolute;
width: calc(100% - 25mm - 20mm);
}
main .signatures {
width: 100%;
display: flex;
justify-content: space-around;
margin: 20mm 0 5mm 0;
}
main .signatures > * {
width: 5cm;
border-top: 1pt solid black;
padding-top: 1mm;
text-align: center;
font-size: 10pt;
}
@page {
@ -154,7 +245,7 @@ table {
width: 210mm;
}
header, .address-wrapper, aside, main {
border: 1px solid lightgray;
border: 1pt solid lightgray;
}
.m1, .m2, .m3 {display: none;}
header {top: 0;}