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

📄 szxxr.asp

📁 OFFICE办公自动化
💻 ASP
字号:
<!--#include file="../inc/Secure.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/Const.asp"-->

<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
	<meta name="Author" content="liujun">
	<link rel="stylesheet" href="../css/main.css" type=text/css>
	<title>考勤休息日设置</title>
</head>
<body>
<div class="TitleBar">设置休息日</div>
<%
function GetDaysInMonth(iMonth, iYear)
	Dim dTemp
	dTemp = DateAdd("d", -1, DateSerial(iYear, iMonth + 1, 1))
	GetDaysInMonth = Day(dTemp)
End function

function GetWeekdayMonthStartsOn(dAnyDayInTheMonth)
	Dim dTemp
	dTemp = DateAdd("d", -(Day(dAnyDayInTheMonth) - 1), dAnyDayInTheMonth)
	GetWeekdayMonthStartsOn = WeekDay(dTemp)
End function

function SubtractOneMonth(dDate)
	SubtractOneMonth = DateAdd("m", -1, dDate)
End function

function AddOneMonth(dDate)
	AddOneMonth = DateAdd("m", 1, dDate)
End function

Dim dDate     ' Date we're displaying calendar for
Dim iDIM      ' Days In Month
Dim iDOW      ' Day Of Week that month starts on
Dim iCurrent  ' Variable we use to hold current day of month as we write table
Dim iPosition ' Variable we use to hold current position in table
' Get selected date.  There are two ways to do this.
' first check if we were passed a full date in RQS("date").
' If so use it, if not look for seperate variables, putting them togeter into a date.
' Lastly check if the date is valid...if not use today
If IsDate(Request.QueryString("date")) Then
	dDate = CDate(Request.QueryString("date"))
Else
	If IsDate(Request.QueryString("month") & "-" & Request.QueryString("day") & "-" & Request.QueryString("year")) Then
		dDate = CDate(Request.QueryString("month") & "-" & Request.QueryString("day") & "-" & Request.QueryString("year"))
	Else
		dDate = Date()
		' The annoyingly bad solution for those of you running IIS3
		If Len(Request.QueryString("month")) <> 0 Or Len(Request.QueryString("day")) <> 0 Or Len(Request.QueryString("year")) <> 0 Or Len(Request.QueryString("date")) <> 0 Then
			Response.Write "The date you picked was not a valid date.  The calendar was set to today's date.<BR><BR>"
		End If
		' The elegant solution for those of you running IIS4
		'If Request.QueryString.Count <> 0 Then Response.Write "The date you picked was not a valid date.  The calendar was set to today's date.<BR><BR>"
	End If
End If

'Now we've got the date.  Now get Days in the choosen month and the day of the week it starts on.
iDIM = GetDaysInMonth(Month(dDate), Year(dDate))
iDOW = GetWeekdayMonthStartsOn(dDate)
%>
<table align="center" width="360" class="InputframeMain"><tr><td><table width=340 border=0 align=center cellpadding="2" cellspacing="1" style="Margin:5px 5px 5px 5px" class=tab>
	<form method="post" action="szxxr1.asp" name="forma"> 
	<input type="hidden" value="<%=year(ddate)%>" name="nian">
	<input type="hidden" value="<%=month(ddate)%>" name="yue">
	<tr>
		<td ALIGN="middle" COLSPAN="7" class=tdTop>
			<table WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
				<tr>
					<td ALIGN="right" class=tdTop><a href="szxxr.asp?date=<%= SubtractOneMonth(dDate) %>" class=linkTop>上月</a></td>
					<td ALIGN="middle" class=tdTop><b><%= Year(dDate) & "年   " & MonthName(Month(dDate))%></b></td>
					<td ALIGN="left" class=tdTop><a href="szxxr.asp?date=<%= AddOneMonth(dDate) %>" class=linkTop>下月</a></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr class=td1>
		<td ALIGN="middle" class=listcellrow><p><b>星期天</b><br></p></td>
		<td ALIGN="middle"><p><b>星期一</b><br></p></td>
		<td ALIGN="middle"><p><b>星期二</b><br></p></td>
		<td ALIGN="middle"><p><b>星期三</b><br></p></td>
		<td ALIGN="middle"><p><b>星期四</b><br></p></td>
		<td ALIGN="middle"><p><b>星期五</b><br></p></td>
		<td ALIGN="middle" class=listcellrow><p><b>星期六</b><br></p></td>
	</tr>
	
