<!--#include file="conn.asp"-->
<%


strM_ID=Trim(Session("UserID"))
strKey=GetVariable("txtKey")
strYear=GetVariable("year")
strMonth=GetVariable("month")
strDay=GetVariable("day")
strType=GetVariable("selType")
strAgent=GetVariable("selAgent")
strQuery=""

if strKey<>"" then
	strQuery=strQuery & " And (t_name Like '%" & strKey & "%' Or f_name Like '%" & strKey & "%' Or b_note Like '%" & strKey & "%') "
end if

if strYear<>"" then
	strQuery=strQuery & " And Year(b_createtime)=" & strYear
end if

if strMonth<>"" then
	strQuery=strQuery & " And Month(b_createtime)=" & strMonth
end if

if strAgent<>"" then
	strQuery=strQuery & " And (m_id=" & strAgent & " Or B_adminid=" & strAgent & ") "
end if

if strDay<>"" then
	strQuery=strQuery & " And Day(b_createtime)=" & strDay
end if

Select Case strType
	Case "1"
		'入账款
		strQuery=strQuery & " And b_type='入账' And m_id=" & strM_ID
	
	Case "2"
		'被扣款
		strQuery=strQuery & " And b_type='扣款' And m_id=" & strM_ID
	
	Case "3"
		'付费款
		strQuery=strQuery & " And b_type='付费' And m_id=" & strM_ID
	
	Case "4"
		'退款
		strQuery=strQuery & " And b_type='退款' And m_id=" & strM_ID
	
End Select

%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>电子商务自助建站--您理想的助手</title>
<link href="common/styleMain.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="common/JS_CheckForm.js"></script>
<script language="JavaScript">

function init(){
	SelectValue(Banksearch.year,"<%=year(date)%>");
	SelectValue(Banksearch.month,"<%=month(date)%>");
	SelectValue(Banksearch.day,"<%=day(date)%>");
}
</script>
</head>
<body leftmargin="0" topmargin="0" onLoad="init()">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
        <tr> 
          <td height="0" align="center">
		  <!--#include file="common/top.asp"-->
          </td>
        </tr>
        <tr> 
          <td height="100%" align="center" valign="top">
