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

📄 b_activediscount.asp

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

'程序员:魏歆
%>

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


<%
'建立数据连接
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"))

m_yearsave1=trim(request("XYear1"))
m_yearsave2=trim(request("XYear2"))
m_monthsave1=trim(request("XMonth1"))
m_monthsave2=trim(request("XMonth2"))
m_daysave1=trim(request("XDay1"))
m_daysave2=trim(request("XDay2"))

m_datesave1=m_yearsave1&"-"&m_monthsave1&"-"&m_daysave1
m_datesave2=m_yearsave2&"-"&m_monthsave2&"-"&m_daysave2



if request("TDiscountrate")<>"" then
	m_discountratesave=round(eval(request("TDiscountrate")),2)
else
	m_discountratesave=0
end if

if request("TRemark")<>"" then
	m_remarksave=trim(request("TRemark"))
else
	m_remarksave=" "
end if


'保存数据
set klrs=server.createobject("adodb.recordset")
klsql= "select * from B_Tblcxdjkl where prodcode='" & m_prodidsave & "'"
'response.write klsql
klrs.open klsql,pubconn,1,3
if klrs.eof then
klrs.addnew 
    klrs.Fields("prodcode")=m_prodidsave
    klrs.Fields("discountrate")=m_discountratesave
    klrs.Fields("begindate")=m_datesave1
	klrs.Fields("enddate")=m_datesave2
	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_Tblcxdjkl set discountrate='"& m_discountratesave &"',begindate='" & m_datesave1 & "',enddate='" & m_datesave2 & "',remark='" & m_remarksave & "' where prodcode='" & m_prodidsave & "'"
set rstsave=conn.Execute(sql)
'Response.Redirect "b_ActiveDiscount.asp?prodcode="&m_prodidsave&"&prodid="&m_prodcodesave&"&page="&m_page&"&mytype="&m_type&""

end if%>

<script language="vbscript">
		window.location="B_ProductView.asp?mytype=1&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")
else
	m_cpmc=""
	m_cpdj=""
	m_cbj=""
end if
rst.close

'----------------------根据参数PRODID调出对应的折扣率,促销时间段----------------------------


if rst.State =1 then
	rst.Close 
end if
rst.Open "select * from B_Tblcxdjkl where prodcode='" & m_prodid & "'",conn,1,3
if	rst.RecordCount >0 then
	rst.MoveFirst 
	m_date1=rst.Fields("begindate")
	m_date2=rst.Fields("enddate")
	m_discountrate=rst.Fields("discountrate")
	m_discount=round(eval(m_discountrate*m_cpdj/100),2)
	m_remark=rst.Fields("remark")
	if len(m_date1)>=10 then
		m_year1=left(m_date1,4)
		m_month1=mid(m_date1,6,2)
		m_day1=right(m_date1,2)
	else
		m_year1=""
		m_month1=""
		m_day1=""
	end if
	
	if len(m_date2)>=10 then
		m_year2=left(m_date2,4)
		m_month2=mid(m_date2,6,2)
		m_day2=right(m_date2,2)
	else
		m_year2=""
		m_month2=""
		m_day2=""
	end if
else
	m_date1=""
	m_date2=""
	m_discountrate=""
	m_discount=""
	m_remark=""
	m_year1=""
	m_month1=""
	m_day1=""
	m_year2=""
	m_month2=""
	m_day2=""
end if
rst.Close 
'------------------------------------------------------------------------------------------
%>

<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<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>
<link href="../cread.css" rel="stylesheet" type="text/css">
<script ID=clientEventHandlersVBS language="vbscript">
	sub TDiscountrate_onkeypress
		window.event.keyCode=PublicKeyAscii(document.form1.TDiscountrate.value,"Num",window.event.keyCode)
	end sub
	
	sub TDiscountrate_onkeyup
		if isnumeric(document.form1.TDiscountrate.value) then
			document.form1.TDiscount.value=round(eval(document.form1.TDiscountrate.value*document.form1.TCpdj.value/100),2)
		end if
	end sub
	
</script>

</head>

