<!-- #include file="include/config.asp" -->
<!-- #include file="INCLUDE/skin.asp" -->
<!--#include file="include/conn.asp"-->
<!--#include file="z_bank_data.asp"-->
<!--#include file="z_bank_const.asp"-->
<%
'=========================================================
' File: z_bank_ebank.asp
' Version:1.0
' Date: 2003-7-20
' Script Written by 冰语，倚天电子，http://et8.126.com
'=========================================================
' Copyright (C) 2002,2003 et8.126.Com. All rights reserved.
' Web: ,http://et8.126.com
' Email: lupi@163.net
'=========================================================

if request("action")<>"open" and not FoundBankUserID then
    founderr=true
    Errmsg=Errmsg+"<br>"+"<li>您还没有在银行开户。</li>"
end if
if UserFreeze then
    founderr=true
    Errmsg=Errmsg+"<br>"+"<li>您的账号已经被冻结，请连系该行行长。</li>"
end if
if not FoundBankID and request("action")<>"open" then
    founderr=true
    Errmsg=Errmsg+"<br>"+"<li>没有找到该银行。</li><li>该银行还没有开放</li><li>非法操作</li>"
end if
if request("action")="" then
    founderr=true
    Errmsg=Errmsg+"<br>"+"<li>非法操作。</li>"
end if
if FoundErr then
    tit_fir="<a href='z_bank_index.asp'>社区银行</a>"
    tit="银行错误信息"
    call web_head(1,0,2,0,0)
    call bank_error() 
    call web_end(0)
else
    tit_fir="<a href='z_bank_index.asp'>社区银行</a>"
    tit="银行信息"
    call web_head(1,0,2,0,0)
    select case request("action")
        case "open"
          call bankreg()
        case "off"
          call off()
        case "C_d_1"
          call C_d_1()
        case "C_d_2"
          call C_d_2()
        case "T_d_1"
          call T_d_1()
        case "T_d_2"
          call T_d_2()
        case "B_loveliness"
          call B_loveliness()
        case "P_loveliness"
          call P_loveliness()
        case "P_f_1"
          call P_f_1()
        case "P_f_2"
          call P_f_2()
        case "vir"
          call vir()
        case "R_E_M"
          call R_E_M()
        case else
          FoundErr=true
          Errmsg=Errmsg+"<br>"+"<li>非法操作。</li>"
    end select
    if FoundErr then
        call bank_error()
    end if
    call web_end(0)
end if
'开户
sub BankReg()
  if FoundBankUserID then
      founderr=true
      Errmsg=Errmsg+"<br>"+"<li>你已经在该银行注册过了。</li>"
  end if
  if integral < Integral then
      founderr=true
      Errmsg=Errmsg+"<br>"+"<li>你的积分不足以在该银行开户。</li>"
  end if
  if usermoney < L_trade then
      founderr=true
      Errmsg=Errmsg+"<br>"+"<li>你不够开户费。</li>"
  end if
  if not FoundErr then
      csql="insert into bankuser(bankid,name,CurrDeposit,events) values ("&cint(request("bankid"))&",'"&login_username&"',"&L_trade&",'"&L_trade&"|银行开户|"&now()&"')"
      cjconn.execute (csql)
      cjconn.execute ("update bank set alldeposit=alldeposit+"&L_trade&",stockpile=stockpile+"&L_trade&",ClientCount=ClientCount+1 where bankid="&BankID)
      if OpenEventsLog=-1 then
          cjconn.execute ("insert into bankevent (bankid,name1,name2,events,trade) values ("&cint(request("bankid"))&",'"&login_username&"','','开户',"&L_trade&")")
      end if
      conn.execute ("update user_data set emoney=emoney-"&L_trade&" where username='"&login_username&"'")
      call yaoyue_banksuc()
  end if
end sub
'销户
sub off()
  if not FoundBankUserID then
      founderr=true
      Errmsg=Errmsg+"<br>"+"<li>你并没有在该银行开户也。</li>"
  end if
  if TimeDeposit>0 then
      founderr=true
      Errmsg=Errmsg+"<br>"+"<li>你还有定期存耶……不想要了？如果想要就等它到期再来咯。</li>"
  end if
  if PaymentForGoods>0 then
      founderr=true
      Errmsg=Errmsg+"<br>"+"<li>你想的倒是很美哦，你还欠银行的钱耶，就想逃？</li>"
  end if
  if IsBankMaster then
      founderr=true
      Errmsg=Errmsg+"<br>"+"<li>有没有搞错啊，你是本银行的行长耶！</li>"
  end if
  if StockPile < CurrDeposit + C_Accrual then
      founderr=true
      Errmsg=Errmsg+"<br>"+"<li>销户吗？可怜的你，该银行已经没人也没钱了，还不起你所存的款项与该得的利息。给你个良好的提示，如果想扁人出气的话，找行长吧，所有人都跑得了就行长不能。</li>"
  end if
  if not FoundErr then
      cjconn.execute ("delete from bankuser where bankuserid="&BankUserID)
      cjconn.execute ("update bank set alldeposit=alldeposit-"&(CurrDeposit+C_Accrual)&",stockpile=stockpile+"&log_on&"-"&(CurrDeposit+C_Accrual)&",ClientCount=ClientCount-1 where bankid="&BankID)
      if OpenEventsLog then
          cjconn.execute ("insert into bankevent (bankid,name1,name2,events,trade) values ("&bankid&",'"&login_username&"','','销户',"&log_on&")")
      end if
      conn.execute ("update user_data set emoney=emoney-"&log_on&"+"&(CurrDeposit+C_Accrual)&" where username='"&login_username&"'")
      call yaoyue_banksuc()
  end if
