From e8529862fe4ad1472b6c63a4a878520f0115e2a5 Mon Sep 17 00:00:00 2001 From: mattf Date: Wed, 13 Sep 2017 13:09:41 +0000 Subject: [PATCH] Added Agent Inbound Status Summary Report git-svn-id: svn://192.168.202.10@2813 3d104415-ff17-0410-8863-d5cf3c621b8a --- UPGRADE | 2 + www/vicidial/AST_agent_inbound_status.php | 1292 +++++++++++++++++++++ www/vicidial/admin.php | 11 +- www/vicidial/user_status.php | 4 + 4 files changed, 1305 insertions(+), 4 deletions(-) create mode 100644 www/vicidial/AST_agent_inbound_status.php diff --git a/UPGRADE b/UPGRADE index 76159913..5789da66 100644 --- a/UPGRADE +++ b/UPGRADE @@ -192,6 +192,8 @@ OTHER CHANGES: 45. Added Inbound DID Summary Report +46. Added Agent Inbound Status Summary Report + diff --git a/www/vicidial/AST_agent_inbound_status.php b/www/vicidial/AST_agent_inbound_status.php new file mode 100644 index 00000000..e69250eb --- /dev/null +++ b/www/vicidial/AST_agent_inbound_status.php @@ -0,0 +1,1292 @@ + LICENSE: AGPLv2 +# +# CHANGES +# +# 170913-0853 - First build based upon AST_agent_status_detail.php +# + +$startMS = microtime(); + +require("dbconnect_mysqli.php"); +require("functions.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];} + elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["user_group"])) {$user_group=$_GET["user_group"];} + elseif (isset($_POST["user_group"])) {$user_group=$_POST["user_group"];} +if (isset($_GET["shift"])) {$shift=$_GET["shift"];} + elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];} +if (isset($_GET["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["file_download"])) {$file_download=$_GET["file_download"];} + elseif (isset($_POST["file_download"])) {$file_download=$_POST["file_download"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["report_display_type"])) {$report_display_type=$_GET["report_display_type"];} + elseif (isset($_POST["report_display_type"])) {$report_display_type=$_POST["report_display_type"];} +if (isset($_GET["search_archived_data"])) {$search_archived_data=$_GET["search_archived_data"];} + elseif (isset($_POST["search_archived_data"])) {$search_archived_data=$_POST["search_archived_data"];} +if (isset($_GET["show_defunct_users"])) {$show_defunct_users=$_GET["show_defunct_users"];} + elseif (isset($_POST["show_defunct_users"])) {$show_defunct_users=$_POST["show_defunct_users"];} + +if (strlen($shift)<2) {$shift='ALL';} +if ($search_archived_data=="checked") {$closer_log_table="vicidial_closer_log_archive";} else {$closer_log_table="vicidial_closer_log";} + +$report_name = 'Agent Inbound Status Summary'; +$db_source = 'M'; + +$JS_text="\n"; + echo "\n"; + echo "\n"; + require("chart_button.php"); + echo "\n"; + echo "\n"; + + echo "\n"; + echo "$report_name\n"; + echo ""; + + $short_header=1; + + require("admin_header.php"); + + echo "\n"; + echo "\n"; + echo ""._QXZ("$report_name")." $NWB#agent_status_detail$NWE\n"; + echo "
";
+	}
+
+if ( (strlen($group[0]) < 1) or (strlen($user_group[0]) < 1) )
+	{
+	echo "
";
+	echo "PLEASE SELECT A CAMPAIGN OR USER GROUP AND DATE-TIME BELOW AND CLICK SUBMIT\n";
+	echo " NOTE: stats taken from shift specified\n";
+	}
+
+else
+	{
+	if ($shift == 'AM') 
+		{
+		$time_BEGIN=$AM_shift_BEGIN;
+		$time_END=$AM_shift_END;
+		if (strlen($time_BEGIN) < 6) {$time_BEGIN = "03:45:00";}   
+		if (strlen($time_END) < 6) {$time_END = "15:14:59";}
+		}
+	if ($shift == 'PM') 
+		{
+		$time_BEGIN=$PM_shift_BEGIN;
+		$time_END=$PM_shift_END;
+		if (strlen($time_BEGIN) < 6) {$time_BEGIN = "15:15:00";}
+		if (strlen($time_END) < 6) {$time_END = "23:15:00";}
+		}
+	if ($shift == 'ALL') 
+		{
+		if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
+		if (strlen($time_END) < 6) {$time_END = "23:59:59";}
+		}
+	$query_date_BEGIN = "$query_date $time_BEGIN";   
+	$query_date_END = "$end_date $time_END";
+
+	if ($file_download < 1)
+		{
+		$ASCII_text.=_QXZ("$report_name")." Report                     $NOW_TIME ($db_source)\n";
+		$ASCII_text.="Time range: $query_date_BEGIN to $query_date_END\n\n";
+		$HTML_text.=_QXZ("$report_name")." Report                     $NOW_TIME ($db_source)\n";
+		$HTML_text.="Time range: $query_date_BEGIN to $query_date_END\n\n";
+		}
+	else
+		{
+		$file_output .= _QXZ("$report_name")." Report                     $NOW_TIME\n";
+		$file_output .= "Time range: $query_date_BEGIN to $query_date_END\n\n";
+		}
+
+	$statuses='-';
+	$statusesTXT='';
+	$statusesHEAD='';
+	$statusesHTML='';
+	$statusesFILE='';
+	$statusesARY[0]='';
+	$j=0;
+	$users='-';
+	$usersARY[0]='';
+	$user_namesARY[0]='';
+	$k=0;
+
+	if ($show_defunct_users) 
+		{
+		$user_stmt="SELECT distinct '' as full_name, user from ".$closer_log_table." where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN'  and status is not null $group_SQL $user_group_SQL order by user asc";
+		}
+	else
+		{
+		$user_stmt="SELECT distinct full_name,vicidial_users.user from vicidial_users,".$closer_log_table." where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' and vicidial_users.user=".$closer_log_table.".user and status is not null $group_SQL $user_group_SQL order by full_name asc";
+		}
+
+		if ($DB) {echo "$user_stmt\n";}
+	$user_rslt=mysql_to_mysqli($user_stmt, $link);
+	$q=0;
+	while($q0) 
+				{
+				$defunct_user_row=mysqli_fetch_row($defunct_user_rslt);
+				$full_name_val=$defunct_user_row[0];
+				} 
+			else 
+				{
+				$full_name_val=$user_row[1];
+				}
+			}
+		else 
+			{
+			$full_name_val=$user_row[0];
+			}
+
+		$full_name[$q] =	$full_name_val;
+		$user[$q] =			$user_row[1];
+
+		if (!preg_match("/\-$user[$q]\-/i", $users))
+			{
+			$users .= "$user[$q]-";
+			$usersARY[$k] = $user[$q];
+			$user_namesARY[$k] = $full_name[$q];
+			$k++;
+			}
+		$q++;
+		}
+
+	if ($show_defunct_users) 
+		{
+		$status_stmt="SELECT distinct status from ".$closer_log_table." where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' and status is not null $group_SQL $user_group_SQL order by status";
+		}
+	else
+		{
+		$status_stmt="SELECT distinct status from vicidial_users,".$closer_log_table." where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' and vicidial_users.user=".$closer_log_table.".user $group_SQL $user_group_SQL order by status";
+		}
+
+		if ($DB) {echo "$status_stmt\n";}
+	$status_rslt=mysql_to_mysqli($status_stmt, $link);
+	$q=0;
+	$status_rows_to_print=0; $sub_status_count=0;
+	while($status_row=mysqli_fetch_row($status_rslt)) 
+		{
+		$current_status=$status_row[0];
+
+		if ($show_defunct_users) 
+			{
+			$stmt="SELECT count(*) as calls,'' as full_name,user,status from ".$closer_log_table." where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' and status='$current_status' $group_SQL $user_group_SQL group by user,full_name,status order by full_name,user,status desc limit 500000;";
+			}
+		else
+			{
+			$stmt="SELECT count(*) as calls,full_name,vicidial_users.user,status from vicidial_users,".$closer_log_table." where call_date <= '$query_date_END' and call_date >= '$query_date_BEGIN' and vicidial_users.user=".$closer_log_table.".user and status='$current_status' $group_SQL $user_group_SQL group by user,full_name,status order by full_name,user,status desc limit 500000;";
+			}
+		$rslt=mysql_to_mysqli($stmt, $link);
+		if ($DB) {echo "$stmt\n";}
+		$status_rows_to_print = mysqli_num_rows($rslt);
+		$rows_to_print+=$status_rows_to_print;
+		$i=0; 
+		while ($i < $status_rows_to_print)
+			{
+			$row=mysqli_fetch_row($rslt);
+
+			if ($show_defunct_users)
+				{
+				$defunct_user_stmt="SELECT full_name,user_group from vicidial_users where user='$row[2]'";
+				$defunct_user_rslt=mysql_to_mysqli($defunct_user_stmt, $link);
+				if (mysqli_num_rows($defunct_user_rslt)>0) 
+					{
+					$defunct_user_row=mysqli_fetch_row($defunct_user_rslt);
+					$full_name_val=$defunct_user_row[0];
+					} 
+				else 
+					{
+					$full_name_val=$row[2];
+					}
+				}
+			else 
+				{
+				$full_name_val=$row[1];
+				}
+
+
+			if ( ($row[0] > 0) and (strlen($row[2]) > 0) and (strlen($row[3]) > 0) and (!preg_match("/NULL/i",$row[3])))
+				{
+				$calls[$q] =		$row[0];
+				$full_name[$q] =	$full_name_val;
+				$user[$q] =			$row[2];
+				$status[$q] =		$row[3];
+				if ( (!preg_match("/-$status[$q]-/i", $statuses)) and (strlen($status[$q])>0) )
+					{
+					$statusesTXT = sprintf("%8s", $status[$q]);
+					$statusesHEAD .= "----------+";
+					$statusesHTML .= " $statusesTXT |";
+					$HTML_statuses .= " $statusesTXT ";
+					$statusesFILE .= "$statusesTXT,";
+					$statuses .= "$status[$q]-";
+					$statusesARY[$j] = $status[$q];
+
+					$sub_statusesARY[$sub_status_count] = $status[$q];
+					$sub_status_count++;
+					$max_varname="max_".$status[$q];
+					$$max_varname=1;
+
+					$j++;
+					}
+				if (!preg_match("/\-$user[$q]\-/i", $users))
+					{
+					$users .= "$user[$q]-";
+					$usersARY[$k] = $user[$q];
+					$user_namesARY[$k] = $full_name[$q];
+					$k++;
+					}
+				}
+			$i++;
+			$q++;
+			}
+		}
+
+	if ($file_download < 1)
+		{
+		$ASCII_text.="INBOUND CALLS STATS BREAKDOWN:\n";
+		$ASCII_text.="+---------------------------+----------+--------+--------+--------+$statusesHEAD\n";
+		$ASCII_text.="| USER NAME                 | ID       | CALLS  | CIcalls| DNC/CI%|$statusesHTML\n";
+		$ASCII_text.="+---------------------------+----------+--------+--------+--------+$statusesHEAD\n";
+
+		$HTML_text.="INBOUND CALLS STATS BREAKDOWN:
\n"; + $HTML_text.=""; + $HTML_text.=""; + $HTML_text.=""; + $HTML_text.=""; + $HTML_text.=""; + $HTML_text.=""; + $HTML_text.=""; + $HTML_text.=$HTML_statuses; + $HTML_text.=""; + + } + else + { + $file_output .= "USER,ID,CALLS,CIcalls,DNC-CI%,$statusesFILE\n"; + } + + + ### BEGIN loop through each user ### + $m=0; + $CIScountTOT=0; + $DNCcountTOT=0; + + $graph_stats=array(); + $max_calls=1; + $max_cicalls=1; + $max_dncci=1; + + while ($m < $k) + { + $Suser=$usersARY[$m]; + $Sfull_name=$user_namesARY[$m]; + $Scalls=0; + $SstatusesHTML=''; + $SstatusesHTMLpct=''; + $SHTML_statuses=''; + $SHTML_statusespct=''; + $SstatusesFILE=''; + $SstatusesFILEpct=''; + $CIScount=0; + $DNCcount=0; + + ### BEGIN loop through each status ### + $n=0; + while ($n < $j) + { + $Sstatus=$statusesARY[$n]; + $SstatusTXT=''; + $varname=$Sstatus."_graph"; + $$varname=$graph_header.""; + $max_varname="max_".$Sstatus; + ### BEGIN loop through each stat line ### + $i=0; $status_found=0; + while ($i < $rows_to_print) + { + if ( ($Suser=="$user[$i]") and ($Sstatus=="$status[$i]") ) + { + $Scalls = ($Scalls + $calls[$i]); + if (preg_match("/\|$status[$i]\|/i",$customer_interactive_statuses)) + { + $CIScount = ($CIScount + $calls[$i]); + $CIScountTOT = ($CIScountTOT + $calls[$i]); + } + if (preg_match("/DNC/i", $status[$i])) + { + $DNCcount = ($DNCcount + $calls[$i]); + $DNCcountTOT = ($DNCcountTOT + $calls[$i]); + } + + if ($calls[$i]>$$max_varname) {$$max_varname=$calls[$i];} + $graph_stats[$m][(4+$n)]=$calls[$i]; + + $SstatusTXT = sprintf("%8s", $calls[$i]); + $SstatusesHTML .= " $SstatusTXT |"; + $SHTML_statuses .= ""; + $SstatusesFILE .= "$calls[$i],"; + $status_found++; + } + $i++; + } + if ($status_found < 1) + { + $graph_stats[$m][(4+$n)]=0; + $SstatusesHTML .= " 0 |"; + $SHTML_statuses .= ""; + $SstatusesFILE .= "0,"; + } + ### END loop through each stat line ### + $n++; + } + ### END loop through each status ### + $TOTcalls=($TOTcalls + $Scalls); + + $RAWuser = $Suser; + $RAWcalls = $Scalls; + $RAWcis = $CIScount; + $Scalls = sprintf("%6s", $Scalls); + $CIScount = sprintf("%6s", $CIScount); + + ### BEGIN loop through each status again to get the damn percentages ### + $n=0; + while ($n < $j) + { + $Sstatus=$statusesARY[$n]; + ### BEGIN loop through each stat line ### + $i=0; $status_found=0; + while ($i < $rows_to_print) + { + if ( ($Suser=="$user[$i]") and ($Sstatus=="$status[$i]") ) + { + $SstatusTXTpct = sprintf("%6.1f", (100*($calls[$i]/$Scalls))); # + $SstatusesHTMLpct .= " $SstatusTXTpct % |"; + $SHTML_statusespct .= ""; + $SstatusesFILEpct .= trim($SstatusTXTpct)."%,"; + $status_found++; + } + $i++; + } + if ($status_found < 1) + { + $SstatusesHTMLpct .= " 0.0 % |"; + $SHTML_statusespct .= ""; + $SstatusesFILEpct .= "0.0%,"; + } + ### END loop through each stat line ### + $n++; + } + ### END loop through each status ### + + if ($file_download<1) + { + if ($non_latin < 1) + { + $Sfull_name= sprintf("%-25s", $Sfull_name); + while(strlen($Sfull_name)>25) {$Sfull_name = substr("$Sfull_name", 0, -1);} + $Suser = sprintf("%-8s", $Suser); + while(strlen($Suser)>8) {$Suser = substr("$Suser", 0, -1);} + } + else + { + $Sfull_name= sprintf("%-75s", $Sfull_name); + while(mb_strlen($Sfull_name,'utf-8')>25) {$Sfull_name = mb_substr("$Sfull_name", 0, -1,'utf-8');} + + $Suser = sprintf("%-24s", $Suser); + while(mb_strlen($Suser,'utf-8')>8) {$Suser = mb_substr("$Suser", 0, -1,'utf-8');} + } + } + $DNCcountPCTs = ( MathZDC($DNCcount, $CIScount) * 100); + $RAWdncPCT = $DNCcountPCTs; + # $DNCcountPCTs = round($DNCcountPCTs,2); + $DNCcountPCTs = round($DNCcountPCTs); + $rawDNCcountPCTs = $DNCcountPCTs; + # $DNCcountPCTs = sprintf("%3.2f", $DNCcountPCTs); + $DNCcountPCTs = sprintf("%6s", $DNCcountPCTs); + + if (trim($Scalls)>$max_calls) {$max_calls=trim($Scalls);} + if (trim($CIScount)>$max_cicalls) {$max_cicalls=trim($CIScount);} + if (trim($DNCcountPCTs)>$max_dncci) {$max_dncci=trim($DNCcountPCTs);} + $graph_stats[$m][1]=trim("$Scalls"); + $graph_stats[$m][2]=trim("$CIScount"); + $graph_stats[$m][3]=trim("$DNCcountPCTs"); + + if ($file_download < 1) + { + $Toutput = "| $Sfull_name | $Suser | $Scalls | $CIScount | $DNCcountPCTs%|$SstatusesHTML\n"; + $Toutput .= "| ".sprintf("%-25s", " ")." | ".sprintf("%-8s", " ")." | ".sprintf("%-6s", " ")." | ".sprintf("%-6s", " ")." | ".sprintf("%-6s", " ")." |$SstatusesHTMLpct\n"; + $Toutput .= "+---------------------------+----------+--------+--------+--------+$statusesHEAD\n"; + + if ($m%2==0) {$bgcolor=$SSstd_row2_background;} else {$bgcolor=$SSstd_row1_background;} + $ToutputHTML = "$SHTML_statuses\n"; + $ToutputHTML .= "$SHTML_statusespct\n"; + + # $graph_stats[$m][0]=trim("$user_namesARY[$m] - $usersARY[$m]"); + } + else + { + $fileToutput = "$Sfull_name,$RAWuser,$RAWcalls,$RAWcis,$rawDNCcountPCTs%,$SstatusesFILE\n"; + $fileToutput .= ",,,,,$SstatusesFILEpct\n"; + } + + $TOPsorted_output[$m] = $Toutput; + $TOPsorted_outputFILE[$m] = $fileToutput; + $TOPsorted_outputHTML[$m] = $ToutputHTML; + + if ($stage == 'ID') + { + $TOPsort[$m] = '' . sprintf("%08s", $RAWuser) . '-----' . $m . '-----' . sprintf("%020s", $RAWuser); + $TOPsortTALLY[$m]=$RAWcalls; + } + if ($stage == 'LEADS') + { + $TOPsort[$m] = '' . sprintf("%08s", $RAWcalls) . '-----' . $m . '-----' . sprintf("%020s", $RAWuser); + $TOPsortTALLY[$m]=$RAWcalls; + } + if ($stage == 'TIME') + { + $TOPsort[$m] = '' . sprintf("%08s", $Stime) . '-----' . $m . '-----' . sprintf("%020s", $RAWuser); + $TOPsortTALLY[$m]=$Stime; + } + if ($stage == 'CI') + { + $TOPsort[$m] = '' . sprintf("%08s", $RAWcis) . '-----' . $m . '-----' . sprintf("%020s", $RAWuser); + $TOPsortTALLY[$m]=$RAWcis; + } + if ($stage == 'DNCCI') + { + $TOPsort[$m] = '' . sprintf("%08s", $RAWdncPCT) . '-----' . $m . '-----' . sprintf("%020s", $RAWuser); + $TOPsortTALLY[$m]=$RAWdncPCT; + } + if (!preg_match('/ID|TIME|LEADS|CI|DNCCI/',$stage)) + if ($file_download < 1) + { + $ASCII_text.="$Toutput"; + $HTML_text.="$ToutputHTML"; + } + else + {$file_output .= "$fileToutput";} + + if ($TOPsortMAX < $TOPsortTALLY[$m]) {$TOPsortMAX = $TOPsortTALLY[$m];} + + $m++; + } + ### END loop through each user ### + + $TOT_AGENTS = sprintf("%4s", $m); + + + ### BEGIN sort through output to display properly ### + if (preg_match('/ID|TIME|LEADS|CI|DNCCI/',$stage)) + { + if (preg_match('/ID/',$stage)) + {sort($TOPsort, SORT_NUMERIC);} + if (preg_match('/TIME|LEADS|CI|DNCCI/',$stage)) + {rsort($TOPsort, SORT_NUMERIC);} + + $m=0; + while ($m < $k) + { + $sort_split = explode("-----",$TOPsort[$m]); + $i = $sort_split[1]; + $sort_order[$m] = "$i"; + if ($file_download < 1) + { + $ASCII_text.="$TOPsorted_output[$i]"; + $HTML_text.="$TOPsorted_outputHTML[$i]"; + } + else + {$file_output .= "$TOPsorted_outputFILE[$i]";} + $m++; + } + } + ### END sort through output to display properly ### + + + + ###### LAST LINE FORMATTING ########## + ### BEGIN loop through each status ### + $SUMstatusesHTML=''; + $SUMstatusesFILE=''; + $SUMHTML_statuses=''; + $SUMstatusesHTMLpct=''; + $SUMstatusesFILEpct=''; + $SUMHTML_statusespct=''; + $n=0; + while ($n < $j) + { + $Scalls=0; + $Sstatus=$statusesARY[$n]; + $SUMstatusTXT=''; + $total_var=$Sstatus."_total"; + ### BEGIN loop through each stat line ### + $i=0; $status_found=0; + while ($i < $rows_to_print) + { + if ($Sstatus=="$status[$i]") + { + $Scalls = ($Scalls + $calls[$i]); + $status_found++; + } + $i++; + } + ### END loop through each stat line ### + if ($status_found < 1) + { + $SUMstatusesHTML .= " 0 |"; + $$total_var="0"; + } + else + { + $SUMstatusTXT = sprintf("%8s", $Scalls); + $SUMstatusesHTML .= " $SUMstatusTXT |"; + $SUMHTML_statuses .= ""; + $SUMstatusesFILE .= "$SUMstatusTXT,"; + $$total_var=$Scalls; + } + $n++; + } + ### END loop through each status ### + + $n=0; + while ($n < $j) + { + $Scalls=0; + $Sstatus=$statusesARY[$n]; + ### BEGIN loop through each stat line ### + $i=0; $status_found=0; + while ($i < $rows_to_print) + { + if ($Sstatus=="$status[$i]") + { + $Scalls = ($Scalls + $calls[$i]); + $status_found++; + } + $i++; + } + ### END loop through each stat line ### + if ($status_found < 1) + { + $SUMstatusesHTMLpct .= " 0.0% |"; + $SUMstatusesFILEpct .= "0.0%,"; + $SUMHTML_statusespct .= ""; + } + else + { + $SstatusTXTpct = sprintf("%6.1f", (100*($Scalls/$TOTcalls))); # + $SUMstatusesHTMLpct .= " $SstatusTXTpct % |"; + $SUMHTML_statusespct .= ""; + $SUMstatusesFILEpct .= trim($SstatusTXTpct)."%,"; + } + $n++; + } + ### END loop through each status ### + + $TOTcalls = sprintf("%7s", $TOTcalls); + $CIScountTOT = sprintf("%7s", $CIScountTOT); + $DNCcountPCT = ( MathZDC($DNCcountTOT, $CIScountTOT) * 100); + $DNCcountPCT = round($DNCcountPCT,2); + $DNCcountPCT = sprintf("%3.2f", $DNCcountPCT); + $DNCcountPCT = ( MathZDC($DNCcountTOT, $CIScountTOT) * 100); + #$DNCcountPCT = round($DNCcountPCT,2); + $DNCcountPCT = round($DNCcountPCT); + #$DNCcountPCT = sprintf("%3.2f", $DNCcountPCT); + $DNCcountPCT = sprintf("%6s", $DNCcountPCT); + + if ($file_download < 1) + { + $ASCII_text.="+---------------------------+----------+--------+--------+--------+$statusesHEAD\n"; + $ASCII_text.="| TOTALS AGENTS:$TOT_AGENTS | $TOTcalls| $CIScountTOT| $DNCcountPCT%|$SUMstatusesHTML\n"; + $ASCII_text.="| ".sprintf("%-36s", " ")." | ".sprintf("%-6s", " ")." | ".sprintf("%-6s", " ")." | ".sprintf("%-6s", " ")." |$SUMstatusesHTMLpct\n"; + $ASCII_text.="+--------------------------------------+--------+--------+--------+$statusesHEAD\n"; + + $ASCII_text.="\n\n"; + + $HTML_text.=""; + $HTML_text.=""; + $HTML_text.=""; + $HTML_text.=""; + $HTML_text.=""; + $HTML_text.=$SUMHTML_statuses; + $HTML_text.=""; + $HTML_text.=""; + $HTML_text.=""; + $HTML_text.=$SUMHTML_statusespct; + $HTML_text.=""; + $HTML_text.="
 USER NAME  ID  CALLS  CIcalls  DNC/CI% 
$Sstatus
$calls[$i]0(".trim($SstatusTXTpct)."%)(0.0 %)
$Sfull_name$Suser$Scalls$CIScount$DNCcountPCTs%
 
$SUMstatusTXT(0.0%)(".trim($SstatusTXTpct)."%)
TOTALS      AGENTS:$TOT_AGENTS$TOTcalls$CIScountTOT$DNCcountPCT%
 
"; + +/* + # USE THIS FOR COMBINED graphs, use pipe-delimited array elements, dataset_name|index|link_name|graph_override + # You have to hard code the graph name in where it is overridden and mind the data indices. No other way to do it. + $multigraph_text=""; + $graph_id++; + $graph_array=array("ASD_CALLSdata|1|CALLS|integer|", "ASD_CICALLSdata|2|CI/CALLS|integer|", "ASD_DNCCIdata|3|DNC/CI|percent|"); + + for ($e=0; $e"._QXZ("TOTAL")." - ".sec_convert($current_graph_total, 'H')." \n"; + $chart_options="options: {tooltips: {callbacks: {label: function(tooltipItem, data) {var value = Math.round(data.datasets[0].data[tooltipItem.index]); return value.toHHMMSS();}}}, legend: { display: false }},"; + break; + case "percent": + $graph_totals_array[$q]=""; + $chart_options="options: {tooltips: {callbacks: {label: function(tooltipItem, data) {var value = data.datasets[0].data[tooltipItem.index]; return value + '%';}}}, legend: { display: false }},"; + break; + default: + $graph_totals_array[$q]=" "._QXZ("TOTAL").": $current_graph_total\n"; + $chart_options="options: { legend: { display: false }},"; + break; + } + + $datasets.=$data; + $datasets.=$graphConstantsA.$graphConstantsB.$graphConstantsC.$graphConstants; # SEE TOP OF SCRIPT + $datasets.="\t\t\t}\n"; + $datasets.="\t\t]\n"; + $datasets.="\t}\n"; + + $JS_text.=$labels.$datasets; + # $JS_text.="}\n"; + # $JS_text.="prepChart('$default_graph', $graph_id, $q, $dataset_name);\n"; + $JS_text.="var main_ctx = document.getElementById(\"CanvasID".$graph_id."_".$q."\");\n"; + $JS_text.="var GraphID".$graph_id."_".$q." = new Chart(main_ctx, {type: '$default_graph', $chart_options data: $dataset_name});\n"; + } + + + $graph_count=count($graph_array); + $graph_title=_QXZ("AGENT STATUS DETAIL REPORT"); + include("graphcanvas.inc"); + $GRAPH.=$graphCanvas; +*/ + } + else + { + $file_output .= "TOTALS,$TOT_AGENTS,$TOTcalls,$CIScountTOT,$DNCcountPCT%,$SUMstatusesFILE\n"; + $file_output .= ",,,,,$SUMstatusesFILEpct\n"; + } + } + +if ($file_download > 0) + { + $FILE_TIME = date("Ymd-His"); + $CSVfilename = "AGENT_STATUS$US$FILE_TIME.csv"; + + // We'll be outputting a TXT file + header('Content-type: application/octet-stream'); + + // It will be called LIST_101_20090209-121212.txt + header("Content-Disposition: attachment; filename=\"$CSVfilename\""); + header('Expires: 0'); + header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); + header('Pragma: public'); + ob_clean(); + flush(); + + echo "$file_output"; + + if ($db_source == 'S') + { + mysqli_close($link); + $use_slave_server=0; + $db_source = 'M'; + require("dbconnect_mysqli.php"); + } + + $endMS = microtime(); + $startMSary = explode(" ",$startMS); + $endMSary = explode(" ",$endMS); + $runS = ($endMSary[0] - $startMSary[0]); + $runM = ($endMSary[1] - $startMSary[1]); + $TOTALrun = ($runS + $runM); + + $stmt="UPDATE vicidial_report_log set run_time='$TOTALrun' where report_log_id='$report_log_id';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_to_mysqli($stmt, $link); + + exit; + } + +$JS_onload.="}\n"; +if ($report_display_type=='HTML') {$JS_text.=$JS_onload;} +$JS_text.="\n"; + +echo "
"; +echo "
Dates:
"; +echo "\n"; +echo ""; + +?> + + to
"; + +?> + +
Inbound groups:
"; +echo "\n"; +echo "
User Groups:
"; +echo "\n"; +echo "
Shift:
"; +echo "

