<!--#include file="conn.asp"-->
<%
if session("admin")="" then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('请先登录！');location.href='index.asp' ;</script>"
response.End
else
if request.cookies("sundxshop")("admin")="" then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('请先登录！');location.href='index.asp' ;</script>"
response.End
end if
end if
goods=Trim(FormatSQL(SafeRequest("goods",0)))
if goods<>"" then
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from  orders where  goods='"&goods&"' ",conn,1,1
if rs.eof and rs.bof then
conn.close
set Conn = Nothing
response.write "<center>此订单中已有商品被管理员删除，无法处理，请手动删除此订单！ "
response.write "<input type=button name=Submit3 value=删除订单 onClick=""location.href='save.asp?action=del&dan="&goods&"&username="&username&"'""> </center>"
response.End
else
receipt=trim(rs("receipt"))
address=trim(rs("address"))
deliverymethordid=trim(rs("deliverymethord"))
end if
rs.close
set rs=nothing

set rs2=server.CreateObject("adodb.recordset")
    rs2.Open "select * from delivery where deliveryid="&deliverymethordid,conn,1,1
     if rs2.eof and rs2.bof then
		 
		  else
		 deliverymethord=trim(rs2("subject"))
          end if
    rs2.Close
          set rs2=nothing 
end if

%>
<title>发货清单管理</title>
<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" BGCOLOR="#39867B">
  <tr> 
    <td align="center"><font color="#FFFFFF">发货清单管理</font></td>
  </tr>
  <tr> 
    <form name="form2" method="post" action="admin_saveems.asp?action=add">
      <td height="98" bgcolor="#FFFFFF"> 
	  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#f1f1f1">
         
           <tr height="20" bgcolor="#FFFFFF" align="center">
           <td width="10%">订单号</td> 
          <td width="15%">发货日期</td>
          <td width="10%">收货人</td>
          <td width="12%">发货方式</td>
          <td width="10%">发货单号</td>
          <td width="15%" >收货地址</td>
           <td width="15%" >网址</td>
          <td width="10%" >操作</td>
        </tr>
        
          
          <tr height="20" bgcolor="#FFFFFF" >
            <td><input class=shopinput1 name="goods" type="text" id="goods" size="15" value="<%=goods%>"></td> 
            <td><select name="dvydateyear" id="dvydateyear">
                <option value="<%=year(now)%>"><%=year(now)%></option>
                <%dim i
for i=2007 to 2020
response.write "<option value="&i&">"&i&"</option>"
next
%>
              </select>
              年 
              <select name="dvydatemonth" id="dvydatemonth">
                <option value="<%= month(now)%>"><%= month(now)%></option>
                <option value="01">01</option>
                <option value="02">02</option>
                <option value="03">03</option>
                <option value="04">04</option>
                <option value="05">05</option>
                <option value="06">06</option>
                <option value="07">07</option>
                <option value="08">08</option>
                <option value="09">09</option>
                <option value="10">10</option>
                <option value="11">11</option>
                <option value="12">12</option>
              </select>
              月 <select name="dvydateday" id="dvydateday">
                 <option value="<%= day(now)%>"><%= day(now)%></option>
                <option value="01">01</option>
                <option value="02">02</option>
                <option value="03">03</option>
                <option value="04">04</option>
                <option value="05">05</option>
                <option value="06">06</option>
                <option value="07">07</option>
                <option value="08">08</option>
                <option value="09">09</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>
              日</td>
            <td><input class=shopinput1 name="username" type="text" id="username" size="10" value="<%=receipt%>"></td>
            <td><input class=shopinput1 name="deliverymethord" type="text" id="deliverymethord"  size="12" value="<%=deliverymethord%>"></td>
            <td><input class=shopinput1 name="emsnum" type="text" id="emsnum" size="15"></td>
            <td><input class=shopinput1 name="address" type="text" id="address"  size="20" value="<%=address%>"></td>
            <td><input class=shopinput1 name="emsurl" type="text" id="emsurl"  size="20"></td>
            <td><input class=shopinput1 type="submit" name="Submit2" value="添 加"></td>
          </form>
          </tr>
        </table></td>
    </form>
  </tr>
</table>
<TABLE WIDTH="98%" BORDER="0" CELLSPACING="0" CELLPADDING="0" ALIGN="CENTER" class=table-zuoyou>
 <TR><TD  VALIGN="TOP">
   <TABLE WIDTH="90%" BORDER="0" ALIGN="center" CELLPADDING="2" CELLSPACING="2" class=table-zuoyou>
	<TR> 
          <td  class=table-xia ALIGN="CENTER"><font color="blue"><b>发货清单</b></font> </td>
            
            
            
        </TR>	
        
      </TABLE>
   </td></tr>
  <TR><TD  VALIGN="TOP">
   <TABLE WIDTH="100%" BORDER="0" ALIGN="center" CELLPADDING="2" CELLSPACING="1"  bgcolor="#f1f1f1">
	<TR bgcolor="#FFFFFF"> 
          <td WIDTH="10%" class=table-youxia ALIGN="CENTER">发货日期 </td>
            <td WIDTH="10%" class=table-youxia ALIGN="CENTER">收货人</td>
            <td WIDTH="10%" class=table-youxia ALIGN="CENTER">发货方式 </td>
             <td WIDTH="12%" class=table-youxia ALIGN="CENTER">发货单号</td>
            <td WIDTH="25%" class=table-xia ALIGN="CENTER">收货人地址 </td>
             <td width="20%" class=table-xia ALIGN="CENTER">网址</td>
            <td WIDTH="13%" class=table-xia ALIGN="CENTER">操作 </td>
        </TR>	
        
      </TABLE>
   </td></tr>

