Working days 
Author Message
 Working days

Hi!

I need function

NoDay = WorkingDays(Month)

Function must return nuber of working days.

Regards ALES



Sun, 22 May 2005 19:03:19 GMT  
 Working days


Quote:
> Hi!

> I need function

> NoDay = WorkingDays(Month)

> Function must return nuber of working days.

> Regards ALES

untested air code

WorkingDays(LONG, LONG, LONG)! LONG

WorkingDays(IN:Month, IN:IncSat, IN:IncSun)! LONG
StartDate   DATE
EndDate     DATE
CurrentYear DATE ! In case midnight between getting StartDate and EndDate
ReturnValue LONG(0)
 CODE
  !---------------------------------------
  IF (IN:Month < 1) OR (IN:Month > 12)
   RETURN 0
  END !IF
  !---------------------------------------
  CurrentYear = YEAR(TODAY())
  StartDate   = DATE(IN:Month,   1, CurrentYear)
  EndDate     = DATE(IN:Month+1, 1, CurrentYear)

  LOOP WHILE (StartDate < EndDate)
   CASE (StartDate % 7)
   OF 0
    IF (IN:IncSun = True)
     ReturnValue += 1
    END !IF
   OF 6
    IF (IN:IncSat = True)
     ReturnValue += 1
    END !IF
   ELSE
    ReturnValue += 1
   END !CASE
  END !LOOP

  RETURN ReturnValue
  !---------------------------------------



Mon, 23 May 2005 00:38:34 GMT  
 Working days
John!

Thanks



Quote:



> > Hi!

> > I need function

> > NoDay = WorkingDays(Month)

> > Function must return nuber of working days.

> > Regards ALES

> untested air code

> WorkingDays(LONG, LONG, LONG)! LONG

> WorkingDays(IN:Month, IN:IncSat, IN:IncSun)! LONG
> StartDate   DATE
> EndDate     DATE
> CurrentYear DATE ! In case midnight between getting StartDate and EndDate
> ReturnValue LONG(0)
>  CODE
>   !---------------------------------------
>   IF (IN:Month < 1) OR (IN:Month > 12)
>    RETURN 0
>   END !IF
>   !---------------------------------------
>   CurrentYear = YEAR(TODAY())
>   StartDate   = DATE(IN:Month,   1, CurrentYear)
>   EndDate     = DATE(IN:Month+1, 1, CurrentYear)

>   LOOP WHILE (StartDate < EndDate)
>    CASE (StartDate % 7)
>    OF 0
>     IF (IN:IncSun = True)
>      ReturnValue += 1
>     END !IF
>    OF 6
>     IF (IN:IncSat = True)
>      ReturnValue += 1
>     END !IF
>    ELSE
>     ReturnValue += 1
>    END !CASE
>   END !LOOP

>   RETURN ReturnValue
>   !---------------------------------------



Mon, 23 May 2005 02:06:36 GMT  
 Working days
Have a nice cristmas in the office :-)



Quote:
> John!

> Thanks





> > > Hi!

> > > I need function

> > > NoDay = WorkingDays(Month)

> > > Function must return nuber of working days.

> > > Regards ALES

> > untested air code

> > WorkingDays(LONG, LONG, LONG)! LONG

> > WorkingDays(IN:Month, IN:IncSat, IN:IncSun)! LONG
> > StartDate   DATE
> > EndDate     DATE
> > CurrentYear DATE ! In case midnight between getting StartDate and
EndDate
> > ReturnValue LONG(0)
> >  CODE
> >   !---------------------------------------
> >   IF (IN:Month < 1) OR (IN:Month > 12)
> >    RETURN 0
> >   END !IF
> >   !---------------------------------------
> >   CurrentYear = YEAR(TODAY())
> >   StartDate   = DATE(IN:Month,   1, CurrentYear)
> >   EndDate     = DATE(IN:Month+1, 1, CurrentYear)

> >   LOOP WHILE (StartDate < EndDate)
> >    CASE (StartDate % 7)
> >    OF 0
> >     IF (IN:IncSun = True)
> >      ReturnValue += 1
> >     END !IF
> >    OF 6
> >     IF (IN:IncSat = True)
> >      ReturnValue += 1
> >     END !IF
> >    ELSE
> >     ReturnValue += 1
> >    END !CASE
> >   END !LOOP

> >   RETURN ReturnValue
> >   !---------------------------------------



Mon, 23 May 2005 20:12:13 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Working Days of a month

2. Net Work Days

3. Number of work days between two dates

4. Number of working days between dates.

5. Y2K/COBOL/267 Working Days - The Answer

6. Yikes! Only 4 Working Days Left For The SNUG'98 CFP Deadline!

7. Yikes! Only 4 Working Days Left For The SNUG'98 CFP Deadline!

8. ActiveState Licenses - 21 day trial doesn't work

9. Day of year- the day number

10. File Day, System Day

11. DAY OF THE WEEK ROUTINE - day-week.txt (1/1)

12. DAY OF THE WEEK ROUTINE - day-week.txt (0/1)

 

 
Powered by phpBB® Forum Software