From 49822a196050f12a566444b3e3e0ea8cd40f6c5b Mon Sep 17 00:00:00 2001 From: Elias Fierke Date: Tue, 30 Jun 2026 15:27:44 +0200 Subject: [PATCH] [feat:] pvst-integration (logo missing, will be in the next commits) --- DataStore/Settings.cs | 2 +- MainWindow.axaml | 5 +---- MainWindow.axaml.cs | 8 ++++++-- Tasks/PdfBuilder.cs | 12 +++++++++--- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/DataStore/Settings.cs b/DataStore/Settings.cs index b7eeea3..4f22f20 100644 --- a/DataStore/Settings.cs +++ b/DataStore/Settings.cs @@ -69,7 +69,7 @@ public class PdfExportSettings public double smallFontSize { get; set; } = 6; public bool exportRunningSheets { get; set; } = true; public int rsNumGrouped { get; set; } = 25; - public int rsPlzStartpoint { get; set; } = 2; + public bool rsPvSt { get; set; } = true; public string rsKNrAbs { get; set; } = ""; public string rsKNrEmp { get; set; } = ""; diff --git a/MainWindow.axaml b/MainWindow.axaml index d2216de..9d11cd7 100644 --- a/MainWindow.axaml +++ b/MainWindow.axaml @@ -314,10 +314,7 @@ - - - - + diff --git a/MainWindow.axaml.cs b/MainWindow.axaml.cs index fe66f2d..b23cb23 100644 --- a/MainWindow.axaml.cs +++ b/MainWindow.axaml.cs @@ -888,7 +888,7 @@ public partial class MainWindow : Window builder.CreateAddressLabelPdfFromAddressSetWithPlaceholder( ((KasAddressList)LstCustomerAdressSets.SelectedItem).ID, - "Company Logo/Info", + "Company Logo/Info", Settings._instance.pdfExport.rsPvSt, filePath ); @@ -931,11 +931,13 @@ public partial class MainWindow : Window TbExpMargMarginBottom.Value = (decimal)options.pageMarginBottomMm; TbExpMargMarginLeft.Value = (decimal)options.pageMarginLeftMm; TbExpMargMarginRight.Value = (decimal)options.pageMarginRightMm; + NudExpRnsPlzcount.Value = options.rsNumGrouped; TbExpMargRowsPerPage.Value = options.rowsPerPage; NudExpMargColumnsPerPage.Value = options.columnsPerPage; NudExpMargFontSize.Value = (decimal)options.fontSize; NudExpMargSmallFontSize.Value = (decimal)options.smallFontSize; + CbExpRnsPvSt.IsChecked = options.rsPvSt; TbExpRnsKNrAbs.Text = options.rsKNrAbs; TbExpRnsKNrEmp.Text = options.rsKNrEmp; @@ -981,7 +983,9 @@ public partial class MainWindow : Window rsAMANr = TbExpRnsAMANr.Text, rsBundGew = TbExpRnsBundGew.Text, rsPalNr = ReadInt(NudExpRnsPalNr, 1), - rsBundNrPal = ReadInt(NudExpRnsBundNrPal, 20) + rsBundNrPal = ReadInt(NudExpRnsBundNrPal, 20), + + rsPvSt = CbExpRnsPvSt.IsChecked.Value }; Settings.Save(); diff --git a/Tasks/PdfBuilder.cs b/Tasks/PdfBuilder.cs index 8541511..85f26b6 100644 --- a/Tasks/PdfBuilder.cs +++ b/Tasks/PdfBuilder.cs @@ -94,7 +94,7 @@ public class PdfBuilder /// The ID of the AddressSet to use /// Text for the first cell (top-left) /// Path where the PDF should be saved - public void CreateAddressLabelPdfFromAddressSetWithPlaceholder(int addressSetId, string placeholderText, + public void CreateAddressLabelPdfFromAddressSetWithPlaceholder(int addressSetId, string placeholderText, bool pvst, string outputPath) { try @@ -138,6 +138,9 @@ public class PdfBuilder if (!addressSet.KasPersons[i].IsGermany()) continue; var addr = AddressCreator.CreateFinalMarkdownString(addressSet.KasPersons[i].id); if (string.IsNullOrWhiteSpace(addr)) continue; + if (pvst) + senderLineID += $"**PvSt, DP AG, Entgelt bezahlt, ZKZ {Settings._instance.pdfExport.rsZKZ}**\n"; + if (addressSet.KasPersons[i].refsid != null || addressSet.KasPersons[i].refsid != 0) senderLineID += $"ID: {addressSet.KasPersons[i].refsid}\n"; else @@ -155,6 +158,9 @@ public class PdfBuilder if (addressSet.KasPersons[i].IsGermany()) continue; var addr = AddressCreator.CreateFinalMarkdownString(addressSet.KasPersons[i].id); if (string.IsNullOrWhiteSpace(addr)) continue; + if (pvst) + senderLineID += $"**PvSt, DP AG, Entgelt bezahlt, ZKZ {Settings._instance.pdfExport.rsZKZ}**\n"; + if (addressSet.KasPersons[i].refsid != null || addressSet.KasPersons[i].refsid != 0) senderLineID += $"ID: {addressSet.KasPersons[i].refsid}\n"; else @@ -458,7 +464,7 @@ public class PdfBuilder } } - return max > 0 ? max * 0.8 : _regularFont.GetHeight(); + return max > 0 ? max * 0.88 : _regularFont.GetHeight(); } private List> WrapRunsToLines(XGraphics gfx, List tokens, double maxWidth) @@ -1246,7 +1252,7 @@ public class PdfBuilder public List<(int, string, string, string, int)> GroupAddresses(int setID) { int grpcount = Settings._instance.pdfExport.rsNumGrouped; // Amount of addresses per group - int stpoint = Settings._instance.pdfExport.rsPlzStartpoint; // group starting point (first n characters of the plz) + int stpoint = 2; // group starting point (first n characters of the plz) KasAddressList list = Settings._instance.addressSets.GetAddressSetByID(setID); if (list == null) throw new Exception("AddressSet nicht gefunden");