<?php
$cstaConf=GetCstaConf($sysTypeNo);
if(0)
{
	echo "sel_date_from=$sel_date_from,sel_date_to=$sel_date_to<br>";
	echo "<pre>";
	print_r($cstaConf);
	echo "</pre>";
}
$slot=$sel_date_from-$sel_date_to+1;
$total_hour_num=$slot*24;
$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<br>";

$cstaData=GetCstaDataByDay($cstaConf,$startTime,$endTime,"detail");
if(0)
{
	echo "<pre>";
	print_r($cstaData);
	echo "</pre>";
}

//Table-1
{
	$amrmgCstaData=$cstaData[0];
	$table_title="AMRMG Statistic&nbsp;&nbsp;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")));
	echo "<br><b><center>$table_title</center></b>";
	echo "<table width=\"100%\" border=\"1\" cellpadding=\"2\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\" bgcolor=\"#FFFFFF\">";
	//Table title
	echo "<tr bgcolor=\"#E6E6E6\">";
	echo "<td align=\"center\" width=\"10%\">E1 No.</td>";
	echo "<td align=\"center\" width=\"30%\">RTP Packets Loss</td>";
	echo "<td align=\"center\" width=\"30%\">RTP Packets Receive</td>";
	echo "<td align=\"center\" width=\"30%\">RTP Packets Send</td>";
	echo "</tr>";
	$row_num=count($amrmgCstaData);
	if($row_num > 0)
	{
		foreach($amrmgCstaData as $e1_id => $data)
		{
			echo "<tr>";
			echo "<td align=\"center\">";
			echo "<a href=# onclick=\"javascript:toHourPage('$sysTypeNo','hour','0','$sel_date_from','$sel_date_to','{$e1_id}','-1');\">";
			echo "$e1_id";
			echo "</a>";
			echo "</td>";
			
			echo "<td align=\"center\">";
			echo "{$data[rtp_pkg_miss]}";
			echo "</td>";
			
			echo "<td align=\"center\">";
			echo "{$data[rtp_pkg_recv]}";
			echo "</td>";
			
			echo "<td align=\"center\">";
			echo "{$data[rtp_pkg_sent]}";
			echo "</td>";

			echo "</tr>";
		}
	}
	else
	{
		echo "<tr>";
		echo "<td>--</td><td>--</td><td>--</td><td>--</td>";
		echo "</tr>";
	}
	echo "</table>";
}
?>