11 Commits

5 changed files with 311 additions and 209 deletions
+1 -1
View File
@@ -185,7 +185,7 @@ public class KasPerson
var trimmedLand = (land ?? "").Trim(); var trimmedLand = (land ?? "").Trim();
var trimmedLowerLand = trimmedLand.ToLower(); var trimmedLowerLand = trimmedLand.ToLower();
var isGermany = trimmedLowerLand == "germany" || trimmedLowerLand == "ger" || var isGermany = trimmedLowerLand == "germany" || trimmedLowerLand == "ger" ||
trimmedLowerLand == "" || trimmedLowerLand == "de" || trimmedLowerLand == "" || trimmedLowerLand == "de" || trimmedLowerLand == "-" ||
trimmedLowerLand == "deutschland"; trimmedLowerLand == "deutschland";
return isGermany; return isGermany;
+16 -4
View File
@@ -52,10 +52,10 @@ public class Settings
public class PdfExportSettings public class PdfExportSettings
{ {
public double cellPaddingTopMm { get; set; } = 5; public double cellPaddingTopMm { get; set; } = 4;
public double cellPaddingBottomMm { get; set; } = 5; public double cellPaddingBottomMm { get; set; } = 4;
public double cellPaddingLeftMm { get; set; } = 5; public double cellPaddingLeftMm { get; set; } = 4;
public double cellPaddingRightMm { get; set; } = 5; public double cellPaddingRightMm { get; set; } = 4;
public double pageMarginTopMm { get; set; } = 0; public double pageMarginTopMm { get; set; } = 0;
public double pageMarginBottomMm { get; set; } = 0; public double pageMarginBottomMm { get; set; } = 0;
@@ -70,6 +70,18 @@ public class PdfExportSettings
public bool exportRunningSheets { get; set; } = true; public bool exportRunningSheets { get; set; } = true;
public int rsNumGrouped { get; set; } = 25; public int rsNumGrouped { get; set; } = 25;
public int rsPlzStartpoint { get; set; } = 2; public int rsPlzStartpoint { get; set; } = 2;
public string rsKNrAbs { get; set; } = "";
public string rsKNrEmp { get; set; } = "";
public string rsZKZ { get; set; } = "";
public string rsIntVer { get; set; } = "";
public string rsLaufz { get; set; } = "";
public string rsEinldat { get; set; } = "";
public string rsAMANr { get; set; } = "";
public string rsBundGew { get; set; } = "";
public int rsPalNr { get; set; } = 1;
public int rsBundNrPal { get; set; } = 20;
} }
public class Global public class Global
+51 -3
View File
@@ -251,8 +251,9 @@
</StackPanel> </StackPanel>
</Grid> </Grid>
<Grid Grid.Row="2" Margin="20" ColumnDefinitions="*,5*,*" IsVisible="False" x:Name="GrdExportMarginOptions"> <Grid Grid.Row="2" Margin="20" ColumnDefinitions="*,5*,*" IsVisible="False" x:Name="GrdExportMarginOptions">
<StackPanel Grid.Column="1" Orientation="Vertical" Spacing="20"> <ScrollViewer Grid.Column="1">
<Grid ColumnDefinitions="*,*,*" ColumnSpacing="20"> <StackPanel Margin="5,5,5,5" Orientation="Vertical" Spacing="20" Background="AliceBlue" >
<Grid ColumnDefinitions="*,*,*" ColumnSpacing="20" Margin="10,10,10,0">
<StackPanel Orientation="Vertical" Spacing="10"> <StackPanel Orientation="Vertical" Spacing="10">
<Grid ColumnDefinitions="*,*"> <Grid ColumnDefinitions="*,*">
<Label Grid.Column="0" Content="Zellenrand oben (mm)"></Label> <Label Grid.Column="0" Content="Zellenrand oben (mm)"></Label>
@@ -319,10 +320,57 @@
</Grid> </Grid>
</StackPanel> </StackPanel>
</Grid> </Grid>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> <Grid ColumnDefinitions="*,*" ColumnSpacing="20" Margin="10,10,10,0">
<StackPanel Grid.Column="0" Orientation="Vertical" Spacing="10">
<Grid ColumnDefinitions="*,2*">
<Label Grid.Column="0" Content="Kunden-Nr. Absender" />
<TextBox Grid.Column="1" x:Name="TbExpRnsKNrAbs" />
</Grid>
<Grid ColumnDefinitions="*,2*">
<Label Grid.Column="0" Content="Kunden-Nr. Empfänger" />
<TextBox Grid.Column="1" x:Name="TbExpRnsKNrEmp" />
</Grid>
<Grid ColumnDefinitions="*,2*">
<Label Grid.Column="0" Content="ZKZ/Titel" />
<TextBox Grid.Column="1" x:Name="TbExpRnsZKZ" />
</Grid>
<Grid ColumnDefinitions="*,2*">
<Label Grid.Column="0" Content="Interner Vermerk" />
<TextBox Grid.Column="1" x:Name="TbExpRnsIntVer" />
</Grid>
<Grid ColumnDefinitions="*,2*">
<Label Grid.Column="0" Content="Laufzeit" />
<TextBox Grid.Column="1" x:Name="TbExpRnsLaufz" />
</Grid>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Vertical" Spacing="10">
<Grid ColumnDefinitions="*,2*">
<Label Grid.Column="0" Content="Einlieferungsdatum" />
<TextBox Grid.Column="1" x:Name="TbExpRnsEinldat" />
</Grid>
<Grid ColumnDefinitions="*,2*">
<Label Grid.Column="0" Content="AM-Auftragsnummer" />
<TextBox Grid.Column="1" x:Name="TbExpRnsAMANr" />
</Grid>
<Grid ColumnDefinitions="*,2*">
<Label Grid.Column="0" Content="Bundgewicht" />
<TextBox Grid.Column="1" x:Name="TbExpRnsBundGew" />
</Grid>
<Grid ColumnDefinitions="*,2*">
<Label Grid.Column="0" Content="Paletten-Nr. (Start)" />
<NumericUpDown Grid.Column="1" Minimum="0" Value="1" x:Name="NudExpRnsPalNr" />
</Grid>
<Grid ColumnDefinitions="*,2*">
<Label Grid.Column="0" Content="Anzahl Bunde auf Palette" />
<NumericUpDown Grid.Column="1" Minimum="0" Value="20" x:Name="NudExpRnsBundNrPal" />
</Grid>
</StackPanel>
</Grid>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="10,10,10,10">
<Button Content="Start" Click="BtnStartGenerateLabels_OnClick"></Button> <Button Content="Start" Click="BtnStartGenerateLabels_OnClick"></Button>
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
</ScrollViewer>
</Grid> </Grid>
</Grid> </Grid>
</TabItem> </TabItem>
+23 -1
View File
@@ -936,6 +936,17 @@ public partial class MainWindow : Window
NudExpMargColumnsPerPage.Value = options.columnsPerPage; NudExpMargColumnsPerPage.Value = options.columnsPerPage;
NudExpMargFontSize.Value = (decimal)options.fontSize; NudExpMargFontSize.Value = (decimal)options.fontSize;
NudExpMargSmallFontSize.Value = (decimal)options.smallFontSize; NudExpMargSmallFontSize.Value = (decimal)options.smallFontSize;
TbExpRnsKNrAbs.Text = options.rsKNrAbs;
TbExpRnsKNrEmp.Text = options.rsKNrEmp;
TbExpRnsZKZ.Text = options.rsZKZ;
TbExpRnsIntVer.Text = options.rsIntVer;
TbExpRnsLaufz.Text = options.rsLaufz;
TbExpRnsEinldat.Text = options.rsEinldat;
TbExpRnsAMANr.Text = options.rsAMANr;
TbExpRnsBundGew.Text = options.rsBundGew;
NudExpRnsPalNr.Value = options.rsPalNr;
NudExpRnsBundNrPal.Value = options.rsBundNrPal;
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -959,7 +970,18 @@ public partial class MainWindow : Window
rowsPerPage = ReadInt(TbExpMargRowsPerPage, 7), rowsPerPage = ReadInt(TbExpMargRowsPerPage, 7),
columnsPerPage = ReadInt(NudExpMargColumnsPerPage, 3), columnsPerPage = ReadInt(NudExpMargColumnsPerPage, 3),
fontSize = ReadDouble(NudExpMargFontSize), fontSize = ReadDouble(NudExpMargFontSize),
smallFontSize = ReadDouble(NudExpMargSmallFontSize) smallFontSize = ReadDouble(NudExpMargSmallFontSize),
rsKNrAbs = TbExpRnsKNrAbs.Text,
rsKNrEmp = TbExpRnsKNrEmp.Text,
rsZKZ = TbExpRnsZKZ.Text,
rsIntVer = TbExpRnsIntVer.Text,
rsLaufz = TbExpRnsLaufz.Text,
rsEinldat = TbExpRnsEinldat.Text,
rsAMANr = TbExpRnsAMANr.Text,
rsBundGew = TbExpRnsBundGew.Text,
rsPalNr = ReadInt(NudExpRnsPalNr, 1),
rsBundNrPal = ReadInt(NudExpRnsBundNrPal, 20)
}; };
Settings.Save(); Settings.Save();
+142 -122
View File
@@ -101,6 +101,12 @@ public class PdfBuilder
{ {
// Find the AddressSet by ID // Find the AddressSet by ID
var addressSet = Settings._instance.addressSets.GetAddressSetByID(addressSetId); var addressSet = Settings._instance.addressSets.GetAddressSetByID(addressSetId);
// foreach (var pers in addressSet.KasPersons)
// {
// AddressCreator.CreateFinalMarkdownString(pers.id);
// }
// addressSet.KasPersons = addressSet.KasPersons.OrderBy(x => x.IsGermany()).ThenBy(y => y.used_plz).ToList();
if (addressSet == null) if (addressSet == null)
throw new ArgumentException($"AddressSet with ID {addressSetId} not found"); throw new ArgumentException($"AddressSet with ID {addressSetId} not found");
@@ -109,7 +115,8 @@ public class PdfBuilder
// Generate markdown addresses from all KasPersons in the set // Generate markdown addresses from all KasPersons in the set
//var addresses = new string?[addressSet.KasPersons.Count]; //var addresses = new string?[addressSet.KasPersons.Count];
var addresses = new List<string>(); var addresses_german = new List<string>();
var addresses_inter = new List<string>();
// find customer (owner) to include sender_address // find customer (owner) to include sender_address
string senderLine = null; string senderLine = null;
@@ -124,28 +131,52 @@ public class PdfBuilder
senderLine = null; senderLine = null;
} }
// national addresses
for (var i = 0; i < addressSet.KasPersons.Count; i++) for (var i = 0; i < addressSet.KasPersons.Count; i++)
{ {
if (!addressSet.KasPersons[i].IsGermany()) continue;
var addr = AddressCreator.CreateFinalMarkdownString(addressSet.KasPersons[i].id); var addr = AddressCreator.CreateFinalMarkdownString(addressSet.KasPersons[i].id);
if (string.IsNullOrWhiteSpace(addr)) continue; if (string.IsNullOrWhiteSpace(addr)) continue;
if (!string.IsNullOrEmpty(senderLine)) if (!string.IsNullOrEmpty(senderLine))
addresses.Add(senderLine + (addr ?? "")); addresses_german.Add(senderLine + (addr ?? ""));
else else
addresses.Add(addr); addresses_german.Add(addr);
} }
if (addresses.Count == 0) // international addresses
for (var i = 0; i < addressSet.KasPersons.Count; i++)
{
if (addressSet.KasPersons[i].IsGermany()) continue;
var addr = AddressCreator.CreateFinalMarkdownString(addressSet.KasPersons[i].id);
if (string.IsNullOrWhiteSpace(addr)) continue;
if (!string.IsNullOrEmpty(senderLine))
addresses_inter.Add(senderLine + (addr ?? ""));
else
addresses_inter.Add(addr);
}
if (addresses_german.Count == 0 && addresses_inter.Count == 0)
{ {
MessageBox.Show(MainWindow._instance, "Keine validen Adressen konnten generiert werden. Abbruch.", "Fehler"); MessageBox.Show(MainWindow._instance, "Keine validen Adressen konnten generiert werden. Abbruch.", "Fehler");
return; return;
} }
CreateAddressLabelPdfWithPlaceholder(addresses, placeholderText, outputPath);
string output_inter = outputPath.Replace(".pdf", "-international.pdf");
if(addresses_german.Count > 0) CreateAddressLabelPdfWithPlaceholder(addresses_german, placeholderText, outputPath);
if(addresses_inter.Count > 0) CreateAddressLabelPdfWithPlaceholder(addresses_inter, placeholderText, output_inter);
if (_settings.exportRunningSheets) if (_settings.exportRunningSheets)
{ {
ExportRunningSheets(addressSetId, outputPath); ExportRunningSheets(addressSetId, outputPath);
} }
CreateAddressLabelPdfWithPlaceholder(addresses, placeholderText, outputPath); //CreateAddressLabelPdfWithPlaceholder(addresses_german, placeholderText, outputPath);
//CreateAddressLabelPdfWithPlaceholder(addresses_inter, placeholderText, output_inter);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -553,6 +584,13 @@ public class PdfBuilder
var fontBig = new XFont("Arial", 30, XFontStyleEx.Bold); var fontBig = new XFont("Arial", 30, XFontStyleEx.Bold);
int firstIndex = pageIndex * 2; int firstIndex = pageIndex * 2;
int palletNumber =
Settings._instance.pdfExport.rsPalNr +
(firstIndex / Settings._instance.pdfExport.rsBundNrPal);
int bundleOnPallet =
(firstIndex % Settings._instance.pdfExport.rsBundNrPal) + 1;
DrawGermanyRunningSheet( DrawGermanyRunningSheet(
gfx, gfx,
marginX, marginX,
@@ -564,9 +602,21 @@ public class PdfBuilder
grouped_nums, grouped_nums,
fontLabel, fontLabel,
fontText, fontText,
fontBig fontBig,
palletNumber,
bundleOnPallet,
firstIndex + 1
); );
int secondIndex = firstIndex + 1;
int palletNumber2 =
Settings._instance.pdfExport.rsPalNr +
(secondIndex / Settings._instance.pdfExport.rsBundNrPal);
int bundleOnPallet2 =
(secondIndex % Settings._instance.pdfExport.rsBundNrPal) + 1;
if (firstIndex + 1 < grouped_nums.Count) if (firstIndex + 1 < grouped_nums.Count)
{ {
DrawGermanyRunningSheet( DrawGermanyRunningSheet(
@@ -576,11 +626,14 @@ public class PdfBuilder
usableW, usableW,
tableH, tableH,
list, list,
grouped_nums[firstIndex + 1], grouped_nums[secondIndex],
grouped_nums, grouped_nums,
fontLabel, fontLabel,
fontText, fontText,
fontBig fontBig,
palletNumber2,
bundleOnPallet2,
secondIndex + 1
); );
} }
} }
@@ -599,8 +652,10 @@ public class PdfBuilder
List<(int,string,string,string,int)> grouped_nums, List<(int,string,string,string,int)> grouped_nums,
XFont fontLabel, XFont fontLabel,
XFont fontText, XFont fontText,
XFont fontBig) XFont fontBig,
{ int pal_nr,
int bundleOnPallet,
int totalBundleNumber){
double line = 1.0; double line = 1.0;
string sender = Customer.GetCustomerByID(list.owner_id)?.sender_address ?? "[Absender]"; string sender = Customer.GetCustomerByID(list.owner_id)?.sender_address ?? "[Absender]";
@@ -611,6 +666,8 @@ public class PdfBuilder
string groupNo = result.Item2?.ToString() ?? "[PLZ]"; string groupNo = result.Item2?.ToString() ?? "[PLZ]";
string fraction = result.Item1?.ToString() ?? "[Fraktion]"; string fraction = result.Item1?.ToString() ?? "[Fraktion]";
var options = Settings._instance.pdfExport;
int total_frac = 0; int total_frac = 0;
foreach (var item in grouped_nums) foreach (var item in grouped_nums)
{ {
@@ -675,8 +732,8 @@ public class PdfBuilder
// Values top row // Values top row
gfx.DrawString(sender, fontText, XBrushes.Black, new XRect(x + 5, y + 20, c1 - 10, r1 - 22), XStringFormats.TopLeft); gfx.DrawString(sender, fontText, XBrushes.Black, new XRect(x + 5, y + 20, c1 - 10, r1 - 22), XStringFormats.TopLeft);
gfx.DrawString("[Kunden-Nr. Absender]", fontText, XBrushes.Black, new XRect(x + c1 + 5, y + 20, c2 - 10, r1 - 22), XStringFormats.TopLeft); gfx.DrawString(options.rsKNrAbs, fontText, XBrushes.Black, new XRect(x + c1 + 5, y + 20, c2 - 10, r1 - 22), XStringFormats.TopLeft);
gfx.DrawString("[ZKZ/Titel]", fontText, XBrushes.Black, new XRect(x + c1 + c2 + 5, y + 20, c3 - 10, r1 - 22), XStringFormats.TopLeft); gfx.DrawString(options.rsZKZ, fontText, XBrushes.Black, new XRect(x + c1 + c2 + 5, y + 20, c3 - 10, r1 - 22), XStringFormats.TopLeft);
gfx.DrawString(amount, fontText, XBrushes.Black, new XRect(x + c1 + c2 + c3 + 5, y + 20, c4 - 10, r1 - 22), XStringFormats.TopLeft); gfx.DrawString(amount, fontText, XBrushes.Black, new XRect(x + c1 + c2 + c3 + 5, y + 20, c4 - 10, r1 - 22), XStringFormats.TopLeft);
// Second row labels // Second row labels
@@ -687,9 +744,9 @@ public class PdfBuilder
// Second row values // Second row values
gfx.DrawString(customerName, fontText, XBrushes.Black, new XRect(x + 5, y + r1 + 20, c1 - 10, r2 - 22), XStringFormats.TopLeft); gfx.DrawString(customerName, fontText, XBrushes.Black, new XRect(x + 5, y + r1 + 20, c1 - 10, r2 - 22), XStringFormats.TopLeft);
gfx.DrawString("[Kunden-Nr. Einlieferer]", fontText, XBrushes.Black, new XRect(x + c1 + 5, y + r1 + 20, c2 - 10, r2 - 22), XStringFormats.TopLeft); gfx.DrawString(options.rsKNrEmp, fontText, XBrushes.Black, new XRect(x + c1 + 5, y + r1 + 20, c2 - 10, r2 - 22), XStringFormats.TopLeft);
gfx.DrawString("[Interne Vermerke]", fontText, XBrushes.Black, new XRect(x + c1 + c2 + 5, y + r1 + 20, c3 - 10, r2 - 22), XStringFormats.TopLeft); gfx.DrawString(options.rsIntVer, fontText, XBrushes.Black, new XRect(x + c1 + c2 + 5, y + r1 + 20, c3 - 10, r2 - 22), XStringFormats.TopLeft);
gfx.DrawString("[Laufzeit]", fontText, XBrushes.Black, new XRect(x + c1 + c2 + c3 + 5, y + r1 + 20, c4 - 10, r2 - 22), XStringFormats.TopLeft); gfx.DrawString(options.rsLaufz, fontText, XBrushes.Black, new XRect(x + c1 + c2 + c3 + 5, y + r1 + 20, c4 - 10, r2 - 22), XStringFormats.TopLeft);
// Middle area // Middle area
gfx.DrawString(groupNo, fontBig, XBrushes.Black, gfx.DrawString(groupNo, fontBig, XBrushes.Black,
@@ -738,27 +795,32 @@ public class PdfBuilder
double valueX = x + leftBottomW * 0.55; double valueX = x + leftBottomW * 0.55;
double valueW = leftBottomW - (valueX - x) - 5; double valueW = leftBottomW - (valueX - x) - 5;
gfx.DrawString("[Einlieferungsdatum]", fontText, XBrushes.Black, gfx.DrawString(options.rsEinldat, fontText, XBrushes.Black,
new XRect(valueX, y + r1 + r2 + r3 + 4, valueW, 14), new XRect(valueX, y + r1 + r2 + r3 + 4, valueW, 14),
XStringFormats.TopRight); XStringFormats.TopRight);
gfx.DrawString("[AM-Auftragsnummer]", fontText, XBrushes.Black, gfx.DrawString(options.rsAMANr, fontText, XBrushes.Black,
new XRect(valueX, blY1 + 4, valueW, 14), new XRect(valueX, blY1 + 4, valueW, 14),
XStringFormats.TopRight); XStringFormats.TopRight);
gfx.DrawString("[Bundgewicht]", fontText, XBrushes.Black, if (options.rsBundNrPal == null) goto nopal;
new XRect(valueX, blY2 + 4, valueW, 14), gfx.DrawString(pal_nr.ToString(), fontText, XBrushes.Black,
XStringFormats.TopRight);
gfx.DrawString("[Paletten-Nr.]", fontText, XBrushes.Black,
new XRect(valueX, blY3 + 4, valueW, 14), new XRect(valueX, blY3 + 4, valueW, 14),
XStringFormats.TopRight); XStringFormats.TopRight);
gfx.DrawString("[Bund-Nr./Bunde auf Palette]", fontText, XBrushes.Black,
gfx.DrawString(
$"{bundleOnPallet}/{Settings._instance.pdfExport.rsBundNrPal}",
fontText,
XBrushes.Black,
new XRect(valueX, blY4 + 4, valueW, 14), new XRect(valueX, blY4 + 4, valueW, 14),
XStringFormats.TopRight); XStringFormats.TopRight);
gfx.DrawString("[Bund-Nr. von Gesamtanzahl]", fontText, XBrushes.Black, nopal:
gfx.DrawString(
$"{totalBundleNumber}/{grouped_nums.Count}",
fontText,
XBrushes.Black,
new XRect(valueX, blY5 + 4, valueW, 14), new XRect(valueX, blY5 + 4, valueW, 14),
XStringFormats.TopRight); XStringFormats.TopRight);
@@ -769,88 +831,7 @@ public class PdfBuilder
XStringFormats.TopLeft); XStringFormats.TopLeft);
} }
// 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);
// }
//
// }
public void CreateInternationalRunningSheets(int setID, string path) public void CreateInternationalRunningSheets(int setID, string path)
{ {
@@ -892,6 +873,15 @@ public class PdfBuilder
int firstIndex = pageIndex * 2; int firstIndex = pageIndex * 2;
int palletNumber =
Settings._instance.pdfExport.rsPalNr +
(firstIndex / Settings._instance.pdfExport.rsBundNrPal);
int bundleOnPallet =
(firstIndex % Settings._instance.pdfExport.rsBundNrPal) + 1;
DrawInternationalRunningSheet( DrawInternationalRunningSheet(
gfx, gfx,
marginX, marginX,
@@ -903,11 +893,23 @@ public class PdfBuilder
grouped_nums, grouped_nums,
fontLabel, fontLabel,
fontText, fontText,
fontBig fontBig,
palletNumber,
bundleOnPallet,
firstIndex + 1
); );
if (firstIndex + 1 < grouped_nums.Count) if (firstIndex + 1 < grouped_nums.Count)
{ {
int secondIndex = firstIndex + 1;
int palletNumber2 =
Settings._instance.pdfExport.rsPalNr +
(secondIndex / Settings._instance.pdfExport.rsBundNrPal);
int bundleOnPallet2 =
(secondIndex % Settings._instance.pdfExport.rsBundNrPal) + 1;
DrawInternationalRunningSheet( DrawInternationalRunningSheet(
gfx, gfx,
marginX, marginX,
@@ -915,11 +917,14 @@ public class PdfBuilder
usableW, usableW,
tableH, tableH,
list, list,
grouped_nums[firstIndex + 1], grouped_nums[secondIndex],
grouped_nums, grouped_nums,
fontLabel, fontLabel,
fontText, fontText,
fontBig fontBig,
palletNumber2,
bundleOnPallet2,
secondIndex + 1
); );
} }
} }
@@ -937,7 +942,11 @@ public class PdfBuilder
List<(int,string,string,string,int)> grouped_nums, List<(int,string,string,string,int)> grouped_nums,
XFont fontLabel, XFont fontLabel,
XFont fontText, XFont fontText,
XFont fontBig) XFont fontBig,
int pal_nr,
int bundleOnPallet,
int totalBundleNumber,
string category = "ECONOMY Non-EU")
{ {
double line = 1.0; double line = 1.0;
@@ -949,6 +958,8 @@ public class PdfBuilder
string groupNo = result.Item2?.ToString() ?? "[PLZ]"; string groupNo = result.Item2?.ToString() ?? "[PLZ]";
string fraction = result.Item1?.ToString() ?? "[Fraktion]"; string fraction = result.Item1?.ToString() ?? "[Fraktion]";
var options = Settings._instance.pdfExport;
int total_frac = 0; int total_frac = 0;
foreach (var item in grouped_nums) foreach (var item in grouped_nums)
{ {
@@ -1013,8 +1024,8 @@ public class PdfBuilder
// Values top row // Values top row
gfx.DrawString(sender, fontText, XBrushes.Black, new XRect(x + 5, y + 20, c1 - 10, r1 - 22), XStringFormats.TopLeft); gfx.DrawString(sender, fontText, XBrushes.Black, new XRect(x + 5, y + 20, c1 - 10, r1 - 22), XStringFormats.TopLeft);
gfx.DrawString("[Kunden-Nr. Absender]", fontText, XBrushes.Black, new XRect(x + c1 + 5, y + 20, c2 - 10, r1 - 22), XStringFormats.TopLeft); gfx.DrawString(options.rsKNrAbs, fontText, XBrushes.Black, new XRect(x + c1 + 5, y + 20, c2 - 10, r1 - 22), XStringFormats.TopLeft);
gfx.DrawString("[ZKZ/Titel]", fontText, XBrushes.Black, new XRect(x + c1 + c2 + 5, y + 20, c3 - 10, r1 - 22), XStringFormats.TopLeft); gfx.DrawString(options.rsZKZ, fontText, XBrushes.Black, new XRect(x + c1 + c2 + 5, y + 20, c3 - 10, r1 - 22), XStringFormats.TopLeft);
gfx.DrawString(amount, fontText, XBrushes.Black, new XRect(x + c1 + c2 + c3 + 5, y + 20, c4 - 10, r1 - 22), XStringFormats.TopLeft); gfx.DrawString(amount, fontText, XBrushes.Black, new XRect(x + c1 + c2 + c3 + 5, y + 20, c4 - 10, r1 - 22), XStringFormats.TopLeft);
// Second row labels // Second row labels
@@ -1025,9 +1036,9 @@ public class PdfBuilder
// Second row values // Second row values
gfx.DrawString(customerName, fontText, XBrushes.Black, new XRect(x + 5, y + r1 + 20, c1 - 10, r2 - 22), XStringFormats.TopLeft); gfx.DrawString(customerName, fontText, XBrushes.Black, new XRect(x + 5, y + r1 + 20, c1 - 10, r2 - 22), XStringFormats.TopLeft);
gfx.DrawString("[Kunden-Nr. Einlieferer]", fontText, XBrushes.Black, new XRect(x + c1 + 5, y + r1 + 20, c2 - 10, r2 - 22), XStringFormats.TopLeft); gfx.DrawString(options.rsKNrEmp, fontText, XBrushes.Black, new XRect(x + c1 + 5, y + r1 + 20, c2 - 10, r2 - 22), XStringFormats.TopLeft);
gfx.DrawString("[Interne Vermerke]", fontText, XBrushes.Black, new XRect(x + c1 + c2 + 5, y + r1 + 20, c3 - 10, r2 - 22), XStringFormats.TopLeft); gfx.DrawString(options.rsIntVer, fontText, XBrushes.Black, new XRect(x + c1 + c2 + 5, y + r1 + 20, c3 - 10, r2 - 22), XStringFormats.TopLeft);
gfx.DrawString("[Laufzeit]", fontText, XBrushes.Black, new XRect(x + c1 + c2 + c3 + 5, y + r1 + 20, c4 - 10, r2 - 22), XStringFormats.TopLeft); gfx.DrawString(options.rsLaufz, fontText, XBrushes.Black, new XRect(x + c1 + c2 + c3 + 5, y + r1 + 20, c4 - 10, r2 - 22), XStringFormats.TopLeft);
// Middle area // Middle area
gfx.DrawString(groupNo, fontBig, XBrushes.Black, gfx.DrawString(groupNo, fontBig, XBrushes.Black,
@@ -1076,27 +1087,36 @@ public class PdfBuilder
double valueX = x + leftBottomW * 0.55; double valueX = x + leftBottomW * 0.55;
double valueW = leftBottomW - (valueX - x) - 5; double valueW = leftBottomW - (valueX - x) - 5;
gfx.DrawString("[Einlieferungsdatum]", fontText, XBrushes.Black, gfx.DrawString(options.rsEinldat, fontText, XBrushes.Black,
new XRect(valueX, y + r1 + r2 + r3 + 4, valueW, 14), new XRect(valueX, y + r1 + r2 + r3 + 4, valueW, 14),
XStringFormats.TopRight); XStringFormats.TopRight);
gfx.DrawString("[AM-Auftragsnummer]", fontText, XBrushes.Black, gfx.DrawString(options.rsAMANr, fontText, XBrushes.Black,
new XRect(valueX, blY1 + 4, valueW, 14), new XRect(valueX, blY1 + 4, valueW, 14),
XStringFormats.TopRight); XStringFormats.TopRight);
gfx.DrawString("[Bundgewicht]", fontText, XBrushes.Black, gfx.DrawString(options.rsBundGew, fontText, XBrushes.Black,
new XRect(valueX, blY2 + 4, valueW, 14), new XRect(valueX, blY2 + 4, valueW, 14),
XStringFormats.TopRight); XStringFormats.TopRight);
gfx.DrawString("[Paletten-Nr.]", fontText, XBrushes.Black, if (options.rsBundNrPal == 0) goto nopal;
gfx.DrawString(pal_nr.ToString(), fontText, XBrushes.Black,
new XRect(valueX, blY3 + 4, valueW, 14), new XRect(valueX, blY3 + 4, valueW, 14),
XStringFormats.TopRight); XStringFormats.TopRight);
gfx.DrawString("[Bund-Nr./Bunde auf Palette]", fontText, XBrushes.Black,
gfx.DrawString(
$"{bundleOnPallet}/{Settings._instance.pdfExport.rsBundNrPal}",
fontText,
XBrushes.Black,
new XRect(valueX, blY4 + 4, valueW, 14), new XRect(valueX, blY4 + 4, valueW, 14),
XStringFormats.TopRight); XStringFormats.TopRight);
gfx.DrawString("[Bund-Nr. von Gesamtanzahl]", fontText, XBrushes.Black, nopal:
gfx.DrawString(
$"{totalBundleNumber}/{grouped_nums.Count}",
fontText,
XBrushes.Black,
new XRect(valueX, blY5 + 4, valueW, 14), new XRect(valueX, blY5 + 4, valueW, 14),
XStringFormats.TopRight); XStringFormats.TopRight);