<!--#include file=conn.asp-->
<!-- #include file="inc/const.asp" -->
<!-- #include file="bank/const_admin.asp" -->
<!--#include file=bank_data.asp-->
<!-- #include file="bank/bank_const.asp" -->
<%
'=========================================================
' file: bank_admin.asp
' Version:2.1 for Dvbbs7.0
' date: 2004-1-7
' script modified by winriver from yaoyue Version
'=========================================================
' copyright (c) 2004  all rights reserved.
' web: http://www.paperbridge.net http://www.winriver.org
' email: huanghetv@163.com winriver2002@yahoo.com
'=========================================================
Head()
dim admin_flag
	admin_flag=",15,"
	if not Dvbbs.master or instr(","&session("flag")&",",admin_flag)=0 then
		Errmsg=ErrMsg + "<BR><li>本页面为管理员专用，请<a href=admin_index.asp target=_top>登录</a>后进入。<br><li>您没有管理本页面的权限。"
    dvbbs_error()
else
    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+errmsg6+"非法操作？"
    end if
    if founderr then
       dvbbs_error()
    end if
    conn.close
    set conn=nothing
    cjconn.close
    set cjconn=nothing
end if
sub ChiefMSG()
%>
<form action=bank_admin.asp?action=ChiefMSGsave method=post>
<table width="95%" border="0" cellspacing="1" cellpadding="3"  align=center class="tableborder">
<tr> 
<th height="23" colspan="2">钱庄总信息设置</th>
</tr>
<tr> 
<td width="40%" class=forumrow>虚拟货币名称</td>
<td width="60%" class=forumrow> 
<input name="curr" size="35" value="<%=curr%>">
</td>
</tr>
<tr> 
<td width="40%" class=forumrow>最低单笔交易金额</td>
<td width="60%" class=forumrow> 
<input name="l_trade" size="35" value="<%=l_trade%>">
</td>
</tr>
<tr> 
<td width="40%" class=forumrow>最高单笔交易金额</td>
<td width="60%" class=forumrow> 
<input name="h_trade" size="35" value="<%=h_trade%>">
</td>
</tr>
<tr> 
<td width="40%" class=forumrow>定期存款的最低金额</td>
<td width="60%" class=forumrow> 
<input name="l_timedeposit" size="35" value="<%=l_timedeposit%>">
</td>
</tr>
<tr> 
<td width="40%" class=forumrow>定期存款的最高金额</td>
<td width="60%" class=forumrow> 
<input name="h_timedeposit" size="35" value="<%=h_timedeposit%>">
</td>
</tr>
<tr> 
<td width="40%" class=forumrow>活期存款日利率</td>
<td width="60%" class=forumrow> 
<input name="c_dateprofit" size="35" value="<%=c_dateprofit%>">
</td>
</tr>
<tr> 
<td width="40%" class=forumrow>定期存款日利率</td>
<td width="60%" class=forumrow> 
<input name="t_dateprofit" size="35" value="<%=t_dateprofit%>">
</td>
</tr>
<tr> 
<td width="40%" class=forumrow>贷款日利率</td>
<td width="60%" class=forumrow> 
<input name="p_dateprofit" size="35" value="<%=p_dateprofit%>">
</td>
</tr>
<tr> 
<td width="40%" class=forumrow>贷款偿还期限</td>
<td width="60%" class=forumrow> 
<input name="p_repay" size="35" value="<%=p_repay%>">
</td>
</tr>
<tr> 
<td width="40%" class=forumrow>贷款最少天数（即必须贷几天后才能还）</td>
<td width="60%" class=forumrow> 
<input name="p_datecount" size="35" value="<%=p_datecount%>">
</td>
</tr>
<tr> 
<td width="40%" class=forumrow>转帐手继费率，最好5以内</td>
<td width="60%" class=forumrow> 
<input name="virement" size="35" value="<%=virement%>">
</td>
</tr>
<tr> 
<td width="40%" class=forumrow>汇款手继费率，最好5以内</td>
<td width="60%" class=forumrow> 
<input name="remit" size="35" value="<%=remit%>">
</td>
</tr>
<tr> 
<td width="40%" class=forumrow>开设钱庄需要的最少金额</td>
<td width="60%" class=forumrow> 
<input name="regbank" size="35" value="<%=regbank%>">
</td>
</tr>
<tr> 
<td width="40%" class=forumrow>官方钱庄掌柜的工资</td>
<td width="60%" class=forumrow> 
<input name="salary" size="35" value="<%=salary%>">
</td>
</tr>
<tr> 
<td width="40%" class=forumrow>官方钱庄掌柜每几天发一次工资</td>
<td width="60%" class=forumrow> 
<input name="s_datecount" size="35" value="<%=s_datecount%>">
</td>
</tr>
<tr> 
<td width="40%" class=forumrow></td>
<td width="60%" class=forumrow> 
<input type="submit" name="s" value="设置">
</td>
</tr>
</table>
</form>
<%
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 [dv_user] set userwealth=userwealth+"&(crs(1)+crs(2))&" where username='"&crs(0)&"'")
                  '后两句那一刀加
                   Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userwealth").text=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userwealth").text+ccur(crs(1)+crs(2))
                  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
