"; echo "sysTypeNo=$sysTypeNo,show_type=$show_type,page_id=$page_id,keyOne=$keyOne,keyTwo=$keyTwo
"; echo "sel_date_from=$sel_date_from,sel_date_to=$sel_date_to
"; echo "select_checkbox_id=$select_checkbox_id
"; } echo ""; echo ""; $cstaConf=GetCstaConf($sysTypeNo); $slot=$sel_date_from-$sel_date_to+1; $startTime=date("Y-m-d H:i:s",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y"))); $endTime=date("Y-m-d H:i:s",mktime(23,59,59,date("m"),date("d")-$sel_date_to,date("Y"))); //echo "startTime=$startTime,endTime=$endTime
"; $cstaDataChip[3]=GetCstaDataByHour($cstaConf,$startTime,$endTime,"sum",3,$keyOne); $cstaDataChip[4]=GetCstaDataByHour($cstaConf,$startTime,$endTime,"sum",4,$keyOne); $total_hour_num=$slot*24; for($i=0;$i<$total_hour_num;$i++) { $inData[Attempt][$i]=$cstaDataChip[3][0][3][$keyOne][Attempt][$i]+0; $inData[Success][$i]=$cstaDataChip[3][0][3][$keyOne][Success][$i]+0; $inData[Duration][$i]=$cstaDataChip[3][0][3][$keyOne][Duration][$i]+0; $inData[SignalErr][$i]=$cstaDataChip[3][0][3][$keyOne][SignalErr][$i]+0; $inData[CallDeny][$i]=$cstaDataChip[3][0][3][$keyOne][CallDeny][$i]+0; $inData[NetBusy][$i]=$cstaDataChip[3][0][3][$keyOne][NetBusy][$i]+0; $inData[CallerClear][$i]=$cstaDataChip[3][0][3][$keyOne][CallerClear][$i]+0; $inData[Normal][$i]=$cstaDataChip[3][0][3][$keyOne][Normal][$i]+0; $inData[SubBusy][$i]=$cstaDataChip[3][0][3][$keyOne][SubBusy][$i]+0; $inData[NoAnswer][$i]=$cstaDataChip[3][0][3][$keyOne][NoAnswer][$i]+0; $outData[Attempt][$i]=$cstaDataChip[4][0][4][$keyOne][Attempt][$i]+0; $outData[Success][$i]=$cstaDataChip[4][0][4][$keyOne][Success][$i]+0; $outData[Duration][$i]=$cstaDataChip[4][0][4][$keyOne][Duration][$i]+0; $outData[SignalErr][$i]=$cstaDataChip[4][0][4][$keyOne][SignalErr][$i]+0; $outData[CallDeny][$i]=$cstaDataChip[4][0][4][$keyOne][CallDeny][$i]+0; $outData[NetBusy][$i]=$cstaDataChip[4][0][4][$keyOne][NetBusy][$i]+0; $outData[CallerClear][$i]=$cstaDataChip[4][0][4][$keyOne][CallerClear][$i]+0; $outData[Normal][$i]=$cstaDataChip[4][0][4][$keyOne][Normal][$i]+0; $outData[SubBusy][$i]=$cstaDataChip[4][0][4][$keyOne][SubBusy][$i]+0; $outData[NoAnswer][$i]=$cstaDataChip[4][0][4][$keyOne][NoAnswer][$i]+0; $inoutData[Attempt][$i]=$inData[Attempt][$i]+$outData[Attempt][$i]; $inoutData[Success][$i]=$inData[Success][$i]+$outData[Success][$i]; $inoutData[Duration][$i]=$inData[Duration][$i]+$outData[Duration][$i]; $inoutData[SignalErr][$i]=$inData[SignalErr][$i]+$outData[SignalErr][$i]; $inoutData[CallDeny][$i]=$inData[CallDeny][$i]+$outData[CallDeny][$i]; $inoutData[NetBusy][$i]=$inData[NetBusy][$i]+$outData[NetBusy][$i]; $inoutData[CallerClear][$i]=$inData[CallerClear][$i]+$outData[CallerClear][$i]; $inoutData[Normal][$i]=$inData[Normal][$i]+$outData[Normal][$i]; $inoutData[SubBusy][$i]=$inData[SubBusy][$i]+$outData[SubBusy][$i]; $inoutData[NoAnswer][$i]=$inData[NoAnswer][$i]+$outData[NoAnswer][$i]; } //In&Out if($keyTwo == 0) { $cstaData=$inoutData; } //In else if($keyTwo == 1) { $cstaData=$inData; } else if($keyTwo == 2) { $cstaData=$outData; } if(0) { echo "
";
	print_r($cstaData);
	echo "
