<!--#include file="conn.asp"-->
<%
if request.cookies("bjx")("shjianame")="" then
response.Redirect "../admin_login.asp"
response.End
end if
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from [shjia] where username='"&request.cookies("bjx")("shjianame")&"'" ,conn,1,1
if not(rs.bof and rs.eof) then
shjiaID=rs("shjiaID")
end if
%>

<html>
<head>
<title>订单管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../../images/css.css" rel="stylesheet" type="text/css">
</head>
<body text="#000000">
<table class="tableBorder" width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#D9E6FF">
  <tr>
    <td colspan="5" align="center" bgcolor="#D9E6FF">
<table width="100%" height="30" border="0" align="center" cellpadding="0" cellspacing="0" background="../../images/admin_bg_1.gif">
  <form name="form1" method="post" action="index.asp">
    <tr align="center" valign="top"> 
      <td width="40%" background="../../images/admin_bg_1.gif"> 
        <div align="center"><font color="#FFFFFF">单位名称、联系人 </font> 
          <input name="keywords" type="text" class="wenbenkuang" size="15">
          <input name="Submit2" type="submit" class="go-wenbenkuang" value="查找"> 
        </div></td>
      <td width="40%" background="../../images/admin_bg_1.gif"><font color="#FFFFFF">所定产品名称 
        </font> 
        <input name="keywords2" type="text" class="wenbenkuang" size="15"> 
        <font color="#FFFFFF"> </font> 
        <input name="Submit22" type="submit" class="go-wenbenkuang" value="查找"> 
      </td>
      <td width="20%" background="../../images/admin_bg_1.gif">&nbsp;</td>
    </tr></form>
</table>
  
<table width="100%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
  <tr  valign="middle" align="center"> 
    <td width="107" height="30" bgcolor="#D9E6FF"> <div align="center">订单ID</div></td>
    <td width="162" height="30" bgcolor="#D9E6FF"> <div align="center">产品名称</div></td>
    <td width="162" height="30" bgcolor="#D9E6FF">类型</td>
    <td width="162" height="30" bgcolor="#D9E6FF">拟购数量</td>
    <td width="225" height="30" bgcolor="#D9E6FF">订单状态</td>
    <td width="101" height="30" bgcolor="#D9E6FF">删除</td>
  </tr>
  <% set rs=server.createobject("adodb.recordset")
     keywords=request("keywords")
 keywords2=request("keywords2")
xs=request("xs")
if keywords<>"" then 
   sql="select * from tuangou where (danwei like '%"&keywords&"%' or forname like '%"&keywords&"%') and shjiaid="&shjiaID&" order by tgtime desc" 
else if keywords2<>"" then 
   sql="select * from tuangou where  bookname like '%"&keywords2&"%' and shjiaid="&shjiaID&"  order by tgtime desc"
   else 
   if xs<>"" then
   sql="select * from tuangou where "&xs&" and shjiaid="&shjiaID&"  order by tgtime desc "
   else 
   sql="select * from tuangou where shjiaid="&shjiaID&"  order by tgtime desc "
    end if
	end if 
	end if
	rs.open sql,conn,3,1
	if rs.eof then 
	  response.write "没有订单！"
	 end if 
 rs.pagesize = 20
if request("page")=""  or isempty(request("page")) then
page = 1
else
page=int(request("page"))
end if
if page>rs.pagecount then
page=rs.pagecount
end if
if not rs.BOF then
Rs.Move Rs.PageSize*(page-1)
end if
i=1
do while not rs.eof and i<=rs.pagesize
%>
  <tr bgcolor="#FFFFFF" valign="middle" align="center"> 
    <td width="107" bgcolor="#D9E6FF" > <a href="detailor.asp?id=<% =rs("tgid")%>"> 
      <% =rs("tgid")%>
      </a></td>
    <td width="162" bgcolor="#D9E6FF"> <div align="center"><a href="detailor.asp?id=<% =rs("tgid")%>">
      <% =rs("bookname")%>
    </a> 
      </div></td>
    <td width="162" bgcolor="#D9E6FF"><%if rs("rad")=1 then 
		   response.write "<font color=red>批发</color>"
		   else 
		    if rs("rad")=2 then
			response.write "集团采购" 
		     end if
		     end if %></td>
    <td width="162" bgcolor="#D9E6FF"><% =rs("shuliang")%></td>
    <td width="225" bgcolor="#D9E6FF">[       
      <%if rs("action")="0" then 
		   response.write "<font color=red>尚未处理</color>"
		   else 
		    if rs("action")="1" then 
			response.write "已发货"
		   else 
		    if rs("action")="2" then
			response.write "货已到" 
		   
		   
		      end if
		     end if
		     end if %>
      ]</td>      
    <td width="101" bgcolor="#D9E6FF"><a href="del.asp?tgid=<% =rs("tgid")%>">删除</a></td>
  </tr>
  <%
i=i+1
 rs.MoveNext                                              
 loop 
%>
  <tr bgcolor="#FFFFFF" valign="middle" align="center"> 
    <form name=form method=post action=?keywords=<%=request("keywords")%>&keywords2=<%=request("keywords2")%>&xs=<%=request("xs")%>>
      <td height="30" colspan="6" bgcolor="#D9E6FF" > 
        <%
if rs.recordcount<>0 then
if page-1 mod 10=0 then
		p=(page-1) \ 10
	else
		p=(page-1) \ 10
	end if

	response.write "页次："& page &"/"& rs.pagecount &"页 每页"& rs.pagesize &" 共"& rs.recordcount &"条记录"&_
					" 分页："

	if p*10>0 then response.write "<a href='?keywords="&keywords&"&keywords2="&keywords2&"&xs="&xs&"&page="&p*10&"' title=上十页>[&lt;&lt;]</a>   "
    uming_i=1
	for ii=p*10+1 to P*10+10
		   if ii=page then
	          response.write "<font color=#ff0000>["+Cstr(ii)+"]</font> "
		   else
		      response.write "<a href='?keywords="&keywords&"&keywords2="&keywords2&"&xs="&xs&"&page="&ii&"'>["+Cstr(ii)+"]</a>   "
		   end if
		if ii=rs.pagecount then exit for
		 uming_i=uming_i+1
	next
	if ii<=rs.pagecount and uming_i=11 then response.write "<a href='?keywords="&keywords&"&keywords2="&keywords2&"&xs="&xs&"&page="&ii&"' title=下十页>[&gt;&gt;]</a>   "
response.write(" 　跳页：<input type=text name=page size=2 maxlength=3 class=wenbenkuang> <input type=submit name=Submit value=Go class=go-wenbenkuang>")
end if%>
      </td></form>
  </tr>
</table>

<form name="form2" method="post" action="index.asp">
  <div align="center">&gt;&gt;自定义显示：       
    <input type="radio" name="xs" value="action=0">
    尚未处理      
    <input type="radio" name="xs" value="action=1">
    已发货       
    <input type="radio" name="xs" value="action=2">
    货已到       
    <input name="Submit" type="submit" class="go-wenbenkuang" value="显示">
  </div>
</form>
</td></tr></table>
</body>
</html>

