<!--#include file="../inc/Secure.htm"-->
<!--#include file="../inc/conn.htm"-->
<!--#include file="../inc/dbtools.htm"-->
<HTML>
<HEAD>
<TITLE>  </TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="../CSS/main.css">
</HEAD>
<%
ID=trim(request("ID"))
todo=trim(request("todo"))
if todo="delete" and id<>"" then
oConn.execute "delete tblCarOrder where ID="& id
end if
%>
<BODY BGCOLOR="#FFFFFF">
<div align=center>
<table border=1 cellpadding=3 cellspacing=0 width="90%" bgcolor=#EEEEEE bordercolordark="#FFFFFF" bordercolorlight="#999999"><tr><td>
<INPUT TYPE="button" name="cmdreturn" value="返  回" class="font9boldwhite" onclick="javascript:window.location.href='car_index.htm'">
</td></tr></table>

<%
Set Rs = Server.Createobject("Adodb.recordset")
sql="select * from tblCarOrder where StartTime>='"& date()&"' and EndTime>='"&now()&"' and OrderID="& LoginID &" order by ID desc"
rs.open sql,oConn
while not rs.eof
%>
<div align="center">
<table border=1 cellpadding=3 cellspacing=1 width="90%" bgcolor=#EEEEEE bordercolordark="#FFFFFF" bordercolorlight="#999999">
	<tr bgcolor=#CCCCCC><td colspan=4 align=center>
	<%=GetTableValue("tblCar","Name","ID",trim(rs("CarID")))%>
	<%if cdate(trim(rs("StartTime")))<=now() and cdate(trim(rs("EndTime")))>=now() then%>
		<font color=red><b><%=trim(rs("StartTime"))&"——"&trim(rs("EndTime"))%></b></font>
	<%else%>
		<b><%=trim(rs("StartTime"))&"——"&trim(rs("EndTime"))%></b>
	<%end if%>
	<a href="car_cancel.htm?todo=delete&ID=<%=trim(rs("ID"))%>" onclick="return CheckDelete();">-->取消该条预约</a>
	</td></tr>

	<tr>
	<td width="15%">使用部门:</td>
	<td width="35%">
	<%if trim(rs("Department"))<>"" then%>
	<%=GetTableValue("tblDepartment","Name","ID",trim(rs("Department")))%>
	<%end if%>
	&nbsp;</td>
	<td nowrap width="15%">使用人:</td>
	<td width="35%">
	<%if trim(rs("UserName"))<>"" then%>
	<%=trim(rs("UserName"))%>
	<%end if%>
	&nbsp;</td>
	</tr>

	<tr>
	<td width=60>预约人:</td>
	<td>
	<%if trim(rs("OrderName"))<>"" then%>
	<%=trim(rs("OrderName"))%>
	<%end if%>
	&nbsp;</td>
	<td nowrap width=60>填写时间:</td>
	<td>
	<%if trim(rs("OrderTime"))<>"" then%>
	<%=trim(rs("OrderTime"))%>
	<%end if%>
	&nbsp;</td>
	</tr>

	<tr>
	<td nowrap>用途:</td>
	<td>
	<%if trim(rs("Used"))<>"" then%>
	<%=trim(rs("Used"))%>
	<%end if%>
	&nbsp;</td>
	<td nowrap>行车路线:</td>
	<td>
	<%if trim(rs("Line"))<>"" then%>
	<%=trim(rs("Line"))%>
	<%end if%>
	&nbsp;</td>
	</tr>

	<tr>
	<td nowrap>司机:</td>
	<td>
	<%if trim(rs("Driver"))<>"" then%>
	<%=trim(rs("Driver"))%>
	<%end if%>
	&nbsp;</td>
	<td nowrap>详细说明：</td>
	<td><%=replace(replace(server.htmlencode(trim(rs("body"))&""),chr(13),"<br>")," ","&nbsp;")%>&nbsp;</td>
	</tr>
			
</table>
</div><BR>
</div>
<BR><BR>
</BODY>
</HTML>
<script language=javascript>
function CheckDelete()
{
	return confirm("确实删除吗？");
}
</script>
<!--#include file="../inc/conn_close.htm"-->
<%
Function GetTableValue(TableName,Field,ValueField,Value)
	if TableName<>"" and Value<>"" then
		Set RsTmp = Server.Createobject("Adodb.recordset")
		strSql = "Select "& Field &" from "& TableName &" where "& ValueField &"='"& Value &"'"
		Rstmp.open strSql,oConn,1,1
		If not Rstmp.eof then
			GetTableValue=trim(Rstmp(Field))
		else
			GetTableValue=""
		end if
		Rstmp.close
		'set RsTmp = Nothing
	else
		GetTableValue=""
	end if
End Function

Sub AddData()
	sql=" INSERT INTO tblCarOrder(OrderID,CarID,Department,OrderName,OrderTime,UserName,StartTime,EndTime,Line,Used,Driver) VALUES(" & OrderID & _
		","& CarId & _
		","& Department & _
		",'"& OrderName & _
		"','"& OrderTime & _
		"','"& UserName & _
		"','"& StartTime & _
		"','"& EndTime & _
		"','"& Line & _
		"','"& Used & _
		"','"& Driver & _
		"');"
	oConn.execute (sql)
end sub
%>