home *** CD-ROM | disk | FTP | other *** search
/ Power CD-ROM!! 7 / POWERCD7.ISO / prgmming / clipper / isbusday.prg < prev    next >
Text File  |  1993-10-14  |  2KB  |  90 lines

  1. /*
  2.  * File......: ISBUSDAY.PRG
  3.  * Author....: Martin Colloby
  4.  * BBS.......: The Dark Knight Returns
  5.  * Net/Node..: 050/069
  6.  * User Name.: Martin Colloby
  7.  * Date......: 18/4/93
  8.  * Revision..: 1.0
  9.  *
  10.  * This is an original work by Martin Colloby and is placed in the public
  11.  * domain.
  12.  *
  13.  * Modification history:
  14.  * ---------------------
  15.  *
  16.  * $Log$
  17.  *
  18.  */
  19.  
  20.  
  21. /*  $DOC$
  22.  *  $FUNCNAME$
  23.  *      GT_ISBUSDAY()
  24.  *  $CATEGORY$
  25.  *      Date
  26.  *  $ONELINER$
  27.  *      See if a date is a business day
  28.  *  $SYNTAX$
  29.  *      GT_IsBusDay( dDate , cCurrency )
  30.  *  $ARGUMENTS$
  31.  *      dDate     - Date to check
  32.  *      cCurrency - Curreny code of country - not yet used
  33.  *  $RETURNS$
  34.  *      .T. if date is a business day
  35.  *      .F. otherwise
  36.  *  $DESCRIPTION$
  37.  *      This implementation checks to see if a date is a week day.
  38.  *      Future implementations will check for bank holidays.
  39.  *  $EXAMPLES$
  40.  *
  41.  *  $SEEALSO$
  42.  *
  43.  *  $INCLUDE$
  44.  *
  45.  *  $END$
  46.  */
  47.  
  48. *
  49. FUNCTION GT_IsBusDay( dDate , cCurrency )
  50.  
  51. /*****************************************************************************
  52.  Purpose - Check if given date is a business day in the given country
  53.  Returns - True if date is a business day, False otherwise
  54.  Author  - Martin Colloby
  55.  Created - 21/12/90
  56. ******************************************************************************
  57.  Parameters - dDate      - Date to check
  58.               cCurrency  - Curreny code of country
  59.  Privates   - None
  60.  Locals     - lIsBusDay  - Set if dDate is a business day
  61.  Externals  - None
  62. *****************************************************************************/
  63.  
  64. LOCAL lIsBusDay := .F.
  65.  
  66. * First check if day is a week day
  67. DO CASE
  68.     CASE DOW( dDate ) == 7
  69.         lIsBusDay := .F.
  70.     CASE DOW( dDate ) == 1
  71.         lIsBusDay := .F.
  72.     OTHERWISE
  73.         lIsBusDay := .T.
  74. ENDCASE
  75.  
  76. ** Now check the bank holiday file
  77. *if not isfile("bankhols") then
  78. *    GT_Warning("Cannot find bank holidays file !")
  79. *    m_isbusday := .F.
  80. *else
  81. *    view "bankhols"
  82. *    locate p_currency + p_date
  83. *    if retval then
  84. *        m_isbusday := .F.
  85. *    endif
  86. *endif
  87.  
  88. RETURN( lIsBusDay )
  89. *
  90.