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: vatCorrection.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 |
[ https://issues.apache.org/jira/browse/OFBIZ-4326?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Stéphane DUCAS updated OFBIZ-4326: ---------------------------------- Attachment: vatCorrection.patch > 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: vatCorrection.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 |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13054452#comment-13054452 ] Stéphane DUCAS commented on OFBIZ-4326: --------------------------------------- The patch is not correct, I'll post a new one.. don't integrate the firt one!! (so sorry) > 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: vatCorrection.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 |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4326?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Stéphane DUCAS updated OFBIZ-4326: ---------------------------------- Attachment: vatCorrection_2.patch > 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: vatCorrection.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 |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4326?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Stéphane DUCAS updated OFBIZ-4326: ---------------------------------- Attachment: vatCorrection_2.patch > 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: 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 |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13054491#comment-13054491 ] Stéphane DUCAS commented on OFBIZ-4326: --------------------------------------- vatCorrection_2.patch is tested and correct.. > 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: 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 |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13054516#comment-13054516 ] Jacques Le Roux commented on OFBIZ-4326: ---------------------------------------- Hi Stéphane, A best practice is to use the same name for patches. As you can se, Jira will gray the old ones. Hence it's easier for us to pick the right one w/out referring to comments. Also, though it's not mandatory, we like to have patches prefixed with the Jira number and named with the title of the issue, eg {code} OFBIZ-4257_add_a_parameter_to_forbid_order_decimal_quantity.patch OFBIZ-4235-ShoppingCartItem.java.patch OFBIZ-4213_Add compilerarg value=-Xlint.patch {code} I'd not ask you that if I'd not have seen that you were contiously contributing these last times ;) Thanks for your contributions! > 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: 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 |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13056234#comment-13056234 ] Paul Foxworthy commented on OFBIZ-4326: --------------------------------------- Hi Stéphane, Could you say a bit more about the problem you've found? I don't understand what the problem is with rounding. I don't think your suggested fix will do the job. The itemPrice parameter will have the price the user entered, which might be different from the list price or any other standard price. If the list price includes tax, lines 434-537 are working out the difference between the tax including in the list price and the tax included in the actual price for this order, and putting in the difference as an order adjustment. If the problem is with rounding, why not just round the itemPrice, or round enteredTotalPriceWithTax when it's calculated on line 515? Thanks Paul Foxworthy > 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: 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 |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13056234#comment-13056234 ] Paul Foxworthy edited comment on OFBIZ-4326 at 6/28/11 3:32 AM: ---------------------------------------------------------------- Hi Stéphane, Could you say a bit more about the problem you've found? I don't understand what the problem is with rounding. I don't think your suggested fix will do the job. The itemPrice parameter will have the price the user entered, which might be different from the list price or any other standard price. If the list price doesn't already include tax, lines 434-537 are working out the difference between the priceWithTax and the tax included in the actual price for this order, and putting in the difference as an order adjustment. If the problem is with rounding, why not just round the price variable, or round enteredTotalPriceWithTax when it's calculated on line 515? Thanks Paul Foxworthy was (Author: paul_foxworthy): Hi Stéphane, Could you say a bit more about the problem you've found? I don't understand what the problem is with rounding. I don't think your suggested fix will do the job. The itemPrice parameter will have the price the user entered, which might be different from the list price or any other standard price. If the list price includes tax, lines 434-537 are working out the difference between the tax including in the list price and the tax included in the actual price for this order, and putting in the difference as an order adjustment. If the problem is with rounding, why not just round the itemPrice, or round enteredTotalPriceWithTax when it's calculated on line 515? Thanks Paul Foxworthy > 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: 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 |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13056364#comment-13056364 ] Stéphane DUCAS commented on OFBIZ-4326: --------------------------------------- Hello Jacques and Paul. @Jacques: No problem 'll do that for the next patches thx for advises @Paul: You're right that my fix wasn't enough in my case. First I noticed that when I Recalculate Order the amount of the vat correction was changing (at last step).. I think the cause is that the amount is rounded at UI side so when the user press recalculate order the itemPrice is rounded (EG:: without recalculation itemPrice=20.895, with recalculation itemPrice=20.90). tax included are calculated with the itemPrice (rounded when recalculated) and vat correction is calculated with the not rounded price (the one in database wich is almost always three decimals because it is the result of a division). So in addition to my fix I hacked ShoppingCartItem.java at line 1211 to round the basePrice at two decimals. (I post the patch now). In fact the new patch patch may be enought so you can maybe forget about the old one.. or neither of them is the correct way to do it.. but with them I can have VAT included price of 24.99 EUR from the shopping cart to the invoice with or without order recalculation. I'm sorry I can't look deeply for the causes and propose the right patch beacause I have to hurry for my customer but I will study more precisly the issue when my project is done. > 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 |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4326?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Stéphane DUCAS updated OFBIZ-4326: ---------------------------------- Attachment: OFBIZ-4326_round_price_in_cart.patch > 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 |
In reply to this post by Nicolas Malin (Jira)
[ 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 |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-4326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13057722#comment-13057722 ] Stéphane DUCAS commented on OFBIZ-4326: --------------------------------------- Hi David thx for your answer, I'm trying to allow my client to set prices with VAT that will persit as defined by my client from the cart to the invoice. This is the case in most french B2C businesses and for them 24,99 EUR is not 25EUR for commercial/marketing reasons. For getting the behavior on the trunk release do I have to set VAT included = Y on my price? When I do so, the tax is not added so the total is correct BUT the VAT price of the total appears nowhere. That's why I currently use this setting on price: Vat Authority ID: French Authority VAT geo ID: FRA Price In Tax: N With that setting when my client type 24,99 Eur ofbiz store in database 20.895 in price and 24.99 in priceWithTax of the ProductPrice entity. Then when creating an order ofbiz calculate a VAT correction that should ensure that the total price is 24.99 (for a quantity of one). Is this the correct way to implement this with trunk version? THX > 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 |
Free forum by Nabble | Edit this page |