diff --git a/Elwig/Documents/Document.cs b/Elwig/Documents/Document.cs
index 755286e..26a0e29 100644
--- a/Elwig/Documents/Document.cs
+++ b/Elwig/Documents/Document.cs
@@ -44,8 +44,8 @@ namespace Elwig.Documents {
.Item(c.Address).Item($"{c.Plz} {c.Ort}").Item("Österreich").Item("Tel.", c.PhoneNr).Item("Fax", c.FaxNr).NextLine()
.Item(c.EmailAddress != null ? $"\">{c.EmailAddress}" : null)
.Item(c.Website != null ? $"{c.Website}" : null)
- .Item("Betriebs-Nr.", c.LfbisNr).Item("UID", c.UstIdNr).NextLine()
- .Item("BIC", c.Bic).Item("IBAN", c.Iban)
+ .Item("Betriebs-Nr.", c.LfbisNr).Item("Bio-KSt.", c.OrganicAuthority).NextLine()
+ .Item("UID", c.UstIdNr).Item("BIC", c.Bic).Item("IBAN", c.Iban)
.ToString();
Date = DateOnly.FromDateTime(Utils.Today);
}
diff --git a/Elwig/Helpers/ClientParameters.cs b/Elwig/Helpers/ClientParameters.cs
index f6d5d7b..57371c8 100644
--- a/Elwig/Helpers/ClientParameters.cs
+++ b/Elwig/Helpers/ClientParameters.cs
@@ -55,6 +55,7 @@ namespace Elwig.Helpers {
public string? Bic;
public string? UstIdNr;
public string? LfbisNr;
+ public string? OrganicAuthority;
public string? PhoneNr;
public string? FaxNr;
@@ -113,6 +114,7 @@ namespace Elwig.Helpers {
UstIdNr = parameters.GetValueOrDefault("CLIENT_USTIDNR");
Bic = parameters.GetValueOrDefault("CLIENT_BIC");
Iban = parameters.GetValueOrDefault("CLIENT_IBAN");
+ OrganicAuthority = parameters.GetValueOrDefault("CLIENT_ORGANIC_AUTHORITY");
switch (parameters.GetValueOrDefault("MODE_DELIVERYNOTE_STATS", "SHORT")?.ToUpper()) {
case "NONE": ModeDeliveryNoteStats = 0; break;
@@ -257,6 +259,7 @@ namespace Elwig.Helpers {
("CLIENT_USTIDNR", UstIdNr),
("CLIENT_BIC", Bic),
("CLIENT_IBAN", Iban),
+ ("CLIENT_ORGANIC_AUTHORITY", OrganicAuthority),
("MODE_DELIVERYNOTE_STATS", deliveryNoteStats),
("MODE_WINEQUALITYSTATISTICS", modeWineQualityStatistics),
("ORDERING_MEMBERLIST", orderingMemberList),
diff --git a/Elwig/Helpers/Validator.cs b/Elwig/Helpers/Validator.cs
index 53b50b3..b0b76e0 100644
--- a/Elwig/Helpers/Validator.cs
+++ b/Elwig/Helpers/Validator.cs
@@ -628,5 +628,55 @@ namespace Elwig.Helpers {
return new(true, null);
}
+
+ public static ValidationResult CheckOrganicAuthorityCode(TextBox input, bool required) {
+ string text = "";
+ int pos = input.CaretIndex;
+ for (int i = 0, v = 0; i < input.Text.Length; i++) {
+ char ch = char.ToUpper(input.Text[i]);
+ if (v < 2 && char.IsAsciiLetter(ch)) {
+ v++;
+ text += ch;
+ } else if ((v == 2 || v == 6) && ch == '-') {
+ v++;
+ text += ch;
+ } else if (v >= 2 && char.IsLetterOrDigit(ch)) {
+ if (text.StartsWith("AT")) {
+ if (v == 3 && ch == 'B' || v == 4 && ch == 'I' || v == 5 && ch == 'O') {
+ v++;
+ text += ch;
+ } else if (v > 6 && char.IsAsciiDigit(ch)) {
+ v++;
+ text += ch;
+ }
+ } else {
+ v++;
+ text += ch;
+ }
+ }
+
+ if (i == input.CaretIndex - 1) {
+ pos = text.Length;
+ } else if (text.StartsWith("AT") && v >= 10) {
+ break;
+ }
+ }
+
+ input.Text = text;
+ input.CaretIndex = pos;
+
+ if (text.Length == 0)
+ return required ? new(false, "Bio-Kontrollstellen-Code ist nicht optional") : new(true, null);
+
+ if (text.StartsWith("AT")) {
+ if (text.Length != 10) {
+ return new(false, "Bio-Kontrollstellen-Code ist ungültig");
+ }
+ } else {
+ return new(false, "Not implemented yet");
+ }
+
+ return new(true, null);
+ }
}
}
diff --git a/Elwig/Windows/AdministrationWindow.cs b/Elwig/Windows/AdministrationWindow.cs
index e17ba3b..0c4b1a3 100644
--- a/Elwig/Windows/AdministrationWindow.cs
+++ b/Elwig/Windows/AdministrationWindow.cs
@@ -570,6 +570,14 @@ namespace Elwig.Windows {
InputLostFocus((TextBox)sender, Validator.CheckLfbisNr);
}
+ protected void OrganicAuthorityCodeInput_TextChanged(object sender, TextChangedEventArgs? evt) {
+ InputTextChanged((TextBox)sender, Validator.CheckOrganicAuthorityCode);
+ }
+
+ protected void OrganicAuthorityCodeInput_LostFocus(object sender, RoutedEventArgs? evt) {
+ InputLostFocus((TextBox)sender, Validator.CheckOrganicAuthorityCode);
+ }
+
protected void UpperCaseInput_TextChanged(object sender, TextChangedEventArgs? evt) {
InputTextChanged((TextBox)sender, Validator.CheckUpperCase);
}
diff --git a/Elwig/Windows/BaseDataWindow.xaml b/Elwig/Windows/BaseDataWindow.xaml
index 9dc045d..28623c7 100644
--- a/Elwig/Windows/BaseDataWindow.xaml
+++ b/Elwig/Windows/BaseDataWindow.xaml
@@ -122,6 +122,12 @@
VerticalAlignment="Top" HorizontalAlignment="Left" Grid.Column="3" Margin="0,130,10,10" Width="64"
TextChanged="LfbisNrInput_TextChanged" LostFocus="LfbisNrInput_LostFocus"/>
+
+
+
0 ? ClientNameSuffixInput.Text : null;
+ p.NameSuffix = string.IsNullOrEmpty(ClientNameSuffixInput.Text) ? null : ClientNameSuffixInput.Text;
p.NameType = ClientNameTypeInput.Text;
p.NameToken = ClientNameTokenInput.Text;
p.NameShort = ClientNameShortInput.Text;
p.Address = ClientAddressInput.Text;
p.Plz = int.Parse(ClientPlzInput.Text);
p.Ort = ClientOrtInput.Text;
- p.Iban = ClientIbanInput.Text.Length > 0 ? ClientIbanInput.Text : null;
- p.Bic = ClientBicInput.Text.Length > 0 ? ClientBicInput.Text : null;
- p.UstIdNr = ClientUstIdNrInput.Text.Length > 0 ? ClientUstIdNrInput.Text : null;
- p.LfbisNr = ClientLfbisNrInput.Text.Length > 0 ? ClientLfbisNrInput.Text : null;
- p.PhoneNr = ClientPhoneNrInput.Text.Length > 0 ? ClientPhoneNrInput.Text : null;
- p.FaxNr = ClientFaxNrInput.Text.Length > 0 ? ClientFaxNrInput.Text : null;
- p.EmailAddress = ClientEmailAddressInput.Text.Length > 0 ? ClientEmailAddressInput.Text : null;
- p.Website = ClientWebsiteInput.Text.Length > 0 ? ClientWebsiteInput.Text : null;
+ p.Iban = string.IsNullOrEmpty(ClientIbanInput.Text) ? null : ClientIbanInput.Text;
+ p.Bic = string.IsNullOrEmpty(ClientBicInput.Text) ? null : ClientBicInput.Text;
+ p.UstIdNr = string.IsNullOrEmpty(ClientUstIdNrInput.Text) ? null : ClientUstIdNrInput.Text;
+ p.LfbisNr = string.IsNullOrEmpty(ClientLfbisNrInput.Text) ? null : ClientLfbisNrInput.Text;
+ p.OrganicAuthority = string.IsNullOrEmpty(ClientOrganicAuthorityInput.Text) ? null : ClientOrganicAuthorityInput.Text;
+ p.PhoneNr = string.IsNullOrEmpty(ClientPhoneNrInput.Text) ? null : ClientPhoneNrInput.Text;
+ p.FaxNr = string.IsNullOrEmpty(ClientFaxNrInput.Text) ? null : ClientFaxNrInput.Text;
+ p.EmailAddress = string.IsNullOrEmpty(ClientEmailAddressInput.Text) ? null : ClientEmailAddressInput.Text;
+ p.Website = string.IsNullOrEmpty(ClientWebsiteInput.Text) ? null : ClientWebsiteInput.Text;
- p.TextDeliveryNote = TextElementDeliveryNote.Text.Length > 0 ? TextElementDeliveryNote.Text : null;
+ p.TextDeliveryNote = string.IsNullOrEmpty(TextElementDeliveryNote.Text) ? null : TextElementDeliveryNote.Text;
p.ModeDeliveryNoteStats = (ModeDeliveryNoteNone.IsChecked == true) ? 0 : (ModeDeliveryNoteGaOnly.IsChecked == true) ? 1 : (ModeDeliveryNoteShort.IsChecked == true) ? 2 : (ModeDeliveryNoteFull.IsChecked == true) ? 3 : 2;
- p.TextDeliveryConfirmation = TextElementDeliveryConfirmation.Text.Length > 0 ? TextElementDeliveryConfirmation.Text : null;
- p.TextCreditNote = TextElementCreditNote.Text.Length > 0 ? TextElementCreditNote.Text : null;
+ p.TextDeliveryConfirmation = string.IsNullOrEmpty(TextElementDeliveryConfirmation.Text) ? null : TextElementDeliveryConfirmation.Text;
+ p.TextCreditNote = string.IsNullOrEmpty(TextElementCreditNote.Text) ? null : TextElementCreditNote.Text;
p.ExportEbicsVersion = ParameterExportEbicsVersion.SelectedIndex + 3;
p.ExportEbicsAddress = ParameterExportEbicsAddress.SelectedIndex;