<%response.expires=-1%>
<!--#include file="../inc/Secure.htm"-->
<%dim ThisKey
ThisKey = "p"
%>
<!--#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)
PigeClass=cRequest("PigeClass")
DocClass=cRequest("Class")
FromDepartment=cRequest("FromDepartment")
if PigeClass="" then PigeClass=0
if DocClass="" then DocClass=0
if FromDepartment="" then FromDepartment=0

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

set rs=Server.CreateObject("ADODB.RecordSet")
sql="select ID,Outin,Class,PigeClass,Title,FromID,PigeTime,PigeID from tblDoc where Pigeonhole=1 "
if PigeClass<>0 then
sql=sql&" and PigeClass="& PigeClass
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="95%" bgcolor=#FFFFFF bordercolordark="#FFFFFF" bordercolorlight="#005AB5">
<tr><td>
<form name="searchform" method="post" action="">
公文检索：
归档类别：<%options "Pigeclass","tblDocPige","Name",PigeClass%>
公文种类：<%options "class","tblDocClass","Name",DocClass%>
拟稿部门：<%options "FromDepartment","tblDepartment","Name",FromDepartment%>
<INPUT TYPE="submit" name="cmdSearch" value="搜索" class="font9boldwhite">
</td></tr>
</table>
</div>

<div align=center>
<table border=0 width="95%" cellpadding=0 cellspacing=0><tr><td>
<%
response.write "<img src='../images/t-gdgw.jpg' border=0> 共" & 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")%>?pigeclass=<%=pigeclass%>&class=<%=docClass%>&Fromdepartment=<%=FromDepartment%>&page=<%=currentpage-1%>">上页</a>　　
		<%
	end if

	if currentpage+1<=totalpage then%>
		<a href="<%=Request.ServerVariables("SCRIPT_NAME")%>?pigeclass=<%=pigeclass%>&class=<%=docClass%>&Fromdepartment=<%=FromDepartment%>&page=<%=currentpage+1%>">下页</a>
		<%
	end if
end if
%>
</td></tr></table>
<div align=center>
<table border=0 width="95%" cellspacing="1" cellpadding=3 bgcolor="#005AB5">
<tr bgcolor=#eeFFFF align=center>
	<td width="6%">&nbsp;</td>
	<td width="10%">归档类别</td>
	<td width="10%">公文种类</td>
	<td>公文主题</td>
	<td width="10%">拟稿人</td>
	<td width="10%">归档人</td>
	<td width="20%">归挡时间</td>
</tr>
<%
if isempty(msgArr) then
	response.write "<tr bgcolor=#FFFFFF><td colspan=7>暂时没有内容。</td></tr>"
else
n=0
for i = 0 to UBound(msgArr,2)
	n=n+1
	if n mod 2 =0 then
		strColor="#E6F2FF"
	else
		strColor="#FFFFFF"
	end if
	if trim(msgarr(1,i))="1" then
		strOutin="发文"
		strFile="Doc_Detail.htm"
	elseif trim(msgarr(1,i))="2" then
		strOutin="收文"
		strFile="Doc_Detail2.htm"
	end if
	strTitle=trim(msgArr(4,i))
	if len(strTitle)>16 then
	strTitle=left(strTitle,14)&"..."
	end if
%>
	<tr bgcolor=<%=strColor%>>
		<td nowrap><%=strOutin%></td>
		<td><%=getTablevalue("tblDocPige","name","ID",trim(msgArr(3,i)))%></td>
		<td><%=getTablevalue("tblDocPige","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(5,i)))%></td>
		<td><%=getTablevalue("tblUser","name","ID",trim(msgArr(7,i)))%></td>
		<td nowrap><%=trim(msgArr(6,i))%></td>
	</tr>
<%
next
end if
%>

</table>
</div>
<BR><BR>
</BODY>
</HTML>
<%
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>