Revisions: jee Initial jee SW Version 1.1 now includes the leave type Other

Similar documents
Visual Programming 1. What is Visual Basic? 2. What are different Editions available in VB? 3. List the various features of VB

Password Protect an Access Database

An InputBox( ) function will display an input Box window where the user can enter a value or a text. The format is

variables programming statements

Understanding the MsgBox command in Visual Basic

Lookup Project. frmlookup (Name: object is a combo box, style 2); use 4 labels: 2 for phone, 2 for mail. MsgBox Function:

Structure Bars. Tag Bar

EMu Release Notes. ADO Reports. EMu 5.0. Document Version 1

A Quick Guide To SSI. By Andrew J. Williams. ez SEO Newsletter Up-to-date information on Affiliate Marketing and Search Engine Optimization

Table-Based Web Pages

HTML Summary. All of the following are containers. Structure. Italics Bold. Line Break. Horizontal Rule. Non-break (hard) space.

A Back-End Link Checker for Your Access Database

'... '... '... Developer: William H. White (consultant) '... With: TEKsystems Inc. '... For: AIG. Financial Information Systems

Configuring Ad hoc Reporting. Version: 16.0

Programming with visual Basic:

Book IX. Developing Applications Rapidly

Excel & Visual Basic for Applications (VBA)

HTMLnotesS15.notebook. January 25, 2015

The MAXQDA Stats Data Editor

While editing a page, a menu bar will appear at the top with the following options:

A HTML document has two sections 1) HEAD section and 2) BODY section A HTML file is saved with.html or.htm extension

Title: Jan 29 11:03 AM (1 of 23) Note that I have now added color and some alignment to the middle and to the right on this example.

HTML TAG SUMMARY HTML REFERENCE 18 TAG/ATTRIBUTE DESCRIPTION PAGE REFERENCES TAG/ATTRIBUTE DESCRIPTION PAGE REFERENCES MOST TAGS

Html basics Course Outline

leveraging your Microsoft Calendar Browser for SharePoint Administrator Manual

840 Database: SQL, ADO and RDS Chapter 25. Department Salary Location

Intellicus Enterprise Reporting and BI Platform

SharePoint List Booster Features

22. VB Programming Fundamentals Data Access with Data Objects

Click the Add a New Value Tab. Click Add. The system will populate the Event ID field with a number after the event request is saved.

SPARK. User Manual Ver ITLAQ Technologies

Table of contents. DMXzone Calendar DMXzone.com

Bruce Moore Fall 99 Internship September 23, 1999 Supervised by Dr. John P.

P3e REPORT WRITER CREATING A BLANK REPORT

SQL Functionality SQL. Creating Relation Schemas. Creating Relation Schemas

Business Insight Authoring

Layout and display. STILOG IST, all rights reserved

Part 3: Dynamic Data: Querying the Database

GUJARAT TECHNOLOGICAL UNIVERSITY DIPLOMA IN INFORMATION TECHNOLOGY Semester: 4

Chapter 3. Windows Database Applications The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill

Unit 5 Web Publishing Systems Page 1 of 13 Part 4 HTML Part 4

As we design and build out our HTML pages, there are some basics that we may follow for each page, site, and application.

By Ryan Stevenson. Guidebook #2 HTML

Frequency tables Create a new Frequency Table

Website Pros Database Component. v

Chapter 4 Creating Tables in a Web Site Using an External Style Sheet

Vector Issue Tracker and License Manager - Administrator s Guide. Configuring and Maintaining Vector Issue Tracker and License Manager

The Crypt Keeper Cemetery Software Online Version Tutorials To print this information, right-click on the contents and choose the 'Print' option.

6/14/2010. VBA program units: Subroutines and Functions. Functions: Examples: Examples:

Tables *Note: Nothing in Volcano!*

Save and Load Searches in Access VBA

Office 365 Training For the

Tech-Talk Using the PATROL Agent COM Server August 1999 Authored By: Eric Anderson

Controlled Assessment Task. Question 1 - Describe how this HTML code produces the form displayed in the browser.

MICROSOFT EXCEL 2000 LEVEL 5 VBA PROGRAMMING INTRODUCTION

In this chapter, I m going to show you how to create a working

GIMP WEB 2.0 MENUS. Before we begin this tutorial let s visually compare a standard navigation bar and a web 2.0 navigation bar.

