Skip to content

Commit e26b867

Browse files
committed
DeliveryInformation added
1 parent dd562a4 commit e26b867

File tree

4 files changed

+129
-43
lines changed

4 files changed

+129
-43
lines changed

Samples/XRechnungUnit1.dfm

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ object Form1: TForm1
4949
end
5050
object Button3: TButton
5151
Left = 8
52-
Top = 185
52+
Top = 208
5353
Width = 129
5454
Height = 25
5555
Caption = 'Erzeugen'
@@ -174,6 +174,14 @@ object Form1: TForm1
174174
Width = 97
175175
Height = 17
176176
Caption = 'Mit Anhaengen'
177-
TabOrder = 19
177+
TabOrder = 13
178+
end
179+
object cbDeliveriyInf: TCheckBox
180+
Left = 8
181+
Top = 185
182+
Width = 97
183+
Height = 17
184+
Caption = 'Lieferanschrift'
185+
TabOrder = 14
178186
end
179187
end

Samples/XRechnungUnit1.pas

Lines changed: 46 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ TForm1 = class(TForm)
2929
btX200ConvertHTML: TButton;
3030
Button1: TButton;
3131
cbAttachments: TCheckBox;
32+
cbDeliveriyInf: TCheckBox;
3233
procedure Button3Click(Sender: TObject);
3334
procedure FormCreate(Sender: TObject);
3435
procedure Button4Click(Sender: TObject);
@@ -128,10 +129,10 @@ procedure TForm1.Button1Click(Sender: TObject);
128129
inv.AccountingSupplierParty.Name := 'Verkaeufername';
129130
inv.AccountingSupplierParty.RegistrationName := 'Verkaeufername'; //Sollte ausgefüllt werden
130131
inv.AccountingSupplierParty.CompanyID := '';
131-
inv.AccountingSupplierParty.StreetName := 'Verkaeuferstraße 1';
132-
inv.AccountingSupplierParty.City := 'Verkaeuferstadt';
133-
inv.AccountingSupplierParty.PostalZone := '01234';
134-
inv.AccountingSupplierParty.CountryCode := 'DE';
132+
inv.AccountingSupplierParty.Address.StreetName := 'Verkaeuferstraße 1';
133+
inv.AccountingSupplierParty.Address.City := 'Verkaeuferstadt';
134+
inv.AccountingSupplierParty.Address.PostalZone := '01234';
135+
inv.AccountingSupplierParty.Address.CountryCode := 'DE';
135136
inv.AccountingSupplierParty.VATCompanyID := 'DE12345678'; //TODO mehrere Steuer-IDs
136137
inv.AccountingSupplierParty.ContactName := 'Meier';
137138
inv.AccountingSupplierParty.ContactTelephone := '030 0815';
@@ -140,10 +141,10 @@ procedure TForm1.Button1Click(Sender: TObject);
140141
inv.AccountingCustomerParty.Name := 'Kaeufername';
141142
inv.AccountingCustomerParty.RegistrationName := 'Kaeufername'; //Sollte ausgefüllt werden
142143
inv.AccountingCustomerParty.CompanyID := 'HRB 456';
143-
inv.AccountingCustomerParty.StreetName := 'Kaeuferstraße 1';
144-
inv.AccountingCustomerParty.City := 'Kaeuferstadt';
145-
inv.AccountingCustomerParty.PostalZone := '05678';
146-
inv.AccountingCustomerParty.CountryCode := 'DE';
144+
inv.AccountingCustomerParty.Address.StreetName := 'Kaeuferstraße 1';
145+
inv.AccountingCustomerParty.Address.City := 'Kaeuferstadt';
146+
inv.AccountingCustomerParty.Address.PostalZone := '05678';
147+
inv.AccountingCustomerParty.Address.CountryCode := 'DE';
147148
inv.AccountingCustomerParty.VATCompanyID := 'DE12345678'; //TODO mehrere Steuer-IDs
148149
inv.AccountingCustomerParty.ContactName := 'Müller';
149150
inv.AccountingCustomerParty.ContactTelephone := '030 1508';
@@ -215,9 +216,9 @@ procedure TForm1.Button3Click(Sender: TObject);
215216
inv := TInvoice.Create;
216217
inv.InvoiceNumber := 'R2020-0815';
217218
inv.InvoiceIssueDate := Date;
218-
inv.InvoiceDueDate := Date+30;
219-
inv.InvoicePeriodStartDate := Date-30;
220-
inv.InvoicePeriodEndDate := Date-1;
219+
inv.InvoiceDueDate := Date+30; //Rechnungsdatum
220+
inv.InvoicePeriodStartDate := Date-30; //Leistungs-/Lieferzeitpunkt Beginn
221+
inv.InvoicePeriodEndDate := Date-1; //Leistungs-/Lieferzeitpunkt Ende
221222
inv.InvoiceTypeCode := TInvoiceTypeCode.itc_CommercialInvoice; //Schlussrechnung
222223
inv.InvoiceCurrencyCode := 'EUR';
223224
inv.TaxCurrencyCode := 'EUR';
@@ -228,10 +229,13 @@ procedure TForm1.Button3Click(Sender: TObject);
228229
inv.AccountingSupplierParty.Name := 'Verkaeufername';
229230
inv.AccountingSupplierParty.RegistrationName := 'Verkaeufername'; //Sollte ausgefuellt werden
230231
inv.AccountingSupplierParty.CompanyID := '';
231-
inv.AccountingSupplierParty.StreetName := 'Verkaeuferstraße 1';
232-
inv.AccountingSupplierParty.City := 'Verkaeuferstadt';
233-
inv.AccountingSupplierParty.PostalZone := '01234';
234-
inv.AccountingSupplierParty.CountryCode := 'DE';
232+
inv.AccountingSupplierParty.Address.StreetName := 'Verkaeuferstraße 1';
233+
inv.AccountingSupplierParty.Address.AdditionalStreetName := 'Hinterhaus'; //optional
234+
inv.AccountingSupplierParty.Address.City := 'Verkaeuferstadt';
235+
inv.AccountingSupplierParty.Address.PostalZone := '01234';
236+
inv.AccountingSupplierParty.Address.CountrySubentity := 'Sachsen'; //optional
237+
inv.AccountingSupplierParty.Address.AddressLine := 'Gate 64'; //optional
238+
inv.AccountingSupplierParty.Address.CountryCode := 'DE';
235239
inv.AccountingSupplierParty.VATCompanyID := 'DE12345678'; //TODO mehrere Steuer-IDs
236240
inv.AccountingSupplierParty.ContactName := 'Meier';
237241
inv.AccountingSupplierParty.ContactTelephone := '030 0815';
@@ -240,15 +244,30 @@ procedure TForm1.Button3Click(Sender: TObject);
240244
inv.AccountingCustomerParty.Name := 'Kaeufername';
241245
inv.AccountingCustomerParty.RegistrationName := 'Kaeufername'; //Sollte ausgefüllt werden
242246
inv.AccountingCustomerParty.CompanyID := 'HRB 456';
243-
inv.AccountingCustomerParty.StreetName := 'Kaeuferstraße 1';
244-
inv.AccountingCustomerParty.City := 'Kaeuferstadt';
245-
inv.AccountingCustomerParty.PostalZone := '05678';
246-
inv.AccountingCustomerParty.CountryCode := 'DE';
247+
inv.AccountingCustomerParty.Address.StreetName := 'Kaeuferstraße 1';
248+
inv.AccountingCustomerParty.Address.City := 'Kaeuferstadt';
249+
inv.AccountingCustomerParty.Address.PostalZone := '05678';
250+
inv.AccountingCustomerParty.Address.CountryCode := 'DE';
247251
inv.AccountingCustomerParty.VATCompanyID := 'DE12345678'; //TODO mehrere Steuer-IDs
248252
inv.AccountingCustomerParty.ContactName := 'Müller';
249253
inv.AccountingCustomerParty.ContactTelephone := '030 1508';
250254
inv.AccountingCustomerParty.ContactElectronicMail := '[email protected]';
251255

