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

📄 b_cusdiscount.asp

📁 一个很好的在线购物系统
💻 ASP
字号:
<%
'----------			页面说明			------------
'对产品价格折扣率(按照不同的客户类别)进行调整。
'产品编码,产品名称,产品定价通过参数PRODID从产品信息表A_ProductInfo中调出
'战略客户,价值客户,一般客户的折扣价,折扣率也根据参数PRODID从客户扣率表B_Tblkhdjkl中调出
'用户可对其进行重新编辑,并保存设置。

'程序员:魏歆
%>

<!--#include file="../include/Pubconn.asp"-->


<%tzkl1=request("tzkl1")
'建立数据连接
dim conn
set conn=server.CreateObject("adodb.connection")
set conn=pubconn
%>
<%
if Request.ServerVariables("REQUEST_METHOD")="POST" then
%>
<%
'获取数据
m_prodidsave=trim(request("TCpbm"))
m_prodcodesave=trim(request("prodcode"))
m_page=trim(request("page"))
m_type=trim(request("mytype"))

if TZkl1<>"" then
	m_discountsave1=round(eval(TZkl1),2)
end if
if request("TZkl2")<>"" then
	m_discountsave2=round(eval(request("TZkl2")),2)
end if
if request("TZkl3")<>"" then
	m_discountsave3=round(eval(request("TZkl3")),2)
end if
m_remarksave=request("TBz")

if m_discountsave1="" then
	m_discountsave1=0
end if
if m_discountsave2="" then
	m_discountsave2=0
end if
if m_discountsave3="" then
	m_discountsave3=0
end if
if m_remarksave="" then
	m_remarksave=" "
end if
'保存数据
set klrs=server.createobject("adodb.recordset")
klsql= "select * from B_Tblkhdjkl where prodcode='" & m_prodidsave & "'"
klrs.open klsql,pubconn,1,3
if klrs.eof then
klrs.addnew 
    klrs.Fields("prodcode")=m_prodidsave
    klrs.Fields("discountrate1")=m_discountsave1
	klrs.Fields("discountrate2")=m_discountsave2
	klrs.Fields("discountrate3")=m_discountsave3
	klrs.Fields("remark")=m_remarksave
    klrs.update  
else

set rstsave=server.CreateObject("adodb.recordset")
if rstsave.State =1 then 
	rstsave.Close 
end if

sql="update B_Tblkhdjkl set discountrate1='"& m_discountsave1 &"',discountrate2='" & m_discountsave2 & "',discountrate3='" & m_discountsave3 & "',remark='" & m_remarksave & "' where prodcode='" & m_prodidsave & "'"
'response.write sql

set rstsave=conn.Execute(sql)
end if
'response.end
'Response.Redirect "b_CusDiscount.asp?prodcode="&m_prodidsave&"&prodid="&m_prodcodesave&"&page="&m_page&"&mytype="&m_type&""
%>
<script language="vbscript">
		window.location="B_ProductView.asp?mytype=0&page=1"
 </script>
<%else%>

<!--#include file="../include/PubCode.asp"-->

<%
'----------------通过参数PRODID调出产品名称,产品定价,成本价------------------

dim rst			'变量--记录集对象
dim m_prodid	'变量--商品编码
dim m_cpmc		'变量--产品名称
dim m_cpdj		'变量--产品定价
dim m_cbj		'变量--成本价

m_prodid=request("prodcode")
m_prodcode=request("prodid")
m_page=request("page")
m_type=request("mytype")

'调出商品名称,商品定价
set rst=server.CreateObject("adodb.recordset")
if rst.State =1 then
	rst.Close 
end if
rst.Open "select * from A_ProductInfo where prodcode='" & m_prodid & "'",conn,1,3
if rst.RecordCount >0 then
	rst.MoveFirst 
	m_cpmc=rst.Fields("prodname")
	m_cpdj=rst.Fields("saleprice")
	m_cbj=rst.Fields("costprice")
	m_cpxh=rst.fields("model")+"-"+rst("standard")
else
	m_cpmc=""
	m_cpdj=""
	m_cpxh=""
	m_cbj=""
end if
rst.close

