if session("username")="" then
%>
top.location.href="../login.asp"
response.end
end if
%>
- 积分兑换礼物
if fla4="0" then
%>
你不具备此权限,请与管理员联系!
response.end
end if
%>
if request("hid1")="ok" then
nowku=request("ku")
nowhuohao=request("huohao")
nowshulian=request("shulian")
nowjifen=request("jifen")
nowhuiyuan=request("huiyuan")
if nowhuiyuan="" then
nowhuiyuan=0
end if
nowid_login=request("id_login")
set rs_login=conn.execute("select * from login where id="&nowid_login)
set rs_huiyuan=conn.execute("select * from huiyuan where id="&nowhuiyuan)
set rs_ku=conn.execute("select ku from ku where id="&nowku)
set rs_produit=conn.execute("select * from produit where huohao='"&nowhuohao&"'")
set rs_bigclass=conn.execute("select bigclass from bigclass where id="&rs_produit("id_bigclass"))
set rs_smallclass=conn.execute("select smallclass from smallclass where id="&rs_produit("id_smallclass"))
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
%>
alert(" 中没有此产品!")
window.history.go(-1)
response.end
elseif rs("shulian")-nowshulian %>
alert(" 库存不足!")
window.history.go(-1)
response.end
elseif rs_huiyuan("jifen")-rs_produit("duihuan")*nowshulian %>
alert(" 积分不足!")
window.history.go(-1)
response.end
else
rs("shulian")=rs("shulian")-nowshulian
end if
rs.update
rs.close
if nowhuiyuan0 then
conn.execute("update huiyuan set jifen=jifen-"&rs_produit("duihuan")*nowshulian&" where id="&nowhuiyuan)
end if
sql="insert into sell(id_produit,bigclass,smallclass,title,huohao,ku,shulian,guige,id_login,type,selldate,id_huiyuan,login,price) values("&rs_produit("id")&",'"&rs_bigclass(0)&"','"&rs_smallclass(0)&"','"&rs_produit("title")&"','"&nowhuohao&"','"&rs_ku(0)&"',"&nowshulian&",'"&rs_produit("guige")&"',"&nowid_login&",3,#"&date()&"#,"&nowhuiyuan&",'"&rs_login("username")&"',"&rs_produit("duihuan")&")"
conn.execute(sql)
%>
alert("兑换礼物成功!");
window.close();
window.opener.location.reload();
response.end
end if
%>
function check()
{
if (document.form1.huohao.value=="单击选择产品"||document.form1.shulian.value=="")
{
alert("有*号的必须填写!");
return false;
}
}
兑换礼物 (共有 积分)
产品销售 (带*号的为必填项)
出货仓库:
sql="select * from ku order by id"
set rs_ku=conn.execute(sql)
if rs_ku.eof then
%>
alert("请先添加仓库!")
window.location.href="../system/ku_add.asp"
end if
%>
do while rs_ku.eof=false
%>
rs_ku.movenext
loop
%>
选择产品:
*
兑换数量:
*
兑换一个所需积分:
0
经办人:
sql="select * from login order by id"
set rs_login=conn.execute(sql)
if rs_login.eof then
%>
alert("请先添加员工!")
window.location.href="../system/user_add.asp"
else
%>
do while rs_login.eof=false
%>
rs_login.movenext
loop
%>
end if
%>