<%temp_customer_manage_count_exchangeaccount_edit_handle=site.object_p%>
<!-- object[<%=site.object_p%>]::temp_customer_manage_account_exchangetoaccount_edit_handle -->
<%
dim count_t
dim account
dim change_t
dim sql_content

count_t=request.form("count")
if count_t="" then
site.Error.info="请填入您想兑换的积分数！"
site.Error.location="back"
site.Error.err()
end if

if count_t-site.temp.customer.info.count_rest>0 then
site.Error.info="您要兑换的积分数超出了您所拥有的积分数！"
site.Error.location="back"
site.Error.err()
end if

change_t=conn.execute("select sort_exchangetocount from jins_customer_sort where sort_id="&site.temp.customer.info.sort_id&" ")("sort_exchangetocount")
change_t=1/change_t
account=count_t*change_t

sql_content="insert into jins_customer_count_list (customer_count_sum,customer_count_addtime,customer_name,sort_id,customer_count_out,customer_count_kind) "
sql_content=sql_content+"values ("&count_t&",'"&now()&"','"&site.temp.customer.info.reg_name&"',2,'减少','兑换为帐户存款') "
conn.execute(sql_content)

sql_content=""

sql_content="insert into jins_customer_consume_list (customer_consume_temp,customer_consume_sum,customer_consume_addtime,customer_name,sort_id,customer_consume_out,customer_consume_kind) "
sql_content=sql_content+"values (1,"&account&",'"&now()&"','"&site.temp.customer.info.reg_name&"',19,'入帐','积分兑换') "
conn.execute(sql_content)

site.Error.info="您成功的将"&count_t&"个积分兑换为帐户存款"&site.info.unit_money(1)&" "&account&"!"
site.Error.location="back"
site.Error.suc()
%>