<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!-- #include file="inc/Session.asp" -->
<!-- #include file="inc/checkrole.asp" -->
<%
'''''''''''''''''''''''''''''''''''''''''''''''
call checkPrevilege(Session("Name"),"p20")
'''''''''''''''''''''''''''''''''''''''''''''''
const recpage=15
dim i,classid,currentpage,BeginTime,key,bykey,PayType,Paras
BeginTime=Timer

bykey=trim(request.QueryString("bykey"))
key=trim(request.QueryString("key"))
if(request.QueryString("PayType")<>"") then
	PayType=Cint(request.QueryString("PayType"))
else
	PayType=0
end if
if not isempty(request.QueryString("page")) then 
	currentpage=Clng(request.QueryString("page"))
else 
	currentpage=1
end if
paras="key="&key&"&bykey="&bykey&"&PayType="&PayType
%>
<html>
<head>
<title>会员管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #FFFFFF;
	font-size:12px;
}
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
form{margin:0;}
-->
</style>
<link href="style/global.css" rel="stylesheet" type="text/css">
<script language="javascript">
function goto(frm)
{
	var gourl ="?<%=paras%>&";
	gourl += "page=" + (frm.page.value);
     var hid=parseInt(frm.hid.value);
	 if(parseInt(frm.page.value)>hid||frm.page.value<=0){
	 alert("错误！请确定你输入的数字在1-"+hid+"之间");
	 return false;
	 }
	window.location.href=gourl;
}
function ConfirmDel()
{
   if(confirm("确认删除？并且不能恢复！确定要删除此信息吗？"))
     return true;
   else
     return false;
	 
}
</script>
</head>
<body>
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><iframe src="right_top.htm" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" height="30" width="100%"></iframe></td>
  </tr>
</table>

<form name="form3" method="get" action="?">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td><div align="center">关键字：
        <input name="key" type="text" id="key" value="<%=key%>">
      按：
      <select name="bykey" id="bykey">
        <option value="PayNo" <%if(bykey="PayNo") then response.write("selected=""selected""") end if%>>交易序列号</option>
        <option value="PayFrom" <%if(bykey="PayFrom") then response.write("selected=""selected""") end if%>>资金流出会员ID</option>
        <option value="PayTo" <%if(bykey="PayTo") then response.write("selected=""selected""") end if%>>资金流入会员ID</option>
      </select>
      <select name="PayType" id="PayType">
	  	<option value="0" <%if(PayType=0) then response.write("selected=""selected""") end if%>>全部</option>
        <option value="1" <%if(PayType=1) then response.write("selected=""selected""") end if%>>财付通充值</option>
        <option value="2" <%if(PayType=2) then response.write("selected=""selected""") end if%>>积分兑换</option>        
      </select>
      <input type="submit" value="搜 索">
      </div></td>
    </tr>
  </table>
