<!--#include file="conn.asp"-->
<!--#include file="../fuction.asp"-->
<!--#include file="adminset.asp"-->
<%if session("admin")="" then
response.Write "<script language='javascript'>alert('网络超时或您还没有登陆！');window.location.href='login.asp';</script>"
response.End
end if
if session("flag")>2 then
response.Write "<div align=center><font size=80 color=red><b>您没有此项目管理权限！</b></font></div>"
response.End
end if
if qx2<>1 then
response.Write "<div align=center><font size=80 color=red><b>您没有此项目管理权限！</b></font></div>"
response.End
end if
%>
<html>
<head>
<title>网软志成在线购物系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="../css.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
.STYLE3 {color: #000000}
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
}
-->
</style>
</head>

<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="1%" height="28">&nbsp;</td>
    <td width="99%"><table width="100%" border="0" cellspacing="0" cellpadding="5">
      <tr>
        <td width="77%" height="27" style="font-size:14px;color:#ffffff">&nbsp;<strong><font color="#000000">网软志成购物后台管理系统 &gt;&gt; 订单管理 &gt;&gt; 非会员作废订单管理</font></strong></td>
        <td width="23%" style="font-size:14px;color:#ffffff"><span class="STYLE1">* 为必添项目</span></td>
      </tr>
      <tr>
        <td height="20" colspan="2" style="font-size:12px;color:#ffffff"><span class="STYLE3">&nbsp;操作说明：点击订单号可进入具体订单明细，在明细中，可对具体订单进行过程修改，以及修改订单的运费、货款等信息！</span><br />
              </span></td>
      </tr>
    </table></td>
  </tr>
</table>
<%dim zhuangtai,namekey,dd,day1,day2
namekey=trim(request("namekey"))
zhuangtai=trim(request("zhuangtai"))
dd=trim(request("dd"))
if trim(request("year1"))<>"" then
  day1=trim(Request.Form("year1"))&"-"&trim(Request.Form("month1"))&"-"&trim(Request.Form("day1"))
  else
  day1=trim(request("day1"))
end if
 if trim(request("year2"))<>"" then
  day2=trim(Request.Form("year2"))&"-"&trim(Request.Form("month2"))&"-"&trim(Request.Form("day2"))
 else
  day2=trim(request("day2"))
 end if
if zhuangtai="" then zhuangtai=0
if namekey="" then namekey=request.querystring("namekey")
if dd="" then dd=request.querystring("dd")
%>
<br>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1">
  <tr>
    <td>
      <div align="right">    </div></td>
  </tr>
</table>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30"><span class="STYLE1">状态查询：
      <select name="select"  class="wenbenkuang" onChange="var jmpURL=this.options[this.selectedIndex].value ; if(jmpURL!='') {window.location=jmpURL;} else {this.selectedIndex=0 ;}" >
        <base target=Right>
        <option value="dingdan_fhy_feidan.asp?zhuangtai=0" selected>--款到发货--</option>
        <option value="dingdan_fhy_feidan.asp?zhuangtai=0" >全部订单状态</option>
        <option value="dingdan_fhy_feidan.asp?zhuangtai=1" >未作任何处理</option>
        <option value="dingdan_fhy_feidan.asp?zhuangtai=2" >订单已确认款未到</option>
        <option value="dingdan_fhy_feidan.asp?zhuangtai=3" >款已到，正在备货</option>
        <option value="dingdan_fhy_feidan.asp?zhuangtai=4" >货已发出</option>
        <option value="dingdan_fhy_feidan.asp?zhuangtai=5" >货已收到谢谢定购 </option>
      </select>
    </span></td>
  </tr>
