I am trying to setup VAT for a chilean localization and am currently doing
some tests in OFBiz online Demo 13.07. I have setup a Tax Authority for Geo ID "CHL" and a VAT Tax which should be collected by this entity. VAT Tax percentage is set to 19%. Taxes included in prices is set up for this tax authority. I also set up the demo store (OFBiz Ecommerce Store ID 9000) with the "Show prices with VAT tax included" flag set to "Y". The stores "VAT Tax Auth Geo ID" is set to "CHL" The stores "Vat Tax Auth Party ID" is set to "10000" which is the Id which was assigned automatically to the Tax Authority I created. Then I created a product "VAT-TestProduct 1" which belongs to the "Widgets" product category. (Product Category ID 200) The corresponding products List- and Default-Prices are both USD 119, and for both prices the flag "Tax in Price" is set to "Y". Furthermore I have expired all promos for the OFBiz Ecommerce Store. Finally I have expired the Sales Tax which is created under the "_NA_" Tax authority in order to avoid that this sales tax intervenes with my setup. I am doing then a product purchase on the e-commerce page and add one "VAT-TestProduct 1" to the basket. What I expect is that the product price should be 119USD since everywhere "Tax included in Price" was set, i.e. in the Tax Authority, in the Store and in the product prices. Nevertheless the indicated product price is USD 141,61. This is equal to USD119 +19%. This means that the VAT tax was added to the product even though I set up everywhere that VAT is already included in the product price of USD 119. The products net price would be USD 100, i.e. the correct price with VAT tax included is USD 100 + 19% = USD 119. To me the indicate product price of USD 141,61 seems to be not correct since VAT was added, even though it was already included. I have also researched the user list and several related Jira issues and have found that I am not the first one to be confused about the correct VAT setup. I would appreciate very much to receive some help on this. Currently everything is configured in OFBiz online demo 13.07 as described above. Kind regards, Peter --- El software de antivirus Avast ha analizado este correo electrónico en busca de virus. http://www.avast.com |
The VAT tax seems to be added to the price because of following code in TaxAuthorityServices.java:
TaxAuthorityServices.java // add up amounts from adjustments (amount OR exemptAmount, sourcePercentage) for (GenericValue taxAdjustment : taxAdustmentList) { if ("SALES_TAX".equals(taxAdjustment.getString("orderAdjustmentTypeId"))) { taxPercentage = taxPercentage.add(taxAdjustment.getBigDecimal("sourcePercentage")); BigDecimal adjAmount = taxAdjustment.getBigDecimal("amount"); taxTotal = taxTotal.add(adjAmount); priceWithTax = priceWithTax.add(adjAmount.divide(quantity,salestaxCalcDecimals,salestaxRounding)); Debug.logInfo("For productId [" + productId + "] added [" + adjAmount.divide(quantity,salestaxCalcDecimals,salestaxRounding) + "] of tax to price for geoId [" + taxAdjustment.getString("taxAuthGeoId") + "], new price is [" + priceWithTax + "]", module); Somehow, somewhere "orderAdjustmentTypeId" is set to "SALES_TAX" eventhough I am not aware where this might be done as I have created the tax as a VAT-Tax. Since above code detects: if ("SALES_TAX".equals(taxAdjustment.getString("orderAdjustmentTypeId))) as true, subsequently the line priceWithTax = priceWithTax.add(adjAmount.divide(quantity,salestaxCalcDecimals,salestaxRounding)); is executed which is responsible for adding the VAT tax. I have tracked this by using "verbose" - logging. By comenting out above code the prices are correctly indicated when the product is displayed in the ecommerce shop. Nevertheless when performing Quick Check-Out and shipping the order to a Chilean address once again a Sales Tax of 19% is added. So far I have not found out which part of the code is responsible for adding the Sales Tax. Help on this subject is much appreciated. Regards, Peter --- El software de antivirus Avast ha analizado este correo electrónico en busca de virus. http://www.avast.com |
Hi Peter,
You might benefit from a book written by community member Sharan Foga on the subject of accounting with OFBiz. See: http://www.lulu.com/shop/sharan-foga/getting-started-with-apache-ofbiz-accounting/paperback/product-21841766.html Best regards, Pierre Op dinsdag 11 augustus 2015 heeft Peter Arnold <[hidden email]> het volgende geschreven: > The VAT tax seems to be added to the price because of following code in > TaxAuthorityServices.java: > > TaxAuthorityServices.java > > // add up amounts from adjustments (amount OR exemptAmount, > sourcePercentage) > for (GenericValue taxAdjustment : taxAdustmentList) { > if > ("SALES_TAX".equals(taxAdjustment.getString("orderAdjustmentTypeId"))) { > taxPercentage = > taxPercentage.add(taxAdjustment.getBigDecimal("sourcePercentage")); > BigDecimal adjAmount = > taxAdjustment.getBigDecimal("amount"); > taxTotal = taxTotal.add(adjAmount); > priceWithTax = > priceWithTax.add(adjAmount.divide(quantity,salestaxCalcDecimals,salestaxRounding)); > Debug.logInfo("For productId [" + productId + "] > added [" + adjAmount.divide(quantity,salestaxCalcDecimals,salestaxRounding) > + "] of tax to price for geoId [" + taxAdjustment.getString("taxAuthGeoId") > + "], new price is [" + priceWithTax + "]", module); > > > Somehow, somewhere "orderAdjustmentTypeId" is set to "SALES_TAX" > eventhough I am not aware where this might be done as I have created the > tax as a VAT-Tax. > Since above code detects: if > ("SALES_TAX".equals(taxAdjustment.getString("orderAdjustmentTypeId))) as > true, subsequently the line > priceWithTax = > priceWithTax.add(adjAmount.divide(quantity,salestaxCalcDecimals,salestaxRounding)); > is executed which is responsible for adding the VAT tax. > > I have tracked this by using "verbose" - logging. > > By comenting out above code the prices are correctly indicated when the > product is displayed in the ecommerce shop. > Nevertheless when performing Quick Check-Out and shipping the order to a > Chilean address once again a Sales Tax of 19% is added. > So far I have not found out which part of the code is responsible for > adding the Sales Tax. > > > Help on this subject is much appreciated. > > > Regards, > Peter > > > > > --- > El software de antivirus Avast ha analizado este correo electrónico en > busca de virus. > http://www.avast.com > > -- Pierre Smits *ORRTIZ.COM <http://www.orrtiz.com>* Services & Solutions for Cloud- Based Manufacturing, Professional Services and Retail & Trade http://www.orrtiz.com |
Administrator
|
In reply to this post by Peter Arnold
Did you check how prices are created? It depends on parameters you pass
You can read the createProductPrice description in its definition: <<Create a Product Price. If taxAuthGeoId and taxAuthPartyId are (or taxAuthCombinedId is) passed in then the price will be considered a price with tax included (the priceWithoutTax, priceWithTax, taxAmount, and taxPercentage fields will also be populated). If the taxInPrice field is 'Y' then the price field will be left with the tax included (price will be equal to priceWithTax), otherwise tax will be removed from the passed in price and the price field will be equal to the priceWithoutTax field. If taxAuthGeoId or taxAuthPartyId empty, and taxAuthCombinedId is empty, then the taxInPrice field will be ignored.>> HTH Jacques Le 11/08/2015 07:00, Peter Arnold a écrit : > The VAT tax seems to be added to the price because of following code in TaxAuthorityServices.java: > > TaxAuthorityServices.java > > // add up amounts from adjustments (amount OR exemptAmount, sourcePercentage) > for (GenericValue taxAdjustment : taxAdustmentList) { > if ("SALES_TAX".equals(taxAdjustment.getString("orderAdjustmentTypeId"))) { > taxPercentage = taxPercentage.add(taxAdjustment.getBigDecimal("sourcePercentage")); > BigDecimal adjAmount = taxAdjustment.getBigDecimal("amount"); > taxTotal = taxTotal.add(adjAmount); > priceWithTax = priceWithTax.add(adjAmount.divide(quantity,salestaxCalcDecimals,salestaxRounding)); > Debug.logInfo("For productId [" + productId + "] added [" + adjAmount.divide(quantity,salestaxCalcDecimals,salestaxRounding) + "] of tax to price for geoId [" + taxAdjustment.getString("taxAuthGeoId") + "], new price is [" + priceWithTax + "]", module); > > > Somehow, somewhere "orderAdjustmentTypeId" is set to "SALES_TAX" eventhough I am not aware where this might be done as I have created the tax as a VAT-Tax. > Since above code detects: if ("SALES_TAX".equals(taxAdjustment.getString("orderAdjustmentTypeId))) as true, subsequently the line > priceWithTax = priceWithTax.add(adjAmount.divide(quantity,salestaxCalcDecimals,salestaxRounding)); is executed which is responsible for adding the VAT tax. > > I have tracked this by using "verbose" - logging. > > By comenting out above code the prices are correctly indicated when the product is displayed in the ecommerce shop. > Nevertheless when performing Quick Check-Out and shipping the order to a Chilean address once again a Sales Tax of 19% is added. > So far I have not found out which part of the code is responsible for adding the Sales Tax. > > > Help on this subject is much appreciated. > > > Regards, > Peter > > > > > --- > El software de antivirus Avast ha analizado este correo electrónico en busca de virus. > http://www.avast.com > > > |
Hi Peter
Thanks for including the details of your test as this made it easy for me to re-run your scenario. And Jacques is right – the answer lies in the product price setup. I added the rate, Tax Authority Party and Geo Id on the product pricing itself. The correct price is then brought through into the shopping cart and no tax is added to the order. Did you run also your test with a Chilean Customer rather than DemoCustomer? Remember that your tax authority and rates are linked to the delivery address of your customer so your customer must have an address in Chile for the rate to be applied. (e.g. DemoCustomer has a US address so the US tax rates will be applied). I'm not sure why updating the Include Tax in Price flag at the store level doesn't achieve this too. Anyway I hope this helps. Thanks Sharan |
Administrator
|
Thanks for your test and the confirmation Sharan :)
Jacques Le 11/08/2015 11:41, Sharan-F a écrit : > Hi Peter > > Thanks for including the details of your test as this made it easy for me to > re-run your scenario. And Jacques is right – the answer lies in the product > price setup. > > I added the rate, Tax Authority Party and Geo Id on the product pricing > itself. The correct price is then brought through into the shopping cart and > no tax is added to the order. > > Did you run also your test with a Chilean Customer rather than DemoCustomer? > Remember that your tax authority and rates are linked to the delivery > address of your customer so your customer must have an address in Chile for > the rate to be applied. (e.g. DemoCustomer has a US address so the US tax > rates will be applied). > > I'm not sure why updating the Include Tax in Price flag at the store level > doesn't achieve this too. > > Anyway I hope this helps. > > Thanks > Sharan > > > > -- > View this message in context: http://ofbiz.135035.n4.nabble.com/VAT-Setup-tp4671326p4671361.html > Sent from the OFBiz - User mailing list archive at Nabble.com. > > |
Hi Pierre, Sharan and Jaques,
I have read all your comments. Thank you very much for helping. Pierre, Thanks for the hint, Sharan's book is already on my shelf and has brought me to where I am without too much troubles, however on the VAT-Tax setup I remain confused. Sharan, Thank you for reproducing the same test as I did. You are right, by adding the Tax rate, Tax Authority Party and Geo Id directly to the product pricing, prices are indicated correctly on the product screens. For a normal "finished good" product the prices now also are correct once in the shopping cart and at final order review. But in my local installation I am running the test also with variant products since I pretend to use them intensively. With pricing being set up on the virtual product in the same manner as indicated by you unfortunately for the variant product in the shopping cart and final order review still the sales tax is being added. So I either have still some configuration problems or there is some missing functionality or bugs in the system. I am using a Chilean Customer for the test, so there shouldn't be a problem with that. Jaques, Thank you for this hint. With this description of course I would have succeeded earlier. Though the very important part would be to know how you track down such a problem and even get to know that the service "createProductPrice" is responsible for the problem one experiences. Of course the debugging knowledge here plays an important role. I think this is also why many possible users of OFBiz are finding it hard to get started. Personally I am not a developer even though I like the topic quite a lot and my informatic skills are also not so bad. I am running OFBiz through Eclipse Luna but am still not able to use debugging functions within Eclipse since during setup there are several errors which I was not able to resolve. So I depend mainly on the logs and on my still limited knowledge of OFBiz. Ftl, groovy and Java are causing also problems and therefore I am not always able to follow through the code, especially when variables are taken out of available context. As I said, I am not a developer. It would be great if you could give some hints on how to improve the ability to debug the system. I know that I am asking a complicated and wide ranging question but you know "It's better to learn fishing than to receive some fishes for free...) Kind regards, Peter --- El software de antivirus Avast ha analizado este correo electrónico en busca de virus. http://www.avast.com |
When pricing is added directly to variant products, the prices are indicated correctly in product screens, shopping cart and final order review.
However prices are indicated with added sales tax when I apply pricing only to the virtual product. One of the reasons to use virtual-, variant- products is that pricing has to be applied only on the virtual product. For example if I sell T-shirts in different colors, each being a variant, it would be the idea to apply pricing just to the virtual T-shirt product since all colors cost the same. This still is not working in my test environment. Regards, Peter --- El software de antivirus Avast ha analizado este correo electrónico en busca de virus. http://www.avast.com |
Administrator
|
In reply to this post by Peter Arnold
Peter,
Inline... Le 11/08/2015 16:50, Peter Arnold a écrit : > Jaques, > > Thank you for this hint. With this description of course I would have succeeded earlier. Though the very important part would be to know how you track down such a problem and even get to know that the service "createProductPrice" is responsible for the problem one experiences. Because I had to look at it before, I even fixed/clarified the description at r1613121 http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services.xml?r1=1613121&r2=1613120&pathrev=1613121 > Of course the debugging knowledge here plays an important role. I think this is also why many possible users of OFBiz are finding it hard to get started. > Personally I am not a developer even though I like the topic quite a lot and my informatic skills are also not so bad. I am running OFBiz through Eclipse Luna but am still not able to use debugging functions within Eclipse since during setup there are several errors which I was not able to resolve. So I depend mainly on the logs and on my still limited knowledge of OFBiz. Ftl, groovy and Java are causing also problems and therefore I am not always able to follow through the code, especially when variables are taken out of available context. As I said, I am not a developer. > > It would be great if you could give some hints on how to improve the ability to debug the system. It seems you are already doing good. I guess you found the page about the Eclipse Debugger in the wiki. But anyway In this case the Eclipse Java debugger was not needed. It's only a description into a (XML) service definition. You though need to know that prices are created (stored in DB) with createProductPrice service. That you should be able to find in the log. You should also then be able to read the createProductPrice service implementation and get your own idea about it, that's how I fixed the description. Actually most of the time you start from the log, and then follow the flow until you reach the point were the issue is. Of course It needs some time to get acquainted... HTH Jacques > > I know that I am asking a complicated and wide ranging question but you know "It's better to learn fishing than to receive some fishes for free...) > > > Kind regards, > > Peter |
Administrator
|
In reply to this post by Peter Arnold
Le 11/08/2015 17:52, Peter Arnold a écrit : > When pricing is added directly to variant products, the prices are indicated correctly in product screens, shopping cart and final order review. > However prices are indicated with added sales tax when I apply pricing only to the virtual product. This could be a bug indeed. Could you please give us ALL the steps you used to get this result? > > One of the reasons to use virtual-, variant- products is that pricing has to be applied only on the virtual product. > For example if I sell T-shirts in different colors, each being a variant, it would be the idea to apply pricing just to the virtual T-shirt product since all colors cost the same. Yes this is indeed the way in this case. Jacques > > This still is not working in my test environment. > > Regards, > > Peter > > > --- > El software de antivirus Avast ha analizado este correo electrónico en busca de virus. > http://www.avast.com > > > |
Jaques,
Thank you for the interesting insight on debugging and your interest in the problems I am describing here. In order to reproduce the prices with added sales tax on the variant product, even though set up as VAT and with "Tax in Price included" please follow the following steps. It's a bit long but that's what I am doing step by step. By the way, right now everything is setup with the following procedure in the online test system OFBiz release 13.07. http://demo-stable-ofbiz.apache.org/catalog/control/main?USERNAME=admin&PASSWORD=ofbiz&JavaScriptEnabled=Y This safes you the work of setting up again. Here is the procedure: In Party Manager: 1. Create new Party Group with Name "SII_CHL" (Leave all settings for group creation as per standard) 2. Assign Role "Tax Authority" to party "SII_CHL" In Accounting Module / Tax Autorities: 3. Create New Tax Authority with following settings: Geo: CHL Party: SII_CHL Include Tax in Price: Y Leave other setting as is 4. Under "Product Rates" create new tax with following settings: Type: Value Added Tax Tax Percentage: 19 From Date: Now Leave other settings as is 5. Expire the Sales Tax created under tax authority _NA_ by setting its corresponding thru date to NOW. 6. Under Catalog Manager / Stores: Modify following Settings for OFBiz Ecommerce Store (ID:9000) Tax settings: Show Prices with VAT tax included: Y VAT Tax Auth Geo Id: CHL VAT Tax Auth Party Id: 10000 (Or the Party ID corresponding to the created Tax Authority SII_CHL) 7. Expire all Promotions for OFBIZ E-Commerce Store [ID:9000] by setting all thru-dates to NOW 8. Under Catalog Manager / Products: Create New Product with following settings: Internal Name: T-Shirt Is Virtual Product: Y 9. Under Catalog Manager / Products / Categories Assign the virtual product "T-Shirt" to the products category ID 200 (Widgets) - Product Category ID: 200 - From Date: Now Add 10 Under Catalog Manager / Products / Content In override Simple Fields Set Product Name to: "T-Shirt Virtual" Update 11. Under Catalog Manager / Features: Create New Feature Category. - Description: "T-Shirt Colors" Submit 12. Create new Feature within feature Category "T-Shirt Colors": Create New Feature - Feature Type: Color - Description: Red Update Create New Feature - Feature Type: Color - Description: Blue Update 13. Create 2 variant products under the virtual product "T-Shirt" Under Catalog Manager / Products Find T-Shirt Product Once T-Shirt Product is selected: Press Features Tab Under Add product features from Category or Group - Choose T-Shirt Colors Category - Feature Application Type: Selectable Add Screen with Blue and Red T-Shirt Colors appears. Set for both colors From Date: Now Sequence:1 for blue Sequence:2 for red Set a tick on each feature in order to select the feature for adding it. Apply 14. Under Catalog Manager / Products with "T-Shirt" virtual product selected press the Variants tab The Quick add Variants screen appears. Define Product IDs for Blue and Red features. Blue: T-Shirt Blue Red: T-Shirt Red Set tick on both features in order to select for variant product creation. Create 15. Under Catalog Manager / Products / Prices set 2 new product prices for the created virtual product "T-Shirt": - Default Price - From Date: Now - Price: 11.9 - Tax Percentage: 19 - Tax in price: Y Create - List Price - From Date: Now - Price: 11.9 - Tax Percentage: 19 - Tax in price: Y Create Now the products should be visible in the E-Shop. The Virtual Products Price appears at USD 14.16 If I Select the blue or the red T-Shirt Price is 11.9USD Now I modify the Product Pricing on the Virtual Product. On Default- and List- Prices add: - Tax Percentage: 19 - Tax Authority Party (ID): 10000 (Or whatever ID corresponds to SII_CHL Party) - Tax Auth Geo Id: CHL Update Back in the E-Shop on the product display now the correct prices appear. I.E. 11.9 USD for the virtual product, the red, and the blue shirt. Now I preselect the blue T-Shirt and add 1 to the shopping cart. If I go to the cart now the price of the Blue T-Shirt is 14,16USD. Now let's define a product price directly on the Red T-Shirt variant product: Under Catalog Manager / Product select the product "T-Shirt Red". Under the Prices Tab: - Price Type: Default Price - From Date: Now - Price: 11.9 - Tax Percentage: 19 - Tax Authority Party (ID): 10000 (Or corresponding ID to SII_CHL) - Tax Auth Geo ID: CHL - Tax in Price: Y Create - Price Type: List Price - From Date: Now - Price: 11.9 - Tax Percentage: 19 - Tax Authority Party (ID): 10000 (Or corresponding ID to SII_CHL) - Tax Auth Geo ID: CHL - Tax in Price: Y Create Back to the E-Shop Select now the Red T-Shirt and add to shopping cart. If you check the prices in the shopping cart the red T-Shirt would be sold at 11.9 USD and the blue T-Shirt at 14.16USD. Only difference being that I have set up pricing directly on the Red T-Shirt, while the blue one gets its price from the virtual product T-Shirt. If you do the Quick Check out with a Chilean "Ship To" address and get to the "Final Checkout Review", you can see that for the Red T-Shirt no sales Tax is applied while for the blue one there is a sales tax of USD 2.26 Kind Regards, Peter --- El software de antivirus Avast ha analizado este correo electrónico en busca de virus. http://www.avast.com |
Hi Peter
I've been through your scenario and it is as you describe and I think it is a bug. In the demo data there is no pricing at the virtual product level and pricing has only been included at the variant product level so perhaps it this has been why the issue hasn't been identified properly before. If pricing is setup at the virtual product (T-Shirt Virtual) level then I would have expected that it would be brought through as the default price to the variant product (and without the tax if this has been specified). The pricing on the variant product itself (T-Shirt Blue, T-Shirt - Red) would then act as an override to the default virtual product price. To me it looks like the variant product override is working correctly but that the default price for including tax in the price on the virtual product is not. I've also taken a look through Jira to see if it has been reported before but I couldn't find anything so I think it would be good if you could create a Jira issue for this. Thanks Sharan |
Dear Sharan,
Thank you for reproducing this setup and verifying its unexpected outcome. I agree with your conclusions and have opened a Jira. https://issues.apache.org/jira/browse/OFBIZ-6576 I hope I have done that well since it's the first one I have opened. Thank you and regards, Peter --- El software de antivirus Avast ha analizado este correo electrónico en busca de virus. http://www.avast.com |
Administrator
|
Thanks Peter,
I have just adjusted the concerned versions Jacques Le 14/08/2015 20:53, Peter Arnold a écrit : > Dear Sharan, > > Thank you for reproducing this setup and verifying its unexpected outcome. > I agree with your conclusions and have opened a Jira. > https://issues.apache.org/jira/browse/OFBIZ-6576 > > I hope I have done that well since it's the first one I have opened. > > Thank you and regards, > > Peter > > > --- > El software de antivirus Avast ha analizado este correo electrónico en busca de virus. > http://www.avast.com > > > |
Free forum by Nabble | Edit this page |