[ https://issues.apache.org/jira/browse/OFBIZ-10500?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jacques Le Roux closed OFBIZ-10500. ----------------------------------- Resolution: Invalid I close. I agree with Ankush, it's working. I did a test for [~wp.rauchholz] and [it worked|https://markmail.org/message/wnuo5ng5pdpg7jex]. After that I updated [the point on VAT in FAQ|https://cwiki.apache.org/confluence/display/OFBIZ/FAQ+-+Tips+-+Tricks+-+Cookbook+-+HowTo#FAQ-Tips-Tricks-Cookbook-HowTo-PricesWithVAT] Thanks Ankush. Please reopen Frank if you disagree and have more to say, thanks > Tax calculation incorrect when creating orders > ---------------------------------------------- > > Key: OFBIZ-10500 > URL: https://issues.apache.org/jira/browse/OFBIZ-10500 > Project: OFBiz > Issue Type: Bug > Components: order > Affects Versions: Release Branch 16.11 > Environment: OpenJDK 1.8.0_151 64bit on Ubuntu 16.04 > Reporter: Frank Herrman > Assignee: Ankush Upadhyay > Priority: Major > Attachments: Invoice.png, OrderReview.png, Schermafbeelding > 2018-07-30 om 10.15.51.png, Schermafbeelding 2018-07-30 om 10.16.16.png, > Shipping.png, Stores.png, VAT.png > > > After a > [discussion|https://lists.apache.org/thread.html/adf568edad92255340697f78ea4f34a07e328cc1689b8fb73e16fa53@%3Cuser.ofbiz.apache.org%3E] > on the user mailinglist we concluded there seems to be an issue with the tax > calculations. > *Steps to reproduce* > * Create a tax authority for a specific country (e.g. The Netherlands in my > case) > * Set sales tax rate of 21% for your store with this Tax Authority > * Create a product and enter a price either including or excluding taxes and > set the corresponding flag for tax included y/n. > * Go to the order manager and order entry. Fill in the details, select the > product and go to the review page. It now shows the incorrect sales tax and > price. > Let's say we have a product of 20 euro incl. taxes. With 21% that comes down > to 3.47 euro of taxes and a price of 16.53 euro. Instead Ofbiz shows a price > of 20 euro excl. taxes and adds 4.20 euros in taxes. > *What I tried* > Changing the price to price excl. VAT and set the flag to 'N' and visa versa. > Both gave the same error. > *Possible solution* > I digged into the code and ended up in the file: > {{applications/order/groovyScripts/entry/OrderReadHelper.java}} > The function in line 2401 > {code:java} > public static BigDecimal getOrderItemSubTotal(GenericValue orderItem, > List<GenericValue> adjustments, boolean forTax, boolean forShipping){code} > returns the price of one item there. It uses this piece of code: > {code:java} > orderItem.getBigDecimal("unitPrice");{code} > The line item is always the price including taxes. When I adjust this price > (by dividing it by 1.21) I do get the correct price in the review page. I do > not, however, get the right tax amount. This is calculated elsewhere and > still using the 20 euro price I guess. Anyway, it does show I was in the > right spot. > I'm not familiar enough with Ofbiz to create a full patch, but I think the > easiest way to go is to add another column to order items where the value > excl. taxes is stored which can be used in places where needed. This does not > affect the whole system. On the other hand I'm not sure where the order items > are stored, since when you are on the review page it is not stored in > database yet. Probably just in the session? Should make things even easier. > The attachments show an example. I have stored a product of 20 euro > (screenshot directly taken from the database tool) and I have set-up a tax > exempt in this case for a customer which shows 4.20 euro sales tax. If I turn > off the tax exempt the grand total becomes 24.20 euros, so it is not related > to the exempt. > -- This message was sent by Atlassian JIRA (v7.6.3#76005)