<!--#include file="conn.asp"-->
<!--#include file="ad_chk.asp"-->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href=inc/css.css rel=STYLESHEET type=text/css>
<body topmargin="5" leftmargin="5" rightmargin="5" bottommargin="5">
<%
if Request.Cookies("WrzcNet")("admin_class")<>0 and Request.Cookies("WrzcNet")("admin_class")<>2 then
response.write "你没有这个权限!"
response.end
end if
%>
<table border="0" cellpadding="2" cellspacing="0" id="table1"><form method="POST" action="ad_sub.asp">
<tr><td rowspan="2"><font color="#FF0000"><b>查询统计：</b></font></td>
		<td> 订单号：</td>
		<td>用户名：</td>
		<td> 开始日期：</td>
		<td> 结束日期：</td>
		<td>订单状态：</td><td rowspan="2"><input type="submit" value="确定" name="B1"></td></tr>
<tr><td> <input type="text" name="sub_number" size="12" class=input value="<%=request("sub_number")%>">　</td>
		<td><input type="text" name="user_name" size="12" class=input value="<%=request("user_name")%>"></td>
		<td> <input type="text" name="dataa" size="12" class=input value="<%if request("dataa")<>"" then%><%=request("dataa")%><%else%><%=year(now())%>-<%=month(now())-1%>-<%=day(now())%><%end if%>"></td>
		<td> <input type="text" name="datab" size="12" class=input value="<%if request("datab")<>"" then%><%=request("datab")%><%else%><%=year(now())%>-<%=month(now())%>-<%=day(now())+1%><%end if%>"></td>
		<td><select size="1" name="zt">
<option value="">全部订单</option>
<option value="1">未处理订单</option>
<option value="-1">等待客户付款</option>
<option value="2">已付款等待确认</option>
<option value="3">已确认收款</option>
<option value="4">已发货订单</option>
<option value="5">已收货订单</option>
<option value="0">无效订单</option>
</select></td></tr></form></table><pre></pre>
<%
  page=request("page")
  if page="" then page=1
  if not(isnumeric(page)) then page=1
  if page<1 then page=1
  page=int(page)
zt=request("zt")
sub_number=request("sub_number")
user_name=request("user_name")
dataa=request("dataa")
datab=request("datab")
if dataa="" then dataa="2000-1-1"
if datab="" then datab="2050-12-12"
if zt<>"" then sera=" and sub_zt=" & zt & ""
if user_name<>"" then serb=" and sub_name like '%" & user_name & "%'"
if sub_number<>"" then serc=" and sub_number like '%" & sub_number & "%'"
if dataa<>"" then serd=" and sub_date>=#" & dataa & "#"
if datab<>"" then sere=" and sub_date<=#" & datab & "#"
set rs=server.createobject("adodb.recordset")
sql="select * from WrzcNet_sub where 1=1 " &sera&serb&serc&serd&sere&" order by sub_id DESC"
rs.open sql,conn,1,1
if rs.eof then
response.write "暂且没有任何订单"
rs.close
set rs=nothing
else%>
<table border="0" cellpadding="5" cellspacing="0" class="st">
<tr><td class="sa">订单号</td><td class="sa">订单状态</td><td class="sa">用户名</td>
	<td class="sa">金额</td>
	<td class="sa">收货人</td>
	<td class="sa">地址</td><td class="sa">日期</td><td class="sa">订单合并</td></tr>
<%
rs.pagesize=20
totalrec=rs.recordcount
totalpage=rs.pagecount
if page>totalpage then page=totalpage
rs.absolutepage=page
i=0
do while not rs.eof and (i<rs.pagesize)
i=i+1%>
<tr><td class="s<%=i mod 2%>"><a href=ad_submore.asp?sub_id=<%=rs("sub_id")%>><%=rs("sub_number")%></a></td>
	<td class="s<%=i mod 2%>">
<%if rs("sub_zt")=0 then response.write "无效订单"%>
<%if rs("sub_zt")=1 then response.write "未处理"%>
<%if rs("sub_zt")=-1 then response.write "已处理等待客户付款"%>
<%if rs("sub_zt")=2 then response.write "已付款等待确认"%>
<%if rs("sub_zt")=3 then response.write "已确认收款"%>
<%if rs("sub_zt")=4 then response.write "已发货注意收货"%>
<%if rs("sub_zt")=5 then response.write "已收货（归档）"%></td>
<td class="s<%=i mod 2%>"><a href="<%=filename%>?user_name=<%=rs("sub_name")%>"><%=rs("sub_name")%></a>&nbsp;<img border="0" src="Img/ad_help.gif" class="helpimg" alt="点击用户名可以查看该用户所有订单"></td>
	<td class="s<%=i mod 2%>" style="font-size:12px;color:#f00;font-family:arial;"><%=rs("fuhao")%><%=FormatNum(subfee(rs("sub_number"))*rs("hui"))%><%=danwei%></td>
	<td class="s<%=i mod 2%>"><%=rs("sub_to")%></td>
	<td class="s<%=i mod 2%>"><%=rs("sub_adds")%></td>
