<!-- #include file="include/onlogin.asp" -->
<!-- #include file="include/conn.asp" -->
<!--#include file="z_bank_data.asp"-->
<!--#include file="z_bank_const.asp"-->
<html>
<title><--管理页面</title>
<link rel="stylesheet" href="forum_admin.css" type="text/css">
<meta NAME=GENERATOR Content="Microsoft FrontPage 5.0"Microsoft FrontPage 3.0"" CHARSET=GB2312>
<BODY leftmargin="0" bottommargin="0" rightmargin="0" topmargin="0" marginheight="0" marginwidth="0">
<%
'=========================================================
' File: z_bank_admin.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
'=========================================================
tit="<a href=z_bank_admin.asp?action=bank >银行管理</a> ┋ " & _
    "<a href=z_bank_admin.asp?action=ChiefMSG >银行参数设置</a> ┋ " 
    response.write header(10,tit)
    Response.Write "<table width='95%' border='0' cellspacing='1' cellpadding='3'  align=center><tr><td height='23' colspan='2' ><font color=#ff0000><B>注意</B></font>：<BR>后台对于所输入的数据可没有作任何过滤，一旦出错将可能影响整个银行，小心不要输入错误啊！！</td></tr></table>"
    if request("action")="ChiefMSG" then
        call ChiefMSG
    elseif request("action")="bank" then
        call bank()
    elseif request("action")="ChiefMSGSave" then
        call ChiefMSGSave
    elseif request("action")="BankSave" then
        call BankSave
    else
        FoundErr=true
        Errmsg=Errmsg+"<br>"+"<li>非法操作？？？？"
    end if
    if FoundErr then
       call bank_error()
    end if
    conn.close
    set conn=nothing
    cjconn.close
    set cjconn=nothing



sub ChiefMSG()
dim objFSO
dim fdata
dim objCountFile
on error resume next
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
if request("save")="" then
	Set objCountFile = objFSO.OpenTextFile(Server.MapPath("z_bank_ChiefMSG.asp"),1,True)
	If Not objCountFile.AtEndOfStream Then fdata = objCountFile.ReadAll
else
	fdata=request("fdata")
	Set objCountFile=objFSO.CreateTextFile(Server.MapPath("z_bank_ChiefMSG.asp"),True)
	objCountFile.Write fdata
end if
objCountFile.Close
Set objCountFile=Nothing
Set objFSO = Nothing
if err.number<>0 then
response.write "您的空间不支持FSO，请同您的空间商联系，或者查看相关权限设置<br>"&Err.Description&""
response.end
end if
%> 
<form method=post action="?action=ChiefMSG">
<div align="center"><center>
<table width="608" border="1" cellspacing="0" cellpadding="3" class="tableBorder" bordercolor="#000080" style="border-collapse: collapse">
<tr> 
<th width="663" class="tableHeaderText" height=25>银行总信息设置
</th>
</tr>
<tr>
<td class="forumrow" width="663">
注意：文件将被保存在你安装目录下的<B>z_bank_ChiefMSG.asp</B>里，如果您的空间不支持<font color="red">FSO</font>，请直接编辑该文件！内容必须在《%%》之中
</td>
</tr>
<tr>
<td class="forumrow" width="663">
<textarea name="fdata" cols="83" rows="15"><%=fdata%></textarea>
</td>
</tr>
<tr>
<td class="forumrow" width="663">
<input type="reset" name="Reset" value="重新修改">
<input type="submit" name="save" value="提交修改"> 当前文件路径：<b><%=Server.MapPath("z_bank_ChiefMSG.asp")%></b>
</td>
</tr>
</form>
</table>
  </center>
</div><br><br>
<%
end sub


