<!--#include file="../include/hf_conn.asp"-->
<!--#include file="checkadmin.asp"-->
<script language=javascript src=../include/mouse_on_title.js></script>
<%call checkmanage("05")%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="manage.css" type="text/css">
</head>
<BODY background="../images/admin/back.gif">
<%
action=request("action")
if action="" then
%>
<table width="98%" border="1"  style="border-collapse: collapse; border-style: dotted; border-width: 0px"  bordercolor="#333333" cellspacing="0" cellpadding="2">
<form name=search action=order2.asp method=post>
<tr><td colspan=2 class=td height=18>搜索订单</td></tr>
<tr><td width=20% align=center>根据订单状态</td><td><select name='Status'>
	<option value=''>请选择订单状态</option>
<%
	set rs=conn.execute("select * from Order_type Order by Status asc")
	do while not rs.eof
	response.write "<option value='"&rs("Status")&"'>"&rs("StatusDefine")&"</option>"
	rs.movenext
	if rs.eof then exit do
	loop
	set rs=nothing
%>
</select></td></tr>

<tr><td width=20% align=center> 根据订单号
</td><td><input type=text name=ordernum size=25 maxlength=12></td></tr>

<tr><td width=20% align=center> 根据提交订单的会员ID
</td><td><input type=text name=userid size=25 maxlength=16></td></tr>
<td width=20% align=center>根据收货人姓名
</td><td><input type=text name=recname size=25 maxlength=20></td></tr>
<td width=20% align=center>根据电子邮箱
</td><td><input type=text name=RecMail size=25 maxlength=100></td></tr>
<td width=20% align=center>根据联系电话
</td><td><input type=text name=RecPhone size=25 maxlength=20></td></tr>
<td width=20% align=center>根据移动电话
</td><td><input type=text name=CompPhone size=25 maxlength=20></td></tr>
<td width=20% align=center>根据联系地址
</td><td><input type=text name=address size=25 maxlength=100></td></tr>
<td width=20% align=center>根据邮政编码
</td><td><input type=text name=ZipCode size=25 maxlength=8></td></tr>
<td width=20% align=center>根据提交订单时间
</td><td><input type="radio" name="ordertime" value="1">今天 &nbsp; <input type="radio" name="ordertime" value="2">昨天 &nbsp; <input type="radio" name="ordertime" value="7">一周内 &nbsp; <input type="radio" name="ordertime" value="30">一月内 &nbsp; <input type="radio" name="ordertime" value="">全部 &nbsp; </td></tr>
<tr><td colspan=2><INPUT name="action" TYPE="hidden" value="ok"><INPUT name=action TYPE="submit" value="开始搜索"></td></tr>
</table>
<br><font color=red>※提示：</font><br>支持模糊搜索，可根据一个或多个条件进行搜索，非搜索条件可空出。
<%
else
if trim(request("ordernum"))<>"" then
  if not isNumeric(trim(request("ordernum"))) then
	response.write "<script language='javascript'>"
	response.write "alert('出错了，订单号必须是数字！');"
	response.write "location.href='javascript:history.go(-1)';"
	response.write "</script>"
	response.end
  end if
end if
	ordersql=""
	if request("Status")<>"" then ordersql=ordersql+" and b.Status='"&request("Status")&"'"
	if trim(request("ordernum"))<>"" then ordersql=ordersql+" and a.ordernum like '%"&trim(request("ordernum"))&"%'"
	if trim(request("userID"))<>"" then ordersql=ordersql+" and a.userid like '%"&trim(request("userid"))&"%'"
	if trim(request("recname"))<>"" then ordersql=ordersql+" and a.recname like '%"&trim(request("recname"))&"%'"
	if trim(request("RecMail"))<>"" then ordersql=ordersql+" and a.RecMail like '%"&trim(request("usermail"))&"%'"
	if trim(request("address"))<>"" then ordersql=ordersql+" and a.address like '%"&trim(request("address"))&"%'"
	if trim(request("RecPhone"))<>"" then ordersql=ordersql+" and a.RecPhone like '%"&trim(request("RecPhone"))&"%'"
	if trim(request("CompPhone"))<>"" then ordersql=ordersql+" and a.CompPhone like '%"&trim(request("CompPhone"))&"%'"
	if trim(request("ZipCode"))<>"" then ordersql=ordersql+" and a.ZipCode like '%"&trim(request("ZipCode"))&"%'"

	if request("ordertime")="1" then  ordersql=ordersql+" and a.ordertime >= #"&date()&"#"
	if request("ordertime")="2" then  ordersql=ordersql+" and a.ordertime >= #"&date()-1&"# and ordertime < #"&date()&"#"
	if request("ordertime")="7" then  ordersql=ordersql+" and a.ordertime >= #"&date()-7&"#"
	if request("ordertime")="30" then  ordersql=ordersql+" and a.ordertime >= #"&date()-30&"#"

response.cookies("hfvip")("ordersql")=ordersql
if ordersql="" then
Response.Redirect("order2.asp")
else
Response.Redirect("order1.asp")
end if

end if
%>
</body>
</html>
