In adition to my last e-mail I just found out that it still is not working as 
expected, even when I use prices excl. taxes. I dived into the code and found 
in applications/order/groovyScripts/entry/OrderReadHelper.java the function 
that gets the price on line 2401 (public static BigDecimal 
getOrderItemSubTotal(GenericValue orderItem, List<GenericValue> adjustments, 
boolean forTax, boolean forShipping))



The first line gets the unit price from an order item 
(orderItem.getBigDecimal("unitPrice");), which always includes taxes. Now I 
believe the real issue is that it should store the price excl. taxes in the 
line item as well. But this affects probably a lot of sections of the system. 
To test it I tried to divide the unitPrice by 1.21 in that function. This did 
return the right price and right total, but the tax exempt was of course still 
calculated based on the price of 20 euro excl. taxes (which is 4.20 euros 
instead of 3.47 euros).



Anyway, maybe not the right discussion for the user list, but there really is 
something wrong here. It doesn't seem to be a configuration error.



Kind regards,

 

Frank



Op 30-07-18 11:35 heeft Frank Herrman <f.herr...@typify.com> geschreven:



    Hi Sharan & others,

    

    

    

    I have set it up like this now:

    

    

    

    * All product prices are connected to the Dutch tax authority, no tax rate 
set. Tax included = Y

    

    * I have created 2 tax authorities for The Netherlands and Belgium, 
connected to the same party ('belastingdienst', dutch authority)

    

    * The Dutch tax authority has the tax set up to 21% sales tax for both 
countries

    

    * The Belgium customer is set up to have a tax exempt for BE and 
'belastingdienst'

    

    

    

    When I look in the prices table of the database I see this:

    

    https://ibb.co/kgf8R8 (don't know if images get stripped out, so just 
pasted a link)

    

    

    

    This is correct for price without tax and the tax amount.

    

    

    

    When I create an order within Ofbiz I still get this:

    

    https://ibb.co/h77BeT 

    

    

    

    Which is incorrect (tax exempt is correct, but the amount of 4.20 and the 
final price of 20 is not). It seems the system keeps using the 'price' column 
in the database instead of the calculated prices and adds tax to it. Other then 
that it seems the tax exempt functionality is working as expected now.

    

    

    

    I just created a script that checks all prices if some of them are set to 
Tax included = Y. If that is the case it will set it to 'N' and set the price 
field to the price excl. VAT. It is not a nice solution, but this makes it 
easier to maintain and solves my issues for now.

    

    

    

    Kind regards,

    

     

    

    Frank

    

    

    

    Op 29-07-18 15:57 heeft Sharan Foga <sha...@apache.org> geschreven:

    

    

    

        Hi Frank

    

        

    

        The options I gave were workarounds for if you needed to get something 
up and running quickly. I agree with you that long term we need to solve it 
properly. 

    

        

    

        Analysis Needed

    

        ==========

    

        Why doesn't the include tax in price flag work properly for Tax 
