Compare commits
31
Commits
v1.0.0
...
2a77967d57
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2a77967d57 | ||
|
|
094fa9e0f4 | ||
|
|
5909d57f47 | ||
|
|
e502aac843 | ||
|
|
5c391a3cc9 | ||
|
|
0bf93cf240 | ||
|
|
de97421914 | ||
|
|
89a9a919e3 | ||
|
|
8dcf1810d4 | ||
|
|
ef7c3c268f | ||
|
|
33b40a1e73 | ||
|
|
6435dd8994 | ||
|
|
6c6aea611d | ||
|
|
0476704e9b | ||
|
|
d79d8f9155 | ||
|
|
e948cc0ce1 | ||
|
|
fc6b5e45e0 | ||
|
|
d1fc214c10 | ||
|
|
f09ccc883d | ||
|
|
ce46b90890 | ||
|
|
4a2af7ac0c | ||
|
|
8ea3ed1e8c | ||
|
|
8745286860 | ||
|
|
321d22eb60 | ||
|
|
e8c159831e | ||
|
|
1d54bd749a | ||
|
|
cbda6d6563 | ||
|
|
6ed8c0e231 | ||
|
|
59ea707007 | ||
|
|
0cce15a8f6 | ||
|
|
5f200fbeef |
@@ -33,6 +33,40 @@ public class KasAddressList //Address-Set
|
|||||||
this.owner_id = owner_id;
|
this.owner_id = owner_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<string> GenerateCSV(bool expAsAdpac)
|
||||||
|
{
|
||||||
|
var customer = Customer.GetCustomerByID(owner_id);
|
||||||
|
// using adpac
|
||||||
|
string result = "";
|
||||||
|
string sep = customer.separator + " ";
|
||||||
|
if(customer.patch != null && expAsAdpac)
|
||||||
|
{
|
||||||
|
string header = customer.patch.GetCSVHeader(sep);
|
||||||
|
result += header + "\n";
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
result = $"refsid{sep} anrede{sep} titel{sep} vorname{sep} adel{sep} name{sep} namezus{sep} anredzus{sep} strasse{sep} strasse2{sep} plz{sep} ort{sep} land{sep} pplz{sep} postfach{sep} name1{sep} name2{sep} name3{sep} name4{sep} name5{sep} funktion{sep} funktion2{sep} abteilung{sep} funktionad{sep} lastupdate\n";
|
||||||
|
}
|
||||||
|
foreach(var item in KasPersons)
|
||||||
|
{
|
||||||
|
if(customer.patch != null && expAsAdpac) // Fall 1: adpac
|
||||||
|
{
|
||||||
|
// Fall 1: adpac
|
||||||
|
result += item.getAdpacValues(sep,customer.patch) + "\n";
|
||||||
|
|
||||||
|
} else // Fall 2: kein adpac:
|
||||||
|
{
|
||||||
|
// refsid anrede titel vorname adel name namezus anredzus strasse strasse2 plz ort land pplz postfach name1 name2 name3 name4 name5 funktion funktion2 abteilung funktionad lastupdate
|
||||||
|
result += item.refsid + sep + item.anrede+ sep + item.titel+ sep + item.vorname+ sep + item.adel+ sep + item.name+ sep + item.namezus+ sep + item.anredzus+ sep + item.strasse+ sep + item.strasse2+ sep + item.plz+ sep + item.ort+ sep + item.land+ sep + item.pplz+ sep + item.postfach+ sep + item.name1+ sep + item.name2+ sep + item.name3+ sep + item.name4+ sep + item.name5+ sep + item.funktion+ sep + item.funktion2+ sep + item.abteilung+ sep + item.funktionad+ sep + "null\n";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public static async Task<string> GenerateName(string basic_type, bool? is_rest = false)
|
public static async Task<string> GenerateName(string basic_type, bool? is_rest = false)
|
||||||
{
|
{
|
||||||
string pre = "";
|
string pre = "";
|
||||||
@@ -228,6 +262,84 @@ public class KasPerson
|
|||||||
|
|
||||||
return id + " - " + name;
|
return id + " - " + name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string getAdpacValues(string sep,AddressPatch ap)
|
||||||
|
{
|
||||||
|
string output = "";
|
||||||
|
if(ap.has_refsid){
|
||||||
|
output += ap.refsid_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_anrede){
|
||||||
|
output += ap.anrede_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_titel){
|
||||||
|
output += ap.titel_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_vorname){
|
||||||
|
output += ap.vorname_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_adel){
|
||||||
|
output += ap.adel_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_name){
|
||||||
|
output += ap.name_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_namezus){
|
||||||
|
output += ap.namezus_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_anredzus){
|
||||||
|
output += ap.anredzus_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_strasse){
|
||||||
|
output += ap.strasse_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_strasse2){
|
||||||
|
output += ap.strasse2_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_plz){
|
||||||
|
output += ap.plz_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_ort){
|
||||||
|
output += ap.ort_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_land){
|
||||||
|
output += ap.land_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_pplz){
|
||||||
|
output += ap.pplz_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_postfach){
|
||||||
|
output += ap.postfach_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_name1){
|
||||||
|
output += ap.name1_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_name2){
|
||||||
|
output += ap.name2_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_name3){
|
||||||
|
output += ap.name3_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_name4){
|
||||||
|
output += ap.name4_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_name5){
|
||||||
|
output += ap.name5_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_funktion){
|
||||||
|
output += ap.funktion_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_funktion2){
|
||||||
|
output += ap.funktion2_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_abteilung){
|
||||||
|
output += ap.abteilung_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(ap.has_funktionad){
|
||||||
|
output += ap.funktionad_is + sep + " ";
|
||||||
|
}
|
||||||
|
return output;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class KasPersonError
|
public class KasPersonError
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Logof_Client;
|
namespace Logof_Client;
|
||||||
|
|
||||||
@@ -12,7 +13,7 @@ namespace Logof_Client;
|
|||||||
public static class SchemaMigration
|
public static class SchemaMigration
|
||||||
{
|
{
|
||||||
// Current schema version - increment when you make breaking changes
|
// Current schema version - increment when you make breaking changes
|
||||||
public const int CURRENT_SCHEMA_VERSION = 3;
|
public const int CURRENT_SCHEMA_VERSION = 5;
|
||||||
|
|
||||||
// Dictionary of migration functions, keyed by the version they migrate TO
|
// Dictionary of migration functions, keyed by the version they migrate TO
|
||||||
private static readonly Dictionary<int, Func<JObject, JObject>> Migrations = new()
|
private static readonly Dictionary<int, Func<JObject, JObject>> Migrations = new()
|
||||||
@@ -22,7 +23,8 @@ public static class SchemaMigration
|
|||||||
// { 2, MigrateV1ToV2 },
|
// { 2, MigrateV1ToV2 },
|
||||||
|
|
||||||
// Example: Migration from v2 to v3
|
// Example: Migration from v2 to v3
|
||||||
// { 3, MigrateV2ToV3 },
|
{ 4, MigrateV3ToV4 },
|
||||||
|
{ 5, MigrateV4ToV5 },
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -93,12 +95,37 @@ public static class SchemaMigration
|
|||||||
/// Example migration function: from v2 to v3.
|
/// Example migration function: from v2 to v3.
|
||||||
/// Add a new required field with a default value.
|
/// Add a new required field with a default value.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static JObject MigrateV2ToV3(JObject obj)
|
private static JObject MigrateV3ToV4(JObject obj)
|
||||||
{
|
{
|
||||||
// Example: Add a new field that didn't exist before
|
// Example: Add a new field that didn't exist before
|
||||||
if (!obj.ContainsKey("new_required_field"))
|
if (!obj.ContainsKey("moduleConfig"))
|
||||||
{
|
{
|
||||||
obj["new_required_field"] = "default_value";
|
obj["moduleConfig"] = JToken.FromObject(new ModuleConfig());
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
private static JObject MigrateV4ToV5(JObject obj)
|
||||||
|
{
|
||||||
|
// Example: Add a new field that didn't exist before
|
||||||
|
if (!obj.ContainsKey("expLabEnable"))
|
||||||
|
{
|
||||||
|
obj["expLabEnable"] = JToken.FromObject(new PdfExportSettings().expLabEnable);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!obj.ContainsKey("expInt"))
|
||||||
|
{
|
||||||
|
obj["expInt"] = JToken.FromObject(new PdfExportSettings().expInt);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!obj.ContainsKey("expNat"))
|
||||||
|
{
|
||||||
|
obj["expNat"] = JToken.FromObject(new PdfExportSettings().expNat);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!obj.ContainsKey("rsGrupTol"))
|
||||||
|
{
|
||||||
|
obj["rsGrupTol"] = JToken.FromObject(new PdfExportSettings().rsGrupTol);
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
@@ -19,6 +20,8 @@ public class Settings
|
|||||||
public Customers customers = new();
|
public Customers customers = new();
|
||||||
public PdfExportSettings pdfExport { get; set; } = new();
|
public PdfExportSettings pdfExport { get; set; } = new();
|
||||||
|
|
||||||
|
public ModuleConfig moduleConfig { get; set; } = new ModuleConfig();
|
||||||
|
|
||||||
public Settings()
|
public Settings()
|
||||||
{
|
{
|
||||||
_instance = this;
|
_instance = this;
|
||||||
@@ -70,8 +73,32 @@ public class Settings
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ModuleConfig
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Contains enabled modules and whether it's password-protected or not (non-existing-feature but soon)
|
||||||
|
/// </summary>
|
||||||
|
public List<(LCModule, bool)> EnabledModules = new();
|
||||||
|
public ModuleConfig()
|
||||||
|
{
|
||||||
|
EnabledModules = new List<(LCModule,bool)>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum LCModule
|
||||||
|
{
|
||||||
|
Addressmanagement,
|
||||||
|
Pricemanagement,
|
||||||
|
Wiki,
|
||||||
|
Staffmanagement,
|
||||||
|
UnifiedEndpointManagement,
|
||||||
|
Financemanagement
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public class PdfExportSettings
|
public class PdfExportSettings
|
||||||
{
|
{
|
||||||
|
public bool expLabEnable {get; set;} = true;
|
||||||
public double cellPaddingTopMm { get; set; } = 4;
|
public double cellPaddingTopMm { get; set; } = 4;
|
||||||
public double cellPaddingBottomMm { get; set; } = 4;
|
public double cellPaddingBottomMm { get; set; } = 4;
|
||||||
public double cellPaddingLeftMm { get; set; } = 4;
|
public double cellPaddingLeftMm { get; set; } = 4;
|
||||||
@@ -91,6 +118,9 @@ public class PdfExportSettings
|
|||||||
public int rsNumGrouped { get; set; } = 25;
|
public int rsNumGrouped { get; set; } = 25;
|
||||||
public bool rsPvSt { get; set; } = true;
|
public bool rsPvSt { get; set; } = true;
|
||||||
|
|
||||||
|
public bool expInt { get; set; } = true;
|
||||||
|
public bool expNat { get; set; } = true;
|
||||||
|
|
||||||
public string rsKNrAbs { get; set; } = "";
|
public string rsKNrAbs { get; set; } = "";
|
||||||
public string rsKNrEmp { get; set; } = "";
|
public string rsKNrEmp { get; set; } = "";
|
||||||
public string rsZKZ { get; set; } = "";
|
public string rsZKZ { get; set; } = "";
|
||||||
@@ -101,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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+101
-9
@@ -21,8 +21,45 @@
|
|||||||
<MenuItem Header="Über" x:Name="MnuAbout" Click="MnuAbout_OnClick" />
|
<MenuItem Header="Über" x:Name="MnuAbout" Click="MnuAbout_OnClick" />
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
<TabControl Grid.Row="1">
|
<TabControl Grid.Row="1" x:Name="TcMain">
|
||||||
<TabItem>
|
<TabItem x:Name="Home">
|
||||||
|
<TabItem.Header>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<LucideIcon Kind="House" Width="32" Height="32" Size="32" />
|
||||||
|
<!-- <Label FontSize="20" Content="Addressverwaltung" VerticalContentAlignment="Center" /> -->
|
||||||
|
</StackPanel>
|
||||||
|
</TabItem.Header>
|
||||||
|
<Grid RowDefinitions="3*,*,100">
|
||||||
|
<StackPanel Orientation="Vertical" Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center" > <!-- ColumnDefinitions="*,*" -->
|
||||||
|
<Label Content="Welcome to Logofclient!" HorizontalAlignment="Center" FontSize="32" ></Label>
|
||||||
|
<Label Content="Version 1.0.1" FontSize="16" HorizontalAlignment="Center"></Label>
|
||||||
|
<!-- <Image Source="assets/calc_man.png" MaxHeight="350" VerticalAlignment="Center" HorizontalAlignment="Center" /> -->
|
||||||
|
</StackPanel>
|
||||||
|
<Grid Grid.Row="1" Margin="20" IsVisible="True" x:Name="GrdHMCalcMan">
|
||||||
|
<Image Source="assets/calc_man.png" VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||||
|
</Grid>
|
||||||
|
<!-- <Grid ColumnDefinitions="*,*,*" Grid.Row="1"> -->
|
||||||
|
<StackPanel Grid.Row="2" Orientation="Horizontal" Spacing="10" HorizontalAlignment="Center"
|
||||||
|
Margin="0,0,5,0">
|
||||||
|
<Button Width="250" HorizontalContentAlignment="Center"
|
||||||
|
Margin="0,0,0,10" IsEnabled="True" VerticalAlignment="Stretch"
|
||||||
|
x:Name="BtnAdmgmt" Click="BtnAdmgmt_OnClick">
|
||||||
|
<StackPanel Orientation="Vertical">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<LucideIcon Kind="MapPinHouse" Width="36" Height="36" />
|
||||||
|
<Label Content="Addressverwaltung" VerticalContentAlignment="Center" FontSize="15"
|
||||||
|
FontWeight="Bold" />
|
||||||
|
</StackPanel>
|
||||||
|
<TextBlock TextWrapping="Wrap" FontSize="9" Text="Strukturierte Verwaltung von Adressen für Pressepost-Printmailings inkl. Erstellung von Bundleitzetteln." HorizontalAlignment="Stretch" TextAlignment="Left"></TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
<!-- </Grid> -->
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</TabItem>
|
||||||
|
<TabItem IsVisible="False" x:Name="Addressmanagement">
|
||||||
<TabItem.Header>
|
<TabItem.Header>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<LucideIcon Kind="MapPinHouse" Width="32" Height="32" Size="32" />
|
<LucideIcon Kind="MapPinHouse" Width="32" Height="32" Size="32" />
|
||||||
@@ -87,6 +124,22 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</MenuItem.Header>
|
</MenuItem.Header>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
<MenuItem x:Name="MnIAdSetExp" Click="MnIAdSetExp_OnClick">
|
||||||
|
<MenuItem.Header>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<LucideIcon Kind="FileUp" Width="12" Height="12" Size="12" />
|
||||||
|
<Label Content="Exportieren (CSV)" VerticalContentAlignment="Center" />
|
||||||
|
</StackPanel>
|
||||||
|
</MenuItem.Header>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem x:Name="MnIAdSetExpAdpac" Click="MnIAdSetExpAdpac_OnClick">
|
||||||
|
<MenuItem.Header>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<LucideIcon Kind="FileUp" Width="12" Height="12" Size="12" />
|
||||||
|
<Label Content="Exportieren inkl. Adpac (CSV)" VerticalContentAlignment="Center" />
|
||||||
|
</StackPanel>
|
||||||
|
</MenuItem.Header>
|
||||||
|
</MenuItem>
|
||||||
<MenuItem x:Name="MnIAdSetDelete" Click="MnIAdSetDelete_OnClick" IsEnabled="True">
|
<MenuItem x:Name="MnIAdSetDelete" Click="MnIAdSetDelete_OnClick" IsEnabled="True">
|
||||||
<MenuItem.Header>
|
<MenuItem.Header>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
@@ -278,6 +331,23 @@
|
|||||||
<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">
|
||||||
<ScrollViewer Grid.Column="1">
|
<ScrollViewer Grid.Column="1">
|
||||||
<StackPanel Margin="5,5,5,5" Orientation="Vertical" Spacing="20" Background="AliceBlue" >
|
<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">
|
||||||
|
<Label Content="Was soll exportiert werden?" FontWeight="Bold"></Label>
|
||||||
|
<CheckBox Content="National exportieren" IsChecked="True" x:Name="CbExpNat"></CheckBox>
|
||||||
|
<CheckBox Content="International exportieren" IsChecked="True" x:Name="CbExpInt"></CheckBox>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Column="1" Orientation="Vertical" Spacing="10">
|
||||||
|
<Label Content="Versandetiketten-Export" FontWeight="Bold"></Label>
|
||||||
|
<CheckBox Content="Versandetiketten erstellen" x:Name="CbExpLabEnable"></CheckBox>
|
||||||
|
<CheckBox Content="PvSt" IsChecked="True" x:Name="CbExpRnsPvSt"></CheckBox>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Column="2" Orientation="Vertical" Spacing="10">
|
||||||
|
<Label Content="Leitzettel-Export" FontWeight="Bold"></Label>
|
||||||
|
<CheckBox Content="Bundleitzettel erstellen" x:Name="CbExpRnsEnable"></CheckBox>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
<Grid Height="1" MaxHeight="1" MinHeight="1" Background="DarkGray" Margin="10,10,10,0"></Grid>
|
||||||
<Grid ColumnDefinitions="*,*,*" ColumnSpacing="20" Margin="10,10,10,0">
|
<Grid ColumnDefinitions="*,*,*" ColumnSpacing="20" Margin="10,10,10,0">
|
||||||
<StackPanel Orientation="Vertical" Spacing="10">
|
<StackPanel Orientation="Vertical" Spacing="10">
|
||||||
<Grid ColumnDefinitions="*,*">
|
<Grid ColumnDefinitions="*,*">
|
||||||
@@ -296,9 +366,8 @@
|
|||||||
<Label Grid.Column="0" Content="Zellenrand rechts (mm)"></Label>
|
<Label Grid.Column="0" Content="Zellenrand rechts (mm)"></Label>
|
||||||
<NumericUpDown Grid.Column="1" x:Name="NudExpMargCellPaddingRight" Minimum="0" Maximum="20" Value="5"></NumericUpDown>
|
<NumericUpDown Grid.Column="1" x:Name="NudExpMargCellPaddingRight" Minimum="0" Maximum="20" Value="5"></NumericUpDown>
|
||||||
</Grid>
|
</Grid>
|
||||||
<CheckBox Content="Bundleitzettel erstellen" x:Name="CbExpRnsEnable"></CheckBox>
|
|
||||||
</StackPanel>
|
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
<StackPanel Grid.Column="1" Orientation="Vertical" Spacing="10">
|
<StackPanel Grid.Column="1" Orientation="Vertical" Spacing="10">
|
||||||
<Grid ColumnDefinitions="*,*">
|
<Grid ColumnDefinitions="*,*">
|
||||||
<Label Content="Zellenabstand oben"></Label>
|
<Label Content="Zellenabstand oben"></Label>
|
||||||
@@ -339,9 +408,9 @@
|
|||||||
<Label Grid.Column="0" Content="Schriftgröße (klein)"></Label>
|
<Label Grid.Column="0" Content="Schriftgröße (klein)"></Label>
|
||||||
<NumericUpDown Grid.Column="1" x:Name="NudExpMargSmallFontSize" Minimum="3" Maximum="30" Value="6"></NumericUpDown>
|
<NumericUpDown Grid.Column="1" x:Name="NudExpMargSmallFontSize" Minimum="3" Maximum="30" Value="6"></NumericUpDown>
|
||||||
</Grid>
|
</Grid>
|
||||||
<CheckBox Content="PvSt" IsChecked="True" x:Name="CbExpRnsPvSt"></CheckBox>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
<Grid Height="1" MaxHeight="1" MinHeight="1" Background="DarkGray" Margin="10,10,10,0"></Grid>
|
||||||
<Grid ColumnDefinitions="*,*" ColumnSpacing="20" Margin="10,10,10,0">
|
<Grid ColumnDefinitions="*,*" ColumnSpacing="20" Margin="10,10,10,0">
|
||||||
<StackPanel Grid.Column="0" Orientation="Vertical" Spacing="10">
|
<StackPanel Grid.Column="0" Orientation="Vertical" Spacing="10">
|
||||||
<Grid ColumnDefinitions="*,2*">
|
<Grid ColumnDefinitions="*,2*">
|
||||||
@@ -364,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*">
|
||||||
@@ -396,7 +469,7 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem IsEnabled="False">
|
<TabItem IsEnabled="False" IsVisible="False" x:Name="Staffmanagement">
|
||||||
<TabItem.Header>
|
<TabItem.Header>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<LucideIcon Kind="Users" Width="32" Height="32" Size="32" />
|
<LucideIcon Kind="Users" Width="32" Height="32" Size="32" />
|
||||||
@@ -404,7 +477,7 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</TabItem.Header>
|
</TabItem.Header>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem IsEnabled="False">
|
<TabItem IsEnabled="False" IsVisible="False" x:Name="Financemanagement">
|
||||||
<TabItem.Header>
|
<TabItem.Header>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<LucideIcon Kind="BadgeEuro" Width="32" Height="32" Size="32" />
|
<LucideIcon Kind="BadgeEuro" Width="32" Height="32" Size="32" />
|
||||||
@@ -412,7 +485,7 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</TabItem.Header>
|
</TabItem.Header>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem IsEnabled="False">
|
<TabItem IsEnabled="False" IsVisible="False" x:Name="Pricemanagement">
|
||||||
<TabItem.Header>
|
<TabItem.Header>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<LucideIcon Kind="ReceiptEuro" Width="32" Height="32" Size="32" />
|
<LucideIcon Kind="ReceiptEuro" Width="32" Height="32" Size="32" />
|
||||||
@@ -420,7 +493,15 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</TabItem.Header>
|
</TabItem.Header>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem IsEnabled="True">
|
<TabItem IsEnabled="False" IsVisible="False" x:Name="UnifiedEndpointManagement">
|
||||||
|
<TabItem.Header>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<LucideIcon Kind="MonitorCog" Width="32" Height="32" Size="32" />
|
||||||
|
<Label FontSize="20" Content="UEM" VerticalContentAlignment="Center" />
|
||||||
|
</StackPanel>
|
||||||
|
</TabItem.Header>
|
||||||
|
</TabItem>
|
||||||
|
<TabItem IsEnabled="True" IsVisible="False" x:Name="Wiki">
|
||||||
<TabItem.Header>
|
<TabItem.Header>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<LucideIcon Kind="LibraryBig" Width="32" Height="32" Size="32" />
|
<LucideIcon Kind="LibraryBig" Width="32" Height="32" Size="32" />
|
||||||
@@ -540,6 +621,17 @@
|
|||||||
<!-- </Grid> -->
|
<!-- </Grid> -->
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
<TabItem>
|
||||||
|
<TabItem.Header>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<LucideIcon Kind="Puzzle" Width="16" Height="16" Size="16" />
|
||||||
|
<Label FontSize="16" Content="Module" VerticalContentAlignment="Center" />
|
||||||
|
</StackPanel>
|
||||||
|
</TabItem.Header>
|
||||||
|
<StackPanel Orientation="Vertical" Spacing="10" x:Name="StpSettingsModules">
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
</TabItem>
|
||||||
<TabItem>
|
<TabItem>
|
||||||
<TabItem.Header>
|
<TabItem.Header>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
|
|||||||
+165
-1
@@ -85,8 +85,92 @@ public partial class MainWindow : Window
|
|||||||
{
|
{
|
||||||
Logger.Log($"Error while doing wiki stuff: {ex.Message}", Logger.LogType.Error);
|
Logger.Log($"Error while doing wiki stuff: {ex.Message}", Logger.LogType.Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach(var module in Enum.GetValues<LCModule>())
|
||||||
|
{
|
||||||
|
CheckBox b = new CheckBox
|
||||||
|
{
|
||||||
|
IsChecked = false
|
||||||
|
};
|
||||||
|
b.Click += (object sender, RoutedEventArgs e) => {
|
||||||
|
RenewModuleSettings(module, b.IsChecked);
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach(var conf in Settings._instance.moduleConfig.EnabledModules)
|
||||||
|
{
|
||||||
|
if(conf.Item1 == module)
|
||||||
|
{
|
||||||
|
b.IsChecked = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Label l = new Label()
|
||||||
|
{
|
||||||
|
Content = module.ToString(),
|
||||||
|
};
|
||||||
|
StpSettingsModules.Children.Add(new StackPanel()
|
||||||
|
{
|
||||||
|
Orientation = Avalonia.Layout.Orientation.Horizontal,
|
||||||
|
Children = {b,l}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(var conf in Settings._instance.moduleConfig.EnabledModules)
|
||||||
|
{
|
||||||
|
Logger.Log($"Enabling module: {conf.Item1}");
|
||||||
|
switch (conf.Item1)
|
||||||
|
{
|
||||||
|
case LCModule.Addressmanagement:
|
||||||
|
Addressmanagement.IsVisible = true;
|
||||||
|
break;
|
||||||
|
case LCModule.Pricemanagement:
|
||||||
|
Pricemanagement.IsVisible = true;
|
||||||
|
break;
|
||||||
|
case LCModule.Staffmanagement:
|
||||||
|
Staffmanagement.IsVisible = true;
|
||||||
|
break;
|
||||||
|
case LCModule.Financemanagement:
|
||||||
|
Financemanagement.IsVisible = true;
|
||||||
|
break;
|
||||||
|
case LCModule.Wiki:
|
||||||
|
Wiki.IsVisible = true;
|
||||||
|
break;
|
||||||
|
case LCModule.UnifiedEndpointManagement:
|
||||||
|
UnifiedEndpointManagement.IsVisible = true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.Log($"Error while applying module configuration: {ex.Message}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void RenewModuleSettings(LCModule value, bool? enabled = true)
|
||||||
|
{
|
||||||
|
if (enabled == true)
|
||||||
|
{
|
||||||
|
Settings._instance.moduleConfig.EnabledModules.Add((value,false));
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
int index = -1;
|
||||||
|
foreach(var conf in Settings._instance.moduleConfig.EnabledModules)
|
||||||
|
{
|
||||||
|
if(conf.Item1 == value)
|
||||||
|
{
|
||||||
|
index = Settings._instance.moduleConfig.EnabledModules.IndexOf(conf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(index != -1)
|
||||||
|
Settings._instance.moduleConfig.EnabledModules.RemoveAt(index);
|
||||||
|
}
|
||||||
|
Settings.Save();
|
||||||
|
}
|
||||||
private async void StartAddressCheck(int addresSetID)
|
private async void StartAddressCheck(int addresSetID)
|
||||||
{
|
{
|
||||||
var progressWindow = new ProgressWindow();
|
var progressWindow = new ProgressWindow();
|
||||||
@@ -894,6 +978,8 @@ public partial class MainWindow : Window
|
|||||||
{
|
{
|
||||||
var options = Settings._instance.pdfExport ?? new PdfExportSettings();
|
var options = Settings._instance.pdfExport ?? new PdfExportSettings();
|
||||||
|
|
||||||
|
CbExpLabEnable.IsChecked = (bool)options.expLabEnable;
|
||||||
|
|
||||||
NudExpMargCellPaddingTop.Value = (decimal)options.cellPaddingTopMm;
|
NudExpMargCellPaddingTop.Value = (decimal)options.cellPaddingTopMm;
|
||||||
NudExpMargCellPaddingBot.Value = (decimal)options.cellPaddingBottomMm;
|
NudExpMargCellPaddingBot.Value = (decimal)options.cellPaddingBottomMm;
|
||||||
NudExpMargCellPaddingLeft.Value = (decimal)options.cellPaddingLeftMm;
|
NudExpMargCellPaddingLeft.Value = (decimal)options.cellPaddingLeftMm;
|
||||||
@@ -910,6 +996,10 @@ public partial class MainWindow : Window
|
|||||||
NudExpMargFontSize.Value = (decimal)options.fontSize;
|
NudExpMargFontSize.Value = (decimal)options.fontSize;
|
||||||
NudExpMargSmallFontSize.Value = (decimal)options.smallFontSize;
|
NudExpMargSmallFontSize.Value = (decimal)options.smallFontSize;
|
||||||
CbExpRnsPvSt.IsChecked = options.rsPvSt;
|
CbExpRnsPvSt.IsChecked = options.rsPvSt;
|
||||||
|
CbExpRnsEnable.IsChecked = options.exportRunningSheets;
|
||||||
|
|
||||||
|
CbExpNat.IsChecked = options.expNat;
|
||||||
|
CbExpInt.IsChecked = options.expInt;
|
||||||
|
|
||||||
TbExpRnsKNrAbs.Text = options.rsKNrAbs;
|
TbExpRnsKNrAbs.Text = options.rsKNrAbs;
|
||||||
TbExpRnsKNrEmp.Text = options.rsKNrEmp;
|
TbExpRnsKNrEmp.Text = options.rsKNrEmp;
|
||||||
@@ -921,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)
|
||||||
{
|
{
|
||||||
@@ -946,6 +1037,8 @@ public partial class MainWindow : Window
|
|||||||
fontSize = ReadDouble(NudExpMargFontSize),
|
fontSize = ReadDouble(NudExpMargFontSize),
|
||||||
smallFontSize = ReadDouble(NudExpMargSmallFontSize),
|
smallFontSize = ReadDouble(NudExpMargSmallFontSize),
|
||||||
|
|
||||||
|
expLabEnable = CbExpLabEnable.IsChecked.Value,
|
||||||
|
|
||||||
rsKNrAbs = TbExpRnsKNrAbs.Text,
|
rsKNrAbs = TbExpRnsKNrAbs.Text,
|
||||||
rsKNrEmp = TbExpRnsKNrEmp.Text,
|
rsKNrEmp = TbExpRnsKNrEmp.Text,
|
||||||
rsZKZ = TbExpRnsZKZ.Text,
|
rsZKZ = TbExpRnsZKZ.Text,
|
||||||
@@ -956,8 +1049,13 @@ public partial class MainWindow : Window
|
|||||||
rsBundGew = TbExpRnsBundGew.Text,
|
rsBundGew = TbExpRnsBundGew.Text,
|
||||||
rsPalNr = ReadInt(NudExpRnsPalNr, 1),
|
rsPalNr = ReadInt(NudExpRnsPalNr, 1),
|
||||||
rsBundNrPal = ReadInt(NudExpRnsBundNrPal, 20),
|
rsBundNrPal = ReadInt(NudExpRnsBundNrPal, 20),
|
||||||
|
rsNumGrouped = ReadInt(NudExpRnsPlzcount, 25),
|
||||||
|
expNat = CbExpNat.IsChecked.Value,
|
||||||
|
expInt = CbExpInt.IsChecked.Value,
|
||||||
|
rsGrupTol = ReadInt(NudExpRnsGrupTol, 0),
|
||||||
|
|
||||||
rsPvSt = CbExpRnsPvSt.IsChecked.Value
|
rsPvSt = CbExpRnsPvSt.IsChecked.Value,
|
||||||
|
exportRunningSheets = CbExpRnsEnable.IsChecked.Value
|
||||||
};
|
};
|
||||||
|
|
||||||
Settings.Save();
|
Settings.Save();
|
||||||
@@ -1387,4 +1485,70 @@ public partial class MainWindow : Window
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async void MnIAdSetExp_OnClick(object? sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var topLevel = TopLevel.GetTopLevel(this);
|
||||||
|
Logger.Log("Exporting as CSV without address patch...");
|
||||||
|
var folders = await topLevel.StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
|
||||||
|
{
|
||||||
|
Title = "Select a Folder",
|
||||||
|
AllowMultiple = false
|
||||||
|
});
|
||||||
|
|
||||||
|
if (folders.Count > 0)
|
||||||
|
{
|
||||||
|
var folderPath = folders[0].Path.LocalPath;
|
||||||
|
Logger.Log($"using ${folderPath} as export destination");
|
||||||
|
if (LstCustomerAdressSets.SelectedItems.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var set in LstCustomerAdressSets.SelectedItems)
|
||||||
|
{
|
||||||
|
string output = await ((KasAddressList)set).GenerateCSV(false);
|
||||||
|
File.WriteAllText(Path.Combine(folderPath,((KasAddressList)set).Name + ".csv"), output);
|
||||||
|
Logger.Log($"exported ${((KasAddressList)set).Name} successfully!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void MnIAdSetExpAdpac_OnClick(object? sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var topLevel = TopLevel.GetTopLevel(this);
|
||||||
|
Logger.Log("Exporting as CSV with address patch...");
|
||||||
|
var folders = await topLevel.StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
|
||||||
|
{
|
||||||
|
Title = "Select a Folder",
|
||||||
|
AllowMultiple = false
|
||||||
|
});
|
||||||
|
|
||||||
|
if (folders.Count > 0)
|
||||||
|
{
|
||||||
|
var folderPath = folders[0].Path.LocalPath;
|
||||||
|
Logger.Log($"using ${folderPath} as export destination");
|
||||||
|
if (LstCustomerAdressSets.SelectedItems.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var set in LstCustomerAdressSets.SelectedItems)
|
||||||
|
{
|
||||||
|
string output = await ((KasAddressList)set).GenerateCSV(true);
|
||||||
|
File.WriteAllText(Path.Combine(folderPath,((KasAddressList)set).Name + ".csv"), output);
|
||||||
|
Logger.Log($"exported ${((KasAddressList)set).Name} successfully!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnAdmgmt_OnClick(object? sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (Addressmanagement.IsVisible && Addressmanagement.IsVisible)
|
||||||
|
{
|
||||||
|
TcMain.SelectedIndex = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -168,6 +168,7 @@ public static class AddressCreator
|
|||||||
} // Error-Handling?
|
} // Error-Handling?
|
||||||
|
|
||||||
if (address_line_count > 1) return string_address;
|
if (address_line_count > 1) return string_address;
|
||||||
|
Logger.Log($"Address with ID {address.id} (refsid: {address.refsid} not valid for production use", Logger.LogType.Warning);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using Avalonia.Controls;
|
||||||
using Logof_Client;
|
using Logof_Client;
|
||||||
|
|
||||||
public class AddressPatch
|
public class AddressPatch
|
||||||
@@ -134,4 +135,84 @@ public class AddressPatch
|
|||||||
|
|
||||||
return "Error while parsing";
|
return "Error while parsing";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetCSVHeader(string sep)
|
||||||
|
{
|
||||||
|
string output = "";
|
||||||
|
|
||||||
|
if(has_refsid){
|
||||||
|
output += refsid_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_anrede){
|
||||||
|
output += anrede_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_titel){
|
||||||
|
output += titel_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_vorname){
|
||||||
|
output += vorname_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_adel){
|
||||||
|
output += adel_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_name){
|
||||||
|
output += name_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_namezus){
|
||||||
|
output += namezus_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_anredzus){
|
||||||
|
output += anredzus_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_strasse){
|
||||||
|
output += strasse_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_strasse2){
|
||||||
|
output += strasse2_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_plz){
|
||||||
|
output += plz_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_ort){
|
||||||
|
output += ort_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_land){
|
||||||
|
output += land_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_pplz){
|
||||||
|
output += pplz_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_postfach){
|
||||||
|
output += postfach_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_name1){
|
||||||
|
output += name1_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_name2){
|
||||||
|
output += name2_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_name3){
|
||||||
|
output += name3_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_name4){
|
||||||
|
output += name4_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_name5){
|
||||||
|
output += name5_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_funktion){
|
||||||
|
output += funktion_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_funktion2){
|
||||||
|
output += funktion2_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_abteilung){
|
||||||
|
output += abteilung_is + sep + " ";
|
||||||
|
}
|
||||||
|
if(has_funktionad){
|
||||||
|
output += funktionad_is + sep + " ";
|
||||||
|
}
|
||||||
|
Logger.Log($"Generated CSV header ist ${output}");
|
||||||
|
return output;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -3,16 +3,26 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Threading.Tasks.Dataflow;
|
using System.Threading.Tasks.Dataflow;
|
||||||
|
using System.Threading;
|
||||||
|
using Avalonia.Threading;
|
||||||
|
|
||||||
namespace Logof_Client;
|
namespace Logof_Client;
|
||||||
|
|
||||||
public class AddressShortener(ProgressWindow progressWindow)
|
public class AddressShortener
|
||||||
{
|
{
|
||||||
|
private readonly ProgressWindow _progress;
|
||||||
|
|
||||||
|
public AddressShortener(ProgressWindow progressWindow)
|
||||||
|
{
|
||||||
|
_progress = progressWindow;
|
||||||
|
}
|
||||||
public async Task Perform(KasAddressList list)
|
public async Task Perform(KasAddressList list)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<int> doubled_ids = new List<int>();
|
List<int> doubled_ids = new List<int>();
|
||||||
|
int[] percentages = [25,25,25,25];
|
||||||
|
|
||||||
for (int i = 0; i < list.KasPersons.Count; i++)
|
for (int i = 0; i < list.KasPersons.Count; i++)
|
||||||
{
|
{
|
||||||
var address = list.KasPersons[i];
|
var address = list.KasPersons[i];
|
||||||
@@ -26,8 +36,19 @@ public class AddressShortener(ProgressWindow progressWindow)
|
|||||||
doubled_ids.Add(address.refsid);
|
doubled_ids.Add(address.refsid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// var cd = Interlocked.Increment(ref current);
|
||||||
|
|
||||||
|
// if (cd % 10 == 0)
|
||||||
|
// {
|
||||||
|
// var percent = cd / (double)total * 100;
|
||||||
|
|
||||||
|
// await Dispatcher.UIThread.InvokeAsync(() =>
|
||||||
|
// _progress.ChangePercentage(percent));
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// delete doubled addresses by refsid
|
// delete doubled addresses by refsid
|
||||||
foreach (int id in doubled_ids)
|
foreach (int id in doubled_ids)
|
||||||
{
|
{
|
||||||
@@ -65,12 +86,19 @@ public class AddressShortener(ProgressWindow progressWindow)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string faileds = "Folgende Adressen wurden entfernt:\n(refsid - Name, Vorname)\n\n";
|
||||||
// delete doubled addresses by refsid
|
// delete doubled addresses by refsid
|
||||||
foreach (int id in toRemove)
|
foreach (int id in toRemove)
|
||||||
{
|
{
|
||||||
// does this remove both of the doubled addresses?
|
// does this remove both of the doubled addresses?
|
||||||
list.KasPersons.Remove(list.KasPersons.Find(x => x.id == id));
|
var pers = list.KasPersons.Find(x => x.id == id);
|
||||||
|
faileds += pers.refsid + " - " + pers.name + ", " + pers.vorname + "\n";
|
||||||
|
list.KasPersons.Remove(pers);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
await Dispatcher.UIThread.InvokeAsync(() => _progress.Hide());
|
||||||
|
if (toRemove.Count > 0) await Dispatcher.UIThread.InvokeAsync(() => MessageBox.Show(null,faileds,"Fehlerhafte Adressen"));
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
+269
-72
@@ -11,6 +11,8 @@ namespace Logof_Client;
|
|||||||
|
|
||||||
public class PdfBuilder
|
public class PdfBuilder
|
||||||
{
|
{
|
||||||
|
private const char RecipientTextMarker = '\u001f';
|
||||||
|
|
||||||
private readonly PdfExportSettings _settings;
|
private readonly PdfExportSettings _settings;
|
||||||
private readonly XFont _boldFont;
|
private readonly XFont _boldFont;
|
||||||
private readonly XFont _regularFont;
|
private readonly XFont _regularFont;
|
||||||
@@ -92,6 +94,8 @@ public class PdfBuilder
|
|||||||
public void CreateAddressLabelPdfFromAddressSetWithPlaceholder(int addressSetId, string placeholderText, bool pvst,
|
public void CreateAddressLabelPdfFromAddressSetWithPlaceholder(int addressSetId, string placeholderText, bool pvst,
|
||||||
string outputPath)
|
string outputPath)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Find the AddressSet by ID
|
// Find the AddressSet by ID
|
||||||
@@ -120,44 +124,50 @@ public class PdfBuilder
|
|||||||
senderLine = null;
|
senderLine = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<KasPerson> failed = new();
|
||||||
// national addresses
|
// national addresses
|
||||||
for (var i = 0; i < addressSet.KasPersons.Count; i++)
|
foreach (var person in addressSet.KasPersons
|
||||||
|
.Where(person => person.IsGermany())
|
||||||
|
.OrderBy(person => person.used_plz))
|
||||||
{
|
{
|
||||||
string senderLineID = senderLine;
|
string senderLineID = senderLine;
|
||||||
if (!addressSet.KasPersons[i].IsGermany()) continue;
|
var addr = AddressCreator.CreateFinalMarkdownString(person.id);
|
||||||
var addr = AddressCreator.CreateFinalMarkdownString(addressSet.KasPersons[i].id);
|
if(addr == null) failed.Add(person);
|
||||||
if (string.IsNullOrWhiteSpace(addr)) continue;
|
if (string.IsNullOrWhiteSpace(addr)) continue;
|
||||||
if (pvst)
|
if (pvst)
|
||||||
senderLineID += $"</font6>**PvSt, DP AG, Entgelt bezahlt, ZKZ {Settings._instance.pdfExport.rsZKZ}**\n<font6>";
|
senderLineID += $"</font6>**PvSt, DP AG, Entgelt bezahlt, ZKZ {Settings._instance.pdfExport.rsZKZ}**\n<font6>";
|
||||||
|
|
||||||
if (addressSet.KasPersons[i].refsid != null || addressSet.KasPersons[i].refsid != 0)
|
if (person.refsid != null || person.refsid != 0)
|
||||||
senderLineID += $"ID: {addressSet.KasPersons[i].refsid}\n</font6>";
|
senderLineID += $"ID: {person.refsid}\n</font6>";
|
||||||
else
|
else
|
||||||
senderLineID += "\n</font6>";
|
senderLineID += "\n</font6>";
|
||||||
if (!string.IsNullOrEmpty(senderLineID))
|
if (!string.IsNullOrEmpty(senderLineID))
|
||||||
addresses_german.Add(senderLineID + (addr ?? ""));
|
addresses_german.Add(senderLineID + RecipientTextMarker + (addr ?? ""));
|
||||||
else
|
else
|
||||||
addresses_german.Add(addr);
|
addresses_german.Add(RecipientTextMarker + (addr ?? ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
// international addresses
|
// international addresses
|
||||||
for (var i = 0; i < addressSet.KasPersons.Count; i++)
|
foreach (var person in addressSet.KasPersons
|
||||||
|
.Where(person => !person.IsGermany())
|
||||||
|
.OrderBy(person => person.land)
|
||||||
|
.ThenBy(person => person.used_plz))
|
||||||
{
|
{
|
||||||
string senderLineID = senderLine;
|
string senderLineID = senderLine;
|
||||||
if (addressSet.KasPersons[i].IsGermany()) continue;
|
var addr = AddressCreator.CreateFinalMarkdownString(person.id);
|
||||||
var addr = AddressCreator.CreateFinalMarkdownString(addressSet.KasPersons[i].id);
|
if(addr == null) failed.Add(person);
|
||||||
if (string.IsNullOrWhiteSpace(addr)) continue;
|
if (string.IsNullOrWhiteSpace(addr)) continue;
|
||||||
if (pvst)
|
if (pvst)
|
||||||
senderLineID += $"</font6>**PvSt, DP AG, Entgelt bezahlt, ZKZ {Settings._instance.pdfExport.rsZKZ}**\n<font6>";
|
senderLineID += $"</font6>**PvSt, DP AG, Entgelt bezahlt, ZKZ {Settings._instance.pdfExport.rsZKZ}**\n<font6>";
|
||||||
|
|
||||||
if (addressSet.KasPersons[i].refsid != null || addressSet.KasPersons[i].refsid != 0)
|
if (person.refsid != null || person.refsid != 0)
|
||||||
senderLineID += $"ID: {addressSet.KasPersons[i].refsid}\n</font6>";
|
senderLineID += $"ID: {person.refsid}\n</font6>";
|
||||||
else
|
else
|
||||||
senderLineID += "\n</font6>";
|
senderLineID += "\n</font6>";
|
||||||
if (!string.IsNullOrEmpty(senderLineID))
|
if (!string.IsNullOrEmpty(senderLineID))
|
||||||
addresses_inter.Add(senderLineID + (addr ?? ""));
|
addresses_inter.Add(senderLineID + RecipientTextMarker + (addr ?? ""));
|
||||||
else
|
else
|
||||||
addresses_inter.Add(addr);
|
addresses_inter.Add(RecipientTextMarker + (addr ?? ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addresses_german.Count == 0 && addresses_inter.Count == 0)
|
if (addresses_german.Count == 0 && addresses_inter.Count == 0)
|
||||||
@@ -168,13 +178,29 @@ public class PdfBuilder
|
|||||||
|
|
||||||
string output_inter = outputPath.Replace(".pdf", "-international.pdf");
|
string output_inter = outputPath.Replace(".pdf", "-international.pdf");
|
||||||
|
|
||||||
if(addresses_german.Count > 0) CreateAddressLabelPdfWithPlaceholder(addresses_german, placeholderText, outputPath, pvst);
|
if(Settings._instance.pdfExport.expLabEnable == false)
|
||||||
if(addresses_inter.Count > 0) CreateAddressLabelPdfWithPlaceholder(addresses_inter, placeholderText, output_inter, pvst);
|
{
|
||||||
|
Logger.Log("Skipping label pdf generation cause it was disabled by user");
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
if(addresses_german.Count > 0 && Settings._instance.pdfExport.expNat) CreateAddressLabelPdfWithPlaceholder(addresses_german, placeholderText, outputPath, pvst);
|
||||||
|
if(addresses_inter.Count > 0 && Settings._instance.pdfExport.expInt) CreateAddressLabelPdfWithPlaceholder(addresses_inter, placeholderText, output_inter, pvst);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (_settings.exportRunningSheets)
|
if (_settings.exportRunningSheets)
|
||||||
{
|
{
|
||||||
ExportRunningSheets(addressSetId, outputPath);
|
ExportRunningSheets(addressSetId, outputPath);
|
||||||
}
|
}
|
||||||
|
if(failed.Count > 0)
|
||||||
|
{
|
||||||
|
string faileds = "Versandetiketten zu folgenden Adressen konnten nicht generiert werden:\n(refsid - Name, Vorname)\n\n";
|
||||||
|
foreach(var pers in failed)
|
||||||
|
{
|
||||||
|
faileds += pers.refsid + " - " + pers.name + ", " + pers.vorname + "\n";
|
||||||
|
}
|
||||||
|
MessageBox.Show(MainWindow._instance,faileds,"Fehlerhafte Adressen");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -335,12 +361,14 @@ public class PdfBuilder
|
|||||||
public string Text { get; }
|
public string Text { get; }
|
||||||
public TextStyle Style { get; }
|
public TextStyle Style { get; }
|
||||||
public bool LineBreak { get; }
|
public bool LineBreak { get; }
|
||||||
|
public bool WrapAtWords { get; }
|
||||||
|
|
||||||
public TextToken(string text, TextStyle style, bool lineBreak = false)
|
public TextToken(string text, TextStyle style, bool lineBreak = false, bool wrapAtWords = false)
|
||||||
{
|
{
|
||||||
Text = text;
|
Text = text;
|
||||||
Style = style;
|
Style = style;
|
||||||
LineBreak = lineBreak;
|
LineBreak = lineBreak;
|
||||||
|
WrapAtWords = wrapAtWords;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -394,19 +422,28 @@ public class PdfBuilder
|
|||||||
|
|
||||||
var i = 0;
|
var i = 0;
|
||||||
var style = TextStyle.Regular;
|
var style = TextStyle.Regular;
|
||||||
|
var wrapAtWords = false;
|
||||||
var buffer = new System.Text.StringBuilder();
|
var buffer = new System.Text.StringBuilder();
|
||||||
|
|
||||||
void FlushBuffer()
|
void FlushBuffer()
|
||||||
{
|
{
|
||||||
if (buffer.Length > 0)
|
if (buffer.Length > 0)
|
||||||
{
|
{
|
||||||
tokens.Add(new TextToken(buffer.ToString(), style));
|
tokens.Add(new TextToken(buffer.ToString(), style, wrapAtWords: wrapAtWords));
|
||||||
buffer.Clear();
|
buffer.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (i < text.Length)
|
while (i < text.Length)
|
||||||
{
|
{
|
||||||
|
if (text[i] == RecipientTextMarker)
|
||||||
|
{
|
||||||
|
FlushBuffer();
|
||||||
|
wrapAtWords = true;
|
||||||
|
i++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (text[i] == '\r')
|
if (text[i] == '\r')
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
@@ -523,6 +560,39 @@ public class PdfBuilder
|
|||||||
available = maxWidth;
|
available = maxWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (token.WrapAtWords)
|
||||||
|
{
|
||||||
|
var wordParts = System.Text.RegularExpressions.Regex.Split(remaining, @"(\s+)");
|
||||||
|
foreach (var wordPart in wordParts)
|
||||||
|
{
|
||||||
|
if (wordPart.Length == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var wordWidth = gfx.MeasureString(wordPart, font).Width;
|
||||||
|
if (string.IsNullOrWhiteSpace(wordPart))
|
||||||
|
{
|
||||||
|
if (currentLine.Count == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (currentWidth + wordWidth > maxWidth)
|
||||||
|
{
|
||||||
|
PushLine();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (currentLine.Count > 0 && currentWidth + wordWidth > maxWidth)
|
||||||
|
{
|
||||||
|
PushLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
currentLine.Add(new TextRun { Text = wordPart, Font = font });
|
||||||
|
currentWidth += wordWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
remaining = "";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var fit = FitTextToWidth(gfx, remaining, font, available);
|
var fit = FitTextToWidth(gfx, remaining, font, available);
|
||||||
if (string.IsNullOrEmpty(fit))
|
if (string.IsNullOrEmpty(fit))
|
||||||
{
|
{
|
||||||
@@ -679,6 +749,7 @@ public class PdfBuilder
|
|||||||
document.Info.Author = "logofclient";
|
document.Info.Author = "logofclient";
|
||||||
|
|
||||||
var grouped_nums = GroupAddresses(setID).ToList();
|
var grouped_nums = GroupAddresses(setID).ToList();
|
||||||
|
DrawPostalCodeOverview(document, grouped_nums);
|
||||||
|
|
||||||
// Zwei Tabellen pro A4-Seite
|
// Zwei Tabellen pro A4-Seite
|
||||||
int sheets = (grouped_nums.Count + 1) / 2;
|
int sheets = (grouped_nums.Count + 1) / 2;
|
||||||
@@ -709,12 +780,14 @@ 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 =
|
int? palletNumber = null;
|
||||||
Settings._instance.pdfExport.rsPalNr +
|
int? bundleOnPallet = null;
|
||||||
(firstIndex / Settings._instance.pdfExport.rsBundNrPal);
|
if (Settings._instance.pdfExport.rsBundNrPal > 0)
|
||||||
|
{
|
||||||
int bundleOnPallet =
|
palletNumber = Settings._instance.pdfExport.rsPalNr +
|
||||||
(firstIndex % Settings._instance.pdfExport.rsBundNrPal) + 1;
|
(firstIndex / Settings._instance.pdfExport.rsBundNrPal);
|
||||||
|
bundleOnPallet = (firstIndex % Settings._instance.pdfExport.rsBundNrPal) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
DrawGermanyRunningSheet(
|
DrawGermanyRunningSheet(
|
||||||
gfx,
|
gfx,
|
||||||
@@ -735,12 +808,14 @@ public class PdfBuilder
|
|||||||
|
|
||||||
int secondIndex = firstIndex + 1;
|
int secondIndex = firstIndex + 1;
|
||||||
|
|
||||||
int palletNumber2 =
|
int? palletNumber2 = null;
|
||||||
Settings._instance.pdfExport.rsPalNr +
|
int? bundleOnPallet2 = null;
|
||||||
(secondIndex / Settings._instance.pdfExport.rsBundNrPal);
|
if (Settings._instance.pdfExport.rsBundNrPal > 0)
|
||||||
|
{
|
||||||
int bundleOnPallet2 =
|
palletNumber2 = Settings._instance.pdfExport.rsPalNr +
|
||||||
(secondIndex % Settings._instance.pdfExport.rsBundNrPal) + 1;
|
(secondIndex / Settings._instance.pdfExport.rsBundNrPal);
|
||||||
|
bundleOnPallet2 = (secondIndex % Settings._instance.pdfExport.rsBundNrPal) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (firstIndex + 1 < grouped_nums.Count)
|
if (firstIndex + 1 < grouped_nums.Count)
|
||||||
{
|
{
|
||||||
@@ -766,7 +841,107 @@ public class PdfBuilder
|
|||||||
document.Save(path);
|
document.Save(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawGermanyRunningSheet(XGraphics gfx, double x, double y, double w, double h, KasAddressList list, dynamic result, List<(int,string,string,string,int)> grouped_nums, XFont fontLabel, XFont fontText, XFont fontBig, int pal_nr, int bundleOnPallet, int totalBundleNumber)
|
private void DrawPostalCodeOverview(PdfDocument document, List<(int, string, string, string, int)> groupedNumbers)
|
||||||
|
{
|
||||||
|
if (groupedNumbers.Count == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var summaries = groupedNumbers
|
||||||
|
.GroupBy(item => item.Item2)
|
||||||
|
.OrderBy(group => group.Key, StringComparer.Ordinal)
|
||||||
|
.Select(group => new
|
||||||
|
{
|
||||||
|
Prefix = group.Key,
|
||||||
|
AddressCount = group.Sum(item => item.Item5),
|
||||||
|
GroupCount = group.Count(),
|
||||||
|
StartPostalCode = group.First().Item3,
|
||||||
|
EndPostalCode = group.Last().Item4
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
const double tableTop = 58;
|
||||||
|
const double headerHeight = 16;
|
||||||
|
const double rowHeight = 14;
|
||||||
|
const double tableGap = 12;
|
||||||
|
double[] columnWidths = { 40, 50, 36, 55, 55 };
|
||||||
|
string[] headers = { "PLZ-Gr.", "Anz.", "Anz.Gr.", "Start", "Ende" };
|
||||||
|
var titleFont = new XFont("Arial", 13, XFontStyleEx.Bold);
|
||||||
|
var headerFont = new XFont("Arial", 7.5, XFontStyleEx.Bold);
|
||||||
|
var textFont = new XFont("Arial", 7.5, XFontStyleEx.Regular);
|
||||||
|
var groupCountFont = new XFont("Arial", 7.5, XFontStyleEx.Bold);
|
||||||
|
int leftCount = (summaries.Count + 1) / 2;
|
||||||
|
double tableWidth = columnWidths.Sum();
|
||||||
|
double allTablesWidth = tableWidth * 2 + tableGap;
|
||||||
|
|
||||||
|
var page = document.AddPage();
|
||||||
|
page.Size = PageSize.A4;
|
||||||
|
using var gfx = XGraphics.FromPdfPage(page);
|
||||||
|
|
||||||
|
gfx.DrawString("Übersicht PLZ-Gruppen", titleFont, XBrushes.Black,
|
||||||
|
new XRect(28, 16, page.Width.Point - 56, 20), XStringFormats.TopLeft);
|
||||||
|
|
||||||
|
var metadataFont = new XFont("Arial", 9, XFontStyleEx.Regular);
|
||||||
|
double metadataWidth = (page.Width.Point - 56) / 3;
|
||||||
|
gfx.DrawString($"ZKZ: {_settings.rsZKZ}", metadataFont, XBrushes.Black,
|
||||||
|
new XRect(28, 38, metadataWidth, 16), XStringFormats.TopLeft);
|
||||||
|
gfx.DrawString($"Datum: {DateTime.Now:dd.MM.yyyy}", metadataFont, XBrushes.Black,
|
||||||
|
new XRect(28 + metadataWidth, 38, metadataWidth, 16), XStringFormats.TopLeft);
|
||||||
|
gfx.DrawString("Projekt: ____________________", metadataFont, XBrushes.Black,
|
||||||
|
new XRect(28 + 2 * metadataWidth, 38, metadataWidth, 16), XStringFormats.TopLeft);
|
||||||
|
|
||||||
|
double firstTableX = (page.Width.Point - allTablesWidth) / 2;
|
||||||
|
for (int tableIndex = 0; tableIndex < 2; tableIndex++)
|
||||||
|
{
|
||||||
|
int startIndex = tableIndex == 0 ? 0 : leftCount;
|
||||||
|
int itemCount = tableIndex == 0 ? leftCount : summaries.Count - leftCount;
|
||||||
|
if (itemCount == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
double tableX = firstTableX + tableIndex * (tableWidth + tableGap);
|
||||||
|
gfx.DrawRectangle(XBrushes.LightGray, tableX, tableTop, tableWidth, headerHeight);
|
||||||
|
gfx.DrawRectangle(XPens.Black, tableX, tableTop, tableWidth, headerHeight);
|
||||||
|
|
||||||
|
double columnX = tableX;
|
||||||
|
for (int columnIndex = 0; columnIndex < headers.Length; columnIndex++)
|
||||||
|
{
|
||||||
|
gfx.DrawString(headers[columnIndex], headerFont, XBrushes.Black,
|
||||||
|
new XRect(columnX + 2, tableTop, columnWidths[columnIndex] - 4, headerHeight),
|
||||||
|
XStringFormats.Center);
|
||||||
|
columnX += columnWidths[columnIndex];
|
||||||
|
if (columnIndex < headers.Length - 1)
|
||||||
|
gfx.DrawLine(XPens.Black, columnX, tableTop, columnX, tableTop + headerHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int rowIndex = 0; rowIndex < itemCount; rowIndex++)
|
||||||
|
{
|
||||||
|
var summary = summaries[startIndex + rowIndex];
|
||||||
|
string[] values =
|
||||||
|
{
|
||||||
|
summary.Prefix,
|
||||||
|
summary.AddressCount.ToString(),
|
||||||
|
summary.GroupCount.ToString(),
|
||||||
|
summary.StartPostalCode,
|
||||||
|
summary.EndPostalCode
|
||||||
|
};
|
||||||
|
double rowY = tableTop + headerHeight + rowIndex * rowHeight;
|
||||||
|
gfx.DrawRectangle(XPens.Black, tableX, rowY, tableWidth, rowHeight);
|
||||||
|
|
||||||
|
columnX = tableX;
|
||||||
|
for (int columnIndex = 0; columnIndex < values.Length; columnIndex++)
|
||||||
|
{
|
||||||
|
gfx.DrawString(values[columnIndex], columnIndex == 2 ? groupCountFont : textFont,
|
||||||
|
XBrushes.Black,
|
||||||
|
new XRect(columnX + 2, rowY, columnWidths[columnIndex] - 4, rowHeight),
|
||||||
|
XStringFormats.Center);
|
||||||
|
columnX += columnWidths[columnIndex];
|
||||||
|
if (columnIndex < values.Length - 1)
|
||||||
|
gfx.DrawLine(XPens.Black, columnX, rowY, columnX, rowY + rowHeight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawGermanyRunningSheet(XGraphics gfx, double x, double y, double w, double h, KasAddressList list, dynamic result, List<(int,string,string,string,int)> grouped_nums, XFont fontLabel, XFont fontText, XFont fontBig, int? pal_nr, int? bundleOnPallet, int totalBundleNumber)
|
||||||
{
|
{
|
||||||
double line = 1.0;
|
double line = 1.0;
|
||||||
|
|
||||||
@@ -914,20 +1089,20 @@ public class PdfBuilder
|
|||||||
new XRect(valueX, blY1 + 4, valueW, 14),
|
new XRect(valueX, blY1 + 4, valueW, 14),
|
||||||
XStringFormats.TopRight);
|
XStringFormats.TopRight);
|
||||||
|
|
||||||
if (options.rsBundNrPal == null) goto nopal;
|
if (options.rsBundNrPal > 0)
|
||||||
gfx.DrawString(pal_nr.ToString(), fontText, XBrushes.Black,
|
{
|
||||||
new XRect(valueX, blY3 + 4, valueW, 14),
|
gfx.DrawString(pal_nr?.ToString() ?? string.Empty, fontText, XBrushes.Black,
|
||||||
XStringFormats.TopRight);
|
new XRect(valueX, blY3 + 4, valueW, 14),
|
||||||
|
XStringFormats.TopRight);
|
||||||
|
|
||||||
|
gfx.DrawString(
|
||||||
|
$"{bundleOnPallet}/{options.rsBundNrPal}",
|
||||||
|
fontText,
|
||||||
|
XBrushes.Black,
|
||||||
|
new XRect(valueX, blY4 + 4, valueW, 14),
|
||||||
|
XStringFormats.TopRight);
|
||||||
|
}
|
||||||
|
|
||||||
gfx.DrawString(
|
|
||||||
$"{bundleOnPallet}/{Settings._instance.pdfExport.rsBundNrPal}",
|
|
||||||
fontText,
|
|
||||||
XBrushes.Black,
|
|
||||||
new XRect(valueX, blY4 + 4, valueW, 14),
|
|
||||||
XStringFormats.TopRight);
|
|
||||||
|
|
||||||
nopal:
|
|
||||||
gfx.DrawString(
|
gfx.DrawString(
|
||||||
$"{totalBundleNumber}/{grouped_nums.Count}",
|
$"{totalBundleNumber}/{grouped_nums.Count}",
|
||||||
fontText,
|
fontText,
|
||||||
@@ -984,12 +1159,14 @@ public class PdfBuilder
|
|||||||
|
|
||||||
int firstIndex = pageIndex * 2;
|
int firstIndex = pageIndex * 2;
|
||||||
|
|
||||||
int palletNumber =
|
int? palletNumber = null;
|
||||||
Settings._instance.pdfExport.rsPalNr +
|
int? bundleOnPallet = null;
|
||||||
(firstIndex / Settings._instance.pdfExport.rsBundNrPal);
|
if (Settings._instance.pdfExport.rsBundNrPal > 0)
|
||||||
|
{
|
||||||
int bundleOnPallet =
|
palletNumber = Settings._instance.pdfExport.rsPalNr +
|
||||||
(firstIndex % Settings._instance.pdfExport.rsBundNrPal) + 1;
|
(firstIndex / Settings._instance.pdfExport.rsBundNrPal);
|
||||||
|
bundleOnPallet = (firstIndex % Settings._instance.pdfExport.rsBundNrPal) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1014,12 +1191,14 @@ public class PdfBuilder
|
|||||||
{
|
{
|
||||||
int secondIndex = firstIndex + 1;
|
int secondIndex = firstIndex + 1;
|
||||||
|
|
||||||
int palletNumber2 =
|
int? palletNumber2 = null;
|
||||||
Settings._instance.pdfExport.rsPalNr +
|
int? bundleOnPallet2 = null;
|
||||||
(secondIndex / Settings._instance.pdfExport.rsBundNrPal);
|
if (Settings._instance.pdfExport.rsBundNrPal > 0)
|
||||||
|
{
|
||||||
int bundleOnPallet2 =
|
palletNumber2 = Settings._instance.pdfExport.rsPalNr +
|
||||||
(secondIndex % Settings._instance.pdfExport.rsBundNrPal) + 1;
|
(secondIndex / Settings._instance.pdfExport.rsBundNrPal);
|
||||||
|
bundleOnPallet2 = (secondIndex % Settings._instance.pdfExport.rsBundNrPal) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
DrawInternationalRunningSheet(
|
DrawInternationalRunningSheet(
|
||||||
gfx,
|
gfx,
|
||||||
@@ -1042,7 +1221,7 @@ public class PdfBuilder
|
|||||||
|
|
||||||
document.Save(path);
|
document.Save(path);
|
||||||
}
|
}
|
||||||
private void DrawInternationalRunningSheet(XGraphics gfx, double x, double y, double w, double h, KasAddressList list, dynamic result, List<(int,string,string,string,int)> grouped_nums, XFont fontLabel, XFont fontText, XFont fontBig, int pal_nr, int bundleOnPallet, int totalBundleNumber, string category = "ECONOMY Non-EU")
|
private void DrawInternationalRunningSheet(XGraphics gfx, double x, double y, double w, double h, KasAddressList list, dynamic result, List<(int,string,string,string,int)> grouped_nums, XFont fontLabel, XFont fontText, XFont fontBig, int? pal_nr, int? bundleOnPallet, int totalBundleNumber, string category = "ECONOMY Non-EU")
|
||||||
{
|
{
|
||||||
double line = 1.0;
|
double line = 1.0;
|
||||||
|
|
||||||
@@ -1194,20 +1373,20 @@ public class PdfBuilder
|
|||||||
new XRect(valueX, blY2 + 4, valueW, 14),
|
new XRect(valueX, blY2 + 4, valueW, 14),
|
||||||
XStringFormats.TopRight);
|
XStringFormats.TopRight);
|
||||||
|
|
||||||
if (options.rsBundNrPal == 0) goto nopal;
|
if (options.rsBundNrPal > 0)
|
||||||
gfx.DrawString(pal_nr.ToString(), fontText, XBrushes.Black,
|
{
|
||||||
new XRect(valueX, blY3 + 4, valueW, 14),
|
gfx.DrawString(pal_nr?.ToString() ?? string.Empty, fontText, XBrushes.Black,
|
||||||
XStringFormats.TopRight);
|
new XRect(valueX, blY3 + 4, valueW, 14),
|
||||||
|
XStringFormats.TopRight);
|
||||||
|
|
||||||
|
gfx.DrawString(
|
||||||
|
$"{bundleOnPallet}/{options.rsBundNrPal}",
|
||||||
|
fontText,
|
||||||
|
XBrushes.Black,
|
||||||
|
new XRect(valueX, blY4 + 4, valueW, 14),
|
||||||
|
XStringFormats.TopRight);
|
||||||
|
}
|
||||||
|
|
||||||
gfx.DrawString(
|
|
||||||
$"{bundleOnPallet}/{Settings._instance.pdfExport.rsBundNrPal}",
|
|
||||||
fontText,
|
|
||||||
XBrushes.Black,
|
|
||||||
new XRect(valueX, blY4 + 4, valueW, 14),
|
|
||||||
XStringFormats.TopRight);
|
|
||||||
|
|
||||||
nopal:
|
|
||||||
gfx.DrawString(
|
gfx.DrawString(
|
||||||
$"{totalBundleNumber}/{grouped_nums.Count}",
|
$"{totalBundleNumber}/{grouped_nums.Count}",
|
||||||
fontText,
|
fontText,
|
||||||
@@ -1230,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)
|
||||||
@@ -1248,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;
|
||||||
@@ -1268,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");
|
||||||
@@ -1284,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