Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2a77967d57 | ||
|
|
094fa9e0f4 | ||
|
|
5909d57f47 | ||
|
|
e502aac843 |
@@ -122,6 +122,11 @@ public static class SchemaMigration
|
||||
{
|
||||
obj["expNat"] = JToken.FromObject(new PdfExportSettings().expNat);
|
||||
}
|
||||
|
||||
if (!obj.ContainsKey("rsGrupTol"))
|
||||
{
|
||||
obj["rsGrupTol"] = JToken.FromObject(new PdfExportSettings().rsGrupTol);
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
@@ -131,6 +131,7 @@ public class PdfExportSettings
|
||||
public string rsBundGew { get; set; } = "";
|
||||
public int rsPalNr { get; set; } = 1;
|
||||
public int rsBundNrPal { get; set; } = 20;
|
||||
public int rsGrupTol { get; set; } = 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -433,6 +433,10 @@
|
||||
<Label Grid.Column="0" Content="Laufzeit" />
|
||||
<TextBox Grid.Column="1" x:Name="TbExpRnsLaufz" />
|
||||
</Grid>
|
||||
<Grid ColumnDefinitions="*,2*">
|
||||
<Label Grid.Column="0" Content="Gruppiertoleranz (Ende)" />
|
||||
<NumericUpDown Grid.Column="1" Minimum="0" Value="0" x:Name="NudExpRnsGrupTol" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="1" Orientation="Vertical" Spacing="10">
|
||||
<Grid ColumnDefinitions="*,2*">
|
||||
|
||||
@@ -1011,6 +1011,7 @@ public partial class MainWindow : Window
|
||||
TbExpRnsBundGew.Text = options.rsBundGew;
|
||||
NudExpRnsPalNr.Value = options.rsPalNr;
|
||||
NudExpRnsBundNrPal.Value = options.rsBundNrPal;
|
||||
NudExpRnsGrupTol.Value = options.rsGrupTol;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -1051,6 +1052,7 @@ public partial class MainWindow : Window
|
||||
rsNumGrouped = ReadInt(NudExpRnsPlzcount, 25),
|
||||
expNat = CbExpNat.IsChecked.Value,
|
||||
expInt = CbExpInt.IsChecked.Value,
|
||||
rsGrupTol = ReadInt(NudExpRnsGrupTol, 0),
|
||||
|
||||
rsPvSt = CbExpRnsPvSt.IsChecked.Value,
|
||||
exportRunningSheets = CbExpRnsEnable.IsChecked.Value
|
||||
|
||||
+22
-4
@@ -1409,6 +1409,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 grptol = Settings._instance.pdfExport.rsGrupTol; // Amount of addresses per group
|
||||
int stpoint = 2; // group starting point (first n characters of the plz)
|
||||
KasAddressList list = Settings._instance.addressSets.GetAddressSetByID(setID);
|
||||
if (list == null)
|
||||
@@ -1427,12 +1428,20 @@ public class PdfBuilder
|
||||
{
|
||||
string start = group.Key;
|
||||
int fraktion = 0;
|
||||
int addressCount = group.Count();
|
||||
int remainder = addressCount % grpcount;
|
||||
int groupCount = (addressCount - 1) / grpcount + 1;
|
||||
bool mergeLastGroup = groupCount > 1 && remainder > 0 && remainder <= grptol;
|
||||
int effectiveGroupCount = groupCount - (mergeLastGroup ? 1 : 0);
|
||||
|
||||
for (int count = 0; count < group.Count(); count += grpcount)
|
||||
for (int groupIndex = 0; groupIndex < effectiveGroupCount; groupIndex++)
|
||||
{
|
||||
fraktion++;
|
||||
|
||||
int currentGroupSize = Math.Min(grpcount, group.Count() - count);
|
||||
int count = groupIndex * grpcount;
|
||||
int currentGroupSize = mergeLastGroup && groupIndex == effectiveGroupCount - 1
|
||||
? addressCount - count
|
||||
: Math.Min(grpcount, addressCount - count);
|
||||
|
||||
string first = group.ElementAt(count).used_plz;
|
||||
string last = group.ElementAt(count + currentGroupSize - 1).used_plz;
|
||||
@@ -1447,6 +1456,7 @@ public class PdfBuilder
|
||||
public List<(int, string, string, string, int)> GroupAddressesInternational(int setID)
|
||||
{
|
||||
int grpcount = Settings._instance.pdfExport.rsNumGrouped; // Amount of addresses per group
|
||||
int grptol = Settings._instance.pdfExport.rsGrupTol; // Amount of addresses per group
|
||||
KasAddressList list = Settings._instance.addressSets.GetAddressSetByID(setID);
|
||||
if (list == null)
|
||||
throw new Exception("AddressSet nicht gefunden");
|
||||
@@ -1463,12 +1473,20 @@ public class PdfBuilder
|
||||
{
|
||||
string start = group.Key;
|
||||
int fraktion = 0;
|
||||
int addressCount = group.Count();
|
||||
int remainder = addressCount % grpcount;
|
||||
int groupCount = (addressCount - 1) / grpcount + 1;
|
||||
bool mergeLastGroup = groupCount > 1 && remainder > 0 && remainder <= grptol;
|
||||
int effectiveGroupCount = groupCount - (mergeLastGroup ? 1 : 0);
|
||||
|
||||
for (int count = 0; count < group.Count(); count += grpcount)
|
||||
for (int groupIndex = 0; groupIndex < effectiveGroupCount; groupIndex++)
|
||||
{
|
||||
fraktion++;
|
||||
|
||||
int currentGroupSize = Math.Min(grpcount, group.Count() - count);
|
||||
int count = groupIndex * grpcount;
|
||||
int currentGroupSize = mergeLastGroup && groupIndex == effectiveGroupCount - 1
|
||||
? addressCount - count
|
||||
: Math.Min(grpcount, addressCount - count);
|
||||
|
||||
string first = group.ElementAt(count).used_plz;
|
||||
string last = group.ElementAt(count + currentGroupSize - 1).used_plz;
|
||||
|
||||
Reference in New Issue
Block a user