Figuring out Price Before Tax
Jul 22, 2009
javascript
This post is more than 18 months old. Since technology changes too rapidly, this content may be out of date (but
that's not always the case). Please remember to verify any technical or programming information with the current
release.
A lot of the time I give quotes including taxes. Every once in a while, someone is curious about what the tax is on a service.
I was messing around the other day and came up with this Javascript function. It takes in the total amount, the tax in percent, and returns the cost before tax.
function figureBeforeTax(amount, tax)
{
return Math.round((amount)*(100 / (100 + ((tax/100)*100)))*100)/100;
}