'----------------------根据参数PRODID调出不同客户类型对应的折扣率----------------------------
dim m_discount1				
dim m_discount2				
dim m_discount3				
dim m_discountrate1			'战略客户折扣率
dim m_discountrate2			'价值客户折扣率
dim m_discountrate3			'一般客户折扣率
dim m_remark				'备注

if rst.State =1 then
	rst.Close 
end if
rst.Open "select * from B_Tblkhdjkl where prodcode='" & m_prodid & "'",conn,1,3
if	rst.RecordCount >0 then
	rst.MoveFirst 
	m_discountrate1=rst.Fields("discountrate1")
	m_discountrate2=rst.Fields("discountrate2")
	m_discountrate3=rst.Fields("discountrate3")
	m_discount1=round(cdbl(m_discountrate1*m_cpdj/100),2)
	m_discount2=round(cdbl(m_discountrate2*m_cpdj/100),2)
	m_discount3=round(cdbl(m_discountrate3*m_cpdj/100),2)
	m_remark=rst.Fields("remark")
else
	m_discountrate1=""
	m_discountrate2=""
	m_discountrate3=""
	m_discount1=""
	m_discount2=""
	m_discount3=""
	m_remark=""
end if
rst.Close 
'------------------------------------------------------------------------------------------
%>

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
<%
'--------控制“折扣价格”,“折扣率”文本框的输入为数字型-------------
%>
<script ID=clientEventHandlersVBS language="vbscript">
	sub TZkl1_onkeypress
		window.event.keyCode=PublicKeyAscii(document.form1.TZkl1.value,"Num",window.event.keyCode)
	end sub
	
	sub TZkl2_onkeypress
		window.event.keyCode=PublicKeyAscii(document.form1.TZkl2.value,"Num",window.event.keyCode)
	end sub
	
	sub TZkl3_onkeypress
		window.event.keyCode=PublicKeyAscii(document.form1.TZkl3.value,"Num",window.event.keyCode)
	end sub
	
	sub TZkl1_onkeyup
		if isnumeric(document.form1.TZkl1.value) then
			document.form1.TZkjg1.value=round(eval(document.form1.TZkl1.value*document.form1.TCpdj.value/100),2)
		end if
	end sub
	
	sub TZkl2_onkeyup
		if isnumeric(document.form1.TZkl2.value) then
			document.form1.TZkjg2.value=round(eval(document.form1.TZkl2.value*document.form1.TCpdj.value/100),2)
		end if
	end sub
	
	sub TZkl3_onkeyup
		if isnumeric(document.form1.TZkl3.value) then
			document.form1.TZkjg3.value=round(eval(document.form1.TZkl3.value*document.form1.TCpdj.value/100),2)
		end if
	end sub
</script>

<%'-----------------------------------------------------------------%>

</head>

<body bgcolor="#FFFFFF">
<center>
<form name="form1" action="B_CusDiscount.asp?prodcode=<%=m_prodcode%>&page=<%=m_page%>&mytype=<%=m_type%>" method="post">
  

<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td width="100%"><b><font size="3"><img border="0" src="../pic/it_22.gif" width="34" height="15"> 
     </font><font size="2">客户折扣</font></b><hr width="40%" size="1" align="left">                   
                         
    </td>                   
  </tr>                   
</table><br>  