end sub
'活期存款
sub C_d_1()
  dim C_d_1_1
  if not isnumeric(request.form("C_d_1_1")) or isnumeric(request.form("C_d_1_1"))="" then
      founderr=true
      Errmsg=Errmsg+"<br>"+"<li>请输入数字</li>"
  else
      C_d_1_1=int(abs(Request.Form("C_d_1_1")))
      if C_d_1_1<L_trade and C_d_1_1<>0 then
          founderr=true
          Errmsg=Errmsg+"<br>"+"<li>就那么点钱，我看你就留着顾面子了，不用存了（最低交易额为"&L_trade&Curr&"以上）</li>"
      end if
      if C_d_1_1 > usermoney then
          founderr=true
          Errmsg=Errmsg+"<br>"+"<li>拜托你先看看你口袋里有多少钱行不行？别老把一毛钱当一百！</li>"
      end if
      if C_d_1_1 > H_trade then
          FoundErr = true
          Errmsg=Errmsg+"<b>"+"<li>哇噻，你的钱真多，不过每次最多只能存"&H_trade&Curr&"咯。</li>"
      end if
  end if
  if not FoundErr then
      cjconn.execute ("update bankuser set Currdeposit=Currdeposit+"&(C_d_1_1+C_Accrual)&",C_accrual=0,events='"&C_d_1_1&"|活期存款|"&now()&"',DateAndTime='"&now()&"' where bankuserid="&BankUserID)
      cjconn.execute ("update bank set alldeposit=alldeposit+"&(C_d_1_1-C_Accrual)&",stockpile=stockpile+"&(C_d_1_1-C_Accrual)&" where bankid="&BankID)
      if OpenEventsLog then
          cjconn.execute ("insert into bankevent (bankid,name1,name2,events,trade) values ("&bankid&",'"&login_username&"','','活期存款',"&C_d_1_1&")")
      end if
      '记录盈利
      call record(C_d_1_1/500)
      conn.execute ("update user_data set emoney=emoney-"&C_d_1_1&" where username='"&login_username&"'")
      call yaoyue_banksuc()
  end if
end sub
'活存取款
sub C_d_2()
  dim C_d_2_1,StockPileLack,acc,acc1
  StockPileLack=false
  if not isnumeric(request.form("C_d_2_1")) then
      founderr=true
      Errmsg=Errmsg+"<br>"+"<li>请输入数字</li>"
  else
      C_d_2_1=int(abs(request.form("C_d_2_1")))
      acc = - C_d_2_1
      acc1 = C_d_2_1 + C_Accrual
      if C_d_2_1 < L_trade and C_d_2_1 <> 0 then
          founderr=true
          Errmsg=Errmsg+"<br>"+"<li>别那么小气嘛，就取那么点钱，你只好返回上页再来一次了。（最低交易额为"&L_trade&Curr&"以上）</li>"
      end if
      if C_d_2_1 > CurrDeposit then
          founderr=true
          Errmsg=Errmsg+"<br>"+"<li>请注意你的存款数额还有多少</li>"
      end if
      if C_d_2_1 > H_trade then
          FoundErr = true
          Errmsg=Errmsg+"<b>"+"<li>一下子提那么多钱不怕被抢？不过就算你不怕也没用，每次最多只能提"&H_trade&Curr&"咯。</li>"
      end if
      if StockPile=0 then
          FoundErr = true
          Errmsg=Errmsg+"<b>"+"<li>该银行的库存为0，你说还有人在那里等你扁人出气吗？</li>"
      end if
      if not FoundErr and StockPile < C_D_2_1 + C_Accrual then
          founderr=true
          StockPileLack=true
          acc = C_Accrual - StockPile
          acc1 = StockPile
          Errmsg=Errmsg+"<br>"+"<li>由于该银行库存不足，出纳小姐只好尴尬的说：“对不起，本银行这时的库存只有<font color=#ff0000><b>"&StockPile&"</b></font>"&Curr&"了。”（注意：你只取到<font color=#ff0000><b>"&StockPile&"</b></font>"&Curr&"，不足的请连系该行行长。）</li>"
      end if
  end if
  if not FoundErr or StockPileLack then
      cjconn.execute ("update bankuser set CurrDeposit=CurrDeposit+"&acc&",C_accrual=0,events='"&acc1&"|取款（活）|"&now()&"',DateAndTime='"&now()&"' where bankuserid="&BankUserID)
      cjconn.execute ("update bank set alldeposit=alldeposit+"&acc&",stockpile=stockpile-"&acc1&" where bankid="&BankID)
      if OpenEventsLog then
          cjconn.execute ("insert into bankevent (bankid,name1,name2,events,trade) values ("&bankid&",'"&login_username&"','','活存取款',"&acc1&")")
      end if
      '记录盈利
      call record(-acc/1000)
      conn.execute ("update user_data set emoney=emoney+"&acc1&" where username='"&login_username&"'")
      if not StockPileLack then
          call yaoyue_banksuc()
      end if
  end if
end sub
'定期存款
sub T_d_1()
  dim T_d_1_1,TimeLong
  if not isnumeric(request.form("T_d_1_1")) then
      founderr=true
      Errmsg=Errmsg+"<br>"+"<li>请输入数字</li>"
  else
      T_d_1_1 = int(abs(Request.Form("T_d_1_1")))
      TimeLong = cint(Request.Form("timelong"))
      if T_d_1_1 > usermoney then
          FoundErr=True
          Errmsg=Errmsg+"<Br>"+"<li>啊！啊！这位不知道是先生还是小姐，你的戴几度的眼镜？如果还看得清楚的话请返回且稍微往左看看你的<b>现金总数</b>还有多少。</li>"
      end if
      if T_d_1_1 < L_TimeDeposit then
          founderr=true
          Errmsg=Errmsg+"<br>"+"<li>哇哦！！！只见银行的出纳ＭＭ拿了大把大把的钞镖数了大半天差点气喘发作，却非常迷惘的怎么超过"&L_TimeDeposit&"万张的纸钞会少于"&L_TimeDeposit&"万元？只好无奈的对您说，对不起，本行的定期存款最少为<font color=#ff0000><b>"&L_TimeDeposit&"</b></font>"&Curr&"。</li>"
      end if
      if T_d_1_1 > H_TimeDeposit then
          founderr=true
          Errmsg=Errmsg+"<br>"+"<li>银行定期存款一次最多只能存<font color=#ff0000><b>"&H_TimeDeposit&"</b></font>"&Curr&"。</li>"
      end if
  end if
  if not FoundErr then
      cjconn.execute ("insert into TimeDeposit (bankid,bankuserid,TimeDeposit,T_Accrual,DateCount) values ("&BankID&","&BankUserID&","&T_d_1_1&","&int(T_DateProfit/100*TimeLong*T_d_1_1)&","&TimeLong&")")
      cjconn.execute ("update bankuser set TimeDeposit=TimeDeposit+"&T_d_1_1&",T_accrual=T_accrual+"&int(T_DateProfit/100*TimeLong*T_d_1_1)&",events='"&T_d_1_1&"|定期存款|"&now()&"' where bankuserid="&BankUserID)
      cjconn.execute ("update bank set alldeposit=alldeposit+"&T_d_1_1&",stockpile=stockpile+"&T_d_1_1&" where bankid="&BankID)
      if OpenEventsLog then
          cjconn.execute ("insert into bankevent (bankid,name1,name2,events,trade) values ("&bankid&",'"&login_username&"','','定期存款',"&T_d_1_1&")")
      end if
      conn.execute ("update user_data set emoney=emoney-"&T_d_1_1&" where username='"&login_username&"'")
      '记录盈利
      call record(T_d_1_1/1000)
      call yaoyue_banksuc()
  end if
end sub
'定存取款及其相关操作
sub T_d_2()
  dim TID,T_d_2_1,T_d_2_2,T_ac,OldTimeLong,NewTimeLong,T_DateTime,selects,StockPileLack,acc,acc1
  if not isnumeric(request.form("T_d_2_1")) then
      founderr=true
      Errmsg=Errmsg+"<br>"+"<li>请输入数字</li>"
  else
      StockPileLack=false
      TID=cint(Request.Form("TID"))
      T_d_2_1=int(abs(Request.Form("T_d_2_1")))
      OldTimeLong=cint(Request.Form("timelong"))
      selects=trim(Request.Form("selects"))
      csql="select TimeDeposit,T_Accrual,DateCount,DateAndTime from TimeDeposit where TID="&TID
      set crs=cjconn.execute (csql)
      if crs.bof and crs.eof then
          Errmsg=Errmsg+"<br>"+"<li>有吗？有吗？糟了，我怎么也找不到你这个存款号耶！嗯！！哇！救命啊，原来是抢银行的！</li>"
          FoundErr=true
          exit sub
      else
          T_d_2_2=crs(0)
          T_ac=crs(1)
          NewTimeLong=crs(2)
          T_DateTime=crs(3)
      end if
      set crs=nothing
      if datediff("d",datediff("d",T_DateTime,now()),NewTimeLong)>0 then
          FoundErr=true
          Errmsg=Errmsg+"<br>"+"<li>你刷，我给你刷，我刷爆你的头，再刷你的钱就有危险了！</li>"
      end if
      select case selects
          case 1
            acc=0
            acc1=T_d_2_2 + T_ac
            if T_d_2_1 <> T_d_2_2 then
                founderr=true
                Errmsg=Errmsg+"<br>"+"<li>哇噻，你的镖镖还是有灵性的，会死掉和结婚生子的不成？</li>"
            end if
            if StockPile=0 then
                FoundErr = true
                Errmsg=Errmsg+"<b>"+"<li>该银行的库存为0，你说还有人在那里等你扁人出气吗？</li>"
            end if
            if not FoundErr and StockPile < T_d_2_2 + T_ac then
                founderr=true
                StockPileLack=true
                acc = T_d_2_2 + T_ac - StockPile
                acc1 = StockPile
                Errmsg=Errmsg+"<br>"+"<li>由于该银行库存不足，出纳小姐只好尴尬的说：“对不起，本银行这时的库存只有<font color=#ff0000><b>"&StockPile&"</b></font>"&Curr&"了。”（注意：你只取到<font color=#ff0000><b>"&StockPile&"</b></font>"&Curr&"，不足的已转为活期存款，有问题请找该行行长。）</li>"
            end if
            if not FoundErr or StockPileLack then
                cjconn.execute ("delete from TimeDeposit where TID="&TID)
                cjconn.execute ("update bankuser set CurrDeposit=CurrDeposit+"&acc&",TimeDeposit=TimeDeposit-"&T_d_2_2&",T_accrual=T_accrual-"&T_ac&",events='"&T_d_2_2&"|取款（定）|"&now()&"' where bankuserid="&BankUserID)
                cjconn.execute ("update bank set allDeposit=allDeposit+"&acc&"-"&T_d_2_2&",StockPile=StockPile-"&acc1&" where bankid="&BankID)
                if OpenEventsLog then
                    cjconn.execute ("insert into bankevent (bankid,name1,name2,events,trade) values ("&bankid&",'"&login_username&"','','取款（定）',"&T_d_2_2&")")
                end if
                conn.execute ("update user_data set emoney=emoney+"&acc1&" where username='"&login_username&"'")
                if not StockPileLack then
                    call yaoyue_banksuc()
                end if
            end if
          case 2
            if T_d_2_1 < T_d_2_2 then
                FoundErr = true
                Errmsg=Errmsg+"<b>"+"<li>转为活存，只能不要修改或填比原款项更大的数据，超出的部分会自动从你现金中扣除。</li>"
            end if
            if T_d_2_1 - T_d_2_2 > usermoney then
                FuundErr=true
                Errmsg=Errmsg+"<br>"+"<li>根据本行第698574587条规定的第78546247点，增出的部分超过你现在的现金数，本行可以无偿的扣去你身上的所有现金。</li>"
            end if
            if T_d_2_1 + T_ac > H_TimeDeposit then
                founderr=true
                Errmsg=Errmsg+"<br>"+"<li>银行定期存款一次最多只能存<font color=#ff0000><b>"&H_TimeDeposit&"</b></font>"&Curr&"。</li>"
            end if
            cjconn.execute ("delete from TimeDeposit where TID="&TID)
            cjconn.execute ("update bankuser set CurrDeposit=CurrDeposit+"&T_d_2_1+T_ac&",TimeDeposit=TimeDeposit-"&T_d_2_2&",T_accrual=T_accrual-"&T_ac&",events='"&T_d_2_1+T_ac&"|活期存款|"&now()&"' where bankuserid="&BankUserID)
            cjconn.execute ("update bank set allDeposit=allDeposit+"&T_ac + T_d_2_1 - T_d_2_2&",StockPile=StockPile+"&T_d_2_1 - T_d_2_2&" where bankid="&BankID)
            if OpenEventsLog then
                cjconn.execute ("insert into bankevent (bankid,name1,name2,events,trade) values ("&bankid&",'"&login_username&"','','活期存款',"&T_d_2_1 + T_ac&")")
            end if
            conn.execute ("update user_data set emoney=emoney-"&(T_d_2_1 - T_d_2_2)&" where username='"&login_username&"'")
            call yaoyue_banksuc()
          case 3
            acc=0
            acc1=T_ac
            if T_d_2_1 - T_d_2_2 > usermoney then
                FoundErr=true
                Errmsg=Errmsg+"<br>"+"<li>喂，你想混水摸鱼啊？先查查自己的现金吧。</li>"
            end if
            if T_d_2_1 < L_TimeDeposit then
                FoundErr=true
                Errmsg=Errmsg+"<br>"+"<li>最少也得"&L_TimeDeposit&Curr&"吧，不然怎么延期啊？</li>"
            end if
            if T_d_2_1 > H_TimeDeposit then
                founderr=true
                Errmsg=Errmsg+"<br>"+"<li>银行定期存款一次最多只能存<font color=#ff0000><b>"&H_TimeDeposit&"</b></font>"&Curr&"。</li>"
            end if
            if StockPile=0 then
                FoundErr = true
                Errmsg=Errmsg+"<b>"+"<li>该银行的库存为0，你说还有人在那里等你扁人出气吗？</li>"
            end if
            if not FoundErr and StockPile < T_ac then
                FoundErr = true
                StockPileLack = true
                acc = T_ac - StockPile
                acc1 = StockPile
                Errmsg=Errmsg+"<br>"+"<li>由于该银行库存不足，出纳小姐只好尴尬的说：“对不起，本银行这时的库存只有<font color=#ff0000><b>"&StockPile&"</b></font>"&Curr&"了。”（注意：你的利息只取到<font color=#ff0000><b>"&StockPile&"</b></font>"&Curr&"，不足的已转为活期存款，存期照你输入的数字延长，如果正在因为没看清该银行的库存还有多少而气得跳脚，那我只有说你活该了。有问题请找该行行长。）</li>"
            end if
            if not Founderr or StockPileLack then
                cjconn.execute ("update TimeDeposit set TimeDeposit="&T_d_2_1&",T_Accrual="&int(T_DateProfit/100*OldTimeLong*T_d_2_1)&",DateCount="&OldTimeLong&",DateAndTime='"&now()&"' where TID="&TID)
                cjconn.execute ("update bankuser set CurrDeposit=CurrDeposit+"&acc&",events='"&T_d_2_1&"|定存延期|"&now()&"' where bankuserid="&BankUserID)
                cjconn.execute ("update bank set allDeposit=allDeposit+"&acc&"+"&(T_d_2_1 - T_d_2_2)&",StockPile=StockPile-"&acc1&" where bankid="&BankID)
                if OpenEventsLog then
                    cjconn.execute ("insert into bankevent (bankid,name1,name2,events,trade) values ("&bankid&",'"&login_username&"','','定存延期',"&T_d_2_1&")")
                end if
                conn.execute ("update user_data set emoney=emoney+"&acc1&" where username='"&login_username&"'")
                call yaoyue_banksuc()
            end if
      end select
  end if
