falconstooth
IS-IT--Management
I have the following formula which is designed to determine how many workdays a person has taken off by calculating the difference between "DateOff" and "ReturnDate" fields. The formula takes into consideration weekends and specified holidays. The problem I'm having is that I cannot create a summary that will add up all of a person's days off. I need a "Total Days Off" field in the report, but cannot seem to accomplish it.
Any ideas would be much appreciated.
WhilePrintingRecords;
DateVar Start:= Date({CallOffHistEmp.DateOff});
DateVar End:= Date({CallOffHistEmp.ReturnDate});
NumberVar Weeks;
NumberVar Days;
NumberVar Hol:=0;
Weeks:= (Truncate(End-DayofWeek(End)+1-(Start-DayofWeek(Start)+1))/7)*5;
Days:=DayofWeek(End)-DayofWeek(Start)+1
+(if DayofWeek(Start)=1 Then-1 Else 0)
+(if DayofWeek(End)=7 Then -1 Else 0);
If Date(2004,08,23) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,08,24) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,09,06) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,10,22) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,11,24) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,11,25) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,11,26) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,12,20) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,12,21) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,12,22) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,12,23) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,12,24) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,12,27) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,12,28) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,12,29) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,12,30) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,12,31) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2005,01,17) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2005,02,18) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2005,02,21) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2005,03,25) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2005,03,28) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2005,03,29) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2005,03,30) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2005,03,31) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2005,04,01) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2005,04,29) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2005,05,30) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
Weeks+Days+Hol-1
(formula base provided by Ken Hamady)
Any ideas would be much appreciated.
WhilePrintingRecords;
DateVar Start:= Date({CallOffHistEmp.DateOff});
DateVar End:= Date({CallOffHistEmp.ReturnDate});
NumberVar Weeks;
NumberVar Days;
NumberVar Hol:=0;
Weeks:= (Truncate(End-DayofWeek(End)+1-(Start-DayofWeek(Start)+1))/7)*5;
Days:=DayofWeek(End)-DayofWeek(Start)+1
+(if DayofWeek(Start)=1 Then-1 Else 0)
+(if DayofWeek(End)=7 Then -1 Else 0);
If Date(2004,08,23) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,08,24) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,09,06) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,10,22) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,11,24) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,11,25) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,11,26) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,12,20) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,12,21) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,12,22) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,12,23) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,12,24) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,12,27) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,12,28) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,12,29) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,12,30) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2004,12,31) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2005,01,17) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2005,02,18) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2005,02,21) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2005,03,25) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2005,03,28) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2005,03,29) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2005,03,30) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2005,03,31) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2005,04,01) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2005,04,29) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
If Date(2005,05,30) in Start to End Then Hol:= Hol+1 Else Hol:= Hol;
Weeks+Days+Hol-1
(formula base provided by Ken Hamady)