<%response.expires=-1%>
<!--#include file="../inc/Secure.htm"-->
<%dim ThisKey
ThisKey = "o"
%>
<!--#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)
Department = GetTableValue ("tblUser","Department","ID",LoginID)
DocClass=cRequest("Class")
Title=cRequest("Title")
FromDepartment=cRequest("FromDepartment")
if DocClass="" then DocClass=0
if FromDepartment="" then FromDepartment=0

if trim(request("todo"))="delete" and trim(request("SelectID"))<>"" and isnumeric(trim(request("SelectID"))) then
	oConn.execute "delete tblDoc where ID="& trim(request("SelectID"))
end if

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

set rs=Server.CreateObject("ADODB.RecordSet")
sql="select ID,Outin,Class,Title,FromID,CreateTimes,currentID,CurrentStep,dispense,Pigeonhole from tblDoc where ID>0 "
if Title<>"" then
sql=sql&" and Title like '%"& title &"%' "
end if
if DocClass<>0 then
sql=sql&" and Class="& DocClass
end if
if FromDepartment<>0 then
sql=sql&" and FromDepartment="& FromDepartment
end if
sql=sql&" Order by ID desc"

rs.pagesize=maxmessage
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
%>
<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>
<div align=center>
<table border=1 cellpadding=3 cellspacing=1 width="100%" bgcolor=#FFFFFF bordercolordark="#FFFFFF" bordercolorlight="#005AB5">
<tr><td>
<form name="searchform" method="post" action="">
检索：
公文种类：<%options "class","tblDocClass","Name",DocClass%>
拟稿部门：<%options "FromDepartment","tblDepartment","Name",FromDepartment%>
标题：<input type="text" class="doc_txt" name="title" value="<%=title%>" size=15 maxlength=50>
<INPUT TYPE="submit" name="cmdSearch" value="搜索" class="font9boldwhite">
</td></table>
</div>

<div align=center>
<table border=0 width="100%" cellpadding=0 cellspacing=0><tr>
    <td> 上页　　 下页 </td>
  </tr></table>
<div align=center>
<table border=0 width="100%" cellspacing="1" cellpadding=3 bgcolor="#005AB5">
<tr bgcolor=#eeFFFF align=center>
	<td width="6%">&nbsp;</td>
	<td width="10%">公文种类</td>
	<td>公文主题</td>
	<td width="10%">拟稿人</td>
	<td width="12%">拟稿时间</td>
	<td width="15%">当前</td>
	<td width="6%"></td>
</tr>
	<tr>
		<td nowrap align=center><%=strOutin%></td>
		<td align=center><%=getTablevalue("tblDocclass","name","ID",trim(msgArr(2,i)))%></td>
		<td><a href="<%=strFile%>?ID=<%=trim(msgArr(0,i))%>"><%=strTitle%></a></td>
		<td><%=getTablevalue("tblUser","name","ID",trim(msgArr(4,i)))%></td>
		<td><%=year(trim(msgArr(5,i)))&"-"&month(trim(msgArr(5,i)))&"-"&day(trim(msgArr(5,i)))%></td>
		<td nowrap><%=strCurrent%></td>
		<td><a href="doc_delete.htm?SelectID=<%=trim(msgarr(0,i))%>&todo=delete" onclick="return CheckDelete();">删除</a></td>
	</tr>
<%
next
end if
%>

</table>
</div>
<BR><BR>
</BODY>
</HTML>
<script language=javascript>
function CheckDelete()
{
	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>