<!--#INCLUDE FILE="../HXINCLUDE/HXINCLUDEHEAD.ASP"-->
<!--#INCLUDE FILE="../HXINCLUDE/SelectDate.asp"-->
<%
ColumnName="":Tablename="HX_AttendanceEvectionEnrol":Tablename1="HX_AttendanceMan"
action=request("action")
Orderby=" where WS_AttendanceEvectionEnrolReplyID="&loginuid&" order by WS_AttendanceEvectionEnrolDate 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_AttendanceEvectionEnrol(WS_AttendanceEvectionEnrolADDRESS,WS_AttendanceEvectionEnrolTime1,WS_AttendanceEvectionEnrolTime2,WS_AttendanceEvectionEnrolLEADERID,WS_AttendanceEvectionEnrolReplyID,WS_AttendanceEvectionEnrolDate,WS_AttendanceEvectionEnrolReason) values('"&request("OUT_ADDRESS")&"',#"&request("OUT_TIME1")&"#,#"&request("OUT_TIME2")&"#,"&LEADER_ID&","&loginuid&",#"&date&"#,'"&request("EnrolReason")&"')")
   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&"提交出差申请<br>******************************<br>出差地点："&request("OUT_ADDRESS")&"<br>出差事因："&request("EnrolReason")&"<br>******************************<br>请<a href=""../HXManpowerResource/AttendanceManageConfirm.asp"" target=""right"">批示</a>！','考勤批示')")
   WS_S.HX_Redirect "AttendanceEvectionEnrol.asp"
  case "del"
   conn.execute("delete * from "&Tablename&" where WS_AEID="&request("ALID")) 
   WS_S.HX_Redirect "AttendanceEvectionEnrol.asp"
  case "back"
   conn.execute("update HX_AttendanceEvectionEnrol set WS_AttendanceEvectionEnrolFlag=3 where WS_AEID="&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_AttendanceEvectionEnrolLEADERID")&",'"&OutName&"出差已归来','考勤批示')")
   WS_S.HX_Redirect "AttendanceEvectionEnrol.asp"
end select
%>
<script>
function CheckForm()
{if(document.form1.OUT_TIME1.value=="" || document.form1.OUT_TIME2.value=="")
   { alert("出差起止时间不能为空！");
     return (false);
   }
   if(document.form1.OUT_ADDRESS.value=="")
   { alert("出差地点不能为空！");
     document.form1.OUT_ADDRESS.focus();
     return (false);
   }   
     if(document.form1.EnrolReason.value=="")
   { alert("出差事因不能为空！");
     document.form1.EnrolReason.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><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 width='16%' bgcolor='#FFFBE8'>出差地点：</td><td width='84%' bgcolor='#FFFBE8'><input type='text' name='OUT_ADDRESS' size='50' maxlength='100'></td></tr><tr><td bgcolor='#FFFBE8'>出差时间：</td><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' valign='top'>出差事因          </td><td bgcolor='#FFFBE8'><textarea name='EnrolReason' cols='50' rows='10' class='bgline'></textarea></td></tr><tr><td bgcolor='#FFFBE8'>请示领导：</td><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 "</td></tr><tr><td bgcolor='#FFFBE8'>&nbsp;</td><td bgcolor='#FFFBE8'><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_AttendanceEvectionEnrolADDRESS")&"</td><td align='center'>"
	 Call WS_S.HX_OutUserInfo(rs("WS_AttendanceEvectionEnrolLEADERID")):response.Write OutName&"</td><td align='center'>"&rs("WS_AttendanceEvectionEnrolTime1")&"</td><td align='center'>"&rs("WS_AttendanceEvectionEnrolTime2")&"</td><td align='center'>"
     select case rs("WS_AttendanceEvectionEnrolFlag")
       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_AttendanceEvectionEnrolFlag")
       case 0:response.Write "<input type='button' value='删除' onclick=""location='?action=del&ALID="&rs("WS_AEID")&"'"" title='删除'>"
       case 1:response.Write "<input type='button' value='销假' onclick=""location='?action=back&ALID="&rs("WS_AEID")&"'"" title='销假'>"
	   case 2:response.Write "<input type='button' value='删除' onclick=""location='?action=del&ALID="&rs("WS_AEID")&"'"" 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%>