<%
'乘风多用户计数器 Sql版
'作者QQ：178575
'作者EMail：yliangcf@163.com
'作者网站：http://www.qqcf.com
'详细简介：http://www.qqcf.com/cfcount.htm
'上面有程序在线演示，安装演示，使用疑难解答，最新版本下载等内容
'因为这些内容可能时常更新，就没有放在程序里，请自己上网站上查看
'有完整版本的演示
%>
<%
AgentUserName=ChkStr(Request("AgentUserName"),1)
CardCode=ChkStr(Request("CardCode"),1)
Px=ChkStr(Request("Px"),1)

If Px="" Then Px="ID"

Call PxFilter(Px,"ID,CardCode,CardPassword,CardMoney,LastDate,EnoughOk,AgentUserName,UserName,EnoughTime,AddTime,PayOk")

Sql="Select * From CFCount_EnoughCard Where 1=1"
If AgentUserName<>"" Then Sql=Sql&" And AgentUserName='"&AgentUserName&"'"
If CardCode<>"" Then Sql=Sql&" And CardCode Like '%"&CardCode&"%'"

Sql=Sql&" Order By "&Px&" Desc"

 
Set Rs=Server.CreateObject("Adodb.RecordSet")
Rs.open Sql,Conn,1,1

If Not Rs.Eof Then
 If ChkStr(Request("Page"),2) = "" Then
  Page = 1
 Else 
  Page = CInt(ChkStr(Request("Page"),2))
 End If

Rs.pagesize=10
TotalRs=Rs.RecordCount
TotalPage=Rs.PageCount
MyPageSize=Rs.PageSize
Rs.AbsolutePage=Page
End If
%>
  
<table class="tb_1">
  <tr> 
    <td height="18" colspan="11"><a href="?Action=enoughcardadd" class="t_button">新增单张充值卡</a> 
<a href="?Action=enoughcardmoreadd" class="t_button">新增批量充值卡</a></td>
  </tr>
  <tr class="tr_2"> 
    <td><a href="?Action=<%=Action%>&AgentUserName=<%=AgentUserName%>&CardCode=<%=CardCode%>&Px=CardCode">卡号</a></td>
    <td><a href="?Action=<%=Action%>&AgentUserName=<%=AgentUserName%>&CardCode=<%=CardCode%>&Px=CardPassword">密码</a></td>
    <td><a href="?Action=<%=Action%>&AgentUserName=<%=AgentUserName%>&CardCode=<%=CardCode%>&Px=CardMoney">卡面金额</a></td>
    <td><a href="?Action=<%=Action%>&AgentUserName=<%=AgentUserName%>&CardCode=<%=CardCode%>&Px=LastDate">最晚充值日期</a></td>
    <td><a href="?Action=<%=Action%>&AgentUserName=<%=AgentUserName%>&CardCode=<%=CardCode%>&Px=AgentUserName">代理商</a></td>
    <td><a href="?Action=<%=Action%>&AgentUserName=<%=AgentUserName%>&CardCode=<%=CardCode%>&Px=EnoughOk">已被充入</a></td>
    <td><a href="?Action=<%=Action%>&AgentUserName=<%=AgentUserName%>&CardCode=<%=CardCode%>&Px=UserName">已充入</a></td>
    <td><a href="?Action=<%=Action%>&AgentUserName=<%=AgentUserName%>&CardCode=<%=CardCode%>&Px=EnoughTime">充值时间</a></td>
    <td><a href="?Action=<%=Action%>&AgentUserName=<%=AgentUserName%>&CardCode=<%=CardCode%>&Px=AddTime">加入时间</a></td>
    <td><a href="?Action=<%=Action%>&AgentUserName=<%=AgentUserName%>&CardCode=<%=CardCode%>&Px=PayOk">已支付</a></td>
    <td>操作</td>
  </tr>
  <%
While Not Rs.Eof And MyPageSize>0
I=I+1
%>
  <form name="<%="f"&I%>" method="post" action="AdminUser.aspx?Action=servermodifysave&ID=<%=Rs("ID")%>">
    <tr class="tr_2"> 


      <td><%
If Rs("PayOk")=-1 And Rs("EnoughOk")=0 Then
 Response.write Rs("CardCode")
