<!--#include file="conn.asp"-->
<!-- #include file="inc/const.asp" -->
<!-- #include file="chkuser.asp" -->
<!-- #include file="inc/char.asp" -->
<!--#include file="inc/theme.asp"-->
<!--#include file="data.asp"-->


<HTML><HEAD><TITLE>社区银行</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META 社区银行插件 for 动网 玮琦制作>
<STYLE type=text/css>TD {
	WORD-SPACING: 1px; FONT: 12px "宋体"; LETTER-SPACING: 1px
}
A:link {
	COLOR: #000000; TEXT-DECORATION: none
}
A:visited {
	COLOR: #000000; TEXT-DECORATION: none
}
A:hover {
	COLOR: #009900; TEXT-DECORATION: underline
}
.p1 {
	FONT-SIZE: 12px
}
BODY {
	FONT-SIZE: 9pt; SCROLLBAR-HIGHLIGHT-COLOR: buttonface; SCROLLBAR-SHADOW-COLOR: buttonface; SCROLLBAR-3DLIGHT-COLOR: buttonhighlight; SCROLLBAR-TRACK-COLOR: #eeeeee; FONT-FAMILY: 宋体; SCROLLBAR-DARKSHADOW-COLOR: buttonshadow
}
.HoverBC {
	BACKGROUND-COLOR: #d1d9e2
}
.LinkGrid {
	BACKGROUND-COLOR: #f8f8f8
}
.p1 {
	PADDING-LEFT: 2px; FONT-SIZE: 12px; LINE-HEIGHT: 12pt
}
.p2 {
	PADDING-LEFT: 3pt; FONT-SIZE: 12px; LINE-HEIGHT: 14pt
}
INPUT {
	BORDER-TOP-WIDTH: 1px; BORDER-LEFT-WIDTH: 1px; FONT-SIZE: 9pt; BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-WIDTH: 1px; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; FONT-FAMILY: "宋体"; BACKGROUND-COLOR: #fafafa; BORDER-RIGHT-WIDTH: 1px; BORDER-RIGHT-COLOR: #000000
}
TEXTAREA {
	BORDER-TOP-WIDTH: 1px; BORDER-LEFT-WIDTH: 1px; FONT-SIZE: 9pt; BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-WIDTH: 1px; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; FONT-FAMILY: 宋体; BACKGROUND-COLOR: #efefef; BORDER-RIGHT-WIDTH: 1px; BORDER-RIGHT-COLOR: #000000
}
SELECT {
	BORDER-TOP-WIDTH: 1px; BORDER-LEFT-WIDTH: 1px; FONT-SIZE: 9pt; BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-WIDTH: 1px; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; FONT-FAMILY: 宋体; BACKGROUND-COLOR: #efefef; BORDER-RIGHT-WIDTH: 1px; BORDER-RIGHT-COLOR: #000000
}
</STYLE>

<META content="MSHTML 6.00.2713.1100" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
<% dim mymoney,sql1,Rs1,bankmoney,bankac,deposittime,lendtime,numtime,deposit,interest,bankinterest,numtime1,loan,loaninterest,sqlstr,endtime,msg,credit,returnloan,loantime,savings,lendmoney,deltacredit
if membername="" then
%>
<script language=vbscript>
  location.href = "login.asp"
</script>
<%
else
Tabletitlecolor="#9898ba"
returnloan = Request.Form("returnloan")
call nav()
if not isnumeric(returnloan) then
%>
<script language="vbscript">
msgbox"您必须输入数字！"
history.back
</script>

<%
elseif returnloan-int(returnloan)<>0 or loan<0 then
%>
<script language="vbscript">
msgbox"请输入正整数钱数！"
history.back
</script>
<%
else

returnloan = int(Request.Form("returnloan"))

sql="Select  * from user where UserName='"&membername&"'"  
set rs=conn.Execute(sql)

	mymoney=rs("userWealth")
	rs.close
	
	
	sql="SELECT * FROM bank WHERE UserName='"&membername&"'"
	Set Rs=conn.Execute(sql)
	if rs.bof then
    rs.close
	call headline(1)
