⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 buy_modi.asp

📁 不错的进销存管理系统。功能比较全
💻 ASP
字号:
<%
if session("yida_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 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
set rs_id=conn.execute("select * from buy where id="&request("id"))
nowselldate=request("selldate")
nowbeizhu=request("beizhu")
nowid_login=request("id_login")
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")
nowbianhao=rs_id("bianhao")

'-------------------------
  set rs=conn.execute("select * from buy where bianhao='"&rs_id("bianhao")&"' and zu=false")
  do while rs.eof=false
    conn.execute("update produit set shulian=shulian-"&rs("shulian")&" where huohao='"&rs("huohao")&"' and id_ku="&rs("id_ku"))
    rs.movenext
  loop
  sql="delete from buy where bianhao='"&rs_id("bianhao")&"'"
  conn.execute(sql)
'-------------------------

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)
nowprice2=request("price2"&x)
if nowprice2="" then
  nowprice2=0
end if
if nowhuohao<>"单击选择产品" and nowshulian<>"" then
set rs_produit=conn.execute("select * from produit where huohao='"&nowhuohao&"'")
set rs_prix=conn.execute("select sum(shulian) from produit where huohao='"&nowhuohao&"'")
if rs_prix(0)+nowshulian>0 then
nowpinprice2=(rs_prix(0)*rs_produit("price2")+nowprice2*nowshulian)/(rs_prix(0)+nowshulian)
else
nowpinprice2=rs_produit("price2")
end if
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("id_ku")=nowku
  rs("shulian")=nowshulian
  rs("danwei")=rs_produit("danwei")
  rs("price")=rs_produit("price")
  rs("price2")=nowpinprice2
  rs("guige")=rs_produit("guige")
  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("beizhu")=rs_produit("beizhu")
else
  rs("shulian")=rs("shulian")+nowshulian
  rs("price2")=nowpinprice2 
end if
rs.update

set rs2=server.createobject("ADODB.RecordSet")
sql="select * from produit where huohao='"&nowhuohao&"'"
rs2.open sql,conn,1,3
do while rs2.eof=false
rs2("price2")=nowpinprice2
rs2.movenext
loop

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
sql="insert into buy(id_produit,bigclass,smallclass,title,huohao,id_ku,ku,shulian,guige,id_login,login,type,selldate,price2,photo,id_gys,gys,bianhao,beizhu) 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,#"&nowselldate&"#,"&nowprice2&",'"&rs_produit("photo")&"',"&nowid_gys&",'"&nowgys&"','"&nowbianhao&"','"&nowbeizhu&"')"
conn.execute(sql)
end if
next
sql="insert into buy(shulian,id_login,login,type,selldate,price2,id_gys,gys,bianhao,zu,beizhu) values("&totalshulian&","&nowid_login&",'"&rs_login("username")&"',0,#"&nowselldate&"#,"&totalprice2&","&nowid_gys&",'"&nowgys&"','"&nowbianhao&"',true,'"&nowbeizhu&"')"
conn.execute(sql)
%>
<script language="javascript">
alert("订单修改成功!")
window.opener.location.reload();
window.close();
</script>
<%
response.end
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.shulian1.value=="")
{
alert("请输入数量!");
return false;
}
}
</script>
<%
set rs=conn.execute("select * from buy where id="&request("id"))
set rs_buy=conn.execute("select * from buy where bianhao='"&rs("bianhao")&"' and zu=false")
%>
<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">
	  <input type="hidden" name="id" value="<%=request("id")%>">
      <tr>
        <td width="20%" align="right" height="30">产品列表:</td>
        <td width="80%" class="category">
          <table cellpadding="0" cellspacing="0" width="100%" border=0>
		    <%
			y=0
			do while rs_buy.eof=false
			  y=y+1
			%>
		    <tr id="cailiaohan<%=y%>">
			  <td>
			    <input name="huohao<%=y%>" readonly onClick="JavaScript:window.open('produit1.asp?form=form1&field=huohao<%=y%>&field2=price2<%=y%>&span1=showshulian<%=y%>','','directorys=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=853,height=470,top=176,left=161');" style="width:80px" value="<%=rs_buy("huohao")%>">
				数量: <input type="text" name="shulian<%=y%>" style="width:30px" onKeyUp="value=value.replace(/[^\d.]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d.]/g,''))" value="<%=rs_buy("shulian")%>">
				单价: <input type="text" name="price2<%=y%>" style="width:50px" onKeyUp="value=value.replace(/[^\d.]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d.]/g,''))" value="<%=rs_buy("price2")%>">
				<%
				if session("shiwei_id")="1" or fla88="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>
				<%
				response.end
				end if
				%>
				仓库: <select name="ku<%=y%>">
				<%
				do while rs_ku.eof=false
				%>
			      <option value="<%=rs_ku("id")%>"<%if rs_ku("id")=rs_buy("id_ku") then%> selected="selected"<%end if%>><%=rs_ku("ku")%></option>
				<%
				  rs_ku.movenext
				loop
				%>
				</select>
				<%if y<>maxproduit then%><span onClick="cailiaohan<%=(y+1)%>.style.display=''" style="cursor:hand;">下一个产品</span><%end if%>	
				<%if y<>1 then%><input type="button" value="清除" onClick="huohao<%=y%>.value='单击选择产品';shulian<%=y%>.value='1';price2<%=y%>.value=''" class="button"><%end if%>							
				<div id="showshulian<%=y%>"></div>
		      </td>
			</tr>		
			<%
			  rs_buy.movenext
			loop
			%>
		    <%for x=(y+1) to maxproduit%>
		    <tr id="cailiaohan<%=x%>" style="display:none;">
			  <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="单击选择产品">
				数量: <input type="text" name="shulian<%=x%>" style="width:30px" onKeyUp="value=value.replace(/[^\d.]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d.]/g,''))" value="1">
				单价: <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" or fla88="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>
				<%
				response.end
				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%><input type="button" value="清除" onClick="huohao<%=x%>.value='单击选择产品';shulian<%=x%>.value='1';price2<%=x%>.value=''" class="button"><%end if%>
				<div id="showshulian<%=x%>"></div>
		      </td>
			</tr>		
			<%next%>		
		  </table>
		</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")%>"<%if rs_gys("id")=rs("id_gys") then%> selected="selected"<%end if%>><%=rs_gys("company")%></option>
			    <%
				  rs_gys.movenext
			    loop
			    %>
			    </select>		
		</td>
      </tr>
	  <tr>
	    <td align="right" height="30">入库时间:</td>
        <td class="category">
		  <input name="selldate" value="<%=rs("selldate")%>" readonly style="width:150px">
		  <img src="../images/date.gif" align="absmiddle" style="cursor:pointer;" onClick="JavaScript:window.open('day.asp?form=form1&field=selldate&oldDate='+selldate.value,'','directorys=no,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,width=250,height=170,top=200,left=520');">
		</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>
		  <%
		  response.end
		  else
		  %>
		  <select name="id_login">
		  <%
		  do while rs_login.eof=false
		  %>
		    <option value="<%=rs_login("id")%>"<%if rs_login("id")=rs("id_login") 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">
		  <textarea name="beizhu" cols="60" rows="3"><%=rs("beizhu")%></textarea>
		</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>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -