Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A common tax scenario
Message
From
23/05/2012 14:57:52
Al Doman (Online)
M3 Enterprises Inc.
North Vancouver, British Columbia, Canada
 
 
To
23/05/2012 13:40:04
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01544104
Message ID:
01544184
Views:
33
Likes (1)
>>Re: the calculation, I'd just back out the values in the reverse order they were originally calculated.
>>
>>If you start with total value $574.88 (actually $575.875), that is 1.095 * ( Price + FedTax ), so
>>
>>( Price + FedTax ) = 574.88 / 1.095, = 525.00
>>
>>Then, ( Price + FedTax ) = Price * 1.05, so
>>
>>Price = ( Price + FedTax ) / 1.05, = 525.00 / 1.05, = 500.00
>>
>>If you want to do it all in one step:
>>
>>T = total dollar value including all taxes
>>P = provincial tax rate as a decimal e.g. 9.5% = 0.095
>>F = federal tax rate as a decimal e.g. 5% = 0.05
>>I = item price
>>
>>Then I = ( T / ( 1 + P ) ) / ( 1 + F )
>
>We do not have the total dollar value including all taxes, as defined here with the T variable. This is the hole problem here we have to workaround. The only thing I have is the total amount for the taxes, which is 74.88$ in our example. From that amount, we have to go back to 500.00$, as we test for Quebec presently. So, this is why, in the other thread, Gregory is working on that fancy method to reverse engineer the entire process.

OK, I didn't realize that.

After a little bit of algebra, I get the formula, using same variables as above plus:

X = total dollar amount of taxes

I = X / ( P + ( P * F ) + F )

If you plug in X = 74.88, you get I = 500.03339, which is the problem you saw earlier.

If you plug in X = 74.875, you get exactly 500.00, but you have no way of knowing that's the exact value for X.

However, you do know the true value of X must be between 74.875 and 74.885 if it was rounded to 74.88. So, plugging in those two values:

X = 74.875, I = 500.00
X = 74.885, I = 500.06678

Any original price I in the range of 500.00 to 500.06 inclusive will give you a tax value, when rounded, of $74.88. The value 500.07 is too high, it results in $74.89 when rounded.

So, you cannot determine the exact value, only the range it belongs to. The reason you can't get the exact price value is that the tax amount is only 14.975% of the price, so you have only that percentage of the precision, if both the price and the tax have been rounded to two decimals.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform