These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

If Statements need help

erendresen
Registered: Nov 3 2008
Posts: 5
Answered

I have a tax document that needs to compare 2 numbers, the amount of tax and the amount of payments made.

If the the tax amount is larger than the payment amount, I need to have that number (the difference of the 2 numbers) show up in one field (taxdue). And I need to make the second field (overpayment) blank or a zero.

If the payment amount is larger than the tax amount, I need to have the difference show up in the second field (overpayment) and the first field (taxdue) needs to be blank or zero.

after reading a couple of posts, i think I need something like this.

var v1 = +getField("tax").value;
var v2 = +getField("payment").value;

//need some kind of calculation here I think to determine difference.
// then can compare the 2 numbers

if (v1 > v2) event.value("taxdue") = difference and event.value("overpayment")=0;
else if (v1 === v2) event.value('taxdue") = 0 and event.value("overpayment")=0
else if (v1 < v2) event.value("overpayment") = difference and event.value(:taxdue")=0

can you help me
thanks

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
You can use the following custom calculation script in "taxdue" feild:
// compute balance due// tax due valuevar v1 = this.getField("tax").value;// payments made valuevar v2 = this.getField("payment").value;// compute balance dueevent.value =  v1 - v2;// if result is negative no balance dueif(event.value < 0) event.value = 0;

And the following custom calculation script for the refund/overpayment field:
// compute rerund// tax due valuevar v1 = this.getField("tax").value;// payments made valuevar v2 = this.getField("payment").value;// compute refund dueevent.value =  v2 - v1;// if negative no overpaymentif(event.value < 0) event.value = 0;

George Kaiser

erendresen
Registered: Nov 3 2008
Posts: 5
will give it a shot and let you know if I have any more problems.
Thanks so much for your help!
Eric