<%
intMonth=Request.QueryString("month")
strYear=Request.QueryString("year")
if intMonth<=12 and intMonth >=1 then
if isdate("01-"&monthname(intMonth)&"-"&strYear) then
strMonth=monthname(intMonth)
'intMonth=month(intMonth)
'strYear=year(now)
else
strMonth=monthname(month(now))
intMonth=month(now)
strYear=year(now)
end if
else
strMonth=monthname(month(now))
intMonth=month(now)
strYear=year(now)
end if
set conn=Server.CreateObject("ADODB.Connection")
fpath="DBQ="&Server.MapPath("admin\_db\feida.mdb")
dpath="Driver={Microsoft Access Driver (*.mdb)};"
conn.open dpath&fpath
set rs=Server.CreateObject("ADODB.Recordset")
set rs2=server.CreateObject("ADODB.Recordset")
%>
<%
if not cint(intMonth)=month(now) then
%>
<%
end if
%>
Course
Calendar
<%=strMonth%> <%=strYear%>
MON
TUE
WED
THU
FRI
SAT
SUN
<%
'generate first week of the month
const totalDayperWeek=7
strWeekDay=weekday("01-"&strMonth&"-"&strYear)-1
if strWeekDay=0 then
strWeekDay=7
end if
%>
<%
if strWeekDay>1 then
for i=1 to strWeekDay-1
%>
<%
counter=counter+1
next
end if
%>
<%
counter=1
for i=1 to totalDayperWeek-strWeekDay+1
%>
<%=counter%>
<%
strDOCourse=cdate(counter & "-" & strMonth & "-" & strYear)
'Response.Write(strDOCourse)
strSQL="SELECT * FROM CourseSchedule WHERE DOCourse=#"&strDOCourse&"# ORDER BY ID"
rs.open strSQL,conn,1,3
if not rs.EOF then
do while not rs.EOF
courseID=rs("CourseID")
ClassType=rs("ClassType")
OpenSeaID=rs("OpenSeaID")
strSQL="SELECT * FROM CourseMaster WHERE ID="&courseID
rs2.Open strSQL,conn,1,3
if not rs2.EOF then
CourseName=rs2("CourseName")
end if
rs2.close
if ClassType="Open Sea" then
strSQL="SELECT * FROM CourseOpenSea WHERE OpenSeaID="&OpenSeaID
rs2.Open strSQL,conn,1,3
if not rs2.EOF then
Destination=rs2("Destination")
Itinerary=rs2("Itinerary")
NoDives=rs2("NoDives")
Availability=rs2("Availability")
Remarks=rs2("Remarks")
DAPoint=rs2("DAPoint")
Meals=rs2("Meals")
Accomodation=rs2("Accomodation")
end if
rs2.close
end if
%>
<%
MonthLastDay=day(dateserial(strYear,intMonth+1,1-1))
counter2=1
for i=counter to MonthLastDay
%>
<%=i%>
<%
strDOCourse=cdate(i & "-" & strMonth & "-" & strYear)
'Response.Write(strDOCourse)
strSQL="SELECT * FROM CourseSchedule WHERE DOCourse=#"&strDOCourse&"# ORDER BY ID"
rs.open strSQL,conn,1,3
if not rs.EOF then
do while not rs.EOF
courseID=rs("CourseID")
ClassType=rs("ClassType")
OpenSeaID=rs("OpenSeaID")
strSQL="SELECT * FROM CourseMaster WHERE ID="&courseID
rs2.Open strSQL,conn,1,3
if not rs2.EOF then
CourseName=rs2("CourseName")
end if
rs2.close
if ClassType="Open Sea" then
strSQL="SELECT * FROM CourseOpenSea WHERE OpenSeaID="&OpenSeaID
rs2.Open strSQL,conn,1,3
if not rs2.EOF then
Destination=rs2("Destination")
Itinerary=rs2("Itinerary")
NoDives=rs2("NoDives")
Availability=rs2("Availability")
Remarks=rs2("Remarks")
DAPoint=rs2("DAPoint")
Meals=rs2("Meals")
Accomodation=rs2("Accomodation")
end if
rs2.close
end if
%>