<font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
单位:元</font>    
   
    
<table border="0" cellpadding="0" cellspacing="0" width="70%">        
  <tr>        
    <td width="24%" bgcolor="#F7F4E5" bordercolor="#F7F4E5" bordercolorlight="#F7F4E5" align="right" ><font size="2">产品编码&nbsp;</font></td>        
    <td width="76%" bgcolor="#F7F4E5" bordercolor="#F7F4E5" bordercolorlight="#F7F4E5" ><input type="text" name="TCpbm" size="24" readonly value=<%=m_prodid%>></td>       
  </tr>       
  <tr>       
    <td width="24%" bgcolor="#F7F4E5" bordercolor="#F7F4E5" bordercolorlight="#F7F4E5" align="right" ><font size="2">产品名称&nbsp;</font></td>       
    <td width="76%" bgcolor="#F7F4E5" bordercolor="#F7F4E5" bordercolorlight="#F7F4E5" ><input type="text" name="TCpmc" size="24" readonly value=<%=m_cpmc%>></td>       
  </tr>       
  <tr>       
    <td width="24%" bgcolor="#F7F4E5" bordercolor="#F7F4E5" bordercolorlight="#F7F4E5" align="right" ><font size="2">型号规格&nbsp;</font></td>       
    <td width="76%" bgcolor="#F7F4E5" bordercolor="#F7F4E5" bordercolorlight="#F7F4E5" ><input type="text" name="TCpmc1" size="24" readonly value=<%=m_cpxh%>></td>       
  </tr>       
  <tr>       
    <td width="24%" bgcolor="#F7F4E5" bordercolor="#F7F4E5" bordercolorlight="#F7F4E5" align="right" ><font size="2">产品定价&nbsp;</font></td>       
    <td width="76%" bgcolor="#F7F4E5" bordercolor="#F7F4E5" bordercolorlight="#F7F4E5" ><input type="text" name="TCpdj" size="24" readonly value=<%=m_cpdj%>></td>       
  </tr>       
  <tr>       
    <td width="24%" bgcolor="#F7F4E5" bordercolor="#F7F4E5" bordercolorlight="#F7F4E5" align="right" ><font size="2">成本价&nbsp;</font></td>       
    <td width="76%" bgcolor="#F7F4E5" bordercolor="#F7F4E5" bordercolorlight="#F7F4E5" ><input type="text" name="TCbj" size="24" readonly value=<%=m_cbj%>></td>       
  </tr>       
</table>       
<P></P>       
<table border="1" cellpadding="0" cellspacing="0" width="70%">       
  <tr>       
    <td width="33%" bgcolor="#DDD2C4" align="center" height="30"><font size="2"><b>客户类别</b></font></td>      
    <td width="34%" align="center" bgcolor="#DDD2C4" height="30"><font size="2"><b>折扣率%</b></font></td>        
    <td width="33%" align="center" bgcolor="#DDD2C4" height="30"><font size="2"><b>折扣价格</b></font></td>       
  </tr>       
  <tr bgcolor="#f7f7f7">       
    <td width="33%" align="center"><font size="2">战略客户</font></td>  
         
    <td width="34%" align="center"><input type="text" name="TZkl1" size="14"  value=<%=m_discountrate1%>></td>        
    <td width="33%" align="center"><input type="text" name="TZkjg1" size="14" readonly  value=<%=m_discount1%>></td>       
  </tr>       
  <tr bgcolor="#EDEBEC">       
    <td width="33%" align="center"><font size="2">价值客户</font></td>      
    <td width="34%" align="center"><input type="text" name="TZkl2" size="14"  value=<%=m_discountrate2%>></td>        
    <td width="33%" align="center"><input type="text" name="TZkjg2" size="14" readonly  value=<%=m_discount2%>></td>       
  </tr>       
  <tr bgcolor="#f7f7f7">       
    <td width="33%" align="center"><font size="2">一般客户</font></td>       
    <td width="34%" align="center"><input type="text" name="TZkl3" size="14"  value=<%=m_discountrate3%>></td>       
    <td width="33%" align="center"><input type="text" name="TZkjg3" size="14" readonly  value=<%=m_discount3%>></td>       
  </tr>       
</table>       
<P></P>     
<table border="0" cellpadding="0" cellspacing="1" width="67%">      
  <tr>      
    <td width="24%"><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 备&nbsp; 注</font></td>      
    <td width="76%"><input type="text" name="TBz" size="33"  value=<%=m_remark%>></td>      
  </tr>      
</table>      
</center>       
<p align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="submit" value="保存" name="B1" class=hand style="background-color: #D1D1D1; border-style: solid; border-width: 1">    
&nbsp; <A href="B_ProductView.asp?prodcode=<%=m_prodcode%>&page=<%=m_page%>&mytype=<%=m_type%>"><font size="2">返回</font></A>       
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        
</p>          
          
</form>          
</body>          
          
</html>         
          
<%end if%>         
         
<%         
'回收内存         
set rst=nothing         
set rstsave=nothing         
conn.Close()         
'------------------------------------------------------------------------------------------         
%>

⌨️ 快捷键说明

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