256+
//Eine Gruppe von Informationselementen, die Informationen über die Anschrift liefern, an die
257+
//die Waren geliefert oder an der die Dienstleistungen erbracht werden. Die Gruppe ist nur zu
258+
//verwenden, wenn die Lieferanschrift von der Erwerberanschrift abweicht. Wenn die Waren
259+
//abgeholt werden, ist die Abholadresse die Lieferadresse. Eine vollständige gültige Anschrift
260+
//ist anzugeben.
261+
if cbDeliveriyInf.Checked then
262+
begin
263+
inv.DeliveryInformation.Name := 'Firma die es bekommt';
264+
inv.DeliveryInformation.Address.StreetName := 'Lieferstraße 1';
265+
inv.DeliveryInformation.Address.City := 'Lieferstadt';
266+
inv.DeliveryInformation.Address.PostalZone := '05678';
267+
inv.DeliveryInformation.Address.CountryCode := 'DE';
268+
inv.DeliveryInformation.ActualDeliveryDate := Date-1;
269+
end;
270+
252271
inv.PaymentMeansCode := ipmc_SEPACreditTransfer; //Ueberweisung
253272
inv.PaymentID := 'Verwendungszweck der Ueberweisung...R2020-0815';
254273
inv.PayeeFinancialAccount := 'DE75512108001245126199'; //dies ist eine nicht existerende aber valide IBAN als test dummy
@@ -539,10 +558,10 @@ procedure TForm1.Button4Click(Sender: TObject);
539558
inv.AccountingSupplierParty.Name := 'Verkaeufername';
540559
inv.AccountingSupplierParty.RegistrationName := 'Verkaeufername'; //Sollte ausgefüllt werden
541560
inv.AccountingSupplierParty.CompanyID := '';
542-
inv.AccountingSupplierParty.StreetName := 'Verkaeuferstraße 1';
543-
inv.AccountingSupplierParty.City := 'Verkaeuferstadt';
544-
inv.AccountingSupplierParty.PostalZone := '01234';
545-
inv.AccountingSupplierParty.CountryCode := 'DE';
561+
inv.AccountingSupplierParty.Address.StreetName := 'Verkaeuferstraße 1';
562+
inv.AccountingSupplierParty.Address.City := 'Verkaeuferstadt';
563+
inv.AccountingSupplierParty.Address.PostalZone := '01234';
564+
inv.AccountingSupplierParty.Address.CountryCode := 'DE';
546565
inv.AccountingSupplierParty.VATCompanyID := 'DE12345678'; //TODO mehrere Steuer-IDs
547566
inv.AccountingSupplierParty.ContactName := 'Meier';
548567
inv.AccountingSupplierParty.ContactTelephone := '030 0815';
@@ -551,10 +570,10 @@ procedure TForm1.Button4Click(Sender: TObject);
551570
inv.AccountingCustomerParty.Name := 'Kaeufername';
552571
inv.AccountingCustomerParty.RegistrationName := 'Kaeufername'; //Sollte ausgefüllt werden
553572
inv.AccountingCustomerParty.CompanyID := 'HRB 456';
554-
inv.AccountingCustomerParty.StreetName := 'Kaeuferstraße 1';
555-
inv.AccountingCustomerParty.City := 'Kaeuferstadt';
556-
inv.AccountingCustomerParty.PostalZone := '05678';
557-
inv.AccountingCustomerParty.CountryCode := 'DE';
573+
inv.AccountingCustomerParty.Address.StreetName := 'Kaeuferstraße 1';
574+
inv.AccountingCustomerParty.Address.City := 'Kaeuferstadt';
575+
inv.AccountingCustomerParty.Address.PostalZone := '05678';
576+
inv.AccountingCustomerParty.Address.CountryCode := 'DE';
558577
inv.AccountingCustomerParty.VATCompanyID := 'DE12345678'; //TODO mehrere Steuer-IDs
559578
inv.AccountingCustomerParty.ContactName := 'Müller';
560579
inv.AccountingCustomerParty.ContactTelephone := '030 1508';

