| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 718 人关注过本帖
标题:asp增加一个产品选择功能 去掉循环 不知道有哪位好心人帮忙解决
只看楼主 加入收藏
dyw123
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2013-3-27
收藏
 问题点数:0 回复次数:0 
asp增加一个产品选择功能 去掉循环 不知道有哪位好心人帮忙解决
<%
if session("baipu_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">
<style>
body {
    background-color:#FFFFFF;
}
</style>
</HEAD>

<BODY>
<%
if fla46="0" and session("baipu_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")
set rs_login=conn.execute("select * from login where id="&nowid_login)
nowid_dgs=request("id_dgs")
nowdgs=""
set rs_dgs=conn.execute("select * from dgs where id="&nowid_dgs)
if rs_dgs.eof=false then nowdgs=rs_dgs("company")
nowhuiyuan=request("huiyuan")
if nowhuiyuan="" then
  nowhuiyuan=0
end if
nowbianhao=replace(replace(replace(replace(replace(replace(FormatDateTime(now(),0),":","")," ",""),"-",""),"/",""),"上午",""),"下午","")


totalshulian=0
totalprice=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

if nowhuohao<>"单击选择产品" and nowshulian<>"" then
set rs_produit=conn.execute("select * from produit where huohao='"&nowhuohao&"'")
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
%>
<script language="javascript">
alert("<%=rs_ku("ku")%> 中没有产品 <%=rs_produit("title")%>!")
window.history.go(-1)
</script>
<%
  response.end
  exit for
elseif rs("shulian")-nowshulian<0 then
%>
<script language="javascript">
alert("<%=rs_ku("ku")%> 中 <%=rs_produit("title")%> 库存不足!")
window.history.go(-1)
</script>
<%
  response.end
  exit for
end if
end if
next


totalshulian=0
totalprice=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

if nowhuohao<>"单击选择产品" and nowshulian<>"" then
set rs_produit=conn.execute("select * from produit where huohao='"&nowhuohao&"'")
set rs=server.createobject("ADODB.RecordSet")
sql="select * from produit where huohao='"&nowhuohao&"' and id_ku="&nowku
rs.open sql,conn,1,3
rs("shulian")=rs("shulian")-nowshulian
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
totalprice=totalprice+nowprice*nowshulian
totalprice2=totalprice2+rs_produit("price2")*nowshulian
sql="insert into sell(id_produit,bigclass,smallclass,title,huohao,id_ku,ku,shulian,guige,id_login,login,type,selldate,price,price2,class,tichen,id_huiyuan,photo,bianhao,id_dgs,dgs) values("&rs_produit("id")&",'"&rs_bigclass(0)&"','"&smallclass&"','"&rs_produit("title")&"','"&nowhuohao&"',"&rs_ku("id")&",'"&rs_ku("ku")&"',"&nowshulian&",'"&rs_produit("guige")&"',"&nowid_login&",'"&rs_login("username")&"',0,#"&date()&"#,"&nowprice&","&rs_produit("price2")&","&rs_produit("class")&","&rs_produit("tichen")&","&nowhuiyuan&",'"&rs_produit("photo")&"','"&nowbianhao&"',"&nowid_dgs&",'"&nowdgs&"')"
conn.execute(sql)
end if
next
if nowhuiyuan<>0 then
  conn.execute("update huiyuan set jifen=jifen+"&totalprice&" where id="&nowhuiyuan)
end if
sql="insert into sell(title,shulian,id_login,login,type,selldate,price,price2,id_huiyuan,bianhao,zu,id_dgs,dgs) values('"&rs_produit("title")&"',"&totalshulian&","&nowid_login&",'"&rs_login("username")&"',0,#"&date()&"#,"&totalprice&","&totalprice2&","&nowhuiyuan&",'"&nowbianhao&"',true,"&nowid_dgs&",'"&nowdgs&"')"
conn.execute(sql)
%>
<script language="javascript">
alert("产品销售成功!")
</script>
<%if dayin2="yes" then%>
<script language="javascript">
window.open('print_sell.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 check1()
{
if (document.form1.huohao1.value=="单击选择产品")
{
alert("还没有选择产品!");
return false;
}

if (document.form1.shulian1.value=="")
{
alert("请输入数量!");
return false;
}

}
</script>

<script language="javascript">
function chg(objName, objName2, zekou)
{
    var obj;
    obj = document.getElementById(objName);
    obj2 = document.getElementById(objName2);
    temp = obj2.value*zekou
    //obj.value = temp.toFixed(2)
    obj.value = Math.round(temp*100)/100
}
</script>

<script language="javascript">
function heji()
{
    var temp;
    temp = 0;
    //obj.value = temp.toFixed(2)
    for (i=1;i<=<%=maxproduit%>;i++)
    {
        obj = document.getElementById('shulian'+i);
        //alert(obj.value);
        obj2 = document.getElementById('price'+i);
        temp=temp+obj.value*obj2.value;
    }
    document.all.heji.innerHTML = Math.round(temp*100)/100
}
</script>

<script language="javascript">
function chg(objName, objName2, zekou)
{
    var obj;
    obj = document.getElementById(objName);
    obj2 = document.getElementById(objName2);
    temp = obj2.value*zekou
    //obj.value = temp.toFixed(2)
    obj.value = Math.round(temp*100)/100
}
</script>

<%
sql="select * from produit"
set rs=conn.execute(sql)
%>

<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('produit2.asp?form=form1&field=huohao<%=x%>&field2=price<%=x%>&field3=hidprice<%=x%>&field4=price<%=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="price<%=x%>" style="width:50px" onKeyUp="value=value.replace(/[^\d.]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d.]/g,''))">&nbsp;  
                        
                <input type="hidden" name="hidprice<%=x%>">
                折扣:<input type="text" onChange="chg('price<%=x%>','hidprice<%=x%>',this.value)" style="width:50px">折
                  
                <%
                if session("baipu_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("baipu_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.asp"
                </script>
                <%
                end if
                %>
                仓库: <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>
        <td align="right" height="30">选择产品2:</td>
        <td 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('produit2.asp?form=form1&field=huohao<%=x%>&field2=price<%=x%>&field3=hidprice<%=x%>&field4=price<%=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="price<%=x%>" style="width:50px" onKeyUp="value=value.replace(/[^\d.]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d.]/g,''))">
                &nbsp;
                          <input type="hidden" name="hidprice<%=x%>">
                折扣:
                <input type="text" onChange="chg('price<%=x%>','hidprice<%=x%>',this.value)" style="width:50px">
               
                <%
                if session("baipu_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("baipu_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.asp"
                </script>
                <%
                end if
                %>
                仓库:
                <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>
        <td align="right" height="30">合计金额:</td>
        <td class="category">
          <input type="button" value="计算合计金额" onClick="heji();" class="button3">&nbsp;
          <span id="heji"></span>        </td>
      </tr>
      
      
      
      <tr>
        <td align="right" height="30">订购商:</td>
        <td class="category">
              <%
                sql="select * from dgs order by id"
                set rs_dgs=conn.execute(sql)
                %>
              <select name="id_dgs">
                <option value="0"></option>
                <%
                do while rs_dgs.eof=false
                %>
                <option value="<%=rs_dgs("id")%>"><%=rs_dgs("company")%></option>
                <%
                  rs_dgs.movenext
                loop
                %>
              </select></td>
      </tr>  
      
      
      
      <tr>
        <td align="right" height="30">经办人:</td>
        <td class="category">
          <%
          if session("baipu_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("baipu_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("baipu_username") then%> selected="selected"<%end if%>><%=rs_login("username")%> </option>
            <%
            rs_login.movenext
          loop
          %>
            </select>
          <%
          end if
          %>        </td>
      </tr>
      <tr>
        <td align="right" height="30">&nbsp;</td>
        <td class="category"><input name="submit" type="submit" class="button" onClick="return check1()" value=" 确认添加 ">
  &nbsp;&nbsp;&nbsp;&nbsp;
  <input name="reset" type="reset" class="button2" value=" 重置 ">
  &nbsp;&nbsp;&nbsp;&nbsp;
  <input type="hidden" name="hid1" value="ok">
  <input type="hidden" name="id" value="<%=request("id")%>"></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>
搜索更多相关主题的帖子: include html 产品 style 
2013-03-27 14:09
快速回复:asp增加一个产品选择功能 去掉循环 不知道有哪位好心人帮忙解决
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.061945 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved