Post by SXGuy » Mon Aug 18, 2014 3:41 am

System -> Localization -> Currencies. Set your default currency to 1.00000000

Opencart allows for 8 decimal places as far as I can see.

By using 8 decimal places, you will limit rounding issues to very very rare orders.

If you can show me, where the law says you must use 4 decimal places, then i'll stand corrected.

In the UK, our government (HMRC) allows for rounding issues, because they understand, you can not round down every gross price to a whole number.

Its very unlikely, your government doesn't understand the same thing.

Your only issue, is the customer paying what he/she believes to be the price, and not finding the actual total differs. Therefore you if use the most amount of decimal places you will be fine.

Remember, you are rounding DOWN from price inc tax, to price ex tax to enter it in to opencart product

22 less 21% tax = 18.18181818181818 or for opencarts sake, 18.18181818 either way, when added multiple times, will still equal the correct amount

22 x 2 = 44. (18.18181818 x2 = 36.36363636 + 21% = 43.9999999956 or 44)

Or have I missed something here?

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by fabrizio » Mon Aug 18, 2014 7:03 am

I have already set 1.00000000 in the currency (€).
The law ( Italy ) say that in the invoice you must write numbers with 2 decimals, rounded down 1c if the third decimals is <5 or rounded up 1c if the third decimals is >/= 5.
In the shop i set the prices with 4 decimals, why this?...as i wrote if i set 2 decimals in the cart i have a price and in the Total /sub-total ( no vat ) i have different numbers and this create a confusion in the customer. Orders are always hundreds and thousands of items!!!..i'm not talking about 1c of difference but much more.
This is the issue and for this i have the prices with vat with for decimals and the math is correct in the cart/totals...but i have to edit the invoice ( Sub-total, total, Iva, shipping cost mus be 2 decimals!) and i cannot use Paypal module----it's complicated but i have no choice.
I tried that module, with prices included vat in admin, but the problem is still there..i have tried other modules but no way to have the same number in the cart and in the Totals. Maybe with a low number of items it works.
I have understood that the problem is that OC calculate the Tax ( Vat/IVA ) on a not rounded number...instead it would be better to round the price first and then apply the Vat..this way i think all would be fine.

Newbie

Posts

Joined
Thu Apr 04, 2013 1:06 am

Post by takahashi1973 » Fri Sep 26, 2014 5:51 pm

Posted this VAT + Round logic problem in Github OC 2.0 development.

Daniel responded quickly by saying it is a know issue and should be solved in OC 2.0

I posted some fixes which rougly/for most shops would work but it is not a 100% solution unfortunately.

In NL B2C shops should show all total values incl. vat so I know what headache this logic causes.

Active Member

Posts

Joined
Thu Oct 13, 2011 11:41 pm

Post by light25 » Mon Dec 08, 2014 4:48 pm

Why can't we just set the the column decimal places to 2

Newbie

Posts

Joined
Wed Dec 03, 2014 3:54 pm

Post by roadrunner » Fri Mar 06, 2015 3:50 pm

Hello there,

Any updates about this after trying oc 2.0.*.*?

Newbie

Posts

Joined
Thu May 29, 2014 2:02 pm

Post by froschgift » Sun May 31, 2015 8:09 pm

This problems exists in OC 2.0.3.1 !!

I tried to open a thread about it in the Bug Report forums for OC 2 but it seems my thread won't be approved to show up...

This needs to be fixed because this way it's useless in germany!

Take a look at the attached screenshot to see the problem

Attachments

Screen Shot 2015-05-29 at 22.22.56.png

Screen Shot 2015-05-29 at 22.22.56.png (177.33 KiB) Viewed 14380 times


Newbie

Posts

Joined
Sat May 30, 2015 4:16 am

Post by fabrizio » Tue Jun 02, 2015 11:08 pm

Hi Froschgift,
i have already lost my hope on this issue, i was forced to switch to another platform because as you say in Europe OC is useless. The math only works if you have no decimals in admin product prices....45..100 etc etc..if you put 40,99€ you have the problem in the cart with wrong calculation...I tried everything as to introduce product prices already with VAT in admin but nothing works. The only solution is to show 4 decimals, and you have the right math but you cannot usePayPal..Good luck.

Fabrizio

Newbie

Posts

Joined
Thu Apr 04, 2013 1:06 am

Post by trueliar » Mon Jun 15, 2015 8:55 pm

same problem. Even if we have developed several things on opencart we have moved new shops to other cart systems.

New member

Posts

Joined
Sat Jan 11, 2014 12:09 am

Post by davidbfranks » Thu Aug 13, 2015 3:44 pm

Same issue here, I cannot believe this has not been fixed in OC2

Active Member

Posts

Joined
Mon Mar 04, 2013 10:31 pm
Location - London

Post by micrdy » Tue Nov 03, 2015 4:56 pm

Same issue here. Has somebody found a fix for this?

New member

Posts

Joined
Mon Mar 09, 2015 6:40 pm

Post by michaelsen » Tue Apr 26, 2016 11:32 pm

Most of us display the price to our customers with 2 decimals, so why work with 4 decimals in the database?
The price field in the oc_product and oc_product_discount has 4 decimals. I haven't done it yet, but I think it will fix the problem if we changed that to 2.