COPYRIGHTED MATERIAL. Contents. Chapter 1: Creating Structured Documents 1

Outlook Web Access Exchange Server

Year 8 Computing Science End of Term 3 Revision Guide

SQL Deluxe 2.0 User Guide

usinginvendb.notebook September 28, 2014

Manual Vba Access 2010 Close Form Without Saving Record

END-TERM EXAMINATION

Using Microsoft Excel to View the UCMDB Class Model

The software shall provide the necessary tools to allow a user to create a Dashboard based on the queries created.

Agilent MassHunter Workstation Software Report Designer Add-in

The figure below shows the Dreamweaver Interface.

Simple sets of data can be expressed in a simple table, much like a

Syntax. Table of Contents

Table Basics. The structure of an table

Fundamental Microsoft Jet SQL for Access 2000

Contents Introduction Getting Started Visual Basic Form Configuration Entering the VB Code

Roxen Content Provider

Setup Series-6003 Security Setup Version 9.0

Working with Actions Stratum.Viewer 6

CenterStone. Reports User Guide. Manhattan Software Inc. World Leading Real Estate, Asset & Facilities Management Software.

GROUPWISE INSTRUCTIONS

Fall 2016 Exam Review 3 Module Test

SAMPLE PAPER I CLASS- X SUBJECT FOUNDATION OF IT. TIME : 3 HRS M.M - 90 NOTE: 1. All questions are compulsory. 2. Write neat and clean.

Configuration Guide xrm1 Data Grid CRM 2013, 2015, 2016 and CRM Online

A Generalized Macro-Based Data Reporting System to Produce Both HTML and Text Files

ISSUE #2 / FALL 2016

Contents. More Controls 51. Visual Basic 1. Introduction to. xiii. Modify the Project 30. Print the Project Documentation 35

The PCC CIS etutorial to Outlook

TIMEaccess Bi-Weekly Supervisors Training Guide Friday, February 01, 2013

Use mail merge to create and print letters and other documents

Logi Ad Hoc Reporting System Administration Guide

d2vbaref.doc Page 1 of 22 05/11/02 14:21

Microsoft Windows SharePoint Services

user specifies what is wanted, not how to find it

Outlook 2010 One. Wednesday, August 7, 9-11 am. Agenda:

LISTING PROGRAM. 1. Form Login. Private Sub BATAL_Click() End End Sub

AxoNet Software GmbH. Introduction. Using the AxClient components for asanetwork

M.C.A. (Sem.-II) Examination. Ma~' CCA-2003 : Building Client Server Application Using VB. Faculty Code: 003 Subject Code:

Microsoft Outlook Basics

CSC 121 Computers and Scientific Thinking

EVERY NATION OUTLOOK WEB ACCESS (OWA) USER S GUIDE

You can use Dreamweaver to build master and detail Web pages, which

TA Instrument Explorer. Getting Started Guide

Transcription:

Memorandum To: From: File John Effland Date: 2005-03-10 Revisions: 2005-03-10 jee Initial 2006-02-24 jee SW Version 1.1 now includes the leave type Other Subject: Leave Calendar Program Architecture and Design 1. Summary A program to generate a calendar that displays vacation and travel times for employees was written in August of 2000. It was subsequently updated to show the schedule of visitors to the NTC. The leave calendar software presents the user with a dialog box to assign leave as shown in Figure 1, stores the leave dates and names in a database, and then queries the database to generate static HTML pages which display calendars for the current and following month. A sample calendar generated by this program is shown in Figure 2. While access to the database is restricted to a few users, anyone can access the HTML calendar files residing on \\cvfiler\cv-cdl-pub. This document describes the design of the software and the system architecture. It is important to note that the architecture is basically obsolete and should eventually be replaced by a commercially available, dynamic web-based design. 2. History The software originated from an article in Microsoft Developer s Net News Magazine 1 entitled Building a Webbased Event Calendar. That article assumed the developer would generate Active Server Pages on Microsoft s Internet Information Server, so much of the code was written for that platform. The didn t have that web server, so the code was ported to Visual Basic Version 6 to build the executable. A SQL database server was running on my office computer wheat and was used to store the data and stored procedures, which also reside in the database server. The intent of the MSDN article was to build a dynamic, web-based scheduling program, but this was scaled down to a simple executable program running on a windows-based client computer, accessing a server-based database, and generating static HTML code to a file each time the program is run. 3. Architecture The overall architecture of the program is shown in Figure 3. The executable file is stored on \\cvfiler and is downloaded and run on the client computer. The user must have access rights to the SQL server program running on wheat. Data are returned from this database server to the client in the form of recordsets using Microsoft s 1 MSDN News Magazine, July/August 2000, Volume 9, Number 4, Page 7. File: \\cvfiler.cv.nrao.edu\cv-cdl-sis\meassys\software\utils\webcalendar\design.doc Page 1 of 15 Last

