<%
'商易仿淘宝4.0(多用户)
'ACCESS版演示网站：http://www.ftaobao.com(商易仿淘宝商城)
'SQL版演示网站：http://sql.ftaobao.com
'电话：0571-56907100
'QQ：1147100
%>
<!--#include file="top.asp"-->
<!--#include file="../include/page.asp"-->
<table width="762" border="0" align="center" cellpadding="2" cellspacing="0" style='BORDER-COLLAPSE: collapse;MARGIN: 3px'>
  <tr> 
    <td height="15" colspan="2"></td>
  </tr>
  <tr> 
    <td width="180" valign="top">
<!--#include file="left.asp"-->
    </td>
<td width="582" height="280" valign="middle">
<%Select case request("abc")
case "add2"%>
<div align="center"> 
  <p><br>
          <a href="?">&gt;&gt;返回送货清单主页面</a>&nbsp;&nbsp;<br>
  </p>
</div>
<table width="96%" border="0" cellpadding="0" cellspacing="0" align="center">
  <tr> 
    <td height="207" valign="top" width="10%"> <form name="ffm" method="POST" action=?abc=add2>
        <table bgcolor=#CCCCCC border=0 cellpadding=3 cellspacing=1 
        width="350" align="center" class="9bang">
          <tbody>
            <tr bgcolor="#f1f1f1"> 
              <td class="008c5e">&gt;&gt;新增送货信息<br>
                (只需输入订单号即可，如果是电话订单请选中<font color="#FF3333">电话</font>后的选框)</td>
            </tr>
            <tr> 
              <td height="18" bgcolor=#FFFFFF class="008c5e"> <div align="center"> 
                  订单号<font color="#FF0000"><b> 
                  <input name="id" type="hidden" id="id" value="<%=Request("id")%>">
                  </b></font> 
                  <input name="bh" type="text" class="wenbenkuang" id="bh" size="15" maxlength="14">
                  <font color="#FF3333">电话</font> 
                  <input name="lx" type="checkbox" id="lx" value="1">
                  <input name="Submit" type="submit" class="go-wenbenkuang" value="提交">
                </div>
                </td>
            </tr>
          </tbody>
        </table>
        <br>
<%if request("bh")<>"" then
	  if request("lx")<>"" then
	  lx=1
	 set rs = conn.execute("select * from telorder where spn='"&shopnet("bh")&"'")
'sql= "select * from telorder where spn="&shopnet("bh")&""
'response.write(sql)
	  if rs.eof then
	  Response.Write("<script>alert(""找不到该订单信息，请确认您输入的订单号是否正确！"");history.back();</script>")
	  else
	  conn.execute("Insert into sh(bh,lx,dz,name,tel,bz,sjid)values("&rs("id")&","&lx&",'"&rs("t_add")&"','"&rs("t_name")&"','"&rs("t_tel")&"','"&rs("telbeizhu")&"',"&shopnet("id")&")")
      end if
	  rs.close
	  else
	  set rs = conn.execute("select * from cart where bh='"&shopnet("bh")&"'")
	  if rs.eof then
	  Response.Write("<script>alert(""找不到该订单信息，请确认您输入的订单号是否正确！"");history.back();</script>")
	  else
	  conn.execute("Insert into sh(bh,dz,name,tel,bz,sjid)values('"&shopnet("bh")&"','"&rs("dz")&"','"&rs("name")&"','"&rs("tel")&"','"&rs("bz")&"',"&shopnet("id")&")")
      end if
	  rs.close
	  end if
end if
'添加完成,开始显示数据 
set rs = conn.execute("select * from sh where sjid="&shopnet("id")&"")
%>
              <table bgcolor=#CCCCCC border=0 cellpadding=3 cellspacing=1 
        width="570" align="center" class="9bang">
                <%set rs = conn.execute("select * from sh where sjid="&shopnet("id")&" order by id desc")
		  if not rs.eof then %>
          <tr bgcolor="#FFFFFF"> 
            <td colspan="5" class="008c5e"> <div align="center">本次送货清单列表&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                <a href="sh_print.asp?id=<%=rs("sjid")%>" target="_blank">&gt;&gt;打印本次送货清单</a></div></td>
          </tr>
          <tbody>
            <tr bgcolor="#f1f1f1"> 
              <td width=100 class="008c5e"> 
                <div align="center">订单号</div></td>
              <td width=225 class="008c5e"> <div align="center">送货地址</div></td>
              <td width=75 class="008c5e"> <div align="center">收货人</div></td>
                    <td width=150 class="008c5e"> 
                      <div align="center">联系电话</div></td>
              <td width=35 align="center" class="008c5e">删除</td>
            </tr>
            <% While NOT rs.EOF %>
            <tr> 
              <td bgcolor=#FFFFFF width=100 height="18"> 
                <div align="center"> 
                  <%if rs("lx")=1 then Response.Write ("电话")%>
                  <%=rs("bh")%></div></td>
              <td bgcolor=#ffffff width=225 height="18"> <%=rs("dz")%></td>
              <td bgcolor=#ffffff width=75 height="18"> <div align="center"><%=rs("name")%></div></td>
              <td height="18" bgcolor=#FFFFFF> <%=rs("tel")%></td>
              <td width="35" rowspan="2" bgcolor=#ffffff> <div align="center"><a href=del.asp?x=a&id=<%=rs("id")%>>删除</a></div></td>
            </tr>
            <tr> 
              <td bgcolor=#FFFFFF height="18">&nbsp;</td>
              <td height="18" colspan="3" bgcolor=#ffffff>备注：<%=rs("bz")%></td>
            </tr>
