<?php
if(0)
{
	echo "sysTypeNo=$sysTypeNo<br>";
	echo "show_type=$show_type<br>";
	echo "page_id=$page_id<br>";
	echo "sel_date_from=$sel_date_from<br>";
	echo "sel_date_to=$sel_date_to<br>";
	echo "keyOne=$keyOne,keyTwo=$keyTwo<br>";
}

echo "<input type=\"hidden\" name=\"select_checkbox_id\" value=\"$select_checkbox_id\">";
echo "<input type=\"hidden\" name=\"scroll_y\" value=\"$scroll_y\">";

$cstaConf=GetCstaConf($sysTypeNo);

$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>";

$cstaDataTmp=GetCstaDataByHour($cstaConf,$startTime,$endTime,"detail",$keyOne,-1);


if(0)
{
	echo "<pre>";
	print_r($cstaDataTmp);
	echo "</pre>";
}

//Table-1
{
	$table_title="E1-{$keyOne}";
	$cstaData=$cstaDataTmp[0][$keyOne];

	if($slot > 1)
		$table_title.=" Statistic&nbsp;&nbsp;Date:".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.=" Statistic&nbsp;&nbsp;Date:".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\">";
	echo "<tr bgcolor=\"#E6E6E6\">";
	echo "<td align=\"center\" width=\"10%\">Time</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($cstaData[rtp_pkg_miss]);
	if($row_num > 0)
	{
		for($hour=0;$hour<$total_hour_num;$hour++)
		{
			if(isset($cstaData[rtp_pkg_miss][$hour]))
			{
				echo "<tr>";
				$hour_title=date("m-d H",mktime($hour,0,0,date("m"),date("d")-$sel_date_from,date("Y")));
				echo "<td align=\"center\">{$hour_title}H</td>";
				
				echo "<td align=\"center\">";
				echo "{$cstaData[rtp_pkg_miss][$hour]}";
				echo "&nbsp;</td>";
				
				echo "<td align=\"center\">";
				echo "{$cstaData[rtp_pkg_recv][$hour]}";
				echo "&nbsp;</td>";
				
				echo "<td align=\"center\">";
				echo "{$cstaData[rtp_pkg_sent][$hour]}";
				echo "&nbsp;</td>";
				
				echo "</tr>";
			}
		}
	}
	else
	{
		echo "<tr>";
		echo "<td>--</td><td>--</td><td>--</td><td>--</td>";
		echo "</tr>";
	}
	
	echo "</table>";
}

?>
