Files
web.ems/wxc2_omc/performance/mscCsta/service_general_down.php
agtuser 16a3fd1e1b init
2024-11-11 17:56:00 +08:00

899 lines
30 KiB
PHP
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
require("../../inc/header.inc");
?>
<script language="JavaScript">
function hide_and_show_table1()
{
if(document.all.t1.style.display=="none")
{
document.all.t0.style.display="";
document.all.t1.style.display="";
document.all.t2.style.display="";
document.all.t3.style.display="";
document.all.t4.style.display="";
document.all.flag1.value="Hide";
}
else
{
document.all.t0.style.display="none";
document.all.t1.style.display="none";
document.all.t2.style.display="none";
document.all.t3.style.display="none";
document.all.t4.style.display="none";
document.all.flag1.value="Show";
}
}
function hide_and_show_table2()
{
if(document.all.t5.style.display=="none")
{
document.all.t5.style.display="";
document.all.t6.style.display="";
document.all.t7.style.display="";
document.all.flag2.value="Hide";
}
else
{
document.all.t5.style.display="none";
document.all.t6.style.display="none";
document.all.t7.style.display="none";
document.all.flag2.value="Show";
}
}
function hide_and_show_table3()
{
if(document.all.t8.style.display=="none")
{
document.all.t8.style.display="";
document.all.t9.style.display="";
document.all.t10.style.display="";
document.all.t11.style.display="";
document.all.t12.style.display="";
document.all.flag3.value="Hide";
}
else
{
document.all.t8.style.display="none";
document.all.t9.style.display="none";
document.all.t10.style.display="none";
document.all.t11.style.display="none";
document.all.t12.style.display="none";
document.all.flag3.value="Show";
}
}
</script>
<?php
?>
<?php
//============scroll the page====================
if($scroll_y > 0){
//echo "<body style=\"overflow-x:hidden\" topmargin=\"5\" leftmargin=\"12\" onLoad='self.scrollBy(0,$scroll_y)'>";
echo "<body leftmargin=\"15\" rightmargin=\"10\" onload=\"javascript:scroll_div('$scroll_y');javascript:adjust_frame('down');\" onresize=\"javascript:adjust_frame('down');\" style=\"overflow:hidden;overflow-x:hidden;overflow-y:hidden;\">";
}else{
echo "<body leftmargin=\"15\" rightmargin=\"10\" onload=\"javascript:adjust_frame('down');\" onresize=\"javascript:adjust_frame('down');\" style=\"overflow:hidden;overflow-x:hidden;overflow-y:hidden;\">";
}
adjust_head_frame("down");
adjust_title_head_frame("down");
adjust_title_tail_frame("down");
adjust_content_head_frame("down");
echo "<br>";
//=====================================================================================|
//============================Function Flag============================================|
//=====================================================================================|
$Hide_Show_Function_On=0;
$DEBUG=0;
//=====================================================================================|
//============================Data From Index Page=====================================|
//=====================================================================================|
if(0)
{
$url_temp=$_SERVER["REQUEST_URI"];
echo "This page URL:$url_temp<br>";
echo "sel_date_from:$sel_date_from<br>";
echo "sel_date_to:$sel_date_to<br>";
}
//=====================================================================================|
//============================Define The Data==========================================|
//=====================================================================================|
//data define
for($i=0;$i<12;$i++)
{
for($j=0;$j<9;$j++)
{
/*
0 sub to sub 0 attempt
1 sub to trunk 1 success
2 trunk to sub 2 call deny
3 trunk to trunk 3 network busy
4 interconnection 4 caller clear
5 sub to IP 5 subscriber busy
6 trunk to IP 6 no answer
7 mobile originated 7 signal error
8 mobile terminated 8 duration
9 in trunk
10 out trunk
11 IP terminated
*/
$service_csta[$i][$j]=0;
}
}
//===================================================================================|
//========================Get The Data From DB=======================================|
//===================================================================================|
$db=$csta_db;
$bgn_time=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")));
$end_time=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_to,date("Y")));
//get the numbers of days that selected
$slot=$sel_date_from-$sel_date_to+1;
if(0)
{
echo "bgn_time:$bgn_time<br>";
echo "end_time:$end_time<br>";
echo "slot:$slot<br>";
echo "db:$csta_db<br>";
}
$key_type_relation=array(5=>0,6=>1,7=>2,8=>3,9=>4,10=>5,11=>6,12=>7,13=>8,14=>9,15=>10,16=>11);
for($day=0;$day<$slot;$day++)
{
$table_name="mscSum";
$temp=date("d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+$day,date("Y")));
$table_name=$table_name."_".$temp;
//echo "table_name:$table_name<br>";
$from_time=date("Y-m-d H:i:s",mktime(0,0,0,date("m"),date("d")-$sel_date_from+$day,date("Y")));
$to_time=date("Y-m-d H:i:s",mktime(23,0,0,date("m"),date("d")-$sel_date_from+$day,date("Y")));
//echo "from:$from_time--to:$to_time<br>";
$select="select key_type,sum(Attempt) as attempt,sum(Success) as success,sum(CallDeny) as call_deny,sum(NetBusy) as network_busy,sum(CallerClear) as caller_clear,sum(SubBusy) as subscriber_busy,sum(NoAnswer) as no_answer,sum(SignalErr) as signal_error,sum(Duration) as duration ";
$from="from $table_name ";
$service_where="and key_type>4 and key_type<17 ";
$where="where csta_datetime >='$from_time' and csta_datetime <'$to_time' ".$service_where;
$group="group by key_type ";
$order="order by key_type ";
$sql=$select.$from.$where.$group.$order;
//echo "$sql<br>";
$result=@mysqli_query($pubConn,$sql);
$rows=@mysqli_fetch_array($result);
if(!$rows)
continue;
do{
$key_type=$rows[key_type];
$index=$key_type_relation[$key_type]+0;
for($tt=0;$tt<9;$tt++)
{
$service_csta[$index][$tt]+=$rows[$tt+1];
//echo "type-$service_type-$tt:{$service_csta[$service_type][$tt]}<br>";
}
}while($rows=mysqli_fetch_array($result));
}
//get the 0-hour of the day
for($day=0;$day<$slot;$day++)
{
$table_name="mscSum";
$temp=date("d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+$day-1,date("Y")));
$table_name=$table_name."_".$temp;
//echo "table_name:$table_name<br>";
$from_time=date("Y-m-d H:i:s",mktime(23,0,0,date("m"),date("d")-$sel_date_from+$day-1,date("Y")));
$to_time=date("Y-m-d H:i:s",mktime(0,0,0,date("m"),date("d")-$sel_date_from+$day,date("Y")));
//echo "from:$from_time--to:$to_time<br>";
$select="select key_type,sum(Attempt) as attempt,sum(Success) as success,sum(CallDeny) as call_deny,sum(NetBusy) as network_busy,sum(CallerClear) as caller_clear,sum(SubBusy) as subscriber_busy,sum(NoAnswer) as no_answer,sum(SignalErr) as signal_error,sum(Duration) as duration ";
$from="from $table_name ";
$service_where="and key_type>4 and key_type<17 ";
$where="where csta_datetime >='$from_time' and csta_datetime <'$to_time' ".$service_where;
$group="group by key_type ";
$order="order by key_type ";
$sql=$select.$from.$where.$group.$order;
//echo "$sql<br>";
$result=@mysqli_query($pubConn,$sql);
$rows=@mysqli_fetch_array($result);
if(!$rows)
continue;
do{
$key_type=$rows[key_type];
$index=$key_type_relation[$key_type]+0;
for($tt=0;$tt<9;$tt++)
{
$service_csta[$index][$tt]+=$rows[$tt+1];
//echo "type-$service_type-$tt:{$service_csta[$service_type][$tt]}<br>";
}
}while($rows=mysqli_fetch_array($result));
}
//===================================================================================|
//==========================Fake Data for Test=======================================|
//===================================================================================|
if($DEBUG)
{
for($i=0;$i<12;$i++)
{
for($j=0;$j<9;$j++)
{
if($j==0)
$service_csta[$i][$j]=rand(200,400);
else if($j==1)
$service_csta[$i][$j]=rand(100,200);
else
$service_csta[$i][$j]=rand(0,100);
}
}
}
//===================================================================================|
//=========================Test The Data=============================================|
//===================================================================================|
if(0)
{
for($i=0;$i<12;$i++)
{
for($j=0;$j<9;$j++)
{
echo "type-$i-$j:{$service_csta[$i][$j]}<br>";
}
}
}
//===================================================================================|
//=======================Show The Table-1============================================|
//===================================================================================|
//===table title
if($slot==1)
$table_title="Service statistic Date:".$bgn_time;
else
$table_title="Service statistic Date:".$bgn_time." to ".$end_time;
echo "<center><b>$table_title</b></center>";
echo "<table border=\"1\" width=\"100%\" cellpadding=\"2\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\" bgcolor=\"#FFFFFF\">";
echo "<tr bgcolor=\"#E6E6E6\">";
echo "<td align=\"center\" width=\"13%\">Type</td>";
echo "<td align=\"center\" width=\"8%\">Attempt</td>";
echo "<td align=\"center\" width=\"8%\">Success</td>";
echo "<td align=\"center\" width=\"8%\"><nobr>Call Deny</td>";
echo "<td align=\"center\" width=\"8%\"><nobr>Net Busy</td>";
echo "<td align=\"center\" width=\"8%\">Caller clear</td>";
echo "<td align=\"center\" width=\"8%\">Sub Busy</td>";
echo "<td align=\"center\" width=\"8%\">No Answer</td>";
echo "<td align=\"center\" width=\"8%\">Signal Error</td>";
echo "<td align=\"center\" width=\"10%\">Total call duration</td>";
echo "<td align=\"center\" width=\"13%\">Average call duration(s)</td>";
echo "</tr>";
$service_type_label=array("Subs to subs","Subs to trunk","Trunk to subs","Trunk to trunk","Intraconnection","Subs to IP","Trunk to IP","Mobile originated","Mobile terminated","In trunk","Out trunk","IP terminated");
//========show subs to subs,subs to local,subs to toll,trunk to subs,trunk to trunk==========
for($i=0;$i<12;$i++)
{
if($i==5||$i==7)
{
echo "<tr id=\"t$i\">";
echo "<td colspan=11>&nbsp</td>";
echo "</tr>";
}
echo "<tr id=\"t$i\">";
echo "<td align=\"center\"><a target=\"_parent\" href=\"../../performance/mscCsta/service_detail_index.php?on_top_index=0&service_type=$i&sel_date_from=$sel_date_from&sel_date_to=$sel_date_to\">$service_type_label[$i]</a></td>";
for($j=0;$j<9;$j++)
{
echo "<td align=\"center\">";
if($j==8)
{
echo "{$service_csta[$i][$j]}(s)";
$hour=floor($service_csta[$i][$j]/3600);
$minute=floor($service_csta[$i][$j]%3600/60);
$second=$service_csta[$i][$j]%60;
if($hour==0&&$minute==0&&$second==0)
echo "<br>";
else
echo "<br>$hour:$minute:$second";
}
else
echo "{$service_csta[$i][$j]}";
if($j>0&&$j<8)
{
if($service_csta[$i][0]==0)
$rate=0;
else
{
$rate=$service_csta[$i][$j]/$service_csta[$i][0];
$rate=$rate*100;
if($rate!=0&&$rate!=100)
$rate=number_format($rate, 2, '.', '');
}
echo "<br>$rate%";
}
echo "</td>";
}
echo "<td align=\"center\">";
if($service_csta[$i][1]!=0)
$ave=round($service_csta[$i][8]/$service_csta[$i][1]);
else
$ave=0;
echo "$ave";
echo "</td>";
echo "</tr>";
}
echo "</table>";
if($Hide_Show_Function_On==1)
echo "<input type=button id=flag1 value=Hide onClick=\"javascript:hide_and_show_table1()\">";
if($Hide_Show_Function_On==1)
echo "<input type=button id=flag2 value=Hide onClick=\"javascript:hide_and_show_table2()\">";
if($Hide_Show_Function_On==1)
echo "<input type=button id=flag3 value=Hide onClick=\"javascript:hide_and_show_table3()\">";
//=====================================================================================|
//=======================Draw The Graphics-1===========================================|
//=====================================================================================|
echo "<p><b>2.Service(Attempt)</b><br>";
//=====graphics size=======
$sizex=830;
$sizey=250;
$im = ImageCreate ($sizex, $sizey);
$background_color=ImageColorAllocate($im,255,255,255);
$black_color=ImageColorAllocate($im,0,0,0);
$white_color= imagecolorallocate($im, 255, 255, 255);
$bgcolor=F8F8F8;
$fgcolor=000000;
$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)));
//====graphics background=======
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);
imagedashedline($im,30,30,100,100,$black_color);
//======draw the horizonal line========
$style = array($black_color,$black_color,$black_color,$black_color,$black_color,$white_color,$white_color,$white_color,$white_color,$white_color);
imagesetstyle($im, $style);
for($i=10;$i>0;$i--)
{
$x1=40;
$y1=20+(10-$i)*18;
$x2=790;
$y2=$y1;
if($i!=10)
{
imageline($im, $x1,$y1,460,$y2, IMG_COLOR_STYLED);
imageline($im, 490,$y1,$x2,$y2, IMG_COLOR_STYLED);
}
imagestring($im,2,$x1-22,$y2-5,($i*10)."%",$black_color);
imagestring($im,2,$x2+5,$y2-5,($i*10)."%",$black_color);
}
//=======draw the vitical line=======
$u=floor(750/25);
for($i=0;$i<25;$i++)
{
$x1=40+$i*$u;
$y1=20;
$x2=$x1;
$y2=200;
ImageDashedLine($im,$x1,$y1,$x2,$y2,$black_color);
}
//=======get colors============
$color[0]=ImageColorAllocate($im,0x99,0x00,0x33);
$color[1]=ImageColorAllocate($im,0x99,0x00,0xcc);
$color[2]=ImageColorAllocate($im,0x99,0x99,0x00);
$color[3]=ImageColorAllocate($im,0x99,0xcc,0x99);
$color[4]=ImageColorAllocate($im,0x99,0xff,0x33);
$color[5]=ImageColorAllocate($im,0xff,0x99,0x66);
$color[6]=ImageColorAllocate($im,0xff,0x99,0xff);
$color[7]=ImageColorAllocate($im,0xff,0xff,0x00);
$color[8]=ImageColorAllocate($im,0x33,0x3,0x33);
$color[9]=ImageColorAllocate($im,0x00,0xcc,0xff);
$color[10]=ImageColorAllocate($im,0x00,0x66,0xcc);
$color[11]=ImageColorAllocate($im,0x33,0xff,0x99);
//=====get the precent and block height(Part-1)======
$attempt_sum_one=0;
for($i=0;$i<7;$i++)
{
$attempt_sum_one+=$service_csta[$i][0];
}
if($attempt_sum_one==0)
{
//sub to sub precent
$subs_to_subs_attempt_precent="0%";
//sub to trunk precent
$subs_to_trunk_attempt_precent="0%";
//trunk to sub precent
$trunk_to_subs_attempt_precent="0%";
//trunk to trunk precent
$trunk_to_trunk_attempt_precent="0%";
//interconnection precent
$interconnection_attempt_precent="0%";
//subs to IP precent
$subs_to_ip_attempt_precent="0%";
//trunk to IP precent
$trunk_to_ip_attempt_precent="0%";
for($t=0;$t<7;$t++)
$height[$t]=0;
}
else
{
//sub to sub precent
$subs_to_subs_attempt_precent=number_format($service_csta[0][0]*100/$attempt_sum_one,2,'.','')."%";
//sub to trunk precent
$subs_to_trunk_attempt_precent=number_format($service_csta[1][0]*100/$attempt_sum_one,2,'.','')."%";
//trunk to sub precent
$trunk_to_subs_attempt_precent=number_format($service_csta[2][0]*100/$attempt_sum_one,2,'.','')."%";
//trunk to trunk precent
$trunk_to_trunk_attempt_precent=number_format($service_csta[3][0]*100/$attempt_sum_one,2,'.','')."%";
//interconnection precent
$interconnection_attempt_precent=number_format($service_csta[4][0]*100/$attempt_sum_one,2,'.','')."%";
//subs to IP precent
$subs_to_ip_attempt_precent=number_format($service_csta[5][0]*100/$attempt_sum_one,2,'.','')."%";
//trunk to IP precent
$trunk_to_ip_attempt_precent=number_format($service_csta[6][0]*100/$attempt_sum_one,2,'.','')."%";
for($t=0;$t<7;$t++)
$height[$t]=floor(180*$service_csta[$t][0]/$attempt_sum_one);
}
//=====get the precent and block height(Part-2)======
$attempt_sum_tow=0;
for($i=7;$i<12;$i++)
{
$attempt_sum_tow+=$service_csta[$i][0];
}
if($attempt_sum_tow==0)
{
//mobile originated precent
$mobile_originated_attempt_precent="0%";
//mobile terminated precent
$mobile_terminated_attempt_precent="0%";
//in trunk precent
$in_trunk_attempt_precent="0%";
//out_trunk precent
$out_trunk_attempt_precent="0%";
//IP terminated precent
$ip_terminated_attempt_precent="0%";
for($t=7;$t<12;$t++)
$height[$t]=0;
}
else
{
//mobile originated precent
$mobile_originated_attempt_precent=number_format($service_csta[7][0]*100/$attempt_sum_tow,2,'.','')."%";
//mobile terminated precent
$mobile_terminated_attempt_precent=number_format($service_csta[8][0]*100/$attempt_sum_tow,2,'.','')."%";
//in trunk precent
$in_trunk_attempt_precent=number_format($service_csta[9][0]*100/$attempt_sum_tow,2,'.','')."%";
//out_trunk precent
$out_trunk_attempt_precent=number_format($service_csta[10][0]*100/$attempt_sum_tow,2,'.','')."%";
//IP terminated precent
$ip_terminated_attempt_precent=number_format($service_csta[11][0]*100/$attempt_sum_tow,2,'.','')."%";
for($t=7;$t<12;$t++)
$height[$t]=floor(180*$service_csta[$t][0]/$attempt_sum_tow);
}
//======draw the data block======
for($i=0;$i<12;$i++)
{
$x1=40+(2*$i+1)*$u;
if($height[$i]==0)
$height[$i]=1;
$y1=200-$height[$i];
$x2=40+(2*$i+2)*$u;
$y2=199;
imagefilledrectangle($im,$x1,$y1,$x2,$y2,$color[$i]);
}
//======draw the legend string=======
imagestring($im,2,65,205,"SUB SUB",$black_color);
imagestring($im,2,60,220,"(".$subs_to_subs_attempt_precent.")",$black_color);
imagestring($im,2,125,205,"SUB TRK",$black_color);
imagestring($im,2,123,220,"(".$subs_to_trunk_attempt_precent.")",$black_color);
imagestring($im,2,185,205,"TRK SUB",$black_color);
imagestring($im,2,185,220,"(".$trunk_to_subs_attempt_precent.")",$black_color);
imagestring($im,2,245,205,"TRK TRK",$black_color);
imagestring($im,2,243,221,"(".$trunk_to_trunk_attempt_precent.")",$black_color);
imagestring($im,2,310,205,"INTRA",$black_color);
imagestring($im,2,308,221,"(".$interconnection_attempt_precent.")",$black_color);
imagestring($im,2,368,205,"SUB IP",$black_color);
imagestring($im,2,366,221,"(".$subs_to_ip_attempt_precent.")",$black_color);
imagestring($im,2,428,205,"TRK IP",$black_color);
imagestring($im,2,425,221,"(".$trunk_to_ip_attempt_precent.")",$black_color);
imagestring($im,2,500,205,"MO",$black_color);
imagestring($im,2,487,221,"(".$mobile_originated_attempt_precent.")",$black_color);
imagestring($im,2,560,205,"MT",$black_color);
imagestring($im,2,547,221,"(".$mobile_terminated_attempt_precent.")",$black_color);
imagestring($im,2,608,205,"IN TRK",$black_color);
imagestring($im,2,605,221,"(".$in_trunk_attempt_precent.")",$black_color);
imagestring($im,2,668,205,"OUT TRK",$black_color);
imagestring($im,2,667,221,"(".$out_trunk_attempt_precent.")",$black_color);
imagestring($im,2,742,205,"IP",$black_color);
imagestring($im,2,727,221,"(".$ip_terminated_attempt_precent.")",$black_color);
//draw the outline
imageLine($im,40,20,40,200,$black_color);
imageLine($im,40,20,460,20,$black_color);
imageLine($im,460,200,460,20,$black_color);
imageLine($im,40,200,460,200,$black_color);
imageLine($im,490,200,490,20,$black_color);
imageLine($im,490,20,790,20,$black_color);
imageLine($im,790,200,790,20,$black_color);
imageLine($im,490,200,790,200,$black_color);
//======show the service attempt graphics==========
//-----<2D><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>
//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="ser3_".time().".png";
if(1){
ImagePng ($im,"$filename");
ImageDestroy($im);
}
//-----<2D><>ʾͼƬ
echo "<img src=\"$filename\"></img>";
//=======show the remark label========
echo "<table width=\"100%\" border=0>";
echo "<tr>";
echo "<td width=\"34%\"><font color=blue>SUB SUB</font>-> Subscriber to subscriber</td>";
echo "<td width=\"34%\"><font color=blue>TRK TRK</font>-> Trunk to trunk</td>";
echo "<td width=\"33%\"><font color=blue>MO</font>-> Mobile originated</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=\"33%\"><font color=blue>SUB TRK</font>-> Subscriber to trunk</td>";
echo "<td width=\"33%\"><font color=blue>INTRA</font>-> Intraconnection</td>";
echo "<td width=\"33%\"><font color=blue>MT</font>-> Mobile terminated</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=\"33%\"><font color=blue>TRK SUB</font>-> Trunk to subscriber</td>";
echo "<td width=\"33%\"><font color=blue>SUB IP</font>-> Subscriber to IP</td>";
echo "<td width=\"34%\"><font color=blue>IN TRK</font>-> In trunk</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=\"33%\"><font color=blue>TRK IP</font>-> Trunk to IP</td>";
echo "<td width=\"33%\"></td>";
echo "<td width=\"34%\"><font color=blue>OUT TRK</font>-> Out trunk</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=\"33%\"></td>";
echo "<td width=\"33%\"></td>";
echo "<td width=\"33%\"><font color=blue>IP</font>-> IP terminated</td>";
echo "</tr>";
echo "</table>";
//=====================================================================================|
//========================Draw The Graphics-2==========================================|
//=====================================================================================|
//=======draw the Success failure graphics==========
echo "<p><b>3.Success/Failure<br>";
$sizex=830;
$sizey=310;
$image=imagecreate($sizex,$sizey);
$bgcolor=imagecolorallocate($image,255,255,255);
$black_color=ImageColorAllocate($image,0,0,0);
$bgcolor=F8F8F8;
$fgcolor=000000;
$background_color = ImageColorAllocate ($image,
hexdec(substr($bgcolor, 0, 2)),
hexdec(substr($bgcolor, 2, 2)),
hexdec(substr($bgcolor, 4, 2)));
$text_color = ImageColorAllocate ($image,
hexdec(substr($fgcolor, 0, 2)),
hexdec(substr($fgcolor, 2, 2)),
hexdec(substr($fgcolor, 4, 2)));
//=====background========
ImageFilledRectangle($image,0,0,$sizex,$sizey,ImageColorAllocate ($image, 198, 198, 198));
ImageFilledRectangle($image,2,2,$sizex,$sizey,ImageColorAllocate ($image, 130, 130, 130));
$pointArr=array(0,$sizey-1,3,$sizey-4,4,$sizey-1);
Imagefilledpolygon($image, $pointArr, 3, ImageColorAllocate ($image, 130, 130, 130));
$pointArr=array($sizex-1,0,$sizex-4,3,$sizex,4);
Imagefilledpolygon($image, $pointArr, 3, ImageColorAllocate ($image, 130, 130, 130));
ImageFilledRectangle($image,2,2,$sizex-3,$sizey-3,$background_color);
//first
imageLine($image,40,20,40,200,$black_color);
imageLine($image,40,20,400,20,$black_color);
imageLine($image,400,200,400,20,$black_color);
imageLine($image,40,200,400,200,$black_color);
//second
imageLine($image,430,20,430,200,$black_color);
imageLine($image,430,20,790,20,$black_color);
imageLine($image,790,200,790,20,$black_color);
imageLine($image,430,200,790,200,$black_color);
//========draw the horizonal line(part-1)=======
$style = array($black_color,$black_color,$black_color,$black_color,$black_color,$white_color,$white_color,$white_color,$white_color,$white_color);
imagesetstyle($image, $style);
for($i=10;$i>0;$i--)
{
$x1=40;
$y1=20+(10-$i)*18;
$x2=400;
$y2=$y1;
if($i!=10)
imageline($image, $x1,$y1,$x2,$y2, IMG_COLOR_STYLED);
imagestring($image,2,$x1-22,$y2-5,($i*10)."%",$black_color);
}
//========draw the horizonal line(part-2)=======
$style = array($black_color,$black_color,$black_color,$black_color,$black_color,$white_color,$white_color,$white_color,$white_color,$white_color);
imagesetstyle($image, $style);
for($i=10;$i>0;$i--)
{
$x1=430;
$y1=20+(10-$i)*18;
$x2=790;
$y2=$y1;
if($i!=10)
imageline($image, $x1,$y1,$x2,$y2, IMG_COLOR_STYLED);
imagestring($image,2,$x1-22,$y2-5,($i*10)."%",$black_color);
}
//========draw the vitical line(part-1)=========
$u=floor(360/15);
for($i=0;$i<16;$i++)
{
$x1=40+$i*$u;
$y1=20;
$x2=$x1;
$y2=200;
ImageDashedLine($image,$x1,$y1,$x2,$y2,$black_color);
}
//========draw the vitical line(part-2)=========
for($i=0;$i<16;$i++)
{
$x1=430+$i*$u;
$y1=20;
$x2=$x1;
$y2=200;
ImageDashedLine($image,$x1,$y1,$x2,$y2,$black_color);
}
//=======get colors============
$color[0]=ImageColorAllocate($image,0x99,0x00,0x33);
$color[1]=ImageColorAllocate($image,0x99,0x00,0xcc);
$color[2]=ImageColorAllocate($image,0x99,0x99,0x00);
$color[3]=ImageColorAllocate($image,0x99,0xcc,0x99);
$color[4]=ImageColorAllocate($image,0x99,0xff,0x33);
$color[5]=ImageColorAllocate($image,0xff,0x99,0x66);
$color[6]=ImageColorAllocate($image,0xff,0x99,0xff);
$color[7]=ImageColorAllocate($image,0xff,0xff,0x00);
$color[8]=ImageColorAllocate($image,0x33,0x3,0x33);
$color[9]=ImageColorAllocate($image,0x00,0xcc,0xff);
$color[10]=ImageColorAllocate($image,0x00,0x66,0xcc);
$color[11]=ImageColorAllocate($image,0x33,0xff,0x99);
//======get the block height(part-1)===========
$sum_one=0;
for($i=0;$i<7;$i++)
$sum_one+=$service_csta[$i][0];
for($i=0;$i<7;$i++)
{
for($j=0;$j<7;$j++)
{
if($sum_one==0)
$total_height[$j][$i]=0;
else
$total_height[$j][$i]=floor(180*$service_csta[$i][$j+1]/$sum_one);
}
}
//======get the block height(part-2)===========
$sum_two=0;
for($i=7;$i<12;$i++)
$sum_two+=$service_csta[$i][0];
for($i=7;$i<12;$i++)
{
for($j=0;$j<7;$j++)
{
if($sum_two==0)
$total_height[$j][$i]=0;
else
$total_height[$j][$i]=floor(180*$service_csta[$i][$j+1]/$sum_two);
}
}
//========draw the data block(part-1)==========
for($i=0;$i<7;$i++)
{
for($j=0;$j<7;$j++)
{
if($total_height[$i][$j]<1)
$total_height[$i][$j]=0;
//echo "lie-$i-hang-$j-{$total_height[$i][$j]}<br>";
$x1=40+(2*$i+1)*24;
$y1=199;
for($z=0;$z<$j+1;$z++)
{
$y1=$y1-$total_height[$i][$z];
}
$x2=40+(2*$i+2)*24;
$y2=199;
for($z=0;$z<$j;$z++)
{
$y2=$y2-$total_height[$i][$z];
}
imagefilledrectangle($image,$x1,$y1,$x2,$y2,$color[$j]);
}
}
//========draw the data block(part-2)==========
for($i=0;$i<7;$i++)
{
for($j=7;$j<12;$j++)
{
if($total_height[$i][$j]<1)
$total_height[$i][$j]=0;
//echo "lie-$i-hang-$j-{$total_height[$i][$j]}<br>";
$x1=430+(2*$i+1)*24;
$y1=199;
for($z=7;$z<$j+1;$z++)
{
$y1=$y1-$total_height[$i][$z];
}
$x2=430+(2*$i+2)*24;
$y2=199;
for($z=7;$z<$j;$z++)
{
$y2=$y2-$total_height[$i][$z];
}
imagefilledrectangle($image,$x1,$y1,$x2,$y2,$color[$j]);
}
}
//=====draw the legend string(part-1)============
imagefilledrectangle($image,30,230,40,240,$color[0]);
imagestring($image,2,50,230,"SUB SUB",$black_color);
imagefilledrectangle($image,170,230,180,240,$color[1]);
imagestring($image,2,190,230,"SUB TRK",$black_color);
imagefilledrectangle($image,320,230,330,240,$color[2]);
imagestring($image,2,340,230,"TRK SUB",$black_color);
imagefilledrectangle($image,470,230,480,240,$color[7]);
imagestring($image,2,490,230,"MO",$black_color);
imagefilledrectangle($image,620,230,630,240,$color[8]);
imagestring($image,2,640,230,"MT",$black_color);
imagefilledrectangle($image,760,230,770,240,$color[9]);
imagestring($image,2,780,230,"IN TRK",$black_color);
imagefilledrectangle($image,30,250,40,260,$color[6]);
imagestring($image,2,50,250,"TRK IP",$black_color);
imagefilledrectangle($image,170,250,180,260,$color[3]);
imagestring($image,2,190,250,"TRK TRK",$black_color);
imagefilledrectangle($image,320,250,330,260,$color[4]);
imagestring($image,2,340,250,"INTRA",$black_color);
imagefilledrectangle($image,470,250,480,260,$color[10]);
imagestring($image,2,490,250,"OUT TRK",$black_color);
imagefilledrectangle($image,620,250,630,260,$color[11]);
imagestring($image,2,640,250,"IP",$black_color);
imagefilledrectangle($image,30,270,40,280,$color[5]);
imagestring($image,2,50,270,"SUB IP",$black_color);
imagestring($image,2,55,205,"Success",$black_color);
imagestring($image,2,113,200,"Call",$black_color);
imagestring($image,2,113,212,"Deny",$black_color);
imagestring($image,2,165,200,"Net",$black_color);
imagestring($image,2,163,212,"Busy",$black_color);
imagestring($image,2,202,200,"Caller",$black_color);
imagestring($image,2,204,212,"Clear",$black_color);
imagestring($image,2,260,200,"Sub",$black_color);
imagestring($image,2,258,212,"Busy",$black_color);
imagestring($image,2,310,200,"No",$black_color);
imagestring($image,2,303,212,"Answer",$black_color);
imagestring($image,2,348,200,"Signal",$black_color);
imagestring($image,2,349,212,"Error",$black_color);
imagestring($image,2,445,205,"Success",$black_color);
imagestring($image,2,113+390,200,"Call",$black_color);
imagestring($image,2,113+390,212,"Deny",$black_color);
imagestring($image,2,165+390,200,"Net",$black_color);
imagestring($image,2,163+390,212,"Busy",$black_color);
imagestring($image,2,202+390,200,"Caller",$black_color);
imagestring($image,2,204+390,212,"Clear",$black_color);
imagestring($image,2,260+390,200,"Sub",$black_color);
imagestring($image,2,258+390,212,"Busy",$black_color);
imagestring($image,2,310+390,200,"No",$black_color);
imagestring($image,2,303+390,212,"Answer",$black_color);
imagestring($image,2,348+390,200,"Signal",$black_color);
imagestring($image,2,349+390,212,"Error",$black_color);
//======show the answer failure graphics=====
$tt=time()-2500;
$file_name="ser4_".$tt.".png";
imagepng($image,$file_name);
imagedestroy($image);
echo "<img src=$file_name></img>";
adjust_content_tail("down");
?>
</body>