Hello
I'm asked to calculate the time spent for resolving a problem.
Therefore, i use the following formula:
numberVar dur := datediff ("s",{ROOTCAUSEM1.OPEN_TIME}, {ROOTCAUSEM1.CLOSE_TIME}-
datediff ("ww", {ROOTCAUSEM1.OPEN_TIME},{ROOTCAUSEM1.CLOSE_TIME},crsaturday) -
datediff ("ww", {ROOTCAUSEM1.OPEN_TIME},{ROOTCAUSEM1.CLOSE_TIME}, crsunday)
);
numberVar hrs;
numberVar min;
numberVar sec;
stringVar hhmmss;
hrs := Truncate(Truncate(dur/60)/60);
min := Remainder(Truncate(dur/60),60);
sec := Remainder(dur,60);
hhmmss := totext(hrs, "0") + ":" + totext(min, "00") + ":" + totext(sec, "00");
hhmmss
So, this is pretty good, because the weekends are substracted. Now, i want to go a bit further and also look at the holidays. Holidays are stored in the table CALHOLIDAYM1, and the beginning of a holiday is stored in the field START_DATE , the end of a holiday is stored in END_DATE. Eg. Startdate = 14/7/2004 0:00:00 and Enddate = 14/7/2004 0:00:00.
My question is : how can i calculate the time spent looking after weekends AND holidays?
Patrick
I'm asked to calculate the time spent for resolving a problem.
Therefore, i use the following formula:
numberVar dur := datediff ("s",{ROOTCAUSEM1.OPEN_TIME}, {ROOTCAUSEM1.CLOSE_TIME}-
datediff ("ww", {ROOTCAUSEM1.OPEN_TIME},{ROOTCAUSEM1.CLOSE_TIME},crsaturday) -
datediff ("ww", {ROOTCAUSEM1.OPEN_TIME},{ROOTCAUSEM1.CLOSE_TIME}, crsunday)
);
numberVar hrs;
numberVar min;
numberVar sec;
stringVar hhmmss;
hrs := Truncate(Truncate(dur/60)/60);
min := Remainder(Truncate(dur/60),60);
sec := Remainder(dur,60);
hhmmss := totext(hrs, "0") + ":" + totext(min, "00") + ":" + totext(sec, "00");
hhmmss
So, this is pretty good, because the weekends are substracted. Now, i want to go a bit further and also look at the holidays. Holidays are stored in the table CALHOLIDAYM1, and the beginning of a holiday is stored in the field START_DATE , the end of a holiday is stored in END_DATE. Eg. Startdate = 14/7/2004 0:00:00 and Enddate = 14/7/2004 0:00:00.
My question is : how can i calculate the time spent looking after weekends AND holidays?
Patrick