intf.Invoice.pas

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
44
Copyright (C) 2020 Landrix Software GmbH & Co. KG
55
Sven Harazim, [email protected]
6+
Version 1.1.0
67
78
This program is free software: you can redistribute it and/or modify
89
it under the terms of the GNU General Public License as published by
@@ -313,17 +314,24 @@ TInvoiceTaxAmount = record
313314
TaxExemptionReason : String; //sollte gesetzt werden bei TaxCategory = AE,E,O,Z
314315
end;
315316

316-
TInvoiceAccountingParty = record
317+
TInvoiceAddress = record
317318
public
318-
Name : String;
319-
RegistrationName : String;
320-
CompanyID : String;
321319
StreetName : String;
322-
//TODO <cbc:AdditionalStreetName>01129</cbc:AdditionalStreetName>
320+
AdditionalStreetName : String;
323321
City : String;
324322
PostalZone : String;
325-
//TODO <cbc:CountrySubentity>Sachsen</cbc:CountrySubentity>
323+
CountrySubentity : String;
324+
AddressLine : String;
326325
CountryCode : String;
326+
end;
327+
328+
TInvoiceAccountingParty = record
329+
public
330+
Name : String;
331+
RegistrationName : String;
332+
CompanyID : String;
333+
334+
Address : TInvoiceAddress;
327335