</table>
<%'开始分页
				Const MaxPerPage=12 
   				dim totalPut   
   				dim CurrentPage
   				dim TotalPages
   				dim j
   				dim sql
    				if Not isempty(request("page")) then
      				currentPage=Cint(request("page"))
   				else
      				currentPage=1
   				end if 
	set rs=server.CreateObject("adodb.recordset")
	if namekey="" then
	'//按状态查询
	if zhuangtai=0  then
  rs.open "select distinct(dingdan),userid,username,userzhenshiname,actiondate,songhuofangshi,zhifufangshi,zhuangtai from shop_action_fhy where zhuangtai<6 and zt=2 order by actiondate desc",conn,1,1
  elseif zhuangtai=888 then
  rs.open "select distinct(dingdan),userid,username,userzhenshiname,actiondate,songhuofangshi,zhifufangshi,zhuangtai from shop_action_fhy  order by actiondate desc",conn,1,1
  else
  rs.open "select distinct(dingdan),userid,username,userzhenshiname,actiondate,songhuofangshi,zhifufangshi,zhuangtai from shop_action_fhy where  zhuangtai="&zhuangtai&" and zt=2 order by actiondate",conn,1,1
  end if
  else
  '//按用户查询
  if zhuangtai=9 then
            if dd=1 then
                rs.open "select distinct(dingdan),userid,username,userzhenshiname,actiondate,songhuofangshi,zhifufangshi,zhuangtai,new from shop_action_fhy where username='"&namekey&"' and zt=2 order by actiondate",conn,1,1
            elseif dd=2 then
                rs.open "select distinct(dingdan),userid,username,userzhenshiname,actiondate,songhuofangshi,zhifufangshi,zhuangtai,qlr,new from shop_action_fhy where qlr='"&namekey&"' and zt=2  order by actiondate",conn,1,1
            elseif dd=5 then
                rs.open "select distinct(dingdan),userid,username,userzhenshiname,actiondate,songhuofangshi,zhifufangshi,zhuangtai,new from shop_action_fhy where dingdan='"&namekey&"' and zt=2  order by actiondate",conn,1,1
            else
                rs.open "select distinct(dingdan),userid,username,userzhenshiname,shouhuoname,actiondate,songhuofangshi,zhifufangshi,zhuangtai,new from shop_action_fhy where shouhuoname='"&namekey&"' and zt=2  order by actiondate",conn,1,1
            end if
        end if
  end if
		  
				if err.number<>0 then
				response.write "数据库中无数据"
				end if
				
  				if rs.eof And rs.bof then
       				Response.Write "<p align='center' class='contents'> 对不起，您选择的状态目前还没有订单！</p>"
   				else
	  				totalPut=rs.recordcount

      				if currentpage<1 then
          				currentpage=1
      				end if

      				if (currentpage-1)*MaxPerPage>totalput then
	   					if (totalPut mod MaxPerPage)=0 then
	     					currentpage= totalPut \ MaxPerPage
	   					else
	      					currentpage= totalPut \ MaxPerPage + 1
	   					end if
      				end if

       				if currentPage=1 then
            			showContent
            			showpage totalput,MaxPerPage,"dingdan_fhy_feidan.asp"
       				else
          				if (currentPage-1)*MaxPerPage<totalPut then
            				rs.move  (currentPage-1)*MaxPerPage
            				dim bookmark
            				bookmark=rs.bookmark
            				showContent
             				showpage totalput,MaxPerPage,"dingdan_fhy_feidan.asp"
        				else
	        				currentPage=1
           					showContent
           					showpage totalput,MaxPerPage,"dingdan_fhy_feidan.asp"
	      				end if
	   				end if
   				   				end if

   				sub showContent
       			dim i
	   			i=0

			%><form name="form1" method="post" action="dingdan_del.asp?action=fhy2" onSubmit="return ck1()">
			<script language="javascript">
			function  ck1(){
if(form1.id){
var b = document.getElementsByTagName("input");
var ok="no"							
for (var i=0; i<b.length; i++){							
if (b[i].type == "checkbox" && b[i].name == "id" &&b[i].checked){ok="ok"}}	
if(ok!="ok"){
alert("您没有选删除的目标")
return false}}
else{
alert("您没有选删除的目标")
return false}}
</script>
<table width="95%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#999999">
  <tr bgcolor="#cccccc"><td><div align="center">删除</div></td>
    <td height="22">
    <div align="center">订单号</div></td>
    <td height="22">
    <div align="center">下单用户</div></td>
    <td height="22">
    <div align="center">订货人姓名</div></td>
    <td height="22">
    <div align="center">付款方式</div></td>
    <td height="22">
    <div align="center">收货方式</div></td>
    <td height="22">
    <div align="center">订单状态</div></td>
  </tr>
  <%do while not rs.eof
		dim snsn,username
		  'set snsn=server.CreateObject("adodb.recordset")
		  'snsn.open "select username from [shop_user] where userid="&rs("userid"),conn,1,1
		  username=trim(rs("username"))
		  'snsn.close
		  'set snsn=nothing
		  %>
  <tr bgcolor="#F3F3F3">
      <td height="22"><div align="center">
        <%if rs("dingdan")<>"" then
		ddid=conn.execute("Select actionid From shop_action_fhy where dingdan='"&rs("dingdan")&"'")
 actionid=ddid(0)
 end if
