home *** CD-ROM | disk | FTP | other *** search
/ Kompuutteri Kaikille K-CD 2002 #3 / K-CD_2002-03.iso / OpenOffice / f_0031 / HolidayUSA.xba < prev    next >
Extensible Markup Language  |  2001-07-20  |  3KB  |  66 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
  3. <script:module xmlns:script="http://openoffice.org/2000/script" script:name="HolidayUSA" script:language="StarBasic">Option Explicit
  4.  
  5. Sub Main
  6.     Call CalAutopilotTable()
  7. End Sub
  8.  
  9. Sub FindWholeYearHolidays_US(ByVal YearInt%)
  10.  
  11.     Dim lDate&
  12.     Dim Easter$
  13.  
  14.     CalInsertBankholiday(DateSerial(YearInt%, 1, 1), "New Year's Day", cHolidayType_Full)
  15.     CalInsertBankholiday(DateSerial(YearInt%, 1, 17), "Martin Luther King", cHolidayType_Full)
  16.  
  17.     CalInsertBankholiday(DateSerial(YearInt%, 2, 12), "Lincoln's Birthday", cHolidayType_Half)
  18.     CalInsertBankholiday(DateSerial(YearInt%, 2, 14), "Valentine's Day", cHolidayType_Half)
  19.     CalInsertBankholiday(DateSerial(YearInt%, 2, 21), "President's Day", cHolidayType_Full)
  20.     CalInsertBankholiday(DateSerial(YearInt%, 2, 22), "Washington's Birthday", cHolidayType_Half)
  21.     
  22.  
  23.     '    Last Monday in May: Menorial Day, Full
  24.     lDate& = DateSerial(YearInt%, 6, 1) - 1
  25.     While WeekDay(lDate&) <> 2
  26.         lDate& = lDate& - 1
  27.     Wend
  28.     CalInsertBankholiday(lDate&, "Memorial Day", cHolidayType_Full)
  29.     
  30.     '    Mothers Day : 2nd Sunday in May, Full
  31.     lDate = GetMonthDate(1,5,2)
  32.     CalInsertBankholiday(lDate&, "Mother's Day", cHolidayType_Full)
  33.  
  34.     '    Fathers Day : 3rd Sunday in June
  35.     lDate = GetMonthDate(1,6,3)
  36.     CalInsertBankholiday(lDate&, "Father's Day", cHolidayType_Full)
  37.     
  38.     '    Easter, get it with look-up table
  39.     lDate& = CalEasterTable&(YearInt%)
  40.     CalInsertBankholiday(lDate&, "Easter Sunday", cHolidayType_Full)
  41.     
  42.     CalInsertBankholiday(DateSerial(YearInt%, 7, 4), "Independence Day", cHolidayType_Full)
  43.     
  44.     CalInsertBankholiday(DateSerial(YearInt%, 10, 9), "Columbus Day", cHolidayType_Half)
  45.     CalInsertBankholiday(DateSerial(YearInt%, 10, 31), "Halloween", cHolidayType_Half)
  46.     
  47.     '    1st Monday in Sep : Labor Day, Full
  48.     lDate = GetMonthDate(2,9,1)
  49.     CalInsertBankholiday(lDate&, "Labor Day", cHolidayType_Full)
  50.  
  51.     ' First Thursday in November 
  52.     lDate = GetMonthDate(3, 11, 1)
  53.     CalInsertBankholiday(lDate&, "Election Day", cHolidayType_Full)
  54.  
  55.     '    3rd Thu    in Nov : Thanksgiving, Full
  56.     lDate = GetMonthDate(5, 11, 1)
  57.     lDate& = lDate& + 21
  58.     CalInsertBankholiday(lDate&, "Thanksgiving", cHolidayType_Full)
  59.  
  60.     CalInsertBankholiday(DateSerial(YearInt%, 11, 11), "Veteran's Day", cHolidayType_Half)
  61.  
  62.     CalInsertBankholiday(DateSerial(YearInt%, 12, 24), "Christmas Eve", cHolidayType_Half)
  63.     CalInsertBankholiday(DateSerial(YearInt%, 12, 25), "Christmas Day", cHolidayType_Full)
  64.     
  65.     CalInsertBankholiday(DateSerial(YearInt%, 12, 31), "New Year's Eve", cHolidayType_Half)
  66. End Sub</script:module>