<td class="s<%=i mod 2%>"><%=rs("sub_date")%></td>
<td class="s<%=i mod 2%>"><a href="ad_hebing.asp?sub_id=<%=rs("sub_id")%>&sub_number=<%=rs("sub_number")%>">订单合并</a></td></tr>
<%rs.movenext
loop
rs.close
set rs=nothing
i=i+1%>
<tr><td colspan="8" class="s<%=i mod 2%>">
	<input type="button" name="zong" value="销售汇总统计" onclick="javascript:window.open('ad_zong.asp?page=1<%if zt<>"" then%>&zt=<%=zt%><%end if%><%if sub_number<>"" then%>&sub_number=<%=sub_number%><%end if%><%if user_name<>"" then%>&user_name=<%=user_name%><%end if%><%if dataa<>"" then%>&dataa=<%=dataa%><%end if%><%if datab<>"" then%>&datab=<%=datab%><%end if%>','_self','')" ></td></tr>
</table>

<table border="0" cellpadding="2" cellspacing="0" width="100%">
<form action=<%=filename%>?1=1<%if zt<>"" then%>&zt=<%=zt%><%end if%><%if sub_number<>"" then%>&sub_number=<%=sub_number%><%end if%><%if user_name<>"" then%>&user_name=<%=user_name%><%end if%><%if dataa<>"" then%>&dataa=<%=dataa%><%end if%><%if datab<>"" then%>&datab=<%=datab%><%end if%> method=post>
<tr><td height="5">
<p style="line-height: 150%; margin: 5px">第<%=page%>页/共<%=totalpage%>页&nbsp;&nbsp;
<%if page-1>0 then%><a href="<%=filename%>?page=<%=page-1%><%if zt<>"" then%>&zt=<%=zt%><%end if%><%if sub_number<>"" then%>&sub_number=<%=sub_number%><%end if%><%if user_name<>"" then%>&user_name=<%=user_name%><%end if%><%if dataa<>"" then%>&dataa=<%=dataa%><%end if%><%if datab<>"" then%>&datab=<%=datab%><%end if%>">上一页</a><%else%>上一页<%end if%>&nbsp;&nbsp;
<%if page+1<=totalpage then%> <a href="<%=filename%>?page=<%=page+1%><%if zt<>"" then%>&zt=<%=zt%><%end if%><%if sub_number<>"" then%>&sub_number=<%=sub_number%><%end if%><%if user_name<>"" then%>&user_name=<%=user_name%><%end if%><%if dataa<>"" then%>&dataa=<%=dataa%><%end if%><%if datab<>"" then%>&datab=<%=datab%><%end if%>">下一页</a><%else%>下一页<%end if%>&nbsp;&nbsp;
页面跳转：<input type="text" name="page" value="<%=page+1%>" size="1" style="text-align: center" class=input><input type="submit" value="GO" class=input><br>
选择页数：<%for i=1 to totalpage
if i=page then%>
<font color="#FF0000"><b><%=i%></b></font>
<%else%>
<a href="?page=<%=i%><%if zt<>"" then%>&zt=<%=zt%><%end if%><%if sub_number<>"" then%>&sub_number=<%=sub_number%><%end if%><%if user_name<>"" then%>&user_name=<%=user_name%><%end if%><%if dataa<>"" then%>&dataa=<%=dataa%><%end if%><%if datab<>"" then%>&datab=<%=datab%><%end if%>"><%=i%></a> 
<%end if
next%></b>
</td></tr></form></table>
<%end if%>


<%
function subfee(sub_number)
set rs3=server.createobject("adodb.recordset")
rs3.open "select * from WrzcNet_sub where sub_number='"&sub_number&"'",conn,1,1
if not rs3.eof then
sub_yunfei=rs3("sub_yunfei")
sub_fapiao=rs3("sub_fapiao")
zhekou=rs3("sub_zhekou")
end if
rs3.close
set rs3=nothing
t3=0
set rs3=server.CreateObject("adodb.recordset")
rs3.open "select * from WrzcNet_basket where sub_number='"&sub_number&"'",conn,1,1
do while not rs3.eof
t3=t3+rs3("hw_price")*rs3("basket_count")
rs3.movenext
loop
rs3.close
set rs3=nothing
subfee=checkshui(t3*zhekou/100+sub_yunfei,shuidian,sub_fapiao)
end function
%><!--#include file="ad_bottom.asp"-->