Post by JNeuhoff » Wed Jan 07, 2009 7:17 pm

The normal U.S. rounding rules specify that taxes are calculated by assessing the tax rate to the total cost of all of the items and then using the HALF_EVEN rounding mode, or banker's rounding, to determine the tax for the order. These rules are substantially different from the default rounding rules for U.K. merchants. For U.K. merchants, the default behavior is to calculate tax separately for each item in the order and then apply the HALF_UP rounding mode to each calculation.

I think we need to carefully investigate these issues and make sure the rounding rules are correctly implemented in OpenCart. I stumbled upon it while working on the Merchant Calculations API for the new Google Checkout module.

Take a look at the country-specific rounding rules. Qphoria, does PayPal have similar distinctions between different rounding-rules?

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by Qphoria » Wed Jan 07, 2009 8:50 pm

For Website Payment Standard, there are no rules. You just pass all values as you want them charged.
However, it seems they do impose some rounding on totals, like withdrawls from your account to your bank, and apparently it has made at least this guy upset over his missing penny.

IIRC, php's number_format is doing the rounding.
Looking at some output from that function:

1.234 = $1.23
2.345 = $2.35
2.001 = $2.00
2.1 = $2.10
1.2345 = $1.23

Looks like it does "HALF_UP" rounding anyway...

So I guess the concern here is only for US stores, that you might display $5.01 on your opencart site, but Google might display $5.02 on their site?
Last edited by Qphoria on Wed Jan 07, 2009 8:51 pm, edited 1 time in total.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by hm2k » Wed Jan 07, 2009 9:32 pm

Related, you may also find this useful: http://wiki.php.net/rfc/rounding

UK Web Hosting


User avatar
Global Moderator

Posts

Joined
Tue Mar 11, 2008 9:06 am
Location - UK

Post by Qphoria » Wed Jan 07, 2009 10:31 pm

Also on the "round" php function, search for "half_even" and you will find user created functions for proper calculations:

http://www.php.net/round

But then do we trigger the rounding method based on
US = Half_Even
Non-US = Half_up

Are there other countries with rules too?
Perhaps we should include the user-made functions for half_up/down/even and set the rules to be configurable, kinda like how weight units are configurable, you can set the method by country as desired, with US and UK entered by default for you.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by totall » Mon May 17, 2010 9:48 am

Just thought I would add this here as I have just started using Opencart and come across this problem, I'm in New Zealand and we don't use any rounding for our tax. It's just a straight calculation. Our rate is currently 12.5% for all Goods and Services. I have a feeling that Australia is also similar (no rounding) but their rate is 10%.

I would like to agree with the suggestion of making the rounding rules user configurable.

Being that it won't be a quick fix, would someone be kind enough to point me in the direction of the file that does the rounding so that I can change it for my needs.

Newbie

Posts

Joined
Mon May 17, 2010 6:36 am

Post by Xsecrets » Mon May 17, 2010 11:21 am

totall wrote:Just thought I would add this here as I have just started using Opencart and come across this problem, I'm in New Zealand and we don't use any rounding for our tax. It's just a straight calculation. Our rate is currently 12.5% for all Goods and Services. I have a feeling that Australia is also similar (no rounding) but their rate is 10%.

I would like to agree with the suggestion of making the rounding rules user configurable.

Being that it won't be a quick fix, would someone be kind enough to point me in the direction of the file that does the rounding so that I can change it for my needs.
how do you not round? you just show 3 or 4 decimal places whatever it takes? what if you wind up with a repeating number? and at that how do you manage to pay a fraction of your lowest denomination of currency? You have to round one way or the other.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by totall » Mon May 17, 2010 12:27 pm

Xsecrets wrote: how do you not round? you just show 3 or 4 decimal places whatever it takes? what if you wind up with a repeating number? and at that how do you manage to pay a fraction of your lowest denomination of currency? You have to round one way or the other.
That is a very valid point, I know what I was thinking, we round to 2 decimal places.

Newbie

Posts

Joined
Mon May 17, 2010 6:36 am

Post by alenbillo2346 » Wed May 19, 2010 2:07 am

there are two rounding method bounding and unbounding
Unbiased Rounding
Round to nearest exact number
For 0.5 case, round so that result is even
o Example for integers
o 2.5 rounds to 2
o 3.5 rounds to 4
This avoids bias in rounding

payroll software
online payroll


Newbie

Posts

Joined
Tue May 18, 2010 4:46 pm
Who is online

Users browsing this forum: Ellen261Rister, Google [Bot], muko34 and 17 guests