Jump to content

TAX amount needs to be rounded UP and not down


Recommended Posts

When generating an order with the TAX value shown as 17.5% the order initially shows a figure which at invoice end differs as it appears that it rounds the figure down tothe nearest penny and not up.

e.g. If you generate a product which is £35.00 + tax...

The order screen shows tha total correctly at £41.13 but when it comes to the invoice stage it rounds it down to £41.12

 

Anything that can be done in the code here?

 

Thanks

Link to comment
Share on other sites

I'm not confirming this observation, just commenting.

 

I think tax rounding should be neither up nor down. As a rule it should be to the nearest cent.

i.e. >=0.005 = 0.01

and < 0.005 = 0.00

 

The other issue is what to round and when.

Say a price is 61.355 (just for argument sake)

10% tax is 6.1355

Total is 67.4905 ROUNDED > 67.49

 

In this case the Australian tax office would expect to receive 6.14 (10/110*67.49)

 

IMHO, on the invoice, the rounding should be

goods 61.355 = 61.36

tax 10% 6.1355= 6.14

invoice total 67.50 (no rounding necessary)

 

tax payment 10/110*67.50 = 6.14

 

Just another thought, is PHP rounding always accurate?

I remember... many moons ago... when I used to code the odd BASIC program or two, we used to get rounding errors.

I stopped using the round() function and used my own instead (add .005 and truncate)

 

Cheers from Downunder,

 

Ozzie

__________________

 

/me Australian (thats my excuse and i'm stickin to it.

Link to comment
Share on other sites

In his example, it would come out to 41.125 which should be rounded to 41.13 (If on the other hand, it had been 41.124, then yes... rounding to 41.12 is fine)

 

I believe PHP's round() function will do this properly - it sounds as if the invoice is just trimming it to 2 decimals rather than rounding. But I dunno, just adding my own comment.

 

I finally had the chance to download and install WHMCS Beta R2 today and play with it a little.. I can't wait for the release so I can start using some of the new features for my customers (such as Tax and being able to assign affiliates to orders, and so much more!)

Link to comment
Share on other sites

  • 2 weeks later...
  • WHMCS CEO
In V3 Beta 2 they are not rounding, i have the same problem.

 

Ruben

Are there any specific details you can provide about this so it can be recreated? Like when this happens and where? What amounts are being used, what tax rate is set, etc...?

 

Matt

Link to comment
Share on other sites

  • 1 month later...
Hi,

 

This seems to be working on my local copy here so I think some changes since the R2 BETA must have corrected this issue.

 

Matt

Matt,

 

I'm sorry, but something is definitely wrong and should be looked at:

 

situation analysis:

program

License Type: Owned License

License Expires: Never

Version: 3.0.0

------------------------------------

salex tax rule AU = 10.0%

sales tax exclusive switch = ON

price 14.95

Tax Product = ON

Client Country = AU

Tax client = ON

------------------------------------

results:

 

On screen order shows OK

product 14.95

sales tax 1.50

total 16.45

 

Order Confirmation email

 

Cpanel Hosting - Bronze Plan (tax-enabled.com)

Amount: $14.95 AUD Monthly

<<=============== no tax showing

Total: $16.45 AUD

 

Invoice confirmation

 

Bronze Plan - tax-enabled.com (02/03/2007 - 02/04/2007) $14.95 AUD

------------------------------------------------------

Sub Total: $14.95 AUD

Credit: $0.00 AUD

10.00% Tax Due: $1.49 AUD <<========should be 1.50

Total: $16.44 AUD <<===============should be 16.45

------------------------------------------------------

 

Invoice

 

$14.95 AUD

Sub Total: $14.95 AUD

Credit: $0.00 AUD

10.00% Tax Due: $1.49 AUD

Total: $16.44 AUD

 

I will repeat this test with sales inclusive

 

Kind regards,

 

Ozzie

Link to comment
Share on other sites

hi ozzie,

 

i had the same issues (tax no showing) + 0.01 differs (wrong calc...)

 

tax no showing in order confirmation email is still an issue i just cut-off that part and only show [Product] and [Amount]. remember an invoice is send at the same time. hope this get fixed soon.

 

about the 0.01 minus. i reported that error since v3 release. Matt said it was because of the database version i use (MySQL 4.x), uhh? he did "some code changes" and issue get fixed. Later (a couple of day ago) i re-installed whmcs to get "all this files update" (bug report fixed) thinking that all of them was included in the zip.

 

in my case, it seems this 0.01 issue get fixed. but this "no tax showing" is new. hehe....

 

if you wonder where is the file that fixe 0.01 ?? i narrowed down to "include" folder. so download the .zip from client area and upload that folder (binary mode).

 

NOTE: it's a good idea to make a backup of "include" folder on your server before u upload the new one.

Link to comment
Share on other sites

Same settings as before except for

sales tax inclusive switch = ON

 

order step 4

 

$16.45 AUD

Subtotal: $14.95 AUD

GST @ 10.00%: $1.50 AUD

Total Due Today: $16.45 AUD

Total Recurring: $16.45 AUD Monthly

:) Heh, this looks promising :)

 

invoice

 

$16.45 AUD

Sub Total: $14.95 AUD

Credit: $0.00 AUD

10.00% Tax Due: $1.49 AUD

Total: $16.45 AUD

 

Pitty, wrong again

 

Order Confirmation email

 

Cpanel Hosting - Bronze Plan (tax-inclusive.com)

Amount: $16.45 AUD Monthly

no tax showing

Total: $16.45 AUD

 

This was to be expected. Not as dramatic on this instance since the advertised price would have been $16.45, still should be shown for consistency.

 

Invoice confirmation email

 

Bronze Plan - tax-inclusive.com (02/03/2007 - 02/04/2007) $16.45 AUD

------------------------------------------------------

Sub Total: $14.95 AUD

Credit: $0.00 AUD

10.00% Tax Due: $1.49 AUD

Total: $16.45 AUD

------------------------------------------------------

 

Over to you Matt.

 

Kind regards, Ozzie

Link to comment
Share on other sites

hi ozzie,

 

out the 0.01 minus. i reported that error since v3 release. Matt said it was because of the database version i use (MySQL 4.x), uhh?

Mmmm,

 

Sounds like a strange proposition to me, I've never heard of a database engine of any sort, causing rounding errors. Usually it's not the database doing calculations of any kind.

 

But, I'm willing to learn and look forward to a further explanation from the experts.

 

Cheers,

 

Ozzie

Link to comment
Share on other sites

The order confirmation email not showing the tax is a known issue in V3. For the rounding error, you'll need to open a ticket so I can take a look.

 

Matt

And Matt looked and it was good. :lol:

 

Problem solved.

 

FOR ALL YOU CURIOUS PEOPLE OUT THERE

The solution is : An upload of the latest V3.0.0 files

(which I thought I had from a 5 Feb 2007 download...)

 

Cheers, Ozzie

Link to comment
Share on other sites

for tax issue or rounding one?

That's the rounding one.

The confirmation email is a known problem, as Matt said.

So I assume it will be corrected in a future release.

 

And so it should, I think, but it is not a showstopper for me.

The rounding issue was.

 

Cheers, Ozzie

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated