<!--#include file="../common/conn.asp"-->
<%
'检查用户权限
call checkuser(GetQueryString("WindowName"))

%>

<%
'从这开始读数据
oYear=GetVariable("year")
oMonth=GetVariable("month")
oDay=GetVariable("day")
strPageUrl=""			'下面取网页URL时用到
strWhere=""				'查询时用到

if oYear<>"" then
	strWhere = strWhere & " And year(o_create)="  & oYear
	strPageUrl=strPageUrl & "&year=" & oYear
end if 

if oMonth<>"" then
	strWhere = strWhere & " And month(o_create)="  & oMonth
	strPageUrl=strPageUrl & "&month=" & oMonth
end if 

if oDay<>"" then
	strWhere = strWhere & " And day(o_create)="  & oDay
	strPageUrl=strPageUrl & "&day=" & oDay
end if 

strSQL="Select * From web_product_order Where mn_id=" & GetVariable("mnid")  & strWhere & " Order By ID Desc"
'response.write strSQL
rs.open strSQL,conn,1,1
'分页显示初始化
page=GetVariable("page")
if page="" then
	page=1
else
	page=Cint(page)
end if

Section=GetVariable("section")
if Section="" then
	Section=1
else
	Section=Cint(Section)
end if
'变量赋值
intPageSize=14		'每页显示记录数
intSectionSize=5		'多少页为一段，像GOOGLE一样
PrevSectionText="<FONT face=webdings>7</FONT>"		'上一段的链接文字
NextSectionText="<FONT face=webdings>8</FONT>"		'下一段的链接文字
PrevPageText="<FONT face=webdings>3</FONT>"			'上页的链接文字	
NextPageText="<FONT face=webdings>4</FONT>"			'下页的链接文字

strPageUrl="?mnid=" & GetVariable("mnid") & "&WindowName=" & strPageUrl

rs.pagesize=intPageSize
intCount=rs.RecordCount 
intPageCount=rs.pagecount
intSectionCount=(intPageCount - 1) \ intSectionSize + 1
if intCount>0 then
	rs.AbsolutePage=page  
end if
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title><%=GetVariable("WindowName")%>订单管理</title>
<!-- no cache headers -->
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="no-cache">
<meta http-equiv="Expires" content="-1">
<meta http-equiv="Cache-Control" content="no-cache">
<!-- end no cache headers -->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<STYLE type="text/css">
A:link		{COLOR: #333333; TEXT-DECORATION: underline}
A:active	{COLOR: #FF0000;}
A:visited	{COLOR: #333333; TEXT-DECORATION: none}
A:hover		{COLOR: #FF0000;TEXT-DECORATION: underline}
td			{font-size:9pt;line-height:140%}
</STYLE>

</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr> 
    <td align="center">
        <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="366600">
        <tr> 
          <td colspan="8" bgcolor="669900"><font color="#FFFFFF"><strong><%=GetVariable("WindowName")%>订单管理</strong>
            总共[<%=intCount%>]份订单</font> </td>
        </tr>
        <tr> 
          <td colspan="8" align="center" bgcolor="#FFFFFF"> <table width="100%" cellpadding="3" cellspacing="0">
              <tbody>
                <tr> 
                  <form name="myform" method="post" action="?mnid=<%=GetVariable("mnid")%>&WindowName=<%=GetVariable("WindowName")%>">
                    <td bgcolor="#FFFFFF"><font color="#000000"> 　查询 
                      <select name="year" size="1" class="put" id="year">
                        <option value="<%=year(date)-1%>"><%=year(date)-1%></option>
                        <option value="<%=year(date)%>" selected><%=year(date)%></option>
                        <option value="<%=year(date)+1%>"><%=year(date)+1%></option>
                      </select>
                      年 
                      <select name="month" size="1" class="put" id="month">
                        <option value="" selected>全部</option>
                        <option value="1">1</option>
                        <option value="2">2</option>
                        <option value="3">3</option>
                        <option value="4">4</option>
                        <option value="5">5</option>
                        <option value="6">6</option>
                        <option value="7">7</option>
                        <option value="8">8</option>
                        <option value="9">9</option>
                        <option value="10">10</option>
                        <option value="11">11</option>
                        <option value="12">12</option>
                      </select>
                      月 
                      <select name="day" size="1" class="put" id="select2">
                        <option value="" selected>全部</option>
                        <option value="1">1</option>
                        <option value="2">2</option>
                        <option value="3">3</option>
                        <option value="4">4</option>
                        <option value="5">5</option>
                        <option value="6">6</option>
                        <option value="7">7</option>
                        <option value="8">8</option>
                        <option value="9">9</option>
                        <option value="10">10</option>
                        <option value="11">11</option>
                        <option value="12">12</option>
                        <option value="13">13</option>
                        <option value="14">14</option>
                        <option value="15">15</option>
                        <option value="16">16</option>
                        <option value="17">17</option>
                        <option value="18">18</option>
                        <option value="19">19</option>
                        <option value="20">20</option>
                        <option value="21">21</option>
                        <option value="22">22</option>
                        <option value="23">23</option>
                        <option value="24">24</option>
                        <option value="25">25</option>
                        <option value="26">26</option>
                        <option value="27">27</option>
                        <option value="28">28</option>
                        <option value="29">29</option>
                        <option value="30">30</option>
                        <option value="31">31</option>
                      </select>
                      日的订单 </font> <input type="submit" name="submit3" value="Go>>" class="put1"> 
                    </td>
                    <td align="center" width=50 bgcolor="#ffffff"> <a href="?mnid=<%=GetVariable("mnid")%>&WindowName=<%=GetVariable("WindowName")%>">全部订单</a> 
                    </td>
                  </form>
                </tr>
              </tbody>
            </table></td>
        </tr>
        <form name="mainform" method="POST" target="BackFrame">
          <tr bgcolor="#669900"> 
            <td width="14%" align="center"><strong><font color="#FFFFFF">时间</font></strong></td>
            <td width="9%" align="center" ><strong><font color="#FFFFFF">联系人</font></strong></td>
            <td width="12%" align="center"><strong><font color="#FFFFFF">联系电话</font></strong></td>
            <td width="24%" align="center"><strong><font color="#FFFFFF">详细地址</font></strong></td>
            <td width="17%" align="center"><strong><font color="#FFFFFF">订购说明</font></strong></td>
            <td  width="10%" align="center">&nbsp;</td>
          </tr>
          <!----------------主体部分开始------------------------------------->
          <%
 '循环输出
 if rs.recordcount<=0 then response.Write("<tr bgcolor=#f9f9f9><td colspan=9 align=center>对不起，没有符合条件的订单！</td></tr>")
 for i=1 to intPageSize
 	if rs.eof then exit for
	if i mod 2=0 then
		strColor="#eeeeee"
	else
		strColor="#f9f9f9"
	end if
 %>
          <tr bgcolor="<%=strColor%>"> 
            <td align="center" bgcolor="<%=strColor%>"><%=year(rs("o_create")) & "年" & month(rs("o_create")) & "月" & day(rs("o_create")) & "日"%></td>
            <td align="center"><%=trim(rs("o_user"))%></td>
            <td align="center" ><%=trim(rs("o_phote"))%></td>
            <td><%=trim(rs("o_addr"))%></td>
            <td><%=trim(rs("o_note"))%></td>
            <td align="center" bgcolor="<%=strColor%>"> 
              <a href="javascript:;" onClick="mywin=window.open('order_view.asp?id=<%=rs("ID")%>&mnid=<%=GetVariable("mnid")%>&WindowName=<%=GetVariable("WindowName")%>','orderview','width=580,height=340,scrollbars=yes,resizable=yes');mywin.focus()"><font color="#FF0000">详细内容</font></a> 
              <a href="order_dele.asp?id=<%=rs("ID")%>&mnid=<%=GetVariable("mnid")%>&WindowName=<%=GetVariable("WindowName")%>" target="BackFrame">删除</a> 
            </td>
          </tr>
          <%
 	 rs.movenext
  next
  %>
          <tr bgcolor="#669900"> 
            <td colspan="8" align="center"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr> 
                  <td align="right"> <font color="#FFFFFF">共有<font color="#FF0000"> 
                    <strong><%=intCount%></strong> </font>条记录，页次<%=Page%>/<%=intPageCount%>　 
                    <%
			'计算每一段的开始页
			intStarPage=(Section-2) * intSectionSize + 1
			'前一段
			if Section<=1 then
				response.Write(PrevSectionText & " ")
			else
				response.Write("<a href='" & strPageUrl & "&page=" & intStarPage & "&section=" & Section-1 & "'>" & PrevSectionText & "</a> ")
			end if 
			
			'显示页码列表
			response.Write("第")
			intStarPage=(Section-1) * intSectionSize + 1
		    for p=intStarPage to intStarPage + intSectionSize - 1
				if p > intPageCount then exit for
				if p=page then
		    		response.Write("<strong>[" & p & "]</strong> ")
				else
		    		response.Write("<a href='" & strPageUrl & "&page=" & p & "&section=" & Section & "'>[" & p & "]</a> ")
				end if	
		    next
			response.Write("页")
			'后一段
			intStarPage=(Section) * intSectionSize + 1
			if Section>=intSectionCount then
				response.Write(" " & NextSectionText)
			else
				response.Write(" <a href='" & strPageUrl & "&page=" & intStarPage & "&section=" & Section+1 & "'>" & NextSectionText & "</a> ")
			end if 
		  %>
                    <select name="page" size="1" onchange="window.location='<%=strPageUrl & "&section="%>' + (Math.floor((parseInt(this.value)-1)/<%=intSectionSize%>)+1) + '<%="&page="%>' + this.value">
                      <option value="<%=page%>" selected>第<%=page%>页</option>
                      <%
							for i=1 to rs.pagecount
					%>
                      <option value="<%=i%>" >第<%=i%>页</option>
                      <%
							next
					 %>
                    </select>
                    </font> 　 </td>
                </tr>
              </table></td>
          </tr>
        </form>
        <tr> 
          <td colspan="8" align="center" bgcolor="#FFFFFF"></td>
        </tr>
      </table>
     </td>
  </tr>
</table>
<iframe name="BackFrame" width="0" height="0" src="about:blank"></iframe>
</body>
</html>

