[ 
https://issues.apache.org/jira/browse/OFBIZ-4326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13056577#comment-13056577
 ] 

David E. Jones commented on OFBIZ-4326:
---------------------------------------

Stéphane,

What is it you are trying to accomplish? I can tell you for sure that there is 
no reliable way to get an even number as desired when the ProductPrice amount 
does not include tax (ie it is stored in the database with tax excluded). I 
worked on this over the course of a few weeks last year for a client making 
little tweaks here and there to improve the accuracy and precision of the 
numbers, but there are ALWAYS edge cases, and we came up with a few that were 
simply not possible to accommodate when the ProductPrice did not have taxes 
included, it's simply not possible when working with only 3 decimal digits.

The only solution is to store price with tax included, and calculate the tax 
based on the amount with tax included. In other words, the only way it will be 
mathematically correct is to follow the formulas dictated by most VAT/IVA/etc 
law.

This is a REAL pain, but does work. OFBiz supports this OOTB in the trunk and 
the 11.04 release branch. The tax adjustments have an amountAlreadyIncluded of 
the tax amount, and the normal adjustment amount is always 0 so that you know 
how much the tax is, but you don't mess up the total by adding it in again.

> VAT Correction for ProductPrice that has priceWithTax =N is not correct (with 
> patch)
> ------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-4326
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-4326
>             Project: OFBiz
>          Issue Type: Bug
>          Components: accounting
>    Affects Versions: SVN trunk
>            Reporter: Stéphane DUCAS
>            Priority: Minor
>         Attachments: OFBIZ-4326_round_price_in_cart.patch, 
> vatCorrection.patch, vatCorrection_2.patch, vatCorrection_2.patch
>
>
> The VAT correction adjustment is not correct because it's based on the price 
> not rounded (while tax adjustment is calculated from the rounded price).
> I provide the patch for that.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to