<!--#include file="../inc/Secure.htm"-->
<%dim ThisKey
ThisKey = "s"
%>
<!--#include file="../inc/permission.htm"-->
<!--#include file="../inc/conn.htm"-->
<!--#include file="../inc/dbtools.htm"-->
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="../CSS/main.css">
</HEAD>
<%
ID=request("selectID")
LoginID=session("LoginID")
CurrentStepTemp=getTablevalue("tblDocStep","ID","Name","分发")
if CurrentStepTemp="" then CurrentStepTemp=0

if request("cmdUp")<>"" then
	ID=trim(request("ID"))
	PigeClass=trim(Request("PigeClass"))
	PigeBody=rtrim(Request("Pigebody"))
	oConn.execute "update tblDoc set Pigeonhole=1,pigeClass="&PigeClass&",PigeBody='"&PigeBody&"',PigeTime='"&now()&"',PigeID="&LoginID&" where ID="& ID

	oConn.close
	set oConn=nothing
	response.write "<h2>公文已经归档完成，谢谢！</h2><BR>"
	response.write "<a href=Doc_pigeonhole.htm><img src='../images/return.gif' border=0></a>"
	response.end
	
end if

if ID<>"" and isnumeric(ID) then
set rs=server.createobject("adodb.recordset")
sql="select * from tblDoc where ID="& ID
rs.open sql,oConn
if not rs.eof then
	FromID=trim(rs("FromID"))
	CurrentID=trim(rs("CurrentID"))
	CheckIDs=trim(rs("CheckIDs"))
	CheckNames=trim(rs("CheckNames"))
	CheckStepIDs=trim(rs("CheckStepIDs"))
	CheckStepNames=trim(rs("CheckStepNames"))

	Outin=trim(rs("outin"))
	ClassID=trim(rs("Class"))
	PreID=trim(rs("PreID"))
	SecureClass=trim(rs("SecureClass"))
	JinjiClass=trim(rs("JinjiClass"))
	Title=trim(rs("Title"))
	Title2=trim(rs("Title2"))
	nOutin=trim(rs("Outin"))

	CurrentStep=trim(rs("CurrentStep"))
	body=rtrim(rs("body"))
	if nOutin="1" then
		strFile="Doc_look.htm"
	elseif nOutin="2" then
		strFile="Doc_look2.htm"
	end if
end if
end if


set rs=server.createobject("adodb.recordset")
sql="select * from tblDoc where pigeonhole=0 and CurrentID=0 and CurrentStep=0 order by ID desc"
rs.open sql,oConn
n=0
while not rs.eof
Outin=trim(rs("Outin"))
dispense=trim(rs("dispense"))
if Outin="1" then
	strOutin="发文"
elseif Outin="2" then
	strOutin="收文"
end if
if dispense="1" then
	strdispense="已分发"
elseif dispense="0" then
	strdispense="尚未分发"
end if

strTitle=trim(rs("Title"))
if len(strTitle)>14 then
strTitle=left(strTitle,14)&"..."
end if

if trim(rs("ID"))=ID then
str = str& "<option value="& trim(rs("ID")) &" selected>" & "["&strOutin&"]"& strTitle &" ("&year(trim(rs("CreateTimes")))&"-"&month(trim(rs("CreateTimes")))&"-"&day(trim(rs("CreateTimes"))) &")<BR>"
else
str = str& "<option value="& trim(rs("ID")) &">" &"["&strOutin&"]"& strTitle &" ("&year(trim(rs("CreateTimes")))&"-"&month(trim(rs("CreateTimes")))&"-"&day(trim(rs("CreateTimes"))) &")<BR>"
end if


rs.movenext
wend
rs.close
set rs=nothing
%>

<BODY BGCOLOR="#FFFFFF">
<img src="../images/t-gwgd.jpg" border=0>
<div align=center>
<table border=1 cellpadding=3 cellspacing=1 width="100%" bgcolor=#FFFFFF bordercolordark="#FFFFFF" bordercolorlight="#999999">
<tr>
	<td>请选择您要归档的公文（双击）</td>
	<td>所选公文信息</td>