<body bgcolor="#FFFFFF">
<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"> 
      </font><font size="2">按促销折扣</font></b><hr width="40%" size="1" align="left">         
               
    </td>         
  </tr>         
</table>    
<center>  
  
<form name="form1" action="B_ActiveDiscount.asp?prodcode=<%=m_prodcode%>&page=<%=m_page%>&mytype=<%=m_type%>" method="post">  
<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;   
单位:元</font>  
  
<table border="1" cellpadding="0" cellspacing="0" width="60%">   
  <tr>   
    <td width="25%" bgcolor="#F7F4E5" align="right" height="35" bordercolor="#F7F4E5" bordercolorlight="#F7F4E5"><font size="2">产品编码</font></td>   
    <td width="25%" bgcolor="#F7F4E5" height="35" bordercolor="#F7F4E5" bordercolorlight="#F7F4E5"><b><font size="2"><input type="text" name="TCpbm" size="12" readonly value=<%=m_prodid%>></font></b></td>   
    <td width="25%" bgcolor="#F7F4E5" align="right" height="35" bordercolor="#F7F4E5" bordercolorlight="#F7F4E5"><font size="2">产品名称</font></td>   
    <td width="25%" bgcolor="#F7F4E5" height="35" bordercolor="#F7F4E5" bordercolorlight="#F7F4E5"><b><font size="2"><input type="text" name="TCpmc" size="12" readonly value=<%=m_cpmc%>></font></b></td>   
  </tr>   
  <tr bgcolor="ffffdf">   
    <td width="25%" bgcolor="#F7F4E5" align="right" height="35" bordercolor="#F7F4E5" bordercolorlight="#F7F4E5"><font size="2">产品定价</font></td>   
    <td width="25%" bgcolor="#F7F4E5" height="35" bordercolor="#F7F4E5" bordercolorlight="#F7F4E5"><b><font size="2"><input type="text" name="TCpdj" size="12" readonly value=<%=m_cpdj%>></font></b></td>   
    <td width="25%" bgcolor="#F7F4E5" align="right" height="35" bordercolor="#F7F4E5" bordercolorlight="#F7F4E5"><font size="2">成本价</font></td>   
    <td width="25%" bgcolor="#F7F4E5" height="35" bordercolor="#F7F4E5" bordercolorlight="#F7F4E5"><b><font size="2"><input type="text" name="TCbj" size="12" readonly value=<%=m_cbj%>></font></b></td>   
  </tr>   
  <tr bgcolor="e2f2ee">   
    <td width="25%" bgcolor="#F7F4E5" align="right" height="35" bordercolor="#F7F4E5" bordercolorlight="#F7F4E5"><font size="2">开始日期</font></td>   
    <td width="10%" colspan="3" bgcolor="#F7F4E5" height="35" bordercolor="#F7F4E5" bordercolorlight="#F7F4E5"><font size="2">   
    <b>   
    <select size="1" name="XYear1" style="width:60">   
    <option selected value="">---- <%for i=1999 to 2020%> <%if trim(m_year1)=cstr(i) then%>  
			<option selected value=<%=cstr(i)%>><%=i%> <%else%>  
			<option value=<%=cstr(i)%>><%=i%> <%end if%> <%next%>   
    </select> </b>年<b> <select size="1" name="XMonth1" style="width:40"> 
    <%if m_month1="" then%>     
    <option selected value="">--</option>      
    <%else
   if len(m_month1)=1 then
  m_month1="0"&m_month1
  end if %>  
			<option selected value=<%=m_month1%>><%=m_month1%></option>       
     <%end if
     for i=1 to 12  
                if i<=9 then 
                i="0"&i 
                
                end if%>   
                <option value=<% =i%>> <% =i %> </option>  
                <%next
                    %>      
    </select> </b>月<b> <select size="1" name="XDay1" style="width:40">
    <%if m_day1="" then%>   
    <option selected value="">-- 
      <%else
    if len(m_day1)=1 then
    m_day1="0"&m_day1
    end if%>      
		<option selected value=<%=m_day1%>><%=m_day1%>      
		      
    <%end if
     for i=1 to 31  
                if i<=9 then 
                i="0"&i 
                end if%>                   
                <option value=<% =i %>> <% =i%> </option>  
                <%next
                 %>      
    </select> </b>日<b> </b></font></td>       
  </tr>       
  <tr bgcolor="ffffdf">       
    <td width="25%" bgcolor="#F7F4E5" align="right" height="35" bordercolor="#F7F4E5" bordercolorlight="#F7F4E5"><font size="2">截止日期</font></td>       
    <td width="10%" colspan="3" bgcolor="#F7F4E5" height="35" bordercolor="#F7F4E5" bordercolorlight="#F7F4E5"><font size="2">       
    <b>       
    <select size="1" name="XYear2" style="width:60">       
    <option selected value="">---- <%for i=1999 to 2020%> <%if trim(m_year2)=cstr(i) then%>   
			<option selected value=<%=cstr(i)%>><%=i%> <%else%>   
			<option value=<%=cstr(i)%>><%=i%> <%end if%> <%next%>    
    </select> </b>年<b>  <select size="1" name="XMonth2" style="width:40"> 
    <%if m_month2="" then%>     
    <option selected value="">--</option>      
    <%else
   if len(m_month2)=1 then
  m_month2="0"&m_month2
  end if %>  
			<option selected value=<%=m_month2%>><%=m_month2%></option>       
     <%end if
     for i=1 to 12  
                if i<=9 then 
                i="0"&i 
                
                end if%>   
                <option value=<% =i%>> <% =i %> </option>  
                <%next
                    %>      
    </select>
    </b>月<b> <select size="1" name="XDay2" style="width:40">
    <%if m_day2="" then%>   
    <option selected value="">-- 
      <%else
    if len(m_day2)=1 then
    m_day2="0"&m_day2
    end if%>      
		<option selected value=<%=m_day2%>><%=m_day2%>      
		      
    <%end if
     for i=1 to 31  
                if i<=9 then 
                i="0"&i 
                end if%>                   
                <option value=<% =i %>> <% =i%> </option>  
                <%next
                 %>      
    </select> </b>日<b> </b></font></td>       
  </tr>       
        
  <tr bgcolor="ffffdf">       
    <td width="25%" bgcolor="#F7F4E5" align="right" height="35" bordercolor="#F7F4E5" bordercolorlight="#F7F4E5"><font size="2">折扣率%</font></td>       
    <td width="75%" colspan="3" bgcolor="#F7F4E5" height="35" bordercolor="#F7F4E5" bordercolorlight="#F7F4E5"><b><font size="2"><input type="text" name="TDiscountrate" size="40" value=<%=m_discountrate%>></font></b></td>       
  </tr>  
  <tr bgcolor="e2f2ee">       
    <td width="25%" bgcolor="#F7F4E5" align="right" height="35" bordercolor="#F7F4E5" bordercolorlight="#F7F4E5"><font size="2">折扣价格</font></td>       
    <td width="75%" colspan="3" bgcolor="#F7F4E5" height="35" bordercolor="#F7F4E5" bordercolorlight="#F7F4E5"><b><font size="2"><input type="text" name="TDiscount" size="40" readonly value=<%=m_discount%>></font></b></td>       
  </tr>      
  <tr bgcolor="e2f2ee">       
    <td width="25%" bgcolor="#F7F4E5" align="right" height="35" bordercolor="#F7F4E5" bordercolorlight="#F7F4E5"><font size="2">备注</font></td>      
    <td width="75%" colspan="3" bgcolor="#F7F4E5" height="35" bordercolor="#F7F4E5" bordercolorlight="#F7F4E5"><b><font size="2"><input type="text" name="TRemark" size="40" value=<%=m_remark%>></font></b></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;&nbsp;  
<A href="B_ProductView.asp?prodcode=<%=m_prodcode%>&page=<%=m_page%>&mytype=<%=m_type%>"><font size="2">返回</font></A>    
  
</p>    
    
</form>    
</body>    
    
</html>    
    
<%end if%>    
    
<%    
'回收内存    
set rst=nothing    
set rstsave=nothing    
conn.Close()     
%>

⌨️ 快捷键说明

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