\n"; +echo "Display as:
"; +echo "\n

"; +echo "

"; +echo ""._QXZ("Search archived data")."
\n"; +echo ""._QXZ("Show defunct users")."

\n"; +echo "       \n"; +echo "
        "; + +echo "          \n"; +echo " DOWNLOAD | \n"; +echo " REPORTS "; +echo "\n"; +echo "
"; + +echo "
"; + +if ($report_display_type=="HTML") + { + echo $HTML_text; + } +else + { + echo $ASCII_text; + } + + +echo "\n"; + +if (!$report_display_type || $report_display_type=="TEXT") + { + echo "\n"; + echo "
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
+
+	$m=0;
+	while ($m < $k)
+		{
+		$sort_split = explode("-----",$TOPsort[$m]);
+		$i = $sort_split[1];
+		$sort_order[$m] = "$i";
+
+		if ( ($TOPsortTALLY[$i] < 1) or ($TOPsortMAX < 1) )
+			{echo "                              \n";}
+		else
+			{
+			echo "                              ";
+			$TOPsortPLOT = ( MathZDC($TOPsortTALLY[$i], $TOPsortMAX) * 110 );
+			$h=0;
+			while ($h <= $TOPsortPLOT)
+				{
+				echo " ";
+				$h++;
+				}
+			echo "\n";
+			}
+		$m++;
+		}
+
+	echo "\n";
+	}
+
+if ($db_source == 'S')
+	{
+	mysqli_close($link);
+	$use_slave_server=0;
+	$db_source = 'M';
+	require("dbconnect_mysqli.php");
+	}
+
+$endMS = microtime();
+$startMSary = explode(" ",$startMS);
+$endMSary = explode(" ",$endMS);
+$runS = ($endMSary[0] - $startMSary[0]);
+$runM = ($endMSary[1] - $startMSary[1]);
+$TOTALrun = ($runS + $runM);
+
+$stmt="UPDATE vicidial_report_log set run_time='$TOTALrun' where report_log_id='$report_log_id';";
+if ($DB) {echo "|$stmt|\n";}
+$rslt=mysql_to_mysqli($stmt, $link);
+
+?>
+
+
diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php
index 63e6f312..70108960 100644
--- a/www/vicidial/admin.php
+++ b/www/vicidial/admin.php
@@ -120,9 +120,9 @@ $PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
 $PHP_SELF=$_SERVER['PHP_SELF'];
 $QUERY_STRING = getenv("QUERY_STRING");
 
-$Vreports = 'NONE, Real-Time Main Report, Real-Time Campaign Summary, Inbound Report, Inbound Report by DID, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound DID Summary Report, Agent DID Report, Inbound IVR Report, Inbound Forecasting Report, Advanced Forecasting Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Fronter - Closer Report, Fronter - Closer Detail Report, Lists Campaign Statuses Report, Lists Statuses Report, Campaign Status List Report, Export Calls Report, Export Leads Report, Agent Time Detail, Agent Status Detail, Agent Performance Detail, Team Performance Detail, Performance Comparison Report, Single Agent Daily, Single Agent Daily Time, User Group Login Report, User Group Hourly Report, User Group Detail Hourly Report, User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report, Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Maximum System Stats, Maximum Stats Detail, Search Leads Logs, Email Log Report, Carrier Log Report, Campaign Debug, Asterisk Debug, Hangup Cause Report, Lists Pass Report, Called Counts List IDs Report, Agent Debug Log Report, Agent Parked Call Report, Agent-Manager Chat Log, Recording Access Log Report, API Log Report, Real-Time Monitoring Log Report';
+$Vreports = 'NONE, Real-Time Main Report, Real-Time Campaign Summary, Inbound Report, Inbound Report by DID, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound DID Summary Report, Agent DID Report, Inbound IVR Report, Inbound Forecasting Report, Advanced Forecasting Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Fronter - Closer Report, Fronter - Closer Detail Report, Lists Campaign Statuses Report, Lists Statuses Report, Campaign Status List Report, Export Calls Report, Export Leads Report, Agent Time Detail, Agent Status Detail, Agent Inbound Status Summary, Agent Performance Detail, Team Performance Detail, Performance Comparison Report, Single Agent Daily, Single Agent Daily Time, User Group Login Report, User Group Hourly Report, User Group Detail Hourly Report, User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report, Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Maximum System Stats, Maximum Stats Detail, Search Leads Logs, Email Log Report, Carrier Log Report, Campaign Debug, Asterisk Debug, Hangup Cause Report, Lists Pass Report, Called Counts List IDs Report, Agent Debug Log Report, Agent Parked Call Report, Agent-Manager Chat Log, Recording Access Log Report, API Log Report, Real-Time Monitoring Log Report';
 
