From c163273ea8b72ae628fcad028cbc1f0a14dd0cc1 Mon Sep 17 00:00:00 2001 From: mattf Date: Sun, 11 Feb 2018 16:29:38 +0000 Subject: [PATCH] Added Outbound Lead Source Report git-svn-id: svn://192.168.202.10@2912 3d104415-ff17-0410-8863-d5cf3c621b8a --- agc_2-X/trunk/UPGRADE | 2 + .../conf_examples/extensions.conf.sample-1.8 | 4 +- .../conf_examples/extensions.conf.sample-13 | 4 +- .../vicidial/AST_source_vlc_status_report.php | 649 ++++++++++++++++++ agc_2-X/trunk/www/vicidial/admin.php | 11 +- agc_2-X/trunk/www/vicidial/help.php | 18 + 6 files changed, 680 insertions(+), 8 deletions(-) create mode 100644 agc_2-X/trunk/www/vicidial/AST_source_vlc_status_report.php diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE index a6126b0b..9f36c7fd 100644 --- a/agc_2-X/trunk/UPGRADE +++ b/agc_2-X/trunk/UPGRADE @@ -267,6 +267,8 @@ OTHER CHANGES: 70. Added In-Group option to look up timezone of customer when a new lead is added during the routing of the call. +71. Added the Outbound Lead Source Report + diff --git a/agc_2-X/trunk/docs/conf_examples/extensions.conf.sample-1.8 b/agc_2-X/trunk/docs/conf_examples/extensions.conf.sample-1.8 index 6049b4d0..963e7468 100644 --- a/agc_2-X/trunk/docs/conf_examples/extensions.conf.sample-1.8 +++ b/agc_2-X/trunk/docs/conf_examples/extensions.conf.sample-1.8 @@ -221,10 +221,10 @@ exten => _9119XXXXXXXX,n,Hangup() ; exten => _91NXXNXXXXXX,n,Dial(${TRUNKloop}/888${EXTEN:2},55,o) ; exten => _91NXXNXXXXXX,n,Hangup() ;exten => _888NXXNXXXXXX,1,Goto(loopback-no-log,91${EXTEN:3},1) -;exten => _888NXXNXXXXXX,n,Hanguo() +;exten => _888NXXNXXXXXX,n,Hangup() exten => 8889990011112,1,Goto(loopback-no-log,9990011112,1) -exten => 8889990011112,n,Hanguo() +exten => 8889990011112,n,Hangup() ; Inbound call from BINFONE diff --git a/agc_2-X/trunk/docs/conf_examples/extensions.conf.sample-13 b/agc_2-X/trunk/docs/conf_examples/extensions.conf.sample-13 index 587bdb86..8d66705a 100644 --- a/agc_2-X/trunk/docs/conf_examples/extensions.conf.sample-13 +++ b/agc_2-X/trunk/docs/conf_examples/extensions.conf.sample-13 @@ -219,10 +219,10 @@ exten => _9119XXXXXXXX,n,Hangup() ; exten => _91NXXNXXXXXX,n,Dial(${TRUNKloop}/888${EXTEN:2},55,o) ; exten => _91NXXNXXXXXX,n,Hangup() ;exten => _888NXXNXXXXXX,1,Goto(loopback-no-log,91${EXTEN:3},1) -;exten => _888NXXNXXXXXX,n,Hanguo() +;exten => _888NXXNXXXXXX,n,Hangup() exten => 8889990011112,1,Goto(loopback-no-log,9990011112,1) -exten => 8889990011112,n,Hanguo() +exten => 8889990011112,n,Hangup() ; Inbound call from BINFONE diff --git a/agc_2-X/trunk/www/vicidial/AST_source_vlc_status_report.php b/agc_2-X/trunk/www/vicidial/AST_source_vlc_status_report.php new file mode 100644 index 00000000..301cc4e0 --- /dev/null +++ b/agc_2-X/trunk/www/vicidial/AST_source_vlc_status_report.php @@ -0,0 +1,649 @@ + LICENSE: AGPLv2 +# +# CHANGES +# +# 180211-1111 - First build +# + +$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_D"])) {$query_date_D=$_GET["query_date_D"];} + elseif (isset($_POST["query_date_D"])) {$query_date_D=$_POST["query_date_D"];} +if (isset($_GET["end_date_D"])) {$end_date_D=$_GET["end_date_D"];} + elseif (isset($_POST["end_date_D"])) {$end_date_D=$_POST["end_date_D"];} +if (isset($_GET["query_date_T"])) {$query_date_T=$_GET["query_date_T"];} + elseif (isset($_POST["query_date_T"])) {$query_date_T=$_POST["query_date_T"];} +if (isset($_GET["end_date_T"])) {$end_date_T=$_GET["end_date_T"];} + elseif (isset($_POST["end_date_T"])) {$end_date_T=$_POST["end_date_T"];} +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["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["group_by"])) {$group_by=$_GET["group_by"];} + elseif (isset($_POST["group_by"])) {$group_by=$_POST["group_by"];} +if (isset($_GET["sort_by"])) {$sort_by=$_GET["sort_by"];} + elseif (isset($_POST["sort_by"])) {$sort_by=$_POST["sort_by"];} +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"];} + +$report_name="Outbound Lead Source Report"; +$NOW_DATE = date("Y-m-d"); +if (!isset($group)) {$group=array();} +if (!isset($query_date_D)) {$query_date_D=$NOW_DATE;} +if (!isset($end_date_D)) {$end_date_D=$NOW_DATE;} +if (!isset($query_date_T)) {$query_date_T="00:00:00";} +if (!isset($end_date_T)) {$end_date_T="23:59:59";} + +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,enable_languages,language_method,report_default_format FROM system_settings;"; +$rslt=mysql_to_mysqli($stmt, $link); +if ($DB) {$HTML_text.="$stmt\n";} +$qm_conf_ct = mysqli_num_rows($rslt); +if ($qm_conf_ct > 0) + { + $row=mysqli_fetch_row($rslt); + $non_latin = $row[0]; + $outbound_autodial_active = $row[1]; + $slave_db_server = $row[2]; + $reports_use_slave_db = $row[3]; + $SSenable_languages = $row[4]; + $SSlanguage_method = $row[5]; + $SSreport_default_format = $row[6]; + } +##### END SETTINGS LOOKUP ##### +########################################### +if (strlen($report_display_type)<2) {$report_display_type = $SSreport_default_format;} + +### ARCHIVED DATA CHECK CONFIGURATION +$archives_available="N"; +$log_tables_array=array("vicidial_list"); +for ($t=0; $t 0) + { + $row=mysqli_fetch_row($rslt); + $VUselected_language = $row[0]; + } + +$auth=0; +$reports_auth=0; +$admin_auth=0; +$auth_message = user_authorization($PHP_AUTH_USER,$PHP_AUTH_PW,'REPORTS',1,0); +if ($auth_message == 'GOOD') + {$auth=1;} + +if ($auth > 0) + { + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and user_level > 7 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_to_mysqli($stmt, $link); + $row=mysqli_fetch_row($rslt); + $admin_auth=$row[0]; + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_to_mysqli($stmt, $link); + $row=mysqli_fetch_row($rslt); + $reports_auth=$row[0]; + + if ($reports_auth < 1) + { + $VDdisplayMESSAGE = _QXZ("You are not allowed to view reports"); + Header ("Content-type: text/html; charset=utf-8"); + echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n"; + exit; + } + if ( ($reports_auth > 0) and ($admin_auth < 1) ) + { + $ADD=999999; + $reports_only_user=1; + } + } +else + { + $VDdisplayMESSAGE = _QXZ("Login incorrect, please try again"); + if ($auth_message == 'LOCK') + { + $VDdisplayMESSAGE = _QXZ("Too many login attempts, try again in 15 minutes"); + Header ("Content-type: text/html; charset=utf-8"); + echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n"; + exit; + } + if ($auth_message == 'IPBLOCK') + { + $VDdisplayMESSAGE = _QXZ("Your IP Address is not allowed") . ": $ip"; + Header ("Content-type: text/html; charset=utf-8"); + echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n"; + exit; + } + Header("WWW-Authenticate: Basic realm=\"CONTACT-CENTER-ADMIN\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$PHP_AUTH_PW|$auth_message|\n"; + exit; + } + +##### BEGIN log visit to the vicidial_report_log table ##### +$LOGip = getenv("REMOTE_ADDR"); +$LOGbrowser = getenv("HTTP_USER_AGENT"); +$LOGscript_name = getenv("SCRIPT_NAME"); +$LOGserver_name = getenv("SERVER_NAME"); +$LOGserver_port = getenv("SERVER_PORT"); +$LOGrequest_uri = getenv("REQUEST_URI"); +$LOGhttp_referer = getenv("HTTP_REFERER"); +$LOGbrowser=preg_replace("/\'|\"|\\\\/","",$LOGbrowser); +$LOGrequest_uri=preg_replace("/\'|\"|\\\\/","",$LOGrequest_uri); +$LOGhttp_referer=preg_replace("/\'|\"|\\\\/","",$LOGhttp_referer); +if (preg_match("/443/i",$LOGserver_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +if (($LOGserver_port == '80') or ($LOGserver_port == '443') ) {$LOGserver_port='';} +else {$LOGserver_port = ":$LOGserver_port";} +$LOGfull_url = "$HTTPprotocol$LOGserver_name$LOGserver_port$LOGrequest_uri"; + +$LOGhostname = php_uname('n'); +if (strlen($LOGhostname)<1) {$LOGhostname='X';} +if (strlen($LOGserver_name)<1) {$LOGserver_name='X';} + +$stmt="SELECT webserver_id FROM vicidial_webservers where webserver='$LOGserver_name' and hostname='$LOGhostname' LIMIT 1;"; +$rslt=mysql_to_mysqli($stmt, $link); +if ($DB) {echo "$stmt\n";} +$webserver_id_ct = mysqli_num_rows($rslt); +if ($webserver_id_ct > 0) + { + $row=mysqli_fetch_row($rslt); + $webserver_id = $row[0]; + } +else + { + ##### insert webserver entry + $stmt="INSERT INTO vicidial_webservers (webserver,hostname) values('$LOGserver_name','$LOGhostname');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_to_mysqli($stmt, $link); + $affected_rows = mysqli_affected_rows($link); + $webserver_id = mysqli_insert_id($link); + } + +$stmt="INSERT INTO vicidial_report_log set event_date=NOW(), user='$PHP_AUTH_USER', ip_address='$LOGip', report_name='$report_name', browser='$LOGbrowser', referer='$LOGhttp_referer', notes='$LOGserver_name:$LOGserver_port $LOGscript_name |$group[0], $query_date, $end_date, $shift, $file_download, $report_display_type|', url='$LOGfull_url', webserver='$webserver_id';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_to_mysqli($stmt, $link); +$report_log_id = mysqli_insert_id($link); +##### END log visit to the vicidial_report_log table ##### + +if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) + { + mysqli_close($link); + $use_slave_server=1; + $db_source = 'S'; + require("dbconnect_mysqli.php"); + $HTML_text.="\n"; + } + +$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER';"; +if ($DB) {$HTML_text.="|$stmt|\n";} +$rslt=mysql_to_mysqli($stmt, $link); +$row=mysqli_fetch_row($rslt); +$LOGuser_group = $row[0]; + +$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';"; +if ($DB) {$HTML_text.="|$stmt|\n";} +$rslt=mysql_to_mysqli($stmt, $link); +$row=mysqli_fetch_row($rslt); +$LOGallowed_campaigns = $row[0]; +$LOGallowed_reports = $row[1]; + +if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORTS/",$LOGallowed_reports)) ) + { + Header("WWW-Authenticate: Basic realm=\"CONTACT-CENTER-ADMIN\""); + Header("HTTP/1.0 401 Unauthorized"); + echo _QXZ("You are not allowed to view this report").": |$PHP_AUTH_USER|$report_name|\n"; + exit; + } + +$LOGallowed_campaignsSQL=''; +$whereLOGallowed_campaignsSQL=''; +if ( (!preg_match("/-ALL/",$LOGallowed_campaigns)) ) + { + $rawLOGallowed_campaignsSQL = preg_replace("/ -/",'',$LOGallowed_campaigns); + $rawLOGallowed_campaignsSQL = preg_replace("/ /","','",$rawLOGallowed_campaignsSQL); + $LOGallowed_campaignsSQL = "and campaign_id IN('$rawLOGallowed_campaignsSQL')"; + $whereLOGallowed_campaignsSQL = "where campaign_id IN('$rawLOGallowed_campaignsSQL')"; + } +$regexLOGallowed_campaigns = " $LOGallowed_campaigns "; + +$i=0; +$group_string='|'; +$group_ct = count($group); +while($i < $group_ct) + { + $group_string .= "$group[$i]|"; + $i++; + } + +$stmt="SELECT campaign_id from vicidial_campaigns $whereLOGallowed_campaignsSQL order by campaign_id;"; +$rslt=mysql_to_mysqli($stmt, $link); +if ($DB) {$HTML_text.="$stmt\n";} +$campaigns_to_print = mysqli_num_rows($rslt); +$i=0; +while ($i < $campaigns_to_print) + { + $row=mysqli_fetch_row($rslt); + $groups[$i] =$row[0]; + if (preg_match("/-ALL/",$group_string) ) + {$group[$i] = $groups[$i];} + $i++; + } + +$i=0; +$group_string='|'; +$group_ct = count($group); +while($i < $group_ct) + { + if ( (preg_match("/ $group[$i] /",$regexLOGallowed_campaigns)) or (preg_match("/-ALL/",$LOGallowed_campaigns)) ) + { + $group_string .= "$group[$i]|"; + $group_SQL .= "'$group[$i]',"; + $groupQS .= "&group[]=$group[$i]"; + } + $i++; + } + +if ( (preg_match("/--ALL--/",$group_string) ) or ($group_ct < 1) ) + {$group_SQL = "";} +else + { + $group_SQL = preg_replace("/,\$/",'',$group_SQL); + $group_SQL_str=$group_SQL; + $group_SQL = "and campaign_id IN($group_SQL)"; + } + +$query_date="$query_date_D $query_date_T"; +$end_date="$end_date_D $end_date_T"; + +require("screen_colors.php"); + +$NWB = "   \"HELP\""; + +$HTML_head.="\n"; +$HTML_head.="\n"; +$HTML_head.="\n"; + +$HTML_head.="\n"; +$HTML_head.="\n"; +$HTML_head.="\n"; +require("chart_button.php"); +$HTML_head.="\n"; +$HTML_head.="\n"; + +$HTML_head.="\n"; +$HTML_head.=""._QXZ("$report_name")."$group_S\n"; +$short_header=1; + +# require("admin_header.php"); + +$HTML_text.="
"; +$HTML_text.=""._QXZ("$report_name")." $NWB#source_vlc_status_report$NWE\n"; + +$HTML_text.="
\n"; +$HTML_text.="
"._QXZ("Entry date").":
"; +$HTML_text.="\n"; +$HTML_text.="\n"; +$HTML_text.="\n"; +$HTML_text.=""; + +$HTML_text.="\n"; + +$HTML_text.="   "; + +$HTML_text.="
"._QXZ("to")."
"; + +$HTML_text.="\n"; + +$HTML_text.="   "; + +$HTML_text.="
"._QXZ("Campaign").":
"; +$HTML_text.="