"; } //Get the trunk title $trunk_element_title="--"; $dualTableLevelWhere="T1.level_1=T2.level_1 AND T1.level_2=T2.level_2 AND T1.level_3=T2.level_3 AND T1.level_4=T2.level_4 AND T1.level_5=T2.level_5 AND T1.level_6=T2.level_6 AND T1.level_7=T2.level_7 AND T1.level_8=T2.level_8 AND T1.level_9=T2.level_9 AND T1.level_10=T2.level_10"; //===get the title of tg===== $instanceNo=omc_keep_length($keyOne,'0',4); $database="OBJ_320"; $sql="SELECT T1.* FROM param_99 AS T1,paramConf AS T2 WHERE $dualTableLevelWhere AND T2.name_2='tgTitle' and T1.instanceNo='$instanceNo' "; $result=@mysqli_query($objDbConn,$sql); $TrunkGroupCount=mysqli_num_rows($result); if($TrunkGroupCount>0) { $rows = @mysqli_fetch_array($result); $trunk_element_title=$rows[initValue]; } //Table-1 { $table_title="TG $keyOne [$trunk_element_title]"; if($keyTwo == 0) $table_title.=" Incoming&Outgoing "; else if($keyTwo == 1) $table_title.=" Incoming "; else if($keyTwo == 2) $table_title.=" Outgoing "; $table_title.="Statistic  Date:"; if($slot>1) $table_title.=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")))." to ".date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_to,date("Y"))); else $table_title.=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y"))); $columnTitle=array( "Time", "Attempt", "Success", "Call Deny", "Net Busy", "Caller
Clear", "Sub Busy", "No
Answer", "Signal
Error", "Total Call
Duration", "Average Call
Duration(s)" ); $columnNum=sizeof($columnTitle); echo "
$table_title
"; echo ""; echo ""; for($i=0;$i<$columnNum;$i++) { echo ""; } echo ""; for($hour=0;$hour<$total_hour_num;$hour++) { $hour_title=date("m-d H",mktime($hour,0,0,date("m"),date("d")-$sel_date_from,date("Y")))."H"; echo ""; echo ""; //Attempt echo ""; //Success echo ""; //CallDeny echo ""; //NetBusy echo ""; //CallerClear echo ""; //SubBusy echo ""; //NoAnswer echo ""; //SignalErr echo ""; //TotalCallDuration echo ""; //AverageCallDuration if($cstaData[Success][$hour] > 0) $value=ceil($cstaData[Duration][$hour]/$cstaData[Success][$hour]); else $value=0; echo ""; echo ""; } echo "
{$columnTitle[$i]}
"; echo "$hour_title"; echo ""; echo "{$cstaData[Attempt][$hour]}
"; echo "
"; echo "{$cstaData[Success][$hour]}
"; $percent=GetPercent($cstaData[Success][$hour],$cstaData[Attempt][$hour]); echo "{$percent}"; echo "
"; echo "{$cstaData[CallDeny][$hour]}
"; $percent=GetPercent($cstaData[CallDeny][$hour],$cstaData[Attempt][$hour]); echo "{$percent}"; echo "
"; echo "{$cstaData[NetBusy][$hour]}
"; $percent=GetPercent($cstaData[NetBusy][$hour],$cstaData[Attempt][$hour]); echo "{$percent}"; echo "
"; echo "{$cstaData[CallerClear][$hour]}
"; $percent=GetPercent($cstaData[CallerClear][$hour],$cstaData[Attempt][$hour]); echo "{$percent}"; echo "
"; echo "{$cstaData[SubBusy][$hour]}
"; $percent=GetPercent($cstaData[SubBusy][$hour],$cstaData[Attempt][$hour]); echo "{$percent}"; echo "
"; echo "{$cstaData[NoAnswer][$hour]}
"; $percent=GetPercent($cstaData[NoAnswer][$hour],$cstaData[Attempt][$hour]); echo "{$percent}"; echo "
"; echo "{$cstaData[SignalErr][$hour]}
"; $percent=GetPercent($cstaData[SignalErr][$hour],$cstaData[Attempt][$hour]); echo "{$percent}"; echo "
"; echo "{$cstaData[Duration][$hour]}
"; $timestamp=SecondToTimeStamp($cstaData[Duration][$hour]); echo "{$timestamp}"; echo "
"; echo "{$value}"; echo "
"; } //Graphics-1 { if($flag0 == "on") { $tmpColor[]=array(0x66,0xff,0x33); $tmpData[]=$cstaData[Success]; } if($flag1 == "on") { $tmpColor[]=array(0x66,0xff,0xff); $tmpData[]=$cstaData[CallDeny]; } if($flag2 == "on") { $tmpColor[]=array(0,0x66,0x66); $tmpData[]=$cstaData[NetBusy]; } if($flag3 == "on") { $tmpColor[]=array(0x66,0,0xcc); $tmpData[]=$cstaData[CallerClear]; } if($flag4 == "on") { $tmpColor[]=array(0x66,0x33,0); $tmpData[]=$cstaData[SubBusy]; } if($flag5 == "on") { $tmpColor[]=array(0xcc,0,0x66); $tmpData[]=$cstaData[NoAnswer]; } if($flag6 == "on") { $tmpColor[]=array(0xff,0,0); $tmpData[]=$cstaData[SignalErr]; } echo "
Hourly Statistic Chart
"; if(0) { echo "flag0=$flag0,flag1=$flag1,flag2=$flag2,flag3=$flag3,flag4=$flag4,flag5=$flag5,flag6=$flag6,flag7=$flag7,flag8=$flag8,flag9=$flag9,flag10=$flag10,flag11=$flag11,flag12=$flag12,flag13=$flag13,flag14=$flag14,flag15=$flag15,flag16=$flag16
"; } $boldline=$select_checkbox_id; for($i=0;$i<$select_checkbox_id;$i++) { $param="flag$i"; if($$param != "on") $boldline--; } $image=CreateImage(820,390); $image=DrawLineHistogram( $image, $tmpData, $tmpColor, 750/(24*$slot), 24, array(50,20), array(750,280), $boldline,1,0,1 ); $remarkBlock=array( "Success", "Call Deny", "Network Busy", "Caller Clear", "Sub Busy", "No Answer", "Signal Error" ); $pointArr=array( array(60,367), array(160,367), array(260,367), array(360,367), array(460,367), array(560,367), array(660,367) ); unset($tmpColor); $tmpColor[]=array(0x66,0xff,0x33); $tmpColor[]=array(0x66,0xff,0xff); $tmpColor[]=array(0,0x66,0x66); $tmpColor[]=array(0x66,0,0xcc); $tmpColor[]=array(0x66,0x33,0); $tmpColor[]=array(0xcc,0,0x66); $tmpColor[]=array(0xff,0,0); $image=AddRemarkToImage($image,$pointArr,$remarkBlock,$tmpColor,0,2); DrawTimeStamp($image,$sel_date_from,$sel_date_to,array(50,355),750/24); echo ""; echo ""; for($i=0;$i"; AddCheckbox($remarkBlock[$i]); echo ""; } echo ""; echo "
"; DrawImage($image); } //Graphics-2 { for($i=0;$i<$total_hour_num;$i++) { if($cstaData[Success][$i] > 0) $aveduration_value[$i]=ceil($cstaData[Duration][$i]/$cstaData[Success][$i]); else $aveduration_value[$i]=0; } unset($tmpColor); unset($tmpData); if($flag7 == "on") { $tmpColor[]=array(0x66,0xff,0xff); $tmpData[]=$cstaData[Duration]; } if($flag8 == "on") { $tmpColor[]=array(0,0x66,0x66); $tmpData[]=$aveduration_value; } echo "

Duration Statistic Chart
"; $image=CreateImage(820,390); $boldline=$select_checkbox_id-7; for($i=7;$i<$select_checkbox_id;$i++) { $param="flag$i"; if($$param != "on") $boldline--; } $image=DrawLineHistogram( $image, $tmpData, $tmpColor, 750/(24*$slot), 24, array(50,20), array(750,280), $boldline,1,0,1 ); unset($tmpColor); $tmpColor[]=array(0x66,0xff,0xff); $tmpColor[]=array(0,0x66,0x66); $remarkBlock=array( "Total Call Duration", "Average Call Duration" ); $pointArr=array( array(60,367), array(260,367) ); $image=AddRemarkToImage($image,$pointArr,$remarkBlock,$tmpColor,0,2); DrawTimeStamp($image,$sel_date_from,$sel_date_to,array(50,355),750/24); echo ""; echo ""; for($i=0;$i"; AddCheckbox($remarkBlock[$i]); echo ""; } echo ""; echo "
"; DrawImage($image); } ?>