Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Anyone have a AfterFirstBusDayOf Month function?
Message
From
16/01/2003 17:13:07
Bill Drew
Independent Consultant
Chicago, Illinois, United States
 
 
To
16/01/2003 13:33:09
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00742471
Message ID:
00742664
Views:
22
Thanks Cetin and Steve:

Here is what I came up with -- using a table of holidays that is maintained in our company.
func IsAfterFirBusDay
LPARAMETERS indate
LOCAL lRetVal,dayofmonth,l_offday
IF !USED("Holiday)
   USE n:\foxprow\holiday order date IN 0
ELSE
   SELECT HOLIDAY
ENDI
*start out with the first day of month
dayofmonth = indate - DAY(indate)+1
l_offday = .t.
DO WHILE l_offday
   IF BETWEEN(DOW(dayofmonth),2,6)
      * passes 1st test -- mon thru fri
      IF !SEEK(dayofmonth)
         * passes 2nd test -- not in the holiday table
         l_offday = .f.
      else
         * it is a holiday -- don't change l_offday
         IF !trade
            *  wait a minute -- it is in holiday table but we trade on that day
            l_offday = .f.
         ENDIF
      ENDIF 
   ENDIF
   IF l_offday
      * it was a non working day -- check the next
      dayofmonth = dayofmonth + 1
   endi
ENDDO
USE IN SELECT("holiday")
* if orig date is after the first business day retu .t.
RETURN indate > dayofmonth 
Previous
Reply
Map
View

Click here to load this message in the networking platform