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

//Table-1
{
	$table_title="VSS 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%\">Call Type</td>";
	echo "<td width=\"40%\">Value</td>";
	echo "</tr>";
	echo "<tr>";
	echo "<td rowspan=6>VSS</td>";
		echo "<tr>";
			echo "<td>Leave Message Attempt</td>";
			$value=$cstaData[1][2][att_lev_msg]+0;
			echo "<td>$value</td>";
		echo "</tr>";
		echo "<tr>";
			echo "<td>Leave Message Success</td>";
			$value=$cstaData[1][2][suc_lev_msg]+0;
			echo "<td>$value</td>";
		echo "</tr>";
		echo "<tr>";
			echo "<td>Maintain Message Attempt</td>";
			$value=$cstaData[1][2][att_mnt_msg]+0;
			echo "<td>$value</td>";
		echo "</tr>";
		echo "<tr>";
			echo "<td>Maintain Message Success</td>";
			$value=$cstaData[1][2][suc_mnt_msg]+0;
			echo "<td>$value</td>";
		echo "</tr>";
		echo "<tr>";
			echo "<td>Fail to Access</td>";
			$value=$cstaData[1][2][acc_fail]+0;
			echo "<td>$value</td>";
		echo "</tr>";
	echo "</tr>";
		
	echo "<tr>";
	echo "<td rowspan=5>ISUP</td>";
		echo "<tr>";
			echo "<td>Original Attempt</td>";
			$value=$cstaData[0][1][att_org_call]+0;
			echo "<td>$value</td>";
		echo "</tr>";
		echo "<tr>";
			echo "<td>Original Success</td>";
			$value=$cstaData[0][1][suc_org_call]+0;
			echo "<td>$value</td>";
		echo "</tr>";
		echo "<tr>";
			echo "<td>Terminal Attempt</td>";
			$value=$cstaData[0][1][att_term_call]+0;
			echo "<td>$value</td>";
		echo "</tr>";
		echo "<tr>";
			echo "<td>Terminal Success</td>";
			$value=$cstaData[0][1][suc_term_call]+0;
			echo "<td>$value</td>";
		echo "</tr>";
	echo "</tr>";
	echo "</table>";
}
?>