sub bank()
  if BankID=0 then
      if request("vt")="open" then
          cjconn.execute ("update bank set opened=1 where bankid="&cint(request("ID")))
          Response.Write "ID为"&request("ID")&"的银行成功开启，请选择其它操作"
      elseif request("vt")="off" then
          cjconn.execute ("update bank set opened=0 where bankid="&cint(request("ID")))
          Response.Write "ID为"&request("ID")&"的银行成功关闭，请选择其它操作"
      elseif request("vt")="del" then
          csql="select name,CurrDeposit,TimeDeposit from bankuser where bankid="&cint(request("ID"))
          set crs=cjconn.execute (csql)
          if not crs.bof and not crs.eof then
              do while not crs.eof
                  conn.execute ("update user_data set emoney=emoney+"&(crs(1)+crs(2))&" where username='"&crs(0)&"'")
                  crs.movenext
              loop
          end if
          set crs=nothing
          cjconn.execute ("delete from bank where bankid="&cint(request("ID")))
          cjconn.execute ("delete from bankuser where bankid="&cint(request("ID")))
          cjconn.execute ("delete from TimeDeposit where bankid="&cint(request("ID")))
          cjconn.execute ("delete from PaymentForGoods where bankid="&cint(request("ID")))
          cjconn.execute ("delete from bankevent where bankid="&cint(request("ID")))
          cjconn.execute ("delete from EVBankMasterLog where bankid="&cint(request("ID")))
          Response.Write "ID为"&request("ID")&"的银行删除关闭，请选择其它操作"
      else
%>
<div align="center">
  <center>
<table width="600" border="1" cellspacing="0" cellpadding="3" class="tableBorder" bordercolor="#000080" style="border-collapse: collapse">
<tr> 
<td width="100%" class=Forumrow>你可以选择下面的银行进行操作</td>
</tr>
<tr> 
<th height="23">以下为未开放的银行</th>
</tr>
<%
          csql="select bankid,bankname,bankmaster from bank where opened=no order by bankid desc"
          set crs=cjconn.execute (csql)
          if crs.bof and crs.eof then
              Response.Write "<tr><td width='100%' class=Forumrow>还没有未开放的银行</td></tr>"
          else
              do while not crs.eof
                  Response.Write "<tr><td width='100%' class=Forumrow>银行ID："&crs(0)&"　|　银行名称："&crs(1)&"　|　行长用户名："&crs(2)&"　|　<a href=z_bank_admin.asp?action=bank&ID="&crs(0)&"&vt=open onclick=""return confirm('确定开放该银行？');"">开放</a>　<a href=z_bank_admin.asp?action=bank&ID="&crs(0)&"&vt=del onclick=""return confirm('这也将删一切与该银行有关的信息，确定删该银行？');"">删除</a> </td></tr>"
                  crs.movenext
              loop
          end if
          Response.Write "<tr><th height='23'>以下为已开放的银行</th></tr>"
          csql="select bankid,bankname,bankmaster from bank where opened=yes order by bankid desc"
          set crs=cjconn.execute (csql)
          if crs.bof and crs.eof then
              Response.Write "<tr><td width='100%' class=Forumrow>还没有开放的银行</td></tr>"
          else
              do while not crs.eof
                  Response.Write "<tr><td width='100%' class=Forumrow>银行ID："&crs(0)&"　|　银行名称："&crs(1)&"　|　行长用户名："&crs(2)&"　|　<a href=z_bank_admin.asp?action=bank&ID="&crs(0)&"&vt=off onclick=""return confirm('确定关闭该银行？');"">关闭</a>　<a href=z_bank_admin.asp?action=bank&ID="&crs(0)&"&vt=del onclick=""return confirm('这也将删一切与该银行有关的信息，确定删该银行？');"">删除</a>　<a href=z_bank_admin.asp?action=bank&bankid="&crs(0)&">进入</a> | <a href='z_bank_ClientEvents.asp?bankid="&crs(0)&"' target=_blank >客户管理 </a> | <a href='z_bank_ClientEvents.asp?bankid="&crs(0)&"&action=events' target=_blank >事件管理 </a> </td></tr>"
                  crs.movenext
              loop
          end if
          set crs=nothing
          Response.Write "</table>"
      end if
  else
%>
<form action=z_bank_admin.asp?bankid=<%=BankID%>&action=BankSave method=post>
  </center>
</div>
<div align="center">
  <center>