end sub
'买魅力
sub B_LoveLiness()
  dim B_LS
  if not isnumeric(request.form("B_LS")) then
      founderr=true
      Errmsg=Errmsg+"<br>"+"<li>请输入数字</li>"
  else
      B_LS=int(abs(Request.Form("B_LS")))
      if B_LS > LoveLiness then
          founderr=true
          Errmsg=Errmsg+"<br>"+"<li>呃，本银行魅力存货没这么多，如果需要下次请早！</li>"
      end if
      if B_LS*ZHML*4 < L_trade then
          founderr=true
          Errmsg=Errmsg+"<br>"+"<li>买那么少有什么用啊，最少也得买"&L_trade\(ZHML*4)&"点吧？</li>"
      end if
      if B_LS*ZHML*4 > usermoney then
          founderr=true
          Errmsg=Errmsg+"<br>"+"<li>钱呢钱呢？你有那么多钱吗？有吗？有吗？（注意：你的现钱不足"&B_LS*ZHML*4&Curr&"）</li>"
      end if
      if B_LS*ZHML*4 > H_trade then
          founderr=true
          Errmsg=Errmsg+"<br>"+"<li>阁下硬是要得，钱多得让人发疯！但所买金额超过"&H_trade&Curr&"只好请你分批买了咯！</li>"
      end if
  end if
  if not FoundErr then
      cjconn.execute ("update bankuser set events='"&B_LS*ZHML*4&"|买魅力值|"&now()&"' where bankuserid="&BankUserID)
      cjconn.execute ("update bank set loveliness=loveliness-"&B_LS&",StockPile=StockPile+"&B_LS*ZHML*4&" where bankid="&BankID)
      if OpenEventsLog then
          cjconn.execute ("insert into bankevent (bankid,name1,name2,events,trade) values ("&bankid&",'"&login_username&"','','买魅力值',"&B_LS*ZHML*4&")")
      end if
      conn.execute ("update user_data set emoney=emoney-"&B_LS*ZHML*4&",userCP=userCP+"&B_LS&" where username='"&login_username&"'")
      '记录盈利
      call record(B_LS*ZHML*4)
      call yaoyue_banksuc()
  end if
end sub
'卖魅力
sub P_Loveliness()
  dim P_LS
  if not isnumeric(request.form("P_LS")) then
      founderr=true
      Errmsg=Errmsg+"<br>"+"<li>请输入数字</li>"
  else
      P_LS=int(abs(Request.Form("P_LS")))
      if P_LS > myuserCP then
          founderr=true
          Errmsg=Errmsg+"<br>"+"<li>你以为你是万人迷啊？有那么大的魅力！</li>"
      end if
      if P_LS*ZHML*2 < L_trade then
          founderr=true
          Errmsg=Errmsg+"<br>"+"<li>卖血也不能那么少吧？总共"&L_trade&Curr&"都没有，不收。</li>"
      end if
      if P_LS*ZHML*2 > StockPile - 10000 then
          FoundErr=true
          Errmsg=Errmsg+"<br>"+"<li>阁下硬是要得，魅力高得让ＭＭ们为之发疯，但也别卖得太猛，本银行还得留点老本啊！</li>"
      end if
      if P_LS*ZHML*2 > H_trade then
          founderr=true
          Errmsg=Errmsg+"<br>"+"<li>阁下硬是要得，魅力高得让人眼红！但所卖金额超过"&H_trade&Curr&"只好请你分批卖了咯！</li>"
      end if
  end if
  if not FoundErr then
      cjconn.execute ("update bankuser set events='"&P_LS*ZHML*2&"|卖魅力值|"&now()&"' where bankuserid="&BankUserID)
      cjconn.execute ("update bank set loveliness=loveliness+"&P_LS&",StockPile=StockPile-"&P_LS*ZHML*2&" where bankid="&BankID)
      if OpenEventsLog then
          cjconn.execute ("insert into bankevent (bankid,name1,name2,events,trade) values ("&bankid&",'"&login_username&"','','卖魅力值',"&P_LS*ZHML*2&")")
      end if
      conn.execute ("update user_data set emoney=emoney+"&P_LS*ZHML*2&",userCP=userCP-"&P_LS&" where username='"&login_username&"'")
      '记录盈利
      call record(-P_LS*ZHML)
      call yaoyue_banksuc()
  end if
