[ad_1]
Hello @monika999,
In this case, you must walk the days from checking to checkout and summing the corresponding amounts.
For example, assuming you have two date fields for the checking and checkout. I’ll call the fieldname1 and fieldname2, and you want to sum their corresponding prices, including the first and last days.
You can insert a calculate field in the form and enter the equation:
(function(){
var prices_list = {
1:80,
2:60,
3:70,
4:50,
5:50,
6:60,
7:40
},
d1 = DATEOBJ(MIN(fieldname1,fieldname2)),
d2 = DATEOBJ(MAX(fieldname1,fieldname2)),
result = 0;
while(d1<=d2){
result += prices_list(WEEKDAY(d1));
d1.setDate(d1.getDate()+1);
}
return PREC(result,2);
})()And that’s all.
Best regards.
