I am trying to list the dates of the working days. I am using Ken's code. Below is the code.
WhilePrintingRecords;
Local DateVar Start := {?StartDate}; // place your Starting Date here
Local DateVar End := {?EndDate}; // place your Ending Date here
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 +
(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;
I added this below it.
For i :=1 to (Weeks + Days - Hol)
Do i;
The output I am trying to get using a date range for example 1/1/2008 - 1/31/2008:
1
2
3
4
5
6
7
8
9
10....
So on and so on.
Can someone please help me.
Thank you.
WhilePrintingRecords;
Local DateVar Start := {?StartDate}; // place your Starting Date here
Local DateVar End := {?EndDate}; // place your Ending Date here
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 +
(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;
I added this below it.
For i :=1 to (Weeks + Days - Hol)
Do i;
The output I am trying to get using a date range for example 1/1/2008 - 1/31/2008:
1
2
3
4
5
6
7
8
9
10....
So on and so on.
Can someone please help me.
Thank you.