New member

Posts

Joined
Tue May 03, 2011 3:17 am

Post by OneManShow » Sat May 07, 2016 10:20 pm

Same issue here.

It is really embarrassing for me, recently won the deal for 4 OpenCart installations, I've just found about this issue... I am not sure how to get this solved properly... please post here if you find out.

An extension that does the job would be fine as well...

Thakns!

Newbie

Posts

Joined
Sun Sep 29, 2013 10:35 pm

Post by OneManShow » Sat May 07, 2016 10:47 pm

Well,

Now, I am a little bit confused with what I was doing just couple of minutes earlier and why it seemed an issue.

It looks like this issue is solved for me... I have the total amount (NET + VAT) of 19,00, I've just started to calculate VAT from the total amount with 4 decimals, entered into the price field the amount before VAT and it looks fine... of course...user does not see 4 decimals on the website, just h2.

Regards,

Newbie

Posts

Joined
Sun Sep 29, 2013 10:35 pm

Post by DaCrash » Wed Nov 02, 2016 2:04 am

Hello, the problem is still not solved.

48 x 18.92 = 908,21 ????? Every german accounting office is screaming if they see someting like that....
I should had take another shop system....


Any Ideas?

Attachments

2016-11-01 16_13_49-Aufträge.png

2016-11-01 16_13_49-Aufträge.png (9.08 KiB) Viewed 12748 times


Image
DG-Webservices- Webdesign und Programmierung aus Friesland


User avatar
New member

Posts

Joined
Mon Feb 22, 2010 8:02 pm
Location - Germany

Post by IP_CAM » Wed Nov 02, 2016 9:13 am

Move to Switzerland, we don't even bother with such small Values, either, it 19.95, or then 20.00 ! :D
Just joking, but in our Currency, 1+ 2 Cent pieces of money really dont exist anymore...
Ernie

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by ADD Creative » Tue Nov 08, 2016 7:21 pm

DaCrash wrote:Hello, the problem is still not solved.

48 x 18.92 = 908,21 ????? Every german accounting office is screaming if they see someting like that....
I should had take another shop system....


Any Ideas?
A work around is to set the excluding tax price to something that will be closer to 2 decimal places value shown including tax.

So instead of a price of 15.9000 which is (15.9000 * 1.19) 18.9210 including tax.
Set the price to 15.8892 which is (15.8992 * 1.19) 18.920048 including tax.

However you will always see these issues at some point.

Other than that you would need to make a lot of changes to the code to combine the tax calculation with the currency conversion so the individual price was always calculated to the correct amount decimal places.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by Frances » Sat May 09, 2020 1:56 am

ADD Creative wrote:
Tue Nov 08, 2016 7:21 pm
DaCrash wrote:Hello, the problem is still not solved.

48 x 18.92 = 908,21 ????? Every german accounting office is screaming if they see someting like that....
I should had take another shop system....


Any Ideas?
A work around is to set the excluding tax price to something that will be closer to 2 decimal places value shown including tax.

So instead of a price of 15.9000 which is (15.9000 * 1.19) 18.9210 including tax.
Set the price to 15.8892 which is (15.8992 * 1.19) 18.920048 including tax.

However you will always see these issues at some point.

Other than that you would need to make a lot of changes to the code to combine the tax calculation with the currency conversion so the individual price was always calculated to the correct amount decimal places.
Thank you for this workaround, it's a perfect solution for my website A pain in the butt, but it works ;D ;D ;D

Newbie

Posts

Joined
Sun Mar 04, 2018 3:21 am

Post by victorj » Mon May 11, 2020 4:19 am

Same problem here.
It even gets worde when large numbers are ordered.

Solved it by storing product price ex tax with 8 decimals in database.
used phpmyadmin to alter product price, set decimals to 8 and altered product template so 8 decimals can be used.

Koeltechnische deurrubbers eenvoudig online op maat bestellen.
Alle niet stekplichtige onderdelen zoals scharnieren, sloten, randverwarming en verlichting voor alle typen koelingen en vriezers.
https://koelcel-onderdelen.com


User avatar
Expert Member

Posts

Joined
Sat Jun 25, 2011 4:09 am
Location - Alkmaar Holland

Post by MB242 » Wed Jan 06, 2021 7:10 pm

victorj wrote:
Mon May 11, 2020 4:19 am
Solved it by storing product price ex tax with 8 decimals in database.
used phpmyadmin to alter product price, set decimals to 8 and altered product template so 8 decimals can be used.
Hello victorj,
I have exactly the same problem. Can you please share product template modifications? I could not find the right file...
Thank you.

Newbie

Posts

Joined
Mon Dec 21, 2020 6:02 pm

Post by victorj » Wed Jan 06, 2021 7:52 pm

you need to change that in your database only.

Koeltechnische deurrubbers eenvoudig online op maat bestellen.
Alle niet stekplichtige onderdelen zoals scharnieren, sloten, randverwarming en verlichting voor alle typen koelingen en vriezers.
https://koelcel-onderdelen.com


User avatar
Expert Member

Posts

Joined
Sat Jun 25, 2011 4:09 am
Location - Alkmaar Holland
Who is online

Users browsing this forum: No registered users and 38 guests