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

📄 watch_manage.asp

📁 具有计划、任务、通告、公文、员工档案、等网络办公功能
💻 ASP
字号:

<%dim ThisKey
ThisKey = "w"
%>
<!--#include file="../conn.asp"-->
<!--#include file="../dbtools.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
%>
<%
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 userinf where username='" & oabusyusername&"'"
rs.open sql,oconn,1
allow_human_manage=rs("allow_human_manage")     
oconn.close
set oconn=nothing
set rs=nothing
if allow_human_manage<>"yes" then
response.write("<font color=red size=""+1"">对不起,需要人员管理权限!</font>")
	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>
<BODY BGCOLOR="#FFFFFF" leftmargin=20 topmargin=5>
<%
session("empid")=request.Cookies("oabusyuserid")
LoginID=trim(session("EmpId"))
if LoginID="" then LoginID=0

if trim(request("todo"))="delete" and trim(request("SelectID"))<>"" and isnumeric(trim(request("SelectID"))) then
Set oconn=Server.CreateObject("ADODB.Connection")
DBPath1=server.mappath("../../db/#sdoa.asa")
oconn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath1
	oConn.execute "delete from tblWatch where ID="& trim(request("SelectID"))
end if

maxmessage=20
currentpage=request("page")
if currentpage="" then 
currentpage=1
end if

Department=trim(request("Department"))
if Department="" then Department=0
Title=replace(trim(request("Title")),"'","''")
StartTime=replace(trim(request("StartTime")),"'","''")
EndTime=replace(trim(request("EndTime")),"'","''")
if StartTime<>"" and EndTime<>"" then
	if cdate(StartTime)>cdate(EndTime) then StartTime=EndTime
end if
if StartTime<>"" and isdate(StartTime) then
if cdate(StartTime)>date() then StartTime=date()
end if

set rs=Server.CreateObject("ADODB.RecordSet")
sql="select ID,Department,CreateName,WatchName,Starttime,EndTime,Times,Title,body,WatchID from tblWatch where ID>0 "
if Department<>"0" then
sql=sql& " and Department="& Department
end if
if Title<>"" then
sql=sql& " and WatchName like '%"& Title &"%' "
end if
if StartTime<>"" then
sql=sql& " and StartTime>=#"& StartTime &"# "
end if
if EndTime<>"" then
sql=sql& " and EndTime<#"& cdate(EndTime)+1 &"# "
end if
sql=sql& " order by Department, ID DESC"

rs.pagesize=maxmessage
Set oconn=Server.CreateObject("ADODB.Connection")
DBPath1=server.mappath("../../db/#sdoa.asa")
oconn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath1
rs.open sql,oConn,1,1
totalpage=rs.pagecount
totalmessage=rs.recordcount
if totalmessage<>0 then
	rs.AbsolutePage=currentpage
	msgArr=rs.getrows(maxmessage)
end if

rs.close
%>


<form name="SearchForm" method="post" action="">
<div align=center>
<table border=0 width="90%" bgcolor=#53A9FF cellspacing=1>
<tr bgcolor=#FFFFFF><td>
	<table border=0 width="100%" bgcolor=#FFFFFF cellspacing=1>
	<tr bgcolor=#FFFFFF>
	<td width="15%">复合检索:</td>
	<td width="30%">部  门:<%options "Department","dept","dept",Department%></td>
	<td width="40%">值班人:<input type="text" name="Title" value="<%=Title%>" class="input" size=20></td>
	<td></td>
	</tr>
	<tr bgcolor=#FFFFFF>
	<td width="15%"></td>
	<td width="30%">截止:<input type="text" name="EndTime" value="<%=EndTime%>" class="input" size=10>(yyyy-mm-dd)</td>

	<td><input type="submit" name="cmdUp" value="检  索" class="font9boldwhite"></td>
	</tr>
	</table>
</td></tr></table>
</div>
</form>
<div align=center>
<table border=0 width="90%"><tr><td>
<%
response.write "检索到的使用记录 共" & totalmessage & "条/" & totalpage & "页,每页"& maxmessage &"条"
if totalpage>0 then
	response.write ",第" & currentpage & "页 "
end if

if totalpage>1 then
	if currentpage>1 then%>
		<a href="<%=Request.ServerVariables("SCRIPT_NAME")%>?Department=<%=Department%>&title=<%=title%>&page=<%=currentpage-1%>">上页</a>  
		<%
	end if

	if currentpage+1<=totalpage then%>
		<a href="<%=Request.ServerVariables("SCRIPT_NAME")%>?Department=<%=Department%>&title=<%=title%>&page=<%=currentpage+1%>">下页</a>
		<%
	end if
end if
%>
</td></tr></table></div>

<%
if isempty(msgArr) then
	response.write "&nbsp;&nbsp;&nbsp;&nbsp;暂时为空。"
else
for i = 0 to UBound(msgArr,2)