%>


<div align="center">
<center>
<table border="0" width="470" cellspacing="1" cellpadding="0">
<tr>
<td class=p2 width="100%">
<p align="center"><br><%=membername%>，您好，欢迎进行银行业务，请您先在银行开个户头！
<p align="center">□-<a href="openaccount.asp">我要开户</a>&nbsp;&nbsp;&nbsp; □-<a href="index.asp">离开银行<br></a></p> 
</td> 
</tr> 
</table> 
</center> 
</div> 
<% 
else 

 loantime=date

 savings=rs("depositmoney")
 interest=rs("accrual")
 lendmoney=rs("lendmoney")
 loaninterest=rs("loaninterest")
 lendtime=rs("lendtime")
 numtime=datediff("d",lendtime,date)

 if numtime= 0 then
 deltacredit=0
 elseif numtime < 11 then
 deltacredit=int((numtime-10)*returnloan/1000)
 else
 deltacredit=int((numtime-10)*lendmoney/700)
 end if
 rs.close

 if returnloan > lendmoney + loaninterest then
	msg= "不用那么客气，想捐款的话请去希望工程委员会。"
 elseif savings+interest < returnloan then
	msg= "您的存款不足以偿还贷款，请存入现金或稍后偿还贷款。"
 else
	if numtime < 11 then
	sqlstr="update bank set lendmoney=lendmoney+loaninterest-"&returnloan&" , loaninterest=0,lendtime='"&loantime&"' ,depositmoney=depositmoney+accrual-"&returnloan&",deposittime='"&loantime&"',accrual=0 where username='"&membername&"'"
	conn.Execute sqlstr
	else 
	sqlstr="update bank set lendmoney=lendmoney-"&returnloan&",depositmoney=accrual+depositmoney-"&returnloan&",deposittime='"&loantime&"',accrual=0 where username='"&membername&"'"
	conn.Execute sqlstr
	end if

	sqlstr="update user set userCP=userCP-"&deltacredit&" where username='"&membername&"'"
	conn.Execute sqlstr
	msg= "偿还贷款业务已完成，谢谢您的惠顾，希望能再次为您服务。"

 	sqlstr="update bank set depositmoney=depositmoney + accrual, deposittime='"&loantime&"' where username='银行'"
	conn.Execute sqlstr

	savings=savings+interest-returnloan
	loan=lendmoney+loaninterest-returnloan

 end if
 
 
