Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

commercial calculation requires xs:decimal insted of xs:double #55

Closed
LRabeDE opened this issue Feb 16, 2018 · 0 comments
Closed

commercial calculation requires xs:decimal insted of xs:double #55

LRabeDE opened this issue Feb 16, 2018 · 0 comments

Comments

@LRabeDE
Copy link

LRabeDE commented Feb 16, 2018

With the current approach, numbers from a XML document are converted to xs:double for further use (fn:number). Using this type (xs: double) does not allow the accuracy of calculations required for the commercial sector. I added a sample invoice for demonstration.
example for type problem.zip In this example the following elements are leading to a validation problem in the Context of BR-S-09:

<cac:TaxTotal> <cbc:TaxAmount currencyID="EUR">5.65</cbc:TaxAmount> <cac:TaxSubtotal> <cbc:TaxableAmount currencyID="EUR">29.75</cbc:TaxableAmount> <cbc:TaxAmount currencyID="EUR">1.79</cbc:TaxAmount> <cac:TaxCategory> <cbc:ID>S</cbc:ID> <cbc:Percent>6</cbc:Percent> <cac:TaxScheme> <cbc:ID>VAT</cbc:ID> </cac:TaxScheme> </cac:TaxCategory> </cac:TaxSubtotal> </cac:TaxTotal>

From my point of view, it seems necessary to type all values used for the calculation as xs:decimal. The following (dirty) example in XSLT shows how the underlying calculation of the BR-S-09 should be adjusted to solve the problem.

<xsl:when test="xs:decimal(../cbc:TaxAmount) = (round(((xs:decimal(../cbc:TaxableAmount)) * (xs:decimal(cbc:Percent) div 100)) * 10 * 10) div 100 )"/>

Note: this is NOT a specific Problem of the implementation of the BR-S-09 in UBL but (at least to my understandig) a common implementation problem.

@oriol oriol closed this as completed Feb 23, 2018
@phax phax added this to the v1.1 milestone Feb 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants