Custom Calculation with rounded figure
I do the following calculation on a local tax form for Total Tax Liability:
event.value = this.getField("TotalTaxEINP").value * this.getField("Percent").value / 100.0;
This value is rounded up, and then either Total Tax Liability (TotalTaxLiab) is subtracted from Total Payments and Credits (TotalPayCr) as follows:
var v1 = Number(this.getField("TotalPayCr").valueAsString);
var v2 = Number(this.getField("TotalTaxLiab").valueAsString);
event.value = Math.max(0, v1-v2);
OR – Total Payments and Credits (TotalPayCr) is subtracted from Total Tax Liability (TotalTaxLiab) as follows:
var v1 = Number(this.getField("TotalTaxLiab").valueAsString);
var v2 = Number(this.getField("TotalPayCr").valueAsString);
event.value = Math.max(0, v1-v2);
My PROBLEM is that when the first calculation is rounded up – it shows the rounded up number on the form – but it is subtracting the number BEFORE rounding in the next 2 calculations (sometimes making me off by $1.00)
How can I get the second 2 calculations to use the rounded up figure?