📄 watch_index.asp
字号:
<%response.expires=-1%>
<!--#include file="../conn.asp"-->
<%
oabusyname=request.cookies("oabusyname")
oabusyusername=request.cookies("oabusyusername")
oabusyuserdept=request.cookies("oabusyuserdept")
oabusyuserlevel=request.cookies("oabusyuserlevel")
if oabusyusername="" then
response.write("<script language=""javascript"">")
response.write("window.top.location.href='../../default.asp';")
response.write("</script>")
response.end
end if
%>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="main.css">
</HEAD>
<%
selectdate=trim(request("SelectDate"))
if selectdate="" then selectdate=date()
%>
<BODY BGCOLOR="#FFFFFF">
<div align=center>
<table border=0 width="70%">
<tr>
<td><a href="WriteLog.asp">值班人员填写值班记录/日志</a></td>
<td><a href="ReadLog.asp">查看值班记录/日志</a></td>
<td><a href="Watch_Cancel.asp">取消值班登记</a></td>
</tr>
</table></div>
<div align=center>
<table border=1 cellpadding=3 cellspacing=1 width="95%" bgcolor=#EEEEEE bordercolordark="#FFFFFF" bordercolorlight="#999999">
<tr>
<td width="15%" nowrap><font color=red><b>值班人一揽</b></font></td>
<td align=center><font color=red><%=year(selectdate)&"年"&month(selectdate)&"月"&day(selectdate)&"日"%></font></td>
<td align=right width="25%">
<a href="watch_index.asp?selectdate=<%=cdate(selectdate)-1%>" title="昨日"><img src="images/arrow_left.gif" border=0></a>
<a href="watch_index.asp" title="今日"><img src="images/today.gif" border=0></a>
<a href="watch_index.asp?selectdate=<%=cdate(selectdate)+1%>" title="明日"><img src="images/arrow_right.gif" border=0></a>
</td>
</tr>
</table>
<table border=1 cellpadding=3 cellspacing=0 width="95%" bgcolor=#EEEEEE bordercolordark="#FFFFFF" bordercolorlight="#999999">
<tr>
<td width="20%">部门/值班人及时间</td>
<td colspan=2> </td>
</tr>
<%
Set oconn=Server.CreateObject("ADODB.Connection")
DBPath1=server.mappath("../../db/#sdoa.asa")
oconn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath1
set rs=server.createobject("Adodb.recordset")
sql="select * from dept where ID>0 Order by dept"
rs.open sql,oConn
while not rs.eof
Department=trim(rs("ID"))%>
<tr>
<td>
<%=trim(rs("dept"))%>
</td>
<td>
<%=GetWatch(Department,selectdate)%>
</td>
<td><a href="watch_Order.asp?Department=<%=Department%>&SelectDate=<%=selectdate%>">安排值班>></a></td>
</tr>
<%rs.movenext
wend
rs.close
set rs=nothing
%>
</table></div>
</BODY>
</HTML>
<%
private function GetWatch(byval Department,byval times)
Set oconn=Server.CreateObject("ADODB.Connection")
DBPath1=server.mappath("../../db/#sdoa.asa")
oconn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath1
set rstmp=server.createobject("Adodb.recordset")
sql="select * from tblwatch where Starttime<=#"& times&" 23:30:00" &"# and EndTime>=#"& times &"# and Department="& Department
'修改过了sql语句,时间要使用#
rstmp.open sql,oConn
if not rstmp.eof then
GetWatch=""
while not rstmp.eof
if GetWatch="" then
GetWatch=GetWatch& trim(rstmp("WatchName"))&"<a href=Watch_detail.asp?selectdate="&selectdate&"&ID="&trim(rstmp("ID"))&">(<font color=red>"&trim(rstmp("StartTime"))&"——"&trim(rstmp("endTime"))&"</font>)</a>"
else
GetWatch=GetWatch&"<BR>"& trim(rstmp("WatchName"))&"<a href=Watch_detail.asp?selectdate="&selectdate&"&ID="&trim(rstmp("ID"))&">(<font color=red>"&trim(rstmp("StartTime"))&"——"&trim(rstmp("endTime"))&"</font>)</a>"
end if
rstmp.movenext
wend
else
GetWatch="未安排"
end if
rstmp.close
end function
private function toyestoday (byval strtoday)
today=cdate(strtoday)
today_year=year(today)
today_month=month(today)
today_day=day(today)
yestoday_year=year(today)
yestoday_month=month(today)
yestoday_day=day(today)
if today_day-1>0 then
yestoday_day=yestoday_day-1
elseif today_month="1" then
yestoday_day=getmaxday(today_year,today_month)
yestoday_month="12"
else
yestoday_day=getmaxday(today_year,today_month)
yestoday_month=yestoday_month-1
end if
toyestoday=yestoday_year&"-"&yestoday_month&"-"&yestoday_day
end function
private function totomorrow (byval strtoday)
today=cdate(strtoday)
today_year=year(today)
today_month=month(today)
today_day=day(today)
tomorrow_year=year(today)
tomorrow_month=month(today)
tomorrow_day=day(today)
if ((today_year mod 4=0) and (today_year mod 100<>0)) or (today_year mod 400=0) then
runnian=true
else
runnian=false
end if
select case today_month
case "1","3","5","7","8","10"
if today_day="31" then
tomorrow_day="1"
tomorrow_month=today_month+1
else
tomorrow_day=today_day+1
end if
case "4","6","9","11"
if today_day="30" then
tomorrow_day="1"
tomorrow_month=today_month+1
else
tomorrow_day=today_day+1
end if
case "2"
if runnian and today_day="29" then
tomorrow_day="1"
tomorrow_month=today_month+1
elseif (not runnian) and today_day="28" then
tomorrow_day="1"
tomorrow_month=today_month+1
else
tomorrow_day=today_day+1
end if
case "12"
if today_day="31" then
tomorrow_day="1"
tomorrow_month=today_month+1
tomorrow_year=today_year+1
else
tomorrow_day=today_day+1
end if
end select
totomorrow =tomorrow_year&"-"&tomorrow_month&"-"&tomorrow_day
end function
private function getmaxday(byval stryear, byval strmonth)
if ((stryear mod 4=0) and (stryear mod 100<>0)) or (stryear mod 400=0) then
runnian=true
else
runnian=false
end if
strmonth=strmonth-1
if strmonth="0" then strmonth="12"
select case strmonth
case "1","3","5","7","8","10","12"
getmaxday="31"
case "4","6","9","11"
getmaxday="30"
case "2"
if runnian then
getmaxday="29"
else
getmaxday="28"
end if
case else
getmaxday="31"
end select
end function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -