<!--#include file="admin_start.asp"-->
<%
dim id
dim ids
dim n_ids
dim name

name=request("customer_name")
id=request("id")
ids=request("ids")
ids=replace(ids," ","")
n_ids=""

if request("action")="add" then

if not MySys.check.isInteger(replace(request("customer_count_sum"),"-","")) then
   MySys.Error.info = "请填入数字！"
   MySys.Error.location = "back"
   MySys.Error.err()
End If

rs.open"select customer_id from jins_customer_list where customer_reg_name='"&name&"' ",conn,1,1
if rs.eof then
   MySys.Error.info = "不存在此用户！"
   MySys.Error.location = "back"
   MySys.Error.err()
End If
rs.close
end if

if not MySys.check.isInteger(id) and request("action")="edit" then
MySys.error.info="请选择您要操作的积分操作记录！"
MySys.error.location="back"
MySys.error.err()
end if

select case request("action")
case "delete"
	if ids="" then
		MySys.error.info="请选择你要删除的积分操作记录！"
		MySys.error.location="back"
		MySys.error.err()
	else

		conn.execute("delete from jins_customer_count_list where customer_count_id in ("&ids&") ")
		
		MySys.error.info="删除积分操作记录成功！"
		if request("back")=1 then MySys.error.location="javascript:opener.history.back(-1);window.close();"
		if request("back")=2 then MySys.error.location="javascript:opener.location.reload();window.close();"
		if request("back")="" then MySys.error.location="back"
		MySys.error.suc()
	end if
	
case else

	if request("action")="add" then
	    sql="select * from jins_customer_count_list  where customer_name='"&name&"' "
	else
	    sql="select * from jins_customer_count_list  where customer_count_id="&id&""
	end if
	
	rs.open sql,conn,1,3
	
	'/////////////////////////////////////////////检测
	if request("action")="add" then
		rs.addnew
		rs("sort_id")=4
		rs("customer_name")=name
		rs("customer_count_kind")="管理员后台增加"
		rs("customer_count_addtime")=now()
		if request("customer_count_sum")<0 then
		rs("customer_count_out")="减少"
		else
		rs("customer_count_out")="增加"
		end if
		rs("customer_count_sum")=abs(request("customer_count_sum"))
		rs.update
		rs.close
	end if
	
	'/////////////////////////////////////////////
	
	MySys.error.info="积分操作成功！"
	MySys.error.location="javascript:opener.focus();opener.location.reload();window.close();"
	MySys.error.suc()

end select
%>
<!--#include file="admin_end.asp"-->
