Post by antipodi » Fri Mar 01, 2013 9:46 pm

Hi,
I've encountered a problem (OC 1.5.4.1): the system does not use the rounded product price to calculate the total.
E.g.:
"Product X". € 5,54 (tax excluded) = € 5,995 (with 10% tax). The system show € 6,00 (rounded) in the pages.
If I buy 4 "Product X" the total is € 23,98 (but it should be € 24,00).

Do you encountered the same problem?
Suggestions?

Kind regards.

Newbie

Posts

Joined
Thu Feb 14, 2013 10:56 pm

Post by Daniel » Sat Mar 02, 2013 11:48 pm

you mean the admin displays this! if its the admin it does not matter its supposed to.

if its the front end then it means you have not set the decimal places up under currencies.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by antipodi » Mon Mar 04, 2013 6:11 pm

What do you mean?

I've set correctly the decimals in admin.

Here you can see the problem: http://shop.tibiona.it/latte-scremato-in-polvere-1kg
Try to put in the cart 4 items of this product.
As you can see, the price without taxes is 5,45€. Tax is 10%. So the rounded price with 2 decimals is 6,00€.
In the cart you should see 24,00€ instead of 23,98€.

Newbie

Posts

Joined
Thu Feb 14, 2013 10:56 pm

Post by takahashi1973 » Wed Apr 10, 2013 10:13 pm

Right; we have this problem too.
Currency is set to 2 decimals.
1 product costs: X
But we started to use discounts: 6 for XX, 36 for YY

Now we see some minor price difference in products total calculation.

WHY?
I think I found why.

Productprice including vat when buying 6 is 5.97 eur.
6* 5.97 = 35,82
BUT totals show: €35,79

5.97/1.21 (21% vat) = 4.93
4.93 = price ex vat * qunatity (6) = 35,79

Where you/clients would expect: 6* 5.97 = 35,82

I am searching now WHERE / in what file the calculation is done so I can reverse the logic
Take product price EX VAT --> add vat = corrrect price incl. vat and then * quantity

but somehow I cannot find it yet ;-)
Anyone?


We use an older 1.5.1.3 opencart version and i see it was also a bug reported
https://code.google.com/p/opencart/issues/detail?id=864

with comment: Already fixed
but in what file :) ......

Active Member

Posts

Joined
Thu Oct 13, 2011 11:41 pm

Post by Daniel » Thu Apr 11, 2013 12:53 am

think about this very carefully. its to do with converting currencies and having 8 decimal places.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by takahashi1973 » Thu Apr 11, 2013 4:24 pm

Hi Daniel,

Ok a currency conversion but the problem is customer can see the total is incorrect so would be better to have it 100% correct I think.

We have only one currency eur 1.0000000 is the value.

Active Member

Posts

Joined
Thu Oct 13, 2011 11:41 pm

Post by takahashi1973 » Mon Apr 15, 2013 3:37 pm

Daniel,

Could you please point me to where/in what file/files to test/edit to see if we can get those totals ok?
We're searching but ...somehow cannot find the right function.
Thank you.

Active Member

Posts

Joined
Thu Oct 13, 2011 11:41 pm

Post by takahashi1973 » Fri May 03, 2013 2:39 am

Found the logic and fixed/tweaked the problem as described in this thread.
anyone needs this tweak? Post a pm or reply in this thread.

Active Member

Posts

Joined
Thu Oct 13, 2011 11:41 pm

Post by Daniel » Mon May 06, 2013 12:15 am

post the fix here. if its any good i might include it.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by takahashi1973 » Mon May 06, 2013 3:32 pm

Daniel, I check with my co programmer and see if we can send you a clear code

Active Member

Posts

Joined
Thu Oct 13, 2011 11:41 pm

Post by takahashi1973 » Wed May 15, 2013 2:29 pm

Ok Daniel, here are the files.

I know this is kind of particular for our client shops/dutch webshops where the law demands that ALL prices show including vat. so also products total, subtotal, shippingcosts should all be showing including vat.

but the products total incl. vat issue this thread is about also occurs on a standard opencart setup.

Active Member

Posts

Joined
Thu Oct 13, 2011 11:41 pm

Post by fabrizio » Mon Jun 03, 2013 7:51 pm

Hi folks,
this is a big issue for me too. I'm forced to use 4 decimals in the website because i prefer to show up the right value than mistakes in the math. My shop sell items like nuts, screws and with multiple orders there is a big difference in the math ( 1000 x 0.29= 290.60 for example ) and accounting issue too!!.
Yesterday i tried the tweak of Takahashi ( thank for your effort!), but in my shop the law demand the subtotal,shipping costs without Vat, the Total include the Vat.
I loaded the xml file and all seems to be ok in the cart, i mean the math is ok..1000 x 0.29 = 290..i bought other products and all was fine at first view, but the problem surge with subtotal that doesn't include vat and the math isn't correct
I have this situation in the cart

10 x 18.46 = 184.60 (prices include Vat )
1000 x 0.29 = 290
Total vat included is 474.60
The subt-total show 392.75 ...now if a add 21% ( VAT ) to this i should have 474.60 instead i have 475.23 ( subtotal is calculated with 4 decimals?)
I think that te system continue to use 4 decimals to calculate the unit prices.... i mean that it show 0.29 but OC use .2906 to do the math
I say this because i was looking at the order mail that the system send to the customer and there i have this situation different from the numbers that the customers see in the cart during the shopping:

10 x 18.46 = 184.59
1000 x 0.29 = 290.60


This is real a brain teaser...anyway i think i'm the only one with a 4 decimals shop in Europe!!;-)
Thank you for your efforts to resolve this problem.

Fabrizio

Newbie

Posts

Joined
Thu Apr 04, 2013 1:06 am