\n"; + +$HTML_text.=_QXZ("Group by").":
"; +$HTML_text.="\n"; + +$HTML_text.="
 \n"; +$HTML_text.="\n"; +$HTML_text.=_QXZ("Display as").":
"; +$HTML_text.="\n

"; + +if ($archives_available=="Y") + { + $HTML_text.=""._QXZ("Search archived data")."\n"; + } + +$HTML_text.="

\n"; + +$HTML_text.="
"; + +$report_URL="$PHP_SELF?DB=$DB&query_date=$query_date&end_date=$end_date&query_date_D=$query_date_D&query_date_T=$query_date_T&end_date_D=$end_date_D&end_date_T=$end_date_T$groupQS&SUBMIT=$SUBMIT&group_by=$group_by&search_archived_data=$search_archived_data"; + +$HTML_text.="\n"; +$HTML_text.=""._QXZ("DOWNLOAD")." |"; +$HTML_text.=" "._QXZ("REPORTS")." \n"; +$HTML_text.="\n"; +$HTML_text.="
"; +$HTML_text.="
\n\n"; + +$HTML_text.="
";
+$i=0;
+$group_string='|';
+$group_ct = count($group);
+$HTML_body="";
+
+while($i < $group_ct)
+	{
+
+	$list_stmt="select list_id from vicidial_lists where campaign_id='$group[$i]'";
+	if ($DB) {$HTML_text.="|$list_stmt|\n";}
+	$list_rslt=mysql_to_mysqli($list_stmt, $link);
+	$list_ary=array();
+	while($list_row=mysqli_fetch_row($list_rslt)) 
+		{
+		array_push($list_ary, $list_row[0]);
+		}
+
+	$dispo_ary=array();
+	$dispo_stmt="SELECT status, status_name from vicidial_campaign_statuses where campaign_id='$group[$i]' UNION SELECT status, status_name from vicidial_statuses order by status, status_name";
+	if ($DB) {$HTML_text.="|$dispo_stmt|\n";}
+	$dispo_rslt=mysql_to_mysqli($dispo_stmt, $link);
+	while($dispo_row=mysqli_fetch_row($dispo_rslt)) 
+		{
+		$dispo_ary["$dispo_row[0]"]=$dispo_row[1];
+		}
+
+	$count_ary=array();
+	$total_ary=array();
+	$status_totals=array();
+	$stmt="select lead_id, $group_by, status from ".$vicidial_list_table." where list_id in ('".implode("','", $list_ary)."') and entry_date>='$query_date' and entry_date<='$end_date'";
+	if ($DB) {$HTML_text.="|$stmt|\n";}
+	$rslt=mysql_to_mysqli($stmt, $link);
+	$grand_total=mysqli_num_rows($rslt);
+	while ($row=mysqli_fetch_row($rslt)) 
+		{
+		$count_ary["$row[1]"]["$row[2]"]++;
+		$total_ary["$row[1]"]++;
+		$status_totals["$row[2]"]++;
+		}
+	ksort($count_ary);
+	arsort($total_ary);
+	arsort($status_totals);
+
+	$HTML_body.=""._QXZ("CAMPAIGN").": $group[$i]
\n"; + $ASCII_text.=""._QXZ("CAMPAIGN").": $group[$i]\n"; + $GRAPH.=""._QXZ("CAMPAIGN").": $group[$i]\n"; + $CSV_text.="\""._QXZ("CAMPAIGN").": $group[$i]\"\n"; + + $rpt_group_title=strtoupper(preg_replace('/_/', " ", $group_by)); + + + + while(list($key, $val)=each($count_ary)) + { + arsort($count_ary[$key]); + switch ($sort_by) + { + case "dispo_desc": + krsort($count_ary[$key]); + break; + case "dispo_asc": + ksort($count_ary[$key]); + break; + case "count_asc": + asort($count_ary[$key]); + break; + } + + $HTML_body.=""; + $HTML_body.=""; + $HTML_body.=""; + + $ASCII_text.=""._QXZ("$rpt_group_title")." : ".($key !="" ? $key : "(NONE)")."\n"; + $ASCII_text.="+------------------------------------------+--------+----------+\n"; + $ASCII_text.="| "._QXZ("DISPOSITION",40)." | "._QXZ("CALLS",6)." | "._QXZ("PERCENT", 8)." |\n"; + $ASCII_text.="+------------------------------------------+--------+----------+\n"; + + $CSV_text.="\""._QXZ("$rpt_group_title")." : ".($key !="" ? $key : "(NONE)")."\"\n"; + $CSV_text.="\""._QXZ("DISPOSITION")."\",\""._QXZ("CALLS")."\",\""._QXZ("PERCENT")."\"\n"; + + $j=0; + while(list($key2, $val2)=each($count_ary[$key])) + { + if ($j%2==0) + { + $bgcolor=$SSstd_row1_background; + } + else + { + $bgcolor=$SSstd_row2_background; + } + + $percent=sprintf("%.2f", 100*MathZDC($val2, $total_ary["$key"])); + $HTML_body.=""; + $ASCII_text.="| ".sprintf("%-40s", ($dispo_ary["$key2"] !="" ? $dispo_ary["$key2"] : $key2))." | ".sprintf("%6s", $val2)." | ".sprintf("%7s", $percent)."% |\n"; + $CSV_text.="\"".($dispo_ary["$key2"] !="" ? $dispo_ary["$key2"] : $key2)."\",\"".$val2."\",\"".$percent." %\"\n"; + + $j++; + } + $HTML_body.=""; + $HTML_body.="
"._QXZ("$rpt_group_title")." : ".($key !="" ? $key : "(NONE)")."
"._QXZ("DISPOSITION",40).""._QXZ("CALLS",6).""._QXZ("PERCENT", 7)."
".($dispo_ary["$key2"] !="" ? $dispo_ary["$key2"] : $key2)."".$val2."".$percent." %
"._QXZ("TOTAL")."".$total_ary["$key"]." 

\n"; + $ASCII_text.="+------------------------------------------+--------+----------+\n"; + $ASCII_text.="| "._QXZ("TOTAL",40)." | ".sprintf("%6s", $total_ary["$key"])." | ".sprintf("%8s", " ")." |\n"; + $ASCII_text.="+------------------------------------------+--------+----------+\n\n"; + $CSV_text.="\""._QXZ("TOTAL")."\",\"".$total_ary["$key"]."\",\"\"\n\n"; + } + $i++; + + $HTML_body.=""; + $HTML_body.=""; + $HTML_body.=""; + + $ASCII_text.=""._QXZ("$rpt_group_title")." : TOTALS\n"; + $ASCII_text.="+------------------------------------------+--------+----------+\n"; + $ASCII_text.="| "._QXZ("DISPOSITION",40)." | "._QXZ("CALLS",6)." | "._QXZ("PERCENT", 8)." |\n"; + $ASCII_text.="+------------------------------------------+--------+----------+\n"; + + $CSV_text.="\""._QXZ("$rpt_group_title")." : TOTALS\"\n"; + $CSV_text.="\""._QXZ("DISPOSITION")."\",\""._QXZ("CALLS")."\",\""._QXZ("PERCENT")."\"\n"; + + arsort($status_totals); + switch ($sort_by) + { + case "dispo_desc": + krsort($status_totals); + break; + case "dispo_asc": + ksort($status_totals); + break; + case "count_asc": + asort($status_totals); + break; + } + while(list($key, $val)=each($status_totals)) + { + if ($j%2==0) + { + $bgcolor=$SSstd_row1_background; + } + else + { + $bgcolor=$SSstd_row2_background; + } + + $percent=sprintf("%.2f", 100*MathZDC($val, $grand_total)); + $HTML_body.=""; + $ASCII_text.="| ".sprintf("%-40s", ($dispo_ary["$key"] !="" ? $dispo_ary["$key"] : $key))." | ".sprintf("%6s", $val)." | ".sprintf("%7s", $percent)."% |\n"; + $CSV_text.="\"".($dispo_ary["$key"] !="" ? $dispo_ary["$key"] : $key)."\",\"".$val."\",\"".$percent." %\"\n"; + + $j++; + } + $HTML_body.=""; + $HTML_body.="
"._QXZ("$rpt_group_title")." : TOTALS
"._QXZ("DISPOSITION",40).""._QXZ("CALLS",6).""._QXZ("PERCENT", 7)."
".($dispo_ary["$key"] !="" ? $dispo_ary["$key"] : $key)."".$val."".$percent." %
"._QXZ("GRAND TOTAL")."".$grand_total." 

\n"; + $ASCII_text.="+------------------------------------------+--------+----------+\n"; + $ASCII_text.="| "._QXZ("GRAND TOTAL",40)." | ".sprintf("%6s", $grand_total)." | ".sprintf("%8s", " ")." |\n"; + $ASCII_text.="+------------------------------------------+--------+----------+\n\n"; + $CSV_text.="\""._QXZ("GRAND TOTAL")."\",\"".$grand_total."\",\"\"\n\n"; + + } + +if ($report_display_type=="HTML") + { + $HTML_text.=$HTML_body; + } +else + { + $HTML_text.=$ASCII_text; + } + +$HTML_text.="
"; + +if ($file_download>0) + { + $FILE_TIME = date("Ymd-His"); + $CSVfilename = "AST_campaign_status_$US$FILE_TIME.csv"; + $CSV_text=preg_replace('/\n +,/', ',', $CSV_text); + $CSV_text=preg_replace('/ +\"/', '"', $CSV_text); + $CSV_text=preg_replace('/\" +/', '"', $CSV_text); + + // 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 "$CSV_text"; + } +else + { + header("Content-type: text/html; charset=utf-8"); + + echo $HTML_head; + require("admin_header.php"); + echo $HTML_text; + flush(); + } + +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; + +?> diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php index ef0627e9..78ed10a4 100644 --- a/agc_2-X/trunk/www/vicidial/admin.php +++ b/agc_2-X/trunk/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, Real-Time Whiteboard Report, 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'; +$Vreports = 'NONE, Real-Time Main Report, Real-Time Campaign Summary, Real-Time Whiteboard Report, 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, Outbound Lead Source 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, Real-Time Whiteboard Report, 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'; +$UGreports = 'ALL REPORTS, NONE, Real-Time Main Report, Real-Time Campaign Summary, Real-Time Whiteboard Report, 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, Outbound Lead Source 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'; @@ -4290,12 +4290,13 @@ else # 180130-2309 - Added inbound_no_agents_no_dial options # 180204-0208 - Added In-Group Wait-Time option PRESS_CALLBACK_QUEUE, and Closing-Time options # 180211-1024 - Changed campaign dial statuses to allow List and allowed In-Group selected status group statuses +# 180211-1126 - Added Outbound Lead Source 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-653a'; -$build = '180211-1024'; +$admin_version = '2.14-654a'; +$build = '180211-1126'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -39708,6 +39709,8 @@ if ($ADD==999999) } echo "\n"; } + if ( (preg_match("/Outbound Lead Source Report/",$LOGallowed_reports)) or (preg_match("/ALL REPORTS/",$LOGallowed_reports)) ) + {echo "
  • "._QXZ("Outbound Lead Source Report")."\n";} if ( (preg_match("/Fronter - Closer Report/",$LOGallowed_reports)) or (preg_match("/ALL REPORTS/",$LOGallowed_reports)) ) {echo "
  • "._QXZ("Fronter - Closer Report")."\n";} if ( (preg_match("/Fronter - Closer Detail Report/",$LOGallowed_reports)) or (preg_match("/ALL REPORTS/",$LOGallowed_reports)) ) diff --git a/agc_2-X/trunk/www/vicidial/help.php b/agc_2-X/trunk/www/vicidial/help.php index 1f30e29f..3092abcc 100644 --- a/agc_2-X/trunk/www/vicidial/help.php +++ b/agc_2-X/trunk/www/vicidial/help.php @@ -148,8 +148,10 @@ # 171224-1027 - Added lists-default_xfer_group entry # 180108-2115 - Added campaigns-next_dial_my_callbacks entry # 180111-1547 - Added settings-anyone_callback_inactive_lists entry +# 180130-0000 - Added GDPR entries for user and system settings # 180130-2303 - Added inbound_no_agents_no_dial entries # 180204-0213 - Added inbound_groups-icbq_expiration_hours and closed-time entries +# 180211-1119 - Added source_vlc_status_report # require("dbconnect_mysqli.php"); @@ -635,6 +637,13 @@ if ($SScustom_fields_enabled > 0)
    - +
    + +
    + - +
    + + 0) { @@ -5546,6 +5555,11 @@ FR_SPAC 00 00 00 00 00 - - +
    +
    +
    + - +

    @@ -6543,6 +6557,10 @@ if ($SSqc_features_active > 0) TOTAL CALLS = Number of calls placed to leads belonging to lists in this campaign within the time frame specified."); ?>
    STATUS FLAGS BREAKDOWN = Breakdown of the total calls into status categories, including counts per category and percentage relative to the number of calls to leads in the list within the time frame specified."); ?>
    +
    +
    + -
    +

    -