end sub
'贷款
sub P_f_1()
  dim PFG
  if not isnumeric(request.form("PFG")) then
      founderr=true
      Errmsg=Errmsg+"<br>"+"<li>请输入数字</li>"
  else
      PFG=int(abs(Request.Form("PFG")))
      csql="select count(bankuserid) from PaymentForGoods where bankuserid="&BankUserID
      set crs=cjconn.execute (csql)
      ii=crs(0)
      set crs=nothing
      if PFG > myuserCP then
          FoundErr=true
          Errmsg=Errmsg+"<br>"+"<li>喂，你没有搞错啊，你还真以为你是万人迷，有那么大魅力啊？</li>"
      end if
      if ii >= PFGTimes then
          FoundErr=true
          Errmsg=Errmsg+"<br>"+"<li>唉，就算你的魅力再大，但……你已经贷了"&ii&"次款了，只有请还清一次后再贷了。</li>"
      end if
      if PFG < 100 then
          FoundErr=true
          Errmsg=Errmsg+"<br>"+"<li>你这叫贷款？就贷那么点我还不如不要。</li>"
      end if
      if PFG*ZHML > StockPile - 10000 then
          FoundErr=true
          Errmsg=Errmsg+"<br>"+"<li>唉，虽然很想贷给你，但银行还得留点底，不然到时要给人拆了。（注意：每次贷款，不能使银行的库金少于一万，你可以偿试贷少一点）</li>"
      end if
      if PFG*ZHML > H_trade then
          FoundErr=true
          Errmsg=Errmsg+"<br>"+"<li>哇！！您真是超级万人迷，但请不要那么猛啊！（注意：你要贷的款项超过"&H_trade&Curr&"，银行的最大单笔交易为"&H_trade&Curr&"。</li>"
      end if
  end if
  if not FoundErr then
      cjconn.execute ("insert into PaymentForGoods (bankid,bankuserid,PaymentForGoods,P_Accrual,ByDetainCP,LastTime) values ("&BankID&","&BankUserID&","&PFG*ZHML&","&int(P_DateProfit/100*PFG*ZHML*P_DateCount)&","&PFG&",'"&dateadd("d",P_DateCount,now())&"')")
      cjconn.execute ("update bankuser set PaymentForGoods=PaymentForGoods+"&PFG*ZHML&",P_accrual=P_accrual+"&int(P_DateProfit/100*PFG*ZHML*P_DateCount)&",ByDetainCP=ByDetainCP+"&PFG&",events='"&PFG*ZHML&"|贷款|"&now()&"' where bankuserid="&BankUserID)
      cjconn.execute ("update bank set StockPile=StockPile-"&PFG*ZHML&",PaymentForGoods=PaymentForGoods+"&PFG*ZHML&" where bankid="&BankID)
      if OpenEventsLog then
          cjconn.execute ("insert into bankevent (bankid,name1,name2,events,trade) values ("&bankid&",'"&login_username&"','','贷款',"&PFG*ZHML&")")
      end if
      conn.execute ("update user_data set emoney=emoney+"&PFG*ZHML&",userCP=userCP-"&PFG&" where username='"&login_username&"'")
      call yaoyue_banksuc()
  end if