Post by takahashi1973 » Wed Jun 12, 2013 2:31 am

Hi!

I think we could tackle this, sorry to respond so late.

VAT and rounding are a ...........ass.
This problem occurs in many shops but in some they don;t due to heavy functional programming for sure.

send me a private message and I send you my emailaddress or we can discuss on this board and see if we can fix it for you.
Might take a few hours and sorry to say but we do not work for free.

Active Member

Posts

Joined
Thu Oct 13, 2011 11:41 pm

Post by takahashi1973 » Wed Jun 12, 2013 2:41 am

Daniel,

Terrible laws all over the world regarding VAT calculations and we have almost seen the end of some terrible tweaking needed for shops under different vat laws.

mixed vat in orders and for instance orders with rewards,coupons, discounts.......
plain terrible.
IF a shops sticks to the default setup there is no problem at all but many countries in EU specially demand B2C shops to show ALL prices including vat EVEN when the + - in totals seems wrong like this:

subtotal: 119 € incl. vat
shipping: 10 incl. vat
vat: 22.39
total: 129,00 incl. vat

and that is not even without discounts/mixed orders/rewards et cet.

Making it a configuration issue like in Magent**** I think is the only way to solve it completely but means some pretty programming for sure.

Anyway: this is a suggestion to see if something can be done about this in opencart.
Happy to tweak for our clients, we are nearly there and done all kinds of country VAT rules tweaks on those totals modules but still are nasty things to work on and test.

Active Member

Posts

Joined
Thu Oct 13, 2011 11:41 pm

Post by ILC » Wed Aug 28, 2013 8:34 am

Hi Takahashi,

You posted the cart totals as shown below:

subtotal: 119 € incl. vat
shipping: 10 incl. vat
vat: 22.39
total: 129,00 incl. vat

I'm new to OpenCart after migrating from another system that we used for 10 years, but this is exactly how I need my checkout to appear to my customers. I've tried various admin settings to try and achieve it, is it possible to do or is it a code change that is required to do this? (At this stage rounding isn't my issue!)

If anyone can offer some pointers or advice that would really help in getting this working!

Thanks,
Iain

ILC
Newbie

Posts

Joined
Mon Aug 12, 2013 7:23 pm

Post by takahashi1973 » Tue May 06, 2014 4:34 pm

The attached VQMOD files do work.

Active Member

Posts

Joined
Thu Oct 13, 2011 11:41 pm

Post by Dekari » Wed Aug 06, 2014 11:03 pm

Hello ,

the attached files for vqmod works perfect for showing correct prices in product list in cart/ checkout...

but the order totals are not correct!!

Can see the error in my site by adding in the cart 2 of the following product:

http://www.vitakids.biz/shoponline/inde ... Itemid=563

the total for product is 2 x 51.00 = 102.00 (CORRECT)

but in the order totals the sub-total / total is 101.99 (NOT CORRECT)
and should have been 102.00

any workaround???/

thanks a lot

Newbie

Posts

Joined
Wed Aug 06, 2014 11:00 pm

Post by fabrizio » Wed Aug 13, 2014 11:45 pm

Hi Dekari,
after one year i still have this problem too ( i use 4 decimals in price to repair this );it's a big problem from an accounting point of view!!. I tried that vqmod but i doesn't work. Maybe for 1, 2 items in the cart math is ok sometimes...but if you add hundreds of items the error is still there and i have almost 1 euros of difference in some carts! .
I don't know if the new version of OC has still this issue, i hope they resolve this problem. I hope someone can give us an aswer. Thank you all.
Ps: i have 1.5.4. OC

Fabrizio

Newbie

Posts

Joined
Thu Apr 04, 2013 1:06 am

Post by SXGuy » Thu Aug 14, 2014 4:36 am

You can not fix this issue for 1 simple reason.

All of you, are trying to calculate VAT/TAX on VAT/TAX inclusive prices. This will always give you problems, because not every number you can think of, excluding VAT/TAX will be a whole number, or at the very least have only 2 to 4 decimal places!!!

How far exactly do you people want to go with this? if you had a number such as 12.2348783 you will still have an issue with 4 decimal places because it would ignore the 5th, and so on, and so on. Any number after the last decimal place you use which is higher than 5, will always cause you a rounding issue. This isn't opencarts fault, this is a rounding problem.

The only sure fire way, you will ever get correct results, is to know, exactly what your NET price should be, before applying VAT/TAX. It doesn't matter HOW you need it to display on your store (inc or excl) its the actuall calculation you are having trouble understanding.

The only way you will ever have correct totals is to use Nth decimal places, this means, using EVERY number after the decimal place in ALL calculations.

If you understand how VAT/TAX is applied net to gross, and how you have to use fractions to calculate the reverse, you would understand, not every result will be the same.

If I had a gross price of 120 (inc vat of 20%) I would need to use 1/6 as a fraction to work out what the vat would be on the gross. if I used Net prices, I can simply ADD 20%

120 is a bad example because it will work out to a whole number, but not every number sequence works the same way, and you will have variations if you decide to limit how many decimal places you use in your calculations.

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by fabrizio » Mon Aug 18, 2014 1:20 am

Hi SXGuy,
if it cannot be fixed it does mean that in EU we cannot use Opencart platform ( unless you use 4 decimals prices!), because it causes big accounting problems in most of EU contries, that' all.
I think it can be resolved as in Magento or Prestashop..how does it works with those softwares?...i have used and using those platforms and i have no rounding issue, why it cannot be resolved with Opencart? .i wish i could resolve this but i'm not a programmer..argh!!
Anyway i'm positive and i hope that one day they resolve this issue, it would be nice.

regards

Fabrizio

Newbie

Posts

Joined
Thu Apr 04, 2013 1:06 am
Who is online

Users browsing this forum: No registered users and 25 guests