authority setup?

    

        

    

        From my perspective I also see two requirements (so happy to get your 
feedback and anyone else's too :-). 

    

        

    

        Requirement 1:

    

        =========

    

        Using your example as the use case - we need to be able to flag that a 
Belgian customer is liable for tax in the Netherlands. Note this applies in the 
case where it is B2C because the Belgian customer needs to pay Dutch tax. So 
for a Sales Order from a Belgian customer there needs to be line calculated for 
Dutch tax using the Dutch tax rate.

    

        

    

        I think the nexus flag in the Tax Authority parties tab is supposed to 
be used for this but it's not working as such because in OFBiz now the tax 
calculation for the Sales Order is based on the customer delivery address. 

    

        

    

        Requirement 2:

    

        =========

    

        Again using your example as the use case - we need to be able to flag 
that a Belgian customer is exempt from being taxed by the Dutch Tax Authority. 
Note this applies in the case where it is B2B where the Belgian customer is a 
company/business.  So for a Sales Order from a Belgian customer there needs to 
be a line on the Sales order saying that the order is exempt from Dutch tax and 
the amount that has been exempted.

    

        

    

        The exempt flag in the Tax Authority parties tab is supposed to be used 
for this but it's not working as such because in OFBiz now the tax calculation 
for the Sales Order is based on the customer delivery address.

    

        

    

        Please feel free to comment or give me any feedback on any of these 
points.

    

        

    

        Thanks

    

        Sharan

    

        

    

        On 2018/07/29 12:51:18, Frank Herrman <f.herr...@typify.com> wrote: 

    

        > Hi Sharan,

    

        > 

    

        > 

    

        > 

    

        > Thank you very much for your reply, this really helps me. The 
difficulty with entering prices excluding VAT for the store managers is that 
you want to have commercial sales prices. You rather sell your product for 9.95 
euro's then for 10.13 euro's for example. So if you have to enter prices 
excluding VAT you need to keep your calculator with you. That is not very 
user-friendly.

    

        > 

    

        > 

    

        > 

    

        > Your second option, defining the tax authority for every product does 
sound like a good solution. I might create a script even to set it 
automatically if the store managers forget about it. From what you are saying 
(and I already was thinking) we don't really need the Belgium tax authority. We 
don't pay taxes in Belgium, just in the Netherlands. We should get the exempt 
working for the B2B customers on the Dutch authority.

    

        > 

    

        > 

    

        > 

    

        > I will be playing around and let you know what solution worked for 
us. I am also willing to provide input for Jira or even in code, just need to 
find my way around the standards first ;-). Thanks again.

    

        > 

    

        > 

    

        > 

    

        > Kind regards,

    

        > 

    

        >  

    

        > 

    

        > Frank

    

        > 

    

        > 

    

        > 

    

        > Op 27-07-18 16:18 heeft Sharan Foga <sha...@apache.org> geschreven:

    

        > 

    

        > 

    

        > 

    

        >     Hi Frank

    

        > 

    

        >     

    

        > 

    

        >     There are a few things to cover here so I’ll answer what I can.

    

        > 

    

        >     

    

        > 

    

        >     * Including VAT in Product Prices *

    

        > 

    

        >     

    

        > 

    

        >     In general for Sales Orders - the tax setup and flow for OFBiz is 
mainly based on the US system where the product pricing does not include sales 
tax (or VAT). The Sales Tax (or VAT) is calculated once you have selected where 
the order will be shipped to. OFBiz uses the shipping address to define which 
Tax Authority to use to calculate the tax.

    

        > 

    

        >     

    

        > 

    

        >     That being said there are some ways around it.

    

        > 

    

        >     

    

        > 

    

        >     1.  You can setup your product pricing to exclude VAT. This means 
that it will be added back into the Sales Order when it is created. 

    

        > 

    

        >     

    

        > 

    

        >     2. You can setup your product price inclusive of VAT then add the 
tax authority at the product pricing level (so in the Price tab for the actual 
Product). Add the Tax Authority, and set the include tax in the price. Don’t 
include a rate at this level because (OFBiz will ignore it!). The tax rate is 
taken from the main Tax Authority setup.

    

        > 

    

        >     

    

        > 

    

        >     What this will do – is that it will assume that the tax is 
already included in the product price so at Sales Order entry it will separate 
it out. So if you set the product price at 100 Euros and have created the Dutch 
Tax Authority using 21%  then at Sales Order Review you should get an 
adjustment line showing the 17.36 Euros VAT. (Which is 21% VAT on 82.64, and 
82.64+17.36 = 100)

    

        > 

    

        >     

    

        > 

    

        >     What I found was missing was that it doesn’t add the VAT 
adjustment into the VAT Total as part of the Sales Oorder summary. The 
adjustment message actually says VAT not added to totals! (So that is a 
potential fix that needs to be done).

    

        > 

    

        >     

    

        > 

    

        >     3. We can look for someone to volunteer to do some more analysis 
on why the include tax in price flag on the Tax Authorities are not working.

    

        > 

    

        >     

    

        > 

    

        >     If you need to get up and running quickly then options 1 and 2 
should help.

    

        > 

    

        >     

    

        > 

    

        >     * Tax Exemptions *

    

        > 

    

        >     

    

        > 

    

        >     This is interesting because OFBiz has some functionaliy that 