%>
<table width="95%" border="0" cellspacing="1" cellpadding="3"  align=center class="tableborder">
<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=bank_admin.asp?action=bank&id="&crs(0)&"&vt=open onclick=""return confirm('确定开放该钱庄？');"">开放</a>　<a href=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=bank_admin.asp?action=bank&id="&crs(0)&"&vt=off onclick=""return confirm('确定关闭该钱庄？');"">关闭</a>　<a href=bank_admin.asp?action=bank&id="&crs(0)&"&vt=del onclick=""return confirm('这也将删一切与该钱庄有关的信息，确定删该钱庄？');"">删除</a>　<a href=bank_admin.asp?action=bank&bankid="&crs(0)&">进入</a></td></tr>"
                  crs.movenext
              loop
          end if
          set crs=nothing
          response.write "</table>"
      end if
  else
%>
<form action=bank_admin.asp?bankid=<%=bankid%>&action=banksave method=post>
<table width="95%" border="0" cellspacing="1" cellpadding="3"  align=center class="tableborder">
<tr> 
<td width="100%" colspan="2" class=forumrow>一般的，钱庄本身的信息除是否为官方钱庄，是否开放事件记录，官方钱庄的掌柜更换，更换钱庄名称等之外，应该让掌柜自行设置（掌柜办公室里）</td>
</tr>
<tr> 
<th height="23" colspan="2"><%=bankname%>信息设置</th>
</tr>
<tr> 
<td width="50%" class=forumrow>钱庄名称</td>
<td width="50%" class=forumrow> 
<input maxlength="6" name="bankname" size="35" value="<%=bankname%>">
</td>
</tr>
<tr> 
<td width="50%" class=forumrow>掌柜名字</td>
<td width="50%" class=forumrow> 
<input name="bankmaster" size="35" value="<%=bankmaster%>">
</td>
</tr>
<tr> 
<td width="50%" class=forumrow>钱庄介绍</td>
<td width="50%" class=forumrow> 
<input maxlength=30 name="msg" size="35" value="<%=msg%>">
</td>
</tr>
<tr> 
<td width="50%" class=forumrow>存款总额</td>
<td width="50%" class=forumrow> 
<input name="alldeposit" size="35" value="<%=alldeposit%>" disabled>
</td>
</tr>
<tr> 
<td width="50%" class=forumrow>魅力库存</td>
<td width="50%" class=forumrow> 
<input name="loveliness" size="35" value="<%=loveliness%>">
</td>
</tr>
<tr> 
<td width="50%" class=forumrow>库存的现金</td>
<td width="50%" class=forumrow> 
<input name="stockpile" size="35" value="<%=stockpile%>">
</td>
</tr>
<tr> 
<td width="50%" class=forumrow>销户手继费（0至10000之间的整数）</td>
<td width="50%" class=forumrow> 
<input name="log_on" size="35" value="<%=log_on%>">
</td>
</tr>
<tr> 
<td width="50%" class=forumrow>客户数</td>
<td width="50%" class=forumrow> 
<input name="clientcount" size="35" value="<%=clientcount%>" disabled>
</td>
</tr>
<tr> 
<td width="50%" class=forumrow>贷款倍数（1至10000之间的整数）</td>
<td width="50%" class=forumrow> 
<input name="zhml" size="35" value="<%=zhml%>">
</td>
</tr>
<tr> 
<td width="50%" class=forumrow>转帐汇款必须到达的最低积分（建议0至10000之间的整数）</td>
<td width="50%" class=forumrow> 
<input name="ep" size="35" value="<%=ep%>">
</td>
</tr>
<tr> 
<td width="50%" class=forumrow>该钱庄被贷的款数</td>
<td width="50%" class=forumrow> 
<input name="bpaymentforgoods" size="35" value="<%=bpaymentforgoods%>" disabled>
</td>
</tr>
<tr> 
<td width="50%" class=forumrow>开户最低积分（0至10000之间）</td>
<td width="50%" class=forumrow> 
<input name="integral" size="35" value="<%=integral%>">
</td>
</tr>
<tr> 
<td width="50%" class=forumrow>同一人同时贷款的最高次数（1至100之间）</td>
<td width="50%" class=forumrow> 
<input name="pfgtimes" size="35" value="<%=pfgtimes%>">
</td>
</tr>
<tr> 
<td width="50%" class=forumrow>是否官方钱庄</td>
<td width="50%" 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="50%" class=forumrow>是否开放事件记当</td>
<td width="50%" 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="50%" class=forumrow></td>
<td width="50%" class=forumrow> 
<input type="submit" name="s" value="修改">
</td>
</tr>
</table>
</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"))
  response.write "<table width='95%' border='0' cellspacing='1' cellpadding='3'  align=center><tr><td height='23' colspan='2' ><font color=#ff0000>修改成功，请从左边选择其它的操作！！</td></tr></table>"
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 [dv_user] where username='"&trim(request.form("bankmaster"))&"'"
      set crs=conn.execute (csql)
      if crs.bof and crs.eof then
          founderr=true
          errmsg=errmsg+errmsg6+"没找到你所输入的掌柜用户名，请确认该用户名存在！"
          exit sub
      else
          FoundUser=true
      end if
      set crs=nothing
      if request.form("everybody") = "1" then
          if everybody then
              cjconn.execute ("update evbankmasterlog set mastername='"&request.form("bankmaster")&"' 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 [dv_user] set userwealth=userwealth-"&l_trade&" where username='"&trim(request.form("bankmaster"))&"'")
          '后两句那一刀加
          Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userwealth").text=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userwealth").text-ccur(l_trade)
      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 "<table width='95%' border='0' cellspacing='1' cellpadding='3'  align=center><tr><td height='23' colspan='2' ><font color=#ff0000>修改成功，请从左边选择其它的操作！！</td></tr></table>"
end sub
%>
</body>
</html>

