<!--#include virtual="/inc/conn.asp"-->
<!--#include virtual="/inc/chkuser.asp"-->
<%


'call logquanxian("e3",1)

'随机号
Function randarr()
Const stringmodarr = "0123456789"
strlength = Len(stringmodarr)
Randomize timer
For i = 1 To 5 
randarr2 = randarr2&Mid(stringmodarr,Int(Rnd * strlength + 1),1)  
Next 
randarr=randarr2
End Function

if SafeRequest("act")="onechuli" then

id=SafeRequestform("id")
jin=SafeRequestform("jin")
lastjin=SafeRequestform("lastjin")
usermail=SafeRequestform("usermail")
usertel=SafeRequestform("usertel")
usercaiwuid=SafeRequestform("usercaiwuid")
yue=SafeRequestform("yue")
shouxufei=request.Form("shouxufei")
ayjsname=SafeRequestform("ayjsname")
ayjstruename=request.Form("ayjstruename")
ayjsfs=SafeRequestform("ayjsfs")
ayjssid=SafeRequestform("ayjssid")
ayjsbank=request.Form("ayjsbank")
ayjstel=SafeRequestform("ayjstel")
bshouxufei=SafeRequestform("bshouxufei")

'response.Write jin&"<br>"
'response.Write lastjin&"<br>"
'response.Write yue&"<br>"
'response.end

rs.open "select ayxiaofei,ayyue,aynameid,ayljjs,aytrueuser,cwku,aydongjie from ayname where aynameid="&id&"",conn,1,3
if ccur(rs("ayyue"))<ccur(jin) then call PopErr("账户余额不足")
caiwuyue=ccur(rs("ayyue"))-ccur(jin)
if ccur(caiwuyue)<0 then caiwuyue=0
rs("ayyue")=caiwuyue 
rs("ayxiaofei")=0
rs("aydongjie")=0
rs("ayljjs")=ccur(rs("ayljjs"))+ccur(lastjin)
nameid=rs("aytrueuser")
cwku=trim(rs("cwku"))
rs.update
rs.close


'创建财务流水randarrcwku
select case	trim(cwku)
case "aycaiwu"
randarrcwku="A"
case "aycaiwu01"
randarrcwku="B"
case "aycaiwu02"
randarrcwku="C"
case "aycaiwu03"
randarrcwku="D"
case "aycaiwu04"
randarrcwku="E"
case "aycaiwu05"
randarrcwku="F"
case else
randarrcwku="A"
end select
crandarrlei="C" 	'标示 D订单 C财务
crandarrhost="A" 	'服务器数据库
crandarrlast=Right(("00"&Month(Now())),2)&Right(("00"&Day(Now())),2)&Right(("00"&hour(Now())),2)&Right(("00"&minute(Now())),2)&Right(("00"&second(Now())),2)&randarr()
crandarr=crandarrlei&crandarrhost&randarrcwku&crandarrlast

caiwuchuliid=split(usercaiwuid,",")
For chuliid=0 To Ubound(caiwuchuliid) 
conn.execute "update "&cwku&" set aycaiwuisjs=1 where aycaiwuid="&caiwuchuliid(chuliid)&" and aycaiwuuser="&id&" and aycaiwuisjs=0"
next

conn.Execute("Insert Into "&cwku&"(aycaiwuzt,aycaiwuleibie,aycailiushui,aycaiwujine,aycaiwuuser,aycaiwudate,aycaiwulastjin,aycaiwuyue,aycaiwutxcl,aycaiwujsms,aycaiwubody,aycwdtime) values('1','1','"&crandarr&"','"&jin&"','"&id&"','"&now()&"','"&lastjin&"','"&caiwuyue&"','1','3','"&trim(shouxufei)&"','"&now()&"')")	

'conn.Execute("Insert Into ayjslist(ayjsjin,ayjsname,ayjstruename,ayjsfs,ayjssid,ayjsbank,ayjstel) values('"&lastjin&"','"&trim(ayjsname)&"','"&trim(ayjstruename)&"','"&trim(ayjsfs)&"','"&trim(ayjssid)&"','"&trim(ayjsbank)&"','"&trim(ayjstel)&"')")	

if ccur(bshouxufei)>0 then
crandarrlei="C" 	'标示 D订单 C财务
crandarrhost="A" 	'服务器数据库
crandarrlast=Right(("00"&Month(Now())),2)&Right(("00"&Day(Now())),2)&Right(("00"&hour(Now())),2)&Right(("00"&minute(Now())),2)&Right(("00"&second(Now())),2)&randarr()
crandarr=crandarrlei&crandarrhost&randarrcwku&crandarrlast
conn.Execute("Insert Into aycaiwu(aycaiwuzt,aycailiushui,aycaiwuleibie,aycaiwujine,aycaiwuisjs,aycwfsjin,aycaiwuzhifu,aycaiwuuser,aycaiwudate) values('1','"&crandarr&"','16','"&bshouxufei&"','1','"&bshouxufei&"','6','0','"&now()&"')")	
end if

'title="来自"&webname&" "&DateValue(now())&"结算申请已提交！"  
'teltitle="来自"&webname&"："&DateValue(now())&"结算申请已提交！详情登录"&weburl&"了解" 
'body=webname&"提醒您：<br><br>"&DateValue(now())&" 您的账户余额已经为您提交了结算申请，具体到账时间已银行时间为准。<br><br> 如果您的提现账户有误，请联系我们进行修改，以免影响您的结算业务！<br><br> "&webname&" "&weburl&""
'call SendEMail(usermail,title,body)     
'call getHTTPPagetel(usertel,teltitle) 
end if

yingjiejin=ccur(request.Cookies("yingjie"))-ccur(lastjin)
if ccur(yingjiejin)<0 then yingjiejin=0
response.Cookies("yingjie")=yingjiejin
%>
<script language="javascript">
window.opener.document.getElementById("j_"+<%=id%>).style.display="none";
window.opener.document.getElementById("yingjiejin").innerHTML='<%=yingjiejin%>';
alert("处理成功");
window.close();
</script>