⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getmonth.asp

📁 功能齐全的oa系统
💻 ASP
字号:
<%@ LANGUAGE = VBScript %>
<% Option Explicit %>
<!-- #include virtual="include/DataEnvi.asp" -->
<%
Response.Expires = -1
Response.AddHeader "Pragma","no-cache"
Response.AddHeader "Cache-Control","no-cache,must-revalidate"
%>
<%
Sub Main()
	Dim strToday
	strToday = Request.QueryString("Today")
	Dim ObjDB, ObjRS, strSQL
	Dim intMonth
	intMonth = Month(strToday)
	set ObjDB = Server.CreateObject("ADODB.Connection")
	OpenDB ObjDB

	dim strMonthStart	'本月1日
	dim strStartDate	'本月1日前一周的星期日
	dim intWeek			'临时变量,用于暂时存储上述两个变量的天数差异

	' 得到本月1日
	strMonthStart = Year(strToday) & "/" & Month(strToday) & "/1"
	intWeek = WeekDay(strMonthStart)	'周日为1,周六为7
	' 转换成周一为1,周日为7
	intWeek = intWeek - 1				
	If intWeek = 0 Then intWeek = 7
	' 得到本月1日前一周的星期日
	strStartDate = DateAdd("d", -intWeek, strMonthStart)
	%>
	<HTML>
	<head>
	<script language = "JavaScript">
	function ViewDay(strDay)
	{
		var strUrl;
		strUrl = "Day.asp?Today=" + strDay;
		//转到日计划
		parent.navigate(strUrl, "", "help:no;status:no");
	}
	</script>
	</head>
	<BODY LEFTMARGIN='0' TOPMARGIN='0' MARGINWIDTH='0' MARGINHEIGHT='0'  Scroll="no"  BGCOLOR="WHITE" LINK="BLACK" VLINK="BLACK" style="MARGIN:0px">
	<table BORDER="0" CELLPADDING="0" BGCOLOR="#F1EDDC" CELLSPACING="1" WIDTH="100%" height="100%">
	<tr width=40 height=60 align = center bgcolor =#B7C9EA id=rowTitle style="font:bold 14px">
		<td style="color:#D2332C">星期日</td>
		<td style="color:white">星期一</td>
		<td style="color:white">星期二</td>
		<td style="color:white">星期三</td>
		<td style="color:white">星期四</td>
		<td style="color:white">星期五</td>
		<td style="color:#D2332C">星期六</td>
	</tr>
	<%
	dim strTempDate
	dim intTempMonth
	dim intTempDay
	dim intTempWeekDay
	dim intMonthDay
	dim strBgColor, strColor, strDetail
	
	for intMonthDay = 0 to 41	           'show 42 days
		if (intMonthDay mod 7 = 0) then
			Response.Write "<tr width=40 height=60>" & VbCrLf
		End if
		strTempDate = DateAdd("d", intMonthDay, strStartDate)
		intTempMonth = Month(strTempDate)
		intTempDay = Day(strTempDate)
		intTempWeekDay = Weekday(strTempDate)
		strTempDate = Year(strTempDate) & "/" & Month(strTempDate) & "/" & Day(strTempDate)
		strBgColor = ""
		strColor = ""
		strDetail = ""
		if intTempMonth <> intMonth then
			' 非当月的背景为浅绿
			strBgColor = "#D2DCED"
			' 周六和周日为红色字
			if intTempWeekDay = 1 or intTempWeekDay = 7 then
				strColor = "#D2332C"
			else
				strColor = "#00009F"
			end if
		else
			' 非当月的背景为表格缺省色
			strBgColor = "F4F4F4"
			' 周六和周日为红色字
			if intTempWeekDay = 1 or intTempWeekDay = 7 then
				strColor = "#D2332C"
			else
				strColor = "#00009F"
			end If
			' 今天的背景为深蓝色
			if DateDiff("d", strTempDate, Date()) = 0 then
				strBgColor = "#9AC2FE"
				strColor = "00009F"
			end if
		end if

		strSQL = "SELECT COUNT(ID) AS [Count] FROM t_OA_Private_Log " & _
				"WHERE IsForLeader=1 And DATEDIFF(dd, StartDate, '" & _
				strTempDate & "') >= 0 AND DATEDIFF(dd, EndDate, '" & _
				strTempDate & "') <= 0" & _
				"GROUP BY DATEPART(dd, StartDate)"
		Set ObjRS = ObjDB.Execute(strSQL)
		If Not ObjRS.EOF Then '当天有安排
			strDetail = "<br><span style='color:red;cursor:hand;font:bold 9pt verdana' " & _
				"title='点击查看日计划' onclick=""ViewDay('" & strTempDate & "')"">" & _
				ObjRS("Count") &"项计划</span>"
		end if
		ObjRS.Close
		Response.Write "<td align=""center"" bgcolor=""" & strBgColor & """>" & _
					"<span style=""cursor:hand;color:" & _
					strColor & ";font:13pt verdana"" title='点击转到日计划' onclick=""ViewDay('" & strTempDate & "')"">" & _
					intTempDay & "</span>" & strDetail & "</td>" & VbCrLf
		if (intMonthDay mod 7 = 6) then
			Response.Write "</tr>" & VbCrLf
		End if
	Next
	%>
	</table>
	</BODY>
	</HTML>
<%
End Sub
Call Main 
%>	

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -