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);
|
obj["expNat"] = JToken.FromObject(new PdfExportSettings().expNat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!obj.ContainsKey("rsGrupTol"))
|
||||||
|
{
|
||||||
|
obj["rsGrupTol"] = JToken.FromObject(new PdfExportSettings().rsGrupTol);
|
||||||
|
}
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ public class PdfExportSettings
|
|||||||
public string rsBundGew { get; set; } = "";
|
public string rsBundGew { get; set; } = "";
|
||||||
public int rsPalNr { get; set; } = 1;
|
public int rsPalNr { get; set; } = 1;
|
||||||
public int rsBundNrPal { get; set; } = 20;
|
public int rsBundNrPal { get; set; } = 20;
|
||||||
|
public int rsGrupTol { get; set; } = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -433,6 +433,10 @@
|
|||||||
<Label Grid.Column="0" Content="Laufzeit" />
|
<Label Grid.Column="0" Content="Laufzeit" />
|
||||||
<TextBox Grid.Column="1" x:Name="TbExpRnsLaufz" />
|
<TextBox Grid.Column="1" x:Name="TbExpRnsLaufz" />
|
||||||
</Grid>
|
</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>
|
||||||
<StackPanel Grid.Column="1" Orientation="Vertical" Spacing="10">
|
<StackPanel Grid.Column="1" Orientation="Vertical" Spacing="10">
|
||||||
<Grid ColumnDefinitions="*,2*">
|
<Grid ColumnDefinitions="*,2*">
|
||||||
|
|||||||
@@ -1011,6 +1011,7 @@ public partial class MainWindow : Window
|
|||||||
TbExpRnsBundGew.Text = options.rsBundGew;
|
TbExpRnsBundGew.Text = options.rsBundGew;
|
||||||
NudExpRnsPalNr.Value = options.rsPalNr;
|
NudExpRnsPalNr.Value = options.rsPalNr;
|
||||||
NudExpRnsBundNrPal.Value = options.rsBundNrPal;
|
NudExpRnsBundNrPal.Value = options.rsBundNrPal;
|
||||||
|
NudExpRnsGrupTol.Value = options.rsGrupTol;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -1051,6 +1052,7 @@ public partial class MainWindow : Window
|
|||||||
rsNumGrouped = ReadInt(NudExpRnsPlzcount, 25),
|
rsNumGrouped = ReadInt(NudExpRnsPlzcount, 25),
|
||||||
expNat = CbExpNat.IsChecked.Value,
|
expNat = CbExpNat.IsChecked.Value,
|
||||||
expInt = CbExpInt.IsChecked.Value,
|
expInt = CbExpInt.IsChecked.Value,
|
||||||
|
rsGrupTol = ReadInt(NudExpRnsGrupTol, 0),
|
||||||
|
|
||||||
rsPvSt = CbExpRnsPvSt.IsChecked.Value,
|
rsPvSt = CbExpRnsPvSt.IsChecked.Value,
|
||||||
exportRunningSheets = CbExpRnsEnable.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)
|
public List<(int, string, string, string, int)> GroupAddresses(int setID)
|
||||||
{
|
{
|
||||||
int grpcount = Settings._instance.pdfExport.rsNumGrouped; // Amount of addresses per group
|
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)
|
int stpoint = 2; // group starting point (first n characters of the plz)
|
||||||
KasAddressList list = Settings._instance.addressSets.GetAddressSetByID(setID);
|
KasAddressList list = Settings._instance.addressSets.GetAddressSetByID(setID);
|
||||||
if (list == null)
|
if (list == null)
|
||||||
@@ -1427,12 +1428,20 @@ public class PdfBuilder
|
|||||||
{
|
{
|
||||||
string start = group.Key;
|
string start = group.Key;
|
||||||
int fraktion = 0;
|
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++;
|
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 first = group.ElementAt(count).used_plz;
|
||||||
string last = group.ElementAt(count + currentGroupSize - 1).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)
|
public List<(int, string, string, string, int)> GroupAddressesInternational(int setID)
|
||||||
{
|
{
|
||||||
int grpcount = Settings._instance.pdfExport.rsNumGrouped; // Amount of addresses per group
|
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);
|
KasAddressList list = Settings._instance.addressSets.GetAddressSetByID(setID);
|
||||||
if (list == null)
|
if (list == null)
|
||||||
throw new Exception("AddressSet nicht gefunden");
|
throw new Exception("AddressSet nicht gefunden");
|
||||||
@@ -1463,12 +1473,20 @@ public class PdfBuilder
|
|||||||
{
|
{
|
||||||
string start = group.Key;
|
string start = group.Key;
|
||||||
int fraktion = 0;
|
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++;
|
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 first = group.ElementAt(count).used_plz;
|
||||||
string last = group.ElementAt(count + currentGroupSize - 1).used_plz;
|
string last = group.ElementAt(count + currentGroupSize - 1).used_plz;
|
||||||
|
|||||||
Reference in New Issue
Block a user