-$UGreports = 'ALL REPORTS, NONE, Real-Time Main Report, Real-Time Campaign Summary, Inbound Report, Inbound Report by DID, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound DID Summary Report, Agent DID Report, Inbound Email Report, Inbound Chat Report, Inbound IVR Report, Inbound Forecasting Report, Advanced Forecasting Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Fronter - Closer Report, Fronter - Closer Detail Report, Lists Campaign Statuses Report, Lists Statuses Report, Campaign Status List Report, Export Calls Report, Export Leads Report, Agent Time Detail, Agent Status Detail, Agent Performance Detail, Team Performance Detail, Performance Comparison Report, Single Agent Daily, Single Agent Daily Time, User Group Login Report, User Group Hourly Report, User Group Detail Hourly Report, User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report, Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Custom Reports Links, CallCard Search, Maximum System Stats, Maximum Stats Detail, Search Leads Logs, Email Log Report, Lists Pass Report, Called Counts List IDs Report, Front Page System Summary, Report Page Servers Summary, Admin Utilities Page, Agent Debug Log Report, Agent Parked Call Report, Agent-Manager Chat Log, Recording Access Log Report, API Log Report, Real-Time Monitoring Log Report';
+$UGreports = 'ALL REPORTS, NONE, Real-Time Main Report, Real-Time Campaign Summary, Inbound Report, Inbound Report by DID, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound DID Summary Report, Agent DID Report, Inbound Email Report, Inbound Chat Report, Inbound IVR Report, Inbound Forecasting Report, Advanced Forecasting Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Fronter - Closer Report, Fronter - Closer Detail Report, Lists Campaign Statuses Report, Lists Statuses Report, Campaign Status List Report, Export Calls Report, Export Leads Report, Agent Time Detail, Agent Status Detail, Agent Inbound Status Summary, Agent Performance Detail, Team Performance Detail, Performance Comparison Report, Single Agent Daily, Single Agent Daily Time, User Group Login Report, User Group Hourly Report, User Group Detail Hourly Report, User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report, Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Custom Reports Links, CallCard Search, Maximum System Stats, Maximum Stats Detail, Search Leads Logs, Email Log Report, Lists Pass Report, Called Counts List IDs Report, Front Page System Summary, Report Page Servers Summary, Admin Utilities Page, Agent Debug Log Report, Agent Parked Call Report, Agent-Manager Chat Log, Recording Access Log Report, API Log Report, Real-Time Monitoring Log Report';
 
 $Vtables = 'NONE,log_noanswer,did_agent_log,contact_information';
 
