Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help listing working days

Status
Not open for further replies.

eliasc

IS-IT--Management
Feb 15, 2008
11
US
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.





 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top