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

@ -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;
}