Else
 Response.write "<font color='#D4D4D4'>"&Rs("CardCode")&"</font>"
End If
%></td>
      <td><%=Rs("CardPassword")%></td>
      <td><%=Rs("CardMoney")%>元</td>
      <td><%=Rs("LastDate")%></td>
      <td><%=Rs("AgentUserName")%></td>
      <td><%
If Rs("EnoughOk")=0 Then
 Response.write "否"
Else
 Response.write "是"
End if
%></td>
      <td><%=Rs("UserName")%></td>
      <td title="<%=Rs("EnoughTime")%>"><%=Month(Rs("EnoughTime"))&"-"&Day(Rs("EnoughTime"))%></td>
      <td title="<%=Rs("AddTime")%>"><%=Month(Rs("AddTime"))&"-"&Day(Rs("AddTime"))%></td>
      <td><%
If Rs("PayOk")=0 Then
 Response.write "否"
Else
 Response.write "是"
End if
%></td>
      <td>
<a href="AdminUser.aspx?Action=enoughcarddel&ID=<%=Rs("ID")%>" onclick="return confirm('确定要删除吗?')">删除</a>
<%
If Rs("PayOk")=0 Then
 Response.write "<br><a href='AdminUser.aspx?Action=enoughcardredo&ID="&Rs("ID")&"' onclick=""return confirm('确定要重新设置这张卡为有效卡吗?')"" style='margin-top:20px;'>设置有效</a>"
End if
%>
</td>
    </tr>
  </form>
  <%
Rs.MoveNext
mypagesize=mypagesize-1
Wend
%>
</table>

<table class="tb_3">
    <tr> 
      <td><a href="?Action=<%=Action%>&AgentUserName=<%=AgentUserName%>&CardCode=<%=CardCode%>&Px=<%=Px%>&Page=1">第一页</a> 
          <%
if page>1 then%>
          <a href='?Action=<%=Action%>&AgentUserName=<%=AgentUserName%>&CardCode=<%=CardCode%>&Px=<%=Px%>&Page=<%=Page-1%>'>上一页</a> 
          <%
end if
%>
          <%
if page<rs.pagecount   then%>
          <a href='?Action=<%=Action%>&AgentUserName=<%=AgentUserName%>&CardCode=<%=CardCode%>&Px=<%=Px%>&Page=<%=Page+1%>'>下一页</a> 
          <%
end if
%>
          <a href="?Action=<%=Action%>&AgentUserName=<%=AgentUserName%>&CardCode=<%=CardCode%>&Px=<%=Px%>&Page=<%=TotalPage%>">最后一页</a> 
          页次：<font color="#ff0000"><%=page%></font>/<%=totalpage%>页&nbsp;&nbsp;共<%=UserTotal%>条记录&nbsp;&nbsp;每页显示<%=rs.pagesize%>条
<%
Response.write "&nbsp;&nbsp;转到第<select id='page' onChange=""window.location=document.getElementById('page').options[document.getElementById('page').selectedIndex].value"">"
For I=1 To TotalPage
    Response.Write "<option value=?Action="&Action&"&AgentUserName="&AgentUserName&"&CardCode="&CardCode&"&Px="&Px&"&Page="&I 
 If Page=I Then Response.Write " selected"
 Response.Write ">"& I &"</option>"
Next
Response.write "</select>页"
%>
</td>

    </tr>
</table>

<script language=JavaScript>
function searchcheck_card()
{ 
 var searchurl ="?Action=<%=Action%>"
 searchurl += '&AgentUserName=' + document.getElementById('AgentUserName').value;
 searchurl += '&CardCode=' + document.getElementById('CardCode').value;
 document.getElementById('form_card').action = searchurl ;
 return true;
}
</script>
  <form name="form_card" id="form_card" method="post" action="?Action=<%=Action%>" onsubmit="return searchcheck_card()">
<table class="tb_3"><tr>
        <td>搜索：
代理商
<input name="AgentUserName" type="text" id="AgentUserName" value="<%=AgentUserName%>" size="10">
卡号
<input name="CardCode" type="text" id="CardCode" value="<%=CardCode%>" size="10">
            <input type="submit" name="Submit" value="查找">
        </td>
      </tr>
</table></form>