Hi. I have a report that uses Ken Hamaday's working days formula. I am now trying to add in the holidays from a table instead of hardcoding.
I don't get any errors but it always returns 0 for number of holidays. Can someone see what I've done wrong?
I don't get any errors but it always returns 0 for number of holidays. Can someone see what I've done wrong?
Code:
Holidays Sub
@HolDate
whileprintingrecords;
shared datetimevar array Holidays;
numbervar i := i+1;
numbervar j := count({WSSC_HOLIDAY.HOLIDAY_DATE});
if i <= j then (
redim preserve Holidays[j + 1];
Holidays[i] :={WSSC_HOLIDAY.HOLIDAY_DATE}
);
Code:
@workdays10 (10 hour day)(main report)
I placed the holiday subreport in report header area.
WhilePrintingRecords;
Local DateVar Start;
Local DateVar End;
Local NumberVar Weeks;
Local NumberVar Days;
Local Numbervar Hol;
Local Numbervar TotDays;
Local Numbervar MonthNum;
Local NumberVar Weds;
Shared DateTimeVar Array Holidays;
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);
Local NumberVar i;
for i := 1 to Count(Holidays)
do (if DayOfWeek(Holidays[i]) in 2 to 6 and Holidays[i] in start to end then Hol:= Hol + 1);
Weds:= DateDiff ("ww", Start, End, crWednesday);
If DayOfWeek(Start) = crWednesday Then
Weds := Weds + 1
else
Weds ;
//Weeks
//Days
Hol
//Weds
//(Weeks + Days - Hol - Weds)