Closed cdruschk closed 5 years ago
Please provide a document where wrong value in /Invoice/TaxTotal/TaxSubtotal/TaxableAmount
does not trigger an error.
I correct my issue description as follows:
NONAT-T10-R029 The intention of the rule is to check that the taxable amount in a tax subtotal on document level is the sum of all invoice lines and allowances and charges on document level with the same tax category.
Instead of using only the tax subtotal on document level the rule runs the check on every occurrence of //cac:TaxSubtotal/cbc:TaxableAmount. That means if there is that kind of element on line level then this rule tries to match each line item's //cbc:TaxableAmount with the total of all line's LineExtensionAmounts and allowances and charges. And this works only if there is only one single line in the whole invoice.
This is wrong. The NONAT-T10-R029 is not checking only elements being part of EHF invoice as /Invoice/InvoiceLine/TaxTotal/TaxSubtotal is outside the EHF specification.
This is how the schematron rule currently looks:
<rule context="cac:TaxSubtotal">
<let name="category" value="normalize-space(cac:TaxCategory/cbc:ID)"/>
<let name="sumLineExtensionAmount" value="xs:decimal(sum(/ubl:Invoice/cac:InvoiceLine[normalize-space(cac:Item/cac:ClassifiedTaxCategory/cbc:ID) = $category]/cbc:LineExtensionAmount))"/>
<let name="sumAllowance" value="xs:decimal(sum(/ubl:Invoice/cac:AllowanceCharge[normalize-space(cac:TaxCategory/cbc:ID) = $category][cbc:ChargeIndicator = 'false']/cbc:Amount))"/>
<let name="sumCharge" value="xs:decimal(sum(/ubl:Invoice/cac:AllowanceCharge[normalize-space(cac:TaxCategory/cbc:ID) = $category][cbc:ChargeIndicator = 'true']/cbc:Amount))"/>
<assert id="NONAT-T10-R029"
test="xs:decimal(cbc:TaxableAmount) = u:twodec($sumLineExtensionAmount - $sumAllowance + $sumCharge)"
flag="fatal">[NONAT-T10-R029]-Taxable amount in a tax subtotal MUST be the sum of line extension amount of all invoice lines and allowances and charges on document level with the same tax category.</assert>
</rule>
I think the issue can be fixed by changing the context as follows:
<rule context="Invoice/cac:TaxTotal/cac:TaxSubtotal">
If you want to ensure that nobody includes the /Invoice/cac:TaxTotal/cac:TaxSubtotal structure in an EHF invoice then a simpler check like this would be more straight forward:
<rule context="cac:InvoiceLine">
<assert id="NONAT-T10-R0XX"
test="cac:TaxTotal/cac:TaxSubtotal"
flag="fatal">[NONAT-T10-R0XX]-Each invoice line MUST NOT contain the cac:TaxTotal/cac:TaxSubtotal element.</assert>`
</rule>
I agree with cdruschk. This rule is creating issues for the customers of ours that have specified TaxSubtotal on lines. If the intention of the rule is: "Check that the taxable amount in a tax subtotal on document level is the sum of all invoice lines and allowances and charges on document level with the same tax category."
then the rule is not specified correctly. The rule is triggered on line level and makes otherwise ok files fail in validation.
@BruCan Where may I find information regarding specifying TaxSubtotal on lines?
Sorry, I am not sure what you asking me about. Are you asking about where the Peppol documentation may be found?
I'm asking about where I may find information on how to specify TaxSubtotal on line level.
@BruCan @cdruschk So where may I find documentation on how to specify TaxSubtotal on line level in invoice?
@klakegg - Can see that the guideline for EHF has not stated this specific section on line level. Will raise this in Peppol context. However - rule is still not working as intended. As @cdruschk states - the error message does not correspond to the actual error.
@BruCan Why are people adding TaxSubtotal on line level when such use is not defined in the standard?
I believe ClassifiedTaCategory is used in EHF for this purpose.
ClassifiedTaxCategory
Please make sure this box is checked before submitting your issue - thank you!
Issues related to PEPPOL BIS or rules part of PEPPOL BIS must be sent to rfc@peppol.eu.
Your issue here:
NONAT-T10-R029 The intention of the rule is to check that the taxable amount in a tax subtotal on document level is the sum of all invoice lines and allowances and charges on document level with the same tax category. Instead of using the tax subtotal on document level for this check it uses the taxable amount in a tax subtotal on line level. This is wrong. The NONAT-T10-R029 is not checking according to elements part of EHF invoice as /Invoice/InvoiceLine/TaxTotal/TaxSubtotal is outside the EHF specification.