calculates tax exempt amounts based on the flags set for the customer in the 
Tax Authority Parties tab.  For Purchase Order it calculates and displays the 
exempt tax amounts– but for Sales Order it seems to be a bit different.

    

        > 

    

        >     

    

        > 

    

        >     So what is happening with your setup is that you have created a 
Dutch Tax Authority and a Belgian Tax Authority, so when you create a Sales 
Order, OFBiz is looking at the delivery address and then using the Tax 
Authority linked to the delivery location to calculate the taxes. (I think 
Belgium has 21% VAT too!).  This means that if you have a Belgium customer, 
OFBiz ignores the Dutch Tax Authority and is using the Belgian one on your 
order. 

    

        > 

    

        >     

    

        > 

    

        >     The quickest way to stop VAT being calculated on the Belgian 
customer order is to remove the Product Rate from the Belgian Tax Authority and 
setup the Product Pricing to not include VAT.

    

        > 

    

        >     OFBiz will then simply use the Product Price and if it is already 
exclusive of VAT, it will be fine. (If it is inclusive of VAT then you will 
have to do a customisation  to adjust it).

    

        > 

    

        >     

    

        > 

    

        >     I've included some responses to your questions below:

    

        > 

    

        >     

    

        > 

    

        >     On 2018/07/24 08:38:48, Frank Herrman <f.herr...@typify.com> 
wrote: 

    

        > 

    

        >     > Hello there,

    

        > 

    

        >     > 

    

        > 

    

        >     > Currently I am trying to find a way to implement tax 
exemptions. I have found multiple discussions about this issue which is common 
in Europe. We want to sell from The Netherlands to Belgium. When we sell to 
other businesses there we do not have to charge the VAT (21%). This post 
brought me close:

    

        > 

    

        >     > 

    

        > 

    

        >     > 
http://ofbiz.135035.n4.nabble.com/German-store-with-vat-selling-to-europe-and-other-countries-without-Vat-tp4642750p4642752.html
 (especially the part after ‘secondly’), but it is still not working. While 
typing this e-mail I reproduced all my steps and even got a bit further ahead.

    

        > 

    

        >     > 

    

        > 

    

        >     > The things I did so far:

    

        > 

    

        >     > 

    

        > 

    

        >     > 

    

        > 

    

        >     >   *   I created two parties, the Dutch and Belgium tax 
authorities. I went to accounting->tax authorities to make them tax authorities 
within Ofbiz for the two beforementioned countries. I have set ‘require tax id 
for exemption’ to ‘N’ for testing purposes (want to make sure this is not the 
issue).

    

        > 

    

        >     >   *   In the product rates tab for the Dutch authority 
(/accounting/control/EditTaxAuthorityRateProducts?taxAuthPartyId=BELASTINGDIENST&taxAuthGeoId=NED)
 I have added Value Added Taxes of 21% for each of my stores.

    

        > 

    

        >     >   *   In the Parties tab (still of the Dutch tax authority) I 
connected the Belgium Party with ‘Is exempt’ set to ‘Y’.

    

        > 

    

        >     > 

    

        > 

    

        >     > Still no luck, it keeps charging 21% VAT when I create an order 
within Ofbiz.

    

        > 

    

        >     > 

    

        > 

    

        >     > Then I tried to connect the party to the Belgium tax authority 
and set ‘is exempt’ to ‘y’ as well. Now when I placed an order I got a really 
nice overview:

    

        > 

    

        >     > Adjustment: Sales Tax  Jurisdiction: Belgium [BEL] Rate: 21% 
Customer Tax ID: FODFINANCIEN Exempt Amount: 4.2

    

        > 

    

        >     > 

    

        > 

    

        >     > The grand total was still the original amount including VAT (20 
euro’s in this case). It should have charged 16,53 euro while the exempt is 
3,47 euro. So it seems to ignore the fact that the price includes VAT already. 
That seems to be the bigger issue.

    

        > 

    

        >     > 

    

        > 

    

        >     > So some things I don’t get:

    

        > 

    

        >     > 

    

        > 

    

        >     >   *   How come that it does something different when I connect 
