<!--#INCLUDE FILE="../HXINCLUDE/HXINCLUDEHEAD.ASP"--><!--#INCLUDE FILE="../HXINCLUDE/SelectDate.asp"-->
<%if WS_S.MemberPriv("WS_PublicAffairsCarModify")<>1 then HX_GoBack "对不起,您的权限不够!",""
action=request("action"):ColumnName="":Tablename="HX_CarApply":Tablename1="HX_CarMain":WS_CAID=request("WS_CAID")
if WS_CAID="" or isnull(WS_CAID) or (WS_CAID<>"" and not isnumeric(WS_CAID)) then HX_GoBack "非法操作",""  
Orderby=" where WS_CAID="&WS_CAID
set rs=WS_S.HX_SetRSD(ColumnName,Tablename,Orderby)
if rs.recordcount<=0 then HX_GoBack "非法操作",""  
select case action
  case "saveinfo"
     WS_MAID=request("WS_MAID")
     rs("WS_CarFirstDate")=request("Date1")&" "&request("xx1")&":"&"00"&":"&"00"
     rs("WS_CarLastDate")=request("Date2")&" "&request("xx2")&":"&"59"&":"&"00"
	 if WS_MAID<>"" and isnumeric(WS_MAID) then
     rs("WS_MAID")=WS_MAID	 
	 end if
	 rs("WS_CarSpremark")=request("spremark")
	 rs("WS_CarSpsign")=1
     rs.update
	 conn.execute("insert into HX_MailChit(WS_MailObject,WS_MailToUid,WS_MailSendUid,WS_MailBody,WS_MailSendDate) values('车辆申请通知！',"&rs("WS_CarApplyMan")&","&LOGINUID&",'您使用车辆的申请已通过审批<br>审批意见："&request("spremark")&"　<br>使用车辆："&conn.execute("select WS_CarName from HX_CarMain where WS_MAID="&WS_MAID)(0)&"<br>使用时间："&rs("WS_CarFirstDate")&"-"&rs("WS_CarLastDate")&"',#"&now&"#)")
     conn.execute("update HX_CarMain set WS_CarState=1 where WS_MAID="&WS_MAID)
	 HX_GoBack "审批成功！","carmanage.asp"  
  case "cancle"
	 conn.execute("insert into HX_MailChit(WS_MailObject,WS_MailToUid,WS_MailSendUid,WS_MailBody,WS_MailSendDate) values('车辆申请通知！'"&rs("WS_CarApplyMan")&","&LOGINUID&",'您使用车辆的申请未通过审批,退回原因为：暂时没有空闲车辆！',#"&now&"#)")
     rs.delete
	 HX_GoBack "取消成功！","carmanage.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='596'  border='0' cellspacing='1' cellpadding='0' align=center bgcolor='#613c25'><tr><td colspan='2' bgcolor=FFFBE8><table width='100%'  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='3' bgcolor=FFFBE8><form name='form1' method='post' action='?action=saveinfo&WS_CAID="&WS_CAID&"'><tr bgcolor='#FFFBE8'><td width='12%'>前往地点</td><td width='20%'>"&rs("WS_cararea")&"</td><td width='14%'><div align='right'>使用人数</div></td><td width='54%'>"&rs("WS_carmannum")&"人</td></tr><tr bgcolor='#FFFBE8'><td>指定车辆</td><td colspan='3'>"
msg=True
	 set crs=WS_S.HX_SetRSD(ColumnName,Tablename1," where WS_CarState=0")	
	 if crs.recordcount<=0 then
	  response.write "<font color='red'>没有空闲车辆</font>"
	  msg=False
	 else
	  response.write "<select name='WS_MAID'>"
	  do until crs.eof
       response.write "<option value="&crs("WS_MAID")&">"&crs("WS_CarName")&"</option>"
	   crs.movenext
	   loop
	   response.write "</select>"
	   msg=True
	  end if
	  response.Write "</td></tr><tr bgcolor='#FFFBE8'><td>申 请 者</td><td colspan='3'>"
	  Call WS_S.HX_OutUserInfo(rs("WS_CarApplyMan")):response.write "<a href='javascript:' onclick=""openwin(700,550,'../HXManpowerResource/userinfolook.asp?WS_Uid="&rs("WS_CarApplyMan")&"');"">"&OutName&"</a></td></tr><tr bgcolor='#FFFBE8'><td width='12%'>简要描述</td><td colspan='3'>"&rs("WS_CarRemark")&"</td></tr><tr bgcolor='#FFFBE8'><td width='12%' height='27'>使用时间</td><td height='27' colspan='3'><input type='text' name='Date1' value='"&year(rs("WS_CarFirstDate"))&"-"&month(rs("WS_CarFirstDate"))&"-"&day(rs("WS_CarFirstDate"))&"' size=10 readonly> <input onclick=""popUpcalendar(this, form1.Date1, 'yyyy/mm/dd')"" type='button' value='选择' title='选择开始时间'> 日<select name='xx1' classname='5'  size='1' ><option value='0'>00</option>"
	  for i=1 to 23
	  response.Write "<option value='"&i&"'"
		if i=hour(rs("WS_CarFirstDate")) then response.Write " selected"
		response.Write">"
		if i<10 then response.Write "0"&i else response.Write i
		response.Write"</option>"
		next
		response.Write "</select>点 ～ <input type='text' name='Date2' value='"&year(rs("WS_CarLastDate"))&"-"&month(rs("WS_CarLastDate"))&"-"&day(rs("WS_CarLastDate"))&"' size=10 readonly> <input onclick=""popUpcalendar(this, form1.Date2, 'yyyy/mm/dd')"" type='button' value='选择' title='选择结束时间'> 日 <select name='xx2' classname='5'  size='1' ><option value='0'>00</option>"
		for i=1 to 23
		response.Write "<option value='"&i&"'"
		if i=hour(rs("WS_CarLastDate")) then response.Write " selected"
		response.Write ">"
		if i<10 then response.Write "0"&i else response.Write i
        response.Write "</option>"
		next
		response.Write "</select>点 </td></tr><tr bgcolor='#FFFBE8'><td width='12%' valign='top'>申请原因</td><td colspan='3' title='"&rs("WS_CarExcuse")&"'>"&rs("WS_CarExcuse")&"</td></tr><tr bgcolor='#FFFBE8'><td valign='top'>申请时间</td><td colspan='3'>"&rs("WS_CarApplyDate")&"</td></tr><tr bgcolor='#FFFBE8'><td width='12%' valign='top'>审批意见</td><td colspan='3'><textarea rows='8' name='spremark' cols='50' class='bgLine'></textarea></td></tr><tr bgcolor='#FFFBE8'><td valign='top'>&nbsp;</td><td colspan='3'><input type='submit' name='Submit' value=' 同 意 申 请 ' "
        if msg=False then response.write "disabled title='暂时还没有空闲车辆，所以无法审批！'"
		response.Write "> <input type='button' name='Submit' value=' 取 消 申 请 ' onclick=""javascript:location.href='?action=cancle&WS_CAID="&WS_CAID&"';""> <input name='WS_CAID' type='hidden' id='WS_CAID' value='"&WS_CAID&"'><font color=FF0000>取消无需填写审批意见</a></td></tr></form></table></td></tr></table>" 
%>