<!--#INCLUDE FILE="../HXINCLUDE/HXINCLUDEHEAD.ASP"-->
<%
ColumnName="":Tablename="HX_AttendanceOutEnrol":Tablename1="HX_AttendanceMan"
action=request("action")
Orderby=" where WS_AttendanceOutEnrolReplyID="&loginuid&" and WS_AttendanceOutEnrolDate=#"&date&"# and WS_AttendanceOutEnrolFlag<=2"
set rs=WS_S.HX_SetRSD(ColumnName,Tablename,Orderby)
select case action
  case "saveinfo"
  LEADER_ID=request("LEADER_ID")
  if not WS_S.HX_ISNUM(LEADER_ID) then HX_GoBack "请示领导不存在，请与管理员联系！",""
   conn.execute("insert into HX_AttendanceOutEnrol(WS_AttendanceOutEnrolTYPE,WS_AttendanceOutEnrolTime1,WS_AttendanceOutEnrolTime2,WS_AttendanceOutEnrolLEADERID,WS_AttendanceOutEnrolReplyID,WS_AttendanceOutEnrolDate) values('"&request("OUT_TYPE")&"',#"&request("OUT_TIME1")&"#,#"&request("OUT_TIME2")&"#,"&LEADER_ID&","&loginuid&",#"&date&"#)")
   Call WS_S.HX_OutUserInfo(loginuid)
   conn.execute("insert into HX_WebSMS(WS_Sendnmb,WS_recvnmb,WS_message,WS_SMSstype) values("&loginuid&","&LEADER_ID&",'"&OutName&"提交外出申请，请<a href=""../HXManpowerResource/AttendanceManageConfirm.asp"" target=""right"">批示</a>！','考勤批示')")
   WS_S.HX_Redirect "AttendanceOutEnrol.asp"
  case "del"
   conn.execute("delete * from "&Tablename&" where WS_AOID="&request("AOID")) 
   WS_S.HX_Redirect "AttendanceOutEnrol.asp"
  case "back"
   conn.execute("update HX_AttendanceOutEnrol set WS_AttendanceOutEnrolFlag=3")
   Call WS_S.HX_OutUserInfo(loginuid)
   conn.execute("insert into HX_WebSMS(WS_Sendnmb,WS_recvnmb,WS_message,WS_SMSstype) values("&loginuid&","&rs("WS_AttendanceOutEnrolLEADERID")&",'"&OutName&"外出已归来','考勤批示')")
   WS_S.HX_Redirect "AttendanceOutEnrol.asp"
end select
%>
<script>
function CheckForm()
{
   if(document.form1.OUT_TIME1.value=="" || document.form1.OUT_TIME2.value=="")
   { alert("外出起止时间不能为空！");
     return (false);
   }
   if(document.form1.OUT_TYPE.value=="")
   { alert("外出原因不能为空！");
     document.form1.OUT_TYPE.focus();
     return (false);
   }
  if(document.form1.LEADER_ID.value=="")
   { alert("请选择请示领导！");
     document.form1.LEADER_ID.focus();
     return (false);
   }
   return (true);
}
</script>
<%response.Write "<head><meta http-equiv='Content-Type' content='text/html; charset=gb2312'><title>今日外出登记</title><link rel=stylesheet type=text/css href='../HXinclude/HX_Style.css'><script src='../HXinclude/HX_Function.js'></script></head><body topmargin='20' leftmargin='0' bottommargin='0'><table width='582'  border='0' cellspacing='1' cellpadding='0' align=center bgcolor='#613c25'><tr><td colspan='2' bgcolor=FFFBE8 background='../hximages/titlelinebg.gif'><table width='580'  border='0' cellspacing='0' cellpadding='0'><tr><td height='25' background='../hximages/titleline.gif'><font class='fontmenu'>今日外出登记</font></td></tr></table><table width='100%'  border='0' cellspacing='1' cellpadding='5' bgcolor='#FFFBE8'>"
     if rs.recordcount<=0 then
      response.Write "<form action='?action=saveinfo'  method='post' name='form1' onsubmit='return CheckForm();'><tr><td height='20'> 因 <input type='text' name='OUT_TYPE' size='20' maxlength='50'> 由 <input type='text' name='OUT_TIME1' size='5' maxlength='5' value='"&hour(time)&":"&minute(time)&"'>  至 <input type='text' name='OUT_TIME2' size='5' maxlength='5' value='"&(hour(time)+1)&":"&minute(time)&"'> 向 "
		set ATRS=WS_S.HX_SetRSD(ColumnName,Tablename1,"")
		if ATRS.recordcount>0 then
		  response.Write "<select name='LEADER_ID'>"
		  do until ATRS.eof
		    Call WS_S.HX_OutUserInfo(ATRS("WS_AttendanceManID"))
		   response.Write "<option value='"&ATRS("WS_AttendanceManID")&"'>"&OutName&"</option>"
		  ATRS.movenext
		  loop
		   response.Write "</select>"
		 end if
		 response.Write " <input type='submit' value='申请外出' class='BigButton' title='申请外出'></td></tr></form>"
		else
		response.Write "<tr><td height='22' align='center'><div align='center' title='提示信息框'><span style='BACKGROUND:#EEEEEE;COLOR:#FF6633;margin: 10px;border:1px dotted #FF6633;font-weight:bold;padding:8px;width=350'>今日，因 <font color='#613c25'>"&rs("WS_AttendanceOutEnrolTYPE")&"</font> 由 <font color='#613c25'>"&rs("WS_AttendanceOutEnrolTime1")&"</font> 至 <font color='#613c25'>"&rs("WS_AttendanceOutEnrolTime2")&"</font> 向 <font color='#613c25'>"
        Call WS_S.HX_OutUserInfo(rs("WS_AttendanceOutEnrolLEADERID")):response.Write OutName&"</font> 申请外出，<font color='#613c25'>"&WS_S.HX_OutEnrolFlag(rs("WS_AttendanceOutEnrolFlag"))&"</font></span></div><br>"
        select case rs("WS_AttendanceOutEnrolFlag")
         case 0 response.Write "<input type='button' value='撤销申请' onclick=""location='?action=del&AOID="&rs("WS_AOID")&"'"" title='撤销申请'>"
         case 1 response.Write "<input type='button' value='外出归来' onclick=""location='?action=back&AOID="&rs("WS_AOID")&"'"" title='外出归来'>"
	     case 2 response.Write "<input type='button' value='删除申请' onclick=""location='?action=del&AOID="&rs("WS_AOID")&"'"" title='删除申请'>"
        end select
     response.Write "</td></tr>"
   end if
  response.Write "</table></td></tr></table>"
WS_S.HX_RSClose ATRS:WS_S.HX_RSClose rs%>