The total amount of the Invoice line (before tax).
値引後の請求書明細行の合計金額(税抜き)。


About

Syntax binding
ubl:Invoice / cac:InvoiceLine / cbc:LineExtensionAmount
Restricted Syntax Cardinality
1..1
Example
87700
Attribute(s)
@currencyID
UBL 2.1
XPath
/ Invoice / cac:InvoiceLine / cbc:LineExtensionAmount
Occurrence
1
Datatype
AmountType
UBL Definition
The total amount for this invoice line, including allowance charges but net of taxes.
Namespace
cbc urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2

Semantic

Business Term

Invoice line net amount

値引後請求書明細行金額(税抜き)
ID
ibt-131
Description
The total amount of the Invoice line (before tax).
値引後の請求書明細行の合計金額(税抜き)。
Aligned Cardinality
1..1
Semantic datatype
Amount

Code list

ISO4217
ISO 4217 Currency codes

Child element

  ID Business term Sem. Card. Syntax Card. XPath
  1..1 1..1 / Invoice / cac:InvoiceLine / cbc:LineExtensionAmount / @currencyID

VERSION 1.0 RULES

Unchanged
Same as 0.9.3

VERSION 0.9.3 RULES
JP PINT 0.9.3 Shared rules
ibr-024(fatal)
Unchanged
Same as 0.9.2
ibr-co-10(fatal)
Unchanged
Same as 0.9.2
ibr-co-13(fatal)
Unchanged
Same as 0.9.2