the party to the Belgium tax authority (exempt=y) then to the Dutch authority 
(exempt=y)?

    

        > 

    

        >     

    

        > 

    

        >     I think the Parties tab is used for linking customers to tax 
authorities. I don’t think it is for linking tax authorities to other tax 
authorities which is why you might be getting weird output. The associations 
tab is for linking tax authorities to tax authorities. 

    

        > 

    

        >     

    

        > 

    

        >     >   *   In the product pricing I can set the tax authority, tax 
rate and if prices include VAT (set to Y of course). Do I need to set that if I 
set the VAT percentage in the Tax Authority? I tried adding and removing it, 
didn’t make any difference.

    

        > 

    

        >     

    

        > 

    

        >     To me this should have been an override setting but it isn't 
working as such. In fact the tax rate is completely ignored and will always be 
taken from the main Tax Authority Setup. 

    

        > 

    

        >     

    

        > 

    

        >     If you do add the Tax Authority here, it should make a difference 
in on the Final Sales Order Review screen.

    

        > 

    

        >     

    

        > 

    

        >     

    

        > 

    

        >     >   *   How can I make sure prices are including taxes? I checked 
the store settings, but couldn’t find anything usefull there. The stores are 
connected to the Dutch tax authority. ‘Show prices with VAT tax included’ is 
set to ‘N’ but does not make any difference (seems to influence webshop only, 
but I’m not using Ofbiz for that).

    

        > 

    

        >     

    

        > 

    

        >     For the pricing, I’ve mentioned some options above. I think the 
store settings are mainly for the webshop. However if you do set the 'Show 
prices with VAT tax included to ‘Y’, in Sales Order entry screens  the product 
pricing will be adjusted. 

    

        > 

    

        >     

    

        > 

    

        >     Remember I mentioned that the taxes are calculated on the 
customer delivery address so the reason the Tax Authority details are needed 
for the Store is that it means the tax can be calculated before any delivery 
address has been selected. 

    

        > 

    

        >     

    

        > 

    

        >      The only thing I’m not sure about is ‘Prorate Taxes’, I don’t 
know what it means since English is not my native language. Changing it did not 
make any difference though.

    

        > 

    

        >     

    

        > 

    

        >     My understanding of Prorate Taxes is like pro rata and means that 
if there is an adjustment to the prices (e.g a discount) then calculate the tax 
is based on the discounted amount rather than the original amount. (If anyone 
has any other understanding then please feel to respond)

    

        > 

    

        >     

    

        > 

    

        >     

    

        > 

    

        >     >   *   The difference between sales taxes and VAT within Ofbiz. 
Somehow it is now showing my VAT tax rules as ‘sales tax’ where it was VAT 
before. I like sales tax better since it is also showing in the grand total (as 
it should), but still I’m not sure why it switched from VAT to Salex tax when I 
was messing around with the tax authorities.

    

        > 

    

        >     

    

        > 

    

        >     

    

        > 

    

        >     They are pretty much both the same thing just different names. 
:-) As OFBiz became more popular in places that use VAT rather than Sales Tax, 
I think it was added.

    

        > 

    

        >     

    

        > 

    

        >     My thought is that it would be good to look at and tidy up the 
VAT functionality especially if there are some things that are not working as 
expected.  I’ll check JIRA to see if there are any outstanding  issues logged 
that are linked to what I’ve mentioned here.  Also real use cases are good so 
if you can help contribute then that also can help others understand the 
problem and provide solutions.

    

        > 

    

        >     

    

        > 

    

        >     Sorry for the long post and hope this helps.

    

        > 

    

        >     

    

        > 

    

        >     Thanks

    

        > 

    

        >     Sharan

    

        > 

    

        >     

    

        > 

    

        >     > 

    

        > 

    

        >     > Thank you for reading this far and hopefully someone can shed 
some light on the pricing/VAT system. It seems really powerfull, but I’m a bit 
lost.

    

        > 

    

        >     > 

    

        > 

    

        >     > Best regards,

    

        > 

    

        >     > 

    

        > 

    

        >     > Frank

    

        > 

    

        >     > 

    

        > 

    

        >     > 

    

        > 

    

        >     

    

        > 

    

        > 

    

        > 

    

        

    

    

    


Reply via email to