<!--#include file="ChiefMSG.asp"-->
<%
If Not IsObject(Conn) Then ConnectionDatabase
dim BankUserID,bankID,Name,CurrDeposit,C_Accrual,TimeDeposit,T_Accrual,PaymentForGoods,P_Accrual,ByDetainCP,Realty,Events,C_date,T_date,P_date,ii,datecount,dateandtime
dim BankName,BankMaster,AllDeposit,LoveLiness,StockPile,Log_on,MSG,ClientCount,ZHML,EP,BPaymentForGoods,Integral,PFGTimes,EveryBody,OpenCloseTime
dim BFace,BWidth,BHeight,BUserWealth,BUserEP,BUserCP
dim FoundBankID,FoundBankUserID,FoundBankUser,UserFreeze,IsBankID,OpenEventsLog,IsBankMaster,bankid_temp
dim csql,Isboard
dim errmsg6,U_wealth,U_ep,U_cp,U_power,U_post
Errmsg6="<br><li>"
FoundBankID=false
FoundBankUserID=false
FoundBankUser=false
UserFreeze=false
IsbankID=false
OpenEventsLog=false
IsBankMaster=false
CurrDeposit=0
C_Accrual=0
TimeDeposit=0
T_Accrual=0
PaymentForGoods=0
P_Accrual=0
ByDetainCP=0
Realty=0
Isboard=0
ii=0

'获取用户现金、魅力和经验值
if Dvbbs.founduser then
sql="select userWealth,userEP,userCP,userPower,userPost from [dv_user] where UserName='"&Dvbbs.Membername&"'"
set rs=conn.execute(sql)
U_wealth=rs(0):U_ep=rs(1):U_cp=rs(2):U_power=rs(3):U_post=rs(4)
end if

if not isnumeric(request("bankid")) or request("bankid")=0 or request("bankid")="" then
    IsbankID=false
    csql="select bankid,CurrDeposit,C_Accrual,TimeDeposit,T_Accrual,PaymentForGoods,P_Accrual,ByDetainCP,Realty from bankuser where name='"&Dvbbs.MemberName&"'"
else
    IsbankID=true
    csql="select bankuserid,name,CurrDeposit,C_accrual,TimeDeposit,T_accrual,PaymentForGoods,P_accrual,ByDetainCP,realty,events,DateAndTime,freeze from bankuser where bankid="&cint(request("bankid"))&" and name='"&Dvbbs.MemberName&"'"
end if
set crs=cjconn.execute (csql)
if crs.bof and crs.eof then
    FoundBankUserID=false
    FoundBankUser=false
    bankID=0
else
    if IsbankID then
        FoundBankUserID=true
        BankUserID=crs(0)
        Name=crs(1)
        CurrDeposit=crs(2)
        C_Accrual=crs(3)
        TimeDeposit=crs(4)
        T_Accrual=crs(5)
        PaymentForGoods=crs(6)
        P_Accrual=crs(7)
        ByDetainCP=crs(8)
        Realty=crs(9)
        Events=split(crs(10),"|")
        C_Date=crs(11)
        UserFreeze=crs(12)
    else
        FoundBankUser=true
        bankID=0
        do while not crs.eof
            bankid_temp=bankid_temp&crs(0)&" "
            CurrDeposit=Currdeposit+crs(1)
            C_Accrual=C_accrual+crs(2)
            TimeDeposit=TimeDeposit+crs(3)
            T_Accrual=T_Accrual+crs(4)
            PaymentForGoods=PaymentForGoods+crs(5)
            P_Accrual=P_Accrual+crs(6)
            ByDetainCP=ByDetainCP+crs(7)
            Realty=Realty+crs(8)
            crs.movenext
        loop
        bankid_temp=replace(trim(bankid_temp)," ",",")
    end if