API called Active-X Data Object s (ADO). The static HTML calendar page is built and the resulting file is stored on \\cvfiler\cv-cdl-pub with a file name that includes the year and month, such as Leave2005Apr.html. The dialog box shown in Figure 1 uses several Visual Basic controls that require further discussion. A hidden ADO data control allows inserting records into the database and also simplifies the connection of the datagrid to the database. Figure 4 shows the form as seen from the Visual Basic IDE and the data control, named adodc1, is hidden when the program runs. The data control updates the database with user names and leave dates in routine btnaddleave_click. Existing names and leave dates are tabulated in the datagrid on the dialog box, which allows the user to edit data directly in the cells of the grid. Changes the user makes to entries in the datagrid are posted back into the database via linkage by defining the data control to be the datasource for the datagrid. The data control is dynamically loaded with the dataset connection string in routine Form_Load and its recordsource is defined in the same routine. Attempts to dynamically generate the recordsource by returning a string from a stored procedure were never successful, but the code remains commented in the routine for future reference. The leave dates are selected using a DateTimePicker control. The stored procedures, listed in Section 7, are routines written in Microsoft s T-SQL, run on the database server, and return recordsets. The Visual Basic code is listed in Section 8. 4. File Locations The leave calendar software uses a number of files given in this section. Visual Basic VB Project files: \\cvfiler.cv.nrao.edu\cv-cdl-sis\meassys\software\utils\webcalendar\webcalcode.vbp \\cvfiler.cv.nrao.edu\cv-cdl-sis\meassys\software\utils\webcalendar\webcalcode.vbw Visual Basic form file: \\cvfiler.cv.nrao.edu\cv-cdl-sis\meassys\software\utils\webcalendar\form1.frm Visual Basic executable location: \\cvfiler.cv.nrao.edu \cv-cdl-pub\webcalendarsoftware\webcalendar.exe Directory for HTML Leave Calendars \\cvfiler.cv.nrao.edu\cv-cdl-pub\ 5. Database Use Names and dates are stored on a MS SQL Server version 7.0 2 database running on computer wheat in my office. Database name: Tables Used: TeamWeb Schedule The database table Schedule is structured as shown in Table 1. 2 Wheat is actually running Microsoft s Data Engine, which is functionally equivalent to SQL Server but the number of concurrent users is limited by slowing down the server when more than 5 concurrent users are logged into the server. Page 2 of 15

Table 1: Schema for Database Table Schedule Field Name Datatype Size (Bytes) idschedule smallint 2 dtdatestart smalldatetime 4 vcevent varchar(100) 100 dtdateend smalldatetime 4 ieventtype smallint 2 A number of other tables in the database TeamWeb were for prototyping of other projects but are now unused. 6. Windows Libraries and OLE Objects The leave calendar software uses the following libraries and OLE objects: stdole2.tlb MSBIND.DLL msador15.dll msado25.tlb MSADODC.OCX MSCOMCTL.OCX MSCOMCT2.OCX MSDATGRD.OCX OLE Automation Microsoft Data Binding Collection VB 6.0 (SP4) Microsoft ActiveX Data Objects Recordset 2.0 Library Microsoft ActiveX Data Objects 2.0 Library Page 3 of 15

Figure 1: Dialog Box for adding leave to the database and generating the calendar file Figure 2: Sample of Calendar Output Page 4 of 15

Figure 3: Overall Architecture Page 5 of 15

Figure 4: Form from Visual Basic Editor Page 6 of 15

