Click to See Complete Forum and Search --> : javascript V.A.T calculation?


Yanhead
10-24-2003, 05:36 AM
Can anyone help me with this, I've got to add V.A.T to the below calculation:

function calculateTotal(num)
{
grandtotal += num;
return grandtotal;
}

It needs to calculate the V.A.T and show the V.A.T amount, the grandtotal and grandtotal with the V.A.T added, any help would be much appreciated?

thanks

Mr J
10-24-2003, 08:02 AM
Something like this I think

vat_rate=17.5

function calculateTotal(num){

vat = num/100*vat_rate

total = num;

grandtotal = total + vat

return grandtotal;
}