<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
option explicit
response.buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
const Dir=1
action=request("action")
%>
<!--#INCLUDE FILE="HX_CONNDATABASE.ASP"-->
<!--#INCLUDE FILE="HX_MD5.ASP"-->
<!--#INCLUDE FILE="HX_SETCOOKIE.ASP"-->
<head>
<title>添加审批人员</title>
<link rel=stylesheet type=text/css href="../HXinclude/HX_Style.css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body topmargin="10" leftmargin="0" bottommargin="10">
<table width="480"  border="0" cellspacing="1" cellpadding="0" align=center bgcolor="#613c25">
  <tr>
    <td colspan="2" bgcolor=FFFBE8><table width="480"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="25" background="../hximages/titleline.gif"><font class="fontmenu">选择审批人员</font></td>
  </tr>
</table>
<%
select case action
  case "del"
     WS_WTID=request("WS_WTID")
	 if WS_WTID="" or isnull(WS_WTID) or (WS_WTID<>"" and not isnumeric(WS_WTID)) then
 	   HX_GoBack "非法操作",""
    end if
	conn.execute("delete from HX_WorkFlowTemp where WS_WTID="&WS_WTID)
	 WS_S.HX_Redirect "submitcheckman.asp?action=saveinfo&WSOA=View"
  case "saveinfo"
  if request("WSOA")<>"View" then
    uid=request("uid")
   if uid="" or isnull(uid) then
 	WS_S.HX_Redirect "submitcheckman.asp" 
   end if
   Orderby=" where WS_WorkFlowTempUid="&loginuid&" ORDER BY WS_WorkFlowTempNumber DESC"
  else
   Orderby=" where WS_WorkFlowTempUid="&loginuid&" ORDER BY WS_WorkFlowTempNumber ASC"
  end if 
   ColumnName="":Tablename="HX_WorkFlowTemp"
   set rs=WS_S.HX_SetRSD(ColumnName,Tablename,Orderby)
 if request("WSOA")<>"View" then 
  if rs.recordcount>0 then
   Num=rs("WS_WorkFlowTempNumber")+1
  else
   Num=1
  end if
  uidarr=split(uid,"|")
   if uidarr(2)<>"" and isnumeric(uidarr(2)) then
    set trs=WS_S.HX_SetRSD(ColumnName,Tablename," where WS_WorkFlowTempUid="&loginuid&" and WS_WorkFlowTempDoManid="&uidarr(2))
     if trs.recordcount<=0 then
       rs.addnew
       rs("WS_WorkFlowTempUid")=loginuid
       rs("WS_WorkFlowTempNumber")=Num
       rs("WS_WorkFlowTempDoManid")=uidarr(2)
       rs("WS_WorkFlowTempAppointment")=uidarr(1)
       rs("WS_WorkFlowTempDepartment")=uidarr(0)
       rs.update
	   WS_S.HX_Redirect "submitcheckman.asp?action=saveinfo&WSOA=View"
     end if 
    end if
 end if   
%>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td bgcolor=FFFBE8><table width="100%" align="CENTER" cellspacing="1" cellpadding="0">
                                <tr align="center" bgcolor="#BF9B73"> 
                                  <td width="11%" height="25"><font color="#FFFBE8">序号</font></td>
                                  <td width="26%" height="25"><font color="#FFFBE8">批阅人员姓名</font></td>
                                  <td width="24%" height="25"><font color="#FFFBE8">所在部门</font></td>
                                  <td width="24%" height="25"><font color="#FFFBE8">职务</font></td>
								  <td width="15%" height="25"><font color="#FFFBE8">删除</font></td>
                                </tr>
                                <%
							if rs.recordcount<=0 then
								response.Write "<tr><td colspan=5 bgcolor=FFFBE8 height=25 align=center>暂无记录！</td></tr>"
							else
								do until rs.eof
								Call WS_S.HX_OutUserInfo(rs("WS_WorkFlowTempDoManid"))
								%> 
                                <tr align="center" bgcolor="FFFBE8" onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#FFFBE8'> 
                                  <td height="15" width="11%"><%=rs("WS_WorkFlowTempNumber")%></td>
                                  <td height="15" width="26%"><%=OutName%></td>
                                  <td height="15" width="24%"><%=OutAppointment%>&nbsp;</td>
                                  <td height="15" width="24%"><%=Outdepartment%></td>
								  <td width="15%" height="25"><a href="?action=del&WS_WTID=<%=rs("WS_WTID")%>">删除</a></td>
                              </tr>
                                <%
								rs.movenext
								loop	
							end if
								WS_S.HX_RSClose rs
								%>
								<tr align="center" bgcolor="#FFFBE8">
                                  <td height="25" colspan="5" align=right><a href="submitcheckman.asp">继续选择</a>&nbsp;&nbsp;<a href="#" onclick="javascript:window.opener.location.href='../HXWORKFLOW/WorkFlowAddPathList.asp?file=1';window.close();">确定</a>&nbsp;&nbsp;</td>
                                </tr>  
                              </table></td>
  </tr>
</table>
<%
  case else
%>
<table width="100%" cellspacing=1 cellpadding=2 align="center" bgcolor="#FFFBE8">
  <form action="?action=saveinfo" method="post" name="form1"><%
  set SERS=WS_S.HX_SetRSD("","HX_Department"," order by WS_OrderBy asc")
  if SERS.recordcount>0 then
  do until sers.eof
  %>
  <tr><td width="100%">
  <%=sers("WS_DepartmentName")%> 
  </td></tr>
  <%set APRS=WS_S.HX_SetRSD("","HX_Appointment"," where WS_Did="&sers("WS_Did")&" order by WS_OrderBy asc")
     if APRS.recordcount>0 then
	   do until APRS.eof
  %>

   <tr>
    <td>&nbsp;&nbsp;<font color="#FF0000"><%=APRS("WS_AppointmentName")%></font><%
	set URS=WS_S.HX_SetRSD("","HX_CompanyUser"," where WS_department="&sers("WS_Did")&" and WS_Appointment="&APRS("WS_Aid")&" and WS_leave=False and WS_Uid<>"&loginuid&" order by WS_Uid asc")
	if URS.recordcount>0 then
	  response.write "　　"
	  do until URS.eof
	   response.write "<input type=""radio"" name=""uid"" class=""radio"" value='"&sers("WS_Did")&"|"&APRS("WS_Aid")&"|"&urs("WS_Uid")&"|' id='WSOA"&urs("WS_Uid")&"'><label for='WSOA"&urs("WS_Uid")&"'><font color=blue>"&URS("WS_Name")&"</font></label>&nbsp;&nbsp;"
	  URS.movenext
	  loop
	end if
	%>	
	</td>
  </tr>
  <%    APRS.movenext
        loop
     end if
 %>
  <tr>
     <td height=3></td>
  </tr>
 <%
  sers.movenext
  loop
  end if
 %>
   <tr>
     <td height="25" align="right">	   
	   <input name="submit" type="submit" value=" 确 定 ">
	 <input name="submit" type="button" value="已选员工" onclick="location.href='submitcheckman.asp?action=saveinfo&WSOA=View';">
	 <input name="submit" type="button" value=" 关 闭 " onclick="javascript:window.close();">	 </td>
  </tr></form>
</table>
<%end select%>
</td>
  </tr>
</table>