328336
IdentifierSellerBuyer : String; //Kreditor-Nr AccountingSupplierParty / Debitor-Nr AccountingCustomerParty
329337

@@ -334,6 +342,14 @@ TInvoiceAccountingParty = record
334342
ContactElectronicMail : String;
335343
end;
336344

345+
TInvoiceDeliveryInformation = record
346+
public
347+
Name : String;
348+
LocationIdentifier : String; //optional Ein Bezeichner für den Ort, an den die Waren geliefert oder an dem die Dienstleistungen erbracht werden.
349+
Address : TInvoiceAddress;
350+
ActualDeliveryDate : TDate; //Lieferdatum
351+
end;
352+
337353
TInvoicePrecedingInvoiceReference = class(TObject)
338354
public
339355
ID : String;
@@ -362,6 +378,7 @@ TInvoice = class(TObject)
362378

363379
AccountingSupplierParty : TInvoiceAccountingParty;
364380
AccountingCustomerParty : TInvoiceAccountingParty;
381+
DeliveryInformation : TInvoiceDeliveryInformation;
365382

366383
//TODO weitere Zahlungswege
367384
PaymentMeansCode : TInvoicePaymentMeansCode;

intf.XRechnung.pas

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
44
Copyright (C) 2020 Landrix Software GmbH & Co. KG
55
Sven Harazim, [email protected]
6+
Version 1.1.0
67
78
This program is free software: you can redistribute it and/or modify
89
it under the terms of the GNU General Public License as published by
@@ -364,10 +365,16 @@ class procedure TXRechnungInvoiceAdapter.SaveDocumentUBL(_Invoice: TInvoice;
364365
end;
365366
with AddChild('cac:PostalAddress') do
366367
begin
367-
AddChild('cbc:StreetName').Text := _Invoice.AccountingSupplierParty.StreetName;
368-
AddChild('cbc:CityName').Text := _Invoice.AccountingSupplierParty.City;
369-
AddChild('cbc:PostalZone').Text := _Invoice.AccountingSupplierParty.PostalZone;
370-
AddChild('cac:Country').AddChild('cbc:IdentificationCode').Text := _Invoice.AccountingSupplierParty.CountryCode;
368+
AddChild('cbc:StreetName').Text := _Invoice.AccountingSupplierParty.Address.StreetName;
369+
if not _Invoice.AccountingSupplierParty.Address.AdditionalStreetName.IsEmpty then
370+
AddChild('cbc:AdditionalStreetName').Text := _Invoice.AccountingSupplierParty.Address.AdditionalStreetName;
371+
AddChild('cbc:CityName').Text := _Invoice.AccountingSupplierParty.Address.City;
372+
AddChild('cbc:PostalZone').Text := _Invoice.AccountingSupplierParty.Address.PostalZone;
373+
if not _Invoice.AccountingSupplierParty.Address.CountrySubentity.IsEmpty then
374+
AddChild('cbc:CountrySubentity').Text := _Invoice.AccountingSupplierParty.Address.CountrySubentity;
375+
if not _Invoice.AccountingSupplierParty.Address.AddressLine.IsEmpty then
376+
AddChild('cac:AddressLine').AddChild('cbc:Line').Text := _Invoice.AccountingSupplierParty.Address.AddressLine;
377+
AddChild('cac:Country').AddChild('cbc:IdentificationCode').Text := _Invoice.AccountingSupplierParty.Address.CountryCode;
371378
end;
372379
if not _Invoice.AccountingSupplierParty.VATCompanyID.IsEmpty then
373380
with AddChild('cac:PartyTaxScheme') do
@@ -401,10 +408,16 @@ class procedure TXRechnungInvoiceAdapter.SaveDocumentUBL(_Invoice: TInvoice;
401408
end;
402409
with AddChild('cac:PostalAddress') do
403410
begin
404-
AddChild('cbc:StreetName').Text := _Invoice.AccountingCustomerParty.StreetName;
405-
AddChild('cbc:CityName').Text := _Invoice.AccountingCustomerParty.City;
406-
AddChild('cbc:PostalZone').Text := _Invoice.AccountingCustomerParty.PostalZone;
407-
AddChild('cac:Country').AddChild('cbc:IdentificationCode').Text := _Invoice.AccountingCustomerParty.CountryCode;
411+
AddChild('cbc:StreetName').Text := _Invoice.AccountingCustomerParty.Address.StreetName;
412+
if not _Invoice.AccountingCustomerParty.Address.AdditionalStreetName.IsEmpty then
413+
AddChild('cbc:AdditionalStreetName').Text := _Invoice.AccountingCustomerParty.Address.AdditionalStreetName;
414+
AddChild('cbc:CityName').Text := _Invoice.AccountingCustomerParty.Address.City;
415+
AddChild('cbc:PostalZone').Text := _Invoice.AccountingCustomerParty.Address.PostalZone;
416+
if not _Invoice.AccountingCustomerParty.Address.CountrySubentity.IsEmpty then
417+
AddChild('cbc:CountrySubentity').Text := _Invoice.AccountingCustomerParty.Address.CountrySubentity;
418+
if not _Invoice.AccountingCustomerParty.Address.AddressLine.IsEmpty then
419+
AddChild('cac:AddressLine').AddChild('cbc:Line').Text := _Invoice.AccountingCustomerParty.Address.AddressLine;
420+
AddChild('cac:Country').AddChild('cbc:IdentificationCode').Text := _Invoice.AccountingCustomerParty.Address.CountryCode;
408421
end;
409422
if not _Invoice.AccountingCustomerParty.VATCompanyID.IsEmpty then
410423
with AddChild('cac:PartyTaxScheme') do
@@ -425,6 +438,35 @@ class procedure TXRechnungInvoiceAdapter.SaveDocumentUBL(_Invoice: TInvoice;
425438
end;
426439
end;
427440

441+
if (_Invoice.DeliveryInformation.ActualDeliveryDate > 0) or
442+
(not _Invoice.DeliveryInformation.Address.CountryCode.IsEmpty) or
443+
(not _Invoice.DeliveryInformation.Name.IsEmpty) then
444+
with xRoot.AddChild('cac:Delivery') do
445+
begin
446+
if (_Invoice.DeliveryInformation.ActualDeliveryDate > 0) then
447+
AddChild('cbc:ActualDeliveryDate').Text := TXRechnungHelper.DateToStr(_Invoice.DeliveryInformation.ActualDeliveryDate);
448+
with AddChild('cac:DeliveryLocation') do
449+
begin
450+
if (not _Invoice.DeliveryInformation.LocationIdentifier.IsEmpty) then
451+
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/
452+
with AddChild('cac:Address') do
453+
begin
454+
AddChild('cbc:StreetName').Text := _Invoice.DeliveryInformation.Address.StreetName;
455+
if not _Invoice.DeliveryInformation.Address.AdditionalStreetName.IsEmpty then
456+
AddChild('cbc:AdditionalStreetName').Text := _Invoice.DeliveryInformation.Address.AdditionalStreetName;
457+
AddChild('cbc:CityName').Text := _Invoice.DeliveryInformation.Address.City;
458+
AddChild('cbc:PostalZone').Text := _Invoice.DeliveryInformation.Address.PostalZone;
459+
if not _Invoice.DeliveryInformation.Address.CountrySubentity.IsEmpty then
460+
AddChild('cbc:CountrySubentity').Text := _Invoice.DeliveryInformation.Address.CountrySubentity;
461+
if not _Invoice.DeliveryInformation.Address.AddressLine.IsEmpty then
462+
AddChild('cac:AddressLine').AddChild('cbc:Line').Text := _Invoice.DeliveryInformation.Address.AddressLine;
463+
AddChild('cac:Country').AddChild('cbc:IdentificationCode').Text := _Invoice.DeliveryInformation.Address.CountryCode;
464+
end;
465+
end;
466+
if (not _Invoice.DeliveryInformation.Name.IsEmpty) then
467+
AddChild('cac:DeliveryParty').AddChild('cac:PartyName').AddChild('cbc:Name').Text := _Invoice.DeliveryInformation.Name;
468+
end;
469+
428470
if (_Invoice.PaymentMeansCode <> ipmc_None) and (not _Invoice.PayeeFinancialAccount.IsEmpty) then
429471
with xRoot.AddChild('cac:PaymentMeans') do
430472
begin

0 commit comments

Comments
 (0)