<!--#include file="../inc/Secure.htm"-->
<%dim ThisKey
ThisKey = "i"
%>
<!--#include file="../inc/permission.htm"-->
<!--#include file="../inc/conn.htm"-->
<!--#include file="../inc/dbtools.htm"-->
<%
LoginID=trim(session("LoginID"))
if LoginID="" then LoginID=0
UserName=GetTableValue ("tblUser","Name","ID",LoginID)

if trim(request("todo"))="delete" and trim(request("SelectID"))<>"" and isnumeric(trim(request("SelectID"))) then
	oConn.execute "delete tblWatchLog 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
WriteID=trim(request("WriteID"))
if WriteID="" then WriteID=0
Title=replace(trim(request("Title")),"'","''")

set rs=Server.CreateObject("ADODB.RecordSet")
sql="select ID,Department,WriteID,WriteName,Title,Body,Times from tblWatchLog where ID>0 "
if Department<>"0" then
sql=sql& " and Department="& Department
end if
if WriteID<>"0" then
sql=sql& " and WriteID="& WriteID
end if
if Title<>"" then
sql=sql& " and Title like '%"& Title &"%'"
end if
sql=sql& " order by Title"

rs.pagesize=maxmessage
rs.open sql,oConn,1,1
totalpage=rs.pagecount
totalmessage=rs.recordcount
if totalmessage<>0 then
	rs.AbsolutePage=currentpage
	arrMsg=rs.getrows(maxmessage)
end if

rs.close
%>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="../CSS/main.css">
</HEAD>
<BODY BGCOLOR="#FFFFFF" leftmargin=20 topmargin=5>
<BR>

<form name="SearchForm" method="post" action="">
<div align=center>
<table border=0>
<tr>
<td>部门：<%options "Department","tblDepartment","Name",Department%></td>
<td>员工：<%options "WriteID","tblUser","Name",WriteID%></td>
<td>主题：<input type="text" name="Title" class="input" size=20></td>
<td><input type="submit" name="cmdUp" value="检  索" class="font9boldwhite"></td>
</table>
</div>
</form>

上页　　 下页 
<div align=center>
<table border=1 cellpadding=3 cellspacing=1 width="95%" bgcolor=#EEEEEE bordercolordark="#FFFFFF" bordercolorlight="#999999">
	<tr>
	<td width=80>填写用户：</td>
	<td><%=trim(arrMsg(3,i))%></td>
	<td width=80>安排部门：</td>
	<td><%=GetTableValue("tblDepartment","Name","ID",arrMsg(1,i))%></td>
</tr>
<tr>
	<td>记录填写时间</td>
	<td colspan=3><%=arrmsg(6,i)%></td>
</tr>
<tr>
	<td>记录日志主题</td>
	<td colspan=3><%=arrMsg(4,i)%></td>
</tr>
<tr>
<td>记录内容描述</td>
<td colspan=3>
<%=replace(replace(server.htmlencode(arrMsg(5,i)&""),chr(13),"<br>")," ","&nbsp;")%>&nbsp;

</td>
</tr>

<tr>
<td>&nbsp;</td>
<td colspan=3 align=right>
<a href="../watch/readlog.htm?todo=delete&selectID=<%=trim(arrMsg(0,i))%>" onclick="return CheckDelete();">删除</a>
</td>
</tr>

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

<BR>
&nbsp;&nbsp;<INPUT TYPE="button" name="cmdreturn" value="返  回" class="font9boldwhite" onclick="javascript:history.back(-1);">
<BR><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 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

%>
<!--#include file="../inc/conn_close.htm"-->
<script language=javascript>
function CheckDelete()
{
	return confirm("确实删除吗？");
}
</script>