end sub
'还款
sub P_f_2()
  dim PID,PF2_1,PF2_2,P_ac,P_CP,CentTB
  if not isnumeric(request.form("PF2")) then
      founderr=true
      Errmsg=Errmsg+"<br>"+"<li>请输入数字</li>"
  else
      PID=cint(Request.Form("PID"))
      PF2_1=int(abs(Request.Form("PF2")))
      CentTB=false
      csql="select PaymentForGoods,P_Accrual,ByDetainCP from PaymentForGoods where PID="&PID
      set crs=cjconn.execute (csql)
      if crs.bof and crs.eof then
          Errmsg=Errmsg+"<br>"+"<li>你有毛病还是发财了嫌钱多，这也刷？</li>"
          FoundErr=true
          exit sub
      else
          PF2_2=crs(0)
          P_ac=crs(1)
          P_CP=crs(2)
      end if
      set crs=nothing
      if PF2_1 > PF2_2 then
          FoundErr=true
          Errmsg=Errmsg+"<br>"+"<li>只见银行的柜台小姐的双颊泛红，眼带桃花直瞪着你，你还真凯，你本笔贷款并没有这么多钱。</li>"
      end if
      if PF2_1 + P_ac > usermoney then
          FoundErr=true
          Errmsg=Errmsg+"<br>"+"<li>sorry，我们不收假钞，真的你又没那么多，记住，要加上利息一并还的哦。</li>"
      end if
      if PF2_1 < PF2_2 then
          if PF2_1*ZHML < 100*ZHML then
              FoundErr=true
              Errmsg=Errmsg+"<br>"+"<li>分期还款每次最少得还" & 100*ZHML&Curr & "。</li>"
          elseif  PF2_1 mod ZHML > 0 then
              FoundErr=true
              Errmsg=Errmsg+"<br>"+"<li>分期还清贷款，还款的数目必须是"&zhml&"的倍数，也就是每"&zhml&Curr&"换回1点魅力。</li>"
          elseif P_CP-PF2_1\ZHML < 100 then
              Founderr=true
              Errmsg=Errmsg+"<br>"+"<li>本期还后剩下所押的魅力已经不足一百，请一次还清。</li>"
          elseif not FoundErr then
              CentTB=true
          end if
      end if
  end if
  if not FoundErr then
      if not CentTB then
          cjconn.execute ("delete from PaymentForGoods where PID="&PID)
      else
          cjconn.execute ("update PaymentForGoods set PaymentForGoods=PaymentForGoods-"&PF2_1&",P_Accrual=0,ByDetainCP=ByDetainCp-"&PF2_1\ZHML&" where PID="&PID)
      end if
      cjconn.execute ("update bankuser set PaymentForGoods=PaymentForGoods-"&PF2_1&",P_accrual=P_accrual-"&P_ac&",ByDetainCP=ByDetainCP-"&PF2_1\ZHML&",events='"&PF2_1&"|还贷款|"&now()&"' where bankuserid="&BankUserID)
      cjconn.execute ("update bank set StockPile=StockPile+"&PF2_1+P_ac&",PaymentForGoods=PaymentForGoods-"&PF2_1&" where bankid="&BankID)
      if OpenEventsLog then
          cjconn.execute ("insert into bankevent (bankid,name1,name2,events,trade) values ("&bankid&",'"&login_username&"','','贷款',"&PF2_1*ZHML&")")
      end if
      conn.execute ("update user_data set emoney=emoney-"&PF2_1+P_ac&",userCP=userCP+"&PF2_1 \ ZHML&" where username='"&login_username&"'")
      '记录盈利
      call record(P_ac)
      call yaoyue_banksuc()
  end if
end sub
'转帐
sub vir()
  dim Bvir,BankUser,TakeOverUser,BFreeze
  if not isnumeric(request.form("Bvir")) then
      founderr=true
      Errmsg=Errmsg+"<br>"+"<li>请输入数字</li>"
  else
      Bvir=int(abs(Request.Form("Bvir")))
      BankUser=trim(Request.Form("bankuser"))
      BFreeze=false
      csql="select bankuserid,freeze from bankuser where bankid="&BankID&" and name='"&BankUser&"'"
      set crs=cjconn.execute (csql)
      if crs.bof and crs.eof then
          Errmsg=Errmsg+"<br>"+"<li>本银行没有该用户，请确定输入的用户名正确。</li>"
          FoundErr=true
          exit sub
      else
          TakeOverUser=crs(0)
          if crs(1)=-1 then
              BFreeze=true
          end if
      end if
      set crs=nothing
      if BFreeze then
          FoundErr=true
          Errmsg=Errmsg+"<br>"+"<li>你所要转帐的用户已经被冻结。</li>"
      end if
      if int(Bvir+Bvir*virement/100) > usermoney then
          FoundErr=true
          Errmsg=Errmsg+"<br>"+"<li>你是不是好心过头啦？还是人家催债催得太紧，让你自己还有多少钱都不知道？（注意：所转的帐及转帐所需的手继费都从你现金中扣除，本笔转加手继费一共需"&int(Bvir+Bvir*virement/100)&Curr&"，而你的现金只有"&usermomey&Curr&"。）</li>"
      end if
      if BankUser = login_username then
          FoundErr=true
          Errmsg=Errmsg+"<br>"+"<li>给自己转帐很好玩吗？</li>"
      end if
      if Bvir < L_trade then
          FoundErr=true
          Errmsg=Errmsg+"<br>"+"<li>HI！亲爱的客户，您转的钱也未免太……少了点吧？</li>"
      end if
      if Bvir > H_trade then
          FoundErr=true
          Errmsg=Errmsg+"<br>"+"<li>晕，你的钱太多太重了，请分次，ＯＫ？</li>"
      end if
  end if
  if not FoundErr then
      '转方更新信息
      cjconn.execute ("update bankuser set events='"&Bvir&"|转帐|"&now()&"' where bankuserid="&BankUserID)
      cjconn.execute ("update bank set alldeposit=alldeposit-"&Bvir&",StockPile=StockPile-"&int(Bvir+Bvir*virement/100)&" where bankid="&BankID)
      if OpenEventsLog then
          cjconn.execute ("insert into bankevent (bankid,name1,name2,events,trade) values ("&bankid&",'"&login_username&"','"&BankUser&"','转帐',"&Bvir&")")
      end if
      conn.execute ("update user_data set emoney=emoney-"&int(Bvir+Bvir*virement/100)&" where username='"&login_username&"'")
      '记录盈利
      call record(Bvir*virement/100)
      '收方更新信息
      cjconn.execute ("update bankuser set CurrDeposit=CurrDeposit+"&Bvir&" where bankuserid="&TakeOverUser)
      dim topic,word
	  topic="[银行转账]请查收"
	  word=login_username&"从"&bankname&"转"&Bvir&Curr&"给你，已经存入你在"&bankname&"的账户中。"
	  sql="insert into user_mail(accept_u,send_u,topic,word,tim,types,isread) values('"&BankUser&"','"&login_username&"','"&topic&"','"&word&"',Now(),1,0)"
	  conn.Execute(sql)
	  call yaoyue_banksuc
  end if
