{
  "id": "BR-AG-01",
  "country": "EU",
  "syntax": "ubl",
  "group": "ipsi",
  "severity": "fatal",
  "severity_note": "fatal, from the Flag column of the Peppol BIS Billing 3.0 UBL rules index retrieved 2026-10-18.",
  "spec": "Peppol BIS Billing 3.0, May 2026 release, EN 16931 model bound to UBL",
  "statement": "An Invoice that contains an Invoice line (BG-25), a Document level allowance (BG-20) or a Document level charge (BG-21) where the VAT category code (BT-151, BT-95 or BT-102) is \"IPSI\" shall contain in the VAT breakdown (BG-23) at least one VAT category code (BT-118) equal with \"IPSI\".",
  "statement_lang": "en",
  "context": "/ubl:Invoice | /cn:CreditNote",
  "test": "((count(//cac:AllowanceCharge/cac:TaxCategory[normalize-space(cbc:ID) = 'M'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']) + count(//cac:ClassifiedTaxCategory[normalize-space(cbc:ID) = 'M'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT'])) > 0 and count(cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[cbc:ID = 'M'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']) > 0) or ((count(//cac:AllowanceCharge/cac:TaxCategory[normalize-space(cbc:ID) = 'M'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']) + count(//cac:ClassifiedTaxCategory[normalize-space(cbc:ID) = 'M'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT'])) = 0 and count(cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[normalize-space(cbc:ID) = 'M'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']) = 0)",
  "meaning": "If a line, a document allowance, or a document charge uses the VAT category \"IPSI\", the VAT breakdown must contain at least one VAT category code equal with \"IPSI\". The statement says \"at least one\", not exactly one, and it says \"equal with\". The published test compares that code to M. It passes when an M line, allowance, or charge is present and at least one VAT breakdown has category id M with the tax scheme VAT, and it passes when none of those uses M and no VAT-scheme breakdown uses M. The positive breakdown count is cbc:ID = 'M' with spaces around = and it requires the tax scheme, written cbc:ID))='VAT' with no space before =. The negative breakdown count uses normalize-space and also requires the tax scheme. The comparison is > 0, not = 1.",
  "fix": "Add a VAT breakdown (BG-23) with category code M and tax scheme VAT when a line, allowance, or charge uses M. The statement asks for at least one, not exactly one.",
  "example_fail": "A line, allowance, or charge uses VAT category code M, and the VAT breakdown has no M category with tax scheme VAT.",
  "example_pass": "One of those uses M, and the VAT breakdown has at least one M category with tax scheme VAT.",
  "example_note": "Illustration of the condition in the official statement. Not an example published by the source.",
  "source_url": "https://docs.peppol.eu/poacc/billing/3.0/rules/ubl-tc434/BR-AG-01/",
  "source_retrieved": "2026-10-18",
  "last_verified": "2026-10-18"
}
