Documents: Add Bio-KSt. to footer
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Test / Run tests (push) Successful in 2m24s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Test / Run tests (push) Successful in 2m24s
				
			This commit is contained in:
		| @@ -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 ? $"<a href=\"mailto:{c.Name} {c.NameSuffix} <{c.EmailAddress}>\">{c.EmailAddress}</a>" : null) | ||||
|                     .Item(c.Website != null ? $"<a href=\"http://{c.Website}/\">{c.Website}</a>" : 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); | ||||
|         } | ||||
|   | ||||
| @@ -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), | ||||
|   | ||||
| @@ -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); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -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); | ||||
|         } | ||||
|   | ||||
| @@ -122,6 +122,12 @@ | ||||
|                              VerticalAlignment="Top" HorizontalAlignment="Left" Grid.Column="3" Margin="0,130,10,10" Width="64" | ||||
|                              TextChanged="LfbisNrInput_TextChanged" LostFocus="LfbisNrInput_LostFocus"/> | ||||
|  | ||||
|                     <Label Content="Bio-Kontrollstelle:" | ||||
|                            VerticalAlignment="Top" HorizontalAlignment="Right" Grid.Column="3" Margin="10,130,110,10"/> | ||||
|                     <TextBox x:Name="ClientOrganicAuthorityInput" | ||||
|                              VerticalAlignment="Top" HorizontalAlignment="Right" Grid.Column="3" Margin="10,130,10,10" Width="90" | ||||
|                              TextChanged="OrganicAuthorityCodeInput_TextChanged" LostFocus="OrganicAuthorityCodeInput_LostFocus"/> | ||||
|  | ||||
|                     <Label Content="Telefon-Nr.:" | ||||
|                            VerticalAlignment="Top" HorizontalAlignment="Left" Grid.Column="2" Margin="10,160,0,10"/> | ||||
|                     <TextBox x:Name="ClientPhoneNrInput" Margin="0,160,10,10" Grid.Column="3" | ||||
|   | ||||
| @@ -366,6 +366,7 @@ namespace Elwig.Windows { | ||||
|             ClientBicInput.Text = p.Bic; | ||||
|             ClientUstIdNrInput.Text = p.UstIdNr; | ||||
|             ClientLfbisNrInput.Text = p.LfbisNr; | ||||
|             ClientOrganicAuthorityInput.Text = p.OrganicAuthority; | ||||
|             ClientPhoneNrInput.Text = p.PhoneNr; | ||||
|             ClientFaxNrInput.Text = p.FaxNr; | ||||
|             ClientEmailAddressInput.Text = p.EmailAddress; | ||||
| @@ -392,26 +393,27 @@ namespace Elwig.Windows { | ||||
|  | ||||
|         private async Task UpdateClientParameters(ClientParameters p) { | ||||
|             p.Name = ClientNameInput.Text; | ||||
|             p.NameSuffix = ClientNameSuffixInput.Text.Length > 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; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user