<TR><TD HEIGHT="200" VALIGN="TOP">
      <%
				Const MaxPerPage=10
   				dim totalPut   
   				dim CurrentPage
   				dim TotalPages
   				dim j
   				dim sql
    			if Not isempty(SafeRequest("page",1)) then
      				currentPage=Cint(SafeRequest("page",1))
   				else
      				currentPage=1
   				end if 
		 set rs=server.CreateObject("adodb.recordset")
		  rs.open "select emsid,dvydate,username,deliverymethord,emsnum,address,emsurl from sdx_ems order by dvydate desc",conn,1,1
		  
				if err.number<>0 then
				response.write ""
				end if
				if rs.eof And rs.bof then
       				Response.Write "<p align='center'> 对不起，目前还没有货单！</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,"admin_ems.asp"
       				else
          				if (currentPage-1)*MaxPerPage<totalPut then
            				rs.move  (currentPage-1)*MaxPerPage
            				dim bookbrand
            				bookbrand=rs.bookbrand
            				showContent
             				showpage totalput,MaxPerPage,"admin_ems.asp"
        				else
	        				currentPage=1
           					showContent
           					showpage totalput,MaxPerPage,"admin_ems.asp"
	      				end if
	   				end if
   				   				end if

   				sub showContent
       			dim i
	   			i=0

			%>
      <%do while not rs.eof%>
      <TABLE WIDTH="100%" BORDER="0" ALIGN="center" CELLPADDING="2" CELLSPACING="1" bgcolor="#f1f1f1">
	<tr height="20" bgcolor="#FFFFFF" align="center">
           <form name="form1" method="post" action="admin_saveems.asp?action=edit&id=<%=rs("emsid")%>"> 
            <td WIDTH="10%"><input class=shopinput1 name="dvydate" type="text" id="dvydate" size="10" value="<% =rs("dvydate")%>"></td>
            <td WIDTH="10%"><input class=shopinput1 name="username" type="text" id="username" size="10" value="<%=trim(rs("username"))%>"></td>
            <td WIDTH="10%"><input class=shopinput1 name="deliverymethord" type="text" id="deliverymethord"  size="10" value="<%=trim(rs("deliverymethord"))%>"></td>
            <td WIDTH="12%"><input class=shopinput1 name="emsnum" type="text" id="emsnum" size="13" value="<%=trim(rs("emsnum"))%>"></td>
            <td WIDTH="25%"><input class=shopinput1 name="address" type="text" id="address"  size="30" value="<%=trim(rs("address"))%>"></td>
             <td WIDTH="20%"><input class=shopinput1 name="emsurl" type="text" id="emsurl"  size="22" value="<%=trim(rs("emsurl"))%>"></td>
            <td WIDTH="13%"><input class=shopinput1 type="submit" name="Submit" value="修 改">
                <a href=admin_saveems.asp?action=del&id=<%=trim(rs("emsid"))%>><font color="#930000">删除</font></a> 
              </td></form>
          </tr>
         
      </TABLE>
      
      <%i=i+1
			if i>=MaxPerPage then Exit Do
			rs.movenext
			loop
			rs.close
			set rs=nothing%>
      <%  
				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 %>
				<form method=Post action=<%=filename%>>
				<p align="center">
				<%
				If CurrentPage<2 Then  %>
				首 页 上一页
				<% Else  %>
				<a href=<% = filename %>?page=1>首 页</a>
				<a href=<% = filename %>?page=<% = CurrentPage-1 %>>上一页</a> 
				<% End If 
				If n-currentpage<1 Then  %>
				下一页 末 页
				<%  Else  %>
				<a href=<% = filename %>?page=<% = (CurrentPage+1) %>>下一页</a> 
				<a href=<% = filename %>?page=<% = n %>>末 页</a>
				<% End If  %>
				 第 <b><% = CurrentPage %></b> 页 共 <b><% = n %></b> 页
				共&nbsp;<b><% = totalnumber %></b>&nbsp;件商品　每页 <b><% = maxperpage %></b> 件商品
				转到第：<input class=shopinput1 type='text' name='page' size=2 maxlength=10 class=smallInput value=<% = currentpage %>>
				页<input class=shopinput1 type='submit'  class='contents' value='跳转' name='cndok'></form>
				<%
				End Function  
			%>
    </TD>
  </TR>
</TABLE>
<br>

<br>
<!--#include file="footer.asp"-->