Tax rounded error

Discuss here how to configure hoteldruid and better use its features.

Moderator: marco

Post Reply
olivierjoncourt
Posts: 9
Joined: Fri Jul 27, 2012 11:28 am

Tax rounded error

Post by olivierjoncourt »

Hello everybody

I use Hoteldruid without problem on my website but since the last update (2.0.0 and 2.0.1) I have a problem with the tax calculation.

1/ The problem appears when there is a rounded apply. I'm in Canada and I had 2 taxes on the base rate: ex

******************************************************************************
Rate type: 2 Bedroom Deluxe (465 CAD$ ) .
Single extra cost "GST" (5% of total multiplied by 1: 23.25 CAD$ ).
Single extra cost "PST" (10% of total multiplied by 1: 48.82 CAD$ ).

Total to be paid: 537.7 CAD$
*******************************************************************************
Total amount is wrong, the right price should be 537.07 CAD$

If I don't have taxes with decimal (ex .15.00), no problem. Trouble is decimals.

2/ Currently, for a tax = $ 12,231 CAD, the rounding will be 12. $ 23 CAD, this value is right.
But if tax = $ 12,237 CAD, again the rounding will be a $ 12.23 CAD when it should be for $ 12.24 CAD.

For online reservation, it's a problem. If anyone has a solution to these problems, I'll appreciate.

Thank you and congratulations for the work.

Olivier
Malpeque Cove Cottages
marco
Posts: 1332
Joined: Tue Jul 05, 2005 6:00 pm
Location: Roma, Italia

Re: Tax rounded error

Post by marco »

Hello Olivier,
the problem should be solved in hoteldruid 2.0.3.

Regards,
Marco
Problems installing, configuring, upgrading?
Try the easiest way to use HotelDruid:
https://www.digitaldruid.net/hosted/index.php
CutNGlass
Posts: 31
Joined: Sat Aug 24, 2013 10:30 am

Re: Tax rounded error

Post by CutNGlass »

The rental tax rate in US North Carolina is 11.75%. Since the application does not allow us to enter that percentage, we handled it by creating an "Extra Cost" item. NC Tax. However, we have found that the rounding issue discussed here also affects the Extra Cost calculations. So, in our case, the tax when added to the amounts, does not round properly. This causes us to many times end up with amounts that should be 94.07, to show as 94.06.

Any help would be appreciated.

--(scott)
CutNGlass
Posts: 31
Joined: Sat Aug 24, 2013 10:30 am

Re: Tax rounded error

Post by CutNGlass »

Stretching my mind back a few years (1980, 1981??) ...
-- I believe the computer course was called "Numerical Computational Methods" and the course book was entitled "Numerical Calculus".

There was a whole section surrounding how to determine the number of decimal places needed for calculation variables, so that the result was accurate to a particular number of decimal places.

Basically, if you want accuracy to two decimal places, then the calculations would need to be performed on 3-4 decimal places (accuracy to the 0.01 place, calculations must be done at least to 0.001 or 0.0001 places).

This is the type of thing:
-- http://www.symphony-consulting.com/blog ... -rounding/
----- (a lot to say, do your calculations with more decimal places than you want final accuracy to be)

-- http://cr4.globalspec.com/thread/27880/ ... lculations
----- (to cut down on decimal round-off errors during calculations, you can multiply by 1000, do the calculations, and then divide by 1000)

-- http://encyclopedia2.thefreedictionary. ... l+calculus
-----
An otherwise satisfactory computational process may become useless, because of the amplification of rounding errors. A computational process is called stable to the extent that its results are not spoiled by rounding errors. The extended calculations involving millions of arithmetic steps now possible on computers have made the stability of a computational process a prime consideration.
I think that it would be accurate to say that if you NEED to be accurate to two decimal places, you cannot simply do your calculations with variable that only have two decimal places.

-- (mary)
marco
Posts: 1332
Joined: Tue Jul 05, 2005 6:00 pm
Location: Roma, Italia

Re: Tax rounded error

Post by marco »

The rounding is done by php functions, so no need to have more decimals. The error won't propagate as the value is not even stored in the database, it is calculated each time it is shown. At least from version 2.0.3 it's possible to insert percentages with 2 decimals for taxes.

Regards,
Marco
Problems installing, configuring, upgrading?
Try the easiest way to use HotelDruid:
https://www.digitaldruid.net/hosted/index.php
CutNGlass
Posts: 31
Joined: Sat Aug 24, 2013 10:30 am

Re: Tax rounded error

Post by CutNGlass »

Okay, I'm confused. When do you anticipate us being able to enter 11.75% tax rate? I can enter 6.75% or 11.7%, but not 11.75%, which is what we need.

In extra costs, we can enter 11.75% for tax rate

In defining over-all tax:
Insert >> Rate
Go down to "Taxes" area:
Field only allows 3 digits total (combined both before and after decimal).
I can enter 6.75% or 11.7%, but not 11.75%

Perhaps when we can use the actual tax field for the tax, the occasional $0.01 (1 cent) error will no longer be there.
CutNGlass
Posts: 31
Joined: Sat Aug 24, 2013 10:30 am

Re: Tax rounded error

Post by CutNGlass »

Marco:

Thanks for fixing this. We are now able to enter 11.75 % tax amount in the tax field on Rates.

--
Mary
Post Reply