[Skip to main content](#vessel-content)

#   Invoice: tax calculatios has an error

##

- **[scharfet](/forum/user/3989-scharfet "View scharfet's Profile")**
- [![scharfet's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar3989.jpg)](/forum/user/3989-scharfet "View scharfet's Profile") Topic Author
- [ Offline](/forum/user/3989-scharfet)

Less More

- Posts: 86
- Thank you received: 2
-
-

12 years 10 months ago -  12 years 10 months ago [\#135499](#135499) by [scharfet](/forum/user/3989-scharfet "View scharfet's Profile")  *[Invoice: tax calculatios has an error](/forum/2-general-talk-about-hikashop/864148-invoice-tax-calculatios-has-an-error#135499 "-- url of the page with the problem -- :   mywebsite.com/mypage  -- HikaShop version -- : 2.2.2 -- Joomla version -- : 2.5.14  Hi, I observed an error in the invoice which is causen when &quot;Round prices during calculations&quot; is set to &quot;Yes&quot;. The error also ocurrs when I use the defauld invoice.php file.  It seems that the invoice is currently calculated like in this example: 8,26440 x 21% = 1,7355=1,74  The correct way would be to use 3,00 as base. 8,26 x 21% = 1,7346=1,73  What do I need to modify to fix this error?  Best Regards, Hannes  p.s: I thins this was my last question in order to finish the online shop. :P")* was created by *[scharfet](/forum/user/3989-scharfet "View scharfet's Profile")*

-- url of the page with the problem -- : [ mywebsite.com/mypage](http://mywebsite.com/mypage)
-- HikaShop version -- : 2.2.2
-- Joomla version -- : 2.5.14

Hi,
I observed an error in the invoice which is causen when "Round prices during calculations" is set to "Yes".
The error also ocurrs when I use the defauld invoice.php file.

It seems that the invoice is currently calculated like in this example:
8,26440 x 21% = 1,7355=1,74

The correct way would be to use 3,00 as base.
8,26 x 21% = 1,7346=1,73

What do I need to modify to fix this error?

Best Regards,
Hannes

p.s: I thins this was my last question in order to finish the online shop. ![:P](/media/kunena/emoticons/14.png ":P")

Last edit: 12 years 10 months ago by [scharfet](/forum/user/3989-scharfet "View scharfet's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg2NDE0OC1pbnZvaWNlLXRheC1jYWxjdWxhdGlvcy1oYXMtYW4tZXJyb3I/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[scharfet](/forum/user/3989-scharfet "View scharfet's Profile")**
- [![scharfet's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar3989.jpg)](/forum/user/3989-scharfet "View scharfet's Profile") Topic Author
- [ Offline](/forum/user/3989-scharfet)

Less More

- Posts: 86
- Thank you received: 2
-
-

12 years 10 months ago -  12 years 10 months ago [\#135513](#135513) by [scharfet](/forum/user/3989-scharfet "View scharfet's Profile")  Replied by *[scharfet](/forum/user/3989-scharfet "View scharfet's Profile")* on topic *[tax calculatios has an error](/forum/2-general-talk-about-hikashop/864148-invoice-tax-calculatios-has-an-error#135513 "-- url of the page with the problem -- :   mywebsite.com/mypage  -- HikaShop version -- : 2.2.2 -- Joomla version -- : 2.5.14  Hi, I observed an error in the invoice which is causen when &quot;Round prices during calculations&quot; is set to &quot;Yes&quot;. The error also ocurrs when I use the defauld invoice.php file.  It seems that the invoice is currently calculated like in this example: 8,26440 x 21% = 1,7355=1,74  The correct way would be to use 3,00 as base. 8,26 x 21% = 1,7346=1,73  What do I need to modify to fix this error?  Best Regards, Hannes  p.s: I thins this was my last question in order to finish the online shop. :P")*

Hi,

I just observed that this error allready ocurrs on checkout, so it has nothing to do with the invoice as I thought at the beginning.

Last edit: 12 years 10 months ago by [scharfet](/forum/user/3989-scharfet "View scharfet's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg2NDE0OC1pbnZvaWNlLXRheC1jYWxjdWxhdGlvcy1oYXMtYW4tZXJyb3I/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[scharfet](/forum/user/3989-scharfet "View scharfet's Profile")**
- [![scharfet's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar3989.jpg)](/forum/user/3989-scharfet "View scharfet's Profile") Topic Author
- [ Offline](/forum/user/3989-scharfet)

Less More

- Posts: 86
- Thank you received: 2
-
-

12 years 10 months ago [\#135516](#135516) by [scharfet](/forum/user/3989-scharfet "View scharfet's Profile")  Replied by *[scharfet](/forum/user/3989-scharfet "View scharfet's Profile")* on topic *[Invoice: tax calculatios has an error](/forum/2-general-talk-about-hikashop/864148-invoice-tax-calculatios-has-an-error#135516 "-- url of the page with the problem -- :   mywebsite.com/mypage  -- HikaShop version -- : 2.2.2 -- Joomla version -- : 2.5.14  Hi, I observed an error in the invoice which is causen when &quot;Round prices during calculations&quot; is set to &quot;Yes&quot;. The error also ocurrs when I use the defauld invoice.php file.  It seems that the invoice is currently calculated like in this example: 8,26440 x 21% = 1,7355=1,74  The correct way would be to use 3,00 as base. 8,26 x 21% = 1,7346=1,73  What do I need to modify to fix this error?  Best Regards, Hannes  p.s: I thins this was my last question in order to finish the online shop. :P")*

Hello!

I know now that the error comes from modifications which was made.

Please could you tell me which php file deals with the calculation of the tax?

Thank you for your help.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg2NDE0OC1pbnZvaWNlLXRheC1jYWxjdWxhdGlvcy1oYXMtYW4tZXJyb3I/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86323
- Thank you received: 14283
-
-

12 years 10 months ago [\#135541](#135541) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Invoice: tax calculatios has an error](/forum/2-general-talk-about-hikashop/864148-invoice-tax-calculatios-has-an-error#135541 "-- url of the page with the problem -- :   mywebsite.com/mypage  -- HikaShop version -- : 2.2.2 -- Joomla version -- : 2.5.14  Hi, I observed an error in the invoice which is causen when &quot;Round prices during calculations&quot; is set to &quot;Yes&quot;. The error also ocurrs when I use the defauld invoice.php file.  It seems that the invoice is currently calculated like in this example: 8,26440 x 21% = 1,7355=1,74  The correct way would be to use 3,00 as base. 8,26 x 21% = 1,7346=1,73  What do I need to modify to fix this error?  Best Regards, Hannes  p.s: I thins this was my last question in order to finish the online shop. :P")*

Which modifications are you talking about ?

The tax calculations are all done in the file administrator/components/com_hikashop/classes/currency.php

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg2NDE0OC1pbnZvaWNlLXRheC1jYWxjdWxhdGlvcy1oYXMtYW4tZXJyb3I/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[scharfet](/forum/user/3989-scharfet "View scharfet's Profile")**
- [![scharfet's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar3989.jpg)](/forum/user/3989-scharfet "View scharfet's Profile") Topic Author
- [ Offline](/forum/user/3989-scharfet)

Less More

- Posts: 86
- Thank you received: 2
-
-

12 years 10 months ago [\#135573](#135573) by [scharfet](/forum/user/3989-scharfet "View scharfet's Profile")  Replied by *[scharfet](/forum/user/3989-scharfet "View scharfet's Profile")* on topic *[Invoice: tax calculatios has an error](/forum/2-general-talk-about-hikashop/864148-invoice-tax-calculatios-has-an-error#135573 "-- url of the page with the problem -- :   mywebsite.com/mypage  -- HikaShop version -- : 2.2.2 -- Joomla version -- : 2.5.14  Hi, I observed an error in the invoice which is causen when &quot;Round prices during calculations&quot; is set to &quot;Yes&quot;. The error also ocurrs when I use the defauld invoice.php file.  It seems that the invoice is currently calculated like in this example: 8,26440 x 21% = 1,7355=1,74  The correct way would be to use 3,00 as base. 8,26 x 21% = 1,7346=1,73  What do I need to modify to fix this error?  Best Regards, Hannes  p.s: I thins this was my last question in order to finish the online shop. :P")*

Hi Nicolas,

I use the original file administrator/components/com_hikashop/classes/currency.php and I have removed all overrides of the hikashop views, but the tax is still not calculated correctly. I do not know what to do.

I made a test. I created the same prouct and same tax on demo.hikashop.com. On your demo shop the tax is calculated correctly.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg2NDE0OC1pbnZvaWNlLXRheC1jYWxjdWxhdGlvcy1oYXMtYW4tZXJyb3I/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[scharfet](/forum/user/3989-scharfet "View scharfet's Profile")**
- [![scharfet's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar3989.jpg)](/forum/user/3989-scharfet "View scharfet's Profile") Topic Author
- [ Offline](/forum/user/3989-scharfet)

Less More

- Posts: 86
- Thank you received: 2
-
-

12 years 10 months ago -  12 years 10 months ago [\#135576](#135576) by [scharfet](/forum/user/3989-scharfet "View scharfet's Profile")  Replied by *[scharfet](/forum/user/3989-scharfet "View scharfet's Profile")* on topic *[Invoice: tax calculatios has an error](/forum/2-general-talk-about-hikashop/864148-invoice-tax-calculatios-has-an-error#135576 "-- url of the page with the problem -- :   mywebsite.com/mypage  -- HikaShop version -- : 2.2.2 -- Joomla version -- : 2.5.14  Hi, I observed an error in the invoice which is causen when &quot;Round prices during calculations&quot; is set to &quot;Yes&quot;. The error also ocurrs when I use the defauld invoice.php file.  It seems that the invoice is currently calculated like in this example: 8,26440 x 21% = 1,7355=1,74  The correct way would be to use 3,00 as base. 8,26 x 21% = 1,7346=1,73  What do I need to modify to fix this error?  Best Regards, Hannes  p.s: I thins this was my last question in order to finish the online shop. :P")*

Hi Nicolas,

I just found out that your demo shop has the same error.

image missing http://www.estudiohr.com/zzz/htest1.png

image missing http://www.estudiohr.com/zzz/htest2.png

I would thank you if you could inform me how to fix the error or send me the updated file so I can repace it.

Best regards

Last edit: 12 years 10 months ago by [scharfet](/forum/user/3989-scharfet "View scharfet's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg2NDE0OC1pbnZvaWNlLXRheC1jYWxjdWxhdGlvcy1oYXMtYW4tZXJyb3I/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86323
- Thank you received: 14283
-
-

12 years 10 months ago [\#135605](#135605) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Invoice: tax calculatios has an error](/forum/2-general-talk-about-hikashop/864148-invoice-tax-calculatios-has-an-error#135605 "-- url of the page with the problem -- :   mywebsite.com/mypage  -- HikaShop version -- : 2.2.2 -- Joomla version -- : 2.5.14  Hi, I observed an error in the invoice which is causen when &quot;Round prices during calculations&quot; is set to &quot;Yes&quot;. The error also ocurrs when I use the defauld invoice.php file.  It seems that the invoice is currently calculated like in this example: 8,26440 x 21% = 1,7355=1,74  The correct way would be to use 3,00 as base. 8,26 x 21% = 1,7346=1,73  What do I need to modify to fix this error?  Best Regards, Hannes  p.s: I thins this was my last question in order to finish the online shop. :P")*

I don't understand how you get that.
Here are my results on the demo website:

[ ![h593ce3b.png](/forum/attachment/14153) ](/forum/attachment/14153 "h593ce3b.png")

That is without calculations rounding.
The price of the product is €8.3612
When you multiply by 10, it's €83.612
Then you add the taxes (19.6%) on it: 99.999952 which is then rounded to €100
The taxes are: 99.999952-83.612=16.387952 which is then rounded to €16.39
So these calculations are perfectly correct.

[ ![h3b1fd41.png](/forum/attachment/14154) ](/forum/attachment/14154 "h3b1fd41.png")

That is with the calculations rounding.
The price of the product is €8.3612
When you multiply by 10, it's €83.612 rounded to €83.61
Then you add the taxes (19.6%) on it: 99.99756 which is then rounded to €100
The taxes are: 100-10*8.36=16.40
So these calculations are perfectly correct too.

- [ ![h593ce3b.png](/forum/attachment/14153) ](/forum/attachment/14153 "h593ce3b.png") [ ](/forum/attachment/14153?download=1 "h593ce3b.png")
- [ ![h3b1fd41.png](/forum/attachment/14154) ](/forum/attachment/14154 "h3b1fd41.png") [ ](/forum/attachment/14154?download=1 "h3b1fd41.png")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg2NDE0OC1pbnZvaWNlLXRheC1jYWxjdWxhdGlvcy1oYXMtYW4tZXJyb3I/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[scharfet](/forum/user/3989-scharfet "View scharfet's Profile")**
- [![scharfet's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar3989.jpg)](/forum/user/3989-scharfet "View scharfet's Profile") Topic Author
- [ Offline](/forum/user/3989-scharfet)

Less More

- Posts: 86
- Thank you received: 2
-
-

12 years 10 months ago -  12 years 10 months ago [\#136436](#136436) by [scharfet](/forum/user/3989-scharfet "View scharfet's Profile")  Replied by *[scharfet](/forum/user/3989-scharfet "View scharfet's Profile")* on topic *[Invoice: tax calculatios has an error](/forum/2-general-talk-about-hikashop/864148-invoice-tax-calculatios-has-an-error#136436 "-- url of the page with the problem -- :   mywebsite.com/mypage  -- HikaShop version -- : 2.2.2 -- Joomla version -- : 2.5.14  Hi, I observed an error in the invoice which is causen when &quot;Round prices during calculations&quot; is set to &quot;Yes&quot;. The error also ocurrs when I use the defauld invoice.php file.  It seems that the invoice is currently calculated like in this example: 8,26440 x 21% = 1,7355=1,74  The correct way would be to use 3,00 as base. 8,26 x 21% = 1,7346=1,73  What do I need to modify to fix this error?  Best Regards, Hannes  p.s: I thins this was my last question in order to finish the online shop. :P")*

Hello Nicolas.

sorry for forgetting to tell you that the error ocurred when VAT is set to 21% (instead of 19,6%).

I made some more tests using your demo shop. This time I just modified the net price of a certain product.
I observed differences in the calculations when "Round prices during calculations" si set to Yes or No.

Please see the attached excel file or the image to see the results of my tests. The file shows the results of the calculations in the cart of your demo shop
I am not quite sure when the error ocurrs. Some tims the tax amount shows an error, and some times it is the total amount which has the error.
I hope this helps to identify the cause.

image missing http://www.estudiohr.com/zzz/fehler.png

Thank you!

Last edit: 12 years 10 months ago by [scharfet](/forum/user/3989-scharfet "View scharfet's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg2NDE0OC1pbnZvaWNlLXRheC1jYWxjdWxhdGlvcy1oYXMtYW4tZXJyb3I/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[scharfet](/forum/user/3989-scharfet "View scharfet's Profile")**
- [![scharfet's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar3989.jpg)](/forum/user/3989-scharfet "View scharfet's Profile") Topic Author
- [ Offline](/forum/user/3989-scharfet)

Less More

- Posts: 86
- Thank you received: 2
-
-

12 years 10 months ago [\#136949](#136949) by [scharfet](/forum/user/3989-scharfet "View scharfet's Profile")  Replied by *[scharfet](/forum/user/3989-scharfet "View scharfet's Profile")* on topic *[Invoice: tax calculatios has an error](/forum/2-general-talk-about-hikashop/864148-invoice-tax-calculatios-has-an-error#136949 "-- url of the page with the problem -- :   mywebsite.com/mypage  -- HikaShop version -- : 2.2.2 -- Joomla version -- : 2.5.14  Hi, I observed an error in the invoice which is causen when &quot;Round prices during calculations&quot; is set to &quot;Yes&quot;. The error also ocurrs when I use the defauld invoice.php file.  It seems that the invoice is currently calculated like in this example: 8,26440 x 21% = 1,7355=1,74  The correct way would be to use 3,00 as base. 8,26 x 21% = 1,7346=1,73  What do I need to modify to fix this error?  Best Regards, Hannes  p.s: I thins this was my last question in order to finish the online shop. :P")*

If you creade products using one of the "net procuct price" displayed in the screenshot and add 10 of these products into the cart you will be able to reproduce the error.

I hope you can fix this error.

Best,
Hannes

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg2NDE0OC1pbnZvaWNlLXRheC1jYWxjdWxhdGlvcy1oYXMtYW4tZXJyb3I/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86323
- Thank you received: 14283
-
-

12 years 10 months ago [\#137395](#137395) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Invoice: tax calculatios has an error](/forum/2-general-talk-about-hikashop/864148-invoice-tax-calculatios-has-an-error#137395 "-- url of the page with the problem -- :   mywebsite.com/mypage  -- HikaShop version -- : 2.2.2 -- Joomla version -- : 2.5.14  Hi, I observed an error in the invoice which is causen when &quot;Round prices during calculations&quot; is set to &quot;Yes&quot;. The error also ocurrs when I use the defauld invoice.php file.  It seems that the invoice is currently calculated like in this example: 8,26440 x 21% = 1,7355=1,74  The correct way would be to use 3,00 as base. 8,26 x 21% = 1,7346=1,73  What do I need to modify to fix this error?  Best Regards, Hannes  p.s: I thins this was my last question in order to finish the online shop. :P")*

Again, I don't see the problem with your tests:
The price of the product is €8,26447 (there are 5 decimals saved in HikaShop so that's what becomes €8,264465)
When you multiply by 10, it's €82,6447
Then you add the taxes (21%) on it: 100,000087 which is then rounded to €100
The taxes are: 100,000087-82,6447=17,355387 which is then rounded to €17,36

The price of the product is €8,26447 rounded to €8,26
Then you add the taxes (21%) on it: €9,9946 which is then rounded to €10
When you multiply by 10, it's €100
The taxes are: 100-10*8.26=17.40
So these calculations are perfectly correct too.

I still don't see what you want me to fix as so far all the examples I tried from you worked out properly.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg2NDE0OC1pbnZvaWNlLXRheC1jYWxjdWxhdGlvcy1oYXMtYW4tZXJyb3I/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.228 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
