表单的内容如何存入数据库中

时间:2021-10-18 06:37:32
请问如何对接数据库,主要是下面红色字体部份,另外下面动态表格中的<input name="ku">此部份换成下拉菜单选择仓库。表格中的价格和条码自动取上行的进货价和条码,但在表格中也可以更改,表中的图片在表中上传,上传后回显,然后可以在表中删除

<%
if session("shiwei_username")="" then
%>
<script language="javascript">
top.location.href="../index.asp"
</script>
<%  
  response.end
end if
%>
<!-- #include file="../conn2.asp" -->
<!-- #include file="../const.asp" -->

<html>
<head>
<title><%=dianming%> - 产品入库</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../style/style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<style>
body {
background-color:#FFFFFF;
}
     table{margin: 5px auto 0;}
.add,.remove{color: blue; text-decoration: underline; cursor: pointer; margin: 0 5px;} 
.i_color_error,.i_model_error{display: none; color: red;}
.pirce2,.shulian,.ku,.tiaoma{width: 100px;}
.pic{color: #333333; width: 150px;}
#i_model_add{background: #FF8000; color: #EEEEEE; padding: 3px 5px; box-shadow: 0px 1px 1px 1px #CCCCCC; border-radius: 3px; cursor: pointer; margin-left: 5px;}
</style>
</HEAD>

<BODY>
<%
if fla1="0" and session("shiwei_id")<>"1" then
%>
<br><center><img src="../images/note.gif" align="absmiddle">&nbsp;<font color="#FF0000">你不具备此权限,请与管理员联系!</font></center>
<%  
  response.end
end if
%>

<%
if request("hid1")="ok" then
nowid_login=request("id_login")
nowid_payment=request("id_payment")
set rs_login=conn.execute("select * from login where id="&nowid_login)
nowid_gys=request("id_gys")
nowgys=""
set rs_gys=conn.execute("select * from gys where id="&nowid_gys)
if rs_gys.eof=false then nowgys=rs_gys("company")
set rs_bianhao=conn.execute("select * from buy order by id desc")
if rs_bianhao.eof then
  nowbianhao=1000001
else
  nowbianhao=1000001+rs_bianhao("id")
end if

totalshulian=0
totalprice2=0
for x=1 to maxproduit
nowku=request("ku"&x)
set rs_ku=conn.execute("select * from ku where id="&nowku)
nowhuohao=request("huohao"&x)
nowshulian=request("shulian"&x)
nowprice=request("price"&x)
if nowprice="" then
  nowprice=0
end if
nowprice2=request("price2"&x)
if nowprice2="" then
  nowprice2=0
end if
nowprice3=request("price3"&x)
if nowprice3="" then
  nowprice3=0
end if
ddan=request("ddan")
wuliufee=request("wuliufee")

if nowhuohao<>"单击选择产品" and nowshulian<>"" then
set rs_produit=conn.execute("select * from produit where huohao='"&nowhuohao&"'")
beizhu=rs_produit("beizhu")
price2=rs_produit("price2")
price=rs_produit("price")
price3=rs_produit("price3")
set rs=server.createobject("ADODB.RecordSet")
sql="select * from produit where huohao='"&nowhuohao&"' and id_ku="&nowku
rs.open sql,conn,1,3
if rs.eof then
  rs.addnew
  rs("id_bigclass")=rs_produit("id_bigclass")
  rs("id_smallclass")=rs_produit("id_smallclass")
  rs("title")=rs_produit("title")
  rs("huohao")=rs_produit("huohao")
  rs("tiaoma")=rs_produit("tiaoma")
  rs("id_ku")=nowku
  rs("shulian")=nowshulian
  rs("danwei")=rs_produit("danwei")
  rs("price")=rs_produit("price")
  rs("price2")=nowprice2
  rs("price3")=rs_produit("price3")
  rs("sekuan")=rs_produit("sekuan")
  rs("guige")=rs_produit("guige")
  rs("jingzhong")=rs_produit("jingzhong")
  rs("zhuangxiangshu")=rs_produit("zhuangxiangshu")
  rs("baojin")=rs_produit("baojin")
  rs("class")=rs_produit("class")
  rs("duihuan")=rs_produit("duihuan")
  rs("tichen_type")=rs_produit("tichen_type")
  rs("tichen")=rs_produit("tichen")
  rs("photo")=rs_produit("photo")
  rs("gys")=nowgys
  rs("id_gys")=nowid_gys
  rs("beizhu")=beizhu
else
  rs("shulian")=rs("shulian")+nowshulian
  rs("price2")=nowprice2 
end if
rs.update
rs.close
sql="select bigclass from bigclass where id="&rs_produit("id_bigclass")
set rs_bigclass=conn.execute(sql)
sql="select smallclass from smallclass where id="&rs_produit("id_smallclass")
set rs_smallclass=conn.execute(sql)
if rs_smallclass.eof then
  smallclass=""
else
  smallclass=rs_smallclass(0)
end if
totalshulian=totalshulian+nowshulian
totalprice2=totalprice2+nowprice2*nowshulian
ddan=request("ddan")
wuliufee=request("wuliufee")

sql="insert into buy(ddan,wuliufee,id_payment,id_produit,bigclass,smallclass,title,huohao,tiaoma,id_ku,ku,shulian,sekuan,guige,jingzhong,zhuangxiangshu,id_login,login,type,selldate,price,price2,price3,photo,id_gys,gys,bianhao,beizhu) values('"&ddan&"','"&wuliufee&"',"&nowid_payment&","&rs_produit("id")&",'"&rs_bigclass(0)&"','"&smallclass&"','"&rs_produit("title")&"','"&nowhuohao&"','"&rs_produit("tiaoma")&"',"&rs_ku("id")&",'"&rs_ku("ku")&"',"&nowshulian&",'"&rs_produit("sekuan")&"','"&rs_produit("guige")&"','"&rs_produit("jingzhong")&"','"&rs_produit("zhuangxiangshu")&"',"&nowid_login&",'"&rs_login("username")&"',0,#"&date()&"#,'"&rs_produit("price")&"',"&nowprice2&",'"&rs_produit("price3")&"','"&rs_produit("photo")&"',"&nowid_gys&",'"&nowgys&"','"&nowbianhao&"','"&beizhu&"')"
conn.execute(sql)
end if
next
sql="insert into buy(ddan,wuliufee,id_payment,shulian,id_login,login,type,selldate,price,price2,price3,id_gys,gys,bianhao,zu) values('"&ddan&"','"&wuliufee&"',"&nowid_payment&","&totalshulian&","&nowid_login&",'"&rs_login("username")&"',0,#"&date()&"#,"&price&","&price2&","&price3&","&nowid_gys&",'"&nowgys&"','"&nowbianhao&"',true)"
conn.execute(sql)
%>
<script language="javascript">
alert("产品入库成功!")
</script> 
<%if dayin1="yes" then%>
<script language="javascript">
window.open('print_buy.asp?bianhao=<%=nowbianhao%>','打印','width=853,height=470,top=176,left=161,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=yes');
</script>
<%end if%>
<%
end if
%>


3 个解决方案

#1


<%
if request("hid2")<>"" then
nowbigclass=request("bigclass")
nowsmallclass=request("smallclass")
nowtitle=request("title")
nowhuohao=request("huohao")
nowtiaoma=request("tiaoma")
nowku=request("ku")
nowshulian=request("shulian")
nowdanwei=request("danwei")
nowprice=request("price")
if nowprice="" then
  nowprice=0
end if
nowprice2=request("price2")
if nowprice2="" then
  nowprice2=0
end if
nowprice3=request("price3")
if nowprice3="" then
  nowprice3=0
end if
nowguige=request("guige")
nowsekuan=request("sekuan")
nowjingzhong=request("jingzhong")
nowzhuangxiangshu=request("zhuangxiangshu")
nowbaojin=request("baojin")
nowclass=request("class")
nowduihuan=request("duihuan")
nowtichen_type=request("tichen_type")
nowtichen=request("tichen")
nowphoto=request("photo")
nowbeizhu=request("beizhu")
nowid_login=request("id_login")
nowid_gys=request("id_gys")
nowgys=""
nowid_payment=request("id_payment")
set rs_login=conn.execute("select * from login where id="&nowid_login)
set rs_gys=conn.execute("select * from gys where id="&nowid_gys)
if rs_gys.eof=false then nowgys=rs_gys("company")
sql="select * from produit where huohao='"&nowhuohao&"'"
set rs=conn.execute(sql)
if rs.eof=false then
%>
<script language="javascript">
alert("您输入的淘宝条码已经存在,请使用已有产品入库进行添加!")
window.history.go(-1)
</script> 
<%
  response.end
end if
sql="insert into produit(id_bigclass,id_smallclass,title,huohao,tiaoma,id_ku,shulian,danwei,price,price2,price3,guige,sekuan,jingzhong,zhuangxiangshu,baojin,class,tichen_type,tichen,photo,beizhu,id_gys,gys) values("&nowbigclass&","&nowsmallclass&",'"&nowtitle&"','"&nowhuohao&"','"&nowtiaoma&"',"&nowku&","&nowshulian&",'"&nowdanwei&"',"&nowprice&","&nowprice2&","&nowprice3&",'"&nowguige&"','"&nowsekuan&"','"&nowjingzhong&"','"&nowzhuangxiangshu&"',"&nowbaojin&","&nowclass&","&nowtichen_type&","&nowtichen&",'"&nowphoto&"','"&nowbeizhu&"',"&nowid_gys&",'"&nowgys&"')"
conn.execute(sql)
sql="select * from produit order by id desc"
set rs_produit=conn.execute(sql)
sql="select bigclass from bigclass where id="&nowbigclass
set rs_bigclass=conn.execute(sql)
sql="select smallclass from smallclass where id="&nowsmallclass
set rs_smallclass=conn.execute(sql)
if rs_smallclass.eof then
  smallclass=""
else
  smallclass=rs_smallclass(0)
end if
sql="select * from ku where id="&nowku
set rs_ku=conn.execute(sql)
set rs_bianhao=conn.execute("select * from buy order by id desc")
if rs_bianhao.eof then
  nowbianhao=1000001
else
  nowbianhao=1000001+rs_bianhao("id")
end if
ddan=request("ddan")
wuliufee=request("wuliufee")
sql="select * from ku where id="&nowku
set rs_ku=conn.execute(sql)
sql="insert into buy(ddan,wuliufee,id_payment,id_produit,bigclass,smallclass,title,huohao,tiaoma,id_ku,ku,shulian,guige,sekuan,jingzhong,zhuangxiangshu,id_login,login,type,selldate,price,price2,price3,photo,id_gys,gys,bianhao,beizhu) values('"&ddan&"',"&wuliufee&","&nowid_payment&","&rs_produit("id")&",'"&rs_bigclass(0)&"','"&smallclass&"','"&nowtitle&"','"&nowhuohao&"','"&nowtiaoma&"',"&rs_ku("id")&",'"&rs_ku("ku")&"',"&nowshulian&",'"&nowguige&"','"&nowsekuan&"','"&nowjingzhong&"','"&nowzhuangxiangshu&"',"&nowid_login&",'"&rs_login("username")&"',0,#"&date()&"#,"&nowprice&","&nowprice2&","&nowprice3&",'"&nowphoto&"',"&nowid_gys&",'"&nowgys&"','"&nowbianhao&"','"&nowbeizhu&"')"
conn.execute(sql)
ddan=request("ddan")

sql="insert into buy(ddan,wuliufee,id_payment,shulian,id_login,login,type,selldate,price,price2,price3,id_gys,gys,bianhao,zu) values('"&ddan&"','"&wuliufee&"',"&nowid_payment&","&nowshulian&","&nowid_login&",'"&rs_login("username")&"',0,#"&date()&"#,"&nowprice&","&nowprice2&","&nowprice3&","&nowid_gys&",'"&nowgys&"','"&nowbianhao&"',true)"
conn.execute(sql)
%>
<script language="javascript">
alert("产品入库成功!")
</script> 
<%if dayin1="yes" then%>
<script language="javascript">
window.open('print_buy.asp?bianhao=<%=nowbianhao%>','打印','width=853,height=470,top=176,left=161,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=yes');
</script>
<%end if%>
<%
end if
%>
<script language="javascript">
function isNumberString (InString,RefString)
{
if(InString.length==0) return (false);
for (Count=0; Count < InString.length; Count++)  {
TempChar= InString.substring (Count, Count+1);
if (RefString.indexOf (TempChar, 0)==-1)  
return (false);
}
return (true);
}

function check()
{
if (document.form2.title.value==""||document.form2.huohao.value==""||document.form2.shulian.value=="")
{
alert("有*号的必须填写!");
return false;
}
if (isNumberString(document.form2.tichen.value,"1234567890.")!=1)
{
alert("价格只能为数字!");
return false;
}
}

function check1()
{
if (document.form1.huohao1.value=="单击选择产品")
{
alert("还没有选择产品!");
return false;
}
if (document.form1.shulian1.value=="")
{
alert("请输入入库数量!");
return false;
}
}

function chg1(a)
{
if (a=="0") {document.all.bian1.innerHTML="%"}
else {document.all.bian1.innerHTML="元"}
}
</script>

<script>   
  function check_click(){   
  if(document.form2.huohao.value=="")   
  {   
  alert("请先输入您要检测的淘宝条码");   
  document.form2.huohao.focus();   
  return   false;   
  }   
  window.open('check.asp?huohao='+document.form2.huohao.value);   
  }   
  </script>   

#2


<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#C4D8ED">
<tr>
<td><img src="../images/r_1.gif" alt="" /></td>
<td width="100%" background="../images/r_0.gif">
  <table cellpadding="0" cellspacing="0" width="100%">
    <tr>
      <td>&nbsp;已有产品入库(带*号的为必填项)</td>
  <td align="right">&nbsp;</td>
    </tr>
  </table>
</td>
<td><img src="../images/r_2.gif" alt="" /></td>
</tr>
<tr>
<td></td>
<td>
<table align="center" cellpadding="4" cellspacing="1" class="toptable grid" border="1">
  <form name="form1" method="post">
      <tr>
        <td width="20%" align="right" height="30">选择产品:</td>
        <td width="80%" class="category">
          <table cellpadding="0" cellspacing="0" width="100%" border=0>
    <%for x=1 to maxproduit%>
    <tr id="cailiaohan<%=x%>"<%if x<>1 then%> style="display:none;"<%end if%>>
  <td>
    <input name="huohao<%=x%>" readonly onClick="JavaScript:window.open('produit1.asp?form=form1&field=huohao<%=x%>&field2=price2<%=x%>&span1=showshulian<%=x%>','','directorys=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=853,height=470,top=176,left=161');" style="width:80px" value="单击选择产品">
&nbsp;数量: <input type="text" name="shulian<%=x%>" style="width:30px" onKeyUp="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" value="1">
&nbsp;成本单价: <input type="text" name="price2<%=x%>" style="width:50px" onKeyUp="value=value.replace(/[^\d.]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d.]/g,''))">
<%
if session("shiwei_id")=1 then
  sql="select * from ku order by id"
  set rs_ku=conn.execute(sql)
else
  sql="select * from ku where instr(login,'"&session("shiwei_id")&",')>0 order by id"
  set rs_ku=conn.execute(sql)   
end if
if rs_ku.eof then
%>
<script language="javascript">
  alert("没有属于你管理的仓库,请先添加仓库!")
  window.location.href="../system/ku_add.asp"
</script>
<%
end if
%>
&nbsp;仓库: <select name="ku<%=x%>">
<%
do while rs_ku.eof=false
%>
      <option value="<%=rs_ku("id")%>"<%if rs_ku("moren") then%> selected="selected"<%end if%>><%=rs_ku("ku")%></option>
<%
  rs_ku.movenext
loop
%>
</select>
<%if x<>maxproduit then%><span onClick="cailiaohan<%=(x+1)%>.style.display=''" style="cursor:hand;">下一个产品</span><%end if%>
<%if x=1 then%><font color="#ff0000">*</font><%end if%>
<div id="showshulian<%=x%>"></div>
      </td>
</tr>
<%next%>
  </table>
</td>
      </tr>
  <tr>
    <tr>
    <td align="right" height="30">订单号:</td>
        <td class="category">
  <input name="ddan" value="<%=ddan%>" style="width:150px">
物流费:
<input type="text" name="wuliufee" id="wuliufee" value="0" onKeyUp="clearNoNum(this);" onafterpaste="clearNoNum(this);">
支付方式
<%
sql="select * from payment order by id"
set rs_login=conn.execute(sql)
  if rs_login.eof then
  %>
            <script language="javascript">
        alert("请先添加支付方式!")
        window.location.href="../system/payment.asp"
        </script>
            <%
  response.end
  else
  %>
            <select name="id_payment" id="id_payment" style="width:65px">
              <%
  do while rs_login.eof=false
  %>
              <option value="<%=rs_login("id")%>"><%=rs_login("payment")%></option>
              <%
    rs_login.movenext
  loop
  %>
            </select>
            <%
  end if
  set rs_login=nothing
  %></td>
    </tr>
        <td align="right" height="30">供应商:</td>
        <td class="category">
  <%
    sql="select * from gys order by id"
    set rs_gys=conn.execute(sql)
    %>
    <select name="id_gys">
  <option value="0"></option>
    <%
    do while rs_gys.eof=false
    %>
  <option value="<%=rs_gys("id")%>"><%=rs_gys("company")%></option>
    <%
  rs_gys.movenext
    loop
    %>
    </select></td>
      </tr>
  <tr>
        <td align="right" height="30">经办人:</td>
        <td class="category">
  <%
  if session("shiwei_id")=1 then
sql="select * from login order by id_zu,id"
set rs_login=conn.execute(sql)
  else
sql="select * from login where id="&session("shiwei_id")
set rs_login=conn.execute(sql)   
  end if
  if rs_login.eof then
  %>
      <script language="javascript">
        alert("请先添加员工!")
        window.location.href="../system/user_add.asp"
      </script>
  <%
  else
  %>
  <select name="id_login">
  <%
  do while rs_login.eof=false
  %>
    <option value="<%=rs_login("id")%>"<%if rs_login("username")=session("shiwei_username") then%> selected="selected"<%end if%>><%=rs_login("username")%> (<%=rs_login("bianhao")%>)</option>
  <%
    rs_login.movenext
  loop
  %>
  </select>
  <%
  end if
  %>
</td>
      </tr> 
<tr>
    <td height="30">&nbsp;</td>
        <td class="category">
  <input type="submit" value=" 确认添加 " onClick="return check1()" class="button">
  <input type="hidden" name="hid1" value="ok">
  <input type="reset" value=" 重新填写 " class="button">
  </td>
      </tr>
  </form>
</table>
</td>
<td></td>
</tr>
<tr>
<td><img src="../images/r_4.gif" alt="" /></td>
<td></td>
<td><img src="../images/r_3.gif" alt="" /></td>
</tr>
</table>

<table cellpadding=0 cellspacing=0 width="98%" align=center><tr><td height="5"></td></tr></table>

<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#C4D8ED">
<tr>
<td><img src="../images/r_1.gif" alt="" /></td>
<td width="100%" background="../images/r_0.gif">
  <table cellpadding="0" cellspacing="0" width="100%">
    <tr>
      <td>&nbsp;新产品入库(带*号的为必填项)</td>
  <td align="right">&nbsp;</td>
    </tr>
  </table>
</td>
<td><img src="../images/r_2.gif" alt="" /></td>
</tr>
<tr>
<td></td>
<td>
<table align="center" cellpadding="4" cellspacing="1" class="toptable grid" border="1">
  <form name="form3">
      <tr>
        <td align="right" height="30">所属大类:</td>
        <td class="category">
    <%
sql="select * from bigclass order by id"
set rs_bigclass=conn.execute(sql)
if rs_bigclass.eof then
%>
<script language="javascript">
  alert("请先添加产品大类!")
  window.location.href="../system/bigclass_add.asp"
</script>
<%
end if
nowbigclass=request("bigclass")
if nowbigclass="" then
  nowbigclass=rs_bigclass("id")
end if
%>
  <select name="bigclass" onChange="form3.submit()">
        <%
do while rs_bigclass.eof=false
%>
        <option value="<%=rs_bigclass("id")%>"<%if trim(cstr(rs_bigclass("id")))=nowbigclass then%> selected="selected"<%end if%>><%=rs_bigclass("bigclass")%></option>
        <%
  rs_bigclass.movenext
loop
%>
      </select>   
  </td>
      </tr>
  </form>
  <form name="form2"> 
  <input type="hidden" name="bigclass" value="<%=nowbigclass%>">
      <tr>
        <td align="right" height="30">所属小类:</td>
        <td class="category">
    <%
sql="select * from smallclass where id_bigclass="&nowbigclass&" order by id"
set rs_smallclass=conn.execute(sql)
%>
  <select name="smallclass">
    <option value="0"></option>
        <%
do while rs_smallclass.eof=false
%>
        <option value="<%=rs_smallclass("id")%>"<%if trim(cstr(rs_smallclass("id")))=nowsmallclass then%> selected="selected"<%end if%>><%=rs_smallclass("smallclass")%></option>
        <%
  rs_smallclass.movenext
loop
%>
      </select>  
  </td>
      </tr>    
      <tr>
        <td width="20%" height="30" align="right">商品名称:</td>
        <td width="80%" class="category">
  <input name="title" type="text" style="width:200px;">&nbsp;<font color="#ff0000">*</font></td>
      </tr>
      <tr>
        <td align="right" height="30">商品货号:</td>
        <td class="category">
          <input type="text" name="huohao" style="width:200px">&nbsp;<font color="#ff0000">*</font>
<input style="width:160"   name="checkno"   type="button"     value="点击检测淘宝条码是否存在"     onClick="javascript:check_click(this)">  

  </td>
 
      </tr>
  <tr>
        <td align="right" height="30">商品条码:</td>
        <td class="category">
          <input type="text" name="tiaoma" style="width:200px">&nbsp;</td>
      </tr>
  <tr>
      
    <td align="right" height="30">订货单号:</td>
        <td class="category">
  <input name="ddan" value="<%=ddan%>" style="width:150px">
物流费:
    <input type="text" name="wuliufee" id="wuliufee" value="0" onKeyUp="clearNoNum(this);" onafterpaste="clearNoNum(this);">
    支付方式
<%
sql="select * from payment order by id"
set rs_login=conn.execute(sql)
  if rs_login.eof then
  %>
            <script language="javascript">
        alert("请先添加支付方式!")
        window.location.href="../system/payment.asp"
        </script>
            <%
  response.end
  else
  %>
            <select name="id_payment" id="id_payment" style="width:65px">
              <%
  do while rs_login.eof=false
  %>
              <option value="<%=rs_login("id")%>"><%=rs_login("payment")%></option>
              <%
    rs_login.movenext
  loop
  %>
            </select>
            <%
  end if
  set rs_login=nothing
  %></td>
      </tr>
      <tr>
        <td align="right" height="30">加入仓库:</td>
        <td class="category">
    <%
if session("shiwei_id")=1 then
  sql="select * from ku order by id"
  set rs_ku=conn.execute(sql)
else
  sql="select * from ku where instr(login,'"&session("shiwei_id")&",')>0 order by id"
  set rs_ku=conn.execute(sql)   
end if
if rs_ku.eof then
%>
<script language="javascript">
  alert("没有属于你管理的仓库,请先添加仓库!")
  window.location.href="../system/ku_add.asp"
</script>
<%
end if
%>
  <select name="ku">
        <%
do while rs_ku.eof=false
%>
        <option value="<%=rs_ku("id")%>"<%if rs_ku("moren") then%> selected="selected"<%end if%>><%=rs_ku("ku")%></option>
        <%
  rs_ku.movenext
loop
%>
      </select>   

#3


  </td>
      </tr>   
      <tr>
        <td align="right" height="30">产品单位:</td>
        <td class="category">
    <%
sql="select * from danwei order by id"
set rs_danwei=conn.execute(sql)
if rs_danwei.eof then
%>
<script language="javascript">
  alert("请先添加单位!")
  window.location.href="../system/danwei_add.asp"
</script>
<%
end if
%>
  <select name="danwei">
        <%
do while rs_danwei.eof=false
%>
        <option value="<%=rs_danwei("danwei")%>"><%=rs_danwei("danwei")%></option>
        <%
  rs_danwei.movenext
loop
%>
      </select>
  <font color="#666666">(只用于普通识别,不能换算)</font></td>
      </tr>   
      <tr>
        <td align="right" height="30">产品价格:</td>
        <td class="category">推荐卖价:<input type="text" name="price" style="width:100px" onKeyUp="value=value.replace(/[^\d.]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d.]/g,''))">
  <font color="#666666">元</font>
   代理价:<input type="text" name="price3" style="width:100px" onKeyUp="value=value.replace(/[^\d.]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d.]/g,''))">
          <font color="#666666">元</font>
  
  进货价:<input type="text" name="price2" style="width:100px" onKeyUp="value=value.replace(/[^\d.]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d.]/g,''))">
          <font color="#666666">元</font>
 
  </td>
      </tr>
    <tr>
        <td align="right" height="30">产品详情:</td>
        <td class="category">
        <div style="width: 840px; margin: 0px auto 0;">
<div>颜色分类:<input id="sekuan" width="60" /><span class="i_color_error">*</span></div>
<div>规格型号:<input id="guige" width="60"  /><span class="i_model_error">*</span><span id="i_model_add">增加</span></div>
<table width="100%" border="1" cellpadding="4" cellspacing="1"  bordercolor="#C9DBEF" id="ctr" >
<tr>  
        <td align="center">颜色</td>  
        <td align="center">图片</td>  
        <td align="center">规格</td>  
        <td align="center">价格</td>  
        <td align="center">数量</td>
        <td align="center">仓库</td>
<td align="center">条码</td>
        <td align="center">删除</td>
    </tr>
</table> 
<script type="text/javascript">
(function($){
var color = '';
var model = '';
var bool;
var td_size = $('#ctr tr:first td').size();
var tr;
var index = 0;
var boo_index;
var rowspan;
var click_bool;
$('#i_model_add').click(function(){
bool  = false;
boo_index = true;
model = $('#guige').val().trim();
color = $('#sekuan').val().trim();
if(model == ''){
bool = true;
$('.i_model_error').show();
}
else{
$('.i_model_error').hide();
}
if(color == ''){
bool = true;
$('.i_color_error').show();
}
else{
$('.i_color_error').hide();
}
if(bool){
return false;
}
$('.sekuan').each(function(){
if($(this).html() == color){
rowspan = $(this).parent().attr('rowspan');
if(rowspan > 0){
rowspan ++;
}
else{
rowspan = 2;
}
$(this).parent().attr('rowspan',rowspan);
$(this).parent().parent().find('.pic').parent().attr('rowspan',rowspan);
tr = '<tr><td><span class="guige">' + model + '</span></td><td><input type="text" name="price2<%=x%>" /></td><td><input class="shulian" onKeyUp="this.value=this.value.replace(/\D/g,\'\') onafterpaste="this.value=this.value.replace(/\D/g,\'\') /></td><td><input type="text" name="ku" /></td><td><input class="tiaoma<%=x%>" /></td><td><span class="remove">删除</span></td></tr>';
$(this).parent().parent().after(tr);
boo_index = false;
}
});
if(boo_index){
tr = '<tr><td><span class="sekuan">' + color + '</span></td><td><input type="file" class="pic" /></td><td><span class="guige">' + model + '</span></td><td><input type="text" name="price2<%=X%>" /></td><td><input class="shulian" onKeyUp="this.value=this.value.replace(/\D/g,\'\') onafterpaste="this.value=this.value.replace(/\D/g,\'\') /></td><td><input type="text" name="ku" /></td><td><input class="<%=tiaomax%>" /></td><td><span class="remove">删除</span></td></tr>';

$('#ctr tbody').append(tr);
}
});
$('.remove').live('click',function(){
if($(this).parent().parent().find('td').size() == td_size && (!$(this).parent().parent().find('td:first').attr('rowspan') || $(this).parent().parent().find('td:first').attr('rowspan') == 1)){
$(this).parent().parent().remove();
}
if($(this).parent().parent().find('td').size() < td_size){
click_bool = true;
$(this).parent().parent().prevAll('tr').each(function(){
if(click_bool && $(this).find('td:first').attr('rowspan')){
rowspan = $(this).find('td:first').attr('rowspan');
rowspan --;
$(this).find('td:first,td:eq(1)').attr('rowspan',rowspan);
click_bool = false;
}
});
$(this).parent().parent().remove();
}
if($(this).parent().parent().find('td').size() == td_size && $(this).parent().parent().find('td:first').attr('rowspan') > 1){
rowspan = $(this).parent().parent().find('td:first').attr('rowspan');
rowspan --; 
$(this).parent().parent().next().prepend($(this).parent().parent().find('td:eq(1)').clone());
$(this).parent().parent().next().prepend($(this).parent().parent().find('td:first').clone());
$(this).parent().parent().next().find('td:first,td:eq(1)').attr('rowspan',rowspan);
$(this).parent().parent().remove();
}
});
})(jQuery);
</script>
</div></td>
      </tr>   
  <tr>
        <td align="right" height="30">产品净重:</td>
        <td class="category"><input type="text" name="jingzhong" style="width:200px"></td>
      </tr>
   <tr>
        <td align="right" height="30">装箱数量:</td>
        <td class="category"><input type="text" name="zhuangxiangshu" style="width:200px"></td>
      </tr>
      <tr>
        <td align="right" height="30">最低库存报警数量:</td>
        <td class="category"><input type="text" name="baojin" style="width:100px" onKeyUp="this.value=this.value.replace(/\D/g,'')"  onafterpaste="this.value=this.value.replace(/\D/g,'')" value="0"> 
          <font color="#666666">(设为零将不会报警)</font></td>
      </tr>   
      <tr>
        <td align="right" height="30">经办人:</td>
        <td class="category">
  <%
  if session("shiwei_id")=1 then
sql="select * from login order by id_zu,id"
set rs_login=conn.execute(sql)
  else
sql="select * from login where id="&session("shiwei_id")
set rs_login=conn.execute(sql)   
  end if
  if rs_login.eof then
  %>
      <script language="javascript">
        alert("请先添加员工!")
        window.location.href="../system/user_add.asp"
      </script>
  <%
  else
  %>
  <select name="id_login">
  <%
  do while rs_login.eof=false
  %>
    <option value="<%=rs_login("id")%>"<%if rs_login("username")=session("shiwei_username") then%> selected="selected"<%end if%>><%=rs_login("username")%> (<%=rs_login("bianhao")%>)</option>
  <%
    rs_login.movenext
  loop
  %>
  </select>
  <%
  end if
  %> </td>
      </tr>
      <tr>
        <td align="right" height="30">供应商:</td>
        <td class="category">
  <%
  sql="select * from gys order by id"
  set rs_gys=conn.execute(sql)
  %>
  <select name="id_gys">
    <option value="0"></option>
  <%
  do while rs_gys.eof=false
  %>
    <option value="<%=rs_gys("id")%>"><%=rs_gys("company")%></option>
  <%
    rs_gys.movenext
  loop
  %>
  </select>
</td>
      </tr>   
      <tr>
        <td align="right" height="30">产品类型:</td>
        <td class="category">
  <select name="class">
    <option value="0">正常产品</option>
<option value="1">公司赠品</option>
  </select>
  </td>
      </tr>
     <tr>
        <td align="right" height="30">兑换所需积分:</td>
        <td class="category">
          <input type="text" name="duihuan" style="width:100px" onKeyUp="this.value=this.value.replace(/\D/g,'')"  onafterpaste="this.value=this.value.replace(/\D/g,'')" value="0">
          <font color="#666666">(会员兑换此礼品所需积分)</font></td>
      </tr>   
      <tr>
        <td align="right" height="30">提成类型:</td>
        <td class="category">
  <select name="tichen_type" onChange="chg1(this.value)">
    <option value="0">按百分比提成</option>
<option value="1">固定提成</option>
  </select>
</td>
      </tr>     
      <tr>
        <td align="right" height="30">员工提成:</td>
        <td class="category">
  销售一件提成:<input type="text" name="tichen" style="width:50px" value="<%=jieshaojifen%>">
  <font color="#666666"><span id="bian1">%</span></font></td>
      </tr>
      <tr>
        <td align="right" height="30">产品备注:</td>
        <td class="category">
          <textarea name="beizhu" cols="60" rows="3"></textarea>
        </td>
      </tr>         
      <tr>
    <td height="30">&nbsp;</td>
        <td class="category"><input type="submit" value=" 确认添加 " onClick="return check()" class="button">&nbsp;&nbsp;&nbsp;&nbsp;
  <input type="hidden" name="hid2" value="ok">
  <input type="hidden" name="photo" value="">
  <input type="reset" value=" 重新填写 " class="button"> </td>
      </tr>
  </form>
</table>
</td>
<td></td>
</tr>
<tr>
<td><img src="../images/r_4.gif" alt="" /></td>
<td></td>
<td><img src="../images/r_3.gif" alt="" /></td>
</tr>
</table>
</body>
</html>

#1


<%
if request("hid2")<>"" then
nowbigclass=request("bigclass")
nowsmallclass=request("smallclass")
nowtitle=request("title")
nowhuohao=request("huohao")
nowtiaoma=request("tiaoma")
nowku=request("ku")
nowshulian=request("shulian")
nowdanwei=request("danwei")
nowprice=request("price")
if nowprice="" then
  nowprice=0
end if
nowprice2=request("price2")
if nowprice2="" then
  nowprice2=0
end if
nowprice3=request("price3")
if nowprice3="" then
  nowprice3=0
end if
nowguige=request("guige")
nowsekuan=request("sekuan")
nowjingzhong=request("jingzhong")
nowzhuangxiangshu=request("zhuangxiangshu")
nowbaojin=request("baojin")
nowclass=request("class")
nowduihuan=request("duihuan")
nowtichen_type=request("tichen_type")
nowtichen=request("tichen")
nowphoto=request("photo")
nowbeizhu=request("beizhu")
nowid_login=request("id_login")
nowid_gys=request("id_gys")
nowgys=""
nowid_payment=request("id_payment")
set rs_login=conn.execute("select * from login where id="&nowid_login)
set rs_gys=conn.execute("select * from gys where id="&nowid_gys)
if rs_gys.eof=false then nowgys=rs_gys("company")
sql="select * from produit where huohao='"&nowhuohao&"'"
set rs=conn.execute(sql)
if rs.eof=false then
%>
<script language="javascript">
alert("您输入的淘宝条码已经存在,请使用已有产品入库进行添加!")
window.history.go(-1)
</script> 
<%
  response.end
end if
sql="insert into produit(id_bigclass,id_smallclass,title,huohao,tiaoma,id_ku,shulian,danwei,price,price2,price3,guige,sekuan,jingzhong,zhuangxiangshu,baojin,class,tichen_type,tichen,photo,beizhu,id_gys,gys) values("&nowbigclass&","&nowsmallclass&",'"&nowtitle&"','"&nowhuohao&"','"&nowtiaoma&"',"&nowku&","&nowshulian&",'"&nowdanwei&"',"&nowprice&","&nowprice2&","&nowprice3&",'"&nowguige&"','"&nowsekuan&"','"&nowjingzhong&"','"&nowzhuangxiangshu&"',"&nowbaojin&","&nowclass&","&nowtichen_type&","&nowtichen&",'"&nowphoto&"','"&nowbeizhu&"',"&nowid_gys&",'"&nowgys&"')"
conn.execute(sql)
sql="select * from produit order by id desc"
set rs_produit=conn.execute(sql)
sql="select bigclass from bigclass where id="&nowbigclass
set rs_bigclass=conn.execute(sql)
sql="select smallclass from smallclass where id="&nowsmallclass
set rs_smallclass=conn.execute(sql)
if rs_smallclass.eof then
  smallclass=""
else
  smallclass=rs_smallclass(0)
end if
sql="select * from ku where id="&nowku
set rs_ku=conn.execute(sql)
set rs_bianhao=conn.execute("select * from buy order by id desc")
if rs_bianhao.eof then
  nowbianhao=1000001
else
  nowbianhao=1000001+rs_bianhao("id")
end if
ddan=request("ddan")
wuliufee=request("wuliufee")
sql="select * from ku where id="&nowku
set rs_ku=conn.execute(sql)
sql="insert into buy(ddan,wuliufee,id_payment,id_produit,bigclass,smallclass,title,huohao,tiaoma,id_ku,ku,shulian,guige,sekuan,jingzhong,zhuangxiangshu,id_login,login,type,selldate,price,price2,price3,photo,id_gys,gys,bianhao,beizhu) values('"&ddan&"',"&wuliufee&","&nowid_payment&","&rs_produit("id")&",'"&rs_bigclass(0)&"','"&smallclass&"','"&nowtitle&"','"&nowhuohao&"','"&nowtiaoma&"',"&rs_ku("id")&",'"&rs_ku("ku")&"',"&nowshulian&",'"&nowguige&"','"&nowsekuan&"','"&nowjingzhong&"','"&nowzhuangxiangshu&"',"&nowid_login&",'"&rs_login("username")&"',0,#"&date()&"#,"&nowprice&","&nowprice2&","&nowprice3&",'"&nowphoto&"',"&nowid_gys&",'"&nowgys&"','"&nowbianhao&"','"&nowbeizhu&"')"
conn.execute(sql)
ddan=request("ddan")

sql="insert into buy(ddan,wuliufee,id_payment,shulian,id_login,login,type,selldate,price,price2,price3,id_gys,gys,bianhao,zu) values('"&ddan&"','"&wuliufee&"',"&nowid_payment&","&nowshulian&","&nowid_login&",'"&rs_login("username")&"',0,#"&date()&"#,"&nowprice&","&nowprice2&","&nowprice3&","&nowid_gys&",'"&nowgys&"','"&nowbianhao&"',true)"
conn.execute(sql)
%>
<script language="javascript">
alert("产品入库成功!")
</script> 
<%if dayin1="yes" then%>
<script language="javascript">
window.open('print_buy.asp?bianhao=<%=nowbianhao%>','打印','width=853,height=470,top=176,left=161,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=yes');
</script>
<%end if%>
<%
end if
%>
<script language="javascript">
function isNumberString (InString,RefString)
{
if(InString.length==0) return (false);
for (Count=0; Count < InString.length; Count++)  {
TempChar= InString.substring (Count, Count+1);
if (RefString.indexOf (TempChar, 0)==-1)  
return (false);
}
return (true);
}

function check()
{
if (document.form2.title.value==""||document.form2.huohao.value==""||document.form2.shulian.value=="")
{
alert("有*号的必须填写!");
return false;
}
if (isNumberString(document.form2.tichen.value,"1234567890.")!=1)
{
alert("价格只能为数字!");
return false;
}
}

function check1()
{
if (document.form1.huohao1.value=="单击选择产品")
{
alert("还没有选择产品!");
return false;
}
if (document.form1.shulian1.value=="")
{
alert("请输入入库数量!");
return false;
}
}

function chg1(a)
{
if (a=="0") {document.all.bian1.innerHTML="%"}
else {document.all.bian1.innerHTML="元"}
}
</script>

<script>   
  function check_click(){   
  if(document.form2.huohao.value=="")   
  {   
  alert("请先输入您要检测的淘宝条码");   
  document.form2.huohao.focus();   
  return   false;   
  }   
  window.open('check.asp?huohao='+document.form2.huohao.value);   
  }   
  </script>   

#2


<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#C4D8ED">
<tr>
<td><img src="../images/r_1.gif" alt="" /></td>
<td width="100%" background="../images/r_0.gif">
  <table cellpadding="0" cellspacing="0" width="100%">
    <tr>
      <td>&nbsp;已有产品入库(带*号的为必填项)</td>
  <td align="right">&nbsp;</td>
    </tr>
  </table>
</td>
<td><img src="../images/r_2.gif" alt="" /></td>
</tr>
<tr>
<td></td>
<td>
<table align="center" cellpadding="4" cellspacing="1" class="toptable grid" border="1">
  <form name="form1" method="post">
      <tr>
        <td width="20%" align="right" height="30">选择产品:</td>
        <td width="80%" class="category">
          <table cellpadding="0" cellspacing="0" width="100%" border=0>
    <%for x=1 to maxproduit%>
    <tr id="cailiaohan<%=x%>"<%if x<>1 then%> style="display:none;"<%end if%>>
  <td>
    <input name="huohao<%=x%>" readonly onClick="JavaScript:window.open('produit1.asp?form=form1&field=huohao<%=x%>&field2=price2<%=x%>&span1=showshulian<%=x%>','','directorys=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=853,height=470,top=176,left=161');" style="width:80px" value="单击选择产品">
&nbsp;数量: <input type="text" name="shulian<%=x%>" style="width:30px" onKeyUp="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" value="1">
&nbsp;成本单价: <input type="text" name="price2<%=x%>" style="width:50px" onKeyUp="value=value.replace(/[^\d.]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d.]/g,''))">
<%
if session("shiwei_id")=1 then
  sql="select * from ku order by id"
  set rs_ku=conn.execute(sql)
else
  sql="select * from ku where instr(login,'"&session("shiwei_id")&",')>0 order by id"
  set rs_ku=conn.execute(sql)   
end if
if rs_ku.eof then
%>
<script language="javascript">
  alert("没有属于你管理的仓库,请先添加仓库!")
  window.location.href="../system/ku_add.asp"
</script>
<%
end if
%>
&nbsp;仓库: <select name="ku<%=x%>">
<%
do while rs_ku.eof=false
%>
      <option value="<%=rs_ku("id")%>"<%if rs_ku("moren") then%> selected="selected"<%end if%>><%=rs_ku("ku")%></option>
<%
  rs_ku.movenext
loop
%>
</select>
<%if x<>maxproduit then%><span onClick="cailiaohan<%=(x+1)%>.style.display=''" style="cursor:hand;">下一个产品</span><%end if%>
<%if x=1 then%><font color="#ff0000">*</font><%end if%>
<div id="showshulian<%=x%>"></div>
      </td>
</tr>
<%next%>
  </table>
</td>
      </tr>
  <tr>
    <tr>
    <td align="right" height="30">订单号:</td>
        <td class="category">
  <input name="ddan" value="<%=ddan%>" style="width:150px">
物流费:
<input type="text" name="wuliufee" id="wuliufee" value="0" onKeyUp="clearNoNum(this);" onafterpaste="clearNoNum(this);">
支付方式
<%
sql="select * from payment order by id"
set rs_login=conn.execute(sql)
  if rs_login.eof then
  %>
            <script language="javascript">
        alert("请先添加支付方式!")
        window.location.href="../system/payment.asp"
        </script>
            <%
  response.end
  else
  %>
            <select name="id_payment" id="id_payment" style="width:65px">
              <%
  do while rs_login.eof=false
  %>
              <option value="<%=rs_login("id")%>"><%=rs_login("payment")%></option>
              <%
    rs_login.movenext
  loop
  %>
            </select>
            <%
  end if
  set rs_login=nothing
  %></td>
    </tr>
        <td align="right" height="30">供应商:</td>
        <td class="category">
  <%
    sql="select * from gys order by id"
    set rs_gys=conn.execute(sql)
    %>
    <select name="id_gys">
  <option value="0"></option>
    <%
    do while rs_gys.eof=false
    %>
  <option value="<%=rs_gys("id")%>"><%=rs_gys("company")%></option>
    <%
  rs_gys.movenext
    loop
    %>
    </select></td>
      </tr>
  <tr>
        <td align="right" height="30">经办人:</td>
        <td class="category">
  <%
  if session("shiwei_id")=1 then
sql="select * from login order by id_zu,id"
set rs_login=conn.execute(sql)
  else
sql="select * from login where id="&session("shiwei_id")
set rs_login=conn.execute(sql)   
  end if
  if rs_login.eof then
  %>
      <script language="javascript">
        alert("请先添加员工!")
        window.location.href="../system/user_add.asp"
      </script>
  <%
  else
  %>
  <select name="id_login">
  <%
  do while rs_login.eof=false
  %>
    <option value="<%=rs_login("id")%>"<%if rs_login("username")=session("shiwei_username") then%> selected="selected"<%end if%>><%=rs_login("username")%> (<%=rs_login("bianhao")%>)</option>
  <%
    rs_login.movenext
  loop
  %>
  </select>
  <%
  end if
  %>
</td>
      </tr> 
<tr>
    <td height="30">&nbsp;</td>
        <td class="category">
  <input type="submit" value=" 确认添加 " onClick="return check1()" class="button">
  <input type="hidden" name="hid1" value="ok">
  <input type="reset" value=" 重新填写 " class="button">
  </td>
      </tr>
  </form>
</table>
</td>
<td></td>
</tr>
<tr>
<td><img src="../images/r_4.gif" alt="" /></td>
<td></td>
<td><img src="../images/r_3.gif" alt="" /></td>
</tr>
</table>

<table cellpadding=0 cellspacing=0 width="98%" align=center><tr><td height="5"></td></tr></table>

<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#C4D8ED">
<tr>
<td><img src="../images/r_1.gif" alt="" /></td>
<td width="100%" background="../images/r_0.gif">
  <table cellpadding="0" cellspacing="0" width="100%">
    <tr>
      <td>&nbsp;新产品入库(带*号的为必填项)</td>
  <td align="right">&nbsp;</td>
    </tr>
  </table>
</td>
<td><img src="../images/r_2.gif" alt="" /></td>
</tr>
<tr>
<td></td>
<td>
<table align="center" cellpadding="4" cellspacing="1" class="toptable grid" border="1">
  <form name="form3">
      <tr>
        <td align="right" height="30">所属大类:</td>
        <td class="category">
    <%
sql="select * from bigclass order by id"
set rs_bigclass=conn.execute(sql)
if rs_bigclass.eof then
%>
<script language="javascript">
  alert("请先添加产品大类!")
  window.location.href="../system/bigclass_add.asp"
</script>
<%
end if
nowbigclass=request("bigclass")
if nowbigclass="" then
  nowbigclass=rs_bigclass("id")
end if
%>
  <select name="bigclass" onChange="form3.submit()">
        <%
do while rs_bigclass.eof=false
%>
        <option value="<%=rs_bigclass("id")%>"<%if trim(cstr(rs_bigclass("id")))=nowbigclass then%> selected="selected"<%end if%>><%=rs_bigclass("bigclass")%></option>
        <%
  rs_bigclass.movenext
loop
%>
      </select>   
  </td>
      </tr>
  </form>
  <form name="form2"> 
  <input type="hidden" name="bigclass" value="<%=nowbigclass%>">
      <tr>
        <td align="right" height="30">所属小类:</td>
        <td class="category">
    <%
sql="select * from smallclass where id_bigclass="&nowbigclass&" order by id"
set rs_smallclass=conn.execute(sql)
%>
  <select name="smallclass">
    <option value="0"></option>
        <%
do while rs_smallclass.eof=false
%>
        <option value="<%=rs_smallclass("id")%>"<%if trim(cstr(rs_smallclass("id")))=nowsmallclass then%> selected="selected"<%end if%>><%=rs_smallclass("smallclass")%></option>
        <%
  rs_smallclass.movenext
loop
%>
      </select>  
  </td>
      </tr>    
      <tr>
        <td width="20%" height="30" align="right">商品名称:</td>
        <td width="80%" class="category">
  <input name="title" type="text" style="width:200px;">&nbsp;<font color="#ff0000">*</font></td>
      </tr>
      <tr>
        <td align="right" height="30">商品货号:</td>
        <td class="category">
          <input type="text" name="huohao" style="width:200px">&nbsp;<font color="#ff0000">*</font>
<input style="width:160"   name="checkno"   type="button"     value="点击检测淘宝条码是否存在"     onClick="javascript:check_click(this)">  

  </td>
 
      </tr>
  <tr>
        <td align="right" height="30">商品条码:</td>
        <td class="category">
          <input type="text" name="tiaoma" style="width:200px">&nbsp;</td>
      </tr>
  <tr>
      
    <td align="right" height="30">订货单号:</td>
        <td class="category">
  <input name="ddan" value="<%=ddan%>" style="width:150px">
物流费:
    <input type="text" name="wuliufee" id="wuliufee" value="0" onKeyUp="clearNoNum(this);" onafterpaste="clearNoNum(this);">
    支付方式
<%
sql="select * from payment order by id"
set rs_login=conn.execute(sql)
  if rs_login.eof then
  %>
            <script language="javascript">
        alert("请先添加支付方式!")
        window.location.href="../system/payment.asp"
        </script>
            <%
  response.end
  else
  %>
            <select name="id_payment" id="id_payment" style="width:65px">
              <%
  do while rs_login.eof=false
  %>
              <option value="<%=rs_login("id")%>"><%=rs_login("payment")%></option>
              <%
    rs_login.movenext
  loop
  %>
            </select>
            <%
  end if
  set rs_login=nothing
  %></td>
      </tr>
      <tr>
        <td align="right" height="30">加入仓库:</td>
        <td class="category">
    <%
if session("shiwei_id")=1 then
  sql="select * from ku order by id"
  set rs_ku=conn.execute(sql)
else
  sql="select * from ku where instr(login,'"&session("shiwei_id")&",')>0 order by id"
  set rs_ku=conn.execute(sql)   
end if
if rs_ku.eof then
%>
<script language="javascript">
  alert("没有属于你管理的仓库,请先添加仓库!")
  window.location.href="../system/ku_add.asp"
</script>
<%
end if
%>
  <select name="ku">
        <%
do while rs_ku.eof=false
%>
        <option value="<%=rs_ku("id")%>"<%if rs_ku("moren") then%> selected="selected"<%end if%>><%=rs_ku("ku")%></option>
        <%
  rs_ku.movenext
loop
%>
      </select>   

#3


  </td>
      </tr>   
      <tr>
        <td align="right" height="30">产品单位:</td>
        <td class="category">
    <%
sql="select * from danwei order by id"
set rs_danwei=conn.execute(sql)
if rs_danwei.eof then
%>
<script language="javascript">
  alert("请先添加单位!")
  window.location.href="../system/danwei_add.asp"
</script>
<%
end if
%>
  <select name="danwei">
        <%
do while rs_danwei.eof=false
%>
        <option value="<%=rs_danwei("danwei")%>"><%=rs_danwei("danwei")%></option>
        <%
  rs_danwei.movenext
loop
%>
      </select>
  <font color="#666666">(只用于普通识别,不能换算)</font></td>
      </tr>   
      <tr>
        <td align="right" height="30">产品价格:</td>
        <td class="category">推荐卖价:<input type="text" name="price" style="width:100px" onKeyUp="value=value.replace(/[^\d.]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d.]/g,''))">
  <font color="#666666">元</font>
   代理价:<input type="text" name="price3" style="width:100px" onKeyUp="value=value.replace(/[^\d.]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d.]/g,''))">
          <font color="#666666">元</font>
  
  进货价:<input type="text" name="price2" style="width:100px" onKeyUp="value=value.replace(/[^\d.]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d.]/g,''))">
          <font color="#666666">元</font>
 
  </td>
      </tr>
    <tr>
        <td align="right" height="30">产品详情:</td>
        <td class="category">
        <div style="width: 840px; margin: 0px auto 0;">
<div>颜色分类:<input id="sekuan" width="60" /><span class="i_color_error">*</span></div>
<div>规格型号:<input id="guige" width="60"  /><span class="i_model_error">*</span><span id="i_model_add">增加</span></div>
<table width="100%" border="1" cellpadding="4" cellspacing="1"  bordercolor="#C9DBEF" id="ctr" >
<tr>  
        <td align="center">颜色</td>  
        <td align="center">图片</td>  
        <td align="center">规格</td>  
        <td align="center">价格</td>  
        <td align="center">数量</td>
        <td align="center">仓库</td>
<td align="center">条码</td>
        <td align="center">删除</td>
    </tr>
</table> 
<script type="text/javascript">
(function($){
var color = '';
var model = '';
var bool;
var td_size = $('#ctr tr:first td').size();
var tr;
var index = 0;
var boo_index;
var rowspan;
var click_bool;
$('#i_model_add').click(function(){
bool  = false;
boo_index = true;
model = $('#guige').val().trim();
color = $('#sekuan').val().trim();
if(model == ''){
bool = true;
$('.i_model_error').show();
}
else{
$('.i_model_error').hide();
}
if(color == ''){
bool = true;
$('.i_color_error').show();
}
else{
$('.i_color_error').hide();
}
if(bool){
return false;
}
$('.sekuan').each(function(){
if($(this).html() == color){
rowspan = $(this).parent().attr('rowspan');
if(rowspan > 0){
rowspan ++;
}
else{
rowspan = 2;
}
$(this).parent().attr('rowspan',rowspan);
$(this).parent().parent().find('.pic').parent().attr('rowspan',rowspan);
tr = '<tr><td><span class="guige">' + model + '</span></td><td><input type="text" name="price2<%=x%>" /></td><td><input class="shulian" onKeyUp="this.value=this.value.replace(/\D/g,\'\') onafterpaste="this.value=this.value.replace(/\D/g,\'\') /></td><td><input type="text" name="ku" /></td><td><input class="tiaoma<%=x%>" /></td><td><span class="remove">删除</span></td></tr>';
$(this).parent().parent().after(tr);
boo_index = false;
}
});
if(boo_index){
tr = '<tr><td><span class="sekuan">' + color + '</span></td><td><input type="file" class="pic" /></td><td><span class="guige">' + model + '</span></td><td><input type="text" name="price2<%=X%>" /></td><td><input class="shulian" onKeyUp="this.value=this.value.replace(/\D/g,\'\') onafterpaste="this.value=this.value.replace(/\D/g,\'\') /></td><td><input type="text" name="ku" /></td><td><input class="<%=tiaomax%>" /></td><td><span class="remove">删除</span></td></tr>';

$('#ctr tbody').append(tr);
}
});
$('.remove').live('click',function(){
if($(this).parent().parent().find('td').size() == td_size && (!$(this).parent().parent().find('td:first').attr('rowspan') || $(this).parent().parent().find('td:first').attr('rowspan') == 1)){
$(this).parent().parent().remove();
}
if($(this).parent().parent().find('td').size() < td_size){
click_bool = true;
$(this).parent().parent().prevAll('tr').each(function(){
if(click_bool && $(this).find('td:first').attr('rowspan')){
rowspan = $(this).find('td:first').attr('rowspan');
rowspan --;
$(this).find('td:first,td:eq(1)').attr('rowspan',rowspan);
click_bool = false;
}
});
$(this).parent().parent().remove();
}
if($(this).parent().parent().find('td').size() == td_size && $(this).parent().parent().find('td:first').attr('rowspan') > 1){
rowspan = $(this).parent().parent().find('td:first').attr('rowspan');
rowspan --; 
$(this).parent().parent().next().prepend($(this).parent().parent().find('td:eq(1)').clone());
$(this).parent().parent().next().prepend($(this).parent().parent().find('td:first').clone());
$(this).parent().parent().next().find('td:first,td:eq(1)').attr('rowspan',rowspan);
$(this).parent().parent().remove();
}
});
})(jQuery);
</script>
</div></td>
      </tr>   
  <tr>
        <td align="right" height="30">产品净重:</td>
        <td class="category"><input type="text" name="jingzhong" style="width:200px"></td>
      </tr>
   <tr>
        <td align="right" height="30">装箱数量:</td>
        <td class="category"><input type="text" name="zhuangxiangshu" style="width:200px"></td>
      </tr>
      <tr>
        <td align="right" height="30">最低库存报警数量:</td>
        <td class="category"><input type="text" name="baojin" style="width:100px" onKeyUp="this.value=this.value.replace(/\D/g,'')"  onafterpaste="this.value=this.value.replace(/\D/g,'')" value="0"> 
          <font color="#666666">(设为零将不会报警)</font></td>
      </tr>   
      <tr>
        <td align="right" height="30">经办人:</td>
        <td class="category">
  <%
  if session("shiwei_id")=1 then
sql="select * from login order by id_zu,id"
set rs_login=conn.execute(sql)
  else
sql="select * from login where id="&session("shiwei_id")
set rs_login=conn.execute(sql)   
  end if
  if rs_login.eof then
  %>
      <script language="javascript">
        alert("请先添加员工!")
        window.location.href="../system/user_add.asp"
      </script>
  <%
  else
  %>
  <select name="id_login">
  <%
  do while rs_login.eof=false
  %>
    <option value="<%=rs_login("id")%>"<%if rs_login("username")=session("shiwei_username") then%> selected="selected"<%end if%>><%=rs_login("username")%> (<%=rs_login("bianhao")%>)</option>
  <%
    rs_login.movenext
  loop
  %>
  </select>
  <%
  end if
  %> </td>
      </tr>
      <tr>
        <td align="right" height="30">供应商:</td>
        <td class="category">
  <%
  sql="select * from gys order by id"
  set rs_gys=conn.execute(sql)
  %>
  <select name="id_gys">
    <option value="0"></option>
  <%
  do while rs_gys.eof=false
  %>
    <option value="<%=rs_gys("id")%>"><%=rs_gys("company")%></option>
  <%
    rs_gys.movenext
  loop
  %>
  </select>
</td>
      </tr>   
      <tr>
        <td align="right" height="30">产品类型:</td>
        <td class="category">
  <select name="class">
    <option value="0">正常产品</option>
<option value="1">公司赠品</option>
  </select>
  </td>
      </tr>
     <tr>
        <td align="right" height="30">兑换所需积分:</td>
        <td class="category">
          <input type="text" name="duihuan" style="width:100px" onKeyUp="this.value=this.value.replace(/\D/g,'')"  onafterpaste="this.value=this.value.replace(/\D/g,'')" value="0">
          <font color="#666666">(会员兑换此礼品所需积分)</font></td>
      </tr>   
      <tr>
        <td align="right" height="30">提成类型:</td>
        <td class="category">
  <select name="tichen_type" onChange="chg1(this.value)">
    <option value="0">按百分比提成</option>
<option value="1">固定提成</option>
  </select>
</td>
      </tr>     
      <tr>
        <td align="right" height="30">员工提成:</td>
        <td class="category">
  销售一件提成:<input type="text" name="tichen" style="width:50px" value="<%=jieshaojifen%>">
  <font color="#666666"><span id="bian1">%</span></font></td>
      </tr>
      <tr>
        <td align="right" height="30">产品备注:</td>
        <td class="category">
          <textarea name="beizhu" cols="60" rows="3"></textarea>
        </td>
      </tr>         
      <tr>
    <td height="30">&nbsp;</td>
        <td class="category"><input type="submit" value=" 确认添加 " onClick="return check()" class="button">&nbsp;&nbsp;&nbsp;&nbsp;
  <input type="hidden" name="hid2" value="ok">
  <input type="hidden" name="photo" value="">
  <input type="reset" value=" 重新填写 " class="button"> </td>
      </tr>
  </form>
</table>
</td>
<td></td>
</tr>
<tr>
<td><img src="../images/r_4.gif" alt="" /></td>
<td></td>
<td><img src="../images/r_3.gif" alt="" /></td>
</tr>
</table>
</body>
</html>