<table width="600" border="1" cellspacing="0" cellpadding="3" class="tableBorder" bordercolor="#000080" style="border-collapse: collapse">
<tr> 
<td width="100%" colspan="2" class=Forumrow>一般的，银行本身的信息除是否为公家银行，是否开放事件记录，公家银行的行长更换，更换银行名称等之外，应该让行长自行设置（行长办公室里）</td>
</tr>
<tr> 
<th height="23" colspan="2"><%=BankName%>信息设置</th>
</tr>
<tr> 
<td width="40%" class=Forumrow>银行名称</td>
<td width="60%" class=Forumrow> 
<input name="BankName" size="35" value="<%=BankName%>">
</td>
</tr>
<tr> 
<td width="40%" class=Forumrow>行长名字</td>
<td width="60%" class=Forumrow> 
<input name="BankMaster" size="35" value="<%=BankMaster%>">
</td>
</tr>
<tr> 
<td width="40%" class=Forumrow>存款总额</td>
<td width="60%" class=Forumrow> 
<input name="AllDeposit" size="35" value="<%=AllDeposit%>" disabled>
</td>
</tr>
<tr> 
<td width="40%" class=Forumrow>魅力库存</td>
<td width="60%" class=Forumrow> 
<input name="LoveLiness" size="35" value="<%=LoveLiness%>">
</td>
</tr>
<tr> 
<td width="40%" class=Forumrow>库存的现金</td>
<td width="60%" class=Forumrow> 
<input name="StockPile" size="35" value="<%=StockPile%>">
</td>
</tr>
<tr> 
<td width="40%" class=Forumrow>销户手继费（100至1000之间的整数）</td>
<td width="60%" class=Forumrow> 
<input name="Log_on" size="35" value="<%=Log_on%>">
</td>
</tr>
<tr> 
<td width="40%" class=Forumrow>银行介绍</td>
<td width="60%" class=Forumrow> 
<input name="MSG" size="35" value="<%=MSG%>">
</td>
</tr>
<tr> 
<td width="40%" class=Forumrow>客户数</td>
<td width="60%" class=Forumrow> 
<input name="ClientCount" size="35" value="<%=ClientCount%>" disabled>
</td>
</tr>
<tr> 
<td width="40%" class=Forumrow>贷款倍数（建议5至40之间的整数）</td>
<td width="60%" class=Forumrow> 
<input name="ZHML" size="35" value="<%=ZHML%>">
</td>
</tr>
<tr> 
<td width="40%" class=Forumrow>转帐汇款必须到达的最低积分（建议200至1000之间的整数）</td>
<td width="60%" class=Forumrow> 
<input name="EP" size="35" value="<%=EP%>">
</td>
</tr>
<tr> 
<td width="40%" class=Forumrow>该银行被贷的款数</td>
<td width="60%" class=Forumrow> 
<input name="BPaymentForGoods" size="35" value="<%=BPaymentForGoods%>" disabled>
</td>
</tr>
<tr> 
<td width="40%" class=Forumrow>开户最低积分（0至1000之间）</td>
<td width="60%" class=Forumrow> 
<input name="integral" size="35" value="<%=integral%>">
</td>
</tr>
<tr> 
<td width="40%" class=Forumrow>同一人同时贷款的最高次数</td>
<td width="60%" class=Forumrow> 
<input name="PFGTimes" size="35" value="<%=PFGTimes%>">
</td>
</tr>
<tr> 
<td width="40%" class=Forumrow>是否公家银行</td>
<td width="60%" class=Forumrow> 
否<input type="radio" name="EveryBody" size="35" value=0 <%if not EveryBody then Response.Write " checked"%>>　是<input type="radio" name="EveryBody" value=1 <%if EveryBody then Response.Write " checked"%>>
</td>
</tr>
<tr> 
<td width="40%" class=Forumrow>是否开放事件记当</td>
<td width="60%" class=Forumrow> 
否<input type="radio" name="OpenEventsLog" size="35" value=0 <%if not OpenEventsLog then Response.Write " checked"%>>　是<input type="radio" name="OpenEventsLog" value=1 <%if OpenEventsLog then Response.Write " checked"%>>
</td>
</tr>
<tr> 
<td width="40%" class=Forumrow></td>
<td width="60%" class=Forumrow> 
<input type="submit" name="s" value="修改">
</td>
</tr>
</table>
  </center>
