I am working on a report that calculates the number of hours necessary to resolve technical issues. Each ticket contains a Start and End Date/Time
I have used Ken Hamandys solution to calculate this value excluding Holidays and Weekends and it seems to work except -
The only issue that remains is if the ticket has a start of end date that falls on the weekend. In thoses case I get negative results.
Below is a look at the results. (normal tour is 7a-7p)
HD0000000187668 June 4, 2009 12:00 June 5, 2009 6:00 420
HD0000000187669 June 5, 2009 12:00 June 8, 2009 6:00 420
HD0000000187670 June 6, 2009 12:00 June 8, 2009 6:00 -300
HD0000000187671 June 5, 2009 12:00 June 6, 2009 6:00 -300
HD0000000187672 May 22, 2009 12:00 May 26, 2009 6:00 420
HD0000000187675 June 15, 2009 21:00 June 16, 2009 4:00 0
I thought that the code presented accounted for the fact that the record could fall on a weekend and adjusts for it here....
//Main Formula - Calculates Work Days - excludes weekends (Sat and Sun) and Holidays defined
WhileReadingRecords;
Local DateTimeVar Start := Date({HPD_HelpDesk.WIP Start});// Updated field
Local DateTimeVar End := Date({HPD_HelpDesk.WIP First Stamped});// Updated field
Local NumberVar Weeks;
Local NumberVar Days;
Local NumberVar Hol;
DateVar Array holidays;
Weeks:=(Truncate(End-dayofWeek(End)+1
-(Start-dayofweek(Start)+1))/7)*5;
Days:=DayOfWeek(End)-DayOfWeek(Start)+1+ <<<<< Here
(if DayOfWeek(Start)=1 then -1 else 0)+
(if DayOfWeek(End)=7 then -1 else 0);
Local NumberVar i;
For i:= 1 to Count(holidays)
do (if DayOfWeek (holidays) in 2 to 6 and
holidays in start to end then Hol:=Hol+1);
Weeks+Days-Hol
But alas it doesn't seem to figure it in and I'm getting the negative amounts.
Does anyone have any suggestions for me?
Thanks so much.
I have used Ken Hamandys solution to calculate this value excluding Holidays and Weekends and it seems to work except -
The only issue that remains is if the ticket has a start of end date that falls on the weekend. In thoses case I get negative results.
Below is a look at the results. (normal tour is 7a-7p)
HD0000000187668 June 4, 2009 12:00 June 5, 2009 6:00 420
HD0000000187669 June 5, 2009 12:00 June 8, 2009 6:00 420
HD0000000187670 June 6, 2009 12:00 June 8, 2009 6:00 -300
HD0000000187671 June 5, 2009 12:00 June 6, 2009 6:00 -300
HD0000000187672 May 22, 2009 12:00 May 26, 2009 6:00 420
HD0000000187675 June 15, 2009 21:00 June 16, 2009 4:00 0
I thought that the code presented accounted for the fact that the record could fall on a weekend and adjusts for it here....
//Main Formula - Calculates Work Days - excludes weekends (Sat and Sun) and Holidays defined
WhileReadingRecords;
Local DateTimeVar Start := Date({HPD_HelpDesk.WIP Start});// Updated field
Local DateTimeVar End := Date({HPD_HelpDesk.WIP First Stamped});// Updated field
Local NumberVar Weeks;
Local NumberVar Days;
Local NumberVar Hol;
DateVar Array holidays;
Weeks:=(Truncate(End-dayofWeek(End)+1
-(Start-dayofweek(Start)+1))/7)*5;
Days:=DayOfWeek(End)-DayOfWeek(Start)+1+ <<<<< Here
(if DayOfWeek(Start)=1 then -1 else 0)+
(if DayOfWeek(End)=7 then -1 else 0);
Local NumberVar i;
For i:= 1 to Count(holidays)
do (if DayOfWeek (holidays) in 2 to 6 and
holidays in start to end then Hol:=Hol+1);
Weeks+Days-Hol
But alas it doesn't seem to figure it in and I'm getting the negative amounts.
Does anyone have any suggestions for me?
Thanks so much.