1755 lines
57 KiB
PHP
Executable File
1755 lines
57 KiB
PHP
Executable File
<?php
|
|
/*********************************************************
|
|
程序说明:
|
|
Function remarks:
|
|
PPS monthly report
|
|
调用关系:调用: header.inc
|
|
被调用:
|
|
|
|
变量说明:
|
|
Author: Lilong
|
|
Time: 2003-12-18
|
|
*********************************************************/
|
|
require("../../inc/header.inc");
|
|
?>
|
|
<!--
|
|
<body onLoad="clock()" leftmargin="12" topmargin="0">
|
|
-->
|
|
<body leftmargin="15" rightmargin="10" onload="javascript:adjust_frame('down');javascript:clock();" onresize="javascript:adjust_frame('down');" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;">
|
|
|
|
<?php
|
|
|
|
function show_alarm($info,$backurl)
|
|
{
|
|
echo "\n<script language=\"JavaScript\">\n";
|
|
echo "parent.window.location.href=\"../../element/bssSpecific/alarm_show.php?info=$info&backurl=$backurl\";\n";
|
|
echo "</script>\n";
|
|
|
|
}
|
|
|
|
adjust_head_frame("down");
|
|
adjust_title_head_frame("down");
|
|
adjust_title_tail_frame("down");
|
|
|
|
adjust_content_head_frame("down");
|
|
echo "<br>";
|
|
|
|
$DEBUG=0;
|
|
$db='PPS_DB';
|
|
global $OMC_server;
|
|
$ppsDbConn = mysqli_connect($OMC_server[0]['host'],$OMC_server[0]['user'],$OMC_server[0]['password'], $db);
|
|
$face_value_type = 6;
|
|
$moneyPara = getMoneyPara_forPpsReport(); //显示的货币单位是最小货币单位的倍数
|
|
|
|
$moneyPara=$moneyPara+0;
|
|
|
|
if(!isset($moneyPara)||$moneyPara==0||trim($moneyPara)=="")
|
|
{
|
|
$info="The parameter (currency_decimal) <br> has no value,please set it!";
|
|
$backurl="../../sysDefine/pubVarDef/paramList.php";
|
|
show_alarm($info,$backurl);
|
|
}
|
|
|
|
|
|
$dotLen = strLen($moneyPara) - 1;
|
|
//echo "<br>dotLen=$dotLen";
|
|
$fmtBit = "%01.".$dotLen."f";
|
|
?>
|
|
|
|
<script LANGUAGE="JavaScript" language="JavaScript1.2">
|
|
var server_timestamp=<?php echo mktime(); ?>;
|
|
var now = new Date();
|
|
var client_timestamp = now.getTime() / 1000;
|
|
var diff_seconds = server_timestamp - client_timestamp;
|
|
|
|
function clock(){
|
|
now = new Date();
|
|
var timeZoneOffsetMin = now.getTimezoneOffset();
|
|
var years = now.getFullYear();
|
|
var months = now.getMonth();
|
|
var days = now.getDate();
|
|
var hours = now.getHours();
|
|
var minutes = now.getMinutes()+timeZoneOffsetMin;
|
|
var seconds = now.getSeconds()+diff_seconds;
|
|
|
|
theDate=new Date(Date.UTC(years,months,days,hours,minutes,seconds));
|
|
var DateYear=theDate.getFullYear();
|
|
|
|
var DateMonth=theDate.getUTCMonth()+1;
|
|
DateMonth=((DateMonth < 10) ? "0" : "")+DateMonth;
|
|
|
|
var DateDay=theDate.getUTCDate();
|
|
DateDay=((DateDay < 10) ? "0" : "")+DateDay;
|
|
|
|
var DateHour=theDate.getUTCHours();
|
|
DateHour=((DateHour < 10) ? "0" : "")+DateHour;
|
|
|
|
var DateMinute=theDate.getUTCMinutes();
|
|
DateMinute=((DateMinute < 10) ? "0" : "")+DateMinute;
|
|
|
|
var DateSecond=theDate.getUTCSeconds();
|
|
DateSecond=((DateSecond < 10) ? "0" : "")+DateSecond;
|
|
|
|
var Time=DateYear+"-"+DateMonth+"-"+DateDay+" "+DateHour+":"+DateMinute+":"+DateSecond;
|
|
|
|
//document.clock.time.value=Time;
|
|
document.getElementById("time").value=Time;
|
|
Timer = setTimeout("clock()",1000);
|
|
}
|
|
</script>
|
|
<?php
|
|
|
|
|
|
$query_year=$_REQUEST['query_year'];
|
|
$query_month=$_REQUEST['query_month'];
|
|
if(!$query_year)
|
|
{
|
|
$query_year =(date("m")==1)?(date("Y")-1):date("Y");
|
|
$query_month =(date("m")==1)?12:(date("m")-1);
|
|
}
|
|
$defaultMonth="$query_year-$query_month";
|
|
$strMonth = date("F",mktime(0,0,0,$query_month,1,$query_year));
|
|
|
|
if($DEBUG) echo "defaultMonth=$defaultMonth<br>";
|
|
|
|
$year=date("Y")."-".date("m")."-".date("d").",".date("D");
|
|
if($DEBUG) echo "$year<br>";
|
|
|
|
$thisFebDays=date("t",mktime(0,0,0,2,1,date("Y")));
|
|
$lastFebDays=date("t",mktime(0,0,0,2,1,(date("Y")-1)));
|
|
if($DEBUG) echo "thisFebDays=$thisFebDays, lastFebDays=$lastFebDays<br>";
|
|
|
|
$monDays = array(
|
|
"0" => "31",
|
|
"1" => "$thisFebDays",
|
|
"2" => "31",
|
|
"3" => "30",
|
|
"4" => "31",
|
|
"5" => "30",
|
|
"6" => "31",
|
|
"7" => "31",
|
|
"8" => "30",
|
|
"9" => "31",
|
|
"10" => "30",
|
|
"11" => "31",
|
|
);
|
|
/*
|
|
$i=0;
|
|
for($i=0;$i<12;$i++){
|
|
echo "$monDays[$i],";
|
|
}
|
|
*/
|
|
$bgnMonth = $query_month;
|
|
$bgnDay = "01";
|
|
$bgnDay = $query_year."-".$bgnMonth."-".$bgnDay;
|
|
if($DEBUG) echo "bgnDay=$bgnDay<br>";
|
|
|
|
$endMonth = $query_month;
|
|
$endDay = $monDays[$endMonth-1];
|
|
$endDay = $query_year."-".$endMonth."-".$endDay;
|
|
if($DEBUG) echo "endDay=$endDay<br>";
|
|
|
|
if($DEBUG) echo "<br>";
|
|
|
|
$selSQL ="SELECT * FROM daily_report WHERE date>='$bgnDay' and date<='$endDay' order by date ASC";
|
|
if($DEBUG) echo "selSQL=$selSQL<br>";
|
|
$selRes = mysqli_query($ppsDbConn,$selSQL);
|
|
echo mysqli_error($ppsDbConn);
|
|
$selRow = @mysqli_fetch_array($selRes);
|
|
if(!$selRow){
|
|
echo "No record found!($query_year-$query_month)!";
|
|
exit();
|
|
}
|
|
//Account summary
|
|
$lastMonthBalance=0;
|
|
$thisMonthRecharge=0;
|
|
$thisMonthBalance=0;
|
|
$thisMonthCharge=0;
|
|
|
|
//Account report
|
|
$thisMonthFresh=0;
|
|
$thisMonthInuse=0;
|
|
$thisMonthSuspended=0;
|
|
$thisMonthBlacklist=0;
|
|
$thisMonthReleased=0;
|
|
$thisMonthOprTrial=0;
|
|
$thisMonthTotal=0;
|
|
|
|
//Recharge card
|
|
$faceValue1=0;
|
|
$thisMonthFaceValue1Used=0;
|
|
$thisMonthFaceValue1Unused=0;
|
|
$faceValue2=0;
|
|
$thisMonthFaceValue2Used=0;
|
|
$thisMonthFaceValue2Unused=0;
|
|
$faceValue3=0;
|
|
$thisMonthFaceValue3Used=0;
|
|
$thisMonthFaceValue3Unused=0;
|
|
$faceValue4=0;
|
|
$thisMonthFaceValue4Used=0;
|
|
$thisMonthFaceValue4Unused=0;
|
|
$faceValue5=0;
|
|
$thisMonthFaceValue5Used=0;
|
|
$thisMonthFaceValue5Unused=0;
|
|
$faceValue6=0;
|
|
$thisMonthFaceValue6Used=0;
|
|
$thisMonthFaceValue6Unused=0;
|
|
|
|
//Call statistics
|
|
$thisMonthIncomingCallNumber=0;
|
|
$thisMonthIncomingCallDuration=0;
|
|
$thisMonthIncomingCallCharge=0;
|
|
|
|
$thisMonthLocalCallNumber=0;
|
|
$thisMonthLocalCallDuration=0;
|
|
$thisMonthLocalCallCharge=0;
|
|
|
|
$thisMonthIDDCallNumber=0;
|
|
$thisMonthIDDCallDuration=0;
|
|
$thisMonthIDDCallCharge=0;
|
|
|
|
$thisMonthNDDCallNumber=0;
|
|
$thisMonthNDDCallDuration=0;
|
|
$thisMonthNDDCallCharge=0;
|
|
|
|
$thisMonthShortMessageNumber=0;
|
|
$thisMonthShortMessageDuration=0;
|
|
$thisMonthShortMessageCharge=0;
|
|
|
|
$thisMonthShortMessageViaWebNumber=0;
|
|
$thisMonthShortMessageViaWebDuration=0;
|
|
$thisMonthShortMessageViaWebCharge=0;
|
|
|
|
$thisMonthConferenceCallNumber=0;
|
|
$thisMonthConferenceCallDuration=0;
|
|
$thisMonthConferenceCallCharge=0;
|
|
|
|
$thisMonthRentNumber=0;
|
|
$thisMonthRentDuration=0;
|
|
$thisMonthRentCharge=0;
|
|
|
|
$thisMonthRechargeSuccNumber=0;
|
|
$thisMonthRechargeSuccDuration=0;
|
|
$thisMonthRechargeSuccCharge=0;
|
|
|
|
$thisMonthRechargeFailNumber=0;
|
|
$thisMonthRechargeFailDuration=0;
|
|
$thisMonthRechargeFailCharge=0;
|
|
|
|
$thisMonthOperatorRechargeNumber=0;
|
|
$thisMonthOperatorRechargeDuration=0;
|
|
$thisMonthOperatorRechargeCharge=0;
|
|
|
|
$thisMonthChargeNumber=0;
|
|
$thisMonthChargeDuration=0;
|
|
$thisMonthChargeCharge=0;
|
|
|
|
$thisMonthTotalNumber=0;
|
|
$thisMonthTotalDuration=0;
|
|
$thisMonthTotalCharge=0;
|
|
|
|
|
|
$thisMonthTotalGPRSVolume=0;
|
|
$thisMonthTotalGPRSDuration=0;
|
|
$thisMonthTotalGPRSCharged=0;
|
|
|
|
$thisMonthTotalSMSNumber=0;
|
|
$thisMonthTotalSMSCharged=0;
|
|
$thisMonthTotalMMSSendNumber=0;
|
|
$thisMonthTotalMMSSendCharged=0;
|
|
$thisMonthTotalMMSRetrieveNumber=0;
|
|
$thisMonthTotalMMSRetrieveCharged=0;
|
|
$thisMonthTotalMMSEmailNumber=0;
|
|
$thisMonthTotalMMSEmailCharged=0;
|
|
|
|
|
|
$allUssdCodes = []; // 用于存储所有记录的 ussd_code
|
|
|
|
do{
|
|
//Account summary
|
|
if ($lastMonthBalance==0)
|
|
$lastMonthBalance = $selRow[yesterday_balance];
|
|
$thisMonthRecharge += $selRow[today_recharge];
|
|
$thisMonthBalance = $selRow[today_balance];
|
|
$thisMonthCharge += $selRow[today_charge];
|
|
$pieces = explode("-",$selRow[date]);
|
|
$dayCharge[$pieces[2]] = $selRow[today_charge];
|
|
//echo "dayCharge[$pieces[2]]={$dayCharge[$pieces[2]]}<br>";
|
|
|
|
//Account report
|
|
$thisMonthFresh = $selRow[fresh_user_num];
|
|
$thisMonthInuse = $selRow[normal_user_num];
|
|
$thisMonthSuspended = $selRow[suspend_user_num];
|
|
$thisMonthBlacklist = $selRow[blacklist_user_num];
|
|
$thisMonthReleased = $selRow[released_user_num];
|
|
$thisMonthOprTrial = $selRow[opr_trial_user_num];
|
|
$thisMonthTotal = $selRow[total_user_num];
|
|
|
|
//Recharge card
|
|
$faceValue1 = ($selRow[precard_facevalue1]>0)?$selRow[precard_facevalue1]:$faceValue1;
|
|
$thisMonthFaceValue1Used += $selRow[precard_used_today1];
|
|
$dayFaceValue1Used[$pieces[2]] = $selRow[precard_used_today1];
|
|
$thisMonthFaceValue1Unused = $selRow[precard_unused1];
|
|
|
|
$faceValue2 = ($selRow[precard_facevalue2]>0)?$selRow[precard_facevalue2]:$faceValue2;
|
|
$thisMonthFaceValue2Used += $selRow[precard_used_today2];
|
|
$dayFaceValue2Used[$pieces[2]] = $selRow[precard_used_today2];
|
|
$thisMonthFaceValue2Unused = $selRow[precard_unused2];
|
|
|
|
$faceValue3 = ($selRow[precard_facevalue3]>0)?$selRow[precard_facevalue3]:$faceValue3;
|
|
$thisMonthFaceValue3Used += $selRow[precard_used_today3];
|
|
$dayFaceValue3Used[$pieces[2]] = $selRow[precard_used_today3];
|
|
$thisMonthFaceValue3Unused = $selRow[precard_unused3];
|
|
|
|
$faceValue4 = ($selRow[precard_facevalue4]>0)?$selRow[precard_facevalue4]:$faceValue4;
|
|
$thisMonthFaceValue4Used += $selRow[precard_used_today4];
|
|
$dayFaceValue4Used[$pieces[2]] = $selRow[precard_used_today4];
|
|
$thisMonthFaceValue4Unused = $selRow[precard_unused4];
|
|
|
|
$faceValue5 = ($selRow[precard_facevalue5]>0)?$selRow[precard_facevalue5]:$faceValue5;
|
|
$thisMonthFaceValue5Used += $selRow[precard_used_today5];
|
|
$dayFaceValue5Used[$pieces[2]] = $selRow[precard_used_today5];
|
|
$thisMonthFaceValue5Unused = $selRow[precard_unused5];
|
|
|
|
$faceValue6 = ($selRow[precard_facevalue6]>0)?$selRow[precard_facevalue6]:$faceValue6;
|
|
$thisMonthFaceValue6Used += $selRow[precard_used_today6];
|
|
$dayFaceValue6Used[$pieces[2]] = $selRow[precard_used_today6];
|
|
$thisMonthFaceValue6Unused = $selRow[precard_unused6];
|
|
|
|
//Call statistics
|
|
$thisMonthIncomingCallNumber += $selRow[incoming_call_num ];
|
|
$thisMonthIncomingCallDuration += $selRow[incoming_call_duration];
|
|
$thisMonthIncomingCallCharge += $selRow[incoming_call_charge];
|
|
|
|
$thisMonthLocalCallNumber += $selRow[local_callout_num];
|
|
$thisMonthLocalCallDuration += $selRow[local_callout_duration];
|
|
$thisMonthLocalCallCharge += $selRow[local_callout_charge];
|
|
|
|
$thisMonthIDDCallNumber += $selRow[IDD_call_num];
|
|
$thisMonthIDDCallDuration += $selRow[IDD_call_duration];
|
|
$thisMonthIDDCallCharge += $selRow[IDD_call_charge];
|
|
|
|
$thisMonthNDDCallNumber += $selRow[NDD_call_num];
|
|
$thisMonthNDDCallDuration += $selRow[NDD_call_duration];
|
|
$thisMonthNDDCallCharge += $selRow[NDD_call_charge];
|
|
|
|
$thisMonthShortMessageNumber += $selRow[short_message_num];
|
|
$thisMonthShortMessageDuration += $selRow[short_message_duration];
|
|
$thisMonthShortMessageCharge += $selRow[short_message_charge];
|
|
|
|
$thisMonthShortMessageViaWebNumber += $selRow[short_message_via_web_num];
|
|
$thisMonthShortMessageViaWebDuration += $selRow[short_message_via_web_duration];
|
|
$thisMonthShortMessageViaWebCharge += $selRow[short_message_via_web_charge];
|
|
|
|
$thisMonthConferenceCallNumber += $selRow[conference_call_num];
|
|
$thisMonthConferenceCallDuration += $selRow[conference_call_duration];
|
|
$thisMonthConferenceCallCharge += $selRow[conference_call_charge];
|
|
|
|
$thisMonthRentNumber += $selRow[rent_charging_num];
|
|
$thisMonthRentDuration += $selRow[rent_charging_duration];
|
|
$thisMonthRentCharge += $selRow[rent_charge];
|
|
|
|
$thisMonthRechargeSuccNumber += $selRow[recharge_suc_num];
|
|
$thisMonthRechargeSuccDuration += $selRow[recharge_suc_duration];
|
|
$thisMonthRechargeSuccCharge += $selRow[recharge_suc];
|
|
|
|
$thisMonthRechargeFailNumber += $selRow[recharge_fail_num];
|
|
$thisMonthRechargeFailDuration += $selRow[recharge_fail_duration];
|
|
$thisMonthRechargeFailCharge += $selRow[recharge_fail];
|
|
|
|
$thisMonthOperatorRechargeNumber += $selRow[ast_recharge_num];
|
|
$thisMonthOperatorRechargeDuration += $selRow[ast_recharge_duration];
|
|
$thisMonthOperatorRechargeCharge += $selRow[ast_recharge];
|
|
|
|
$thisMonthChargeNumber += $selRow[ast_charge_num];
|
|
$thisMonthChargeDuration += $selRow[ast_charge_duration];
|
|
$thisMonthChargeCharge += $selRow[ast_charge];
|
|
|
|
$thisMonthTotalNumber += $selRow[total_call_num];
|
|
$thisMonthTotalDuration += $selRow[total_call_duration];
|
|
$thisMonthTotalCharge += $selRow[total_call_charge];
|
|
|
|
$thisMonthTotalGPRSVolume+=($selRow[gprs_volume]-0)/1024;
|
|
$thisMonthTotalGPRSDuration+=($selRow[gprs_duration]-0)/3600;
|
|
$thisMonthTotalGPRSCharged+=$selRow[gprs_charged]-0;
|
|
|
|
$thisMonthTotalSMSNumber+=$selRow[sms_number];
|
|
$thisMonthTotalSMSCharged+=$selRow[sms_charged];
|
|
$thisMonthTotalMMSSendNumber+=$selRow[mms_send_number];
|
|
$thisMonthTotalMMSSendCharged+=$selRow[mms_send_charged];
|
|
$thisMonthTotalMMSRetrieveNumber+=$selRow[mms_retrieve_number];
|
|
$thisMonthTotalMMSRetrieveCharged+=$selRow[mms_retrieve_charged];
|
|
$thisMonthTotalMMSEmailNumber+=$selRow[mms_email_number];
|
|
$thisMonthTotalMMSEmailCharged+=$selRow[mms_email_charged];
|
|
|
|
|
|
if(!count($allUssdCodes)){ // 代表是第一条记录
|
|
// 初始化数组
|
|
for ($i = 1; $i <= 8; $i++) {
|
|
$allUssdCodes[$i] = $selRow['ussd_code_' . $i];
|
|
$thisMonthTotalSessionNum[$i] = $selRow['session_num_' . $i];
|
|
$thisMonthTotalSessionDuration[$i] = $selRow['session_duration_'. $i];
|
|
$thisMonthTotalErrorTimeout[$i] = $selRow['error_timeout_'. $i];
|
|
$thisMonthTotalErrorSystem[$i] = $selRow['error_system_'. $i];
|
|
$thisMonthTotalErrorMessage[$i] = $selRow['error_message_'. $i];
|
|
}
|
|
} else { // 剩余记录
|
|
// 创建USSD索引的映射
|
|
$codeToIndexMap = array_flip(array_filter($allUssdCodes));
|
|
|
|
for ($j = 1; $j <= 8; $j++) {
|
|
$currentCode = $selRow['ussd_code_' . $j];
|
|
if (!$currentCode) continue; // 跳过空代码
|
|
|
|
if (isset($codeToIndexMap[$currentCode])) {
|
|
// 已存在的代码,累加统计数据
|
|
$index = $codeToIndexMap[$currentCode];
|
|
$thisMonthTotalSessionNum[$index] += $selRow['session_num_' . $j];
|
|
$thisMonthTotalSessionDuration[$index] += $selRow['session_duration_'. $j];
|
|
$thisMonthTotalErrorTimeout[$index] += $selRow['error_timeout_'. $j];
|
|
$thisMonthTotalErrorSystem[$index] += $selRow['error_system_'. $j];
|
|
$thisMonthTotalErrorMessage[$index] += $selRow['error_message_'. $j];
|
|
} else {
|
|
//找一个空位存放
|
|
foreach ($allUssdCodes as $key => $value) {
|
|
if (!$value) {
|
|
$allUssdCodes[$key] = $currentCode;
|
|
$codeToIndexMap[$currentCode] = $key;
|
|
$thisMonthTotalSessionNum[$key] = $selRow['session_num_' . $j];
|
|
$thisMonthTotalSessionDuration[$key] = $selRow['session_duration_'. $j];
|
|
$thisMonthTotalErrorTimeout[$key] = $selRow['error_timeout_'. $j];
|
|
$thisMonthTotalErrorSystem[$key] = $selRow['error_system_'. $j];
|
|
$thisMonthTotalErrorMessage[$key] = $selRow['error_message_'. $j];
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
}while($selRow=mysqli_fetch_array($selRes));
|
|
|
|
$thisMonthTotalGPRSVolume=number_format($thisMonthTotalGPRSVolume,3,'.','');
|
|
$thisMonthTotalGPRSDuration=number_format($thisMonthTotalGPRSDuration,3,'.','');
|
|
|
|
if($DEBUG){
|
|
echo "lastMonthBalance=$lastMonthBalance, ";
|
|
echo "thisMonthRecharge=$thisMonthRecharge, ";
|
|
echo "thisMonthBalance=$thisMonthBalance, ";
|
|
echo "thisMonthCharge=$thisMonthCharge, ";
|
|
echo "<br>";
|
|
echo "thisMonthFresh=$thisMonthFresh, ";
|
|
echo "thisMonthInuse=$thisMonthInuse, ";
|
|
echo "thisMonthSuspended=$thisMonthSuspended, ";
|
|
echo "thisMonthBlacklist=$thisMonthBlacklist, ";
|
|
echo "thisMonthReleased=$thisMonthReleased, ";
|
|
echo "thisMonthTotal=$thisMonthTotal, ";
|
|
echo "<br>";
|
|
echo "faceValue1=$faceValue1, ";
|
|
echo "thisMonthFaceValue1Used=$thisMonthFaceValue1Used, ";
|
|
echo "thisMonthFaceValue1Unused=$thisMonthFaceValue1Unused, ";
|
|
echo "<br>";
|
|
echo "thisMonthFaceValue2Used=$thisMonthFaceValue2Used, ";
|
|
echo "thisMonthFaceValue2Unused=$thisMonthFaceValue2Unused, ";
|
|
echo "<br>";
|
|
echo "thisMonthFaceValue3Used=$thisMonthFaceValue3Used, ";
|
|
echo "thisMonthFaceValue3Unused=$thisMonthFaceValue3Unused, ";
|
|
echo "<br>";
|
|
echo "thisMonthFaceValue4Used=$thisMonthFaceValue4Used, ";
|
|
echo "thisMonthFaceValue4Unused=$thisMonthFaceValue4Unused, ";
|
|
echo "<br>";
|
|
}
|
|
|
|
/************* 统计前几个月的收费情况 ***************/
|
|
for($i=1;$i<=12;$i++){
|
|
$monCharge[$i]=0;
|
|
$selBgnDay = $query_year."-".($i<10?"0":"").$i."-01";
|
|
$selEndDay = $query_year."-".($i<10?"0":"").$i."-".$monDays[$i-1];
|
|
if($DEBUG) echo "selBgnDay=$selBgnDay, selEndDay=$selEndDay<br>";
|
|
$selSQL = "SELECT * FROM daily_report WHERE date>='$selBgnDay' and date<='$selEndDay'";
|
|
if($DEBUG) echo "selSQL=$selSQL<br>";
|
|
$selRes = mysqli_query($ppsDbConn,$selSQL);
|
|
echo mysqli_error($ppsDbConn);
|
|
$selRow = @mysqli_fetch_array($selRes);
|
|
do{
|
|
$monCharge[$i] += $selRow[today_charge];
|
|
$monFaceValue1Used[$i] += $selRow[precard_used_today1];
|
|
$monFaceValue2Used[$i] += $selRow[precard_used_today2];
|
|
$monFaceValue3Used[$i] += $selRow[precard_used_today3];
|
|
$monFaceValue4Used[$i] += $selRow[precard_used_today4];
|
|
$monFaceValue5Used[$i] += $selRow[precard_used_today5];
|
|
$monFaceValue6Used[$i] += $selRow[precard_used_today6];
|
|
}while($selRow = @mysqli_fetch_array($selRes));
|
|
if($DEBUG) echo "monCharge[$i]=$monCharge[$i]<br>";
|
|
}
|
|
?>
|
|
|
|
|
|
|
|
<?php
|
|
//----------------------------------页面标题---------------------------------------------------------
|
|
?>
|
|
<table border="0" width="100%" cellpadding="2" cellspacing="0" bordercolor="#FFFFFF" bordercolordark="#FFFFFF">
|
|
<tr>
|
|
<td width="25%">
|
|
</td>
|
|
<td width="50%" align="center">
|
|
<b>
|
|
<?php echo "$strMonth PPS report ($bgnDay ~ $endDay)";?>
|
|
</b>
|
|
</td>
|
|
|
|
<td width="5%" align="right">
|
|
<a href="./downCSTA.php?sysTypeNo=360&flag=month&bgnDay=<?php echo "$bgnDay";?>&endDay=<?php echo "$endDay";?> ">
|
|
<img align=absBottom border=0 src="../../images/list.gif" width="16" height="16"><?php echo " Export";?>
|
|
</a>
|
|
|
|
<td width="5%" align="right">
|
|
<div onClick="window.print();" style="cursor:hand">
|
|
<img align=absBottom border=0 src="../../images/printer.gif" width="16" height="16"><?php echo " $strDailyBtnPrint";?>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
|
|
|
|
<?php
|
|
//----------------------------------全局统计--------------------------------------------------------
|
|
?>
|
|
<table border="1" width="100%" cellpadding="2" cellspacing="0" bordercolor="#666666" bordercolordark="#FFFFFF" bgcolor="#FFFFFF">
|
|
<tr bgcolor=#E6E6E6 >
|
|
<?php
|
|
echo "<td width=\"16%\"> </td>";
|
|
echo "<td width=\"42%\">$strDailyUserState</td> ";
|
|
echo "<td align=\"right\" width=\"42%\">$strDailyUserNum</td> ";
|
|
?>
|
|
</tr>
|
|
<?php
|
|
echo "<tr>";
|
|
echo "<td rowspan=\"7\">$strDailyUserTitle</td>";
|
|
$fresh_user_num = showComma($thisMonthFresh);
|
|
echo "<td>$strDailyFresh</td>";
|
|
echo "<td align=\"right\">$fresh_user_num</td>";
|
|
echo "</tr>";
|
|
|
|
echo "<tr>";
|
|
$normal_user_num = showComma($thisMonthInuse);
|
|
echo "<td>$strDailyUsing</td>";
|
|
echo "<td align=\"right\">$normal_user_num</td>";
|
|
echo "</tr>";
|
|
|
|
echo "<tr>";
|
|
$suspend_user_num = showComma($thisMonthSuspended);
|
|
echo "<td>$strDailySuspend</td>";
|
|
echo "<td align=\"right\">$suspend_user_num</td>";
|
|
echo "</tr>";
|
|
|
|
echo "<tr>";
|
|
$blacklist_user_num = showComma($thisMonthBlacklist);
|
|
echo "<td>$strBlackList</td>";
|
|
echo "<td align=\"right\">$blacklist_user_num</td>";
|
|
echo "</tr>";
|
|
|
|
echo "<tr>";
|
|
$released_user_num = showComma($thisMonthReleased);
|
|
echo "<td>$strReleased</td>";
|
|
echo "<td align=\"right\">$released_user_num</td>";
|
|
echo "</tr>";
|
|
|
|
echo "<tr>";
|
|
$opr_trial_user_num = showComma($thisMonthOprTrial);
|
|
echo "<td>OPR Trial</td>";
|
|
echo "<td align=\"right\">$opr_trial_user_num</td>";
|
|
echo "</tr>";
|
|
|
|
echo "<tr>";
|
|
$total_user_num = showComma($thisMonthTotal);
|
|
echo "<td>$strTotal</td>";
|
|
echo "<td align=\"right\">$total_user_num</td>";
|
|
echo "</tr>";
|
|
?>
|
|
</table>
|
|
|
|
<?php
|
|
//-------------------------------------------充值卡当月统计---------------------------------------------
|
|
?>
|
|
<p></p>
|
|
<table border="1" width="100%" cellpadding="2" cellspacing="0" bordercolor="#666666" bordercolordark="#FFFFFF" bgcolor="#FFFFFF">
|
|
<tr bgcolor=#E6E6E6>
|
|
<?php
|
|
echo "<td width=\"16%\"> </td>";
|
|
echo "<td width=\"16.8%\">$strDailyCardFace</td> ";
|
|
for($i=1;$i<=$face_value_type;$i++)
|
|
{
|
|
$showValue=${"faceValue".$i}/$moneyPara;
|
|
if($showValue == 0){
|
|
echo "<td align=\"right\" width=\"10%\">--</td>";
|
|
$arr_FaceValueList[$i] = 0;
|
|
}else{
|
|
echo "<td align=\"right\" width=\"10%\"> ($strValueCurrency";
|
|
echo "$showValue)";
|
|
echo "</td>";
|
|
$arr_FaceValueList[$i] = 1;
|
|
}
|
|
}
|
|
?>
|
|
</tr>
|
|
<?php
|
|
echo "<tr>";
|
|
echo "<td rowspan=\"2\">$strPrepaidCard</td>";
|
|
// echo "<td>$strThisMonthCharged</td>";
|
|
echo "<td>Used</td>";
|
|
for($i=1;$i<=$face_value_type;$i++)
|
|
{
|
|
$precardUsed=showComma(${"thisMonthFaceValue".$i."Used"});
|
|
if($arr_FaceValueList[$i] == 1){
|
|
echo "<td align=\"right\">$precardUsed</td>";
|
|
}else{
|
|
echo "<td align=\"right\">--</td>";
|
|
}
|
|
}
|
|
echo "</tr>";
|
|
|
|
echo "<tr>";
|
|
echo "<td>$strNotCharged</td>";
|
|
for($i=1;$i<$face_value_type+1;$i++)
|
|
{
|
|
$precardUnused=showComma(${"thisMonthFaceValue".$i."Unused"});
|
|
if($arr_FaceValueList[$i] == 1){
|
|
echo "<td align=\"right\">$precardUnused</td>";
|
|
}else{
|
|
echo "<td align=\"right\">--</td>";
|
|
}
|
|
}
|
|
echo "</tr>";
|
|
?>
|
|
|
|
</table>
|
|
|
|
<?php
|
|
//----------------------------------当日话单统计-----------------------------------------------------------
|
|
?>
|
|
<p></p>
|
|
<table border="1" width="100%" cellpadding="2" cellspacing="0" bordercolor="#666666" bordercolordark="#FFFFFF" bgcolor="#FFFFFF">
|
|
<tr bgcolor=#E6E6E6>
|
|
<?php
|
|
echo "<td width=\"16%\"> </td>";
|
|
echo "<td width=\"21%\">$strDailyCallType</td> ";
|
|
echo "<td width=\"21%\" align=\"right\">$strDailyCallTimes</td> ";
|
|
echo "<td width=\"21%\" align=\"right\">$strDailyCallDuration</td> ";
|
|
echo "<td width=\"21%\" align=\"right\">$strDailyCallCharge</td> ";
|
|
?>
|
|
</tr>
|
|
|
|
<tr >
|
|
<td rowspan="11"><?php echo "$strCallStatistics"; ?></td>
|
|
<?php
|
|
echo "<td>$strDailyCallIncoming</td>";
|
|
$incoming_call_nums = showComma($thisMonthIncomingCallNumber);
|
|
$incoming_call_duration = showComma($thisMonthIncomingCallDuration);
|
|
$incoming_call_charge = showComma(sprintf("$fmtBit",$thisMonthIncomingCallCharge/$moneyPara));
|
|
echo "<td align=\"right\">$incoming_call_nums</td>";
|
|
echo "<td align=\"right\">$incoming_call_duration</td>";
|
|
echo "<td align=\"right\">$incoming_call_charge</td>";
|
|
?>
|
|
</tr>
|
|
|
|
<tr >
|
|
<?php
|
|
echo "<td>$strDailyCallIDD</td>";
|
|
$IDD_call_nums = showComma($thisMonthIDDCallNumber);
|
|
$IDD_call_duration = showComma($thisMonthIDDCallDuration);
|
|
$IDD_call_charge = showComma(sprintf("$fmtBit",$thisMonthIDDCallCharge/$moneyPara));
|
|
echo "<td align=\"right\">$IDD_call_nums</td>";
|
|
echo "<td align=\"right\">$IDD_call_duration</td>";
|
|
echo "<td align=\"right\">$IDD_call_charge</td>";
|
|
?>
|
|
</tr>
|
|
|
|
<tr >
|
|
<?php
|
|
echo "<td>$strDailyCallNDD</td>";
|
|
$NDD_call_nums = showComma($thisMonthNDDCallNumber);
|
|
$NDD_call_duration = showComma($thisMonthNDDCallDuration);
|
|
$NDD_call_charge = showComma(sprintf("$fmtBit",$thisMonthNDDCallCharge/$moneyPara));
|
|
echo "<td align=\"right\">$NDD_call_nums</td>";
|
|
echo "<td align=\"right\">$NDD_call_duration</td>";
|
|
echo "<td align=\"right\">$NDD_call_charge</td>";
|
|
?>
|
|
</tr>
|
|
|
|
<tr >
|
|
<?php
|
|
echo "<td>$strDailyCallLocalOut</td>";
|
|
$local_callout_nums = showComma($thisMonthLocalCallNumber);
|
|
$local_callout_duration = showComma($thisMonthLocalCallDuration);
|
|
$local_callout_charge = showComma(sprintf("$fmtBit",$thisMonthLocalCallCharge/$moneyPara));
|
|
echo "<td align=\"right\">$local_callout_nums</td>";
|
|
echo "<td align=\"right\">$local_callout_duration</td>";
|
|
echo "<td align=\"right\">$local_callout_charge</td>";
|
|
?>
|
|
</tr>
|
|
|
|
<tr>
|
|
<?php
|
|
echo "<td>$strDailyCallSMS</td>";
|
|
$short_message_nums = showComma($thisMonthShortMessageNumber);
|
|
$short_message_duration = showComma($thisMonthShortMessageDuration);
|
|
$short_message_charge = showComma(sprintf("$fmtBit",$thisMonthShortMessageCharge/$moneyPara));
|
|
echo "<td align=\"right\">$short_message_nums</td>";
|
|
echo "<td align=\"right\">$short_message_duration</td>";
|
|
echo "<td align=\"right\">$short_message_charge</td>";
|
|
?>
|
|
</tr>
|
|
|
|
<!-- Short message via web -->
|
|
<tr>
|
|
<?php
|
|
echo "<td>$strDailyCallSMSViaWeb</td>";
|
|
$short_message_nums = showComma($thisMonthShortMessageViaWebNumber);
|
|
$short_message_duration = showComma($thisMonthShortMessageViaWebDuration);
|
|
$short_message_charge = showComma(sprintf("$fmtBit",$thisMonthShortMessageViaWebCharge/$moneyPara));
|
|
echo "<td align=\"right\">$short_message_nums</td>";
|
|
echo "<td align=\"right\">$short_message_duration</td>";
|
|
echo "<td align=\"right\">$short_message_charge</td>";
|
|
?>
|
|
</tr>
|
|
|
|
<tr>
|
|
<?php
|
|
echo "<td>$strDailyCallConferenceCall</td>";
|
|
$conference_call_nums = showComma($thisMonthConferenceCallNumber);
|
|
$conference_call_duration = showComma($thisMonthConferenceCallDuration);
|
|
$conference_call_charge = showComma(sprintf("$fmtBit",$thisMonthConferenceCallCharge/$moneyPara));
|
|
echo "<td align=\"right\">$conference_call_nums</td>";
|
|
echo "<td align=\"right\">$conference_call_duration</td>";
|
|
echo "<td align=\"right\">$conference_call_charge</td>";
|
|
?>
|
|
</tr>
|
|
|
|
<tr>
|
|
<?php
|
|
echo "<td>$strDailyCallRent</td>";
|
|
$rent_charging_nums = showComma($thisMonthRentNumber);
|
|
$rent_charging_duration = showComma($thisMonthRentDuration);
|
|
$rent_charge = showComma(sprintf("$fmtBit",$thisMonthRentCharge/$moneyPara));
|
|
echo "<td align=\"right\">$rent_charging_nums</td>";
|
|
echo "<td align=\"right\">$rent_charging_duration</td>";
|
|
echo "<td align=\"right\">$rent_charge</td>";
|
|
?>
|
|
</tr>
|
|
<!--
|
|
<tr>
|
|
<?php
|
|
echo "<td>$strDailyCharged</td>";
|
|
$recharge_suc_nums = showComma($thisMonthRechargeSuccNumber);
|
|
$recharge_suc_duration = showComma($thisMonthRechargeSuccDuration);
|
|
$recharge_suc = showComma(sprintf("$fmtBit",$thisMonthRechargeSuccCharge/$moneyPara));
|
|
echo "<td align=\"right\">$recharge_suc_nums</td>";
|
|
echo "<td align=\"right\">$recharge_suc_duration</td>";
|
|
echo "<td align=\"right\">$recharge_suc</td>";
|
|
?>
|
|
</tr>
|
|
-->
|
|
<tr>
|
|
<?php
|
|
echo "<td>$strOperatorRecharge</td>";
|
|
$ast_recharge_nums = showComma($thisMonthOperatorRechargeNumber);
|
|
$ast_recharge_duration = showComma($thisMonthOperatorRechargeDuration);
|
|
$ast_recharge = showComma(sprintf("$fmtBit",$thisMonthOperatorRechargeCharge/$moneyPara));
|
|
echo "<td align=\"right\">$ast_recharge_nums</td>";
|
|
echo "<td align=\"right\">$ast_recharge_duration</td>";
|
|
echo "<td align=\"right\">$ast_recharge</td>";
|
|
?>
|
|
</tr>
|
|
|
|
<tr>
|
|
<?php
|
|
echo "<td>$strOperatorCharge</td>";
|
|
$ast_charge_nums = showComma($thisMonthChargeNumber);
|
|
$ast_charge_duration = showComma($thisMonthChargeDuration);
|
|
$ast_charge = showComma(sprintf("$fmtBit",$thisMonthChargeCharge/$moneyPara));
|
|
echo "<td align=\"right\">$ast_charge_nums</td>";
|
|
echo "<td align=\"right\">$ast_charge_duration</td>";
|
|
echo "<td align=\"right\">$ast_charge</td>";
|
|
?>
|
|
</tr>
|
|
|
|
<tr>
|
|
<?php
|
|
echo "<td>$strTotal</td>";
|
|
$total_call_num = showComma($thisMonthTotalNumber);
|
|
$total_call_charge = showComma(sprintf("$fmtBit",$thisMonthTotalCharge/$moneyPara));
|
|
$total_call_duration = showComma($thisMonthTotalDuration);
|
|
echo "<td align=\"right\">$total_call_num</td>";
|
|
echo "<td align=\"right\">$total_call_duration</td>";
|
|
echo "<td align=\"right\">$total_call_charge</td>";
|
|
?>
|
|
</tr>
|
|
</table>
|
|
|
|
|
|
|
|
<?php
|
|
//----------------------------------USSD Code Report-----------------------------------------------------------
|
|
?>
|
|
<p></p>
|
|
<TABLE border="1" width="100%" cellpadding="2" cellspacing="0" bordercolor="#666666" bordercolordark="#FFFFFF" bgcolor="#FFFFFF">
|
|
<TR bgcolor=#E6E6E6>
|
|
<?php
|
|
echo "<td width=\"10%\"> </td>";
|
|
echo "<td width=\"10%\">Index</td>";
|
|
echo "<td width=\"10%\">USSD Code</td> ";
|
|
echo "<td width=\"10%\" align=\"right\">Session Num</td> ";
|
|
echo "<td width=\"10%\" align=\"right\">Session Duration</td> ";
|
|
echo "<td width=\"10%\" align=\"right\">Error Timeout</td> ";
|
|
echo "<td width=\"10%\" align=\"right\">Error System</td> ";
|
|
echo "<td width=\"10%\" align=\"right\">Error Message</td> ";
|
|
echo "<td width=\"10%\" align=\"right\">Average Duration</td> ";
|
|
echo "<td width=\"10%\" align=\"right\">TPS</td> ";
|
|
|
|
?>
|
|
</TR>
|
|
<TR >
|
|
<td rowspan="11"><?php echo "USSD Code Report"; ?></td>
|
|
<?php
|
|
echo "<td>1</td>";
|
|
// $thisMonthTotalSessionNum[$i]+=$selRow['session_num_' . $i];
|
|
// $thisMonthTotalSessionDuration[$i]+=$selRow['session_duration_'. $i];
|
|
// $thisMonthTotalErrorTimeout[$i]+=$selRow['error_timeout_'. $i];
|
|
// $thisMonthTotalErrorSystem[$i]+=$selRow['error_system_'. $i];
|
|
// $thisMonthTotalErrorMessage[$i]+=$selRow['error_message_'. $i];
|
|
// $thisMonthTotalErrorReserve1[$i]+=$selRow['error_reserve_1_'. $i];
|
|
// $thisMonthTotalErrorReserve2[$i]+=$selRow['error_reserve_2_'. $i];
|
|
$average1 = $thisMonthTotalSessionNum[1] ? round($thisMonthTotalSessionDuration[1]/($thisMonthTotalSessionNum[1]), 2) : 0;
|
|
$tps1 = round($thisMonthTotalSessionNum[1]/(3600*24), 2);
|
|
echo "<td align=\"right\">$allUssdCodes[1]</td>";
|
|
echo "<td align=\"right\">$thisMonthTotalSessionNum[1]</td>";
|
|
echo "<td align=\"right\">$thisMonthTotalSessionDuration[1]</td>";
|
|
echo "<td align=\"right\">$thisMonthTotalErrorTimeout[1]</td>";
|
|
echo "<td align=\"right\">$thisMonthTotalErrorSystem[1]</td>";
|
|
echo "<td align=\"right\">$thisMonthTotalErrorMessage[1]</td>";
|
|
echo "<td align=\"right\">$average1</td>";
|
|
echo "<td align=\"right\">$tps1</td>";
|
|
|
|
|
|
// echo "<td align=\"right\">$incoming_call_nums</td>";
|
|
// echo "<td align=\"right\">$incoming_call_duration</td>";
|
|
// echo "<td align=\"right\">$incoming_call_charge</td>";
|
|
?>
|
|
</TR>
|
|
<?php
|
|
for ($i = 2; $i <= 8; $i++) {
|
|
$average = $thisMonthTotalSessionNum[$i] ? round($thisMonthTotalSessionDuration[$i]/$thisMonthTotalSessionNum[$i], 2) : 0;
|
|
$tps = round($thisMonthTotalSessionNum[$i]/(3600*24), 2);
|
|
echo "<tr>";
|
|
echo "<td>$i</td>";
|
|
echo "<td align=\"right\">{$allUssdCodes[$i]}</td>";
|
|
echo "<td align=\"right\">{$thisMonthTotalSessionNum[$i]}</td>";
|
|
echo "<td align=\"right\">{$thisMonthTotalSessionDuration[$i]}</td>";
|
|
echo "<td align=\"right\">{$thisMonthTotalErrorTimeout[$i]}</td>";
|
|
echo "<td align=\"right\">{$thisMonthTotalErrorSystem[$i]}</td>";
|
|
echo "<td align=\"right\">{$thisMonthTotalErrorMessage[$i]}</td>";
|
|
echo "<td align=\"right\">{$average}</td>";
|
|
echo "<td align=\"right\">{$tps}</td>";
|
|
echo "</tr>";
|
|
}
|
|
?>
|
|
</TABLE>
|
|
|
|
|
|
|
|
|
|
|
|
<p></p>
|
|
<?php
|
|
echo "<table border=\"1\" width=\"100%\" cellpadding=\"2\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\" bgcolor=\"#FFFFFF\">";
|
|
echo "<tr bgcolor=\"#E6E6E6\">";
|
|
echo "<td width=16%> </td>";
|
|
echo "<td>GPRS volume(MB)</td>";
|
|
echo "<td>GPRS duration(H)</td>";
|
|
echo "<td>GPRS charged</td>";
|
|
echo "</tr>";
|
|
|
|
echo "<tr>";
|
|
echo "<td>GPRS statistic</td>";
|
|
echo "<td align=\"right\"> $thisMonthTotalGPRSVolume</td>";
|
|
echo "<td align=\"right\"> $thisMonthTotalGPRSDuration</td>";
|
|
echo "<td align=\"right\"> $thisMonthTotalGPRSCharged</td>";
|
|
echo "</tr>";
|
|
|
|
echo "</table><br>";
|
|
|
|
echo "<table border=\"1\" width=\"100%\" cellpadding=\"2\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\" bgcolor=\"#FFFFFF\">";
|
|
echo "<tr bgcolor=\"#E6E6E6\">";
|
|
echo "<td width=16%> </td>";
|
|
echo "<td>SMS number</td>";
|
|
echo "<td>SMS charged</td>";
|
|
echo "<td>MMS send number</td>";
|
|
echo "<td>MMS send charged</td>";
|
|
echo "<td>MMS retrieve number</td>";
|
|
echo "<td>MMS retrieve charged</td>";
|
|
echo "<td>MMS email number</td>";
|
|
echo "<td>MMS email number</td>";
|
|
echo "</tr>";
|
|
|
|
echo "<tr>";
|
|
echo "<td>MMS statistic</td>";
|
|
echo "<td align=\"right\"> $thisMonthTotalSMSNumber</td>";
|
|
echo "<td align=\"right\"> $thisMonthTotalSMSCharged</td>";
|
|
echo "<td align=\"right\"> $thisMonthTotalMMSSendNumber</td>";
|
|
echo "<td align=\"right\"> $thisMonthTotalMMSSendCharged</td>";
|
|
echo "<td align=\"right\"> $thisMonthTotalMMSRetrieveNumber</td>";
|
|
echo "<td align=\"right\"> $thisMonthTotalMMSRetrieveCharged</td>";
|
|
echo "<td align=\"right\"> $thisMonthTotalMMSEmailNumber</td>";
|
|
echo "<td align=\"right\"> $thisMonthTotalMMSEmailCharged</td>";
|
|
echo "</tr>";
|
|
|
|
echo "</table>";
|
|
|
|
?>
|
|
|
|
<p></p>
|
|
|
|
<table border="1" width="100%" cellpadding="2" cellspacing="0" bordercolor="#666666" bordercolordark="#FFFFFF" bgcolor="#FFFFFF">
|
|
<tr bgcolor=#E6E6E6>
|
|
<?php
|
|
echo "<td width=\"16%\"> </td>";
|
|
echo "<td width=\"21%\" align=\"right\">$strAccountLastMonthBalance</td>";
|
|
echo "<td width=\"21%\" align=\"right\">$strAccountThisMonthRecharge</td>";
|
|
echo "<td width=\"21%\" align=\"right\">$strAccountThisMonthBalance</td>";
|
|
echo "<td width=\"21%\" align=\"right\">$strAccountThisMonthCharge</td>";
|
|
?>
|
|
</tr>
|
|
|
|
<tr >
|
|
<?php
|
|
echo "<td>$strAccountSummary</td>";
|
|
$yesterday_balance = showComma(sprintf("$fmtBit",$lastMonthBalance/$moneyPara));
|
|
$today_recharge = showComma(sprintf("$fmtBit",$thisMonthRecharge/$moneyPara));
|
|
$today_charge = showComma(sprintf("$fmtBit",$thisMonthCharge/$moneyPara));
|
|
$today_balance = showComma(sprintf("$fmtBit",$thisMonthBalance/$moneyPara));
|
|
echo "<td align=\"right\">$yesterday_balance</td>";
|
|
echo "<td align=\"right\">$today_recharge</td>";
|
|
echo "<td align=\"right\">$today_balance</td>";
|
|
echo "<td align=\"right\">$today_charge</td>";
|
|
?>
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
|
|
<!--
|
|
******************************* Draw charge statistic graphic *************************
|
|
-->
|
|
|
|
<?php
|
|
$maxYNum=0;
|
|
for ($i=1;$i<=$monDays[$query_month-1];$i++){
|
|
$j = (($i<10)?"0":"").$i;
|
|
$dayCharge[$i] = $dayCharge[$j]/$moneyPara;
|
|
//echo "dayCharge[$j]=$dayCharge[$j]<br>";
|
|
$maxYNum = ($dayCharge[$i]>$maxYNum)?$dayCharge[$i]:$maxYNum;
|
|
}
|
|
$maxYNum = (floor($maxYNum/80)+1)*80;
|
|
//echo "maxYNum=$maxYNum<br>";
|
|
$legendArr=array(
|
|
array('Charge','7D0000',0)
|
|
);
|
|
$title=$strMonth." call charge statistic.";
|
|
|
|
|
|
//-----图片背景和坐标,标示等基本元素,请勿修改这部分
|
|
$DEBUG=0;
|
|
$sizex=550;
|
|
$sizey=270;
|
|
$bgcolor=F8F8F8;
|
|
$fgcolor=000000;
|
|
$dayStr=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$i,date("Y")));
|
|
|
|
$im = ImageCreate ($sizex, $sizey);
|
|
|
|
$background_color = ImageColorAllocate ($im, hexdec(substr($bgcolor, 0, 2)), hexdec(substr($bgcolor, 2, 2)),hexdec(substr($bgcolor, 4, 2)));
|
|
|
|
$text_color = ImageColorAllocate ($im, hexdec(substr($fgcolor, 0, 2)), hexdec(substr($fgcolor, 2, 2)),hexdec(substr($fgcolor, 4, 2)));
|
|
|
|
//背景
|
|
ImageFilledRectangle($im,0,0,$sizex,$sizey,ImageColorAllocate ($im, 198, 198, 198));
|
|
ImageFilledRectangle($im,2,2,$sizex,$sizey,ImageColorAllocate ($im, 130, 130, 130));
|
|
$pointArr=array(0,$sizey-1,3,$sizey-4,4,$sizey-1);
|
|
Imagefilledpolygon($im, $pointArr, 3, ImageColorAllocate ($im, 130, 130, 130));
|
|
$pointArr=array($sizex-1,0,$sizex-4,3,$sizex,4);
|
|
Imagefilledpolygon($im, $pointArr, 3, ImageColorAllocate ($im, 130, 130, 130));
|
|
ImageFilledRectangle($im,2,2,$sizex-3,$sizey-3,$background_color);
|
|
|
|
//边框
|
|
$xBgn=75;
|
|
$yBgn=15;
|
|
$xEnd=540;
|
|
$yEnd=215;
|
|
$unitXPix=15;
|
|
ImageLine($im, $xBgn, $yBgn, $xBgn, $yEnd, $text_color);
|
|
ImageLine($im, $xBgn, $yBgn, $xEnd, $yBgn, $text_color);
|
|
ImageLine($im, $xBgn, $yEnd, $xEnd, $yEnd, $text_color);
|
|
ImageLine($im, $xEnd, $yBgn, $xEnd, $yEnd, $text_color);
|
|
|
|
//竖网格及标注
|
|
for($i=0;$i<=$monDays[$query_month-1];$i++){
|
|
ImageDashedLine($im, $xBgn + $i*15, $yBgn, $xBgn + $i*15, $yEnd, $text_color);
|
|
if($i % 2 == 0){
|
|
Imagestring($im, 2, $xBgn + $i*15 - 4, $yEnd, "$i", $text_color);
|
|
}
|
|
}
|
|
|
|
//横网格及标注
|
|
for($i=0;$i<8;$i++){
|
|
ImageDashedLine($im, $xBgn, $yBgn + $i*25, $xEnd, $yBgn + $i*25, $text_color);
|
|
/*
|
|
$yRemark=$maxYNum / 8 * (8 - $i);
|
|
Imagestring($im, 2, $xBgn - 50, $yBgn + $i*25 - 5, "$yRemark", $text_color);
|
|
*/
|
|
$scale=$maxYNum / 8 * (8 - $i);
|
|
if($scale>1000*1000){
|
|
$displayMaxData = round($scale/100000)/10;
|
|
$displayMaxData = $displayMaxData."M";
|
|
}elseif($scale>1000){
|
|
$displayMaxData = round($scale/100)/10;
|
|
$displayMaxData = $displayMaxData."K";
|
|
}else
|
|
$displayMaxData = $scale;
|
|
|
|
Imagestring($im, 2, $xBgn - 50, $yBgn + $i*25 - 5, "$displayMaxData", $text_color);
|
|
}
|
|
|
|
//色块图标及说明
|
|
for($i=0;$i<sizeof($legendArr);$i++){
|
|
$tmpName=$legendArr[$i][0];
|
|
$tmpColor=$legendArr[$i][1];
|
|
$color = ImageColorAllocate ($im, hexdec(substr($tmpColor, 0, 2)), hexdec(substr($tmpColor, 2, 2)),hexdec(substr($tmpColor, 4, 2)));
|
|
$legendArr[$i][2]=$color;
|
|
ImageFilledRectangle($im,82 + $i* 100,$yEnd + 22,80 + $i* 100 + 10,$yEnd + 30,$legendArr[$i][2]);
|
|
Imagestring($im, 2, 95 + $i* 100,$yEnd + 20, "$tmpName", $text_color);
|
|
}
|
|
|
|
//下部图表名称
|
|
//Imagestring($im, 2, 200,$yEnd + 40, $title, $text_color);
|
|
|
|
//坐标转换函数,将数值转换成坐标
|
|
function getNewXY($pointArr)
|
|
{
|
|
global $xBgn,$yBgn,$xEnd,$yEnd,$maxYNum,$unitXPix;
|
|
$DEBUG=0;
|
|
for($i=0;$i<sizeof($pointArr);$i=$i+2){
|
|
$pointArr[$i] = $xBgn + $pointArr[$i] * $unitXPix;
|
|
if($DEBUG) echo "<br>pointArr[$i]={$pointArr[$i]}";
|
|
$pointArr[$i+1] = $yEnd - round(($yEnd - $yBgn) * ($pointArr[$i+1] / $maxYNum));
|
|
if($DEBUG) echo "<br>pointArr[$i+1]={$pointArr[$i+1]}";
|
|
}
|
|
$pointArr[$i] = $pointArr[$i-2];
|
|
if($DEBUG) echo "<br>pointArr[$i]={$pointArr[$i]}";
|
|
$pointArr[$i+1] = $yEnd-1;
|
|
if($DEBUG) echo "<br>pointArr[$i+1]={$pointArr[$i+1]}";
|
|
return($pointArr);
|
|
}
|
|
|
|
for($i=0;$i<=$monDays[$query_month-1];$i++){
|
|
$pointArr[$i*2] = $i;
|
|
$pointArr[$i*2+1] = $dayCharge[$i];
|
|
}
|
|
//-----开始画图(线或色块),需要修改
|
|
//色块
|
|
/*
|
|
$pointArr=getNewXY($pointArr);
|
|
$pointNum= sizeof($pointArr) / 2;
|
|
$tmpColor=$legendArr[0][2];
|
|
imagefilledpolygon($im, $pointArr, $pointNum, $tmpColor);
|
|
*/
|
|
//线条
|
|
$pointArr=getNewXY($pointArr);
|
|
$pointNum= sizeof($pointArr) / 2;
|
|
$tmpColor=$legendArr[0][2];
|
|
imagepolygon($im, $pointArr, $pointNum, $tmpColor);
|
|
?>
|
|
|
|
<table border="0" width="100%" cellpadding="2" cellspacing="0" bordercolor="#FFFFFF" bordercolordark="#FFFFFF">
|
|
<tr>
|
|
<td width="75%" align="center">
|
|
<b>
|
|
<?php echo "$strMonth call charge statistics";?>
|
|
</b>
|
|
</td>
|
|
<td width="25%"></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<?php
|
|
//-----输出图形文件,请勿修改
|
|
//delete *.png
|
|
$handle=opendir('.');
|
|
while($file=readdir($handle)){
|
|
$retval="";
|
|
$pt=strrpos($file,".");
|
|
if($pt) $retval=substr($file,$pt+1,strlen($file)-$pt);
|
|
if($retval=='png') unlink($file);
|
|
}
|
|
$filename=time().".png";
|
|
if(!$DEBUG){
|
|
ImagePng ($im,"$filename");
|
|
ImageDestroy($im);
|
|
}
|
|
|
|
//-----显示图片
|
|
echo "<body topmargin=\"0\" leftmargin=\"5\">";
|
|
echo "<img src=\"$filename\">";
|
|
echo "</body>";
|
|
?>
|
|
<br><br>
|
|
<!--
|
|
******************************* Draw used charge card statistic graphic *************************
|
|
-->
|
|
|
|
<?php
|
|
$maxYNum=0;
|
|
for ($i=1;$i<=$monDays[$query_month-1];$i++){
|
|
$j = (($i<10)?"0":"").$i;
|
|
for($k=1;$k<=6;$k++){
|
|
${"dayFaceValue".$k."Used"}[$i] = ${"dayFaceValue".$k."Used"}[$j];
|
|
$maxYNum = (${"dayFaceValue".$k."Used"}[$i]>$maxYNum)?${"dayFaceValue".$k."Used"}[$i]:$maxYNum;
|
|
}
|
|
}
|
|
$maxYNum = (floor($maxYNum/8)+1)*8;
|
|
if($DEBUG) echo "maxYNum=$maxYNum<br>";
|
|
for($i=0;$i<6;$i++){
|
|
$faceValue[$i] = "Face value(".${"faceValue".($i+1)}/$moneyPara.")";
|
|
$moneyPara;
|
|
}
|
|
$legendArr=array(
|
|
array($faceValue[0],'0000FF',0),
|
|
array($faceValue[1],'00FF00',0),
|
|
array($faceValue[2],'FF0000',0),
|
|
array($faceValue[3],'7D0000',0),
|
|
array($faceValue[4],'FF00FF',0),
|
|
array($faceValue[5],'eeaa22',0)
|
|
);
|
|
/*
|
|
for($i=0;$i<4;$i++){
|
|
$legendArr[$i*3] = "Face value(".${"faceValue".$i}.")";
|
|
$legendArr[$i*3+1] = "7D7D00";
|
|
$legendArr[$i*3+2] = 0;
|
|
}
|
|
*/
|
|
$title=$strMonth." recharge card statistic.";
|
|
|
|
|
|
//-----图片背景和坐标,标示等基本元素,请勿修改这部分
|
|
$sizex=700;
|
|
$sizey=270;
|
|
$bgcolor=F8F8F8;
|
|
$fgcolor=000000;
|
|
$dayStr=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$i,date("Y")));
|
|
|
|
$im = ImageCreate ($sizex, $sizey);
|
|
|
|
$background_color = ImageColorAllocate ($im, hexdec(substr($bgcolor, 0, 2)), hexdec(substr($bgcolor, 2, 2)),hexdec(substr($bgcolor, 4, 2)));
|
|
|
|
$text_color = ImageColorAllocate ($im, hexdec(substr($fgcolor, 0, 2)), hexdec(substr($fgcolor, 2, 2)),hexdec(substr($fgcolor, 4, 2)));
|
|
|
|
//背景
|
|
ImageFilledRectangle($im,0,0,$sizex,$sizey,ImageColorAllocate ($im, 198, 198, 198));
|
|
ImageFilledRectangle($im,2,2,$sizex,$sizey,ImageColorAllocate ($im, 130, 130, 130));
|
|
$pointArr=array(0,$sizey-1,3,$sizey-4,4,$sizey-1);
|
|
Imagefilledpolygon($im, $pointArr, 3, ImageColorAllocate ($im, 130, 130, 130));
|
|
$pointArr=array($sizex-1,0,$sizex-4,3,$sizex,4);
|
|
Imagefilledpolygon($im, $pointArr, 3, ImageColorAllocate ($im, 130, 130, 130));
|
|
ImageFilledRectangle($im,2,2,$sizex-3,$sizey-3,$background_color);
|
|
|
|
//边框
|
|
$xBgn=75;
|
|
$yBgn=15;
|
|
$xEnd=540;
|
|
$yEnd=215;
|
|
$unitXPix=15;
|
|
ImageLine($im, $xBgn, $yBgn, $xBgn, $yEnd, $text_color);
|
|
ImageLine($im, $xBgn, $yBgn, $xEnd, $yBgn, $text_color);
|
|
ImageLine($im, $xBgn, $yEnd, $xEnd, $yEnd, $text_color);
|
|
ImageLine($im, $xEnd, $yBgn, $xEnd, $yEnd, $text_color);
|
|
|
|
//竖网格及标注
|
|
for($i=0;$i<=$monDays[$query_month-1];$i++){
|
|
ImageDashedLine($im, $xBgn + $i*15, $yBgn, $xBgn + $i*15, $yEnd, $text_color);
|
|
if($i % 2 == 0){
|
|
Imagestring($im, 2, $xBgn + $i*15 - 4, $yEnd, "$i", $text_color);
|
|
}
|
|
}
|
|
|
|
//横网格及标注
|
|
for($i=0;$i<8;$i++){
|
|
ImageDashedLine($im, $xBgn, $yBgn + $i*25, $xEnd, $yBgn + $i*25, $text_color);
|
|
/*
|
|
$yRemark=$maxYNum / 8 * (8 - $i);
|
|
Imagestring($im, 2, $xBgn - 50, $yBgn + $i*25 - 5, "$yRemark", $text_color);
|
|
*/
|
|
$scale=$maxYNum / 8 * (8 - $i);
|
|
if($scale>1000*1000){
|
|
$displayMaxData = round($scale/100000)/10;
|
|
$displayMaxData = $displayMaxData."M";
|
|
}elseif($scale>1000){
|
|
$displayMaxData = round($scale/100)/10;
|
|
$displayMaxData = $displayMaxData."K";
|
|
}else
|
|
$displayMaxData = $scale;
|
|
|
|
Imagestring($im, 2, $xBgn - 50, $yBgn + $i*25 - 5, "$displayMaxData", $text_color);
|
|
}
|
|
|
|
//色块图标及说明
|
|
for($i=0;$i<sizeof($legendArr);$i++){
|
|
$tmpName=$legendArr[$i][0];
|
|
$tmpColor=$legendArr[$i][1];
|
|
$color = ImageColorAllocate ($im, hexdec(substr($tmpColor, 0, 2)), hexdec(substr($tmpColor, 2, 2)),hexdec(substr($tmpColor, 4, 2)));
|
|
$legendArr[$i][2]=$color;
|
|
ImageFilledRectangle($im,32 + $i* 110,$yEnd + 22,30 + $i* 110 + 10,$yEnd + 30,$legendArr[$i][2]);
|
|
Imagestring($im, 2, 45 + $i* 110,$yEnd + 20, "$tmpName", $text_color);
|
|
}
|
|
|
|
//下部图表名称
|
|
//Imagestring($im, 2, 200,$yEnd + 40, $title, $text_color);
|
|
|
|
//face value 1
|
|
for($i=0;$i<=$monDays[$query_month-1];$i++){
|
|
$pointArr1[$i*2] = $i;
|
|
$pointArr1[$i*2+1] = $dayFaceValue1Used[$i];
|
|
//echo "dayFaceValue1Used[$i]=$dayFaceValue1Used[$i]<br>";
|
|
}
|
|
//线条
|
|
$pointArr1=getNewXY($pointArr1);
|
|
$pointNum1= sizeof($pointArr1) / 2;
|
|
$tmpColor1=$legendArr[0][2];
|
|
imagepolygon($im, $pointArr1, $pointNum1, $tmpColor1);
|
|
|
|
//face value 2
|
|
for($i=0;$i<=$monDays[$query_month-1];$i++){
|
|
$pointArr2[$i*2] = $i;
|
|
$pointArr2[$i*2+1] = $dayFaceValue2Used[$i];
|
|
//echo "dayFaceValue2Used[$i]=$dayFaceValue2Used[$i]<br>";
|
|
}
|
|
//线条
|
|
$pointArr2=getNewXY($pointArr2);
|
|
$pointNum2= sizeof($pointArr2) / 2;
|
|
$tmpColor2=$legendArr[1][2];
|
|
imagepolygon($im, $pointArr2, $pointNum2, $tmpColor2);
|
|
|
|
//face value 3
|
|
for($i=0;$i<=$monDays[$query_month-1];$i++){
|
|
$pointArr3[$i*2] = $i;
|
|
$pointArr3[$i*2+1] = $dayFaceValue3Used[$i];
|
|
//echo "dayFaceValue3Used[$i]=$dayFaceValue3Used[$i]<br>";
|
|
}
|
|
//线条
|
|
$pointArr3=getNewXY($pointArr3);
|
|
$pointNum3= sizeof($pointArr3) / 2;
|
|
$tmpColor3=$legendArr[2][2];
|
|
imagepolygon($im, $pointArr3, $pointNum3, $tmpColor3);
|
|
|
|
//face value 4
|
|
for($i=0;$i<=$monDays[$query_month-1];$i++){
|
|
$pointArr4[$i*2] = $i;
|
|
$pointArr4[$i*2+1] = $dayFaceValue4Used[$i];
|
|
//echo "dayFaceValue4Used[$i]=$dayFaceValue4Used[$i]<br>";
|
|
}
|
|
//线条
|
|
$pointArr4=getNewXY($pointArr4);
|
|
$pointNum4= sizeof($pointArr4) / 2;
|
|
$tmpColor4=$legendArr[3][2];
|
|
imagepolygon($im, $pointArr4, $pointNum4, $tmpColor4);
|
|
|
|
//face value 5
|
|
for($i=0;$i<=$monDays[$query_month-1];$i++){
|
|
$pointArr5[$i*2] = $i;
|
|
$pointArr5[$i*2+1] = $dayFaceValue5Used[$i];
|
|
//echo "dayFaceValue4Used[$i]=$dayFaceValue4Used[$i]<br>";
|
|
}
|
|
//线条
|
|
$pointArr5=getNewXY($pointArr5);
|
|
$pointNum5= sizeof($pointArr5) / 2;
|
|
$tmpColor5=$legendArr[4][2];
|
|
imagepolygon($im, $pointArr5, $pointNum5, $tmpColor5);
|
|
|
|
//face value 6
|
|
for($i=0;$i<=$monDays[$query_month-1];$i++){
|
|
$pointArr6[$i*2] = $i;
|
|
$pointArr6[$i*2+1] = $dayFaceValue6Used[$i];
|
|
//echo "dayFaceValue6Used[$i]=$dayFaceValue6Used[$i]<br>";
|
|
}
|
|
//线条
|
|
$pointArr6=getNewXY($pointArr6);
|
|
$pointNum6= sizeof($pointArr6) / 2;
|
|
$tmpColor6=$legendArr[5][2];
|
|
imagepolygon($im, $pointArr6, $pointNum6, $tmpColor6);
|
|
?>
|
|
|
|
<table border="0" width="100%" cellpadding="2" cellspacing="0" bordercolor="#FFFFFF" bordercolordark="#FFFFFF">
|
|
<tr>
|
|
<td width="75%" align="center">
|
|
<b>
|
|
<?php echo "$strMonth recharge card statistics";?>
|
|
</b>
|
|
</td>
|
|
<td width="25%"></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<?php
|
|
//-----输出图形文件,请勿修改
|
|
//delete *.png
|
|
$filename1=time()."1.png";
|
|
if(!$DEBUG){
|
|
ImagePng ($im,"$filename1");
|
|
ImageDestroy($im);
|
|
}
|
|
|
|
//-----显示图片
|
|
echo "<body topmargin=\"0\" leftmargin=\"5\">";
|
|
echo "<img src=\"$filename1\">";
|
|
echo "</body>";
|
|
?>
|
|
<br><br>
|
|
|
|
<!--
|
|
*************** 画月收费统计图 **********************
|
|
-->
|
|
<table border="0" width="100%" cellpadding="2" cellspacing="0" bordercolor="#FFFFFF" bordercolordark="#FFFFFF">
|
|
<tr>
|
|
<td width="75%" align="center">
|
|
<b>
|
|
<?php echo "$query_year call charge statistics";?>
|
|
</b>
|
|
</td>
|
|
<td width="25%"></td>
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
<?php
|
|
$height=300;
|
|
$width=550;
|
|
$jc=$height/100;
|
|
$font=3;
|
|
$fontwidth= imagefontwidth ($font);
|
|
$fontheight=imagefontheight($font);
|
|
$dot=6;
|
|
|
|
$maxData=0;
|
|
for($i=1;$i<=12;$i++){
|
|
$data[$i-1] = $monCharge[$i]/$moneyPara;
|
|
$maxData = ($data[$i-1]>$maxData)?$data[$i-1]:$maxData;
|
|
$label[$i-1] = date("M",mktime(0,0,0,$i,1,$query_year));
|
|
if($DEBUG) echo "maxData=$maxData<br>";
|
|
if($DEBUG) echo "data[$i-1]=${data[$i-1]}, label[$i-1]=${label[$i-1]}<br>";
|
|
}
|
|
$maxData = (floor($maxData/1000)+1)*1000;
|
|
$image= imagecreate ($width,$height+20);
|
|
$bg=imagecolorallocate($image,0xff,0xff,0xff);
|
|
#$point= imagecolorallocate($image,0xff,0xff,0xff);
|
|
$line=imagecolorallocate($image,0x7d,0x00,0x00);
|
|
$lineFrame=imagecolorallocate($image,0xbb,0xbb,0xbb);
|
|
$text=imagecolorallocate($image,0x00,0x00,0x00);
|
|
$dotcolor=imagecolorallocate($image,0x7d,0x00,0x00);
|
|
imageline ($image,50,0,50,$height,$lineFrame);
|
|
imageline($image,50,$height,$width,$height,$lineFrame);
|
|
for ($i=1;$i<11;$i++)
|
|
{
|
|
imagedashedline($image,50,$height - $jc*$i*10 ,$width ,$height -$jc*$i*10 ,$lineFrame );
|
|
// imagestring ($image,$font,0,$height-$jc*$i*10,$maxData/10*$i,$text);
|
|
|
|
$scale = $maxData/10*$i;
|
|
if($scale>1000*1000){
|
|
$displayMaxData = round($scale/100000)/10;
|
|
$displayMaxData = $displayMaxData."M";
|
|
}elseif($scale>1000){
|
|
$displayMaxData = round($scale/100)/10;
|
|
$displayMaxData = $displayMaxData."K";
|
|
}else
|
|
$displayMaxData = $scale;
|
|
|
|
imagestring ($image,$font,0,$height-$jc*$i*10,$displayMaxData,$text);
|
|
}
|
|
for ($i=0;$i<count($data);$i++)
|
|
{
|
|
$tmp=round($data [$i]/$maxData*10000)/100;
|
|
#echo $tmp."<BR>";
|
|
$x1=(($width-50)/count($data))*($i)+40+10;
|
|
#echo $x1 ."<BR>";
|
|
$y1=$height-$tmp*$jc;
|
|
$x2=$x1;
|
|
$y2=$y1+$tmp*$jc;
|
|
#echo $y1."<BR>";
|
|
// imagestring($image,$font,$x1,$y1-2*$fontheight,$tmp."%(".$data[$i].")",$text);
|
|
if($data[$i]>1000*1000){
|
|
$displayData[$i] = round($data[$i]/100000)/10;
|
|
$displayData[$i] = $displayData[$i]."M";
|
|
}elseif($data[$i]>1000){
|
|
$displayData[$i] = round($data[$i]/100)/10;
|
|
$displayData[$i] = $displayData[$i]."K";
|
|
}
|
|
else
|
|
$displayData[$i] = $data[$i];
|
|
|
|
imagestring($image,$font,$x1+$dot,$y1-2*$dot,$displayData[$i],$text);
|
|
imagearc ($image,$x1 ,$y1,$dot,$dot,0,360,$dotcolor);
|
|
imagefilltoborder ($image,$x1,$y1,$dotcolor,$dotcolor);
|
|
imagestring ($image,$font,$x1,$y2,$label[$i],$text);
|
|
if ($i>0)
|
|
{
|
|
imageline($image,$tmpx1,$tmpy1,$x1,$y1,$line);
|
|
}
|
|
$tmpx1=$x1;$tmpy1=$y1;
|
|
}
|
|
$filename2=time()."2.png";
|
|
ImagePng ($image,$filename2);
|
|
ImageDestroy($image);
|
|
|
|
//display the picture
|
|
echo "<body topmargin=\"0\" leftmargin=\"5\">";
|
|
echo "<table";
|
|
echo "<td width=\"100%\" align=\"center\">";
|
|
echo "<img src=\"$filename2\">";
|
|
echo "</td>";
|
|
echo "</table>";
|
|
echo "</body>";
|
|
?>
|
|
|
|
<br><br>
|
|
|
|
<!--
|
|
*************** 画月充值卡统计图 **********************
|
|
-->
|
|
<table border="0" width="100%" cellpadding="2" cellspacing="0" bordercolor="#FFFFFF" bordercolordark="#FFFFFF">
|
|
<tr>
|
|
<td width="75%" align="center">
|
|
<b>
|
|
<?php echo "$query_year recharge card statistics";?>
|
|
</b>
|
|
</td>
|
|
<td width="25%"></td>
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
<?php
|
|
$height=300;
|
|
$yEnd = 300;
|
|
$width=550;
|
|
$jc=$height/100;
|
|
$font=3;
|
|
$fontwidth= imagefontwidth ($font);
|
|
$fontheight=imagefontheight($font);
|
|
$dot=6;
|
|
|
|
$maxData=0;
|
|
for($i=1;$i<=12;$i++){
|
|
$data1[$i-1] = $monFaceValue1Used[$i];
|
|
$data2[$i-1] = $monFaceValue2Used[$i];
|
|
$data3[$i-1] = $monFaceValue3Used[$i];
|
|
$data4[$i-1] = $monFaceValue4Used[$i];
|
|
$data5[$i-1] = $monFaceValue5Used[$i];
|
|
$data6[$i-1] = $monFaceValue6Used[$i];
|
|
$maxData = ($data1[$i-1]>$maxData)?$data1[$i-1]:$maxData;
|
|
$maxData = ($data2[$i-1]>$maxData)?$data2[$i-1]:$maxData;
|
|
$maxData = ($data3[$i-1]>$maxData)?$data3[$i-1]:$maxData;
|
|
$maxData = ($data4[$i-1]>$maxData)?$data4[$i-1]:$maxData;
|
|
$maxData = ($data5[$i-1]>$maxData)?$data5[$i-1]:$maxData;
|
|
$maxData = ($data6[$i-1]>$maxData)?$data6[$i-1]:$maxData;
|
|
$label[$i-1] = date("M",mktime(0,0,0,$i,1,$query_year));
|
|
if($DEBUG) echo "maxData=$maxData<br>";
|
|
if($DEBUG) echo "data1[$i-1]=${data1[$i-1]}, label[$i-1]=${label[$i-1]}<br>";
|
|
}
|
|
$maxData = (floor($maxData/10)+1)*10;
|
|
$image= imagecreate ($width,$height+20);
|
|
$bg=imagecolorallocate($image,0xff,0xff,0xff);
|
|
#$point= imagecolorallocate($image,0xff,0xff,0xff);
|
|
$line1=imagecolorallocate($image,0x00,0x00,0xFF);
|
|
$line2=imagecolorallocate($image,0x00,0xFF,0x00);
|
|
$line3=imagecolorallocate($image,0xFF,0x00,0x00);
|
|
$line4=imagecolorallocate($image,0x7d,0x00,0x00);
|
|
$line5=imagecolorallocate($image,0xFF,0x00,0xFF);
|
|
$line6=imagecolorallocate($image,0xee,0xaa,0x22);
|
|
|
|
$lineFrame=imagecolorallocate($image,0xbb,0xbb,0xbb);
|
|
$text=imagecolorallocate($image,0x00,0x00,0x00);
|
|
$dotcolor1=imagecolorallocate($image,0x00,0x00,0xFF);
|
|
$dotcolor2=imagecolorallocate($image,0x00,0xFF,0x00);
|
|
$dotcolor3=imagecolorallocate($image,0xFF,0x00,0x00);
|
|
$dotcolor4=imagecolorallocate($image,0x7d,0x00,0x00);
|
|
$dotcolor5=imagecolorallocate($image,0xFF,0x00,0xFF);
|
|
$dotcolor6=imagecolorallocate($image,0xee,0xaa,0x22);
|
|
imageline ($image,50,0,50,$height,$lineFrame);
|
|
imageline($image,50,$height,$width,$height,$lineFrame);
|
|
for ($i=1;$i<11;$i++)
|
|
{
|
|
imagedashedline($image,50,$height - $jc*$i*10 ,$width ,$height -$jc*$i*10 ,$lineFrame );
|
|
// imagestring ($image,$font,0,$height-$jc*$i*10,$maxData/10*$i,$text);
|
|
|
|
$scale = $maxData/10*$i;
|
|
if($scale>1000*1000){
|
|
$displayMaxData = round($scale/100000)/10;
|
|
$displayMaxData = $displayMaxData."M";
|
|
}elseif($scale>1000){
|
|
$displayMaxData = round($scale/100)/10;
|
|
$displayMaxData = $displayMaxData."K";
|
|
}else
|
|
$displayMaxData = $scale;
|
|
|
|
imagestring ($image,$font,0,$height-$jc*$i*10,$displayMaxData,$text);
|
|
}
|
|
//face value 1
|
|
for ($i=0;$i<count($data1);$i++)
|
|
{
|
|
$tmp=round($data1[$i]/$maxData*10000)/100;
|
|
#echo $tmp."<BR>";
|
|
$x1=(($width-50)/count($data1))*($i)+40+10;
|
|
#echo $x1 ."<BR>";
|
|
$y1=$height-$tmp*$jc;
|
|
$x2=$x1;
|
|
$y2=$y1+$tmp*$jc;
|
|
#echo $y1."<BR>";
|
|
|
|
if($data1[$i]>1000*1000){
|
|
$displayData1[$i] = round($data1[$i]/100000);
|
|
$displayData1[$i] = $displayData1[$i]/10;
|
|
$displayData1[$i] = $displayData1[$i]."M";
|
|
}elseif($data1[$i]>1000){
|
|
$displayData1[$i] = round($data1[$i]/100);
|
|
$displayData1[$i] = $displayData1[$i]/10;
|
|
$displayData1[$i] = $displayData1[$i]."K";
|
|
}
|
|
else
|
|
$displayData1[$i] = $data1[$i];
|
|
//imagestring($image,$font,$x1,$y1-2*$fontheight,$data1[$i],$text);
|
|
imagestring($image,$font,$x1+$dot,$y1-$dot,$displayData1[$i],$text);
|
|
imagearc ($image,$x1 ,$y1,$dot,$dot,0,360,$dotcolor1);
|
|
imagefilltoborder ($image,$x1,$y1,$dotcolor1,$dotcolor1);
|
|
imagestring ($image,$font,$x1,$y2,$label[$i],$text);
|
|
if ($i>0)
|
|
{
|
|
imageline($image,$tmpx1,$tmpy1,$x1,$y1,$line1);
|
|
}
|
|
$tmpx1=$x1;$tmpy1=$y1;
|
|
}
|
|
//face value 2
|
|
for ($i=0;$i<count($data2);$i++)
|
|
{
|
|
$tmp=round($data2[$i]/$maxData*10000)/100;
|
|
#echo $tmp."<BR>";
|
|
$x1=(($width-50)/count($data2))*($i)+40+10;
|
|
#echo $x1 ."<BR>";
|
|
$y1=$height-$tmp*$jc;
|
|
$x2=$x1;
|
|
$y2=$y1+$tmp*$jc;
|
|
#echo $y1."<BR>";
|
|
|
|
if($data2[$i]>1000*1000){
|
|
$displayData2[$i] = round($data2[$i]/100000);
|
|
$displayData2[$i] = $displayData2[$i]/10;
|
|
$displayData2[$i] = $displayData2[$i]."M";
|
|
}elseif($data2[$i]>1000){
|
|
$displayData2[$i] = round($data2[$i]/100);
|
|
$displayData2[$i] = $displayData2[$i]/10;
|
|
$displayData2[$i] = $displayData2[$i]."K";
|
|
}
|
|
else
|
|
$displayData2[$i] = $data2[$i];
|
|
//imagestring($image,$font,$x1,$y1-2*$fontheight,$data2[$i],$text);
|
|
imagestring($image,$font,$x1+$dot,$y1-$dot,$displayData2[$i],$text);
|
|
imagearc ($image,$x1 ,$y1,$dot,$dot,0,360,$dotcolor2);
|
|
imagefilltoborder ($image,$x1,$y1,$dotcolor2,$dotcolor2);
|
|
imagestring ($image,$font,$x1,$y2,$label[$i],$text);
|
|
if ($i>0)
|
|
{
|
|
imageline($image,$tmpx1,$tmpy1,$x1,$y1,$line2);
|
|
}
|
|
$tmpx1=$x1;$tmpy1=$y1;
|
|
}
|
|
//face value 3
|
|
for ($i=0;$i<count($data3);$i++)
|
|
{
|
|
$tmp=round($data3[$i]/$maxData*10000)/100;
|
|
#echo $tmp."<BR>";
|
|
$x1=(($width-50)/count($data3))*($i)+40+10;
|
|
#echo $x1 ."<BR>";
|
|
$y1=$height-$tmp*$jc;
|
|
$x2=$x1;
|
|
$y2=$y1+$tmp*$jc;
|
|
#echo $y1."<BR>";
|
|
|
|
if($data3[$i]>1000*1000){
|
|
$displayData3[$i] = round($data3[$i]/100000);
|
|
$displayData3[$i] = $displayData3[$i]/10;
|
|
$displayData3[$i] = $displayData3[$i]."M";
|
|
}elseif($data3[$i]>1000){
|
|
$displayData3[$i] = round($data3[$i]/100);
|
|
$displayData3[$i] = $displayData3[$i]/10;
|
|
$displayData3[$i] = $displayData3[$i]."K";
|
|
}
|
|
else
|
|
$displayData3[$i] = $data3[$i];
|
|
//imagestring($image,$font,$x1,$y1-2*$fontheight,$data3[$i],$text);
|
|
imagestring($image,$font,$x1+$dot,$y1-$dot,$displayData3[$i],$text);
|
|
imagearc ($image,$x1 ,$y1,$dot,$dot,0,360,$dotcolor3);
|
|
imagefilltoborder ($image,$x1,$y1,$dotcolor3,$dotcolor3);
|
|
imagestring ($image,$font,$x1,$y2,$label[$i],$text);
|
|
if ($i>0)
|
|
{
|
|
imageline($image,$tmpx1,$tmpy1,$x1,$y1,$line3);
|
|
}
|
|
$tmpx1=$x1;$tmpy1=$y1;
|
|
}
|
|
//face value 4
|
|
for ($i=0;$i<count($data4);$i++)
|
|
{
|
|
$tmp=round($data4[$i]/$maxData*10000)/100;
|
|
#echo $tmp."<BR>";
|
|
$x1=(($width-50)/count($data4))*($i)+40+10;
|
|
#echo $x1 ."<BR>";
|
|
$y1=$height-$tmp*$jc;
|
|
$x2=$x1;
|
|
$y2=$y1+$tmp*$jc;
|
|
#echo $y1."<BR>";
|
|
|
|
if($data4[$i]>1000*1000){
|
|
$displayData4[$i] = round($data4[$i]/100000);
|
|
$displayData4[$i] = $displayData4[$i]/10;
|
|
$displayData4[$i] = $displayData4[$i]."M";
|
|
}elseif($data4[$i]>1000){
|
|
$displayData4[$i] = round($data4[$i]/100);
|
|
$displayData4[$i] = $displayData4[$i]/10;
|
|
$displayData4[$i] = $displayData4[$i]."K";
|
|
}
|
|
else
|
|
$displayData4[$i] = $data4[$i];
|
|
//imagestring($image,$font,$x1,$y1-2*$fontheight,$data4[$i],$text);
|
|
imagestring($image,$font,$x1+$dot,$y1-$dot,$displayData4[$i],$text);
|
|
imagearc ($image,$x1 ,$y1,$dot,$dot,0,360,$dotcolor4);
|
|
imagefilltoborder ($image,$x1,$y1,$dotcolor4,$dotcolor4);
|
|
imagestring ($image,$font,$x1,$y2,$label[$i],$text);
|
|
if ($i>0)
|
|
{
|
|
imageline($image,$tmpx1,$tmpy1,$x1,$y1,$line4);
|
|
}
|
|
$tmpx1=$x1;$tmpy1=$y1;
|
|
}
|
|
|
|
//face value 5
|
|
for ($i=0;$i<count($data5);$i++)
|
|
{
|
|
$tmp=round($data5[$i]/$maxData*10000)/100;
|
|
#echo $tmp."<BR>";
|
|
$x1=(($width-50)/count($data5))*($i)+40+10;
|
|
#echo $x1 ."<BR>";
|
|
$y1=$height-$tmp*$jc;
|
|
$x2=$x1;
|
|
$y2=$y1+$tmp*$jc;
|
|
#echo $y1."<BR>";
|
|
|
|
if($data5[$i]>1000*1000){
|
|
$displayData5[$i] = round($data5[$i]/100000);
|
|
$displayData5[$i] = $displayData5[$i]/10;
|
|
$displayData5[$i] = $displayData5[$i]."M";
|
|
}elseif($data5[$i]>1000){
|
|
$displayData5[$i] = round($data5[$i]/100);
|
|
$displayData5[$i] = $displayData5[$i]/10;
|
|
$displayData5[$i] = $displayData5[$i]."K";
|
|
}
|
|
else
|
|
$displayData5[$i] = $data5[$i];
|
|
//imagestring($image,$font,$x1,$y1-2*$fontheight,$data4[$i],$text);
|
|
imagestring($image,$font,$x1+$dot,$y1-$dot,$displayData5[$i],$text);
|
|
imagearc ($image,$x1 ,$y1,$dot,$dot,0,360,$dotcolor5);
|
|
imagefilltoborder ($image,$x1,$y1,$dotcolor5,$dotcolor5);
|
|
imagestring ($image,$font,$x1,$y2,$label[$i],$text);
|
|
if ($i>0)
|
|
{
|
|
imageline($image,$tmpx1,$tmpy1,$x1,$y1,$line5);
|
|
}
|
|
$tmpx1=$x1;$tmpy1=$y1;
|
|
}
|
|
|
|
//face value 6
|
|
for ($i=0;$i<count($data6);$i++)
|
|
{
|
|
$tmp=round($data6[$i]/$maxData*10000)/100;
|
|
#echo $tmp."<BR>";
|
|
$x1=(($width-50)/count($data6))*($i)+40+10;
|
|
#echo $x1 ."<BR>";
|
|
$y1=$height-$tmp*$jc;
|
|
$x2=$x1;
|
|
$y2=$y1+$tmp*$jc;
|
|
#echo $y1."<BR>";
|
|
|
|
if($data6[$i]>1000*1000){
|
|
$displayData6[$i] = round($data6[$i]/100000);
|
|
$displayData6[$i] = $displayData6[$i]/10;
|
|
$displayData6[$i] = $displayData6[$i]."M";
|
|
}elseif($data6[$i]>1000){
|
|
$displayData6[$i] = round($data6[$i]/100);
|
|
$displayData6[$i] = $displayData6[$i]/10;
|
|
$displayData6[$i] = $displayData6[$i]."K";
|
|
}
|
|
else
|
|
$displayData6[$i] = $data6[$i];
|
|
//imagestring($image,$font,$x1,$y1-2*$fontheight,$data4[$i],$text);
|
|
imagestring($image,$font,$x1+$dot,$y1-$dot,$displayData6[$i],$text);
|
|
imagearc ($image,$x1 ,$y1,$dot,$dot,0,360,$dotcolor6);
|
|
imagefilltoborder ($image,$x1,$y1,$dotcolor6,$dotcolor6);
|
|
imagestring ($image,$font,$x1,$y2,$label[$i],$text);
|
|
if ($i>0)
|
|
{
|
|
imageline($image,$tmpx1,$tmpy1,$x1,$y1,$line6);
|
|
}
|
|
$tmpx1=$x1;$tmpy1=$y1;
|
|
}
|
|
|
|
//色块图标及说明
|
|
for($i=0;$i<sizeof($legendArr);$i++){
|
|
$tmpName=$legendArr[$i][0];
|
|
$tmpColor=$legendArr[$i][1];
|
|
$color = ImageColorAllocate ($image, hexdec(substr($tmpColor, 0, 2)), hexdec(substr($tmpColor, 2, 2)),hexdec(substr($tmpColor, 4, 2)));
|
|
$legendArr[$i][2]=$color;
|
|
ImageFilledRectangle($image,82 + $i* 120,$yEnd + 22,80 + $i* 120 + 10,$yEnd + 30,$legendArr[$i][2]);
|
|
Imagestring($image, 2, 95 + $i* 120,$yEnd + 20, "$tmpName", $text_color);
|
|
}
|
|
|
|
$filename2=time()."3.png";
|
|
ImagePng ($image,$filename2);
|
|
ImageDestroy($image);
|
|
|
|
//display the picture
|
|
echo "<body topmargin=\"0\" leftmargin=\"5\">";
|
|
echo "<table";
|
|
echo "<td width=\"100%\" align=\"center\">";
|
|
echo "<img src=\"$filename2\">";
|
|
echo "</td>";
|
|
echo "</table>";
|
|
echo "</body>";
|
|
?>
|
|
|
|
<p> </p>
|
|
|
|
<table>
|
|
<form name="clock">
|
|
<?php
|
|
echo "<b>$strDailyOperator: </b>";
|
|
echo "$userInfo[ID]";
|
|
echo " ";
|
|
echo "<b>$strDailyPrintTime</b>";
|
|
?>
|
|
<INPUT TYPE="text" id="time" SIZE="22" style="border-left:medium none;border-right:medium none;border-top:medium none;border-bottom:medium none" class="text">
|
|
</form>
|
|
</table>
|
|
<?php
|
|
adjust_content_tail("down");
|
|
?>
|
|
</body>
|
|
</html>
|