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

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

//Table-1
{
	$table_title="AAS 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 width=\"20%\">&nbsp;</td>";
	echo "<td width=\"40%\">Type</td>";
	echo "<td width=\"40%\">Value</td>";
	echo "</tr>";
	echo "<tr>";
	echo "<td rowspan=3>PPS Service</td>";
		echo "<tr>";
			echo "<td>Attempt</td>";
			$value=$cstaData[pps_service_attempt]+0;
			echo "<td>$value</td>";
		echo "</tr>";
		echo "<tr>";
			echo "<td>Success</td>";
			$value=$cstaData[pps_service_success]+0;
			echo "<td>$value</td>";
		echo "</tr>";
	echo "</tr>";
	
	echo "<td rowspan=3>MSC Service</td>";
		echo "<tr>";
			echo "<td>Attempt</td>";
			$value=$cstaData[msc_service_attempt]+0;
			echo "<td>$value</td>";
		echo "</tr>";
		echo "<tr>";
			echo "<td>Success</td>";
			$value=$cstaData[msc_service_success]+0;
			echo "<td>$value</td>";
		echo "</tr>";
	echo "</tr>";
	
	echo "<tr>";
		echo "<td>Invalid</td>";
		echo "<td>Invalid Call</td>";
		$value=$cstaData[invalid_call]+0;
		echo "<td>$value</td>";
	echo "</tr>";
	echo "</table>";
}
?>

