xorder
Implement X-Factur / ZUGFeRD XML support for Delphi
- Active · last change 1-13-2025
- ★ 1 on GitHub
README
WPXOrder is a collection of Delphi units to create X-Factur (ZUGFeRD) XML data. It is a collection of Delphi classes that represent the elements defined by the X-Factor format.
It was created to load, process and save such data. It does not include E-Invoice standard and is focussed to create the XML data to be embedded inside PDF invoices. To create such Invoices you can use the powerful PDF creation VCL wPDF. To read such Invoices you can use WPViewPDF PLUS which can not only extract X-Factur Data but also attach it.
We developed WPXOrder to offer a tool that leverages the capabilities of the modern Delphi compiler, simplifying the management of the complex format using a deeply thought out software architecture.
Please read here how to use WPXOrder.
Features
Load XML Data
This generates objects that represent the data structures and content present in the XML data. You can directly interact with the data structures using the Pascal programming language. If you don’t require this feature, it can be turned off, and the links to XML support will also be removed from the project.
Create Pascal code from object structure
The component generates Delphi code that can reconstruct the entire object structure step by step. Certain information is configured using specific types, like the accepted payment methods, or as text strings. Having the code simplifies the process of generating similar invoices by simply changing the data while retaining the object names.
Save XML Data from object struture
After the object structure has been loaded or created, you can store it as new XML data. The XML will represent the precise arrangement and sequence of tags that are present in the internal object data. Saving is accomplished using basic string operations, eliminating the need for XML support. This results in a process that is quick, dependable, and platform-independent. We evaluated the functionality by importing loading sample invoices and saving the data as new XML files. After utilizing text-diff, only a few minor alterations were identified, primarily variations in insignificant digits in numerical values (such as the "0" following the decimal point). We suggest that you check your data in the same manner.
Sample of auto-generated Delphi code
with WPXOrder1.ExchangedDocument do
begin
ID.ValueStr := '471102';
TypeCode.SetValue(TDocumentCode.c380_Commercial_invoice);
IssueDateTime.DateTimeString.SetValue('20200305',{format=}'102');
....// some lines skipped
end;
item:=WPXOrder1.Transaction.Items.Add;
with item.Line do
begin
AssociatedDocumentLineDocument.LineID.ValueStr := '1';
SpecifiedLineTradeAgreement.NetPriceProductTradePrice.ChargeAmount.SetValue(9.90);
SpecifiedLineTradeDelivery.BilledQuantity.SetValue('20.0000',{unitCode=}'H87');
SpecifiedLineTradeSettlement.ApplicableTradeTax.TypeCode.SetValue('VAT');
SpecifiedLineTradeSettlement.ApplicableTradeTax.CategoryCode.SetValue(TTaxCategory.S_Standard_rate);
SpecifiedLineTradeSettlement.ApplicableTradeTax.RateApplicablePercent.SetValue('19');
SpecifiedLineTradeSettlement.SpecifiedTradeSettlementLineMonetarySummation.LineTotalAmount.SetValue(198.00);
end;
with WPXOrder1.Transaction.ApplicableHeaderTradeAgreement do
begin
SellerTradeParty.Name.SetValue('Lieferant GmbH');
SellerTradeParty.PostalTradeAddress.PostcodeCode.SetValue('80333',{listID=}'',{listVersionID=}'');
....// some lines skipped
SellerTradeParty.SpecifiedTaxRegistration[1].ID.SetValue('201/113/40209',TTaxID.FC_tax_number);
SellerTradeParty.SpecifiedTaxRegistration[2].ID.SetValue('DE123456789',TTaxID.VA_VAT_number);
....// some lines skipped
end;
with WPXOrder1.Transaction.ApplicableHeaderTradeSettlement do
begin
InvoiceCurrencyCode.SetValue(TCurrencyCode.EUR);
ApplicableTradeTax.CalculatedAmount.SetValue(37.62);
ApplicableTradeTax.TypeCode.SetValue('VAT');
ApplicableTradeTax.BasisAmount.SetValue(198.00);
ApplicableTradeTax.CategoryCode.SetValue(TTaxCategory.S_Standard_rate);
ApplicableTradeTax.RateApplicablePercent.SetValue('19.00');
SpecifiedTradePaymentTerms.DueDateDateTime.DateTimeString.SetValue('20200404',{format=}'102');
SpecifiedTradeSettlementHeaderMonetarySummation.LineTotalAmount.SetValue(198.00);
SpecifiedTradeSettlementHeaderMonetarySummation.ChargeTotalAmount.SetValue(0.00);
SpecifiedTradeSettlementHeaderMonetarySummation.AllowanceTotalAmount.SetValue(0.00);
SpecifiedTradeSettlementHeaderMonetarySummation.TaxBasisTotalAmount.SetValue(198.00);
SpecifiedTradeSettlementHeaderMonetarySummation.TaxTotalAmount.SetValue(37.62, 'EUR');
SpecifiedTradeSettlementHeaderMonetarySummation.GrandTotalAmount.SetValue(235.62);
SpecifiedTradeSettlementHeaderMonetarySummation.DuePayableAmount.SetValue(235.62);
end;
WPXOrder is distributed under a dual license:
1. GNU General Public License, Version 3.0 or later (GPL-3.0-or-later)
You can find a copy of the license at [http://www.gnu.org/licenses/gpl-3.0.html](http://www.gnu.org/licenses/gpl-3.0.html) This allows you to freely use, modify, and distribute the software under the terms of the GPL. (Your software must also be distributed under GNU License!) Not allowed is the use in components of any kind or forks of this component.
2. Commercial License:
For those who prefer to use "WPXOrder" without the restrictions imposed by the GPL, a commercial license is available. Please contact WPCubed GmbH - support@wptools.de for terms and pricing.
Usage Disclaimer
The code was created with the Information provided here [https://xeinkauf.de/dokumente/](https://xeinkauf.de/dokumente/) Here you can validate the created XML / Invoice [https://portal3.gefeg.com/invoice/page/validation](https://portal3.gefeg.com/invoice/page/validation)
This software is provided in the hope that it will be useful, but without any warranty of any kind.
For more details, please refer to the licenses. For inquiries or support, please contact support@wptools.de. For information about what information to include in the X-Factur data please refer to the offical information. Tip: You can download an spreadsheet with the possible values for the "codes".

