Convert Complex Excel Calculation Formula to PDF Custom Calculation Script
I have an Excel formula calculates the Unit_Price which is then multuplied by the quantity to establish a quote for printed matierial. I have been asked to create a PDF Form for orders of printed material but I have very little to no experiience with PDF Custom Calculation Script (or java).
I need help with translating the formula below into Custome Calculation Script for the Unit_Price field. It is calculated on 2 variables, the Item (H26) and Quantity (I26). I was able to do a basic custom calculation based just on the item and set a single price but not able to work out how to include the second variable which is the price change based on quantity). Unfortunatley I don't know javascript at all and nothing I found anywhere was able to really assist me in the translating this Excel formula.
If anyone can help or point me to a great tutorial on translating Excel to Java, I would really appreciate the assisatance.
(H26) - Printed_Item (var v1 = this.getField("Print_Item").value;)
(I26) - Print_Quantity (var v2 = this.getField("Print_Quantity").value;)
EXCEL FORMULA to set UNIT_PRICE
=IF(H26="A4 Flyers",(IF(ISBLANK(I26),"",IF(AND(I26>=1,I26<151),0.25,IF(AND(I26>=151,I26<451),0.2,IF(AND(I26>=451,I26<951),0.14,IF(AND(I26>=951,I26<1401),0.1,IF(AND(I26>=1401,I26<1901),0.09,IF(I26>=1901,0.08,"")))))))),IF(H26="DL Flyers",(IF(ISBLANK(I26),"",IF(AND(I26>=1,I26<151),0.08,IF(AND(I26>=151,I26<451),0.07,IF(AND(I26>=451,I26<951),0.05,IF(AND(I26>=951,I26<1401),0.04,IF(AND(I26>=1401,I26<1901),0.04,IF(I26>=1901,0.03,"")))))))),IF(H26="A4 Poster (100 gsm)",(IF(ISBLANK(I26),"",IF(AND(I26>=1,I26<11),1.00,IF(AND(I26>=11,I26<26),0.07,IF(AND(I26>=26,I26<51),0.05,IF(AND(I26>=51,I26<101),0.03,IF(I26>=101,0.25,""))))))),IF(H26="A3 Poster (100 gsm)",(IF(ISBLANK(I26),"",IF(AND(I26>=1,I26<151),0.08,IF(AND(I26>=151,I26<451),0.07,IF(AND(I26>=451,I26<951),0.05,IF(AND(I26>=951,I26<1401),0.04,IF(AND(I26>=1401,I26<1901),0.04,IF(I26>=1901,0.03,"")))))))),IF(H26="Corflute - A1 Poster Coreflute",(IF(ISBLANK(I26),"",IF(AND(I26>=1,I26<11),25,IF(AND(I26>=11,I26<26),22.5,IF(I26>=26,20,""))))))))))