<%rs.MoveNext()
Wend
end if%>
          </tbody>
        </table>
        <input type="hidden" name="MM_insert" value="true">
      </form></td>
  </tr>
</table>
</body>
</html>
<%
'商易仿淘宝4.0.1演示地址
'http://www.ftaobao.com
rs.Close:set rs=nothing
case "add"
if request("add")="yes" and shopnet("n")<>"" and shopnet("y")<>"" and shopnet("r")<>"" then
conn.execute("Insert into sh(n,y,r,name)values('"&shopnet("n")&"','"&shopnet("y")&"','"&shopnet("r")&"','"&username&"')")
Response.redirect "?abc=add2&id="&conn.execute("select id from sh_sj where n='"&shopnet("n")&"' and y='"&shopnet("y")&"' and r='"&shopnet("r")&"'")(0)&""
end if%>
  <form method="POST" action="?abc=add&add=yes">
        第一步：录入送货清单日期<br>
        <br>
        <table bgcolor=#CCCCCC border=0 cellpadding=3 cellspacing=1 
        width="400" align="center" class="9bang">
          <tbody>
            <tr> 
              <td bgcolor=#f1f1f1 class="008c5e" width="100" height="25" align="center"><font size="2">送货清单日期</font></td>
              <td width="300" height="25" bgcolor=#FFFFFF class="008c5e"> <font size="2"> 
                &nbsp;
                <input name="n" type="text" class="wenbenkuang" id="n" value="<%=year(date())%>" size="8" maxlength="4">
                年 
                <input name="y" type="text" class="wenbenkuang" id="y" value="<%=month(date())%>" size="4" maxlength="2">
                月
                <input name="r" type="text" class="wenbenkuang" id="r" value="<%=day(date())%>" size="4" maxlength="2">
                日 </font></td>
            </tr>
            <tr> 
              <td bgcolor=#f1f1f1 class="008c5e" width="100" height="25">&nbsp;</td>
              <td width="300" height="25" bgcolor=#ffffff class="008c5e"> <font size="2">&nbsp; 
                <input name="submit" type="submit" class="go-wenbenkuang" value="提交">
                <input name="Reset" type="reset" class="go-wenbenkuang" value="重填">
                <input name="Submit" type="button" class="go-wenbenkuang" onclick="javascript:window.history.go(-1)" value="返回">
                </font></td>
            </tr>
          </tbody>
        </table>
        </form>
<%case else
if request("del")="yes" then
conn.execute("Delete * from sh where sjid="&shopnet("id")&"")
conn.execute("Delete * from sh_sj where id="&shopnet("id")&"")
end if
set rs=server.createobject("adodb.recordset")
sql="select * from sh where name='"&username&"' order by id desc "
rs.open sql,conn,3,1
if rs.eof then 
response.write "没有！"
end if 
page1("15")%>
</div>
<table width="500" height="30" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr align="center" valign="top"> 
      <td> <div align="center"></div>
        <a href="?abc=add">&gt;&gt;添加新送货清单</a></td>
    </tr>
</table>
<table width="500" border="0" align="center" bgcolor="#CCCCCC" cellpadding="0" cellspacing="1">
  <tr bgcolor="#f1f1f1" valign="middle" align="center"> 
    <td width="100" height="20"> 
      <div align="center">id</div></td>
    <td width="200" height="20"> 
      <div align="center">送货日期</div></td>
    <td width="100" height="20">修改</td>
    <td width="100">删除</td>
  </tr>
<%i=1
do while not rs.eof and i<=rs.pagesize%>
  <tr bgcolor="#FFFFFF" valign="middle" align="center"> 
      <td width="100" > <a href="sh_print.asp?id=<%=rs("id")%>" target="_blank">
<% =rs("id")%></a>
      </td>
    <td width="200"> 
      <div align="center"> <%=rs("n")%>年<%=rs("y")%>月<%=rs("r")%>日</div></td>
    <td width="100"> <a href="?abc=add2&id=<% =rs("id")%>">修改</a></td>
    <td width="100"><a href="?del=yes&id=<% =rs("id")%>&page=<%= page %>">删除</a></td>
  </tr>
<%i=i+1
rs.MoveNext                                              
loop%>
  <tr bgcolor="#FFFFFF" valign="middle" align="center"> 
      <td height="30" colspan="4" >
<%page2("")
rs.close:set rs=nothing%> </td>
  </tr>
</table>
<%End Select%>
</td>
  </tr>
</table>
<!--#include file="../bottom.asp"-->
