Code:
<% wYear=Request.QueryString("wYear") IF wYear = "" THEN wYear=Request.Form("wYear") IF wYear = "" OR wYear < 1753 OR wYear > 9999 THEN wYear = DATEPART("yyyy",now()) wMonth=Request.QueryString("wMonth") IF wMonth = "" THEN wMonth=Request.Form("wMonth") IF wMonth = "" THEN wMonth=DATEPART("m", now()) szMonth = MonthName(wMonth) SET conn=server.createobject("ADODB.connection") conn.Open "DATABASE=[database name];DSN=[DSN Name];UID=[login];Password=[password];" szSQL = "SELECT DATEPART(dd, RecDate) AS DayOfMonth, DATEPART(dw, RecDate) AS WkDay, " & _ "DaysTopCustomer FROM SalesRecords "& _ "WHERE DATEPART(yyyy, RecDate) = " & wYear & "AND DATEPART(mm, RecDate) = " & wMonth & _ " GROUP BY DATEPART(dd, RecDate), DATEPART(dw, RecDate) "& _ "ORDER BY DATEPART(dd, RecDate)" SET rs1=conn.Execute(szSQL) 'INITIALIZE DAY ARRAY lc = 0 dim d(31) for lc = 1 to 31 D(lc) = " " next 'loop through records for the month & assign to D array. DO WHILE NOT rs1.eof 'DAY ASSIGNMENT LOOP TempD = rs1("DayOfMonth") D(TempD) = rs1("DaysTopCustomer") IF NOT rs1.eof THEN rs1.movenext IF rs1.eof then exit do LOOP %> <html><HEAD><TITLE>Single Month View of Perpetual Calendar</TITLE></head> <BODY><CENTER><H2>Subscription Sales</H2><P> <H1><%=szMonth%>, <%=wYear%></H1><P> <TABLE ALIGN=center WIDTH=75% BORDER=1 CELLSPACING=1 CELLPADDING=5> <TR> <TD ALIGN=middle width=14%><STRONG>Sunday</STRONG></TD> <TD ALIGN=middle width=14%><STRONG>Monday</STRONG></TD> <TD ALIGN=middle width=14%><STRONG>Tuesday</STRONG></TD> <TD ALIGN=middle width=14%><STRONG>Wednesday</STRONG></TD> <TD ALIGN=middle width=14%><STRONG>Thursday</STRONG></TD> <TD ALIGN=middle width=14%><STRONG>Friday</STRONG></TD> <TD ALIGN=middle width=14%><STRONG>Saturday</STRONG></TD> </TR> <TR> <% 'Determine day of the week the month begins on tempdate = wMonth & "/1/" & wYear bwdom = datepart("w", tempdate) DayOfWeekCounter = 1 'PRINT LEADING BLANK DAYS SELECT CASE bwdom CASE 1 DayOfWeekCounter = 1 CASE 2 %> <TD> </TD><%DayOfWeekCounter = 2 CASE 3 %> <TD> </TD><TD> </TD><%DayOfWeekCounter = 3 CASE 4 %> <TD> </TD><TD> </TD><TD> </TD><%DayOfWeekCounter = 4 CASE 5 %> <TD> </TD><TD> </TD><TD> </TD><TD> </TD><%DayOfWeekCounter = 5 CASE 6 %> <TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><%DayOfWeekCounter = 6 CASE 7 %> <TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><%DayOfWeekCounter = 7 CASE ELSE %> <TD>Beginning Day of Week Error</TD><% END SELECT 'Determine last day of month & number of weeks IF wMonth < 12 THEN ldom = Day(DateAdd("d", -1, wMonth + 1 & "/1/" & wYear)) ELSE ldom = Day(DateAdd("d", -1, "1/1/" & wYear + 1)) END IF NumWeeks = 5 IF (bwdom = 6 AND ldom = 31) OR (bwdom = 7 AND ldom > 29) THEN NumWeeks = 6 IF bwdom = 1 AND ldom = 28 THEN NumWeeks = 4 DayCounter = 1 WeekCounter = 1 DO WHILE WeekCounter < NumWeeks + 1 DO WHILE DayOfWeekCounter < 8 IF DayCounter < ldom + 1 THEN %> <TD ALIGN=left> <TABLE ALIGN=center width=100% BORDER=0 CELLSPACING=0 CELLPADDING=0> <TR><TD align=left><STRONG><%=DayCounter%></STRONG> </TR><TR> <TD align=center><H2><FONT color=ff0000> <%=D(DayCounter)%></FONT></H2> </TR></TABLE> <%ELSE%> <TD ALIGN=middle> </TD> <%END IF DayOfWeekCounter = DayOfWeekCounter + 1 DayCounter = DayCounter + 1 LOOP DayOfWeekCounter = 1 WeekCounter = WeekCounter + 1 %> </TR><TR> <%LOOP%> </TABLE> <%IF wMonth = 1 THEN%> <a href="month.asp?wMonth=12%>&wYear=<%=(wYear-1)%>">Previous</a> <a href="month.asp?wMonth=<%=(wMonth+1)%>&wYear=<%=wYear%>">Next</a> <%ELSEIF wMonth = 12 THEN%> <a href="month.asp?wMonth=<%=(wMonth-1)%>&wYear=<%=wYear%>">Previous</a> <a href="month.asp?wMonth=1&wYear=<%=(wYear+1)%>">Next</a> <%ELSE%> <a href="month.asp?wMonth=<%=(wMonth-1)%>&wYear=<%=wYear%>">Previous</a> <a href="month.asp?wMonth=<%=(wMonth+1)%>&wYear=<%=wYear%>">Next</a> <%END IF%> <FORM action="month.asp" method="post" id=form1 name=form1> <SELECT name="wMonth" size="1"> <%IF wMonth = 1 THEN %> <option selected value="1">January</option> <%ELSE%> <option value="1">January</option> <%END IF%> <%IF wMonth = 2 THEN %> <option selected value="2">February</option> <%ELSE%> <option value="2">February</option> <%END IF%> <%IF wMonth = 3 THEN %> <option selected value="3">March</option> <%ELSE%> <option value="3">March</option> <%END IF%> <%IF wMonth = 4 THEN %> <option selected value="4">April</option> <%ELSE%> <option value="4">April</option> <%END IF%> <%IF wMonth = 5 THEN %> <option selected value="5">May</option> <%ELSE%> <option value="5">May</option> <%END IF%> <%IF wMonth = 6 THEN %> <option selected value="6">June</option> <%ELSE%> <option value="6">June</option> <%END IF%> <%IF wMonth = 7 THEN %> <option selected value="7">July</option> <%ELSE%> <option value="7">July</option> <%END IF%> <%IF wMonth = 8 THEN %> <option selected value="8">August</option> <%ELSE%> <option value="8">August</option> <%END IF%> <%IF wMonth = 9 THEN %> <option selected value="9">September</option> <%ELSE%> <option value="9">September</option> <%END IF%> <%IF wMonth = 10 THEN %> <option selected value="10">October</option> <%ELSE%> <option value="10">October</option> <%END IF%> <%IF wMonth = 11 THEN %> <option selected value="11">November</option> <%ELSE%> <option value="11">November</option> <%END IF%> <%IF wMonth = 12 THEN %> <option selected value="12">December</option> <%ELSE%> <option value="12">December</option> <%END IF%> </SELECT> Year (1753 to 9999): <input size=6 maxlength=4 name=wYear value=<%=wYear%>> <input type="submit" name="Jump" VALUE="Jump"> </form> <a href="calendar.asp">Full Year View</a> </center></BODY></HTML>+
file: /Techref/method/month.asp.htm, 8KB, , updated: 2008/12/13 10:31, local time: 2024/8/14 23:12,
owner: JMN-EFP-786,
3.143.244.58:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://techref.massmind.org/techref/method/month.asp.htm"> ASP Month Calendar</A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to techref.massmind.org! |
.