<?php
/*********************************************************      
 程序说明：         
    功能说明：进行话务查询

    调用关系：调用:header.inc     
              被调用:      
 
    变量说明：
     返回值：无

 作者：Cui Ticun  2004-12-14     
      
修改注释：      
NO.1      
姓名：            
时间：      
修改说明：      
*********************************************************/  
require("../../inc/header.inc");
?>
<body leftmargin="15" rightmargin="10" onload="javascript:adjust_frame('down');" onresize="javascript:adjust_frame('down');" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;">
<?php
adjust_head_frame("down");
adjust_title_head_frame("down");
adjust_title_tail_frame("down");

adjust_content_head_frame("down");	
echo "<br>";

$DEBUG=0;

$db='CSTA_DB';
$sort_field = 'csta_datetime DESC, key_sys_id ASC';		//排序所依赖的字段名
$number_records_to_display = 200;		//每页纪录数
$time_column = "csta_datetime";

if(!isset($sel_date)){
	$sel_date = date("Y-m-d",mktime(0,0,0,date("m"),date("d"),date("Y")));
	$timeItem = date("Y-m-d",mktime(0,0,0,date("m"),date("d"),date("Y")));
	if($DEBUG) echo "<br>sel_date=$sel_date";
}

$tmpDay = explode('-',$sel_date);
$tmpDay = $tmpDay[2];
$table_name='aasDetail'."_".$tmpDay;

$sel_field_list= @mysql_list_fields($db,$table_name);
if(!$sel_field_list){
	echo "<br>$strNotFindRecord.";
	exit();
}

$sysTypeNo=311;
switch($sysTypeNo){
	case '311':
		$helpId = "3.8";
		$callTypeDefArr=array('PPS','MSC','Invalid Calls');
		$fieldTypeDef='pps_service_attempt,pps_service_success,msc_service_attempt,msc_service_success,invalid_call';
		break;
	default:
		echo "Can not support this sysTypeNo($sysTypeNo)";
		exit();
}

?>

<?php
//合成sql语句
$order=" ORDER BY $sort_field   $sort_direction";
$limit=" LIMIT $initial_record, $number_records_to_display";

$csta_sql="SELECT * FROM $table_name ".$order;
if($DEBUG)echo "<br>csta_sql=$csta_sql";
$csta_result = mysqli_query($pubConn,$csta_sql);
$csta_rows = @mysqli_fetch_array($csta_result);
echo mysqli_error($pubConn);

//显示表头
echo "<table border=\"1\" width=\"100%\" cellpadding=\"2\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\" bgcolor=\"#FFFFFF\">";  
echo "<tr bgcolor=\"#E6E6E6\" align=\"center\">";
echo "<td rowspan=\"2\" width=\"10%\">system ID</td>";
echo "<td colspan=\"2\" width=\"30%\">PPS Service</td>";
echo "<td colspan=\"2\" width=\"30%\">MSC Service</td>";
echo "<td rowspan=\"2\" width=\"10%\">Invalid call</td>";
echo "<td rowspan=\"2\" width=\"20%\">Time($timeItem)</td>";	
echo "</tr>";
echo "<tr bgcolor=\"#E6E6E6\" align=\"center\">";
echo "<td>Attempt</td>";
echo "<td>Success</td>";
echo "<td>Attempt</td>";
echo "<td>Success</td>";
echo "</tr>";

//显示表的记录
$fieldArr=explode(',',$fieldTypeDef);
do{
	echo "<tr>";
	echo "<td align=\"center\">$csta_rows[key_sys_id]</td>";
	for($i=0;$i<sizeof($fieldArr);$i++){
		$tmpFieldName= $fieldArr[$i];
		echo "<td align=\"right\">$csta_rows[$tmpFieldName]</td>";
	}
	$tmpArray = explode(" ",$csta_rows[csta_datetime]);
	echo "<td align=\"center\">$tmpArray[1]</td>";
	echo "</tr>";
}while($csta_rows= mysqli_fetch_array($csta_result));
?>
</table>
<?php
adjust_content_tail("down");
?>
</form>
</body>
</html>