4 Replies Latest reply on Jan 5, 2010 10:02 AM by richardellis

# Calculating VAT

I am working on a form that requires calculating the VAT amount.

I have used the following;

var f = this.getField('field1');
var v = this.getField('checkbox1');
if(v.value=='Yes')
var vat = f.value * 0.175;
else
var vat = 0;

event.value= f.value * 3 + vat;

But all this is doing is multiplying the pre VAT price by 3 to give the inc VAT price, which is incorrect.

What I actually need is a script that sees the value of a field calculates the VAT and shows the result. Does anyone have any ideas?

• ###### 1. Re: Calculating VAT

The price including the VAT (assuming it's 17.5%) is just the price times 1.175 .

• ###### 2. Re: Calculating VAT

What I need to show is the value of the VAT (yes it is 17.5%) against the price.

So if the ex VAT price is £50, the VAT on this amount would be 8.75. This is what I need to show.

Thanks

• ###### 3. Re: Calculating VAT

So multiply the price by 0.175

• ###### 4. Re: Calculating VAT

Thats great. I ditched the javascript and just used the Simplified Field Notation option and it worked.

Cheers