<!--#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
%>
<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="saveems.asp?action=add">
      <td height="98" bgcolor="#FFFFFF"> 
	  <table width="80%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
          <tr height="20" bgcolor="#FFFFFF" align="center"> 
           <tr height="20" bgcolor="#FFFFFF" align="center"> 
          <td width="15%">发货日期</td>
          <td width="15%">收货人</td>
          <td width="15%">发货方式</td>
          <td width="20%">发货单号</td>
          <td width="25%" >收货地址</td>
          <td width="10%" >操作</td>
        </tr>
          </tr>
          
          <tr height="20" bgcolor="#FFFFFF" align="center"> 
            <td><input name="date" type="text" id="date" size="16"></td>
            <td><input name="username" type="text" id="username" size="15"></td>
            <td><input name="deliverymethord" type="text" id="deliverymethord"  size="15"></td>
            <td><input name="emsnum" type="text" id="emsnum" size="20"></td>
            <td><input name="address" type="text" id="address"  size="26"></td>
            <td><input 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="90%" BORDER="0" ALIGN="center" CELLPADDING="2" CELLSPACING="2" class=table-zuoyou>
	<TR> 
          <td WIDTH="15%" class=table-youxia ALIGN="CENTER">发货日期 </td>
            <td WIDTH="15%" class=table-youxia ALIGN="CENTER">收货人</td>
            <td WIDTH="20%" class=table-youxia ALIGN="CENTER">发货方式 </td>
             <td WIDTH="20%" class=table-youxia ALIGN="CENTER">发货单号</td>
            <td WIDTH="30%" 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,date,username,deliverymethord,emsnum,address from ems order by emsid 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,"ems.asp"
       				else
          				if (currentPage-1)*MaxPerPage<totalPut then
            				rs.move  (currentPage-1)*MaxPerPage
            				dim bookbrand
            				bookbrand=rs.bookbrand
            				showContent
             				showpage totalput,MaxPerPage,"ems.asp"
        				else
	        				currentPage=1
           					showContent
           					showpage totalput,MaxPerPage,"ems.asp"
	      				end if
	   				end if
   				   				end if

   				sub showContent
       			dim i
	   			i=0

			%>
      <%do while not rs.eof%>
      <TABLE WIDTH="90%" BORDER="0" ALIGN="center" CELLPADDING="2" CELLSPACING="2" class=table-zuoyou>
	<tr height="20" bgcolor="#FFFFFF" align="center">
           <form name="form1" method="post" action="saveems.asp?action=edit&id=<%=rs("emsid")%>"> 
            <td><input name="date" type="text" id="date" size="16" value="<%=trim(rs("date"))%>"></td>
            <td><input name="username" type="text" id="username" size="15" value="<%=trim(rs("username"))%>"></td>
            <td><input name="deliverymethord" type="text" id="deliverymethord"  size="15" value="<%=trim(rs("deliverymethord"))%>"></td>
            <td><input name="emsnum" type="text" id="emsnum" size="20" value="<%=trim(rs("emsnum"))%>"></td>
            <td><input name="address" type="text" id="address"  size="26" value="<%=trim(rs("address"))%>"></td>
            <td><input type="submit" name="Submit" value="修 改">
                &nbsp;&nbsp;<a href=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 type='text' name='page' size=2 maxlength=10 class=smallInput value=<% = currentpage %>>
				页<input type='submit'  class='contents' value='跳转' name='cndok'></form>
				<%
				End Function  
			%>
    </TD>
  </TR>
</TABLE>
<br>

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