NL-R-001: For suppliers in the Netherlands, if the document is a creditnote, the document MUST contain an invoice reference (cac:BillingReference/cac:InvoiceDocumentReference/cbc:ID)
NL-R-001 is a Dutch national rule (Peppol BIS Billing 3.0, UBL-2.1) that enforces the legal requirement that a credit note issued by a Dutch supplier must reference the original invoice it corrects. The context XPath `cbc:CreditNoteTypeCode[$supplierCountryIsNL]` selects the CreditNoteTypeCode element (BT-3) only when the supplier's country (BT-40, derived from cac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cbc:Country/cac:IdentificationCode or cbc:IdentificationCode) is 'NL'. The rule fires when the document is a credit note (CreditNoteTypeCode = 381) and the required BillingReference/InvoiceDocumentReference/ID (BT-25, the referenced invoice number) is absent. The assertion is fatal because without the original invoice reference the credit note cannot be legally matched to the corrected invoice, breaking VAT auditability. The XPath test evaluates the presence of `cac:BillingReference/cac:InvoiceDocumentReference/cbc:ID` relative to the document root; if the node-set is empty, the assertion fails.
1. Identify the original invoice number that the credit note corrects. 2. In the UBL CreditNote document, add a cac:BillingReference element as a direct child of the CreditNote root (after cbc:DocumentCurrencyCode and before cac:AccountingSupplierParty). 3. Inside cac:BillingReference, add cac:InvoiceDocumentReference. 4. Inside cac:InvoiceDocumentReference, add cbc:ID with the original invoice number as its text content. 5. Ensure the supplier's country code is correctly set to 'NL' in cac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cbc:Country/cbc:IdentificationCode. 6. Validate the document against the Peppol BIS Billing 3.0 Schematron to confirm the rule passes.
Missing <cbc:EndpointID schemeID="..."> inside <cac:AccountingSupplierParty>/<cac:Party>.
fix: Add <cbc:EndpointID schemeID="9930">DE123456789</cbc:EndpointID> as the first child of Seller <cac:Party>.
No <cbc:BuyerReference> (BT-10) found. Mandatory in XRechnung 3.0 (BR-DE-15) and required in Peppol BIS 3.0 (PEPPOL-EN16931-R003) when OrderReference is absent.
fix: Insert <cbc:BuyerReference>991-12849-74</cbc:BuyerReference> in the document header.
If both supplier and customer are located in Germany, an invoice shall contain information on "PAYMENT INSTRUCTIONS" (BG-16).
If both supplier and customer are located in Germany, the group "SELLER CONTACT" (BG-6) shall be provided.
If both supplier and customer are located in Germany, the element "Buyer reference" (BT-10) shall be provided.
If both supplier and customer are located in Germany, and if one of the VAT codes S, Z, E, AE, K, G, L, or M is used, an invoice shall contain at least one of the following elements: "Seller VAT identifier" (BT-31) or "Seller tax registration identifier" (BT-32) or "SELLER TAX REPRESENTATIVE PARTY" (BG-11).
If both supplier and customer are located in Germany, the element "Invoice type code" (BT-3) should only contain the following values from code list UNTDID 1001: 326 (Partial invoice), 380 (Commercial invoice), 384 (Corrected invoice), 389 (Self-billed invoice), 381 (Credit note), 875 (Partial construction invoice), 876 (Partial final construction invoice), 877 (Final construction invoice).