end if
if IsbankID then
    bankID=cint(request("bankid"))
    csql="select bankname,bankmaster,alldeposit,loveliness,stockpile,log_on,msg,ClientCount,ZHML,EP,PaymentForGoods,integral,PFGTimes,Everybody,EventsLog,opentime from bank where bankid="&bankID&" and opened=yes"
    set crs=cjconn.execute (csql)
    if crs.bof and crs.eof then
        FoundBankID=false
    else
        FoundBankID=true
        Isboard=3
        BankName=crs(0)
        BankMaster=crs(1)
        AllDeposit=crs(2)
        LoveLiness=crs(3)
        StockPile=crs(4)
        Log_on=crs(5)
        MSG=crs(6)
        ClientCount=crs(7)
        ZHML=crs(8)
        EP=crs(9)
        BPaymentForGoods=crs(10)
        integral=crs(11)
        PFGTimes=crs(12)
        EveryBody=crs(13)
        OpenEventsLog=crs(14)
        OpenCloseTime=split(crs(15),"||")
        if BankMaster=Dvbbs.MemberName then
            IsBankMaster=true
        else
            IsbankMaster=false
        end if
        sql="select userface,userwidth,userheight,userWealth,userEP,userCP from [dv_user] where UserName='"&BankMaster&"'"
        set rs=conn.execute(sql)
        if rs.bof and rs.eof then
            response.write "<meta http-equiv=refresh content=""3;URL=index.asp""><b>该钱庄有问题，请连系系统管理员……</b>"
	        response.end
	    else
	        BFace=rs(0)
	        BWidth=rs(1)
	        BHeight=rs(2)
	        BUserwealth=rs(3)
	        BUserep=rs(4)
	        BUsercp=rs(5)
	    end if
	    set rs=nothing
	end if
end if

if BankUserID<>0 then
csql="select datecount,dateandtime from TimeDeposit where bankuserid="&BankUserID
set crs=cjconn.execute (csql)
if crs.bof and crs.eof then
datecount=null
dateandtime=null
else
datecount=crs("datecount")
dateandtime=crs("dateandtime")
end if
else
datecount=null
dateandtime=null
end if

set crs=nothing

sub yaoyue_banksuc()
response.write "<br><table cellpadding=3 cellspacing=1 align=center class=tableborder1><tr align=center><th width='100%'><b>操作成功：</b></td></tr><tr><td width='100%' class=tablebody1>"
if request("action")="open"  then
    response.write "<meta http-equiv=refresh content=""3;URL=bank_main.asp?bankid="&request("bankid")&""">您在<font color=ff0000><b>"&bankname&"</b></font>开户成功，请选择您要返回的页面，三秒后将返回您开户的钱庄。"
elseif request("action")="off" then
    response.write "您在<font color=ff0000><b>"&bankname&"</b></font>消户成功。<meta http-equiv=refresh content=""3;URL=bank_index.asp"">"
elseif IsBankMaster and request("masterwork")<>"" then
    Response.Write "<meta http-equiv=refresh content=""3;URL=bank_MasterWork.asp?bankid="&bankid&"""><b>钱庄掌柜操作成功：</b>请选择您要返回的页面，三秒后将返回您的帐房。"
elseif request.form("menu")<>"" then
    Response.Write "<meta http-equiv=refresh content=""3;URL=bank_fuwu.asp?bankid="&bankid&"""><b>特殊服务操作成功：</b>请选择您要返回的页面，三秒后将返回特殊服务。"
elseif not FoundBankID then
    response.write "<meta http-equiv=refresh content=""3;URL=bank_index.asp""><b>钱庄操作成功：</b>请选择您要返回的页面，三秒后将返钱庄列表。"
else
    response.write "<meta http-equiv=refresh content=""3;URL=bank_main.asp?bankid="&bankid&"""><b>钱庄操作成功：</b>请选择您要返回的页面，三秒后将返回您操作的钱庄。"
end if
response.write "<br><br>"
if request("menu")<>"" then
    Response.Write "<li><a href=bank_fuwu.asp?bankid="&BankID&">返回特殊服务</a></li>"
end if
if IsBankMaster and request("masterwork")<>"" then
    Response.Write "<li><a href=bank_MasterWork.asp?bankid="&BankID&">返回帐房</a></li>"
end if
response.write "<li><a href=bank_index.asp>返钱庄列表</a></li>"
if FoundBankID then
    Response.Write "<li><a href=bank_main.asp?bankid="&request("bankid")&">返回刚才所在钱庄</a></li>"
end if
Response.Write "<li><a href=index.asp>返论坛首页</a></li></td></tr></table>"
end sub

function bank_err(msg) 
%>
<table cellspacing=1 cellpadding=3 align=center class=tableborder1 style="width:75%">
	<tr>
    <th height=25>钱庄错误信息</th>
  </tr>
	<tr><td width="100%" class=tablebody1><b>产生错误的可能原因：</b><br><%=msg%><br></td></tr>
	<tr><td align=center height=26 class=tablebody2><a href="javascript:history.go(-1)">返回上一页</a></td></tr>
</table>
<%
call footer()
response.end
end function
%>