<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/function.asp"-->
<!--#include file="checklogin.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>修改信息</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.width100{width:100%;}

-->
</style>
</head>

<body>
<!--#include file="top.asp"-->
<%
dim sql,csql,totalpage,totalnum,pagesizes,currentpage,carr,j,vby
if(request.QueryString("page")<>"") then
	currentpage=Clng(request.QueryString("page"))
else
	currentpage=1
end if
pagesizes=15
if(request.QueryString("vby")<>"") then
	vby=Cint(request.QueryString("vby"))
else
	vby=0
end if
if(vby=0) then
	sql="select top "&pagesizes&" id,PayType,PayMoney,PayFrom,PayTo,PayDate,PayNo,PayTitle,PayDesc from t_payhis where id<=(select min(id) from (select top "&((currentpage-1)*pagesizes+1)&" id from t_payhis where PayFrom='"&checkusername&"' order by id desc) as t) and PayFrom='"&checkusername&"' order by id desc"
	csql="select count(*) from t_payhis where PayFrom='"&checkusername&"'"
else
	sql="select top "&pagesizes&" id,PayType,PayMoney,PayFrom,PayTo,PayDate,PayNo,PayTitle,PayDesc from t_payhis where id<=(select min(id) from (select top "&((currentpage-1)*pagesizes+1)&" id from t_payhis where PayTo='"&checkusername&"' order by id desc) as t) and PayTo='"&checkusername&"' order by id desc"
	csql="select count(*) from t_payhis where PayTo='"&checkusername&"'"
end if
totalnum=conn.execute(csql)(0)
totalpage=int((totalnum-1+pagesizes)/pagesizes)
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,3,1
if not rs.eof then
	carr=rs.GetRows()
end if
rs.close
set rs=nothing
%>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="35"><div align="center">·<a href="?vby=0">消费记录</a> ·<a href="?vby=1">充值记录</a></div></td>
  </tr>
</table>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" class="border">
  <tr>
    <td height="28" colspan="7" class="th_title">财务历史记录</td>
  </tr>
  <tr>
    <td class="td_row"><strong>类型</strong></td>
    <td class="td_row"><strong>金额</strong></td>
    <td class="td_row"><strong>来自</strong></td>
    <td class="td_row"><strong>去向</strong></td>
    <td class="td_row"><strong>日期</strong></td>
    <td class="td_row"><strong>订单号</strong></td>
    <td class="td_row"><strong>备注</strong></td>
  </tr>
  <%
  if(isarray(carr)) then
	for j=0 to ubound(carr,2)
  %>
  <tr>
    <td class="td_row"><%=carr(1,j)%></td>
    <td class="td_row"><%=carr(2,j)%></td>
    <td class="td_row"><%=carr(3,j)%></td>
    <td class="td_row"><%=carr(4,j)%></td>
    <td class="td_row"><%=carr(5,j)%></td>
    <td class="td_row"><%=carr(6,j)%></td>
    <td class="td_row"><%=carr(8,j)%></td>
  </tr>
  <%
	next
  else
	response.Write("<tr><td colspan=""5"">暂时没有记录</td></tr>")
  end if
  set carr=nothing
  %>
  <tr>
    <td colspan="7" class="td_row">
	<div align="center">
	<%
	dim n,p,startpage,endpage
	n=currentpage+1
	p=currentpage-1
	startpage=currentpage-5
	if(startpage<=0) then
		startpage=1
	end if
	endpage=currentpage+5
	if(endpage>totalpage) then
		endpage=totalpage
	end if
	response.write("&nbsp;共"&totalnum&"条&nbsp;")
	if p>0then
		response.write("["&"<a href='?vby="&vby&"&page="&cstr(p)&"'>上一页</a>]&nbsp;&nbsp;&nbsp;")
	else 
		response.write("上一页&nbsp;&nbsp;&nbsp;")
	end if 
	'''''''''''''''''
	for j=startpage to endpage
			if(j=currentpage) then
				response.write(j&"&nbsp;")
			else
				response.write("<a href=""?vby="&vby&"&page="&j&""">["&j&"]</a>&nbsp;")
			end if
			if(j>(startPage+10)) then
				exit for
			end if
	next
	'''''''''''''''''''''''''''''''''''''
	if currentpage>=totalpage then 
		response.write("下一页" )
	else
		response.Write("["&"<a href='?vby="&vby&"&page="&cstr(n)&"'>下一页</a>]")
	end if
	response.Write("&nbsp;共"&totalpage&"页&nbsp;")
	response.Write("&nbsp;第"&currentpage&"页&nbsp;")
	%>              
	</div>	</td>
  </tr>  
</table>
</body>
</html>
<%
call connclose()
%>