Copy link to clipboard
Copied
I'm trying to create a form that will calculate tax on the lines that are marked "taxable". I want to add checkboxes for taxable (Y/N), but I don't know how to create the script to calculate tax on only "Y" marked lines.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
First, rename field Text95 to Text94 and change the Subtotal calculation to reflect this chagne. Name your check boxes Tax87 through Tax94 (one for each row to match the corresponding Text87-Text94 subtotal fields). Enter the following custom calculation script in the Tax field:
var tax=0;
for(var i=87;i<95;i++)
{
var rate=this.getField("Tax"+i).value=="Off"?0:0.0875;
tax+=Number(this.getField("Text"+i).value*rate)
}
event.value=tax;