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

Ankush Upadhyay commented on OFBIZ-10500:
-----------------------------------------

[~FrankH],

I tried to replicate the issue reported in ticket description with following 
data:

{code}

<Party partyId="NLD_TA" partyTypeId="PARTY_GROUP" statusId="PARTY_ENABLED"/>
 
<PartyGroup partyId="NLD_TA" groupName="Netherlands Tax Authority"/>
 
<PartyRole partyId="NLD_TA" roleTypeId="TAX_AUTHORITY"/>
 
<TaxAuthority taxIdFormatPattern="\d\{2}\-\d\{7}|\d\{3}\-\d\{2}\-\d\{4}" 
taxAuthGeoId="NLD" taxAuthPartyId="NLD_TA"/>
 
<TaxAuthorityRateProduct taxAuthorityRateSeqId="9006" description="Standard 
E-Commerce Netherlands Tax Rate" fromDate="2016-01-01 00:00:00.0" 
productStoreId="9000" taxAuthGeoId="NLD" taxAuthPartyId="NLD_TA" 
taxAuthorityRateTypeId="VAT_TAX" taxPercentage="21.00" />


<ProductPrice currencyUomId="EUR" fromDate="2012-07-03 00:00:00.0" 
price="20.000" productId="GZ-2644" productPricePurposeId="PURCHASE" 
productPriceTypeId="DEFAULT_PRICE" productStoreGroupId="_NA_" 
taxAuthGeoId="NLD" taxAuthPartyId="NLD_TA" taxInPrice="Y" />

<ProductPrice currencyUomId="EUR" fromDate="2012-07-03 00:00:00.0" 
price="20.000" productId="GZ-2644" productPricePurposeId="PURCHASE" 
productPriceTypeId="LIST_PRICE" productStoreGroupId="_NA_" taxAuthGeoId="NLD" 
taxAuthPartyId="NLD_TA" taxInPrice="Y" />

{code}
And VAT is recorded correctly in OrderAdjustment.amountAlreadyIncluded field. 
Also actual product price and VAT applied is recorded in Order Invoice.
Please review attached screenshots.
 !VAT.png! 
 !Invoice.png! 

 

> 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, Schermafbeelding 2018-07-30 om 
> 10.15.51.png, Schermafbeelding 2018-07-30 om 10.16.16.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)

Reply via email to