GenerateInvoiceXMLA

PDF/A and compliance

Description

The trailing A denotes the ANSI (char) DLL entry point; the ActiveX/COM surface exposes only the Unicode form. Behaviour is identical to GenerateInvoiceXML and string arguments are interpreted using the current SetAnsiMode code page

Generates a compliant Factur-X / ZUGFeRD EN 16931 CrossIndustryInvoice (CII D16B) or OASIS UBL 2.1 electronic invoice XML payload with automatic VAT category grouping and monetary summation

Syntax

Delphi

Function DLGenerateInvoiceXMLA(InstanceID, Format: Integer; InvoiceID, IssueDate, CurrencyCode, SellerName, SellerVATID, BuyerName, BuyerVATID, LineItemsSpec: PAnsiChar): PAnsiChar;

DLL

const char* DLGenerateInvoiceXMLA(int InstanceID, int Format, const char* InvoiceID, const char* IssueDate, const char* CurrencyCode, const char* SellerName, const char* SellerVATID, const char* BuyerName, const char* BuyerVATID, const char* LineItemsSpec);

Parameters

Format0 for Factur-X / ZUGFeRD EN 16931 CII XML, or 1 for OASIS UBL 2.1 Invoice XML
InvoiceIDInvoice document identifier (BT-1)
IssueDateInvoice issue date in YYYY-MM-DD or YYYYMMDD format (BT-2)
CurrencyCodeISO 4217 3-letter currency code such as EUR or USD (BT-5)
SellerNameSeller trading name (BT-27)
SellerVATIDSeller VAT identifier prefixed with country code (BT-31)
BuyerNameBuyer trading name (BT-44)
BuyerVATIDBuyer VAT identifier prefixed with country code (BT-48)
LineItemsSpecSemicolon-separated line items formatted as Name|Quantity|NetUnitPrice|TaxRatePercent|UnitCode|TaxCategoryCode

Return values

Unicode XML text containing the generated CII or UBL 2.1 invoice document; encode it as UTF-8 when writing a file, or inspect LastErrorCode when the result is empty

Remarks

Quantities, unit prices, and tax rates retain the precision needed to round-trip their numeric values; decimal output has no exponents and at least two fractional digits

VAT groups use the category and exact numeric rate, keeping distinct rates separate even when their difference is below 0.001

Invalid, non-finite, or out-of-range numeric operands return an empty string and set LastErrorCode to 125 (PDFLIB_ERROR_INVOICE_INVALID); a subsequent successful call clears that error

The same happens for an empty invoice identifier, an issue date that is not a calendar date in one of the two formats, a currency code that is not three letters, and an empty line item list. No default is substituted for any of them

See also

ValidateInvoiceBusinessRulesBuiltIn, ValidateInvoiceBusinessRulesWithTools