7. Stored Procedures in Database TeamWeb on MS SQL Server Wheat The following stored procedures run queries on tables in the database TeamWeb and return recordsets using Microsoft s ADO API. Note that only the procedure spgetscheduleforday actually runs with the leave calendar software. The other stored procedures are uncompleted enhancements. ***************************************************************** CREATE Procedure spgetscheduleforday(@ndatetime smalldatetime) -- Returns all events whose dates fall between the date given in the parameter -- 2000-08-08 jee As SELECT vcevent, ieventtype FROM Schedule -- Style 0 shows dates as text in form: "mon dd yyyy hh:miam (or PM)" WHERE (CONVERT(DATETIME, @ndatetime, 0) BETWEEN CONVERT(DATETIME, dtdatestart,0) AND CONVERT(DATETIME, dtdateend,0)) ORDER BY vcevent Return **************************************************************** CREATE Procedure spgetrecsbydate -- Returns all events ordered by date -- 2000-09-01 jee As SELECT * FROM Schedule ORDER BY dtdatestart DESC return **************************************************************** CREATE Procedure spgetschedule(@nmonth tinyint,@nyear smallint) As select idschedule, convert(varchar, datepart(dd, dtdatestart)) nday, vcevent from Schedule where datepart(yy, dtdatestart) = @nyear and datepart(mm, dtdatestart) = @nmonth order by datepart(dd, dtdatestart) return 8. Visual Basic Code The following code is used to generate the dialog box to assign vacations and to generate the static web pages. Option Explicit Private Const sversion = "1.1 2006-02-24" V 1.1 2006-02-24 jee 1) added "Other Leave" type and color 2) Updated VB to SP6 to get progress bar working again V 1.0.14 2005-03-10 jee returned fonts to orig size and sat/sun columns only 50 wide V 1.0.13 2005-03-09 jee made fonts larger and sat/sun cols smaller. V 1.0.12 2004-08-17 jee changed header from CDL to NTC in DoHeader V 1.0.11 2004-01-14 jee changed header from CDL to NTC in DoHeader V 1.0.10 2003-12-15 jee changed header from CDL to NTC V 1.0.9 2003-09-29 jee changed from Appointments to Visitors in DoFooter and ileave_type V 1.0.8 2003-01-22 jee corrected spelling of Shure to sure!! V 1.0.7 2002-11-20 jee cvfiler root is no longer "shares" but is "cv-cdl-pub" V 1.4 2002-10-18 jee changed to use CV Filer, spgetscheduleforday now sorts by "event" V 1.3 2000-09-01 jee Orders data control records by date Page 7 of 15

V 1.2 2000-08-31 jee corrected color in MakeCalendar color assignments. V 1.1 2000-08-18 jee added error checks for data control. V 1.0 2000-08-16 jee 1) added multiple month support. Private Enum ileave_type Vacation = 1 Travel Visitor Other End Enum Private Const scolor_vacation As String = "red" Private Const scolor_travel As String = "black" Private Const scolor_visitor As String = "green" Private Const scolor_other_leave As String = "blue" file name for output of html file Private Const sdirectory_name As String = "//cvfiler/shares/cv-cdl-pub/" Private Const sdirectory_name As String = "//cvfiler/cv-cdl-pub/" Database connection string Private Const sdbconnection = "Provider=SQLOLEDB.1;Integrated Security=SSPI;" & _ "Persist Security Info=False;Initial Catalog=TeamWeb;Data Source=wheat" Private m_oconnection As ADODB.Connection if TRUE, dont change the end date to match changes in the start date. Private benddatechanged As Boolean if true, quit Private m_bdatabaseerror As Boolean Private m_rsevents As ADODB.Recordset ******************************************************************** ******************************************************************** Private Sub Adodc1_Error(ByVal ErrorNumber As Long, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, fcanceldisplay As Boolean) Runs if error occurs with Active X Data Object Control 2000-08-18 jee Call MsgBox(Description, vbinformation + vbokonly) dont display error in another dialog box fcanceldisplay = True m_bdatabaseerror = True ******************************************************************** Private Sub btnaddleave_click() 2000-08-10 jee 2000-08-15 jee Moved MakeCalendar to own button 2003-09-29 jee changed from Appointments to Visitors 2006-02-24 jee 1) added other leave type 2) now hide status box Dim ileavetypebuff As Integer Page 8 of 15