</form>
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#999999">
  <tr bgcolor="#FF9900">
    <td height="22" colspan="8"><div align="center" class="style1">◆ 会员管理 ◆</div></td>
  </tr>
  <tr bgcolor="#EEEEEE">
    <td width="4%" bgcolor="#EEEEEE"><div align="center">ID</div></td>
    <td width="11%" height="20"><div align="center">交易类型</div></td>
    <td width="7%"><div align="center">金额</div></td>
    <td width="14%"><div align="center">来自帐户</div></td>
    <td width="13%"><div align="center">流入帐户</div></td>
    <td width="10%"><div align="center">日期</div></td>
    <td width="10%"><div align="center">序列号</div></td>
    <td width="31%" bgcolor="#EEEEEE"><div align="center">备注</div></td>
  </tr>
  <!-- 开始按行循环----------------------->
  <%
  		dim countSql,querySql,newsArr
		set rs=server.createobject("adodb.recordset")
		countSql="select count(*) from t_payhis where 1=1"		
		if(key<>"") then
			Select Case bykey
					Case "PayNo"
						countSql=countSql&" and PayNo='"&key&"'"
					Case "PayFrom"
						countSql=countSql&" and PayFrom='"&key&"'"
					Case "PayTo"
						countSql=countSql&" and PayTo='"&key&"'"				
					Case Else				
			End Select
		end if
		if(PayType=1) then
			countSql=countSql&" and PayType='财付通充值'"
		elseif(PayType=2) then
			countSql=countSql&" and PayType='积分兑换'"
		end if
  		rs.open countSql,conn,3,1
		allrec=rs(0)
		rs.close
		set rs=nothing
		totalpage=int((allrec+recpage-1)/recpage)		
		set rs=server.createobject("adodb.recordset")
		'查询sql
		querySql="select top "&recpage&" id,PayType,PayMoney,PayFrom,PayTo,PayDate,PayNo,PayTitle,PayDesc from t_payhis where id <=(select min(id) from (select top "&(recpage*(currentpage-1)+1)&" id from t_payhis where 1=1"
		if(key<>"") then
			Select Case bykey
					Case "PayNo"
						querySql=querySql&" and PayNo='"&key&"'"
					Case "PayFrom"
						querySql=querySql&" and PayFrom='"&key&"'"
					Case "PayTo"
						querySql=querySql&" and PayTo='"&key&"'"
					Case Else				
			End Select
		end if
		if(PayType=1) then
			querySql=querySql&" and PayType='财付通充值'"
		elseif(PayType=2) then
			querySql=querySql&" and PayType='积分兑换'"
		end if
		querySql=querySql&" order by id desc) as t) "
		if(key<>"") then
			Select Case bykey
					Case "PayNo"
						querySql=querySql&" and PayNo='"&key&"'"
					Case "PayFrom"
						querySql=querySql&" and PayFrom='"&key&"'"
					Case "PayTo"
						querySql=querySql&" and PayTo='"&key&"'"
					Case Else				
			End Select
		end if
		if(PayType=1) then
			querySql=querySql&" and PayType='财付通充值'"
		elseif(PayType=2) then
			querySql=querySql&" and PayType='积分兑换'"
		end if
		querySql=querySql&" order by id desc "
		'response.write(querySql)
		rs.open querySql,conn,3,1
		if rs.eof or rs.bof then
			response.Write("未找到相关信息!")
			response.End()
		else
			newsArr=rs.GetRows()
		end if
		rs.close
		set rs=nothing
		for i=0 to ubound(newsArr,2)
	%>
  <tr>
    <td bgcolor="#FFFFFF"><div align="center"><%=newsArr(0,i)%></div></td>
    <td height="20" bgcolor="#FFFFFF"><div align="center"><%=newsArr(1,i)%></div></td>
    <td bgcolor="#FFFFFF"><div align="center"><%=newsArr(2,i)%></div></td>
    <td bgcolor="#FFFFFF">
	<div align="center"><%=newsArr(3,i)%></div></td>
    <td bgcolor="#FFFFFF">
	  <div align="center"><%=newsArr(4,i)%></div></td>
    <td bgcolor="#FFFFFF"><div align="center"><%=newsArr(5,i)%></div></td>
    <td bgcolor="#FFFFFF"><div align="center"><%=newsArr(6,i)%></div></td>
    <td bgcolor="#FFFFFF"><div align="left"><%=newsArr(8,i)%></div>
    <div align="center"></div></td>
  </tr>
  
  <%
	next	  
  %>  
  <!--按行循环结束------------------------>
</table>
<table width="100%" height="20"  border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td>
	<form name="form2" method="post" action="" style="margin:0 0 0 0">
      <div align="center">
<%
dim n,p
n=currentpage+1
p=currentpage-1
if p>0then
response.write("["&"<a href='?"&paras&"&page="&cstr(p)&"'>上一页</a>]&nbsp;&nbsp;&nbsp;")
else response.write("上一页&nbsp;&nbsp;&nbsp;")
end if 
if (n-1)*recpage>=allrec then 
response.write("下一页" )
else
response.Write("["&"<a href='?"&paras&"&page="&cstr(n)&"'>下一页</a>]")
end if
response.write("&nbsp;共"&allrec&"条&nbsp;")
response.Write("&nbsp;共"&totalpage&"页&nbsp;")
response.Write("&nbsp;第"&currentpage&"页&nbsp;")
%>
            <input type="hidden" name="hid" value="<%=totalpage%>">
&nbsp;&nbsp;跳至
<input name="page" type="text" size="5" onKeyPress="if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;" onChange="goto(this.form)" style="border:1px solid #000000;height:18px ">
          页
          <input type="button" name="Button22" value="Go->" style="font-size:12px ;border:1px solid #000000;height:18px ">
        </div>
    </form></td>
  </tr>
</table>
<script language="javascript">
function CheckAll(form) {  
	for (var i=0;i<form.elements.length;i++)  {  
		var e = form.elements[i];  
		if (e.name != 'chkall')  
		e.checked = true // form.chkall.checked;  
	}  
} 
 
function ContraSel(form) {
	for (var i=0;i<form.elements.length;i++){
		var e = form.elements[i];
		if (e.name != 'chkall')
		e.checked=!e.checked;
	}
}
</script>
</body>
</html>
<%
call connclose()
%>
执行时间：<%=CStr(FormatNumber((Timer-BeginTime)*1000,2))& "毫秒"%>             