Copy link to clipboard
Copied
Hello my Friends,
I need your help for this problem and I need the code for this issue.
Here the details for this form.
In the the Status Dropbox there 3 categories ( Pending, Invoice and Release)
When I select the “Pending” Status in dropbox, then select the Reservation date and select the Deposit Dropbox (yes or No) then result in Over due text box
if “yes” selection from deposit dropbox = display in overdue textbox is “14 days"
If “no” selection from deposit dropbox = display in overdue textbox is “ 3 days”
If the status select, invoice and release not showing the overdue. Mean blank only. Only the Pending showing the output in over due textbox.
Please refer the sample in excel in attached. So that you have idea what I mean. The main point there is if you change the date automatic the over due is change the no. of days.
Also, the pdf file sample but without code in over due because I don’t know how to do it.
Thanks you advance for you help.
Put the code in "OD1" field as "Custom Calculation Script"
if(this.getField("Status1").valueAsString == "Pending" && this.getField("Dep1").valueAsString == "Yes"){
event.value = "14 Days";}
else if(this.getField("Status1").valueAsString == "Pending" && this.getField("Dep1").valueAsString == "No"){
event.value = "3 Days";}
else event.value = "";
See if this works for you example
This is code I put in "OD1" field as custom calculation script:
var today = util.printd("mmmm/d/yyyy", new Date());
var overdue = this.getField("Date1A_af_date").value;
if (today.length && overdue.length) {
var datetoday = util.scand("mmmm d, yyyy", today);
var dateoverdue = util.scand("mmmm d, yyyy", overdue);
var diff = (dateoverdue.valueOf() - datetoday.valueOf())/1000;
var days = (((diff / 60) / 60) / 24);
var res = days+14;
var res2 = days+3;}
if(this.getField("Statu
Copy link to clipboard
Copied
You can find scripts for this in the forum.
Copy link to clipboard
Copied
Hi Bernd, please can you find me. because i try to find this same question but unfortunely I did see the script what I'm looking for.
Copy link to clipboard
Copied
Look also at "Related conversations".
Copy link to clipboard
Copied
How exactly do you want second part of your question if date is changed to work?
If it's todays date it shows "14 days" and lets say its November 14 2020 what does it need to show then?
Copy link to clipboard
Copied
Hi Asim,
Anyway forget the second question. Sorry for that.
I need only the code for that 1st part. Please can you help me this.
Copy link to clipboard
Copied
Put the code in "OD1" field as "Custom Calculation Script"
if(this.getField("Status1").valueAsString == "Pending" && this.getField("Dep1").valueAsString == "Yes"){
event.value = "14 Days";}
else if(this.getField("Status1").valueAsString == "Pending" && this.getField("Dep1").valueAsString == "No"){
event.value = "3 Days";}
else event.value = "";
Copy link to clipboard
Copied
finally. thanks you Nesa. 🙂
Copy link to clipboard
Copied
Hi Nesa,
One more your help please. The code you give is work is good for me.
But my boss he said some wrong in the formula and additional info to give to me.
Please can you open the excel (sample) in attached in my post. if you notice if you change the date the no. of days in overdue is changes also not only 14 days or 3 days. you can see also the formula from excel.
Please can you do also this the code. Sorry for I disturb you.
Copy link to clipboard
Copied
also, if I want to change the date example below.
10/10/2020 - the result in over due is -8 days
12/20/2020 - the result in over due is 53 days.
you can see there the sample in excel.
Copy link to clipboard
Copied
See if this works for you example
This is code I put in "OD1" field as custom calculation script:
var today = util.printd("mmmm/d/yyyy", new Date());
var overdue = this.getField("Date1A_af_date").value;
if (today.length && overdue.length) {
var datetoday = util.scand("mmmm d, yyyy", today);
var dateoverdue = util.scand("mmmm d, yyyy", overdue);
var diff = (dateoverdue.valueOf() - datetoday.valueOf())/1000;
var days = (((diff / 60) / 60) / 24);
var res = days+14;
var res2 = days+3;}
if(this.getField("Status1").valueAsString == "Pending" && this.getField("Dep1").valueAsString == "Yes"){
event.value = res.toFixed();}
else if(this.getField("Status1").valueAsString == "Pending" && this.getField("Dep1").valueAsString == "No"){
event.value = res2.toFixed();}
else event.value = "";
Copy link to clipboard
Copied
you're amazing. thank you for your support.
Copy link to clipboard
Copied
I asked you about that and you said forget that, you just need first part and now when you got first part you asking for second part.
What you ask is way more complicated to do, especially since you obviously asking someone to do your job for free. Good luck.
Copy link to clipboard
Copied
sorry for that Asim.
Because my boss he want to follow the formula from excel. But I don't know how to do in PDF file.