Dim vdatediff As Variant Call ShowStatus("") validate the field values If Len(Me.tbName) = 0 Then Call MsgBox("Please enter someones name for this leave.", _ vbokonly + vbexclamation) Exit Sub If Len(Me.DTPickerStart.Value) = 0 Then Call MsgBox("Please enter a valid start date for this leave.", _ vbokonly + vbexclamation) Exit Sub If Len(Me.DTPickerEnd.Value) = 0 Then Call MsgBox("Please enter a valid end date for this leave.", _ vbokonly + vbexclamation) Exit Sub compare number of seconds to make sure dates OK vdatediff = DateDiff("s", Me.DTPickerStart.Value, Me.DTPickerEnd.Value) If DateDiff("s", Me.DTPickerStart.Value, Me.DTPickerEnd.Value) < 0 Then Call MsgBox("The start date occurs after the end date.", _ vbokonly + vbexclamation) Exit Sub decode the leave type If Me.obTravel.Value Then ileavetypebuff = ileave_type.travel ElseIf Me.obVisitor.Value Then ileavetypebuff = ileave_type.visitor ElseIf Me.obOther.Value Then ileavetypebuff = ileave_type.other Else ileavetypebuff = ileave_type.vacation With Me.Adodc1.Recordset.AddNew!Name = Me.tbName.Text!DateStart = Me.DTPickerStart.Value!DateEnd = Me.DTPickerEnd.Value!iEventType = ileavetypebuff.update End With reset the input fields Me.tbName.Text = "" Me.DTPickerEnd.Value = Format(Now, "yyyy-mm-dd") Me.DTPickerStart.Value = Format(Now, "yyyy-mm-dd") Me.obVacation.Value = True benddatechanged = False ******************************************************************** Private Sub btndeleteentry_click() deletes the selection on the data grid Page 9 of 15

2000-08-10 jee 2003-01-22 jee corrected shure to sure!! 2006-02-24 jee added hide statusbox Call ShowStatus("") If MsgBox("Are you sure you want to delete the record" _ & vbcr & " highlighted in the grid box?", vbquestion + vbyesno) = vbyes Then With Me.Adodc1.Recordset.Delete End With ******************************************************************** Private Sub btnquit_click() 2000-08-10 jee Unload Me ******************************************************************** Private Sub btupdatecalendar_click() 2000-08-15 jee 2006-02-24 jee Hide status area at first Dim sfilename1 As String Dim sfilename2 As String Const sinterval_type As String = "m" "m" specifies months as interval. Dim vthismonth As Variant current date Dim vnextmonth As Variant a date in the next month hide the status area Call ShowStatus("") vthismonth = Now add one month the the current date to get next months date vnextmonth = DateAdd(sINTERVAL_TYPE, 1, vthismonth) Generate file names from date first file name is this months schedule sfilename1 = sdirectory_name & "Leave" & Format$(vThisMonth, "YYYYMMM") & ".html" second file name is the next months schedule This is obtained by adding one month to the current date sfilename2 = sdirectory_name & "Leave" & Format$(vNextMonth, "YYYYMMM") & ".html" Fetch data from database and write out file first, for this month Open sfilename1 For Output As #1 Me.ProgressBar.Visible = True Call MakeCalendar(vThisMonth, 0, sfilename2) Me.ProgressBar.Visible = False Close #1 then, for next month Open sfilename2 For Output As #1 Me.ProgressBar.Visible = True Call MakeCalendar(vNextMonth, 1, sfilename1) Me.ProgressBar.Visible = False Close #1 update the statusbar Call ShowStatus("Files written to:" & vbcr & vbcr & _ Page 10 of 15

