diff --git a/Tasks/PdfBuilder.cs b/Tasks/PdfBuilder.cs
index ab7ef45..573f80e 100644
--- a/Tasks/PdfBuilder.cs
+++ b/Tasks/PdfBuilder.cs
@@ -494,21 +494,27 @@ public class PdfBuilder
public void ExportRunningSheets(int setID, string path)
{
+ string international_path = path;
if (path.EndsWith(".pdf"))
{
path = path.Substring(0, path.Length - 4);
+ international_path = path;
path = path + "-Laufzettel.pdf";
+ international_path = international_path + "-Laufzettel-International.pdf";
}
else
{
path = path + "-Laufzettel.pdf";
+ international_path = international_path + "-Laufzettel-International.pdf";
}
- CreateRunningSheets(setID, path);
+ CreateGermanyRunningSheets(setID, path);
+ CreateInternationalRunningSheets(setID, international_path);
}
- public void CreateRunningSheets(int setID, string path)
+
+ public void CreateGermanyRunningSheets(int setID, string path)
{
KasAddressList list = Settings._instance.addressSets.GetAddressSetByID(setID);
var document = new PdfDocument();
@@ -586,7 +592,90 @@ public class PdfBuilder
document.Save(path);
}
+
+ public void CreateInternationalRunningSheets(int setID, string path)
+ {
+ KasAddressList list = Settings._instance.addressSets.GetAddressSetByID(setID);
+ var document = new PdfDocument();
+ document.Info.Title = $"Laufzettel für {list.Name}";
+ document.Info.Subject = "powered by logofclient";
+ document.Info.Author = "logofclient";
+ int margin = 50;
+
+ var grouped_nums = GroupAddressesInternational(setID);
+
+ foreach (var result in grouped_nums)
+ {
+ var page = document.AddPage();
+ page.Size = PageSize.A4;
+
+ var gfx = XGraphics.FromPdfPage(page);
+
+ var width = page.Width.Point-margin;
+ var height = page.Height.Point-margin;
+ gfx.DrawLine(XPens.Black, margin, margin, margin, height);
+ gfx.DrawLine(XPens.Black, margin, margin, width, margin);
+ gfx.DrawLine(XPens.Black, width, margin, width, height);
+ gfx.DrawLine(XPens.Black, margin, height, width, height);
+
+ var boldfont = new XFont("Cantarell", 11, XFontStyleEx.Bold);
+ var font = new XFont("Cantarell", 11, XFontStyleEx.Regular);
+ var bigboldfont = new XFont("Cantarell", 35, XFontStyleEx.Bold);
+
+ // Versandinfo
+ gfx.DrawString($"Versand {list.Name}", boldfont, XBrushes.Black,
+ new XRect(margin+5, margin, width-margin, 25), XStringFormats.CenterLeft);
+ gfx.DrawString($"Start: ", font, XBrushes.Black,
+ new XRect(margin+5, margin+25, width-margin, 25), XStringFormats.CenterLeft);
+ gfx.DrawString($"{result.Item3}", font, XBrushes.Black,
+ new XRect(margin+75, margin+25, width-margin, 25), XStringFormats.CenterLeft);
+ gfx.DrawString($"Ende: ", font, XBrushes.Black,
+ new XRect(margin+5, margin+40, width-margin, 25), XStringFormats.CenterLeft);
+ gfx.DrawString($"{result.Item4}", font, XBrushes.Black,
+ new XRect(margin+75, margin+40, width-margin, 25), XStringFormats.CenterLeft);
+ gfx.DrawString($"Kunde: ", font, XBrushes.Black,
+ new XRect(margin+5, margin+55, width-margin, 25), XStringFormats.CenterLeft);
+ gfx.DrawString($"{Customer.GetCustomerByID(list.owner_id).name}", font, XBrushes.Black,
+ new XRect(margin+75, margin+55, width-margin, 25), XStringFormats.CenterLeft);
+ gfx.DrawString($"Absender: ", font, XBrushes.Black,
+ new XRect(margin+5, margin+70, width-margin, 25), XStringFormats.CenterLeft);
+ gfx.DrawString($"{Customer.GetCustomerByID(list.owner_id).sender_address}", font, XBrushes.Black,
+ new XRect(margin+75, margin+70, width-margin, 25), XStringFormats.CenterLeft);
+ gfx.DrawString($"Anzahl: ", font, XBrushes.Black,
+ new XRect(margin+5, margin+85, width-margin, 25), XStringFormats.CenterLeft);
+ gfx.DrawString($"{result.Item5}", font, XBrushes.Black,
+ new XRect(margin+75, margin+85, width-margin, 25), XStringFormats.CenterLeft);
+
+ // logofclient ad
+ gfx.DrawString($"powered by logofclient", font, XBrushes.Black,
+ new XRect(margin+5, height-55, width-margin, 25), XStringFormats.CenterLeft);
+ gfx.DrawString($"(c) 2026 MyPapertown", font, XBrushes.Black,
+ new XRect(margin+5, height-40, width-margin, 25), XStringFormats.CenterLeft);
+ gfx.DrawString($"mypapercloud.de/logof", font, XBrushes.Black,
+ new XRect(margin+5, height-25, width-margin, 25), XStringFormats.CenterLeft);
+
+
+ int total_frac = 0;
+ foreach (var item in grouped_nums)
+ {
+ if (item.Item2 == result.Item2) total_frac++;
+ }
+
+ // group number
+ gfx.DrawString($"{result.Item2}", bigboldfont, XBrushes.Black,
+ new XRect(margin, margin, width-margin, (height-margin)/2), XStringFormats.Center);
+ gfx.DrawString($"Fraktion {result.Item1}/{total_frac}", font, XBrushes.Black,
+ new XRect(margin, margin, width-margin, (height-margin)/2 + 50), XStringFormats.Center);
+ }
+
+ if (document.PageCount > 0)
+ {
+ document.Save(path);
+ }
+
+ }
+
///
/// Calculates address groups to summarize for the single pages of the running sheets.
///
@@ -629,4 +718,40 @@ public class PdfBuilder
return output;
}
+
+ public List<(int, string, string, string, int)> GroupAddressesInternational(int setID)
+ {
+ int grpcount = Settings._instance.pdfExport.rsNumGrouped; // Amount of addresses per group
+ KasAddressList list = Settings._instance.addressSets.GetAddressSetByID(setID);
+ if (list == null)
+ throw new Exception("AddressSet nicht gefunden");
+
+ List<(int, string, string, string, int)> output = new();
+
+ List> sorted_list = list.KasPersons
+ .Where(x => !string.IsNullOrEmpty(x?.used_plz) && !x.IsGermany())
+ .OrderBy(x => x.used_plz)
+ .GroupBy(x => x.land)
+ .ToList();
+
+ foreach (var group in sorted_list)
+ {
+ string start = group.Key;
+ int fraktion = 0;
+
+ for (int count = 0; count < group.Count(); count += grpcount)
+ {
+ fraktion++;
+
+ int currentGroupSize = Math.Min(grpcount, group.Count() - count);
+
+ string first = group.ElementAt(count).used_plz;
+ string last = group.ElementAt(count + currentGroupSize - 1).used_plz;
+
+ output.Add((fraktion, start, first, last, currentGroupSize));
+ }
+ }
+
+ return output;
+ }
}