@@ -4170,12 +4170,13 @@ else
 # 170821-2009 - Fix for issue #1036
 # 170825-1708 - Added filename_override option for Automated Reports, added more space for report_times
 # 170828-2105 - Added Inbound DID Summary Report
+# 170913-0908 - Added Agent Inbound Status Summary Report
 #
 
 # make sure you have added a user to the vicidial_users MySQL table with at least user_level 9 to access this page the first time
 
-$admin_version = '2.14-627a';
-$build = '170828-2105';
+$admin_version = '2.14-628a';
+$build = '170913-0908';
 
 $STARTtime = date("U");
 $SQLdate = date("Y-m-d H:i:s");
@@ -39114,6 +39115,8 @@ if ($ADD==999999)
 			{echo "
  • "._QXZ("Agent Time Detail")."\n";} if ( (preg_match("/Agent Status Detail/",$LOGallowed_reports)) or (preg_match("/ALL REPORTS/",$LOGallowed_reports)) ) {echo "
  • "._QXZ("Agent Status Detail")."\n";} + if ( (preg_match("/Agent Inbound Status Summary/",$LOGallowed_reports)) or (preg_match("/ALL REPORTS/",$LOGallowed_reports)) ) + {echo " - "._QXZ("Inbound Summary")."\n";} if ( (preg_match("/Agent Performance Detail/",$LOGallowed_reports)) or (preg_match("/ALL REPORTS/",$LOGallowed_reports)) ) {echo "
  • "._QXZ("Agent Performance Detail")."\n";} if ( (preg_match("/Team Performance Detail/",$LOGallowed_reports)) or (preg_match("/ALL REPORTS/",$LOGallowed_reports)) ) diff --git a/www/vicidial/user_status.php b/www/vicidial/user_status.php index 2286209c..9ca04753 100644 --- a/www/vicidial/user_status.php +++ b/www/vicidial/user_status.php @@ -40,6 +40,7 @@ # 170217-1213 - Fixed non-latin auth issue #995 # 170228-1623 - Changed emergency logout to hangup all agent session calls, and more logging # 170409-1555 - Added IP List validation code +# 170912-1704 - Removed non-functional change-campaign feature # $startMS = microtime(); @@ -945,6 +946,7 @@ if ($agents_to_print > 0) if ($change_agent_campaign > 0) { +/* echo "
    \n"; echo "\n"; echo "\n"; @@ -959,6 +961,7 @@ if ($agents_to_print > 0) } echo "\n"; echo "
    \n"; +*/ echo "
    \n"; echo "\n"; @@ -966,6 +969,7 @@ if ($agents_to_print > 0) echo "\n"; echo "   "._QXZ("NOTE: this will hang up all calls in the agent session")."
    \n"; } + } else