%><input name="id" type="checkbox" id="id" value="<%=actionid%>">
</div></td>
    <td height="22">
    <div align="center"><a href="javascript:;" onClick="javascript:window.open('dingdan_fhy_edit.asp?dan=<%=trim(rs("dingdan"))%>&username=<%=username%>','','width=710,height=388,toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes');return false;"><%=trim(rs("dingdan"))%></a></div></td>
    <td height="22">
    <div align="center"><%=username%></div></td>
    <td height="22">
    <div align="center"><%=trim(rs("userzhenshiname"))%></div></td>
    <td height="22">
    <div align="center"> <span class="table-xiayou">
      <%set rs2=server.CreateObject("adodb.recordset")
	  if isnull(rs("zhifufangshi")) then
      response.write "方式不存在"
	  else
	  if rs("zhifufangshi")="" then
            zhifufangshi=99999
        else
            zhifufangshi=rs("zhifufangshi")
        end if	
    rs2.Open "select * from shop_songhuo where songid="&zhifufangshi&"",conn,1,1
	if rs2.eof then
		response.write "方式不存在"
	else
	    response.Write trim(rs2("subject"))
    end if
    rs2.close
    set rs2=nothing
	end if%>
    </span></div></td>
    <td height="22">
    <div align="center"> <span class="table-xiayou">
      <%			  if isnull(rs("songhuofangshi")) then
		response.write "方式不存在"
else
if rs("songhuofangshi")="" then
            songhuofangshi=99999
        else
            songhuofangshi=rs("songhuofangshi")
        end if	
	  set rs2=server.CreateObject("adodb.recordset")
    rs2.Open "select * from shop_sys where songid="&songhuofangshi&"",conn,1,1
	if rs2.eof then
		response.write "方式不存在"
	else
    response.Write trim(rs2("fsh"))
end if
    rs2.Close
    set rs2=nothing
	end if%>
    </span></div></td>
    <td height="22">
      <div align="center">
        <%
		  select case rs("zhuangtai")
	case "1"
	response.write "未作任何处理"
	case "2"
	if rs("zhifufangshi")="货到付款" then
	response.write "订单已确认，正在备货"
	else
	response.write "订单已确认，款未到"
    end if
	case "3"
	if rs("zhifufangshi")="货到付款" then
	response.write "货已发出"
	else
	response.write "款已到，正在备货"
    end if
	case "4"
	if rs("zhifufangshi")="货到付款" then
	response.write "货已收到，款结清，谢谢您的定购"
	else
	response.write "货已发出"
    end if
	case "5"
	response.write "货已收到，款结清，谢谢您的定购"
	end select%>
    </div></td>
  </tr>
  <%i=i+1
			if i>=MaxPerPage then Exit Do
			rs.movenext
		loop
		rs.close
		set rs=nothing%>
		<tr bgcolor="#F3F3F3">
    <td colspan="7">
      <div align="right"> 全选
          <input type="checkbox" name="checkbox" value="Check All" onClick="mm()">
          <input type="submit" name="Submit" class="go-wenbenkuang" value="删 除" onClick="return test();">
&nbsp;&nbsp; </div></td>
  </tr>
