Copy link to clipboard
Copied
I have a work order form I've built and at the end of the form is a checkbox to check if the sale is sales tax exempt.
The fields used are as follows (in the order they appear in the document/tab sequence):
Pre_Tax_Subtotal just takes the sum of line items, which works as expected (using the simple calculations provided by Acrobat).
SalesTax uses the following formula:
if(this.getField('SalesTaxExempt').isBoxChecked(0) == '1'){
event.value = 0;
} else {
var taxRate = .0825;
var subTot = this.getField('Pre_Tax_Subtotal').value;
var stc = subTot * taxRate;
event.value = stc;
}
SalesTax reflects as '0' in the box when the box is checked (as I would expect it) but the GrandTotal reflects a total amount with sales tax included when it should be consistent with the Pre_Tax_Subtotal field. Unchecking SalesTaxExempt puts the calculated sales tax back in, but then the GrandTotal field updates to reflect the Pre_Tax_Subtotal field.
I'm kind of a newbie when it comes to Javascript and I know my variable names/field names don't follow best practices, but surely this isn't why this form is doing this?
Any help is greatly appreciated. All of the form fields except for the SalesTax field use the basic arithmetic functions out of the box. SalesTax is the only custom calculation I've incorporated.
Here is a screencast of the behavior.
Okay, my field calculation order was out of sequence with SalesTax falling after the GrandTotal field. After reordering SalesTax BEFORE GrandTotal, the issue has gone away and the form now works as it should. I am marking this as resolved.
Copy link to clipboard
Copied
Okay, my field calculation order was out of sequence with SalesTax falling after the GrandTotal field. After reordering SalesTax BEFORE GrandTotal, the issue has gone away and the form now works as it should. I am marking this as resolved.