Files
agtuser 16a3fd1e1b init
2024-11-11 17:56:00 +08:00

231 lines
6.7 KiB
PHP
Executable File

<?php
/*********************************************************
程序说明:
功能说明:话务分析
调用关系:调用: connectdb.inc,header.inc
被调用:
变量说明:
返回值:无
作者:
修改注释:
NO.1
姓名:
时间:
修改说明:
*********************************************************/
require("../../inc/header.inc");
?>
<base target="_self">
<body leftmargin=12 topmargin=0>
<?php
$showDate = date("d",mktime(0,0,0,date("m"),date("d")-$sel_date,date("Y")));
$showDate = omc_keep_length($showDate,0,2);
$db = $csta_db;
$sort_field = 'csta_datetime'; //排序所依赖的字段名
$sort_direction = 'DESC'; //排序顺序
$number_records_to_display = 200; //每页纪录数
$time_column = "csta_datetime"; //时间列名
$sysType = isset($sysType)?$sysType:$DEFAULT_SYS; //设备名
$table_name = omc_table_name($sysType,'csta-q'); //取得数据库名
if($sysType == 'CNF' || $sysType == 'VPS'){
$table_name="vpsDetail";
}
$table_name = $table_name."_".$showDate;
$query_type = isset($query_type)?$query_type:'0'; //取得查询类型
$where = isset($where) ? urldecode($where) : ''; //传回变量后解url码
$where = isset($where) ? stripslashes($where) : ''; //解除一些'/'
$head_name = "&nbsp";
$title_time=date("Y-m-d", mktime(0,0,0,date("m"),date("d")-$sel_date,date("Y")));//表头显示时间
$sel_field_list= @mysql_list_fields($db,$table_name);
if(!$sel_field_list){
echo "<br>$strNotFindRecord.";
exit();
}
$sysIdFiled="key_sys_id";
$subsysIdFiled="key_subsys_id";
//-------确定日期范围-----
if($sel_date<0){
$bgn_date=date("Y-m-d H:i:s", mktime(0,0,0,date("m"),date("d")-6,date("Y")));
$end_date=date("Y-m-d H:i:s", mktime());
}elseif($sel_date>0){
if($sel_time){
$bgn_date=date("Y-m-d H:i:s", mktime($hou_1,$mid_1,$sec_1,date("m"),date("d")-$sel_date,date("Y")));
$end_date=date("Y-m-d H:i:s", mktime($hou_2,$mid_2,$sec_2,date("m"),date("d")-$sel_date,date("Y")));
}else{
$bgn_date=date("Y-m-d H:i:s", mktime(0,0,0,date("m"),date("d")-$sel_date,date("Y")));
$end_date=date("Y-m-d H:i:s", mktime(0,0,0,date("m"),date("d")-$sel_date+1,date("Y")));
}
}else{
if($sel_time){
$bgn_date=date("Y-m-d H:i:s", mktime($hou_1,$mid_1,$sec_1,date("m"),date("d")-$sel_date,date("Y")));
$end_date=date("Y-m-d H:i:s", mktime($hou_2,$mid_2,$sec_2,date("m"),date("d")-$sel_date,date("Y")));
}else{
$bgn_date=date("Y-m-d H:i:s", mktime(0,0,0,date("m"),date("d"),date("Y")));
$end_date=date("Y-m-d H:i:s", mktime());
}
}
//统计时间的总秒数
if($sel_time){
$sum_time = ($hou_2*3600+$mid_2*60+$sec_2)-($hou_1*3600+$mid_1*60+$sec_1);//指定时间的总秒数
}else{
if($sel_date<0){
$sum_time = 24*7*3600;//一星期拥有的总时间数
}elseif($sel_date>0){
$sum_time=24*3600;//一天拥有的总时间数
}else{
$hou=date("H");
$mid=date("i");
$sec=date("s");
$sum_time=$hou*3600+$mid*60+$sec;
}
}
//where语句的时间限制组成部分$w1
$w1=" $time_column >= '$bgn_date' AND $time_column <= '$end_date'";
//where语句的系统id限制组成部分$w2
if($sys_num!='-1' && $sys_num!='')
{
$w2=" AND $sysIdFiled=$sys_num";
}
//where语句的子系统id限制组成部分$w3
if($subsys_num!='-1' && $subsys_num!='')
{
$w3=" AND $subsysIdFiled=$subsys_num";
}
//where语句的E1id限制组成部分$w4
if($e1_num!='-1' && $e1_num!='')
{
$w4=" AND key_e1_tg=$e1_num";
}
//where语句的类型限制组成部分$w5
$w5=" AND key_type=2 ";
$sys_id=$sysType.$sys.$subsys.$e1;
//合成查询语句$where
$where=" WHERE ".$w0.$w1.$w2.$w3.$w4.$w5;
//echo "$where<br>";
$str_sql_all=" SELECT count(*) as number_of_records FROM $table_name ".$where;
//echo "$str_sql_all<br>";
$csta_result= mysqli_query($pubConn,$str_sql_all);
$record = mysql_fetch_object($csta_result);
$number_of_records = $record->number_of_records;
if(!$number_of_records)
{
echo $strNotFindRecord;
exit();
}
//insert log
insertLog('table',2,4);
//合成子系统编号统计的sql语句
$order_1=" ORDER BY $sysIdFiled,$subsysIdFiled";
$group_1=" GROUP BY $sysIdFiled,$subsysIdFiled";
//合成sql语句
$csta_sql_1="SELECT $sysIdFiled,$subsysIdFiled, SUM(att),SUM(ans),SUM(caller_clear),SUM(no_ans),SUM(subscriber_busy),SUM(network_busy),
SUM(call_barred),SUM(signaling_timer_expired),SUM(total_holding_time) FROM $table_name".$where.$group_1.$order_1;
//echo "$csta_sql_1<br>";
$result_1=mysqli_query($pubConn,$csta_sql_1);
$rows_1 = mysqli_fetch_array($result_1);
?>
<form method="POST" action="./saveCsv.php" name="selectform">
<table border="0" width="100%">
<tr>
<td width="25%">
</td>
<td width="50%">
<p align="center"><font size="2"><b><?php echo "CNF Statistic"; ?></b></font><font size="2"><b>&nbsp;
Date:<?php echo $title_time; ?></b></font>
</td>
<td width="20%" align="right">
<div onClick="window.print();" style="cursor:hand">
<img align=absBottom border=0 src="../../images/printer.gif" width="16" height="16">
</div>
</td>
</tr>
</table>
<table border="1" width="100%" cellpadding="2" cellspacing="0" bordercolor="#666666" bordercolordark="#FFFFFF" bgcolor="#FFFFFF">
<tr bgcolor="#E6E6E6">
<td colspan="1" align="center" height="15">&nbsp;
</td>
<td colspan="10" align="center" height="15"><b>&nbsp;
<?php
if($sysType == $DEFAULT_SYS)
echo "1.$head_name";
?>
</b></td>
</td>
</tr>
<tr bgcolor="#EFEFEF">
<td align="center"><?php echo $strSystem; ?></td>
<td align="center"><?php echo $strAttemptedCall; ?></td>
<td align="center"><?php echo "$strAnswer"; ?></td>
<td align="center"><?php echo "$strCallerClear"; ?></td>
<td align="center"><?php echo "$strNoAnswer"; ?></td>
<td align="center"><?php echo "Conference full"; ?></td>
<td align="center"><?php echo "Password error"; ?></td>
<td align="center"><?php echo "Call rejected"; ?></td>
<td align="center"><?php echo "Signal timeout"; ?></td>
<td align="center"><?php echo "$strTotalHoldingTime"; ?></td>
<td align="center"><?php echo "$strAverageCallDuration"; ?></td>
</tr>
<?php
do{
?>
<tr>
<td align="center">
<?php
$row[0]=$rows_1[0];
$row[1]=$rows_1[1];
echo $sysType."_"."$row[0]_$row[1]";
?>
</td>
<td align="center"><?php echo $rows_1[2];?></td>
<td align="center"><?php echo $rows_1[3];?></td>
<td align="center"><?php echo $rows_1[4];?></td>
<td align="center"><?php echo $rows_1[5];?></td>
<td align="center"><?php echo $rows_1[6];?></td>
<td align="center"><?php echo $rows_1[7];?></td>
<td align="center"><?php echo $rows_1[8];?></td>
<td align="center"><?php echo $rows_1[9];?></td>
<?php
$format_1=Second2format($rows_1[10]*6);
?>
<td align="center"><?php echo $format_1;?></td>
<?php
if(($rows_1[3]+$rows_1[12])>0)
{
$aht_1=round($rows_1[10]*6/$rows_1[3]);
}
else
{
$aht_1=0;
}
?>
<td align="center"><?php echo $aht_1;?></td>
</tr>
<?php
}while($rows_1 = @mysqli_fetch_array($result_1));
?>
</table>
</form>
</body>
</html>