</table></form>
<%  
				End Sub   
  
				Function showpage(totalnumber,maxperpage,filename)  
  				Dim n
  				
				If totalnumber Mod maxperpage=0 Then  
					n= totalnumber \ maxperpage  
				Else
					n= totalnumber \ maxperpage+1  
				End If
				'//////////////////
				if namekey="" then
				 if day1="" then
				Response.Write "<form method=Post action="&filename&"?zhuangtai="&zhuangtai&"&lx="&lx&"&dd="&dd&">" 
				 else
				Response.Write "<form method=Post action="&filename&"?zhuangtai="&zhuangtai&"&lx="&lx&"&dd="&dd&"&day1="&day1&"&day2="&day2&">" 
				  end if
				else
				Response.Write "<form method=Post action="&filename&"?zhuangtai="&zhuangtai&"&namekey="&namekey&"&lx="&lx&"&dd="&dd&">" 
				end if
				'//////////////////
				Response.Write "<p align='center' class='contents'> "  
				If CurrentPage<2 Then  
					Response.Write "<font class='contents'>首页 上一页</font> "  
				Else  
					'///////////////////
					if namekey="" then
					if day1="" then
					Response.Write "<a href="&filename&"?page=1&zhuangtai="&zhuangtai&"&lx="&lx&"&dd="&dd&" class='contents'>首页</a> "  
					Response.Write "<a href="&filename&"?page="&CurrentPage-1&"&zhuangtai="&zhuangtai&"&lx="&lx&"&dd="&dd&" class='contents'>上一页</a> "  
					else
					Response.Write "<a href="&filename&"?page=1&zhuangtai="&zhuangtai&"&lx="&lx&"&dd="&dd&"&day1="&day1&"&day2="&day2&" class='contents'>首页</a> "  
					Response.Write "<a href="&filename&"?page="&CurrentPage-1&"&zhuangtai="&zhuangtai&"&lx="&lx&"&dd="&dd&"&day1="&day1&"&day2="&day2&" class='contents'>上一页</a> "  
					end if
					ELSE
					Response.Write "<a href="&filename&"?page=1&zhuangtai="&zhuangtai&"&namekey="&namekey&"&lx="&lx&"&dd="&dd&" class='contents'>首页</a> "  
					Response.Write "<a href="&filename&"?page="&CurrentPage-1&"&zhuangtai="&zhuangtai&"&namekey="&namekey&"&lx="&lx&"&dd="&dd&" class='contents'>上一页</a> "
					end if  
					'//////////////////
				End If
				
				If n-currentpage<1 Then  
					Response.Write "<font class='contents'>下一页 尾页</font>"  
				Else 
				'//////////////////////// 
				if namekey="" then
				  if day1="" then
					Response.Write "<a href="&filename&"?page="&(CurrentPage+1)&"&zhuangtai="&zhuangtai&"&lx="&lx&"&dd="&dd&" class='contents'>"  
					Response.Write "下一页</a> <a href="&filename&"?page="&n&"&zhuangtai="&zhuangtai&"&lx="&lx&"&dd="&dd&" class='contents'>尾页</a>"
					else 
					
					Response.Write "<a href="&filename&"?page="&(CurrentPage+1)&"&zhuangtai="&zhuangtai&"&lx="&lx&"&dd="&dd&"&day1="&day1&"&day2="&day2&" class='contents'>"  
					Response.Write "下一页</a> <a href="&filename&"?page="&n&"&zhuangtai="&zhuangtai&"&lx="&lx&"&dd="&dd&"&day1="&day1&"&day2="&day2&" class='contents'>尾页</a>"
					end if
					else
					Response.Write "<a href="&filename&"?page="&(CurrentPage+1)&"&zhuangtai="&zhuangtai&"&namekey="&namekey&"&lx="&lx&"&dd="&dd&" class='contents'>"  
					Response.Write "下一页</a> <a href="&filename&"?page="&n&"&zhuangtai="&zhuangtai&"&namekey="&namekey&"&lx="&lx&"&dd="&dd&" class='contents'>尾页</a>" 
					end if 
					'/////////////////////
				End If  
					Response.Write "<font class='contents'> 页次：</font><font class='contents'>"&CurrentPage&"</font><font class='contents'>/"&n&"页</font> "  
					Response.Write "<font class='contents'> 共有"&totalnumber&"笔订单 "&maxperpage&"笔订单/页</font> " 
					Response.Write "<font class='contents'>转到：</font><input type='text' name='page' size=4 maxlength=10 class=wenbenkuang value="&currentpage&">"  
					Response.Write "&nbsp;<input type='submit'  class='go-wenbenkuang' value='GO' name='cndok'></form>"  
				End Function  
			%>
<br>
<table width="95%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#999999">
  <tr>
    <form name="form2" method="post" action="dingdan_fhy_feidan.asp?zhuangtai=9">
      <td bgcolor="#F3F3F3">
        <div align="center">
          <input type="radio" name="dd" value="1">
          下单用户
          <input type="radio" name="dd" value="2">
          最后处理人
          <input type="radio" name="dd" value="5">
          订单号
          <input type="radio" name="dd" value="6">
          收货人
          <input name="namekey" type="text"  class="wenbenkuang" id="namekey2" value="请输入关键字" size="14" onFocus="this.value=''">
 
          <input type="submit" name="Submit" value="查询"  class="go-wenbenkuang">
      </div></td>
    </form>
  </tr>
</table>
<br>
<!--#include file="copyright.asp"-->
</body>
</html>
<script>
function test()
{
  if(!confirm('确认删除吗？')) return false;
}
</script>
<script language=javascript>
function mm()
{
   var a = document.getElementsByTagName("input");
   if(form1.checkbox.checked==false){
   for (var i=0; i<a.length; i++)
      if (a[i].type == "checkbox") a[i].checked = false;
   }
   else
   {
   for (var i=0; i<a.length; i++)
      if (a[i].type == "checkbox") a[i].checked = true;
   }
}
</script>