%>
<div align="center">
<table border=1 cellpadding=3 cellspacing=1 width="90%" bgcolor=#EEEEEE bordercolordark="#FFFFFF" bordercolorlight="#999999">
	<tr bgcolor=#CCCCCC><td colspan=4 align=center>
	<font color=red><b><%=gettableValue("dept","dept","id",trim(msgarr(1,i)))%></b></font>
	<%if cdate(trim(msgarr(5,i)))>=now() then%>
		<font color=red><b><%=trim(msgarr(4,i))&"——"&trim(msgarr(5,i))%></b></font>
	<%else%>
		<b><%=trim(msgarr(4,i))&"——"&trim(msgarr(5,i))%></b>
	<%end if%>
	&nbsp;&nbsp;&nbsp;&nbsp;<a href="Watch_manage.asp?todo=delete&selectID=<%=trim(msgarr(0,i))%>" onclick="return CheckDelete();"><img src="../images/delete.gif" border=0></a>
	</td></tr>

	<tr>
	<td nowrap width="15%">值班人:</td>
	<td width="35%">
	<%if trim(msgarr(3,i))<>"" then%>
	<font color=red><%=trim(msgarr(3,i))%></font>
	<%end if%>
	&nbsp;</td>
	<td width="15%">值班部门:</td>
	<td width="35%">
	<%if trim(msgarr(1,i))<>"" then%>
	<%=GetTableValue("dept","dept","ID",trim(msgarr(1,i)))%>
	<%end if%>
	&nbsp;</td>
	
	</tr>

	<tr>
	<td width=60>安排人:</td>
	<td>
	<%if trim(msgarr(2,i))<>"" then%>
	<%=trim(msgarr(2,i))%>
	<%end if%>
	&nbsp;</td>
	<td nowrap width=60>填写时间:</td>
	<td>
	<%if trim(msgarr(6,i))<>"" then%>
	<%=trim(msgarr(6,i))%>
	<%end if%>
	&nbsp;</td>
	</tr>

	<!--tr>
	<td nowrap>值班主题:</td>
	<td colspan=3>
	<%if trim(msgarr(7,i))<>"" then%>
	<%=trim(msgarr(7,i))%>
	<%end if%>
	&nbsp;</td>
	</tr-->

	<tr>
	<td nowrap>值班内容说明:</td>
	<td colspan=3><%=replace(replace(server.htmlencode(trim(msgarr(8,i))&""),chr(13),"<br>")," ","&nbsp;")%>&nbsp;</td>
	</tr>
	<tr>
	<td nowrap>值班日记检查:</td>
	<td colspan=3>
	<%
	Department=trim(msgarr(1,i))
	WatchID=trim(msgarr(9,i))
	StartTime=trim(msgarr(4,i))
	EndTime=trim(msgarr(5,i))
	str=GetLog(trim(msgarr(0,i)),Department,WatchID,StartTime,EndTime)
	response.write str
	%>&nbsp;</td>
	</tr>
			
</table>
</div><BR>

<%
next
end if
%>
</table>
</div>
<BR><BR>

</BODY>
</HTML>
<script language=javascript>
function CheckDelete()
{
//	document.NewsForm.cmdDelete.value !=""
	return confirm("确实删除吗?");
}
</script>
<%
Function GetTableValue(TableName,Field,ValueField,Value)
	if TableName<>"" and Value<>"" then
		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")
		strSql = "Select "& Field &" from "& TableName &" where "& ValueField &"="& Value &""
		Rstmp.open strSql,oConn,1,1
		If not Rstmp.eof then
			GetTableValue=trim(Rstmp(Field))
		else
			GetTableValue=""
		end if
		Rstmp.close
		'set RsTmp = Nothing
	else
		GetTableValue=""
	end if
End Function

Function GetLog(ID,Department,WatchID,StartTime,EndTime)
	if isnumeric(Department) and isnumeric(WatchID) and isdate(StartTime) and isDate(EndTime) then
	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 count(*) as nCount from tblWatchLog where WriteID="& WatchID &" and DepartMent="& Department &" and Times>=#"& StartTime &"# and Times<=#"& EndTime &"#"
	rstmp.open sql,oConn
	if not rstmp.eof then
		nCount=trim(rstmp("nCount"))
		if nCount<>"0" then
			Getlog="<a href=ManageLog.asp?Department="&Department&"&ID="&ID&"&WriteId="&WatchID&">共检查到 <font color=red>"& nCount &"</font> 条值班日记!</a>"
		else
			Getlog="未填写值班日记!"
		end if
	else
		Getlog="未填写值班日记!"
	end if
	rstmp.close
	set rstmp=nothing
	else
		Getlog="出现错误!"
	end if
end Function

%>

<script language=javascript>
function CheckDelete()
{
	return confirm("确实删除吗?");
}
</script>

⌨️ 快捷键说明

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