<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtm
l1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<script type="text/javascript" src="/js/jjquery.js"></script>
<link type="text/css" href="/js/datepicker/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="/js/datepicker/ui.core.js"></script>
<script type="text/javascript" src="/js/datepicker/ui.datepicker.js"></script>
<script type="text/javascript"
src="/js/datepicker/ui.datepicker-zh-CN.js"></script>
<link type="text/css" href="/js/datepicker/demos.css" rel="stylesheet" />
<script type="text/javascript"
src="/js/tablesorter/jquery.tablesorter.js"></script>
<style type="text/css">
@import "/js/tablesorter/assets/css/default.css";
</style>
<style type="text/css">
body {
background-color: #DCDCDC;
font-size: 12px;
font-family: "EIIa";
}
p {
line-height: 150%;
margin: 0;
font-size: 14px;
}
a:link {
color: orange;
}
a:active {
color: orange;
}
a:visited {
color: orange;
text-decoration: none;
}
a:hover {
color: orange;
}
/*table.tr.td{font-size:12px;}*/
td {
font-size: 13px;
font-weight: bold;
}
#nav {
float: right;
width: 100%;
}
#nav ul li {
list-style: none;
float: left;
padding: 5px 0px;
margin: 0 30px;
}
#nav ul li a {
font-size: 15px;
}
#page a:link {
color: black;
}
#page a:active {
color: blue;
}
#page a:visited {
color: orange;
text-decoration: none;
}
#page {
float: both;
width: 100%;
position: absolute;
left: 50px;
}
#page ul li {
list-style: none;
float: left;
padding: 5px 5px;
margin: 0px 5px;
border: 1px solid;
}
#page ul li a {
font-size: 13px;
}
</style>
<script>
$(function() {
$(".date-pick").datepicker();
});
$(function() {
$(".asort").tablesorter({widgets:["zebra"]});
$(".bsort").tablesorter({widgets:["zebra"]});
});
</script>
<script language="javascript"><!--
function SetColor(o,a,b,c,d)
{
var t=document.getElementById(o).getElementsByTagName("tr");
for(var i=0;i<t.length;i++)
{
t[i].style.backgroundColor=(t[i].sectionRowIndex%2==0)?a:b;
t[i].onclick=function(){
if(this.x!="1")
{
this.x="1";
this.style.backgroundColor=d;
}
else{
this.x="0";
this.style.backgroundColor=(this.sectionRowIndex%2==0)?a:b;
}
}
t[i].onmouseover=function()
{
if(this.x!="1")this.style.backgroundColor=c;
}
t[i].onmouseout=function()
{
if(this.x!="1")this.style.backgroundColor=(this.sectionRowIndex%2==0)?a:b;
}
}
}
--></script>
</head>
<?php
$project_name = "book";
require_once("../mod_db_link.php");
$today=date("Y-m-d",strtotime("-1 days"));
$search_date=isset($_REQUEST["datelist"])?$_REQUEST["datelist"]:$today;
/***********************************/
$stat_year = date("Y");
$stat_month = date("m");
$my_month = $_GET["my_month"];
if($my_month == null)
{
if ($y==null){
$y=$stat_year;
}
if ($m==null){
$m=$stat_month;
}
$my_month="{$y}-{$m}";
}
//echo $my_month;
///**********************************/
$statdb = statdb();
$bookdb = book_contentdb();
echo "<p>统计项目:充值统计</p>";
echo "<p>统计时间:$search_date </p>";
echo "<br>";
global $statdb,$search_date,$bookdb;
$sql = "select cpid,cpname from bc_book_charge_cp order by cpid asc;";
$results = mysql_query($sql,$bookdb);
$thlist = array();
//array_push($thlist,array("cpid"=>"stat_date","cpname"=>"统计日期"));
while($row=mysql_fetch_array($results))
{
//$thlist[$row["cpid"]] = $row["cpname"];
array_push($thlist, array("cpid"=>$row["cpid"], "cpname"=>$row["cpname"]));
}
array_push($thlist, array("cpid"=>"all", "cpname"=>"整体数据"));
$listinfo = array();
//$sql="select * from stat_cp_charge where stat_date like '2013-10%' order by stat_date desc , cpid asc ;";
$sql="select * from stat_cp_charge where stat_date like '".$my_month."%' order by stat_date desc , cpid asc ;";
$results = mysql_query($sql,$statdb);
while($row=mysql_fetch_array($results))
{
$cpid = $row["cpid"];
$stat_date = $row["stat_date"];
$conv_rate = $row["conv_rate"];
$arpu = $row["arpu"];
if (! array_key_exists($stat_date,$listinfo))
{
$listinfo[$stat_date] = array();
$listinfo[$stat_date]["stat_date"] = $stat_date;
}
$arpu = sprintf("%.2f",$arpu);
$conv_rate = sprintf("%.4f",$conv_rate);
$conv_rate = $conv_rate * 100;
$conv_rate = $conv_rate."%";
$listinfo[$stat_date][$cpid] = $conv_rate." | ".$arpu;
}
draw_table($thlist,$listinfo);
function draw_table($thlist, $listinfo)
{
echo "<table class='asort' border=1 cellspacing=0 cellpadding=0 width=60%>";
echo "<thead><tr>";
echo "<th align=center><nobr>统计日期</nobr></th>";
foreach($thlist as $i)
{
echo "<th align=center><nobr>".$i["cpname"]."</nobr></th>";
}
echo "</tr></thead>";
foreach($listinfo as $list)
{
echo "<tr>";
echo "<td height=30 align=center><nobr>".$list["stat_date"]."</nobr></td>";
foreach($thlist as $th)
{
$cpid = $th["cpid"];
if(array_key_exists($cpid,$list))
{
echo "<td height=30 align=center><nobr>".$list[$cpid]." </nobr></td>";
}
else
{
echo "<td height=30 align=center><nobr> - </nobr></td>";
}
}
echo "</tr>";
}
echo "<tr>";
foreach($tstruc as $count=>$tdv)
{
if("item"==$tdv){
echo "<td height=30 width='50px' align=center>总计</td>";
}else{
echo "<td height=30 align=center><nobr>".$sum[$tdv]."</nobr></td>";
}
}
echo "</tr>";
echo "</table>";
echo "<br><br>";
}
?>