Custom Calculation script issues
I have an acrobat order form with 104 products. People can buy an individual item or cases of that item. I've been able to calculate the product cost per item and per case.
My issue is that there are discount conditions based on the number of cases purchased:
- Less than 8 cases = no discount on total invoice
- 8-23 cases = 10% discount on total invoice
- 24 or more = 20% discount on total invoice
I have a tally of all cases purchased called "Case Qty" (CQ), and I have a tally of the cost of all items purchased called "Total Cost" (TC). In a cell called "Discount Cost", I have a CCS that seems to be working, with a few exceptions: if there are exactly 8 cases ordered, no discount is applied to the cell. Also, sometimes if you meet the criteria for a discount then change the case value so that it doesn't meet the criteria, the discount value is still applied to the cell. Can anyone see what I'm doing wrong? Thanks so much for the help.
var CQ = this.getField("Case Qty").value;
var TC = this.getField("TOTAL COST").value;
if(( CQ > 7 ) && (CQ < 24 )) event.value = TC*0.90;
else if( CQ > 23 ) event.value = TC*0.80;
else if( CQ < 😎 event.value = TC*0;