<TABLE class=table002 cellSpacing=0 cellPadding=0 border=0>
              <TBODY>
                <TR> 
                  <!--左边开始-->
                  <TD width="20%" align=right vAlign=top> <!--#include file="common/left.asp"--> </TD>
                  <!--左边结束-->
                  <TD width="2%" background="images/rowline.gif">&nbsp;</TD>
                  <!--右边开始-->
                  <TD vAlign=top align=center width="78%">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr> 
                        <td>
						
                            <TABLE width="100%" height="100%" border=0 cellPadding=6 cellSpacing=0>
                              <TBODY>
                                <TR> 
                                  
                                <TD height="320" vAlign=top bgColor=#ffffff><strong><font color="#FF0000">我的明细账</font></strong><BR> <HR SIZE=1>
                                    <table width="99%" border="0" cellpadding="2" cellspacing="1" bgcolor="#5F8AC5">
                                    <tr align="center"> 
                                      <td width="10%" height="22" bgcolor="#5F8AC5"><strong><font color="#FFFFFF">&nbsp;账单号</font></strong></td>
                                      <td width="9%" bgcolor="#5F8AC5"><strong><font color="#FFFFFF">金额￥</font></strong></td>
                                      <td width="9%" bgcolor="#5F8AC5"><strong><font color="#FFFFFF">类型</font></strong></td>
                                      <td width="23%" bgcolor="#5F8AC5"><strong><font color="#FFFFFF">时间</font></strong></td>
                                      <td width="16%" bgcolor="#5F8AC5"><strong><font color="#FFFFFF">操作人</font></strong></td>
                                      <td width="33%" bgcolor="#5F8AC5"><strong><font color="#FFFFFF">说明</font></strong></td>
                                    </tr>
                                    <tr> 
                                      <td height="1" colspan="6" bgcolor="#5F8AC5"></td>
                                    </tr>
                                    <%
									strQueryString="&txtKey=" & strKey & "&year=" & strYear & "&month=" & strMonth & "&day=" & strDay & "&selType=" & strType & "&selAgent=" & strAgent
									strSQL="Select * from v_bank Where m_id=" & strM_ID & strQuery & " Order by id Desc"
									rs.open strSQL,conn,1,1
										'分页显示初始化
									page=GetVariable("page")
									if page="" then
										page=1
									else
										page=Cint(page)
									end if
									
									Section=GetVariable("section")
									if Section="" then
										Section=1
									else
										Section=Cint(Section)
									end if
									'变量赋值
									intPageSize=12		'每页显示记录数
									intSectionSize=5		'多少页为一段，像GOOGLE一样
									PrevSectionText="<FONT face=webdings>7</FONT>"		'上一段的链接文字
									NextSectionText="<FONT face=webdings>8</FONT>"		'下一段的链接文字
									PrevPageText="<FONT face=webdings>3</FONT>"			'上页的链接文字	
									NextPageText="<FONT face=webdings>4</FONT>"			'下页的链接文字
									
									strPageUrl="?t=" & strQueryString
									
									rs.pagesize=intPageSize
									intCount=rs.RecordCount 
									intPageCount=rs.pagecount
									intSectionCount=(intPageCount - 1) \ intSectionSize + 1
									if intCount>0 then
										rs.AbsolutePage=page  
									else
										response.Write("没有任何账单！")
									end if
									
									%>
                                    <%
									 '循环输出
									 for i=1 to intPageSize
										if rs.eof then exit for
										if i mod 2=0 then
											strColor="#F8F8F8"
										else
											strColor="#fFfFfF"
										end if
									 %>
                                    <tr bgcolor="<%=strColor%>"> 
                                      <td align="center"><%=rs("id")%></td>
                                      <td align="right">
									  <%if rs("b_money")>0 then%>
									  <font color="#FF0000"><%=rs("b_money")%></font>
									  <%else%>
									  <%=rs("b_money")%>
									  <%end if%>
									  </td>
                                      <td align="center"><%=rs("B_type")%></td>
                                      <td><%=rs("B_CreateTime")%></td>
                                      <td><%=rs("t_name")%></td>
                                      <td><%=rs("B_Note")%></td>
                                    </tr>
                                    <%
										 rs.movenext
									  next
									%>
                                  </table>
                                  <table width="100%" height="30" border="0" cellpadding="0" cellspacing="0">
                                    <tr> 
                                      <td width="100%" height="25" colspan="2" align="right"> 
                                        共有<%=intCount%>记录，分<%=intPageCount%>页，当前页<%=Page%>，每页显示<%=intPageSize%>条记录 
                                        <%
												'计算每一段的开始页
												intStarPage=(Section-2) * intSectionSize + 1
												'前一段
												if Section<=1 then
													response.Write(PrevSectionText & " ")
												else
													response.Write("<a href='" & strPageUrl & "&page=" & intStarPage & "&section=" & Section-1 & "'>" & PrevSectionText & "</a> ")
												end if 
												
												'显示页码列表
												response.Write("第")
												intStarPage=(Section-1) * intSectionSize + 1
												for p=intStarPage to intStarPage + intSectionSize - 1
													if p > intPageCount then exit for
													if p=page then
														response.Write("<strong>[" & p & "]</strong> ")
													else
														response.Write("<a href='" & strPageUrl & "&page=" & p & "&section=" & Section & "'>[" & p & "]</a> ")
													end if	
												next
												response.Write("页")
												'后一段
												intStarPage=(Section) * intSectionSize + 1
												if Section>=intSectionCount then
													response.Write(" " & NextSectionText)
												else
													response.Write(" <a href='" & strPageUrl & "&page=" & intStarPage & "&section=" & Section+1 & "'>" & NextSectionText & "</a> ")
												end if 
											  %> <select name="page" size="1" onChange="window.location='<%=strPageUrl & "&section="%>' + (Math.floor((parseInt(this.value)-1)/<%=intSectionSize%>)+1) + '<%="&page="%>' + this.value">
                                          <option value="<%=page%>" selected>第<%=page%>页</option>
                                          <%
													for i=1 to rs.pagecount
													%>
                                          <option value="<%=i%>" >第<%=i%>页</option>
                                          <%
														next
													%>
                                        </select>
                                        　 </td>
                                    </tr>
                                  </table></TD>
                                </TR>
                              </TBODY>
                            </TABLE>

						 </td>
                      </tr>
                      <tr>
                        <td align="center"> 
                          <form action="User_BankList.asp" method="post" name="Banksearch" id="Banksearch">
                            <table width="98%" border="0" cellpadding="2" cellspacing="1" bgcolor="#5F8AC5">
                              <tr> 
                                <td bgcolor="#5F8AC5">&nbsp<strong><font color="#FFFFFF">账单搜索</font></strong></td>
                              </tr>
                              <tr> 
                                <td height="100" align="center" bgcolor="F9F9F9"> 
                                  <table width="98%" border="0" cellspacing="1" cellpadding="3">
                                    <tr> 
                                      <td height="30"> 发生时间： 
                                        <select name="year" id="select2">
                                        <option value="">所有年</option>
                                          <%
											for i=year(date)-3 to year(date) + 5
										   %>
                                          <option value="<%=i%>"><%=i%></option>
                                          <%next%>
                                        </select>
                                        年 
                                        <select name="month" id="select3">
                                          <option value="">所有月</option>
                                          <option value="1">1</option>
                                          <option value="2">2</option>
                                          <option value="3">3</option>
                                          <option value="4">4</option>
                                          <option value="5">5</option>
                                          <option value="6">6</option>
                                          <option value="7">7</option>
                                          <option value="8">8</option>
                                          <option value="9">9</option>
                                          <option value="10">10</option>
                                          <option value="11">11</option>
                                          <option value="12">12</option>
                                        </select>
                                        月 
                                        <select name="day" id="select4">
                                          <option value="">所有日</option>
                                          <option value="1">1</option>
                                          <option value="2">2</option>
                                          <option value="3">3</option>
                                          <option value="4">4</option>
                                          <option value="5">5</option>
                                          <option value="6">6</option>
                                          <option value="7">7</option>
                                          <option value="8">8</option>
                                          <option value="9">9</option>
                                          <option value="10">10</option>
                                          <option value="11">11</option>
                                          <option value="12">12</option>
                                          <option value="13">13</option>
                                          <option value="14">14</option>
                                          <option value="15">15</option>
                                          <option value="16">16</option>
                                          <option value="17">17</option>
                                          <option value="18">18</option>
                                          <option value="19">19</option>
                                          <option value="20">20</option>
                                          <option value="21">21</option>
                                          <option value="22">22</option>
                                          <option value="23">23</option>
                                          <option value="24">24</option>
                                          <option value="25">25</option>
                                          <option value="26">26</option>
                                          <option value="27">27</option>
                                          <option value="28">28</option>
                                          <option value="29">29</option>
                                          <option value="30">30</option>
                                          <option value="31">31</option>
                                        </select>
                                        日 </td>
                                    </tr>
                                    <tr> 
                                      <td height="30"> 账单类型： 
                                        <select name="selType">
                                          <option value="" selected>全部类型</option>
                                          <option value="1">入账款项</option>
                                          <option value="2">被扣款项</option>
                                          <option value="4">退还款项</option>
                                        </select></td>
                                    </tr>
                                    <tr style="display:none"> 
                                      <td height="30"> 操 作 人： 
                                        <select name="selAgent" id="select11">
                                          <option value="">选择对象</option>
                                          <%
													Set rSub=server.CreateObject("ADODB.RecordSet")
													rSub.open "Select id,m_name From member Where m_code>0 Order by m_code Desc",conn,1,1
													for i=1 to rSub.recordcount
														response.Write("<option value=" & rSub("id") & ">" & Trim(rSub("m_name")) & "</option>")
														rSub.movenext
													next
													rSub.close
											%>
                                        </select> </td>
                                    </tr>
                                    <tr> 
                                      <td height="30">关 键 字： 
                                        <input name="txtKey" type="text" id="txtKey2" onClick="this.value='';" size=30 maxlength="50">
                                        　<font color="#FF0000">＊输入用户名，或交易关键字</font> 
                                      </td>
                                    </tr>
                                    <tr>
                                      <td height="30" align="center"> 
                                        <input type="submit" name="submit" value=" 查 询 ">
                                        　
<input type="reset" name="Submit" value=" 取 消 ">
                                        　 <input type="button" name="Submit2" value=" 帮 助 "></td>
                                    </tr>
                                  </table>
                                </td>
                              </tr>
                            </table>
                          </form>
						  </td>
                      </tr>
                    </table> 
                  </TD>
                </TR>
              </TBODY>
            </TABLE></td>
        </tr>
        <tr> 
          <td height="0" align="center">
		  <!--#include file="common/bottom.asp"-->
		  </td>
        </tr>
      </table></td>
  </tr>
</table>
</body>
</html>
