<!--#INCLUDE FILE="../HXINCLUDE/HXINCLUDEHEAD.ASP"--><!--#INCLUDE FILE="../HXINCLUDE/SelectDate.asp"-->
<%ColumnName="":Tablename="HX_AttendanceLeaveEnrol":Tablename1="HX_AttendanceMan"
action=request("action")
Orderby=" where WS_AttendanceLeaveEnrolReplyID="&loginuid&" order by WS_AttendanceLeaveEnrolDate asc"
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_AttendanceLeaveEnrol(WS_AttendanceLeaveEnrolTYPE,WS_AttendanceLeaveEnrolTime1,WS_AttendanceLeaveEnrolTime2,WS_AttendanceLeaveEnrolLEADERID,WS_AttendanceLeaveEnrolReplyID,WS_AttendanceLeaveEnrolDate) 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 "AttendanceLeaveEnrol.asp"
  case "del"
   conn.execute("delete * from "&Tablename&" where WS_ALID="&request("ALID")) 
   WS_S.HX_Redirect "AttendanceLeaveEnrol.asp"
  case "back"
   conn.execute("update HX_AttendanceLeaveEnrol set WS_AttendanceLeaveEnrolFlag=3  where WS_ALID="&request("ALID"))
   Call WS_S.HX_OutUserInfo(loginuid)
   conn.execute("insert into HX_WebSMS(WS_Sendnmb,WS_recvnmb,WS_message,WS_SMSstype) values("&loginuid&","&rs("WS_AttendanceLeaveEnrolLEADERID")&",'"&OutName&"请假已归来','考勤批示')")
   WS_S.HX_Redirect "AttendanceLeaveEnrol.asp"
end select
   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='0' bgcolor='#FFFBE8'><form action='?action=saveinfo'  method='post' name='form1' onsubmit='return CheckForm();'><tr><td height='67'><table width='100%'  border='0' cellspacing='1' cellpadding='4' bgcolor='#613c25'><tr><td bgcolor='#FFFBE8'>因 <input type='text' name='OUT_TYPE' size='50' maxlength='100'></td></tr><tr><td bgcolor='#FFFBE8'>由 <input type='text' name='OUT_TIME1' size='12' maxlength='10' value='"&date&"' readonly> <input name='button' type='button' title='选择开始时间' onClick=""popUpcalendar(this, form1.OUT_TIME1, 'yyyy/mm/dd')"" value='选择'> 至 <input type='text' name='OUT_TIME2' size='12' maxlength='10' value='"&date+1&"' readonly> <input name='button' type='button' title='选择开始时间' onClick=""popUpcalendar(this, form1.OUT_TIME2, 'yyyy/mm/dd')"" value='选择'></td></tr><tr><td bgcolor='#FFFBE8'>向 "
    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 name='submit' type='submit' class='BigButton' title='申请请假' value='申请请假'></td></tr></table></td></tr></form>"
	   if rs.recordcount<=0 then
	    response.Write "<tr><td height=22 align=center>暂无申请记录</td></tr>"
       else
       response.Write "<tr><td height='22' align='center'><br><table width='100%'  border='0' cellspacing='1' cellpadding='2' bgcolor='613c25'><tr bgcolor='#6C8DBE' class='td4'><td height='20' align='center'>请假原因</td><td align='center'>请示领导</td><td align='center'>开始时间</td><td align='center'>结束时间</td><td align='center'>状态</td><td align='center'>操作</td></tr>"
	   do until rs.eof
	   response.Write "<tr bgcolor='#FFFBE8'><td align='center'>"&rs("WS_AttendanceLeaveEnrolTYPE")&"</td><td align='center'>"
	   Call WS_S.HX_OutUserInfo(rs("WS_AttendanceLeaveEnrolLEADERID")):response.Write OutName&"</td><td align='center'>"&rs("WS_AttendanceLeaveEnrolTime1")&"</td><td align='center'>"&rs("WS_AttendanceLeaveEnrolTime2")&"</td><td align='center'>"
	   select case rs("WS_AttendanceLeaveEnrolFlag")
       case 0:response.Write "待批"
       case 1:response.Write "已批准"
	   case 2:response.Write "未批准"
	   case 3:response.Write "申请销假" 
  end select
  response.Write "</td><td align='center'>"
  select case rs("WS_AttendanceLeaveEnrolFlag")
       case 0:response.Write "<input type='button' value='删除' onclick=""location='?action=del&ALID="&rs("WS_ALID")&"'"" title='删除'>"
       case 1:response.Write "<input type='button' value='销假' onclick=""location='?action=back&ALID="&rs("WS_ALID")&"'"" title='销假'>"
	   case 2:response.Write "<input type='button' value='删除' onclick=""location='?action=del&ALID="&rs("WS_ALID")&"'"" title='删除'>"
	   case 3:response.Write "无"	 
  end select
  response.Write "</td></tr>"
   rs.movenext
  loop
  response.Write "</table></td></tr>"
  end if
  response.Write "</table></td></tr></table>"
  WS_S.HX_RSClose ATRS:WS_S.HX_RSClose rs%>
  <script language="javascript">
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>