anskaffelser / ehf-postaward-g2

Specifications part of EHF Post-Award, 2nd generation.
33 stars 37 forks source link

Error: BII2-T10-R056 fires for correct values #109

Closed Jasak closed 9 years ago

Jasak commented 9 years ago

Current release validator started to throw BII2-T10-R056 error for the following case:

<cac:TaxTotal>
        <cbc:TaxAmount currencyID="NOK">0.00</cbc:TaxAmount>
        <cac:TaxSubtotal>
            <cbc:TaxableAmount currencyID="NOK">234.64</cbc:TaxableAmount>
            <cbc:TaxAmount currencyID="NOK">0.00</cbc:TaxAmount>
            <cac:TaxCategory>
                <cbc:ID schemeID="UNCL5305">Z</cbc:ID>
                <cbc:Percent>0.0000</cbc:Percent>
                <cac:TaxScheme>
                    <cbc:ID>VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:TaxCategory>
        </cac:TaxSubtotal>
    </cac:TaxTotal>
    <cac:LegalMonetaryTotal>
        <cbc:LineExtensionAmount currencyID="NOK">214.64</cbc:LineExtensionAmount>
        <cbc:TaxExclusiveAmount currencyID="NOK">234.64</cbc:TaxExclusiveAmount>
        <cbc:TaxInclusiveAmount currencyID="NOK">234.64</cbc:TaxInclusiveAmount>
        <cbc:ChargeTotalAmount currencyID="NOK">20.00</cbc:ChargeTotalAmount>
        <cbc:PrepaidAmount currencyID="NOK">0.00</cbc:PrepaidAmount>
        <cbc:PayableRoundingAmount currencyID="NOK">0.01</cbc:PayableRoundingAmount>
        <cbc:PayableAmount currencyID="NOK">234.65</cbc:PayableAmount>
    </cac:LegalMonetaryTotal>

Test defined by this rule is:

Test: ((cbc:PrepaidAmount) and (number(cbc:PayableAmount) = (round((cbc:TaxInclusiveAmount - cbc:PrepaidAmount) * 10 * 10) div 100)) 
or 
number(cbc:PayableAmount) = number(cbc:TaxInclusiveAmount)) 
or
 ((cbc:PrepaidAmount) and (cbc:PayableRoundingAmount) and ((number(cbc:PayableAmount) -number(cbc:PayableRoundingAmount)) = (round((cbc:TaxInclusiveAmount - cbc:PrepaidAmount) * 10 * 10) div 100)) 
or
 (number(cbc:PayableAmount) - number(cbc:PayableRoundingAmount))= number(cbc:TaxInclusiveAmount)), 
Location: /*:Invoice[namespace-uri()='urn:oasis:names:specification:ubl:schema:xsd:Invoice-2'][1]/*:LegalMonetaryTotal[namespace-uri()='urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2'][1]

So it should be true for (number(cbc:PayableAmount) - number(cbc:PayableRoundingAmount))= number(cbc:TaxInclusiveAmount))

234.65 - 0.01 = 234.64

Did I miss something or this is a bug?

SiwMeckelborg commented 9 years ago

could you please send the entire file that is failing to siw.meckelborg@edisys.no so I can do some testing.

SiwMeckelborg commented 9 years ago

Hi, TaxInclusiveAmount must be including the PayableRoundingAmount: See guide chapter 6.4.2: "The element MonetaryTotal/PayableRoundingAmount is used for this and is specified on the header level. This value must be added to the value in MonetaryTotal/TaxInclusiveAmount."

changed your file to have TaxInclusive = 234.65 and file is validated ok.

Jasak commented 9 years ago

Thanks for your help.

cdruschk commented 9 years ago

Hi!

I get the same error when I have ".00" as decimals on only one amount while the other amounts don´t have decimals like this:

cac:LegalMonetaryTotal

65280/cbc:LineExtensionAmount 65280/cbc:TaxExclusiveAmount 81600/cbc:TaxInclusiveAmount 81600.00/cbc:PayableAmount /cac:LegalMonetaryTotal This should be validating fine from business perspective, but it is generating an error and would stop the invoice.