end sub
'汇款
sub R_E_M()
  dim BRemit,TakeBank,BankUser,TakeOverUser,TakeOverBank,BFreeze
  if not isnumeric(request.form("BRemit")) then
      founderr=true
      Errmsg=Errmsg+"<br>"+"<li>金额请输入数字。</li>"
  else
      BRemit=int(abs(Request.Form("BRemit")))
      TakeBank=trim(Request.Form("takebank"))
      BankUser=trim(Request.Form("bankuser"))
      csql="select bankid from bank where bankname='"&TakeBank&"'"
      BFreeze=false
      set crs=cjconn.execute (csql)
      if crs.BOF and crs.EOF then
          Errmsg=Errmsg+"<br>"+"<li>找不到你所要汇到的银行，请确定该银行存在。</li>"
          FoundErr=true
          exit sub
      else
          TakeOverBank=crs(0)
      end if
      csql="select bankuserid,freeze from bankuser where bankid="&TakeOverBank&" and name='"&BankUser&"'"
      set crs=cjconn.execute (csql)
      if crs.BOF and crs.EOF then
          Errmsg=Errmsg+"<br>"+"<li>在所汇到的银行中找不到所指定的用户，请确认该用户存在。</li>"
          FoundErr=true
          exit sub
      else
          TakeOverUser=crs(0)
          if crs(1)=-1 then
              BFreeze=true
          end if
      end if
      set crs=nothing
      if BFreeze then
          FoundErr=true
          Errmsg=Errmsg+"<br>"+"<li>你所要转帐的用户已经被冻结。</li>"
      end if
      if TakeBank=bankname then
          FoundErr=true
          Errmsg=Errmsg+"<br>"+"<li>相同银行，只要用转帐就行吧？</li>"
      end if
      if int(BRemit+BRemit*remit/100) > usermoney then
          FoundErr=true
          Errmsg=Errmsg+"<br>"+"<li>你是不是好心过头啦？还是人家催债催得太紧，让你自己还有多少钱都不知道？（注意：所转的帐及转帐所需的手继费都从你现金中扣除，本笔转加手继费一共需"&int(BRemit+BRemit*remit/100)&Curr&"，而你的现金只有"&usermomey&Curr&"。）</li>"
      end if
      if BankUser = login_username then
          FoundErr=true
          Errmsg=Errmsg+"<br>"+"<li>给自己汇款很好玩吗？</li>"
      end if
      if BRemit < L_trade then
          FoundErr=true
          Errmsg=Errmsg+"<br>"+"<li>HI！亲爱的客户，您转的钱也未免太……少了点吧？</li>"
      end if
      if BRemit > H_trade then
          FoundErr=true
          Errmsg=Errmsg+"<br>"+"<li>晕，你的钱太多太重了，请分次，ＯＫ？</li>"
      end if
  end if
  if not FoundErr then
      '汇方更新信息
      cjconn.execute ("update bankuser set events='"&BRemit&"|转帐|"&now()&"' where bankuserid="&BankUserID)
      cjconn.execute ("update bank set StockPile=StockPile-"&int(BRemit*remit/100)&" where bankid="&BankID)
      if OpenEventsLog then
          cjconn.execute ("insert into bankevent (bankid,name1,name2,events,trade) values ("&bankid&",'"&login_username&"','"&BankUser&"','汇款',"&BRemit&")")
      end if
      conn.execute ("update user_data set emoney=emoney-"&int(BRemit+BRemit*remit/100)&" where username='"&login_username&"'")
      '记录盈利
      call record(BRemit*remit/100)
      '收方更新信息
      cjconn.execute ("update bankuser set CurrDeposit=CurrDeposit+"&BRemit&" where bankuserid="&TakeOverUser)
      cjconn.execute ("update bank set alldeposit=alldeposit+"&BRemit&",StockPile=StockPile+"&BRemit&" where bankid="&TakeOverBank)
      dim topic,word
	  topic="[银行汇款]请查收"
	  word=login_username&"从"&bankname&"汇"&BRemit&Curr&"到"&TakeBank&"给你，已经存入你在"&TakeBank&"的账户中。"
	  sql="insert into user_mail(accept_u,send_u,topic,word,tim,types,isread) values('"&BankUser&"','"&login_username&"','"&topic&"','"&word&"',Now(),1,0)"
	  conn.Execute(sql)
	  call yaoyue_banksuc
  end if
end sub
%>