%>
<TABLE cellSpacing=0 cellPadding=0 width=770 align=center border=0>
  <TBODY>
  <TR>
    <TD width=19 height=70>&nbsp; </TD>
    <TD width=207 height=65></TD>
    <TD width=59 height=65>&nbsp;</TD>
    <TD width=474 height=65></TD>
    <TD width=11 height=65>&nbsp;</TD></TR>
  <TR bgColor=#1f7bbe>
    <TD colSpan=5 height=3></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=770 align=center border=0>
  <TBODY>
  <TR>
    <TD width=1 bgColor=#000000 height=11 rowSpan=6><IMG height=1 
      src="pic/spacer.gif" width=1></TD>
    <TD bgColor=#000000 colSpan=5 height=1><IMG height=1 
      src="pic/spacer.gif" width=1></TD>
    <TD width=1 bgColor=#000000 rowSpan=6><IMG height=1 
      src="pic/spacer.gif" width=1></TD></TR>
  <TR>
    <TD colSpan=5><!-- 栏目分类 -->
      <TABLE cellSpacing=0 cellPadding=5 width="100%" border=0>
        <TBODY>
        <TR>
          <TD width=5></TD>
          <TD>您好！您现在的位置：<a href=index.asp>社区</a>--&gt; 银行 </TD>
          <TD align=right><A href="bank.asp">营业厅</A> 
            | <A href="deposit.asp">存款</A> | <A 
            href="withdraw.asp">取款</A> | <A 
            href="transfer.asp">转帐</A>  | <A 
            href="loan.asp">贷款</A> | <A 
            href="returnloan.asp">偿还贷款</A>    
			<% if master then
			    %>
				 | <A 
            href="admin_bank.asp">管理</A> 
			<% end if%>
        </TD></TR></TBODY></TABLE></TD></TR>
  <TR>
    <TD background=pic/linexu.gif colSpan=5 height=1><IMG height=1 
      src="pic/spacer.gif" width=1></TD></TR>
  <TR>
    <TD class=LinkGrid vAlign=top width=170><!-- 功能列表 -->
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD vAlign=top height=18>
            <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
              <TBODY>
              <TR>
                <TD class=HoverBC align=middle height=22><IMG 
                  src="pic/spacer.gif"><IMG 
                  src="pic/spacer.gif"><IMG height=16 
                  src="pic/userlist.gif" width=16 align=absMiddle> 
                我的资料</TD></TR>
              <TR>
                <TD height=1><IMG src="pic/spacer.gif"><IMG 
                  src="pic/spacer.gif"><IMG 
                src="pic/spacer.gif"></TD></TR></TBODY></TABLE></TD></TR>
        <TR>
          <TD class=LinkGrid>
            <TABLE cellSpacing=0 cellPadding=3 width="100%" border=0>
              <TBODY>
              <TR>
                <TD align=middle colSpan=2 height=5></TD></TR>
              <TR align=middle>
                <TD colSpan=2></TD></TR>
              <TR>
                <TD align=right width="38%">姓名：</TD>
                <TD width="62%"><%=membername%></TD></TR>
              <TR>
                <TD align=right width="38%">现金：</TD>
                <TD width="62%"><%=mymoney%> 两银子</TD></TR>
              <TR>
                <TD align=right width="38%">存款：</TD>
                <TD width="62%"><%=savings%> 两银子</TD></TR>
              <TR>
                <TD align=right width="38%">利息：</TD>
                <TD width="62%"><%=interest%> 两银子</TD></TR>
              <TR>
                <TD align=right width="38%">总资产：</TD>
                <TD width="62%"><%=mymoney+savings+interest%> 两银子</TD>
              </TR>
              <TR>
                <TD align=right width="38%">贷款：</TD>
                <TD width="62%"><%=loan%> 两银子</TD>
              </TR>
              <TR>
                <TD align=middle colSpan=2 height=5></TD></TR></TBODY></TABLE></TD></TR>
        <TR align=left>
          <TD></TD></TR></TBODY></TABLE></TD>
    <TD width=1 background=pic/linexu.gif><IMG 
      src="pic/spacer.gif"></TD>

    <TD vAlign=top align=middle width=582><!-- 主要窗口 -->
      <TABLE cellSpacing=0 cellPadding=0 width="97%" border=0>
        <TBODY>
        <TR>
          <TD width="59%">
 <%=msg%>		  
		  <BR><BR>
            <BR>
          </TD>
          <TD class=p2 width="41%"><BR>　　更及时的关心，更周到的服务，所有的一切，尽在社区银行。<BR>　　您的利息已全部转成本金，请注意查收。您的信用额提高了<%=deltacredit*(-1)%>点。<BR>　　本银行全自由式，你随时都可以从本银行存储或提取现金。<BR>　　你将不会遇到本银行倒闭或无库存资金支持给你！</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=5 width=770 align=center border=0>
  <TBODY>
  <TR bgColor=#000000>
    <TD colSpan=3 height=1></TD></TR>
  <TR class=HoverBC>
    <TD align=right>&nbsp;</TD>
    <TD align=right><IMG height=15 
      src="pic/gotop.gif" width=15 border=0></TD>
  </TR>
  <TR>
    <TD align=middle colSpan=3>&nbsp;</TD>
  </TR></TBODY></TABLE></BODY></HTML>


  <%
  end if
  end if
  call endline()
  end if
  %>
   <!--#include file="footer2.asp"-->


