ValidateInvoiceBusinessRulesBuiltIn
E-invoicing
Requires the Small Business edition — in Delphi, C++Builder and Lazarus code create the library as TPDFlibSmallBusiness (unit PDFlibSmallBusiness) or TPDFlibEnterprise; the Small Business and Enterprise DLL and ActiveX builds provide it unchanged; the Single edition keeps the method, which returns 0, an empty string or False and sets LastErrorCode to 901 (PDFLIB_ERROR_SMALLBUSINESS_REQUIRED)
Description
Validates embedded Factur-X CII or OASIS UBL 2.1 invoice XML against a native subset of the EN 16931 business rules, without external tools, and reports which rules were not checked
Syntax
Delphi
Function ValidateInvoiceBusinessRulesBuiltIn(Const EmbeddedFileName: WideString): WideString; Virtual;ActiveX
Function PDFlib::ValidateInvoiceBusinessRulesBuiltIn(EmbeddedFileName As String) As StringDLL
const wchar_t* DLValidateInvoiceBusinessRulesBuiltIn(int InstanceID, const wchar_t* EmbeddedFileName);
const char* DLValidateInvoiceBusinessRulesBuiltInA(int InstanceID, const char* EmbeddedFileName);Parameters
| EmbeddedFileName | Name of the embedded invoice attachment inside the PDF, or an empty string to auto-detect the Factur-X or single XML invoice attachment |
|---|
Return values
| JSON | The validation report as JSON with per-stage status, coverage, executed rule count and the collected issues coverage is subset and fullConformance is always false for this provider |
|---|
Remarks
The built-in provider runs on all supported platforms without xmllint, Java, Saxon or COM XML libraries. The Schema stage checks XML well-formedness, DTD prohibition and the root element (CrossIndustryInvoice, Invoice or CreditNote); it does not validate against the XSD
The Schematron stage reads the invoice into the EN 16931 business terms and checks, with the rule IDs of the EN 16931 validation artefacts 1.3.16:
- Mandatory terms: specification identifier, invoice number, issue date, type code, currency, seller and buyer names, postal addresses and country codes, document totals, VAT breakdown and invoice lines (BR-01 to BR-16, BR-21 to BR-28, BR-CO-04, BR-CO-18, BR-CO-26, BR-45 to BR-48)
- Calculations: line, allowance, charge, tax and payable totals and the taxable and tax amount of each VAT category (BR-CO-10 to BR-CO-17 and BR-xx-08, BR-xx-09)
- VAT category rules for S, Z, E, AE, K (BR-IC), G, O, L (BR-AF) and M (BR-AG): line rates, exemption reasons and the seller and buyer VAT identifiers they require (BR-xx-02, -05, -10)
- Code lists for document type, currency, dates, references, subjects, identifier and classification schemes, countries, payment means, VAT categories, allowance and charge reasons, exemption reasons, unit codes, MIME and electronic address schemes (BR-CL-01 to BR-CL-26) and two-decimal amounts (BR-DEC-01, -05, -09 to -20, -23)
- Profile rules: XRechnung 3.0.2 CIUS and extension rules (BR-DE-1 to BR-DE-31, BR-DEX-01 to BR-DEX-14) on CII and UBL, and Peppol BIS Billing 3.0 (3.0.20) core, common, code list and national rules (PEPPOL-EN16931-*, NO-R-*, DK-R-*, IT-R-*, SE-R-*, GR-R-*, IS-R-*, NL-R-*, DE-R-*) on UBL
Tolerances and rounding follow the CII or the UBL artefact of each rule. EN 16931 rules are not applied to Factur-X MINIMUM and BASIC WL documents, which are not EN 16931 invoices; an informational BuiltIn.Coverage.Profile issue says so
Each issue has a category: syntax, cardinality, calculation, vat, codelist, decimal, profile or coverage, so schema, arithmetic and profile findings can be told apart. Each stage lists the rule areas it left out in notCovered; GetBuiltInInvoiceRuleCatalog returns the complete list
A passed built-in report means the checked rules hold. For conformance to the complete standard or a CIUS, run ValidateInvoiceBusinessRulesWithTools with a versioned rule package, whose stages report coverage rulePackage
See also
ValidateInvoiceBusinessRules, ValidateInvoiceBusinessRulesWithTools, GetBuiltInInvoiceRuleCatalog, ExtractFacturXXMLToString