sfilename1 & vbcr & vbcr & _ sfilename2) ******************************************************************** Private Sub DTPickerEnd_Change() When the end date changes, match this with changes in the start date. 2000-08-10 jee if TRUE, dont change the end date to match changes in the start date. benddatechanged = True ******************************************************************** Private Sub DTPickerStart_Change() Change the end date to match this, unless the user has already changed the end date. 2000-08-10 jee If Not benddatechanged Then Me.DTPickerEnd.Value = Me.DTPickerStart.Value ******************************************************************** Private Sub Form_Initialize() 2000-08-10 jee 2000-08-18 JEE added init of data control. if TRUE, dont change the end date to match changes in the start date. benddatechanged = False m_bdatabaseerror = False ******************************************************************** Private Sub Form_Load() 2000-08-10 jee 2000-08-18 jee added init of data control 2000-09-01 added m_oconnection 2003-12-15 jee changed caption from CDL... to NTC... Me.ProgressBar.Visible = False Me.ProgressBar.Scrolling = ccscrollingsmooth Dim oconn As ADODB.Connection Set m_rsevents = m_oconnection.execute("spgetrecsbydate") setup default values Me.DTPickerStart.Value = Format(Now, "yyyy-mm-dd") Me.DTPickerEnd.Value = Format(Now, "yyyy-mm-dd") Me.tbName.Text = "" Me.obVacation.Value = True Me.Caption = "NTC Leave Schedule Version " & sversion Me.Show Page 11 of 15

load the data control with the connection string Call ShowStatus(vbCr & vbcr & " Connecting to database...") Me.Refresh Set oconn = cngetdataconnection With Me.Adodc1.ConnectionString = sdbconnection Cant get a stored procedure to populate the data grid because it produces forward only cursors. Set.Recordset = oconn.execute("spgetrecsbydate").recordsource = "SELECT dtdatestart AS DateStart, dtdateend AS DateEnd, vcevent AS Name, ieventtype FROM Schedule ORDER BY dtdatestart DESC" On Error Resume Next.Refresh On Error GoTo 0 End With If m_bdatabaseerror Then End With Me.DataGrid1 Set.DataSource = Me.Adodc1 End With Call ShowStatus("") ******************************************************************** Sub ShowStatus(ByVal sstatus) shows the status box Calling Parms: sstatus - string to show if "", then hide status box 2000-08-18 jee 2006-02-24 jee added refresh Me.labStatus.Caption = sstatus If Len(sStatus) = 0 Then Me.labStatus.Visible = False Else Me.labStatus.BackColor = vbblue Me.labStatus.ForeColor = vbwhite Me.labStatus.Visible = True Me.Refresh ******************************************************************** Sub DoHeader(ByVal stitle As String) 2004-01-14 jee changed header from CDL to NTC 2004-08-17 jee now I really think I changed the header from CDL to NTC Print #1, "<html>" Print #1, "<head>" Print #1, "<META HTTP-EQUIV=""Content-Type"" CONTENT=""text/html; charset=iso8859-1"">" Print #1, "<title>ntc Leave Calendar - " & stitle & "</title>" Page 12 of 15

Print #1, "</head>" Print #1, "<body bgcolor=""white"" link=""blue"" alink=""blue"" vlink=""blue"">" Print #1, "<basefont face=""verdana, Arial"">" Print #1, "<center><h1>ntc Leave Calendar</h1>" Print #1, "<h3> " & stitle & " </h3>"; ******************************************************************** Sub DoFooter() 2000-08-15 jee 2000-08-31 jee added software version 2003-09-29 jee changed from Appointments to Visitors 2006-02-24 jee added general leave color Print #1, "</center>" Print #1, "<p> <font size = X small>" & "Color Key:" Print #1, "<UL> <font color=""" & scolor_vacation & """><LI> " & "Vacation" Print #1, "<font color=""" & scolor_other_leave & """><LI> " & "Other Leave (Family, Jury, Doctor, etc.)" Print #1, "<font color=""" & scolor_travel & """><LI> " & "Travel" Print #1, "<font color=""" & scolor_visitor & """><LI> " & "Visitors" & " </UL>" Print #1, "<P> <font color=""black""> " & "Last Modified: " & Format$(Now(), "yyyy-mm-dd hh:mm:ss") Print #1, " Software Ver. " & sversion; "</p>" Print #1, "</body></html>" ******************************************************************** Function cngetdataconnection() As ADODB.Connection 2000-08-07 jee 2000-08-10 jee changed connection string to be constant 2000-09-01 jee changed to use m_oconnection Dim oconn As ADODB.Connection Dim strconn As String Set oconn = CreateObject("ADODB.Connection") If m_oconnection Is Nothing Then Set m_oconnection = CreateObject("ADODB.Connection") m_oconnection.open sdbconnection Set cngetdataconnection = m_oconnection End Function ******************************************************************** Private Sub MakeCalendar(ByVal dtdate As Variant, _ ByVal iwhichmonth As Integer, _ ByVal slinkfilename As String) Purpose: Main calendar page that shows events in a calendar format Calling Parms: vdate - date used to obtain month to query and generate 2000-08-07 jee from MSDN paper, August, 2000 2000-08-10 jee 2000-08-16 jee 2000-08-31 jee corrected color assignments 2005-03-09 jee shortened sat and sun 2005-03-10 jee cleaned up do loop 2006-02-24 jee added other leave, removed progress bar calendar data. iwhichmonth = not 1 is current month 1 - next month slinkfilename - name of file containing prevous/next month calendar Page 13 of 15

