0){ //echo ""; echo ""; }else{ echo ""; } ?> "; //========================================================================================| //========================Initial The Data From Index Page================================| //========================================================================================| if(!isset($sel_date_from)) $sel_date_from=0; if(!isset($sel_date_to)) $sel_date_to=0; if(!isset($sel_in_out)) $sel_in_out=0; if(!isset($from_hour)) $from_hour="00"; if(!isset($from_minute)) $from_minute="00"; if(!isset($from_second)) $from_second="00"; if(!isset($to_hour)) $to_hour="23"; if(!isset($to_minute)) $to_minute="59"; if(!isset($to_second)) $to_second="59"; $DEBUG=0; //========================================================================================| //============================Define The Data=============================================| //========================================================================================| $detailTableFields=array("Attempt", "Success", "Duration", "lu_normal", "lu_res_not_ok", "lu_ser_not_ok", "lu_ser_no_imp", "lu_msg_error", "lu_pro_error", "cc_normal", "cc_call_deny", "cc_net_busy", "cc_caller_clear", "cc_sub_busy", "cc_no_answer", "cc_sig_error", "sm_normal", "sm_error_sub", "sm_ser_not_ok", "sm_net_busy", "sm_msg_error", "sm_pro_error", "sm_res_not_ok" ); $detailTableFieldsSql=""; for($i=0;$i0) { while($rows = @mysqli_fetch_array($result)) { //get the instanceNo of the tg $trunk_no=$rows[instanceNo]+0; $trunk_status[$trunk_no]=1; $trunk_element_title[$trunk_no]=$rows[initValue]; } } //========================================================================================| //=============================Get The Data From DB=======================================| //========================================================================================| //=====data for per trunk======= $db=$csta_db; $slot=$sel_date_from-$sel_date_to+1; $time_column="csta_datetime"; //echo "sel_in_out=$sel_in_out
"; $service_type=$sel_in_out+1; for($day=0;$day<$slot;$day++) { $table_name ="ipalimSum"; $temp=date("d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+$day,date("Y"))); $table_name=$table_name."_".$temp; $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 "table_name:$table_name
"; //echo "from_time:$from_time
"; //echo "to_time:$to_time
"; //echo "in_out:$sel_in_out
"; if($service_type < 6) $trunk_where="and key_type=".$service_type." "; else $trunk_where=""; $select="select key_e1_tg,$detailTableFieldsSql "; $from="from $table_name "; $where="where $time_column >='$from_time' and $time_column <'$to_time' ".$trunk_where; $group="group by key_e1_tg "; $order="order by key_e1_tg "; $sql=$select.$from.$where.$group.$order; //echo "sql:$sql
"; $result=@mysqli_query($pubConn,$sql); $rows=@mysqli_fetch_array($result); if(!$rows) continue; do { $gro=$rows[0]; for($tt=0;$tt"; } }while($rows=mysqli_fetch_array($result)); } //get the 0-hour of this day for($day=0;$day<$slot;$day++) { $table_name ="ipalimSum"; $temp=date("d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+$day-1,date("Y"))); $table_name=$table_name."_".$temp; $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 "table_name:$table_name
"; //echo "from_time:$from_time
"; //echo "to_time:$to_time
"; //echo "in_out:$sel_in_out
"; if($service_type < 6) $trunk_where="and key_type=".$service_type." "; else $trunk_where=""; $select="select key_e1_tg,$detailTableFieldsSql "; $from="from $table_name "; $where="where $time_column >='$from_time' and $time_column <'$to_time' ".$trunk_where; $group="group by key_e1_tg "; $order="order by key_e1_tg "; $sql=$select.$from.$where.$group.$order; //echo "sql:$sql
"; $result=@mysqli_query($pubConn,$sql); $rows=@mysqli_fetch_array($result); if(!$rows) continue; do { $gro=$rows[0]; for($tt=0;$tt"; } }while($rows=mysqli_fetch_array($result)); } //=====data for lu_trunk,mo_trunk,mt_trunk,smo_trunk,smt_trunk=== for($day=0;$day<$slot;$day++) { $table_name ="ipalimSum"; $temp=date("d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+$day,date("Y"))); $table_name=$table_name."_".$temp; $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"))); //===lu-trunk data===== $select="select key_e1_tg,$detailTableFieldsSql "; $from="from $table_name "; $trunk_where="and key_type=1 "; $where="where $time_column >='$from_time' and $time_column <'$to_time' ".$trunk_where; $group="group by key_e1_tg "; $order="order by key_e1_tg "; $sql=$select.$from.$where.$group.$order; $result=@mysqli_query($pubConn,$sql); $rows=@mysqli_fetch_array($result); if(!$rows) continue; do{ //if the trunk group is disable $trunk_no=$rows[0]; if($trunk_status[$trunk_no]==0) continue; for($tt=0;$tt"; } }while($rows=mysqli_fetch_array($result)); //===mo-trunk======= $select="select key_e1_tg,$detailTableFieldsSql "; $from="from $table_name "; $trunk_where="and key_type=2 "; $where="where $time_column >='$from_time' and $time_column <'$to_time' ".$trunk_where; $group="group by key_e1_tg "; $order="order by key_e1_tg "; $sql=$select.$from.$where.$group.$order; $result=@mysqli_query($pubConn,$sql); $rows=@mysqli_fetch_array($result); if(!$rows) continue; do{ $trunk_no=$rows[0]; if($trunk_status[$trunk_no]==0) continue; for($tt=0;$tt"; } }while($rows=mysqli_fetch_array($result)); //===mt-trunk======= $select="select key_e1_tg,$detailTableFieldsSql "; $from="from $table_name "; $trunk_where="and key_type=3 "; $where="where $time_column >='$from_time' and $time_column <'$to_time' ".$trunk_where; $group="group by key_e1_tg "; $order="order by key_e1_tg "; $sql=$select.$from.$where.$group.$order; $result=@mysqli_query($pubConn,$sql); $rows=@mysqli_fetch_array($result); if(!$rows) continue; do{ $trunk_no=$rows[0]; if($trunk_status[$trunk_no]==0) continue; for($tt=0;$tt"; } }while($rows=mysqli_fetch_array($result)); //===smo-trunk======= $select="select key_e1_tg,$detailTableFieldsSql "; $from="from $table_name "; $trunk_where="and key_type=4 "; $where="where $time_column >='$from_time' and $time_column <'$to_time' ".$trunk_where; $group="group by key_e1_tg "; $order="order by key_e1_tg "; $sql=$select.$from.$where.$group.$order; $result=@mysqli_query($pubConn,$sql); $rows=@mysqli_fetch_array($result); if(!$rows) continue; do{ $trunk_no=$rows[0]; if($trunk_status[$trunk_no]==0) continue; for($tt=0;$tt"; } }while($rows=mysqli_fetch_array($result)); //===smt-trunk======= $select="select key_e1_tg,$detailTableFieldsSql "; $from="from $table_name "; $trunk_where="and key_type=5 "; $where="where $time_column >='$from_time' and $time_column <'$to_time' ".$trunk_where; $group="group by key_e1_tg "; $order="order by key_e1_tg "; $sql=$select.$from.$where.$group.$order; $result=@mysqli_query($pubConn,$sql); $rows=@mysqli_fetch_array($result); if(!$rows) continue; do{ $trunk_no=$rows[0]; if($trunk_status[$trunk_no]==0) continue; for($tt=0;$tt"; } }while($rows=mysqli_fetch_array($result)); //=====total_trunk data======= $select="select key_e1_tg,$detailTableFieldsSql "; $from="from $table_name "; $trunk_where="and key_type>0 and key_type<6 "; $where="where $time_column >='$from_time' and $time_column <'$to_time' ".$trunk_where; $group="group by key_e1_tg "; $order="order by key_e1_tg "; $sql=$select.$from.$where.$group.$order; //echo "$sql
"; $result=@mysqli_query($pubConn,$sql); $rows=@mysqli_fetch_array($result); if(!$rows) continue; do{ $trunk_no=$rows[0]; if($trunk_status[$trunk_no]==0) continue; for($tt=0;$tt"; } }while($rows=mysqli_fetch_array($result)); } //get the 0-hour of the day for($day=0;$day<$slot;$day++) { $table_name ="ipalimSum"; $temp=date("d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+$day-1,date("Y"))); $table_name=$table_name."_".$temp; $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"))); //===lu-trunk data===== $select="select key_e1_tg,$detailTableFieldsSql "; $from="from $table_name "; $trunk_where="and key_type=1 "; $where="where $time_column >='$from_time' and $time_column <'$to_time' ".$trunk_where; $group="group by key_e1_tg "; $order="order by key_e1_tg "; $sql=$select.$from.$where.$group.$order; $result=@mysqli_query($pubConn,$sql); $rows=@mysqli_fetch_array($result); if(!$rows) continue; do{ //if the trunk group is disable $trunk_no=$rows[0]; if($trunk_status[$trunk_no]==0) continue; for($tt=0;$tt"; } }while($rows=mysqli_fetch_array($result)); //===mo-trunk======= $select="select key_e1_tg,$detailTableFieldsSql "; $from="from $table_name "; $trunk_where="and key_type=2 "; $where="where $time_column >='$from_time' and $time_column <'$to_time' ".$trunk_where; $group="group by key_e1_tg "; $order="order by key_e1_tg "; $sql=$select.$from.$where.$group.$order; $result=@mysqli_query($pubConn,$sql); $rows=@mysqli_fetch_array($result); if(!$rows) continue; do{ $trunk_no=$rows[0]; if($trunk_status[$trunk_no]==0) continue; for($tt=0;$tt"; } }while($rows=mysqli_fetch_array($result)); //===mt-trunk======= $select="select key_e1_tg,$detailTableFieldsSql "; $from="from $table_name "; $trunk_where="and key_type=3 "; $where="where $time_column >='$from_time' and $time_column <'$to_time' ".$trunk_where; $group="group by key_e1_tg "; $order="order by key_e1_tg "; $sql=$select.$from.$where.$group.$order; $result=@mysqli_query($pubConn,$sql); $rows=@mysqli_fetch_array($result); if(!$rows) continue; do{ $trunk_no=$rows[0]; if($trunk_status[$trunk_no]==0) continue; for($tt=0;$tt"; } }while($rows=mysqli_fetch_array($result)); //===smo-trunk======= $select="select key_e1_tg,$detailTableFieldsSql "; $from="from $table_name "; $trunk_where="and key_type=4 "; $where="where $time_column >='$from_time' and $time_column <'$to_time' ".$trunk_where; $group="group by key_e1_tg "; $order="order by key_e1_tg "; $sql=$select.$from.$where.$group.$order; $result=@mysqli_query($pubConn,$sql); $rows=@mysqli_fetch_array($result); if(!$rows) continue; do{ $trunk_no=$rows[0]; if($trunk_status[$trunk_no]==0) continue; for($tt=0;$tt"; } }while($rows=mysqli_fetch_array($result)); //===smt-trunk======= $select="select key_e1_tg,$detailTableFieldsSql "; $from="from $table_name "; $trunk_where="and key_type=5 "; $where="where $time_column >='$from_time' and $time_column <'$to_time' ".$trunk_where; $group="group by key_e1_tg "; $order="order by key_e1_tg "; $sql=$select.$from.$where.$group.$order; $result=@mysqli_query($pubConn,$sql); $rows=@mysqli_fetch_array($result); if(!$rows) continue; do{ $trunk_no=$rows[0]; if($trunk_status[$trunk_no]==0) continue; for($tt=0;$tt"; } }while($rows=mysqli_fetch_array($result)); //=====total_trunk data======= $select="select key_e1_tg,$detailTableFieldsSql "; $from="from $table_name "; $trunk_where="and key_type>0 and key_type<6 "; $where="where $time_column >='$from_time' and $time_column <'$to_time' ".$trunk_where; $group="group by key_e1_tg "; $order="order by key_e1_tg "; $sql=$select.$from.$where.$group.$order; //echo "$sql
"; $result=@mysqli_query($pubConn,$sql); $rows=@mysqli_fetch_array($result); if(!$rows) continue; do{ $trunk_no=$rows[0]; if($trunk_status[$trunk_no]==0) continue; for($tt=0;$tt"; } }while($rows=mysqli_fetch_array($result)); } if(0) { for($i=0;$i"; } } } //====test the title of trunk group=== if(0) { for($i=0;$i<=256;$i++) { echo "group:$i {$trunk_element_title[$i]}
"; } } //====test the status of trunk group=== if(0) { for($i=0;$i<=256;$i++) { echo "group:$i {$trunk_status[$i]}
"; } } //=====test the in_trunk,out_trunk,total_trunk== if(0) { for($i=0;$i"; echo "mo-type-$i:{$mo_trunk[$i]}
"; echo "mt-type-$i:{$mt_trunk[$i]}
"; echo "smo-type-$i:{$smo_trunk[$i]}
"; echo "smt-type-$i:{$smt_trunk[$i]}
"; //echo "total-type-$i:{$total_trunk[$i]}
"; } } //========================================================================================| //===========================Show the table-1=============================================| //========================================================================================| //===get the numbers of days that selected=== $slot=$sel_date_from-$sel_date_to+1; //====get the table title==== $title_time=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y"))); if($slot==1) $table_title="Trunk statistic Date:".$title_time; else $table_title="Trunk statistic Date:".$title_time." to ".date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_to,date("Y"))); echo "
$table_title
"; echo ""; if($service_type==1) { $temp="LU"; $tempi=11; } else if($service_type==2) { $temp="Call MO"; $tempi=12; } else if($service_type==3) { $temp="Call MT"; $tempi=12; } else if($service_type==4) { $temp="SM MO"; $tempi=12; } else if($service_type==5) { $temp="SM MT"; $tempi=12; } echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; //LU if($service_type == 1) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } //call else if($service_type == 2 || $service_type == 3) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } //SM else if($service_type == 4 || $service_type == 5) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } echo ""; if($service_type == 1) $DataRelation=array(0,1,3,4,5,6,7,8,2); else if($service_type == 2 || $service_type == 3) $DataRelation=array(0,1,9,10,11,12,13,14,15,2); else if($service_type == 4 || $service_type == 5) $DataRelation=array(0,1,16,17,18,19,20,21,22,2); for($i=0;$i<=256;$i++) { if($trunk_status[$i]!=1) continue; echo ""; $t=$i; echo ""; echo ""; for($j=0;$j"; if($m_j==0) { echo "{$trunk_csta[$i][$m_j]}"; } else if($m_j==2) { echo "{$trunk_csta[$i][$m_j]}(s)"; $hour=floor($trunk_csta[$i][$m_j]/3600); $minute=floor($trunk_csta[$i][$m_j]%3600/60); $second=$trunk_csta[$i][$m_j]%60; if($hour==0&&$minute==0&&$second==0) echo "
"; else echo "
$hour:$minute:$second"; } else { echo "{$trunk_csta[$i][$m_j]}"; echo "
"; if($trunk_csta[$i][0]==0) $rate=0; else { $rate=$trunk_csta[$i][$m_j]/$trunk_csta[$i][0]; $rate=$rate*100; $rate=number_format($rate,2,"."," "); } if($rate==0) $rate=0; echo "$rate%"; } echo ""; } //==average call duration===== echo "
"; echo ""; } echo "
 $temp
TG No.Element TitleAttemptSuccessNormalNo ResourceNo ServiceInvalid ServiceInvalid MessageSignal ErrorDurationAverage Duration(s)AttemptSuccessNormalCall DenyNet BusyCaller ClearSub BusyNo AnswerSignal ErrorDurationAverage Duration(s)AttemptSuccessNormalSub ErrorNo ServiceNet BusyMessage ErrorSignal ErrorNo ResourceDurationAverage Duration(s)
$t{$trunk_element_title[$i]}"; if($trunk_csta[$i][1]!=0) $ave=round($trunk_csta[$i][2]/$trunk_csta[$i][1]); else $ave=0; echo "$ave"; echo "
"; //========================================================================================| //=========================Show the table-2 LU===============================================| //========================================================================================| echo "
$table_title
"; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; //LU echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; //====LU trunk data===== $DataRelation=array(3,4,5,6,7,8); echo ""; echo ""; for($i=0;$i"; if($lu_trunk[0]!=0) { $rate=$lu_trunk[$m_i]/$lu_trunk[0]; $rate=$rate*100; $rate=number_format($rate,2,"."," "); } else $rate=0; if($rate==0) $rate=0; echo "$rate%"; echo ""; } echo ""; echo "
Success/failure
TypeNormalNo ResourceNo ServiceInvalid ServiceInvalid MessageSignal Error
LU
"; //========================================================================================| //=========================Show the table-3 Call===============================================| //========================================================================================| //echo "
$table_title
"; echo "
"; echo ""; //echo ""; //echo ""; //echo ""; echo ""; //Call echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; //====mo trunk data===== $DataRelation=array(9,10,11,12,13,14,15); echo ""; echo ""; for($i=0;$i"; if($mo_trunk[0]!=0) { $rate=$mo_trunk[$m_i]/$mo_trunk[0]; $rate=$rate*100; $rate=number_format($rate,2,"."," "); } else $rate=0; if($rate==0) $rate=0; echo "$rate%"; echo ""; } echo ""; echo ""; echo ""; for($i=0;$i"; if($mt_trunk[0]!=0) { $rate=$mt_trunk[$m_i]/$mt_trunk[0]; $rate=$rate*100; $rate=number_format($rate,2,"."," "); } else $rate=0; if($rate==0) $rate=0; echo "$rate%"; echo ""; } echo ""; echo "
Success/failure
TypeNormalCall DenyNet BusyCaller ClearSub BusyNo AnswerSignal Error
Call MO
Call MT
"; //========================================================================================| //=========================Show the table-4 SM===============================================| //========================================================================================| //echo "
$table_title
"; echo "
"; echo ""; //echo ""; //echo ""; //echo ""; echo ""; //Call echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; //====mo trunk data===== $DataRelation=array(16,17,18,19,20,21,22); echo ""; echo ""; for($i=0;$i"; if($smo_trunk[0]!=0) { $rate=$smo_trunk[$m_i]/$smo_trunk[0]; $rate=$rate*100; $rate=number_format($rate,2,"."," "); } else $rate=0; if($rate==0) $rate=0; echo "$rate%"; echo ""; } echo ""; echo ""; echo ""; for($i=0;$i"; if($smt_trunk[0]!=0) { $rate=$smt_trunk[$m_i]/$smt_trunk[0]; $rate=$rate*100; $rate=number_format($rate,2,"."," "); } else $rate=0; if($rate==0) $rate=0; echo "$rate%"; echo ""; } echo ""; echo "
Success/failure
TypeNormalSub ErrorNo ServiceNet BusyMessage ErrorSignal ErrorNo Resource
SM MO
SM MT
"; //========================================================================================| //=======================Draw the Graphics-1==============================================| //========================================================================================| echo "

LU/Call MO/Call MT/SM MO/SM MT(Attempt Call)
"; $sizex=510; $sizey=240; $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))); $color[0]=ImageColorAllocate($im,0x33,0x33,0xff); $color[1]=ImageColorAllocate($im,0x66,0xaa,0); $color[2]=ImageColorAllocate($im,0x66,0xff,0x33); $color[3]=ImageColorAllocate($im,0x66,0xff,0xff); $color[4]=ImageColorAllocate($im,0,0x66,0x66); //=====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); imageLine($im,40,20,40,200,$black_color); imageLine($im,40,20,490,20,$black_color); imageLine($im,490,200,490,20,$black_color); imageLine($im,40,200,490,200,$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=490; $y2=$y1; if($i!=10) imageline($im,$x1,$y1,$x2,$y2,IMG_COLOR_STYLED); imagestring($im,2,$x1-22,$y2-5,($i*10)."%",$black_color); } //====draw the vitical line====== $u=floor(450/10); for($i=0;$i<10;$i++) { $x1=40+$i*$u; $y1=20; $x2=$x1; $y2=200; ImageDashedLine($im,$x1,$y1,$x2,$y2,$black_color); } //=====get the five block height======= if($total_trunk[0]==0) { $lu_trunk_percent="0%"; $mo_trunk_percent="0%"; $mt_trunk_percent="0%"; $smo_trunk_percent="0%"; $smt_trunk_percent="0%"; $height[0]=0; $heighr[1]=0; $height[2]=0; $height[3]=0; $height[4]=0; } else { $lu_trunk_percent=change_percent($lu_trunk[0]/$total_trunk[0]); $mo_trunk_percent=change_percent($mo_trunk[0]/$total_trunk[0]); $mt_trunk_percent=change_percent($mt_trunk[0]/$total_trunk[0]); $smo_trunk_percent=change_percent($smo_trunk[0]/$total_trunk[0]); $smt_trunk_percent=change_percent($smt_trunk[0]/$total_trunk[0]); $height[0]=floor(180*$lu_trunk[0]/$total_trunk[0]); $height[1]=floor(180*$mo_trunk[0]/$total_trunk[0]); $height[2]=floor(180*$mt_trunk[0]/$total_trunk[0]); $height[3]=floor(180*$smo_trunk[0]/$total_trunk[0]); $height[4]=floor(180*$smt_trunk[0]/$total_trunk[0]); } //======draw the data block======= for($i=0;$i<5;$i++) { $x1=85+(2*$i)*45; if($height[$i]==0) $height[$i]=1; $y1=200-$height[$i]; $x2=85+(2*$i+1)*45; $y2=199; imagefilledrectangle($im,$x1,$y1,$x2,$y2,$color[$i]); } //=====draw the legend string======= imagestring($im,2,105,205,"LU",$black_color); imagestring($im,2,88,220,"(".$lu_trunk_percent.")",$black_color); imagestring($im,2,175,205,"Call MO",$black_color); imagestring($im,2,180,220,"(".$mo_trunk_percent.")",$black_color); imagestring($im,2,265,205,"Call MT",$black_color); imagestring($im,2,270,220,"(".$mt_trunk_percent.")",$black_color); imagestring($im,2,363,205,"SM MT",$black_color); imagestring($im,2,365,220,"(".$smo_trunk_percent.")",$black_color); imagestring($im,2,450,205,"SM MO",$black_color); imagestring($im,2,455,220,"(".$smt_trunk_percent.")",$black_color); //====show the graphics===== //-----输出图形文件,请勿修改 //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="tg1_".time().".png"; if(1){ ImagePng ($im,"$filename"); ImageDestroy($im); } //-----显示图片 echo ""; /* //========================================================================================| //==========================Draw the Graphics-2===========================================| //========================================================================================| echo "

Success/Failure
"; $sizex=600; $sizey=250; $image=imagecreate($sizex,$sizey); $bgcolor=imagecolorallocate($image,255,255,255); $black_color=ImageColorAllocate($image,0,0,0); $white_color=ImageColorAllocate($image,255,255,255); $bgcolor=F8F8F8; $fgcolor=000000; $color[0]=ImageColorAllocate($image,0x33,0x33,0xff); $color[1]=ImageColorAllocate($image,0x66,0xaa,0); $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); imageLine($image,40,20,40,200,$black_color); imageLine($image,40,20,580,20,$black_color); imageLine($image,580,200,580,20,$black_color); imageLine($image,40,200,580,200,$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($image, $style); for($i=10;$i>0;$i--) { $x1=40; $y1=20+(10-$i)*18; $x2=580; $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===== $u=floor(540/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); } //=====get the block height====== for($j=0;$j<7;$j++) { if($total_trunk[0]==0) $total_height[$j][0]=1; else $total_height[$j][0]=floor(180*$in_trunk[$j+1]/$total_trunk[0]); } for($j=0;$j<7;$j++) { if($total_trunk[0]==0) $total_height[$j][1]=1; else $total_height[$j][1]=floor(180*$out_trunk[$j+1]/$total_trunk[0]); } //======draw the data block===== for($i=0;$i<7;$i++) { for($j=0;$j<2;$j++) { if($total_height[$i][$j]<1) $total_height[$i][$j]=1; //echo "lie-$i-hang-$j-{$total_height[$i][$j]}
"; $x1=40+(2*$i+1)*36; $y1=199; for($z=0;$z<$j+1;$z++) { $y1=$y1-$total_height[$i][$z]; } $x2=40+(2*$i+2)*36; $y2=199; for($z=0;$z<$j;$z++) { $y2=$y2-$total_height[$i][$z]; } imagefilledrectangle($image,$x1,$y1,$x2,$y2,$color[$j]); } } //=====draw the legend string===== imagefilledrectangle($image,150,230,165,245,$color[0]); imagestring($image,2,170,230,"In",$black_color); imagefilledrectangle($image,320,230,335,245,$color[1]); imagestring($image,2,340,230,"Out",$black_color); imagestring($image,2,77,205,"Success",$black_color); imagestring($image,2,135,205,"Call deny",$black_color); imagestring($image,2,215,205,"Net busy",$black_color); imagestring($image,2,293,200,"Caller",$black_color); imagestring($image,2,298,212,"clear",$black_color); imagestring($image,2,360,205,"Sub busy",$black_color); imagestring($image,2,430,205,"No answer",$black_color); imagestring($image,2,508,200,"Signal",$black_color); imagestring($image,2,512,212,"error",$black_color); //=====show the success failure graphics==== $tt=time()-1505; $file_name="tg2_".$tt.".png"; imagepng($image,$file_name); imagedestroy($image); echo ""; */ adjust_content_tail("down"); ?>