<%
' 如果本月第一天不是星期天,在前加cell.
If iDOW <> 1 Then
	Response.Write vbTab & "<TR class=td1>" & vbCrLf
	iPosition = 1
	Do While iPosition < iDOW
		Response.Write vbTab & vbTab & "<TD class='listcellrow' >&nbsp;</TD>" & vbCrLf
		iPosition = iPosition + 1
	Loop
End If

'将每一日写入日历
iCurrent = 1
iPosition = iDOW
Do While iCurrent <= iDIM
	'如果在行开始,加<tr>
	If iPosition = 1 Then
		Response.Write vbTab & "<TR class=td1>" & vbCrLf
	End If
	
	'将今天用颜色区别开
	call checkifrest()
	
	' 如果在行末,加</tr>
	If iPosition = 7 Then
		Response.Write vbTab & "</TR>" & vbCrLf
		iPosition = 0
	End If
	
	' 变量+1
	iCurrent = iCurrent + 1
	iPosition = iPosition + 1
Loop

' 增加一空cell
If iPosition <> 1 Then
	Do While iPosition <= 7
		Response.Write vbTab & vbTab & "<TD class='listcellrow' >&nbsp;</TD>" & vbCrLf
		iPosition = iPosition + 1
	Loop
	Response.Write vbTab & "</TR>" & vbCrLf
End If
%></table></td></tr>
	<tr class=InputframeButtonLine>
		<td align="center" height=35>
			<input type="button" class="button" value="保存" name="B1" onclick="javascript:forma.submit();">&nbsp;<input type="button" class="button" value="重置" name="B2" onclick="forma.reset();">
		</td>
	</tr>
</form>
</table>


<%'显示本月日历及是否为休息日%>
<% Sub checkifrest()%>

<% 
If datevalue(year(ddate) &"-"& month(ddate) & "-" & icurrent) = datevalue(now) Then

    Set RS = server.CreateObject("ADODB.RecordSet")
	sql="select * from kq_xxrb where year(xxr)=" & year(dDate) & " and month(xxr)=" & month(dDate) & " and day(xxr)=" & iCurrent
	RS.Open sql,oConn,1,1
	If rs.RecordCount=0 then
			Response.Write vbTab & vbTab & "<TD BGCOLOR=#ff0000><P><input type='checkbox' name='C1' value='" & year(dDate) & "-" & month(dDate) & "-" & icurrent  & "' disabled><B>" & icurrent & vbCrLf
	Else
		Response.Write vbTab & vbTab & "<TD BGCOLOR=#ff0000><P><input type='checkbox' name='C1' value='" & year(dDate) & "-" & month(dDate) & "-" & icurrent  & "' checked disabled><B>" & icurrent & vbCrLf
	End if
Else
	Set RS = server.CreateObject("ADODB.RecordSet")
	sql="select * from kq_xxrb where year(xxr)=" & year(dDate) & " and month(xxr)=" & month(dDate) & " and day(xxr)=" & iCurrent
	RS.Open sql,oConn,1,1
	If rs.recordcount=0 then
	   if datevalue(year(ddate) &"-"& month(ddate) & "-" & icurrent)<datevalue(now) then
    	    Response.Write vbTab & vbTab & "<TD class='listcellrow'><P><input type='checkbox'  name='C1' value='" & year(dDate) & "-" & month(dDate) & "-" & icurrent  & "' disabled>" & icurrent &  vbCrLf
	    else
	    	Response.Write vbTab & vbTab & "<TD class='listcellrow'><P><input type='checkbox'  name='C1' value='" & year(dDate) & "-" & month(dDate) & "-" & icurrent  & "'>" & icurrent &  vbCrLf
		end if
	Else
	  if datevalue(year(ddate) &"-"& month(ddate) & "-" & icurrent)<datevalue(now) then
	   Response.Write vbTab & vbTab & "<TD class='listcellrow'><P><input type='checkbox' name='C1' value='" & year(dDate) & "-" & month(dDate) & "-" & icurrent  & "' checked disabled>" & icurrent &  vbCrLf
	  else 
	    Response.Write vbTab & vbTab & "<TD class='listcellrow'><P><input type='checkbox' name='C1' value='" & year(dDate) & "-" & month(dDate) & "-" & icurrent  & "' checked>" & icurrent &  vbCrLf
	  end if
	End if
End If

%>
<% End Sub %>
<%
	set rs=nothing
	oConn.close
	set oConn=nothing
%>
</body>
</html>
 

⌨️ 快捷键说明

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