</tr>
<tr>
	<td width="50%" valign=top>
	<form name="DocForm" method="post" action="">
	<select name="SelectIDList" multiple size="20" style="width:100%;" ondblClick="document.DocForm.SelectID.value=document.DocForm.SelectIDList[document.DocForm.SelectIDList.selectedIndex].value;document.DocForm.submit();">
	<%=str%>
	</select>
	<INPUT TYPE="hidden" name="SelectID" value="<%=ID%>">
	<INPUT TYPE="hidden" name="ID" value="<%=ID%>">
	</form>
	</td>

	<td width="50%" valign=top>
	<%if ID<>"" and isnumeric(id) AND ID<>"0" then%>
	<table border=1 cellpadding=1 cellspacing=1 width="100%" bgcolor=#FFFFFF bordercolordark="#FFFFFF" bordercolorlight="#999999">
	
	<tr>
		<td align=right width="22%">公文种类：</td>
		<td disabled><%=GetTableValue("tblDocClass","Name","ID",ClassID)&" ("&strdispense&")"%>&nbsp;</td>
	</tr>
	<tr>
		<td align=right>紧急程度：</td>
		<td disabled><%=GetJinjiClass(JinjiClass)%>&nbsp;</td>
	</tr>
	<tr>
		<td align=right>秘密等级：</td>
		<td disabled><%=GetSecureClass(SecureClass)%>&nbsp;</td>
	</tr>
	<tr>
		<td align=right>公文标题：</td>
		<td disabled><a href="<%=strFile%>?ID=<%=ID%>"><%=title%></a>&nbsp;</td>
	</tr>
	<tr>
		<td align=right>主题词：</td>
		<td disabled><a href="<%=strFile%>?ID=<%=ID%>"><%=title2%></a>&nbsp;</td>
	</tr>
	<tr>
		<td align=right>正文：</td>
		<td disabled>
		<%if trim(body)<>"" then
		if len(body)>80 then%>
		<%=replace(replace(server.htmlencode(left(body,80)&" ")," ","&nbsp;"),chr(13),"<BR>")&"......"%>
		<%else%>
		<%=replace(replace(server.htmlencode(body&" ")," ","&nbsp;"),chr(13),"<BR>")%>
		<%end if%>
	<%else%>
	&nbsp;
	<%end if%></td>
	</tr>
	
	<%
		FromName=getTableValue("tblUser","Name","ID",FromID)
		arrName=split(CheckNames,".")
		arrStep=split(CheckStepNames,",")	
		if not isempty(arrName) then
		str1=""
		for i=0 to ubound(arrName)
			str1=str1&"("&arrName(i)&")"&"<font color=red>["&arrStep(i)&"]</font>—>"
		next
		str1=str1&"<font color=red>(完成)</font>"
		end if
	%>
	<tr bgcolor=#EECC77>
		<td colspan=2 disabled><%=FromName&"<font color=red>[拟稿]</font>—>"&str1%></td>
	</tr>

	<%if ID<>"" and isnumeric(id) AND ID<>"0" then%>
		<form name="UserForm" method="post" action="">
		<tr><td colspan=2>
		<table border=0 width="100%">
		<tr><td>归档说明</td>
		<td><textarea cols=28 rows=3 name="pigeBody"></textarea></td>
		</tr>
		<tr><td>归档类别</td>
		<td><%options "PigeClass","tblDocPige","Name",0%>
		<INPUT TYPE="submit" name="cmdUp" value="确定" class="font9boldwhite" onclick="return CheckData();">
		</td>
		</tr>
		</table>
		<INPUT TYPE="hidden" name="ID" value="<%=ID%>">
		</form>
	<%end if%>

</table>
<%else%>
未选择...
<%end if%>
</td>	
</tr>
</table>
</div>

<BR><BR>
</BODY>
</HTML>

<script language=javascript>

function OpenWindow(url,windowname)
{
window.open(url,windowname,'left=100,top=50,height=350,width=650,toolbar=no,menubar=no,scrollbars=yes')
}

function CheckData()
{
	return confirm('确认归档吗？');
}
</script>
<script language="javascript" src="../inc/jtrim.js"></script>
<!--#include file="../inc/conn_close.htm"-->
<%
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
Private function GetJinjiClass(byval nClass)
select case trim(nClass)
	case "0"
	GetJinjiClass="未定义"
	case "1"
	GetJinjiClass="缓"
	case "2"
	GetJinjiClass="急"
	case "3"
	GetJinjiClass="加急"
	case else
	GetJinjiClass="未定义"
end select
end function

Private function GetSecureClass(byval nClass)
select case trim(nClass)
	case "0"
	GetSecureClass="未定义"
	case "1"
	GetSecureClass="普通"
	case "2"
	GetSecureClass="秘密"
	case "3"
	GetSecureClass="机密"
	case "4"
	GetSecureClass="绝密"
	case else
	GetSecureClass="未定义"
end select
end function
%>
