<!--#include file="conn.asp"-->
<!--#include file="adminset.asp"-->
<%if session("admin")="" then
response.Write "<script language='javascript'>alert('网络超时或您还没有登陆！');window.location.href='login.asp';</script>"
response.End
end if
if session("flag")>1 then
response.Write "<div align=center><font size=80 color=red><b>您没有此项目管理权限！</b></font></div>"
response.End
end if
if qx1<>1 then
response.Write "<div align=center><font size=80 color=red><b>您没有此项目管理权限！</b></font></div>"
response.End
end if

dim zhkid,order,zhkname,i,px
if request("action")="update" then
    for i=1 to request.form("zhkid").count
	zhkid=replace(request.form("zhkid")(i),"'","")
	order=replace(request.form("order")(i),"'","")
	zhkname=replace(request.form("zhkname")(i),"'","")
	px=replace(request.form("px")(i),"'","")
	if replace(request.form("order")(i),"'","")="" then
%>
<script language=javascript>
history.back()
alert("请填写折扣比例！")
</script>
<%
		Response.End
	end if
conn.execute("update shop_zhk set [order]="&order&",zhkname='"&zhkname&"',px="&px&" where id="&zhkid)
'Set rs = Server.CreateObject("ADODB.Recordset")
'rs.open "select * From shop_zhk",conn,1,3
'rs("zhkname")=zhkname
'rs("order")=order
'rs("px")=px
'rs.update

 next
' rs.close
'set rs=nothing
conn.close
set conn=nothing
response.write "<p align=center><font color=red>折扣设置成功!<br>2秒钟后返回上页!</font>"
response.write "<meta http-equiv=""refresh"" content=""2;url=zhekou_manage.asp"">"
end if


if request("action")="add" then
	zhkname=trim(request("zhkname"))
	order=request.form("order")
	px=request.form("px")
	If zhkname="" Then
		response.write "折扣不能为空！请<a href=javascript:history.go(-1)>返回重新填写</a>！"
		response.end
	end if
	If order="" Then
		response.write "比例不能为空！请<a href=javascript:history.go(-1)>返回重新填写</a>！"
		response.end
	end if
		If px="" Then
		response.write "比例不能为空！请<a href=javascript:history.go(-1)>返回重新填写</a>！"
		response.end
	end if
Set rs = Server.CreateObject("ADODB.Recordset")
rs.open "select * From shop_zhk",conn,1,3
rs.addnew
rs("zhkname")=zhkname
rs("order")=order
rs("px")=px
rs.update
rs.close
set rs=nothing

conn.close
set conn=nothing
response.write "<p align=center><font color=red>折扣添加成功!<br>2秒钟后返回上页!</font>"
response.write "<meta http-equiv=""refresh"" content=""2;url=zhekou_manage.asp"">"
end if
%>