<!--#INCLUDE FILE="../HXINCLUDE/HXINCLUDEHEAD.ASP"-->
<%if WS_S.MemberPriv("WS_PublicAffairsCarModify")<>1 then HX_GoBack "对不起,您的权限不够!",""
ColumnName="":Tablename="HX_CarApply":Orderby=" order by WS_CAID desc":action=request("action")
if action="return" then
  WS_CAID=request("WS_CAID")
  if WS_CAID="" or isnull(WS_CAID) or (WS_CAID<>"" and not isnumeric(WS_CAID)) then	HX_GoBack "非法操作",""  
  conn.execute("delete from HX_CarReturn where WS_CMID="&conn.execute("select WS_MAID from HX_CarApply where WS_CAID="&WS_CAID)(0))
  conn.execute("update HX_CarMain set WS_CarState=0 where WS_MAID="&conn.execute("select WS_MAID from HX_CarApply where WS_CAID="&WS_CAID)(0))
  conn.execute("delete from HX_CarApply where WS_CAID="&WS_CAID)
  HX_GoBack "还车成功！","carmanage.asp"
end if
set rs=WS_S.HX_SetRSD(ColumnName,Tablename,Orderby)
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><tr bgcolor='#BF9B73' class='td4'><td width='15%' height='23'><div align='center'>申请者</div></td><td width='18%' height='23'><div align='center'>使用的车辆</div></td><td width='50%' height='23'><div align='center'>使用时间</div></td><td width='17%' height='23'><div align='center'>请审批</div></td></tr>"
if rs.recordcount<=0 then
      response.Write "<tr><td colspan=6 bgcolor=FFFBE8 height=25 align=center>暂无记录！</td></tr>"
else
    rs.PageSize =15 '每页记录条数
	iCount=rs.RecordCount '记录总数
	iPageSize=rs.PageSize
    	maxpage=rs.PageCount 
    	page=request("page")
    
    if Not IsNumeric(page) or page="" then
        page=1
    else
        page=cint(page)
    end if
    
    if page<1 then
        page=1
    elseif  page>maxpage then
        page=maxpage
    end if
    
    rs.AbsolutePage=Page

	if page=maxpage then
		x=iCount-(maxpage-1)*iPageSize
	else
		x=iPageSize
	end if
	ii=0
	do while not rs.EOF
   response.Write "<tr bgcolor='#FFFBE8' onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#FFFBE8'><td width='15%' height='23'><div align='center'>"
     Call WS_S.HX_OutUserInfo(rs("WS_CarApplyMan")):response.Write OutName&"</div></td><td width='18%' height='23'><div align='center'>"
        if rs("WS_MAID")=0 then 
	      response.Write "未指定车辆" 
        else
		  set Urs=WS_S.HX_SetRSD(ColumnName,"HX_CarMain"," where WS_MAID="&rs("WS_MAID"))
		  if urs.recordcount>0 then
		    response.Write urs("WS_CarName")
		  else
		   	response.Write "未指定车辆"
		  end if
		end if
   response.Write "</div></td><td width='50%' height='23'><div align='center'><font color='008000'>"&formatdatetime(rs("WS_CarFirstDate"),vbshortdate)&"&nbsp;"&formatdatetime(rs("WS_CarFirstDate"),vbshorttime)&" ～ "&formatdatetime(rs("WS_CarLastDate"),vbshortdate)&"&nbsp;"&formatdatetime(rs("WS_CarLastDate"),vbshorttime)&"</font></div></td><td width='17%' height='23'><div align='center'>"
  if rs("WS_CarSpsign")=0 then  response.Write "<a href='CarAudmit.asp?WS_CAID="&rs("WS_CAID")&"'>审批</a>" else  response.Write "<a href='?action=return&WS_CAID="&rs("WS_CAID")&"'>还车</a>"
   response.Write "</div></td></tr>"
  ii=ii+1
   if ii>=rs.PageSize then Exit Do
	  rs.movenext
      loop
      call WS_S.PageControl(iCount,maxpage,page,"border=0 align=right","<p align=right>",6)
end if
call WS_S.HX_RSClose(rs) 
response.Write "</table></td></tr></table>"%>