<!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 name="robots" content="noindex,nofollow">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link  href="img/style.css" rel="stylesheet" type="text/css" />
<title>充值记录</title>
<script src="js/common.js" type="text/javascript"></script>
<script src="js/main.js" type="text/javascript"></script>
<style type="text/css">
select {
	font-size:12px;
}
form{float:left;}
</style>
</head>
<body>
<!--当前导航-->
<script type="text/JavaScript">if(parent.$('admincpnav')) parent.$('admincpnav').innerHTML='后台首页&nbsp;&raquo;&nbsp;用户&nbsp;&raquo;&nbsp;充值记录';</script>
<?php
	$sqlyes="SELECT SUM( climit ) AS cckyes FROM sea_cck where status=1";
	$rowyes = $dsql->GetOne($sqlyes);
    if($rowyes['cckyes']>0){
        $cckyes = $rowyes['cckyes'];
    }else{
        $cckyes = 0;
    }
	
	if($ckey !=""){
		$sqlyesu="SELECT SUM( climit ) AS cckyes FROM sea_cck where status=1 and uname='$ckey'";
		$rowyesu = $dsql->GetOne($sqlyesu);
		if($rowyesu['cckyes']>0){
			$cckyesu = $rowyesu['cckyes'];
		}else{
			$cckyesu = 0;
		}
	}
	
	$w="";
    $numPerPage=20;
    $page = isset($page) ? intval($page) : 1;
    if($page==0) $page=1;
    
	
	if (!empty($climit) AND $climit != "all") 
	{$w.=" and climit=$climit";}
	else
	{$w.='';}
	if (!empty($ckey)) {$w.=" and uname = '$ckey'";}

	
	//计算有多少条数据
    $csqlStr="select count(*) as dd from sea_cck where status=1 ".$w;
	$rowTotal = $dsql->GetOne($csqlStr);
    if(is_array($rowTotal)){
        $TotalResult = $rowTotal['dd'];
    }else{
        $TotalResult = 0;
    }
    $TotalPage = ceil($TotalResult/$numPerPage);
    if ($page>$TotalPage) $page=$TotalPage;
    $limitstart = ($page-1) * $numPerPage;
    if($limitstart<0) $limitstart=0;
    
   $sqlStr="select * from sea_cck where status=1 ".$w." ORDER BY usetime DESC limit $limitstart,$numPerPage";

?>
<div class="r_main">
  <div class="r_content">
    <div class="r_content_1">
      <table class="tb_style" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td colspan="15" class="td_title">&nbsp;充值记录&nbsp;&nbsp;【充值总额<font color=red><?php echo $cckyes ?></font>】
		  <?php if($cckyesu>0){echo '【用户<font color=red>'.$ckey.'</font>充值总额<font color=red>'.$cckyesu.'</font>】';} ?>
            </td>
        </tr>
        <tr>
          
            <td height="40" align="left" colspan="10">
             
			 <form action="" method="post" >
              面值：
			  <select id='climit' name='climit' style="width:80px" onChange="self.location.href='?cstatus=<?php echo $cstatus ?>&climit='+this.options[this.selectedIndex].value">
			    <option value=''>选择面值</option>
				<option value='all'>全部</option>
                <?php
					$sqlclimit="select DISTINCT climit from sea_cck group by climit ORDER BY climit ASC ";
					$dsql->SetQuery($sqlclimit);
					$dsql->Execute('alimit');
					while($rowalimit=$dsql->GetObject('alimit'))
					{echo '<option value="'.$rowalimit->climit.'">'.$rowalimit->climit.'</option>';}
				?>
				</select>
          </form> 
		   <form action="?action=search" method="post" >
              &nbsp;&nbsp;&nbsp;用户：<input  name="ckey" type="text" id="ckey" size="12">
			  <input type="submit" name="selectBtn" value="搜 索" class="btn"  />
		   </form>
         </td>
		</tr>
        <?php
if($TotalResult==0){
    echo "<tr><td colspan='10'><br>&nbsp;<font color=red>无充值信息</font><br><br></td></tr>";}
?>
        <tr bgcolor="#f5fafe" >
          <td width="20"  height="30" bgcolor="#FFFFFF" class="td_btop3">用户</td>
          <td width="20" bgcolor="#FFFFFF" class="td_btop3">面值</td>
          <td width="60" bgcolor="#FFFFFF" class="td_btop3">充值时间</td>
		  <td width="100" bgcolor="#FFFFFF" class="td_btop3">充值卡号</td>
        </tr>
        <form method="post" name="videolistform">
          <?php

$dsql->SetQuery($sqlStr);
$dsql->Execute('key_list');
while($row=$dsql->GetObject('key_list'))
{
$id=$row->id;
$copy.=$row->ckey."\n"
?>


          <tr bgcolor="#FFF" style="background-color:#FFF" onmouseover="style.backgroundColor='#E6F2FB'" onmouseout="style.backgroundColor='#FFF'">
            <td class="td_border" height="30"><?php echo $row->uname;?></td>
			<td class="td_border"><?php echo $row->climit;?></td>			
            <td class="td_border"><?php echo $row->usetime;?></td>
			<td class="td_border"><?php echo $row->ckey;?></td>

          </tr>
          <?php }?>
  
        </form>
		
        <tr>
          <td height="30" colspan="11" class="td_border">
            <div class="cuspages">
              <div class="pages"> &nbsp;页次：<?php echo $page;?>/<?php echo $TotalPage;?> 每页<?php echo $numPerPage;?> 总收录数据<?php echo $TotalResult;?>条 <a href="?page=1&ckey=<?php echo $ckey ?>&climit=<?php echo $climit;?>">首页</a> <a href="?page=<?php echo ($page-1);?>&ckey=<?php echo $ckey ?>&climit=<?php echo $climit;?>">上一页</a> <a href="?page=<?php echo ($page+1);?>&ckey=<?php echo $ckey ?>&climit=<?php echo $climit;?>">下一页</a> <a href="?page=<?php echo $TotalPage;?>&ckey=<?php echo $ckey ?>&climit=<?php echo $climit;?>">尾页</a>&nbsp;&nbsp;跳转
                <input type="text" id="skip" value="" onkeyup="this.value=this.value.replace(/[^\d]+/,'')" style="width:40px"/>
                &nbsp;&nbsp;
                <input type="button" value="确 定" class="btn" onclick="location.href='?page='+ document.getElementById('skip').value +'&ckey=<?php echo $ckey ?>&climit=<?php echo $climit;?>';"/>
              </div>
            </div>
 </td>
        </tr>
      </table>
    </div>
  </div>
</div>
<div id="copy" name="copy" style="display:none;"><textarea style="width:400px;height:500px;"><?php echo $copy; ?></textarea></div>
<?php
viewFoot();
?>
</body>
</html>
