Dear all,
I need help with a task I need to achieve;
I Created a purchase order form, where clients could order items.
they are about 10 products, each product has 3 fields : price, quantity and total price. the total amount will be calculated at the bottom of the page. the document works brilliantly.
I would need ta java script to do the following (I am straggling to do it):
I have 2 dates fields, one for actual date (will call it: date1) and the second is for "chosen delivery date (will call it: date2)", so I would like the document to be able to pick the actual date automatically as soon as the PDF has been opened and should be locked (uneditable).
Now, the calculation should depend on the date difference (date2 -date1), if the difference is less than 21 days then the calculation of the price for each product should be increased by 20% for each product and the client should see a warning message that 20% surcharge will be added due to e.g. late order
Is that possible ? could anyone help?
Many thanks
Madona33
Solved! Go to Solution.
Views
Replies
Total Likes
In FormCalc this is quite easy. The calculation script for the total price could look this way:
var factor = 1
if (not datefield2.isNull and not datefield1.isNull) then
if (Date2Num(datefield2.formattedValue, "MM/DD/YYYY") - Date2Num(datefield1.formattedValue, "MM/DD/YYYY") lt 21) then
factor = 1.2
endif
endif
var totalPrice = quantity * price * factor
$ = totalPrice
Views
Replies
Total Likes
In FormCalc this is quite easy. The calculation script for the total price could look this way:
var factor = 1
if (not datefield2.isNull and not datefield1.isNull) then
if (Date2Num(datefield2.formattedValue, "MM/DD/YYYY") - Date2Num(datefield1.formattedValue, "MM/DD/YYYY") lt 21) then
factor = 1.2
endif
endif
var totalPrice = quantity * price * factor
$ = totalPrice
Views
Replies
Total Likes
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies