-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
129 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ TForm1 = class(TForm) | |
btX200ConvertHTML: TButton; | ||
Button1: TButton; | ||
cbAttachments: TCheckBox; | ||
cbDeliveriyInf: TCheckBox; | ||
procedure Button3Click(Sender: TObject); | ||
procedure FormCreate(Sender: TObject); | ||
procedure Button4Click(Sender: TObject); | ||
|
@@ -128,10 +129,10 @@ procedure TForm1.Button1Click(Sender: TObject); | |
inv.AccountingSupplierParty.Name := 'Verkaeufername'; | ||
inv.AccountingSupplierParty.RegistrationName := 'Verkaeufername'; //Sollte ausgefüllt werden | ||
inv.AccountingSupplierParty.CompanyID := ''; | ||
inv.AccountingSupplierParty.StreetName := 'Verkaeuferstraße 1'; | ||
inv.AccountingSupplierParty.City := 'Verkaeuferstadt'; | ||
inv.AccountingSupplierParty.PostalZone := '01234'; | ||
inv.AccountingSupplierParty.CountryCode := 'DE'; | ||
inv.AccountingSupplierParty.Address.StreetName := 'Verkaeuferstraße 1'; | ||
inv.AccountingSupplierParty.Address.City := 'Verkaeuferstadt'; | ||
inv.AccountingSupplierParty.Address.PostalZone := '01234'; | ||
inv.AccountingSupplierParty.Address.CountryCode := 'DE'; | ||
inv.AccountingSupplierParty.VATCompanyID := 'DE12345678'; //TODO mehrere Steuer-IDs | ||
inv.AccountingSupplierParty.ContactName := 'Meier'; | ||
inv.AccountingSupplierParty.ContactTelephone := '030 0815'; | ||
|
@@ -140,10 +141,10 @@ procedure TForm1.Button1Click(Sender: TObject); | |
inv.AccountingCustomerParty.Name := 'Kaeufername'; | ||
inv.AccountingCustomerParty.RegistrationName := 'Kaeufername'; //Sollte ausgefüllt werden | ||
inv.AccountingCustomerParty.CompanyID := 'HRB 456'; | ||
inv.AccountingCustomerParty.StreetName := 'Kaeuferstraße 1'; | ||
inv.AccountingCustomerParty.City := 'Kaeuferstadt'; | ||
inv.AccountingCustomerParty.PostalZone := '05678'; | ||
inv.AccountingCustomerParty.CountryCode := 'DE'; | ||
inv.AccountingCustomerParty.Address.StreetName := 'Kaeuferstraße 1'; | ||
inv.AccountingCustomerParty.Address.City := 'Kaeuferstadt'; | ||
inv.AccountingCustomerParty.Address.PostalZone := '05678'; | ||
inv.AccountingCustomerParty.Address.CountryCode := 'DE'; | ||
inv.AccountingCustomerParty.VATCompanyID := 'DE12345678'; //TODO mehrere Steuer-IDs | ||
inv.AccountingCustomerParty.ContactName := 'Müller'; | ||
inv.AccountingCustomerParty.ContactTelephone := '030 1508'; | ||
|
@@ -215,9 +216,9 @@ procedure TForm1.Button3Click(Sender: TObject); | |
inv := TInvoice.Create; | ||
inv.InvoiceNumber := 'R2020-0815'; | ||
inv.InvoiceIssueDate := Date; | ||
inv.InvoiceDueDate := Date+30; | ||
inv.InvoicePeriodStartDate := Date-30; | ||
inv.InvoicePeriodEndDate := Date-1; | ||
inv.InvoiceDueDate := Date+30; //Rechnungsdatum | ||
inv.InvoicePeriodStartDate := Date-30; //Leistungs-/Lieferzeitpunkt Beginn | ||
inv.InvoicePeriodEndDate := Date-1; //Leistungs-/Lieferzeitpunkt Ende | ||
inv.InvoiceTypeCode := TInvoiceTypeCode.itc_CommercialInvoice; //Schlussrechnung | ||
inv.InvoiceCurrencyCode := 'EUR'; | ||
inv.TaxCurrencyCode := 'EUR'; | ||
|
@@ -228,10 +229,13 @@ procedure TForm1.Button3Click(Sender: TObject); | |
inv.AccountingSupplierParty.Name := 'Verkaeufername'; | ||
inv.AccountingSupplierParty.RegistrationName := 'Verkaeufername'; //Sollte ausgefuellt werden | ||
inv.AccountingSupplierParty.CompanyID := ''; | ||
inv.AccountingSupplierParty.StreetName := 'Verkaeuferstraße 1'; | ||
inv.AccountingSupplierParty.City := 'Verkaeuferstadt'; | ||
inv.AccountingSupplierParty.PostalZone := '01234'; | ||
inv.AccountingSupplierParty.CountryCode := 'DE'; | ||
inv.AccountingSupplierParty.Address.StreetName := 'Verkaeuferstraße 1'; | ||
inv.AccountingSupplierParty.Address.AdditionalStreetName := 'Hinterhaus'; //optional | ||
inv.AccountingSupplierParty.Address.City := 'Verkaeuferstadt'; | ||
inv.AccountingSupplierParty.Address.PostalZone := '01234'; | ||
inv.AccountingSupplierParty.Address.CountrySubentity := 'Sachsen'; //optional | ||
inv.AccountingSupplierParty.Address.AddressLine := 'Gate 64'; //optional | ||
inv.AccountingSupplierParty.Address.CountryCode := 'DE'; | ||
inv.AccountingSupplierParty.VATCompanyID := 'DE12345678'; //TODO mehrere Steuer-IDs | ||
inv.AccountingSupplierParty.ContactName := 'Meier'; | ||
inv.AccountingSupplierParty.ContactTelephone := '030 0815'; | ||
|
@@ -240,15 +244,30 @@ procedure TForm1.Button3Click(Sender: TObject); | |
inv.AccountingCustomerParty.Name := 'Kaeufername'; | ||
inv.AccountingCustomerParty.RegistrationName := 'Kaeufername'; //Sollte ausgefüllt werden | ||
inv.AccountingCustomerParty.CompanyID := 'HRB 456'; | ||
inv.AccountingCustomerParty.StreetName := 'Kaeuferstraße 1'; | ||
inv.AccountingCustomerParty.City := 'Kaeuferstadt'; | ||
inv.AccountingCustomerParty.PostalZone := '05678'; | ||
inv.AccountingCustomerParty.CountryCode := 'DE'; | ||
inv.AccountingCustomerParty.Address.StreetName := 'Kaeuferstraße 1'; | ||
inv.AccountingCustomerParty.Address.City := 'Kaeuferstadt'; | ||
inv.AccountingCustomerParty.Address.PostalZone := '05678'; | ||
inv.AccountingCustomerParty.Address.CountryCode := 'DE'; | ||
inv.AccountingCustomerParty.VATCompanyID := 'DE12345678'; //TODO mehrere Steuer-IDs | ||
inv.AccountingCustomerParty.ContactName := 'Müller'; | ||
inv.AccountingCustomerParty.ContactTelephone := '030 1508'; | ||
inv.AccountingCustomerParty.ContactElectronicMail := '[email protected]'; | ||
|
||
//Eine Gruppe von Informationselementen, die Informationen über die Anschrift liefern, an die | ||
//die Waren geliefert oder an der die Dienstleistungen erbracht werden. Die Gruppe ist nur zu | ||
//verwenden, wenn die Lieferanschrift von der Erwerberanschrift abweicht. Wenn die Waren | ||
//abgeholt werden, ist die Abholadresse die Lieferadresse. Eine vollständige gültige Anschrift | ||
//ist anzugeben. | ||
if cbDeliveriyInf.Checked then | ||
begin | ||
inv.DeliveryInformation.Name := 'Firma die es bekommt'; | ||
inv.DeliveryInformation.Address.StreetName := 'Lieferstraße 1'; | ||
inv.DeliveryInformation.Address.City := 'Lieferstadt'; | ||
inv.DeliveryInformation.Address.PostalZone := '05678'; | ||
inv.DeliveryInformation.Address.CountryCode := 'DE'; | ||
inv.DeliveryInformation.ActualDeliveryDate := Date-1; | ||
end; | ||
|
||
inv.PaymentMeansCode := ipmc_SEPACreditTransfer; //Ueberweisung | ||
inv.PaymentID := 'Verwendungszweck der Ueberweisung...R2020-0815'; | ||
inv.PayeeFinancialAccount := 'DE75512108001245126199'; //dies ist eine nicht existerende aber valide IBAN als test dummy | ||
|
@@ -539,10 +558,10 @@ procedure TForm1.Button4Click(Sender: TObject); | |
inv.AccountingSupplierParty.Name := 'Verkaeufername'; | ||
inv.AccountingSupplierParty.RegistrationName := 'Verkaeufername'; //Sollte ausgefüllt werden | ||
inv.AccountingSupplierParty.CompanyID := ''; | ||
inv.AccountingSupplierParty.StreetName := 'Verkaeuferstraße 1'; | ||
inv.AccountingSupplierParty.City := 'Verkaeuferstadt'; | ||
inv.AccountingSupplierParty.PostalZone := '01234'; | ||
inv.AccountingSupplierParty.CountryCode := 'DE'; | ||
inv.AccountingSupplierParty.Address.StreetName := 'Verkaeuferstraße 1'; | ||
inv.AccountingSupplierParty.Address.City := 'Verkaeuferstadt'; | ||
inv.AccountingSupplierParty.Address.PostalZone := '01234'; | ||
inv.AccountingSupplierParty.Address.CountryCode := 'DE'; | ||
inv.AccountingSupplierParty.VATCompanyID := 'DE12345678'; //TODO mehrere Steuer-IDs | ||
inv.AccountingSupplierParty.ContactName := 'Meier'; | ||
inv.AccountingSupplierParty.ContactTelephone := '030 0815'; | ||
|
@@ -551,10 +570,10 @@ procedure TForm1.Button4Click(Sender: TObject); | |
inv.AccountingCustomerParty.Name := 'Kaeufername'; | ||
inv.AccountingCustomerParty.RegistrationName := 'Kaeufername'; //Sollte ausgefüllt werden | ||
inv.AccountingCustomerParty.CompanyID := 'HRB 456'; | ||
inv.AccountingCustomerParty.StreetName := 'Kaeuferstraße 1'; | ||
inv.AccountingCustomerParty.City := 'Kaeuferstadt'; | ||
inv.AccountingCustomerParty.PostalZone := '05678'; | ||
inv.AccountingCustomerParty.CountryCode := 'DE'; | ||
inv.AccountingCustomerParty.Address.StreetName := 'Kaeuferstraße 1'; | ||
inv.AccountingCustomerParty.Address.City := 'Kaeuferstadt'; | ||
inv.AccountingCustomerParty.Address.PostalZone := '05678'; | ||
inv.AccountingCustomerParty.Address.CountryCode := 'DE'; | ||
inv.AccountingCustomerParty.VATCompanyID := 'DE12345678'; //TODO mehrere Steuer-IDs | ||
inv.AccountingCustomerParty.ContactName := 'Müller'; | ||
inv.AccountingCustomerParty.ContactTelephone := '030 1508'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
Copyright (C) 2020 Landrix Software GmbH & Co. KG | ||
Sven Harazim, [email protected] | ||
Version 1.1.0 | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
|
@@ -313,17 +314,24 @@ TInvoiceTaxAmount = record | |
TaxExemptionReason : String; //sollte gesetzt werden bei TaxCategory = AE,E,O,Z | ||
end; | ||
|
||
TInvoiceAccountingParty = record | ||
TInvoiceAddress = record | ||
public | ||
Name : String; | ||
RegistrationName : String; | ||
CompanyID : String; | ||
StreetName : String; | ||
//TODO <cbc:AdditionalStreetName>01129</cbc:AdditionalStreetName> | ||
AdditionalStreetName : String; | ||
City : String; | ||
PostalZone : String; | ||
//TODO <cbc:CountrySubentity>Sachsen</cbc:CountrySubentity> | ||
CountrySubentity : String; | ||
AddressLine : String; | ||
CountryCode : String; | ||
end; | ||
|
||
TInvoiceAccountingParty = record | ||
public | ||
Name : String; | ||
RegistrationName : String; | ||
CompanyID : String; | ||
|
||
Address : TInvoiceAddress; | ||
|
||
IdentifierSellerBuyer : String; //Kreditor-Nr AccountingSupplierParty / Debitor-Nr AccountingCustomerParty | ||
|
||
|
@@ -334,6 +342,14 @@ TInvoiceAccountingParty = record | |
ContactElectronicMail : String; | ||
end; | ||
|
||
TInvoiceDeliveryInformation = record | ||
public | ||
Name : String; | ||
LocationIdentifier : String; //optional Ein Bezeichner für den Ort, an den die Waren geliefert oder an dem die Dienstleistungen erbracht werden. | ||
Address : TInvoiceAddress; | ||
ActualDeliveryDate : TDate; //Lieferdatum | ||
end; | ||
|
||
TInvoicePrecedingInvoiceReference = class(TObject) | ||
public | ||
ID : String; | ||
|
@@ -362,6 +378,7 @@ TInvoice = class(TObject) | |
|
||
AccountingSupplierParty : TInvoiceAccountingParty; | ||
AccountingCustomerParty : TInvoiceAccountingParty; | ||
DeliveryInformation : TInvoiceDeliveryInformation; | ||
|
||
//TODO weitere Zahlungswege | ||
PaymentMeansCode : TInvoicePaymentMeansCode; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
Copyright (C) 2020 Landrix Software GmbH & Co. KG | ||
Sven Harazim, [email protected] | ||
Version 1.1.0 | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
|
@@ -364,10 +365,16 @@ class procedure TXRechnungInvoiceAdapter.SaveDocumentUBL(_Invoice: TInvoice; | |
end; | ||
with AddChild('cac:PostalAddress') do | ||
begin | ||
AddChild('cbc:StreetName').Text := _Invoice.AccountingSupplierParty.StreetName; | ||
AddChild('cbc:CityName').Text := _Invoice.AccountingSupplierParty.City; | ||
AddChild('cbc:PostalZone').Text := _Invoice.AccountingSupplierParty.PostalZone; | ||
AddChild('cac:Country').AddChild('cbc:IdentificationCode').Text := _Invoice.AccountingSupplierParty.CountryCode; | ||
AddChild('cbc:StreetName').Text := _Invoice.AccountingSupplierParty.Address.StreetName; | ||
if not _Invoice.AccountingSupplierParty.Address.AdditionalStreetName.IsEmpty then | ||
AddChild('cbc:AdditionalStreetName').Text := _Invoice.AccountingSupplierParty.Address.AdditionalStreetName; | ||
AddChild('cbc:CityName').Text := _Invoice.AccountingSupplierParty.Address.City; | ||
AddChild('cbc:PostalZone').Text := _Invoice.AccountingSupplierParty.Address.PostalZone; | ||
if not _Invoice.AccountingSupplierParty.Address.CountrySubentity.IsEmpty then | ||
AddChild('cbc:CountrySubentity').Text := _Invoice.AccountingSupplierParty.Address.CountrySubentity; | ||
if not _Invoice.AccountingSupplierParty.Address.AddressLine.IsEmpty then | ||
AddChild('cac:AddressLine').AddChild('cbc:Line').Text := _Invoice.AccountingSupplierParty.Address.AddressLine; | ||
AddChild('cac:Country').AddChild('cbc:IdentificationCode').Text := _Invoice.AccountingSupplierParty.Address.CountryCode; | ||
end; | ||
if not _Invoice.AccountingSupplierParty.VATCompanyID.IsEmpty then | ||
with AddChild('cac:PartyTaxScheme') do | ||
|
@@ -401,10 +408,16 @@ class procedure TXRechnungInvoiceAdapter.SaveDocumentUBL(_Invoice: TInvoice; | |
end; | ||
with AddChild('cac:PostalAddress') do | ||
begin | ||
AddChild('cbc:StreetName').Text := _Invoice.AccountingCustomerParty.StreetName; | ||
AddChild('cbc:CityName').Text := _Invoice.AccountingCustomerParty.City; | ||
AddChild('cbc:PostalZone').Text := _Invoice.AccountingCustomerParty.PostalZone; | ||
AddChild('cac:Country').AddChild('cbc:IdentificationCode').Text := _Invoice.AccountingCustomerParty.CountryCode; | ||
AddChild('cbc:StreetName').Text := _Invoice.AccountingCustomerParty.Address.StreetName; | ||
if not _Invoice.AccountingCustomerParty.Address.AdditionalStreetName.IsEmpty then | ||
AddChild('cbc:AdditionalStreetName').Text := _Invoice.AccountingCustomerParty.Address.AdditionalStreetName; | ||
AddChild('cbc:CityName').Text := _Invoice.AccountingCustomerParty.Address.City; | ||
AddChild('cbc:PostalZone').Text := _Invoice.AccountingCustomerParty.Address.PostalZone; | ||
if not _Invoice.AccountingCustomerParty.Address.CountrySubentity.IsEmpty then | ||
AddChild('cbc:CountrySubentity').Text := _Invoice.AccountingCustomerParty.Address.CountrySubentity; | ||
if not _Invoice.AccountingCustomerParty.Address.AddressLine.IsEmpty then | ||
AddChild('cac:AddressLine').AddChild('cbc:Line').Text := _Invoice.AccountingCustomerParty.Address.AddressLine; | ||
AddChild('cac:Country').AddChild('cbc:IdentificationCode').Text := _Invoice.AccountingCustomerParty.Address.CountryCode; | ||
end; | ||
if not _Invoice.AccountingCustomerParty.VATCompanyID.IsEmpty then | ||
with AddChild('cac:PartyTaxScheme') do | ||
|
@@ -425,6 +438,35 @@ class procedure TXRechnungInvoiceAdapter.SaveDocumentUBL(_Invoice: TInvoice; | |
end; | ||
end; | ||
|
||
if (_Invoice.DeliveryInformation.ActualDeliveryDate > 0) or | ||
(not _Invoice.DeliveryInformation.Address.CountryCode.IsEmpty) or | ||
(not _Invoice.DeliveryInformation.Name.IsEmpty) then | ||
with xRoot.AddChild('cac:Delivery') do | ||
begin | ||
if (_Invoice.DeliveryInformation.ActualDeliveryDate > 0) then | ||
AddChild('cbc:ActualDeliveryDate').Text := TXRechnungHelper.DateToStr(_Invoice.DeliveryInformation.ActualDeliveryDate); | ||
with AddChild('cac:DeliveryLocation') do | ||
begin | ||
if (not _Invoice.DeliveryInformation.LocationIdentifier.IsEmpty) then | ||
AddChild('cbc:ID').Text := _Invoice.DeliveryInformation.LocationIdentifier; //TODO schemeID https://docs.peppol.eu/poacc/billing/3.0/syntax/ubl-invoice/cac-Delivery/cac-DeliveryLocation/cbc-ID/ | ||
with AddChild('cac:Address') do | ||
begin | ||
AddChild('cbc:StreetName').Text := _Invoice.DeliveryInformation.Address.StreetName; | ||
if not _Invoice.DeliveryInformation.Address.AdditionalStreetName.IsEmpty then | ||
AddChild('cbc:AdditionalStreetName').Text := _Invoice.DeliveryInformation.Address.AdditionalStreetName; | ||
AddChild('cbc:CityName').Text := _Invoice.DeliveryInformation.Address.City; | ||
AddChild('cbc:PostalZone').Text := _Invoice.DeliveryInformation.Address.PostalZone; | ||
if not _Invoice.DeliveryInformation.Address.CountrySubentity.IsEmpty then | ||
AddChild('cbc:CountrySubentity').Text := _Invoice.DeliveryInformation.Address.CountrySubentity; | ||
if not _Invoice.DeliveryInformation.Address.AddressLine.IsEmpty then | ||
AddChild('cac:AddressLine').AddChild('cbc:Line').Text := _Invoice.DeliveryInformation.Address.AddressLine; | ||
AddChild('cac:Country').AddChild('cbc:IdentificationCode').Text := _Invoice.DeliveryInformation.Address.CountryCode; | ||
end; | ||
end; | ||
if (not _Invoice.DeliveryInformation.Name.IsEmpty) then | ||
AddChild('cac:DeliveryParty').AddChild('cac:PartyName').AddChild('cbc:Name').Text := _Invoice.DeliveryInformation.Name; | ||
end; | ||
|
||
if (_Invoice.PaymentMeansCode <> ipmc_None) and (not _Invoice.PayeeFinancialAccount.IsEmpty) then | ||
with xRoot.AddChild('cac:PaymentMeans') do | ||
begin | ||
|