VERSION 0.9.2 RULES
JP PINT 0.9.2 Aligned rules
aligned-ibrp-053(fatal)
Obsoleted
[aligned-ibrp-053]-Invoice line net amount (ibt-131) MUST equal (Invoiced quantity (ibt-129) * (Item net price (ibt-146)/item price base quantity (ibt-149)) + Sum of invoice line charge amount (ibt-141) - sum of invoice line allowance amount (ibt-136).
context
cac:InvoiceLine |
cac:CreditNoteLine
test
(exists(cac:Price/cbc:BaseQuantity) and
  u:slack(xs:decimal(cbc:LineExtensionAmount), xs:decimal(((cbc:InvoicedQuantity|cbc:CreditedQuantity) * (cac:Price/cbc:PriceAmount div cac:Price/cbc:BaseQuantity)) +
      sum(//cac:AllowanceCharge[cbc:ChargeIndicator=true()]/cbc:Amount) -
      sum(//cac:AllowanceCharge[cbc:ChargeIndicator=false()]/cbc:Amount)), 0.02)) or
(
  not(
    exists(cac:Price/cbc:BaseQuantity)) and
  u:slack(xs:decimal(cbc:LineExtensionAmount), xs:decimal(((cbc:InvoicedQuantity|cbc:CreditedQuantity) * cac:Price/cbc:PriceAmount) +
      sum(//cac:AllowanceCharge[cbc:ChargeIndicator=true()]/cbc:Amount) -
      sum(//cac:AllowanceCharge[cbc:ChargeIndicator=false()]/cbc:Amount)), 0.02
  )
)
aligned-ibrp-ae-08(fatal)
Obsoleted
[aligned-ibrp-ae-08]-For each different value of tax category rate (ibt-119) where the tax category code (ibt-118) is ""Reverse charge", the tax category taxable amount (ibt-116) in a tax breakdown (ibg-23) MUST equal the sum of Invoice line net amounts (ibt-131) plus the sum of document level charge amounts (ibt-99) minus the sum of document level allowance amounts (ibt-92) where the tax category code (ibt-151, ibt-102, ibt-95) is "Standard rated" and the tax rate (ibt-152, ibt-103, ibt-96) equals the tax category rate (ibt-119).
context
/*/cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[normalize-space(cbc:ID) = 'AE'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']
test
(exists(//cac:InvoiceLine) and
  (
    xs:decimal(../cbc:TaxableAmount) =
    (sum(../../../cac:InvoiceLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='AE']/xs:decimal(cbc:LineExtensionAmount)) +
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='AE']/xs:decimal(cbc:Amount)) -
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='AE']/xs:decimal(cbc:Amount))))) or
(exists(//cac:CreditNoteLine) and
  (
    xs:decimal(../cbc:TaxableAmount) =
    (sum(../../../cac:CreditNoteLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='AE']/xs:decimal(cbc:LineExtensionAmount)) +
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='AE']/xs:decimal(cbc:Amount)) -
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='AE']/xs:decimal(cbc:Amount))
    )
  )
)
aligned-ibrp-e-08(fatal)
Obsoleted
[aligned-ibrp-e-08]-In a tax breakdown (ibg-23) where the tax category code (ibt-118) is "Exempt from tax" the tax category taxable amount (ibt-116) MUST equal the sum of Invoice line net amounts (ibt-131) minus the sum of Document level allowance amounts (ibt-92) plus the sum of Document level charge amounts (ibt-99) where the tax category codes (ibt-151, ibt-95, ibt-102) are "Exempt from tax".
context
/*/cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[normalize-space(cbc:ID) = 'E'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']
test
(exists(//cac:InvoiceLine) and
  (
    xs:decimal(../cbc:TaxableAmount) =
    (sum(../../../cac:InvoiceLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='E']/xs:decimal(cbc:LineExtensionAmount)) +
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='E']/xs:decimal(cbc:Amount)) -
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='E']/xs:decimal(cbc:Amount))))) or
(exists(//cac:CreditNoteLine) and
  (
    xs:decimal(../cbc:TaxableAmount) =
    (sum(../../../cac:CreditNoteLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='E']/xs:decimal(cbc:LineExtensionAmount)) +
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='E']/xs:decimal(cbc:Amount)) -
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='E']/xs:decimal(cbc:Amount))
    )
  )
)
aligned-ibrp-g-08(fatal)
Obsoleted
[aligned-ibrp-g-08]-In a tax breakdown (ibg-23) where the tax category code (ibt-118) is "Export" the tax category taxable amount (ibt-116) MUST equal the sum of Invoice line net amounts (ibt-131) minus the sum of Document level allowance amounts (ibt-92) plus the sum of Document level charge amounts (ibt-99) where the tax category codes (ibt-151, ibt-95, ibt-102) are "Export".
context
/*/cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[normalize-space(cbc:ID) = 'G'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']
test
(exists(//cac:InvoiceLine) and
  (
    xs:decimal(../cbc:TaxableAmount) =
    (sum(../../../cac:InvoiceLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='G']/xs:decimal(cbc:LineExtensionAmount)) +
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='G']/xs:decimal(cbc:Amount)) -
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='G']/xs:decimal(cbc:Amount))))) or
(exists(//cac:CreditNoteLine) and
  (
    xs:decimal(../cbc:TaxableAmount) =
    (sum(../../../cac:CreditNoteLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='G']/xs:decimal(cbc:LineExtensionAmount)) +
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='G']/xs:decimal(cbc:Amount)) -
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='G']/xs:decimal(cbc:Amount))
    )
  )
)
aligned-ibrp-ic-08(fatal)
Obsoleted
[aligned-ibrp-ic-08]-In a tax breakdown (ibg-23) where the tax category code (ibt-118) is "Intra-community supply" the tax category taxable amount (ibt-116) MUST equal the sum of Invoice line net amounts (ibt-131) minus the sum of Document level allowance amounts (ibt-92) plus the sum of Document level charge amounts (ibt-99) where the tax category codes (ibt-151, BT-95, BT-102) are "Intra-community supply".
context
/*/cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[normalize-space(cbc:ID) = 'K'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']
test
(exists(//cac:InvoiceLine) and
  (
    xs:decimal(../cbc:TaxableAmount) =
    (sum(../../../cac:InvoiceLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='K']/xs:decimal(cbc:LineExtensionAmount)) +
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='K']/xs:decimal(cbc:Amount)) -
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='K']/xs:decimal(cbc:Amount))))) or
(exists(//cac:CreditNoteLine) and
  (
    xs:decimal(../cbc:TaxableAmount) =
    (sum(../../../cac:CreditNoteLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='K']/xs:decimal(cbc:LineExtensionAmount)) +
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='K']/xs:decimal(cbc:Amount)) -
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='K']/xs:decimal(cbc:Amount))
    )
  )
)
aligned-ibrp-o-08(fatal)
Obsoleted
[aligned-ibrp-o-08]-In a tax breakdown (ibg-23) where the tax category code (ibt-118) is " Not subject to tax" the tax category taxable amount (ibt-116) MUST equal the sum of Invoice line net amounts (ibt-131) minus the sum of Document level allowance amounts (ibt-92) plus the sum of Document level charge amounts (ibt-99) where the tax category codes (ibt-151, ibt-95, ibt-102) are "Not subject to tax".
context
/*/cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[normalize-space(cbc:ID) = 'O'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']
test
(exists(//cac:InvoiceLine) and
  (
    xs:decimal(../cbc:TaxableAmount) =
    (sum(../../../cac:InvoiceLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='O']/xs:decimal(cbc:LineExtensionAmount)) +
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='O']/xs:decimal(cbc:Amount)) -
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='O']/xs:decimal(cbc:Amount))))) or
(exists(//cac:CreditNoteLine) and
  (
    xs:decimal(../cbc:TaxableAmount) =
    (sum(../../../cac:CreditNoteLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='O']/xs:decimal(cbc:LineExtensionAmount)) +
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='O']/xs:decimal(cbc:Amount)) -
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='O']/xs:decimal(cbc:Amount))
    )
  )
)
aligned-ibrp-s-08(fatal)
Obsoleted
[aligned-ibrp-s-08]-For each different value of tax category rate (ibt-119) where the tax category code (ibt-118) is "Standard rated", the tax category taxable amount (ibt-116) in a tax breakdown (ibg-23) MUST equal the sum of Invoice line net amounts (ibt-131) plus the sum of document level charge amounts (ibt-99) minus the sum of document level allowance amounts (ibt-92) where the tax category code (ibt-151, ibt-102, ibt-95) is "Standard rated" and the tax rate (ibt-152, ibt-103, ibt-96) equals the tax category rate (ibt-119).
context
/*/cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[normalize-space(cbc:ID) = 'S'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']
test
every $rate in xs:decimal(cbc:Percent) satisfies
(((exists(//cac:InvoiceLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID) =
        'S'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent) =$rate]) or
      exists(//cac:AllowanceCharge[cac:TaxCategory/normalize-space(cbc:ID)='S'][cac:TaxCategory/xs:decimal(cbc:Percent) =
        $rate])) and
    (u:slack(../xs:decimal(cbc:TaxableAmount), sum(../../../cac:InvoiceLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='S'][cac:Item/ cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent) =$rate]/xs:decimal(cbc:LineExtensionAmount)) +
        sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='S'][cac:TaxCategory/xs:decimal(cbc:Percent) =
          $rate]/xs:decimal(cbc:Amount)) -
        sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='S'][cac:TaxCategory/xs:decimal(cbc:Percent) =
          $rate]/xs:decimal(cbc:Amount)),0.02))) or
  (
    (exists(//cac:CreditNoteLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID) =
        'S'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent) =$rate]) or
      exists(//cac:AllowanceCharge[cac:TaxCategory/normalize-space(cbc:ID)='S'][cac:TaxCategory/xs:decimal(cbc:Percent) =
        $rate])) and
    (u:slack(../xs:decimal(cbc:TaxableAmount), sum(../../../cac:CreditNoteLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='S'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent) =$rate]/xs:decimal(cbc:LineExtensionAmount)) +
        sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='S'][cac:TaxCategory/xs:decimal(cbc:Percent) =
          $rate]/xs:decimal(cbc:Amount)) -
        sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='S'][cac:TaxCategory/xs:decimal(cbc:Percent) =
          $rate]/xs:decimal(cbc:Amount)),0.02)
    )
  )
)
aligned-ibrp-z-08(fatal)
Obsoleted
[aligned-ibrp-z-08]-In a tax breakdown (ibg-23) where tax category code (ibt-118) is "Zero rated" the tax category taxable amount (ibt-116) MUST equal the sum of Invoice line net amount (ibt-131) minus the sum of Document level allowance amounts (ibt-92) plus the sum of Document level charge amounts (ibt-99) where the tax category codes (ibt-151, ibt-95, ibt-102) are "Zero rated".
context
/*/cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[normalize-space(cbc:ID) = 'Z'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']
test
(exists(//cac:InvoiceLine) and
  (
    xs:decimal(../cbc:TaxableAmount) =
    (sum(../../../cac:InvoiceLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='Z']/xs:decimal(cbc:LineExtensionAmount)) +
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='Z']/xs:decimal(cbc:Amount)) -
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='Z']/xs:decimal(cbc:Amount))))) or
(exists(//cac:CreditNoteLine) and
  (
    xs:decimal(../cbc:TaxableAmount) =
    (sum(../../../cac:CreditNoteLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='Z']/xs:decimal(cbc:LineExtensionAmount)) +
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='Z']/xs:decimal(cbc:Amount)) -
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='Z']/xs:decimal(cbc:Amount))
    )
  )
)
JP PINT 0.9.2 Shared rules
ibr-024(fatal)
Still valid
[ibr-024]-Each Invoice line (ibg-25) MUST have an Invoice line net amount (ibt-131).
context
cac:InvoiceLine |
cac:CreditNoteLine
test
exists(cbc:LineExtensionAmount)
ibr-co-10(fatal)
Still valid
[ibr-co-10]-Sum of Invoice line net amount (ibt-106) = Σ Invoice line net amount (ibt-131).
context
cac:LegalMonetaryTotal
test
(
  xs:decimal(cbc:LineExtensionAmount) =
  (
    round(
      sum(//(cac:InvoiceLine|cac:CreditNoteLine)/xs:decimal(cbc:LineExtensionAmount)) * 10 * 10) div 100
  )
)
ibr-co-13(fatal)
Still valid
[ibr-co-13]-Invoice total amount without Tax (ibt-109) = Σ Invoice line net amount (ibt-131) - Sum of allowances on document level (ibt-107) + Sum of charges on document level (ibt-108).
context
cac:LegalMonetaryTotal
test
(
  (cbc:ChargeTotalAmount) and
  (cbc:AllowanceTotalAmount) and
  (
    xs:decimal(cbc:TaxExclusiveAmount) =
    round(
      (xs:decimal(cbc:LineExtensionAmount) +
        xs:decimal(cbc:ChargeTotalAmount) -
        xs:decimal(cbc:AllowanceTotalAmount)
      ) * 10 * 10
    ) div 100
  )
) or
(
  not(
    cbc:ChargeTotalAmount) and
  (cbc:AllowanceTotalAmount) and
  (
    xs:decimal(cbc:TaxExclusiveAmount) =
    round(
      (xs:decimal(cbc:LineExtensionAmount) -
        xs:decimal(cbc:AllowanceTotalAmount)
      ) * 10 * 10
    ) div 100
  )
) or
(
  (cbc:ChargeTotalAmount) and
  not(cbc:AllowanceTotalAmount) and
  (
    xs:decimal(cbc:TaxExclusiveAmount) =
    round(
      (xs:decimal(cbc:LineExtensionAmount) +
        xs:decimal(cbc:ChargeTotalAmount)
      ) * 10 * 10
    ) div 100
  )
) or
(
  not(
    cbc:ChargeTotalAmount) and
  not(cbc:AllowanceTotalAmount) and
  (
    xs:decimal(cbc:TaxExclusiveAmount) =
    xs:decimal(cbc:LineExtensionAmount)
  )
)
Code list rule (Shared rule)
ibr-cl-03 (fatal)
[ibr-cl-03]-currencyID MUST be coded using ISO code list 4217 alpha-3.
Context
cbc:LineExtensionAmount
Test
(
  (
    not(contains(normalize-space(@currencyID), ' ')) and
    contains(' AED AFN ALL AMD ANG AOA ARS AUD AWG AZN BAM BBD BDT BGN BHD BIF BMD BND BOB BOV BRL BSD BTN BWP BYR BZD CAD CDF CHE CHF CHW CLF CLP CNY COP COU CRC CUC CUP CVE CZK DJF DKK DOP DZD EGP ERN ETB EUR FJD FKP GBP GEL GHS GIP GMD GNF GTQ GYD HKD HNL HRK HTG HUF IDR ILS INR IQD IRR ISK JMD JOD JPY KES KGS KHR KMF KPW KRW KWD KYD KZT LAK LBP LKR LRD LSL LYD MAD MDL MGA MKD MMK MNT MOP MRO MUR MVR MWK MXN MXV MYR MZN NAD NGN NIO NOK NPR NZD OMR PAB PEN PGK PHP PKR PLN PYG QAR RON RSD RUB RWF SAR SBD SCR SDG SEK SGD SHP SLL SOS SRD SSP STD SVC SYP SZL THB TJS TMT TND TOP TRY TTD TWD TZS UAH UGX USD USN UYI UYU UZS VEF VND VUV WST XAF XAG XAU XBA XBB XBC XBD XCD XDR XOF XPD XPF XPT XSU XTS XUA XXX YER ZAR ZMW ZWL ',
      concat(' ', normalize-space(@currencyID), ' ')
    )
  )
)

VERSION 0.9.1 RULES
Obsoleted
Shared rules (0.9.1)
ibr-024 (fatal)
[ibr-024]-Each Invoice line (ibg-25) MUST have an Invoice line net amount (ibt-131).
context
cac:InvoiceLine |
cac:CreditNoteLine
test
exists(cbc:LineExtensionAmount)
ibr-co-10 (fatal)
[ibr-co-10]-Sum of Invoice line net amount (ibt-106) = Σ Invoice line net amount (ibt-131).
context
cac:LegalMonetaryTotal
test
(
  xs:decimal(cbc:LineExtensionAmount) =
  (
    round(
      sum(//(cac:InvoiceLine|cac:CreditNoteLine)/xs:decimal(cbc:LineExtensionAmount)) * 10 * 10) div 100
  )
)
ibr-co-13 (fatal)
[ibr-co-13]-Invoice total amount without Tax (ibt-109) = Σ Invoice line net amount (ibt-131) - Sum of allowances on document level (ibt-107) + Sum of charges on document level (ibt-108).
context
cac:LegalMonetaryTotal
test
(
  (cbc:ChargeTotalAmount) and
  (cbc:AllowanceTotalAmount) and
  (
    xs:decimal(cbc:TaxExclusiveAmount) =
    round(
      (xs:decimal(cbc:LineExtensionAmount) +
        xs:decimal(cbc:ChargeTotalAmount) -
        xs:decimal(cbc:AllowanceTotalAmount)
      ) * 10 * 10
    ) div 100
  )
) or
(
  not(
    cbc:ChargeTotalAmount) and
  (cbc:AllowanceTotalAmount) and
  (
    xs:decimal(cbc:TaxExclusiveAmount) =
    round(
      (xs:decimal(cbc:LineExtensionAmount) -
        xs:decimal(cbc:AllowanceTotalAmount)
      ) * 10 * 10
    ) div 100
  )
) or
(
  (cbc:ChargeTotalAmount) and
  not(cbc:AllowanceTotalAmount) and
  (
    xs:decimal(cbc:TaxExclusiveAmount) =
    round(
      (xs:decimal(cbc:LineExtensionAmount) +
        xs:decimal(cbc:ChargeTotalAmount)
      ) * 10 * 10
    ) div 100
  )
) or
(
  not(
    cbc:ChargeTotalAmount) and
  not(cbc:AllowanceTotalAmount) and
  (
    xs:decimal(cbc:TaxExclusiveAmount) =
    xs:decimal(cbc:LineExtensionAmount)
  )
)
Code list rule (Shared rule)
ibr-cl-03 (fatal)
[ibr-cl-03]-currencyID MUST be coded using ISO code list 4217 alpha-3.
Context
cbc:LineExtensionAmount
Test
(
  (
    not(contains(normalize-space(@currencyID), ' ')) and
    contains(' AED AFN ALL AMD ANG AOA ARS AUD AWG AZN BAM BBD BDT BGN BHD BIF BMD BND BOB BOV BRL BSD BTN BWP BYR BZD CAD CDF CHE CHF CHW CLF CLP CNY COP COU CRC CUC CUP CVE CZK DJF DKK DOP DZD EGP ERN ETB EUR FJD FKP GBP GEL GHS GIP GMD GNF GTQ GYD HKD HNL HRK HTG HUF IDR ILS INR IQD IRR ISK JMD JOD JPY KES KGS KHR KMF KPW KRW KWD KYD KZT LAK LBP LKR LRD LSL LYD MAD MDL MGA MKD MMK MNT MOP MRO MUR MVR MWK MXN MXV MYR MZN NAD NGN NIO NOK NPR NZD OMR PAB PEN PGK PHP PKR PLN PYG QAR RON RSD RUB RWF SAR SBD SCR SDG SEK SGD SHP SLL SOS SRD SSP STD SVC SYP SZL THB TJS TMT TND TOP TRY TTD TWD TZS UAH UGX USD USN UYI UYU UZS VEF VND VUV WST XAF XAG XAU XBA XBB XBC XBD XCD XDR XOF XPD XPF XPT XSU XTS XUA XXX YER ZAR ZMW ZWL ',
      concat(' ', normalize-space(@currencyID), ' ')
    )
  )
)

JP PINT 0.9 RULES
Obsoleted
Aligned Rules (0.9)
jp-br-09(fatal)
[jp-br-09]-Invoice line net amount (ibt-131) = Item net price (ibt-146) X Invoiced quantity (ibt-129) ÷ Item price base quantity (ibt-149) + Invoice line charge amount (ibt-141) – Invoice line allowance amount (ibt-136).
context
/ubl:Invoice[cac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cac:Country/cbc:IdentificationCode = 'JP' ]/cac:InvoiceLine
test
(exists(cac:Price/cbc:BaseQuantity) and
  (
    (exists(cac:AllowanceCharge[cbc:ChargeIndicator=false()]) and
      exists(cac:AllowanceCharge[cbc:ChargeIndicator=true()]) and
      (cbc:LineExtensionAmount =
        cbc:InvoicedQuantity * (cac:Price/cbc:PriceAmount div cac:Price/cbc:BaseQuantity) +
        cac:AllowanceCharge[cbc:ChargeIndicator=true()]/cbc:Amount -
        cac:AllowanceCharge[cbc:ChargeIndicator=false()]/cbc:Amount)) or
    (
      not(
        exists(cac:AllowanceCharge[cbc:ChargeIndicator=false()])) and
      exists(cac:AllowanceCharge[cbc:ChargeIndicator=true()]) and
      (cbc:LineExtensionAmount =
        cbc:InvoicedQuantity * (cac:Price/cbc:PriceAmount div cac:Price/cbc:BaseQuantity) +
        cac:AllowanceCharge[cbc:ChargeIndicator=true()]/cbc:Amount)) or
    (exists(cac:AllowanceCharge[cbc:ChargeIndicator=false()]) and
      not(exists(cac:AllowanceCharge[cbc:ChargeIndicator=true()])) and
      (cbc:LineExtensionAmount =
        cbc:InvoicedQuantity * (cac:Price/cbc:PriceAmount div cac:Price/cbc:BaseQuantity) -
        cac:AllowanceCharge[cbc:ChargeIndicator=false()]/cbc:Amount)) or
    (
      not(
        exists(cac:AllowanceCharge[cbc:ChargeIndicator=false()])) and
      not(exists(cac:AllowanceCharge[cbc:ChargeIndicator=true()])) and
      (cbc:LineExtensionAmount =
        cbc:InvoicedQuantity * (cac:Price/cbc:PriceAmount div cac:Price/cbc:BaseQuantity))))) or
(
  not(
    exists(cac:Price/cbc:BaseQuantity)) and
  (
    (exists(cac:AllowanceCharge[cbc:ChargeIndicator=false()]) and
      exists(cac:AllowanceCharge[cbc:ChargeIndicator=true()]) and
      (cbc:LineExtensionAmount =
        cbc:InvoicedQuantity * cac:Price/cbc:PriceAmount +
        cac:AllowanceCharge[cbc:ChargeIndicator=true()]/cbc:Amount -
        cac:AllowanceCharge[cbc:ChargeIndicator=false()]/cbc:Amount)) or
    (
      not(
        exists(cac:AllowanceCharge[cbc:ChargeIndicator=false()])) and
      exists(cac:AllowanceCharge[cbc:ChargeIndicator=true()]) and
      (cbc:LineExtensionAmount =
        cbc:InvoicedQuantity * (cac:Price/cbc:PriceAmount +
          cac:AllowanceCharge[cbc:ChargeIndicator=true()]/cbc:Amount))) or
    (exists(cac:AllowanceCharge[cbc:ChargeIndicator=false()]) and
      not(exists(cac:AllowanceCharge[cbc:ChargeIndicator=true()])) and
      (cbc:LineExtensionAmount =
        cbc:InvoicedQuantity * (cac:Price/cbc:PriceAmount -
          cac:AllowanceCharge[cbc:ChargeIndicator=false()]/cbc:Amount))) or
    (
      not(
        exists(cac:AllowanceCharge[cbc:ChargeIndicator=false()])) and
      not(exists(cac:AllowanceCharge[cbc:ChargeIndicator=true()])) and
      (cbc:LineExtensionAmount =
        cbc:InvoicedQuantity * (cac:Price/cbc:PriceAmount))
    )
  )
)
Shared Rules (0.9)
ibr-24(fatal)
[ibr-24]-Each Invoice line (ibg-25) shall have an Invoice line net amount (ibt-131).
context
cac:InvoiceLine | cac:CreditNoteLine
test
exists(cbc:LineExtensionAmount)

PEPPOL BIS BILLING 3.0 RULES
EN16931 model bound to UBL rules
BR-24 (fatal)
Each Invoice line (BG-25) shall have an Invoice line net amount (BT-131).
context
cac:InvoiceLine |
cac:CreditNoteLine
test
exists(cbc:LineExtensionAmount)
BR-AE-08 (fatal)
In a VAT breakdown (BG-23) where the VAT category code (BT-118) is "Reverse charge" the VAT category taxable amount (BT-116) shall equal the sum of Invoice line net amounts (BT-131) minus the sum of Document level allowance amounts (BT-92) plus the sum of Document level charge amounts (BT-99) where the VAT category codes (BT-151, BT-95, BT-102) are "Reverse charge".
context
/*/cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[normalize-space(cbc:ID) = 'AE'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']
test
(exists(//cac:InvoiceLine) and
  (
    xs:decimal(../cbc:TaxableAmount) =
    (sum(../../../cac:InvoiceLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='AE']/xs:decimal(cbc:LineExtensionAmount)) +
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='AE']/xs:decimal(cbc:Amount)) -
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='AE']/xs:decimal(cbc:Amount))))) or
(exists(//cac:CreditNoteLine) and
  (
    xs:decimal(../cbc:TaxableAmount) =
    (sum(../../../cac:CreditNoteLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='AE']/xs:decimal(cbc:LineExtensionAmount)) +
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='AE']/xs:decimal(cbc:Amount)) -
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='AE']/xs:decimal(cbc:Amount))
    )
  )
)
BR-CO-10 (fatal)
Sum of Invoice line net amount (BT-106) = Σ Invoice line net amount (BT-131).
context
cac:LegalMonetaryTotal
test
(
  xs:decimal(cbc:LineExtensionAmount) =
  xs:decimal(round(sum(//(cac:InvoiceLine|cac:CreditNoteLine)/xs:decimal(cbc:LineExtensionAmount)
      ) * 10 * 10
    ) div 100
  )
)
BR-CO-13 (fatal)
Invoice total amount without VAT (BT-109) = Σ Invoice line net amount (BT-131) - Sum of allowances on document level (BT-107) + Sum of charges on document level (BT-108).
context
cac:LegalMonetaryTotal
test
(
  (cbc:ChargeTotalAmount) and
  (cbc:AllowanceTotalAmount) and
  (
    xs:decimal(cbc:TaxExclusiveAmount) =
    round(
      (xs:decimal(cbc:LineExtensionAmount) +
        xs:decimal(cbc:ChargeTotalAmount) -
        xs:decimal(cbc:AllowanceTotalAmount)
      ) * 10 * 10
    ) div 100
  )
) or
(
  not(
    cbc:ChargeTotalAmount) and
  (cbc:AllowanceTotalAmount) and
  (
    xs:decimal(cbc:TaxExclusiveAmount) =
    round(
      (xs:decimal(cbc:LineExtensionAmount) -
        xs:decimal(cbc:AllowanceTotalAmount)
      ) * 10 * 10
    ) div 100
  )
) or
(
  (cbc:ChargeTotalAmount) and
  not(cbc:AllowanceTotalAmount) and
  (
    xs:decimal(cbc:TaxExclusiveAmount) =
    round(
      (xs:decimal(cbc:LineExtensionAmount) +
        xs:decimal(cbc:ChargeTotalAmount)
      ) * 10 * 10
    ) div 100
  )
) or
(
  not(
    cbc:ChargeTotalAmount) and
  not(cbc:AllowanceTotalAmount) and
  (
    xs:decimal(cbc:TaxExclusiveAmount) =
    xs:decimal(cbc:LineExtensionAmount)
  )
)
BR-DEC-23 (fatal)
The allowed maximum number of decimals for the Invoice line net amount (BT-131) is 2.
context
cac:InvoiceLine |
cac:CreditNoteLine
test
string-length(substring-after(cbc:LineExtensionAmount,'.'))<=2
BR-E-08 (fatal)
In a VAT breakdown (BG-23) where the VAT category code (BT-118) is "Exempt from VAT" the VAT category taxable amount (BT-116) shall equal the sum of Invoice line net amounts (BT-131) minus the sum of Document level allowance amounts (BT-92) plus the sum of Document level charge amounts (BT-99) where the VAT category codes (BT-151, BT-95, BT-102) are "Exempt from VAT".
context
/*/cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[normalize-space(cbc:ID) = 'E'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']
test
(exists(//cac:InvoiceLine) and
  (
    xs:decimal(../cbc:TaxableAmount) =
    (sum(../../../cac:InvoiceLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='E']/xs:decimal(cbc:LineExtensionAmount)) +
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='E']/xs:decimal(cbc:Amount)) -
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='E']/xs:decimal(cbc:Amount))))) or
(exists(//cac:CreditNoteLine) and
  (
    xs:decimal(../cbc:TaxableAmount) =
    (sum(../../../cac:CreditNoteLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='E']/xs:decimal(cbc:LineExtensionAmount)) +
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='E']/xs:decimal(cbc:Amount)) -
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='E']/xs:decimal(cbc:Amount))
    )
  )
)
BR-G-08 (fatal)
In a VAT breakdown (BG-23) where the VAT category code (BT-118) is "Export outside the EU" the VAT category taxable amount (BT-116) shall equal the sum of Invoice line net amounts (BT-131) minus the sum of Document level allowance amounts (BT-92) plus the sum of Document level charge amounts (BT-99) where the VAT category codes (BT-151, BT-95, BT-102) are "Export outside the EU".
context
/*/cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[normalize-space(cbc:ID) = 'G'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']
test
(exists(//cac:InvoiceLine) and
  (
    xs:decimal(../cbc:TaxableAmount) =
    (sum(../../../cac:InvoiceLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='G']/xs:decimal(cbc:LineExtensionAmount)) +
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='G']/xs:decimal(cbc:Amount)) -
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='G']/xs:decimal(cbc:Amount))))) or
(exists(//cac:CreditNoteLine) and
  (
    xs:decimal(../cbc:TaxableAmount) =
    (sum(../../../cac:CreditNoteLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='G']/xs:decimal(cbc:LineExtensionAmount)) +
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='G']/xs:decimal(cbc:Amount)) -
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='G']/xs:decimal(cbc:Amount))
    )
  )
)
BR-IC-08 (fatal)
In a VAT breakdown (BG-23) where the VAT category code (BT-118) is "Intra-community supply" the VAT category taxable amount (BT-116) shall equal the sum of Invoice line net amounts (BT-131) minus the sum of Document level allowance amounts (BT-92) plus the sum of Document level charge amounts (BT-99) where the VAT category codes (BT-151, BT-95, BT-102) are "Intra-community supply".
context
/*/cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[normalize-space(cbc:ID) = 'K'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']
test
(exists(//cac:InvoiceLine) and
  (
    xs:decimal(../cbc:TaxableAmount) =
    (sum(../../../cac:InvoiceLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='K']/xs:decimal(cbc:LineExtensionAmount)) +
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='K']/xs:decimal(cbc:Amount)) -
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='K']/xs:decimal(cbc:Amount))))) or
(exists(//cac:CreditNoteLine) and
  (
    xs:decimal(../cbc:TaxableAmount) =
    (sum(../../../cac:CreditNoteLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='K']/xs:decimal(cbc:LineExtensionAmount)) +
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='K']/xs:decimal(cbc:Amount)) -
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='K']/xs:decimal(cbc:Amount))
    )
  )
)
BR-IG-08 (fatal)
For each different value of VAT category rate (BT-119) where the VAT category code (BT-118) is "IGIC", the VAT category taxable amount (BT-116) in a VAT breakdown (BG-23) shall equal the sum of Invoice line net amounts (BT-131) plus the sum of document level charge amounts (BT-99) minus the sum of document level allowance amounts (BT-92) where the VAT category code (BT-151, BT-102, BT-95) is "IGIC" and the VAT rate (BT-152, BT-103, BT-96) equals the VAT category rate (BT-119).
context
/*/cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[normalize-space(cbc:ID) = 'L'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']
test
every $rate in xs:decimal(cbc:Percent) satisfies
((exists(//cac:InvoiceLine) and
    (
      (../xs:decimal(cbc:TaxableAmount -
          1) < (sum(../../../cac:InvoiceLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='L'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent) =$rate]/xs:decimal(cbc:LineExtensionAmount)) +
          sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='L'][cac:TaxCategory/xs:decimal(cbc:Percent) =
            $rate]/xs:decimal(cbc:Amount)) -
          sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='L'][cac:TaxCategory/xs:decimal(cbc:Percent) =
            $rate]/xs:decimal(cbc:Amount)))) and
      (../xs:decimal(cbc:TaxableAmount +
          1) > (sum(../../../cac:InvoiceLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='L'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent) =$rate]/xs:decimal(cbc:LineExtensionAmount)) +
          sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='L'][cac:TaxCategory/xs:decimal(cbc:Percent) =
            $rate]/xs:decimal(cbc:Amount)) -
          sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='L'][cac:TaxCategory/xs:decimal(cbc:Percent) =
            $rate]/xs:decimal(cbc:Amount)))))) or
  (exists(//cac:CreditNoteLine) and
    (
      (../xs:decimal(cbc:TaxableAmount -
          1) < (sum(../../../cac:CreditNoteLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='L'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent) =$rate]/xs:decimal(cbc:LineExtensionAmount)) +
          sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='L'][cac:TaxCategory/xs:decimal(cbc:Percent) =
            $rate]/xs:decimal(cbc:Amount)) -
          sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='L'][cac:TaxCategory/xs:decimal(cbc:Percent) =
            $rate]/xs:decimal(cbc:Amount)))) and
      (../xs:decimal(cbc:TaxableAmount +
          1) > (sum(../../../cac:CreditNoteLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='L'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent) =$rate]/xs:decimal(cbc:LineExtensionAmount)) +
          sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='L'][cac:TaxCategory/xs:decimal(cbc:Percent) =
            $rate]/xs:decimal(cbc:Amount)) -
          sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='L'][cac:TaxCategory/xs:decimal(cbc:Percent) =
            $rate]/xs:decimal(cbc:Amount))))
    )
  )
)
BR-IP-08 (fatal)
For each different value of VAT category rate (BT-119) where the VAT category code (BT-118) is "IPSI", the VAT category taxable amount (BT-116) in a VAT breakdown (BG-23) shall equal the sum of Invoice line net amounts (BT-131) plus the sum of document level charge amounts (BT-99) minus the sum of document level allowance amounts (BT-92) where the VAT category code (BT-151, BT-102, BT-95) is "IPSI" and the VAT rate (BT-152, BT-103, BT-96) equals the VAT category rate (BT-119).
context
/*/cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[normalize-space(cbc:ID) = 'M'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']
test
every $rate in xs:decimal(cbc:Percent) satisfies
((exists(//cac:InvoiceLine) and
    (
      (../xs:decimal(cbc:TaxableAmount -
          1) < (sum(../../../cac:InvoiceLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='M'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent) =$rate]/xs:decimal(cbc:LineExtensionAmount)) +
          sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='M'][cac:TaxCategory/xs:decimal(cbc:Percent) =
            $rate]/xs:decimal(cbc:Amount)) -
          sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='M'][cac:TaxCategory/xs:decimal(cbc:Percent) =
            $rate]/xs:decimal(cbc:Amount)))) and
      (../xs:decimal(cbc:TaxableAmount +
          1) > (sum(../../../cac:InvoiceLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='M'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent) =$rate]/xs:decimal(cbc:LineExtensionAmount)) +
          sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='M'][cac:TaxCategory/xs:decimal(cbc:Percent) =
            $rate]/xs:decimal(cbc:Amount)) -
          sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='M'][cac:TaxCategory/xs:decimal(cbc:Percent) =
            $rate]/xs:decimal(cbc:Amount)))))) or
  (exists(//cac:CreditNoteLine) and
    (
      (../xs:decimal(cbc:TaxableAmount -
          1) < (sum(../../../cac:CreditNoteLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='M'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent) =$rate]/xs:decimal(cbc:LineExtensionAmount)) +
          sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='M'][cac:TaxCategory/xs:decimal(cbc:Percent) =
            $rate]/xs:decimal(cbc:Amount)) -
          sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='M'][cac:TaxCategory/xs:decimal(cbc:Percent) =
            $rate]/xs:decimal(cbc:Amount)))) and
      (../xs:decimal(cbc:TaxableAmount +
          1) > (sum(../../../cac:CreditNoteLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='M'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent) =$rate]/xs:decimal(cbc:LineExtensionAmount)) +
          sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='M'][cac:TaxCategory/xs:decimal(cbc:Percent) =
            $rate]/xs:decimal(cbc:Amount)) -
          sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='M'][cac:TaxCategory/xs:decimal(cbc:Percent) =
            $rate]/xs:decimal(cbc:Amount))))
    )
  )
)
BR-O-08 (fatal)
In a VAT breakdown (BG-23) where the VAT category code (BT-118) is " Not subject to VAT" the VAT category taxable amount (BT-116) shall equal the sum of Invoice line net amounts (BT-131) minus the sum of Document level allowance amounts (BT-92) plus the sum of Document level charge amounts (BT-99) where the VAT category codes (BT-151, BT-95, BT-102) are "Not subject to VAT".
context
/*/cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[normalize-space(cbc:ID) = 'O'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']
test
(exists(//cac:InvoiceLine) and
  (
    xs:decimal(../cbc:TaxableAmount) =
    (sum(../../../cac:InvoiceLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='O']/xs:decimal(cbc:LineExtensionAmount)) +
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='O']/xs:decimal(cbc:Amount)) -
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='O']/xs:decimal(cbc:Amount))))) or
(exists(//cac:CreditNoteLine) and
  (
    xs:decimal(../cbc:TaxableAmount) =
    (sum(../../../cac:CreditNoteLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='O']/xs:decimal(cbc:LineExtensionAmount)) +
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='O']/xs:decimal(cbc:Amount)) -
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='O']/xs:decimal(cbc:Amount))
    )
  )
)
BR-S-08 (fatal)
For each different value of VAT category rate (BT-119) where the VAT category code (BT-118) is "Standard rated", the VAT category taxable amount (BT-116) in a VAT breakdown (BG-23) shall equal the sum of Invoice line net amounts (BT-131) plus the sum of document level charge amounts (BT-99) minus the sum of document level allowance amounts (BT-92) where the VAT category code (BT-151, BT-102, BT-95) is "Standard rated" and the VAT rate (BT-152, BT-103, BT-96) equals the VAT category rate (BT-119).
context
/*/cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[normalize-space(cbc:ID) = 'S'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']
test
every $rate in xs:decimal(cbc:Percent) satisfies
(((exists(//cac:InvoiceLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID) =
        'S'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent) =$rate]) or
      exists(//cac:AllowanceCharge[cac:TaxCategory/normalize-space(cbc:ID)='S'][cac:TaxCategory/xs:decimal(cbc:Percent) =
        $rate])) and
    (
      (../xs:decimal(cbc:TaxableAmount -
          1) < (sum(../../../cac:InvoiceLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='S'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent) =$rate]/xs:decimal(cbc:LineExtensionAmount)) +
          sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='S'][cac:TaxCategory/xs:decimal(cbc:Percent) =
            $rate]/xs:decimal(cbc:Amount)) -
          sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='S'][cac:TaxCategory/xs:decimal(cbc:Percent) =
            $rate]/xs:decimal(cbc:Amount)))) and
      (../xs:decimal(cbc:TaxableAmount +
          1) > (sum(../../../cac:InvoiceLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='S'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent) =$rate]/xs:decimal(cbc:LineExtensionAmount)) +
          sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='S'][cac:TaxCategory/xs:decimal(cbc:Percent) =
            $rate]/xs:decimal(cbc:Amount)) -
          sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='S'][cac:TaxCategory/xs:decimal(cbc:Percent) =
            $rate]/xs:decimal(cbc:Amount)))))) or
  (exists(//cac:CreditNoteLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID) =
      'S'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent) =$rate]) or
    exists(//cac:AllowanceCharge[cac:TaxCategory/normalize-space(cbc:ID)='S'][cac:TaxCategory/xs:decimal(cbc:Percent) =
      $rate])) and
  (
    (../xs:decimal(cbc:TaxableAmount -
        1) < (sum(../../../cac:CreditNoteLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='S'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent) =$rate]/xs:decimal(cbc:LineExtensionAmount)) +
        sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='S'][cac:TaxCategory/xs:decimal(cbc:Percent) =
          $rate]/xs:decimal(cbc:Amount)) -
        sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='S'][cac:TaxCategory/xs:decimal(cbc:Percent) =
          $rate]/xs:decimal(cbc:Amount)))) and
    (../xs:decimal(cbc:TaxableAmount +
        1) > (sum(../../../cac:CreditNoteLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='S'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent) =$rate]/xs:decimal(cbc:LineExtensionAmount)) +
        sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='S'][cac:TaxCategory/xs:decimal(cbc:Percent) =
          $rate]/xs:decimal(cbc:Amount)) -
        sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='S'][cac:TaxCategory/xs:decimal(cbc:Percent) =
          $rate]/xs:decimal(cbc:Amount)))
    )
  )
)
BR-Z-08 (fatal)
In a VAT breakdown (BG-23) where VAT category code (BT-118) is "Zero rated" the VAT category taxable amount (BT-116) shall equal the sum of Invoice line net amount (BT-131) minus the sum of Document level allowance amounts (BT-92) plus the sum of Document level charge amounts (BT-99) where the VAT category codes (BT-151, BT-95, BT-102) are "Zero rated".
context
/*/cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[normalize-space(cbc:ID) = 'Z'][cac:TaxScheme/normalize-space(upper-case(cbc:ID))='VAT']
test
(exists(//cac:InvoiceLine) and
  (
    xs:decimal(../cbc:TaxableAmount) =
    (sum(../../../cac:InvoiceLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='Z']/xs:decimal(cbc:LineExtensionAmount)) +
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='Z']/xs:decimal(cbc:Amount)) -
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='Z']/xs:decimal(cbc:Amount))))) or
(exists(//cac:CreditNoteLine) and
  (
    xs:decimal(../cbc:TaxableAmount) =
    (sum(../../../cac:CreditNoteLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='Z']/xs:decimal(cbc:LineExtensionAmount)) +
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='Z']/xs:decimal(cbc:Amount)) -
      sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='Z']/xs:decimal(cbc:Amount))
    )
  )
)