</div>
</form>
<%
  end if
end sub

sub ChiefMSGSave()
  cjconn.execute ("update bankconfig set Curr='"&Request.Form("Curr")&"',L_trade="&Request.Form("L_trade")&",H_trade="&Request.Form("H_trade")&",L_TimeDeposit="&Request.Form("L_TimeDeposit")&",H_TimeDeposit="&Request.Form("H_TimeDeposit")&",C_DateProfit="&Request.Form("C_DateProfit")&",T_DateProfit="&Request.Form("T_DateProfit")&",P_DateProfit="&Request.Form("P_DateProfit")&",P_Repay="&Request.Form("P_Repay")&",P_DateCount="&Request.Form("P_DateCount")&",virement="&Request.Form("virement")&",remit="&Request.Form("remit")&",RegBank="&Request.Form("RegBank")&",salary="&Request.Form("salary")&",S_DateCount="&Request.Form("S_DateCount")&" where Active=1")
  Response.Write "修改成功"
end sub

sub BankSave()
  dim FoundUser,NotFoundBankUser
  FoundUser=false
  FoundBankUser=false
  if Request.Form("BankMaster") <> BankMaster then
      csql="select name from bankuser where bankid="&BankID&" and name='"&trim(Request.Form("BankMaster"))&"'"
      set crs=cjconn.execute (csql)
      if crs.bof and crs.eof then
          NotFoundBankUser=true
      else
          NotFoundBankUser=false
      end if
      csql="select username from user_data where username='"&trim(Request.Form("BankMaster"))&"'"
      set crs=conn.execute (csql)
      if crs.bof and crs.eof then
          FoundErr=true
          Errmsg=Errmsg+"<br>"+"<li>没找到你所输入的行长用户名，请确认该用户名存在！"
          exit sub
      else
          FoundUser=true
      end if
      set crs=nothing
      if Request.Form("EveryBody") = 1 then
          if EveryBody then
              cjconn.execute ("update EVBankMasterLog where bankid="&BankID)
          else
              cjconn.execute ("insert into EVBankMasterLog (bankid,MasterName) values ("&BankID&",'"&Request.Form("BankMaster")&"')")
          end if
      end if
      if NotFoundBankUser and FoundUser then
          cjconn.execute ("insert into bankuser (bankid,name,CurrDeposit,events) values ("&BankID&",'"&trim(Request.Form("BankMaster"))&"',"&L_trade&",'"&L_trade&"|开户|"&now()&"')")
          conn.execute ("update user_data set emoney=emoney-"&L_trade&" where username='"&trim(Request.Form("BankMaster"))&"'")
      end if
      Response.Write "你已经把"&bankname&"的行长改为"&trim(Request.Form("BankMaster"))&"了，应该及时通知他及原来的行长，"
  else
      if Request.Form("EveryBody") = 0 then
          if EveryBody then
              cjconn.execute ("delete from EVBankMasterLog where bankid="&BankID)
          end if
      end if
      if Request.Form("EveryBody") = 1 then
          if not EveryBody then
              cjconn.execute ("insert into EVBankMasterLog (bankid,MasterName) values ("&BankID&",'"&Request.Form("BankMaster")&"')")
          end if
      end if
  end if
  cjconn.execute ("update bank set BankName='"&Request.Form("BankName")&"',BankMaster='"&Request.Form("BankMaster")&"',LoveLiness="&Request.Form("LoveLiness")&",StockPile="&Request.Form("StockPile")&",Log_on="&Request.Form("Log_on")&",MSG='"&Request.Form("MSG")&"',ZHML="&Request.Form("ZHML")&",EP="&Request.Form("EP")&",Integral="&Request.Form("Integral")&",PFGTimes="&Request.Form("PFGTimes")&",EveryBody="&Request.Form("EveryBody")&",EventsLog="&Request.Form("OpenEventsLog")&" where bankid="&BankID)
  Response.Write "修改成功，请从左边选择其它的操作"
end sub
%><br><br>
</BODY>
</html>