Dim dbconn, rs, ndex, nmonth, nyear Set the Month and Year If nmonth = "" Then nmonth = Month(dtDate) If nyear = "" Then nyear = Year(dtDate) Set the date to the first of the current month dtdate = DateSerial(nYear, nmonth, 1) Call ShowStatus("Connecting to database...") Set dbconn = cngetdataconnection Call ShowStatus("") Set rs = dbconn.execute("spgetschedule " & nmonth & ", " & nyear) DoHeader (MonthName(Month(dtDate)) & " " & nyear) print out the days of the week in the table header Print #1, "<tr><td colspan=2>" Print #1, "<table border=1 bgcolor=""gray"" cellpadding=3>" Print #1, "<tr bgcolor=""blue"">" Print #1, "<td width=50><font color=""white""><b>sun</b></font></td>" Print #1, "<td width=180><font color=""white""><b>monday</b></font></td>" Print #1, "<td width=180><font color=""white""><b>tuesday</b></font></td>" Print #1, "<td width=180><font color=""white""><b>wednesday</b></font></td>" Print #1, "<td width=180><font color=""white""><b>thursday</b></font></td>" Print #1, "<td width=180><font color=""white""><b>friday</b></font></td>" Print #1, "<td width=50><font color=""white""><b>sat</b></font></td></tr>" Print #1, "<tr bgcolor=""#ffffc0"">" Add blank cells until the first day of the month For ndex = 1 To Weekday(dtDate) - 1 Print #1, "<td bgcolor=""#c0c0c0""> </td>" Next Loop for this month With Me.ProgressBar.Min = 0.Max = 31.Visible = True.Value = 0 End With Do Me.ProgressBar.Value = Me.ProgressBar.Value + 1 print out the day of the month at the top of the cell: Print #1, "<td valign=""top"">" & Day(dtDate) & "<br> <br>" find all entries for this date and put them into the recordset Set rs = dbconn.execute("spgetscheduleforday " & dtdate & "") loop until the recordset is empty If Not rs.eof Then loop until EOF Do Until rs.eof font size is one size smaller Print #1, "<font size=""-1"">" change colors according to type Select Case rs.fields("ieventtype") Case ileave_type.vacation: Print #1, "<font color=""" & scolor_vacation & """>"; Case ileave_type.other: Print #1, "<font color=""" & scolor_other_leave & """>"; Page 14 of 15

Case ileave_type.travel: Print #1, "<font color=""" & scolor_travel & """>"; Case ileave_type.visitor: Print #1, "<font color=""" & scolor_visitor & """>"; Case Else: Print #1, "<font color=""black"">"; End Select print out the event Print #1, "<b>" & rs("vcevent"); Print #1, "</b></font><br>" rs.movenext If rs.eof Then Exit Do Loop Print #1, "</td>" terminate row if day is Saturday If Weekday(dtDate) = 7 Then Print #1, "</tr>" & vbcrlf & "<tr bgcolor=""#ffffc0"">" dtdate = DateAdd("d", 1, dtdate) Loop Until (Month(dtDate) <> CInt(nMonth)) Add blank cells to fill out the rest of the month if needed If Weekday(dtDate) <> 1 Then For ndex = Weekday(dtDate) To 7 Print #1, "<td bgcolor=""#c0c0c0""> </td>" Next Print #1, "</tr>" Print #1, "</table></td></tr>" Print #1, "<tr><td><a href=""" & slinkfilename & """ > " enter previous/next month links If iwhichmonth = 1 Then Print #1, "<b>&lt - Previous Month" Else current month Print #1, "<b>next Month - &gt" Print #1, "</b></a></td></tr>" Print #1, "</form>" Call DoFooter Page 15 of 15