<%@LANGUAGE="VBSCRIPT"%> <% function getColorByDataAssignments(tmprs) if (tmprs.eof) then getColorByDataAssignments="0" else getColorByDataAssignments = "B0BECC" end if end function dim Conn, strSql, rs, strMessage set Conn = server.createobject("ADODB.Connection") Conn.open strConn %>


  <% ' first determine the months to display if request("m") <> "" and request("y") <> "" then if cint(request("m")) mod 2 = 0 then currentMonth = cint(request("m")-1) else currentMonth = cint(request("m")) end if currentYear = cint(request("y")) else ' show default month if month(date) mod 2 = 0 then currentMonth = month(date) - 1 else currentMonth = month(date) end if currentYear = year(date) end if %>
<% set rs = server.createobject("ADODB.Recordset") rs.CursorLocation=3 strSql = "select distinct year(theDate) as theYear from tblEvent where year((theDate)) >= " & year(date) rs.open strSql, Conn do while not rs.eof %> <% rs.movenext loop rs.close %>
>"><%= rs("theYear")%>
>jan - feb
>mar - apr
>may -jun
>jul - aug
>sep - oct
>nov - dec
<% strSql = "select *, day(theDate) as theDay, month(theDate) as theMonth from tblEvent where month(theDate) in (" & currentMonth & "," & currentMonth+1 & ") and year(theDate) = " & currentYear rs.open strSql, Conn 'currentDate = CDate(cstr(currentMonth) + "/" + "01" + "/" + cstr(currentyear)) 'for each month in the year for i=currentMonth to currentMonth + 1 currentDate = CDate(cstr(i) + "/" + "01" + "/" + cstr(currentyear)) currentMonth=month(currentDate) currentWeekDay = weekday(currentDate) %> <% next rs.close : set rs = nothing %>
<% 'insert blanks untill the first day of the month (1/1) 'if the 1/2/2001 is tuesday then insert 2 blank <% for j=0 to currentWeekDay-2 %> <% next end if 'insert the days of the month and only for this month do while month(currentDate) = currentMonth 'only 7 days in a row (one week) if j mod 7=0 then %> <% end if rs.filter = "theDay=" & day(currentDate) & " and theMonth=" & month(currentDate) color = getColorByDataAssignments(rs) if color = "0" then %> <% 'close the row of one week if j mod 7=6 then %> <% end if 'next day currentDate = DateAdd("d", 1, currentDate) j = j +1 loop 'insert blanks untill the end day of the month 'if the 30/2/2001 is tuesday then insert 4 blank <% next end if %>
<%=monthName(currentMonth)%>
S M T W T F S
if currentWeekDay<>1 then %>
 
<% else %> <% end if %> <% if day(currentDate) = cint(request("d")) and month(currentDate) = cint(request("m")) and year(currentDate) = cint(request("y")) then response.write "" & day(currentDate) & "" else response.write day(currentDate) end if %>
currentWeekDay = weekday(currentDate) if currentWeekDay>1 then for j=currentWeekDay to 7 %>  
  <% if request("d") <> "" then %>
 
<%= formatdatetime(request("m") + "/" + request("d") + "/" + request("y"), vbLongDate) %>

 
<% set rs = server.createobject("ADODB.Recordset") strSql = "select * from tblEvent where theDate = #" & PadZero(request("m"),2) & "/" & PadZero(request("d"),2) & "/" + request("y") & "# order by AMPM, theTime;" rs.CursorLocation=3 rs.open strSql, Conn if rs.recordcount = 1 then 'show detail if there's only one event for the day ID_FK = rs("Event_ID_PK") %> <% else do while not rs.eof %> <% rs.movenext loop end if %>
<%= left(rs("theTime"),2) + ":" + right(rs("theTime"),2) + " " + rs("AMPM") %>
<%= AddBrToCrLf(rs("theText"))%>
<% rs.close %>
<%= left(rs("theTime"),2) + ":" + right(rs("theTime"),2) + " " + rs("AMPM") %>     "><%= trim(rs("Title")) %>
<% end if %>
<% ' upcoming events set rs2 = server.createobject("adodb.recordset") strSql = "select top 4 tblEvent.*, tblIcon.ImgFile FROM tblEvent LEFT JOIN tblIcon ON tblEvent.Icon_ID_FK = tblIcon.Icon_ID_PK where tblEvent.theDate >=date() order by tblEvent.theDate" rs2.open strSql, Conn %>
 


Upcoming Events

<% If Not rs2.EOF Then %> <% End If If Not rs2.EOF Then %> <% End If If Not rs2.EOF Then %> <% End If If Not rs2.EOF Then %> <% End If rs2.close : set rs2=nothing %>
" width="89" height="52"> <% 'If Len(rs2("theText")) > 80 Then dot = ".." Else dot = "" response.write formatdatetime(rs2("theDate"), vbShortDate) response.write "
" response.write rs2("title") rs2.MoveNext %>
" width="89" height="52">   <% response.write formatdatetime(rs2("theDate"), vbShortDate) response.write "
" response.write rs2("title") rs2.MoveNext %>
" width="89" height="52">   <% response.write formatdatetime(rs2("theDate"), vbShortDate) response.write "
" response.write rs2("title") rs2.MoveNext %>
" width="89" height="52">   <% response.write formatdatetime(rs2("theDate"), vbShortDate) response.write "
" response.write rs2("title") rs2.MoveNext %>
 
 
<% set rs = nothing Conn.close : set Conn = nothing Function AddBrToCrLf(strInput) AddBrToCrLf = Replace(strInput, vbCrLf, "
" & vbCrLf) End Function %>
 
6355 Corte Del Abeto C-100 Carlsbad, CA 92009 Phone: 760.603.9777 © 2005, All rights reserved. Calvary Chapel Carlsbad