diff --git a/UPGRADE b/UPGRADE index c4d3b83c..d2d9c30a 100644 --- a/UPGRADE +++ b/UPGRADE @@ -193,6 +193,8 @@ OTHER CHANGES: Carrier Log Stats generated once per minute system-wide instead of every time the realtime report refreshes on every screen. +47. Added option to several reports to search the archived logs. + diff --git a/www/vicidial/AST_CLOSER_service_level.php b/www/vicidial/AST_CLOSER_service_level.php index 71cce68f..98ff58f9 100644 --- a/www/vicidial/AST_CLOSER_service_level.php +++ b/www/vicidial/AST_CLOSER_service_level.php @@ -30,6 +30,7 @@ # 141128-0856 - Code cleanup for QXZ functions # 141230-0923 - Added code for on-the-fly language translations display # 150516-1258 - Fixed Javascript element problem, Issue #857 +# 151125-1627 - Added search archive option # $startMS = microtime(); @@ -56,6 +57,8 @@ if (isset($_GET["file_download"])) {$file_download=$_GET["file_download"];} elseif (isset($_POST["file_download"])) {$file_download=$_POST["file_download"];} 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 (strlen($shift)<2) {$shift='ALL';} @@ -81,6 +84,24 @@ if ($qm_conf_ct > 0) ##### END SETTINGS LOOKUP ##### ########################################### +### ARCHIVED DATA CHECK CONFIGURATION +$archives_available="N"; +$table_name="vicidial_closer_log"; +$archive_table_name=use_archive_table($table_name); +if ($archive_table_name!=$table_name) {$archives_available="Y";} + +if ($search_archived_data) + { + $vicidial_closer_log_table=use_archive_table("vicidial_closer_log"); + } +else + { + $vicidial_closer_log_table="vicidial_closer_log"; + } +############# + + + if ($non_latin < 1) { $PHP_AUTH_USER = preg_replace('/[^-_0-9a-zA-Z]/', '', $PHP_AUTH_USER); @@ -352,13 +373,17 @@ $MAIN.="\n"; $MAIN.="\n"; $MAIN.="\n"; $MAIN.="\n"; -$MAIN.="           "._QXZ("DOWNLOAD")." | "._QXZ("MODIFY")." | "._QXZ("REPORTS").""; +$MAIN.="           "._QXZ("DOWNLOAD")." | "._QXZ("MODIFY")." | "._QXZ("REPORTS").""; +if ($archives_available=="Y") + { + $MAIN.="
"._QXZ("Search archived data")."\n"; + } $MAIN.="
\n"; + $MAIN.="\n\n"; $MAIN.="
\n\n";
 
-
 if (!$group)
 	{
 	$MAIN.="\n\n";
@@ -560,7 +585,7 @@ $TOTintervals = $j;
 
 
 ### GRAB ALL RECORDS WITHIN RANGE FROM THE DATABASE ###
-$stmt="select queue_seconds,UNIX_TIMESTAMP(call_date),length_in_sec,status from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysqli_real_escape_string($link, $group) . "';";
+$stmt="select queue_seconds,UNIX_TIMESTAMP(call_date),length_in_sec,status from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysqli_real_escape_string($link, $group) . "';";
 $rslt=mysql_to_mysqli($stmt, $link);
 if ($DB) {$MAIN.="$stmt\n";}
 $records_to_grab = mysqli_num_rows($rslt);
diff --git a/www/vicidial/AST_CLOSERstats.php b/www/vicidial/AST_CLOSERstats.php
index 8ed5a955..84177274 100644
--- a/www/vicidial/AST_CLOSERstats.php
+++ b/www/vicidial/AST_CLOSERstats.php
@@ -49,6 +49,8 @@
 # 150516-1259 - Fixed Javascript element problem, Issue #857
 # 150522-1304 - Fixed issue with missing calls from user stats section
 # 150928-1234 - Separated User Group permissions for this report by in-group and by DID
+# 151124-1236 - Changed bottom chart to pull all time segments
+# 151125-1633 - Added search archive option
 #
 
 $startMS = microtime();
@@ -81,6 +83,8 @@ if (isset($_GET["file_download"]))				{$file_download=$_GET["file_download"];}
 	elseif (isset($_POST["file_download"]))	{$file_download=$_POST["file_download"];}
 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"];}
 
 $MT[0]='0';
 if (strlen($shift)<2) {$shift='ALL';}
@@ -111,6 +115,30 @@ if ($qm_conf_ct > 0)
 ##### END SETTINGS LOOKUP #####
 ###########################################
 
+### ARCHIVED DATA CHECK CONFIGURATION
+$archives_available="N";
+$log_tables_array=array("vicidial_did_log", "vicidial_closer_log", "live_inbound_log");
+for ($t=0; $t\n
"; +if ($archives_available=="Y") + { + $MAIN.=""._QXZ("Search archived data")."

\n"; + } + $MAIN.="   \n"; $MAIN.="\n"; $MAIN.="\n\n"; @@ -527,14 +561,20 @@ if ($shift == 'ALL') $query_date_BEGIN = "$query_date $time_BEGIN"; $query_date_END = "$end_date $time_END"; +# Calculate first record in interval and last +$time_BEGIN_array=explode(":", $time_BEGIN); +$first_shift_record=(4*$time_BEGIN_array[0])+(ceil($time_BEGIN_array[1]/15)); +$time_END_array=explode(":", $time_END); +$last_shift_record=(4*$time_END_array[0])+(ceil($time_END_array[1]/15)); + if ($EMAIL=='Y') { - $MAIN.=_QXZ("Inbound Email Stats").": $group_string $NOW_TIME "._QXZ("DOWNLOAD")."\n"; + $MAIN.=_QXZ("Inbound Email Stats").": $group_string $NOW_TIME "._QXZ("DOWNLOAD")."\n"; $CSV_text1.="\""._QXZ("Inbound Call Stats").":\",\"$group_string\",\"$NOW_TIME\"\n"; } else { - $MAIN.=_QXZ("Inbound Call Stats").": $group_string $NOW_TIME "._QXZ("DOWNLOAD")."\n"; + $MAIN.=_QXZ("Inbound Call Stats").": $group_string $NOW_TIME "._QXZ("DOWNLOAD")."\n"; $CSV_text1.="\""._QXZ("Inbound Call Stats").":\",\"$group_string\",\"$NOW_TIME\"\n"; } @@ -557,7 +597,7 @@ if ($DID=='Y') $did_SQL = preg_replace('/,$/i', '',$did_SQL); if (strlen($did_SQL)<3) {$did_SQL="''";} - $stmt="select uniqueid from vicidial_did_log where did_id IN($did_SQL);"; + $stmt="select uniqueid from ".$vicidial_did_log_table." where did_id IN($did_SQL);"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $unids_to_print = mysqli_num_rows($rslt); @@ -620,7 +660,7 @@ if ($group_ct > 1) $did_id[$i] = $row[0]; } - $stmt="select uniqueid from vicidial_did_log where did_id='$did_id[$i]';"; + $stmt="select uniqueid from ".$vicidial_did_log_table." where did_id='$did_id[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$ASCII_text.="$stmt\n";} $DIDunids_to_print = mysqli_num_rows($rslt); @@ -634,28 +674,28 @@ if ($group_ct > 1) $DIDunid_SQL = preg_replace('/,$/i', '',$DIDunid_SQL); if (strlen($DIDunid_SQL)<3) {$DIDunid_SQL="''";} - $stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='$group[$i]';"; + $stmt="select count(*),sum(length_in_sec) from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='$group[$i]';"; if ($DID=='Y') { - $stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($DIDunid_SQL);"; + $stmt="select count(*),sum(length_in_sec) from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($DIDunid_SQL);"; } $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$ASCII_text.="$stmt\n";} $row=mysqli_fetch_row($rslt); - $stmt="select count(*) from live_inbound_log where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and comment_a='$group[$i]' and comment_b='START';"; + $stmt="select count(*) from ".$live_inbound_log_table." where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and comment_a='$group[$i]' and comment_b='START';"; if ($DID=='Y') { - $stmt="select count(*) from live_inbound_log where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and uniqueid IN($DIDunid_SQL);"; + $stmt="select count(*) from ".$live_inbound_log_table." where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and uniqueid IN($DIDunid_SQL);"; } $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$ASCII_text.="$stmt\n";} $rowx=mysqli_fetch_row($rslt); - $stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='$group[$i]' and status IN('DROP','XDROP') and (length_in_sec <= 49999 or length_in_sec is null);"; + $stmt="select count(*),sum(length_in_sec) from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='$group[$i]' and status IN('DROP','XDROP') and (length_in_sec <= 49999 or length_in_sec is null);"; if ($DID=='Y') { - $stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and status IN('DROP','XDROP') and (length_in_sec <= 49999 or length_in_sec is null) and uniqueid IN($DIDunid_SQL);"; + $stmt="select count(*),sum(length_in_sec) from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and status IN('DROP','XDROP') and (length_in_sec <= 49999 or length_in_sec is null) and uniqueid IN($DIDunid_SQL);"; } $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$ASCII_text.="$stmt\n";} @@ -733,28 +773,28 @@ $MAIN.="---------- "._QXZ("TOTALS")."\n"; $CSV_text1.="\n\""._QXZ("Time range").":\",\"$query_date_BEGIN\",\""._QXZ("to")."\",\"$query_date_END\"\n\n"; -$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL);"; +$stmt="select count(*),sum(length_in_sec) from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL);"; if ($DID=='Y') { - $stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL);"; + $stmt="select count(*),sum(length_in_sec) from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL);"; } $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $row=mysqli_fetch_row($rslt); -$stmt="select count(*),sum(queue_seconds) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL');"; +$stmt="select count(*),sum(queue_seconds) from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL');"; if ($DID=='Y') { - $stmt="select count(*),sum(queue_seconds) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL') and uniqueid IN($unid_SQL);"; + $stmt="select count(*),sum(queue_seconds) from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL') and uniqueid IN($unid_SQL);"; } $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $rowy=mysqli_fetch_row($rslt); -$stmt="select count(*) from live_inbound_log where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and comment_a IN($group_SQL) and comment_b='START';"; +$stmt="select count(*) from ".$live_inbound_log_table." where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and comment_a IN($group_SQL) and comment_b='START';"; if ($DID=='Y') { - $stmt="select count(*) from live_inbound_log where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and uniqueid IN($unid_SQL);"; + $stmt="select count(*) from ".$live_inbound_log_table." where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and uniqueid IN($unid_SQL);"; } $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} @@ -811,10 +851,10 @@ $MAIN.="---------- "._QXZ("DROPS")."\n"; $CSV_text1.="\n\""._QXZ("DROPS")."\"\n"; -$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status IN('DROP','XDROP') and (length_in_sec <= 49999 or length_in_sec is null);"; +$stmt="select count(*),sum(length_in_sec) from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status IN('DROP','XDROP') and (length_in_sec <= 49999 or length_in_sec is null);"; if ($DID=='Y') { - $stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and status IN('DROP','XDROP') and (length_in_sec <= 49999 or length_in_sec is null) and uniqueid IN($unid_SQL);"; + $stmt="select count(*),sum(length_in_sec) from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and status IN('DROP','XDROP') and (length_in_sec <= 49999 or length_in_sec is null) and uniqueid IN($unid_SQL);"; } $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} @@ -859,13 +899,13 @@ if (strlen($group_SQL)>3) $Sanswer_sec_pct_rt_stat_one = $row[0]; $Sanswer_sec_pct_rt_stat_two = $row[1]; - $stmt = "SELECT count(*) from vicidial_closer_log where campaign_id IN($group_SQL) and call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and queue_seconds <= $Sanswer_sec_pct_rt_stat_one and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL');"; + $stmt = "SELECT count(*) from ".$vicidial_closer_log_table." where campaign_id IN($group_SQL) and call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and queue_seconds <= $Sanswer_sec_pct_rt_stat_one and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL');"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $row=mysqli_fetch_row($rslt); $answer_sec_pct_rt_stat_one = $row[0]; - $stmt = "SELECT count(*) from vicidial_closer_log where campaign_id IN($group_SQL) and call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and queue_seconds <= $Sanswer_sec_pct_rt_stat_two and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL');"; + $stmt = "SELECT count(*) from ".$vicidial_closer_log_table." where campaign_id IN($group_SQL) and call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and queue_seconds <= $Sanswer_sec_pct_rt_stat_two and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL');"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $row=mysqli_fetch_row($rslt); @@ -956,10 +996,10 @@ $MAIN.="---------- "._QXZ("QUEUE STATS")."\n"; $CSV_text1.="\n\""._QXZ("QUEUE STATS")."\"\n"; -$stmt="select count(*),sum(queue_seconds) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and (queue_seconds > 0);"; +$stmt="select count(*),sum(queue_seconds) from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and (queue_seconds > 0);"; if ($DID=='Y') { - $stmt="select count(*),sum(queue_seconds) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and (queue_seconds > 0) and uniqueid IN($unid_SQL);"; + $stmt="select count(*),sum(queue_seconds) from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and (queue_seconds > 0) and uniqueid IN($unid_SQL);"; } $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} @@ -1012,7 +1052,7 @@ if ($EMAIL=='Y') { $TOTALcalls = 0; $ASCII_text="\n"; -$ASCII_text.="---------- $rpt_type_verbiage "._QXZ("HOLD TIME BREAKDOWN IN SECONDS",36)." "._QXZ("DOWNLOAD")."\n"; +$ASCII_text.="---------- $rpt_type_verbiage "._QXZ("HOLD TIME BREAKDOWN IN SECONDS",36)." "._QXZ("DOWNLOAD")."\n"; $ASCII_text.="+-------------------------------------------------------------------------------------------+------------+\n"; $ASCII_text.="| 0 5 10 15 20 25 30 35 40 45 50 55 60 90 +90 | TOTAL |\n"; $ASCII_text.="+-------------------------------------------------------------------------------------------+------------+\n"; @@ -1021,10 +1061,10 @@ $CSV_text2.="\n\"$rpt_type_verbiage "._QXZ("HOLD TIME BREAKDOWN IN SECONDS")."\" $CSV_text2.="\"\",\"0\",\"5\",\"10\",\"15\",\"20\",\"25\",\"30\",\"35\",\"40\",\"45\",\"50\",\"55\",\"60\",\"90\",\"+90\",\"TOTAL\"\n"; -$stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) group by queue_seconds;"; +$stmt="select count(*),queue_seconds from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) group by queue_seconds;"; if ($DID=='Y') { - $stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by queue_seconds;"; + $stmt="select count(*),queue_seconds from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by queue_seconds;"; } $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$ASCII_text.="$stmt\n";} @@ -1081,14 +1121,14 @@ $CSV_text2.="\"\",\"$hd_0\",\"$hd_5\",\"$hd10\",\"$hd15\",\"$hd20\",\"$hd25\",\" if ($report_display_type=="HTML") { - $stmt="select count(*),round(queue_seconds) as rd_sec from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) group by rd_sec order by rd_sec asc;"; - $ms_stmt="select queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) order by queue_seconds desc limit 1;"; - $mc_stmt="select count(*) as ct from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) group by queue_seconds order by ct desc limit 1;"; + $stmt="select count(*),round(queue_seconds) as rd_sec from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) group by rd_sec order by rd_sec asc;"; + $ms_stmt="select queue_seconds from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) order by queue_seconds desc limit 1;"; + $mc_stmt="select count(*) as ct from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) group by queue_seconds order by ct desc limit 1;"; if ($DID=='Y') { - $stmt="select count(*),round(queue_seconds) as rd_sec from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by rd_sec;"; - $ms_stmt="select queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) order by queue_seconds desc limit 1;"; - $mc_stmt="select count(*) as ct from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by queue_seconds order by ct desc limit 1;"; + $stmt="select count(*),round(queue_seconds) as rd_sec from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by rd_sec;"; + $ms_stmt="select queue_seconds from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) order by queue_seconds desc limit 1;"; + $mc_stmt="select count(*) as ct from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by queue_seconds order by ct desc limit 1;"; } if ($DB) {$GRAPH_text.=$stmt."\n";} $ms_rslt=mysql_to_mysqli($ms_stmt, $link); @@ -1165,10 +1205,10 @@ $ASCII_text.="+----------------------------------------------------------------- $CSV_text2.="\n\"$rpt_type_verbiage "._QXZ("DROP TIME BREAKDOWN IN SECONDS")."\"\n"; $CSV_text2.="\"\",\"0\",\"5\",\"10\",\"15\",\"20\",\"25\",\"30\",\"35\",\"40\",\"45\",\"50\",\"55\",\"60\",\"90\",\"+90\",\""._QXZ("TOTAL")."\"\n"; -$stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status IN('DROP','XDROP') group by queue_seconds;"; +$stmt="select count(*),queue_seconds from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status IN('DROP','XDROP') group by queue_seconds;"; if ($DID=='Y') { - $stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and status IN('DROP','XDROP') group by queue_seconds;"; + $stmt="select count(*),queue_seconds from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and status IN('DROP','XDROP') group by queue_seconds;"; } $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$ASCII_text.="$stmt\n";} @@ -1225,14 +1265,14 @@ $ASCII_text.="+----------------------------------------------------------------- $CSV_text2.="\"\",\"$dd_0\",\"$dd_5\",\"$dd10\",\"$dd15\",\"$dd20\",\"$dd25\",\"$dd30\",\"$dd35\",\"$dd40\",\"$dd45\",\"$dd50\",\"$dd55\",\"$dd60\",\"$dd90\",\"$dd99\",\"$BDdropCALLS\"\n"; if ($report_display_type=="HTML") { - $stmt="select count(*),round(queue_seconds) as rd_sec from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status IN('DROP','XDROP') group by rd_sec order by rd_sec asc;"; - $ms_stmt="select queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status IN('DROP','XDROP') order by queue_seconds desc limit 1;"; - $mc_stmt="select count(*) as ct from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status IN('DROP','XDROP') group by queue_seconds order by ct desc limit 1;"; + $stmt="select count(*),round(queue_seconds) as rd_sec from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status IN('DROP','XDROP') group by rd_sec order by rd_sec asc;"; + $ms_stmt="select queue_seconds from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status IN('DROP','XDROP') order by queue_seconds desc limit 1;"; + $mc_stmt="select count(*) as ct from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status IN('DROP','XDROP') group by queue_seconds order by ct desc limit 1;"; if ($DID=='Y') { - $stmt="select count(*),round(queue_seconds) as rd_sec from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and status IN('DROP','XDROP') group by rd_sec;"; - $ms_stmt="select queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and status IN('DROP','XDROP') order by queue_seconds desc limit 1;"; - $mc_stmt="select count(*) as ct from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and status IN('DROP','XDROP') group by queue_seconds order by ct desc limit 1;"; + $stmt="select count(*),round(queue_seconds) as rd_sec from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and status IN('DROP','XDROP') group by rd_sec;"; + $ms_stmt="select queue_seconds from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and status IN('DROP','XDROP') order by queue_seconds desc limit 1;"; + $mc_stmt="select count(*) as ct from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and status IN('DROP','XDROP') group by queue_seconds order by ct desc limit 1;"; } if ($DB) {$GRAPH_text.=$stmt."\n";} $ms_rslt=mysql_to_mysqli($ms_stmt, $link); @@ -1310,10 +1350,10 @@ $ASCII_text.="----------+------------------------------------------------------- $CSV_text2.="\n\"$rpt_type_verbiage "._QXZ("ANSWERED TIME AND PERCENT BREAKDOWN IN SECONDS")."\"\n"; $CSV_text2.="\"\",\"0\",\"5\",\"10\",\"15\",\"20\",\"25\",\"30\",\"35\",\"40\",\"45\",\"50\",\"55\",\"60\",\"90\",\"+90\",\""._QXZ("TOTAL")."\"\n"; -$stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL') group by queue_seconds;"; +$stmt="select count(*),queue_seconds from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL') group by queue_seconds;"; if ($DID=='Y') { - $stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL') group by queue_seconds;"; + $stmt="select count(*),queue_seconds from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL') group by queue_seconds;"; } $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$ASCII_text.="$stmt\n";} @@ -1515,14 +1555,14 @@ $CSV_text2.="\""._QXZ("CUM")." %\",\"$pCad_0\",\"$pCad_5\",\"$pCad10\",\"$pCad15 $CSV_text2.="\""._QXZ("CUM ANS")." %\",\"$ApCad_0\",\"$ApCad_5\",\"$ApCad10\",\"$ApCad15\",\"$ApCad20\",\"$ApCad25\",\"$ApCad30\",\"$ApCad35\",\"$ApCad40\",\"$ApCad45\",\"$ApCad50\",\"$ApCad55\",\"$ApCad60\",\"$ApCad90\",\"$ApCad99\"\n"; if ($report_display_type=="HTML") { - $stmt="select count(*),round(queue_seconds) as rd_sec from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL') group by rd_sec order by rd_sec asc;"; - $ms_stmt="select queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL') order by queue_seconds desc limit 1;"; - $mc_stmt="select count(*) as ct from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL') group by queue_seconds order by ct desc limit 1;"; + $stmt="select count(*),round(queue_seconds) as rd_sec from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL') group by rd_sec order by rd_sec asc;"; + $ms_stmt="select queue_seconds from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL') order by queue_seconds desc limit 1;"; + $mc_stmt="select count(*) as ct from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL') group by queue_seconds order by ct desc limit 1;"; if ($DID=='Y') { - $stmt="select count(*),round(queue_seconds) as rd_sec from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL') group by rd_sec;"; - $ms_stmt="select queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL') order by queue_seconds desc limit 1;"; - $mc_stmt="select count(*) as ct from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL') group by queue_seconds order by ct desc limit 1;"; + $stmt="select count(*),round(queue_seconds) as rd_sec from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL') group by rd_sec;"; + $ms_stmt="select queue_seconds from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL') order by queue_seconds desc limit 1;"; + $mc_stmt="select count(*) as ct from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL') group by queue_seconds order by ct desc limit 1;"; } if ($DB) {$GRAPH_text.=$stmt."\n";} $ms_rslt=mysql_to_mysqli($ms_stmt, $link); @@ -1590,7 +1630,7 @@ else $TOTALcalls = 0; $ASCII_text="\n"; -$ASCII_text.="---------- $rpt_type_verbiage "._QXZ("HANGUP REASON STATS",25)." "._QXZ("DOWNLOAD")."\n"; +$ASCII_text.="---------- $rpt_type_verbiage "._QXZ("HANGUP REASON STATS",25)." "._QXZ("DOWNLOAD")."\n"; $ASCII_text.="+----------------------+------------+\n"; $ASCII_text.="| "._QXZ("HANGUP REASON",20)." | $rpt_type_verbiages |\n"; $ASCII_text.="+----------------------+------------+\n"; @@ -1598,10 +1638,10 @@ $ASCII_text.="+----------------------+------------+\n"; $CSV_text3.="\n\"$rpt_type_verbiage "._QXZ("HANGUP REASON STATS")."\"\n"; $CSV_text3.="\""._QXZ("HANGUP REASON")."\",\"$rpt_type_verbiages\"\n"; -$stmt="select count(*),term_reason from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) group by term_reason order by term_reason;"; +$stmt="select count(*),term_reason from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) group by term_reason order by term_reason;"; if ($DID=='Y') { - $stmt="select count(*),term_reason from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by term_reason order by term_reason;"; + $stmt="select count(*),term_reason from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by term_reason order by term_reason;"; } $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$ASCII_text.="$stmt\n";} @@ -1676,7 +1716,7 @@ else $TOTALcalls = 0; $ASCII_text="\n"; -$ASCII_text.="---------- $rpt_type_verbiage "._QXZ("STATUS STATS",18)." "._QXZ("DOWNLOAD")."\n"; +$ASCII_text.="---------- $rpt_type_verbiage "._QXZ("STATUS STATS",18)." "._QXZ("DOWNLOAD")."\n"; $ASCII_text.="+--------+----------------------+----------------------+------------+------------+----------+-----------+\n"; $ASCII_text.="| "._QXZ("STATUS",6)." | "._QXZ("DESCRIPTION",20)." | "._QXZ("CATEGORY",20)." | $rpt_type_verbiages | "._QXZ("TOTAL TIME",10)." | "._QXZ("AVG TIME",8)." |$rpt_type_verbiages/"._QXZ("HOUR",4)."|\n"; $ASCII_text.="+--------+----------------------+----------------------+------------+------------+----------+-----------+\n"; @@ -1691,10 +1731,10 @@ $CSV_text4.="\""._QXZ("STATUS")."\",\""._QXZ("DESCRIPTION")."\",\""._QXZ("CATEGO ## get counts and time totals for all statuses in this campaign -$stmt="select count(*),status,sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) group by status;"; +$stmt="select count(*),status,sum(length_in_sec) from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) group by status;"; if ($DID=='Y') { - $stmt="select count(*),status,sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by status;"; + $stmt="select count(*),status,sum(length_in_sec) from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by status;"; } $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$ASCII_text.="$stmt\n";} @@ -1851,7 +1891,7 @@ else ######### STATUS CATEGORY STATS $ASCII_text="\n"; -$ASCII_text.="---------- "._QXZ("CUSTOM STATUS CATEGORY STATS",34)." "._QXZ("DOWNLOAD")."\n"; +$ASCII_text.="---------- "._QXZ("CUSTOM STATUS CATEGORY STATS",34)." "._QXZ("DOWNLOAD")."\n"; $ASCII_text.="+----------------------+------------+--------------------------------+\n"; $ASCII_text.="| "._QXZ("CATEGORY",20)." | $rpt_type_verbiages | "._QXZ("DESCRIPTION",30)." |\n"; $ASCII_text.="+----------------------+------------+--------------------------------+\n"; @@ -1937,7 +1977,7 @@ else $TOTALcalls = 0; $ASCII_text="\n"; -$ASCII_text.="---------- $rpt_type_verbiage "._QXZ("INITIAL QUEUE POSITION BREAKDOWN",38)." "._QXZ("DOWNLOAD")."\n"; +$ASCII_text.="---------- $rpt_type_verbiage "._QXZ("INITIAL QUEUE POSITION BREAKDOWN",38)." "._QXZ("DOWNLOAD")."\n"; $ASCII_text.="+-------------------------------------------------------------------------------------+------------+\n"; $ASCII_text.="| 1 2 3 4 5 6 7 8 9 10 15 20 25 +25 | "._QXZ("TOTAL",10)." |\n"; $ASCII_text.="+-------------------------------------------------------------------------------------+------------+\n"; @@ -1946,10 +1986,10 @@ $CSV_text6.="\n\"$rpt_type_verbiage "._QXZ("INITIAL QUEUE POSITION BREAKDOWN")." $CSV_text6.="\"\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"15\",\"20\",\"25\",\"+25\",\""._QXZ("TOTAL")."\"\n"; -$stmt="select count(*),queue_position from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) group by queue_position;"; +$stmt="select count(*),queue_position from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) group by queue_position;"; if ($DID=='Y') { - $stmt="select count(*),queue_position from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by queue_position;"; + $stmt="select count(*),queue_position from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by queue_position;"; } $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$ASCII_text.="$stmt\n";} @@ -2002,14 +2042,14 @@ $CSV_text6.="\"\",\"$qp_1\",\"$qp_2\",\"$qp_3\",\"$qp_4\",\"$qp_5\",\"$qp_6\",\" if ($report_display_type=="HTML") { - $stmt="select count(*),queue_position as qp from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) group by qp order by qp asc;"; - $ms_stmt="select queue_position from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) order by queue_position desc limit 1;"; - $mc_stmt="select count(*) as ct from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) group by queue_position order by ct desc limit 1;"; + $stmt="select count(*),queue_position as qp from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) group by qp order by qp asc;"; + $ms_stmt="select queue_position from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) order by queue_position desc limit 1;"; + $mc_stmt="select count(*) as ct from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) group by queue_position order by ct desc limit 1;"; if ($DID=='Y') { - $stmt="select count(*),queue_position as qp from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by qp order by qp asc;"; - $ms_stmt="select queue_position from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) order by queue_position desc limit 1;"; - $mc_stmt="select count(*) as ct from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by queue_position order by ct desc limit 1;"; + $stmt="select count(*),queue_position as qp from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by qp order by qp asc;"; + $ms_stmt="select queue_position from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) order by queue_position desc limit 1;"; + $mc_stmt="select count(*) as ct from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by queue_position order by ct desc limit 1;"; } if ($DB) {$GRAPH_text.=$stmt."\n";} $ms_rslt=mysql_to_mysqli($ms_stmt, $link); @@ -2079,7 +2119,7 @@ $TOTtime=0; $TOTavg=0; $ASCII_text="\n"; -$ASCII_text.="---------- "._QXZ("AGENT STATS",17)." "._QXZ("DOWNLOAD")."\n"; +$ASCII_text.="---------- "._QXZ("AGENT STATS",17)." "._QXZ("DOWNLOAD")."\n"; $ASCII_text.="+--------------------------+------------+------------+--------+\n"; $ASCII_text.="| "._QXZ("AGENT",24)." | $rpt_type_verbiages | "._QXZ("TIME H:M:S",10)." |"._QXZ("AVERAGE",8)."|\n"; $ASCII_text.="+--------------------------+------------+------------+--------+\n"; @@ -2100,10 +2140,10 @@ $CALLS_graph=$graph_header."$rpt_type_verbiages $TIMEHMS_graph=$graph_header.""._QXZ("TIME H:M:S").""; $AVERAGE_graph=$graph_header.""._QXZ("AVERAGE").""; -$stmt="select vicidial_closer_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_closer_log,vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and vicidial_closer_log.user is not null and length_in_sec is not null and vicidial_closer_log.user=vicidial_users.user group by vicidial_closer_log.user;"; +$stmt="select ".$vicidial_closer_log_table.".user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from ".$vicidial_closer_log_table.",vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and ".$vicidial_closer_log_table.".user is not null and length_in_sec is not null and ".$vicidial_closer_log_table.".user=vicidial_users.user group by ".$vicidial_closer_log_table.".user;"; if ($DID=='Y') { - $stmt="select vicidial_closer_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_closer_log,vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and vicidial_closer_log.user is not null and length_in_sec is not null and vicidial_closer_log.user=vicidial_users.user group by vicidial_closer_log.user;"; + $stmt="select ".$vicidial_closer_log_table.".user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from ".$vicidial_closer_log_table.",vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and ".$vicidial_closer_log_table.".user is not null and length_in_sec is not null and ".$vicidial_closer_log_table.".user=vicidial_users.user group by ".$vicidial_closer_log_table.".user;"; } $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$ASCII_text.="$stmt\n";} @@ -2211,7 +2251,7 @@ $CSV_text7.="\""._QXZ("TOTAL Agents").": $TOTagents\",\"$TOTcalls\",\"$TOTtime\" ######### TIME STATS $MAIN.="\n"; -$MAIN.="---------- "._QXZ("TIME STATS",16)." "._QXZ("DOWNLOAD")."\n"; +$MAIN.="---------- "._QXZ("TIME STATS",16)." "._QXZ("DOWNLOAD")."\n"; $CSV_text9.="\""._QXZ("TIME STATS")."\"\n\n"; @@ -2221,10 +2261,10 @@ $MAIN.="\n"; ############################## ######### 15-minute increment breakdowns of total calls and drops, then answered table $BDansweredCALLS = 0; -$stmt="SELECT status,queue_seconds,UNIX_TIMESTAMP(call_date),call_date from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL);"; +$stmt="SELECT status,queue_seconds,UNIX_TIMESTAMP(call_date),call_date from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL);"; if ($DID=='Y') { - $stmt="SELECT status,queue_seconds,UNIX_TIMESTAMP(call_date),call_date from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL);"; + $stmt="SELECT status,queue_seconds,UNIX_TIMESTAMP(call_date),call_date from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL);"; } $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} @@ -2365,72 +2405,75 @@ while ($i <= 96) if ($h == 2) {$time = " 30 ";} if ($h == 3) {$time = " 45 ";} $Ghour_count = $hour_count[$i]; - if ($Ghour_count < 1) + if ($i >= $first_shift_record && $i<=$last_shift_record) # May need to use lower. Ask Matt. +# if ($i >= $first_shift_record && $i<$last_shift_record) { - if ( ($no_lines_yet) or ($i > $last_full_record) ) + if ($Ghour_count < 1) { - $do_nothing=1; + # if ( ($no_lines_yet) or ($i > $last_full_record) ) + # { + # $do_nothing=1; + # } + # else + # { + $hour_count[$i] = sprintf("%-5s", $hour_count[$i]); + $ASCII_text.="|$time|"; + $CSV_text9.="\"$time\","; + $k=0; while ($k <= 102) {$ASCII_text.=" "; $k++;} + $ASCII_text.="| $hour_count[$i] |\n"; + $CSV_text9.="\"0\",\"0\"\n"; + + # } } else { - $hour_count[$i] = sprintf("%-5s", $hour_count[$i]); - $ASCII_text.="|$time|"; - $CSV_text9.="\"$time\","; - $k=0; while ($k <= 102) {$ASCII_text.=" "; $k++;} - $ASCII_text.="| $hour_count[$i] |\n"; - $CSV_text9.="\"0\",\"0\"\n"; + $no_lines_yet=0; + $Xhour_count = ($Ghour_count * $hour_multiplier); + $Yhour_count = (99 - $Xhour_count); + $Gdrop_count = $drop_count[$i]; + if ($Gdrop_count < 1) + { + $hour_count[$i] = sprintf("%-5s", $hour_count[$i]); + + $ASCII_text.="|$time|"; + $CSV_text9.="\"$time\","; + $k=0; while ($k <= $Xhour_count) {$ASCII_text.="*"; $k++; $char_counter++;} + $ASCII_text.="*X"; $char_counter++; + $k=0; while ($k <= $Yhour_count) {$ASCII_text.=" "; $k++; $char_counter++;} + while ($char_counter <= 101) {$ASCII_text.=" "; $char_counter++;} + $ASCII_text.="| 0 | $hour_count[$i] |\n"; + $CSV_text9.="\"0\",\"$hour_count[$i]\"\n"; + + } + else + { + $Xdrop_count = ($Gdrop_count * $hour_multiplier); + + # if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);} + + $XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 ); + + $hour_count[$i]+=0; + $drop_count[$i]+=0; + + $hour_count[$i] = sprintf("%-5s", $hour_count[$i]); + $drop_count[$i] = sprintf("%-5s", $drop_count[$i]); + + $ASCII_text.="|$time|"; + $CSV_text9.="\"$time\","; + $k=0; while ($k <= $Xdrop_count) {$ASCII_text.=">"; $k++; $char_counter++;} + $ASCII_text.="D"; $char_counter++; + $k=0; while ($k <= $XXhour_count) {$ASCII_text.="*"; $k++; $char_counter++;} + $ASCII_text.="X"; $char_counter++; + $k=0; while ($k <= $Yhour_count) {$ASCII_text.=" "; $k++; $char_counter++;} + while ($char_counter <= 102) {$ASCII_text.=" "; $char_counter++;} + $ASCII_text.="| $drop_count[$i] | $hour_count[$i] |\n"; + $CSV_text9.="\"$drop_count[$i]\",\"$hour_count[$i]\"\n"; + + } } - } - else - { - $no_lines_yet=0; - $Xhour_count = ($Ghour_count * $hour_multiplier); - $Yhour_count = (99 - $Xhour_count); - - $Gdrop_count = $drop_count[$i]; - if ($Gdrop_count < 1) - { - $hour_count[$i] = sprintf("%-5s", $hour_count[$i]); - - $ASCII_text.="|$time|"; - $CSV_text9.="\"$time\","; - $k=0; while ($k <= $Xhour_count) {$ASCII_text.="*"; $k++; $char_counter++;} - $ASCII_text.="*X"; $char_counter++; - $k=0; while ($k <= $Yhour_count) {$ASCII_text.=" "; $k++; $char_counter++;} - while ($char_counter <= 101) {$ASCII_text.=" "; $char_counter++;} - $ASCII_text.="| 0 | $hour_count[$i] |\n"; - $CSV_text9.="\"0\",\"$hour_count[$i]\"\n"; - - } - else - { - $Xdrop_count = ($Gdrop_count * $hour_multiplier); - - # if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);} - - $XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 ); - - $hour_count[$i]+=0; - $drop_count[$i]+=0; - - $hour_count[$i] = sprintf("%-5s", $hour_count[$i]); - $drop_count[$i] = sprintf("%-5s", $drop_count[$i]); - - $ASCII_text.="|$time|"; - $CSV_text9.="\"$time\","; - $k=0; while ($k <= $Xdrop_count) {$ASCII_text.=">"; $k++; $char_counter++;} - $ASCII_text.="D"; $char_counter++; - $k=0; while ($k <= $XXhour_count) {$ASCII_text.="*"; $k++; $char_counter++;} - $ASCII_text.="X"; $char_counter++; - $k=0; while ($k <= $Yhour_count) {$ASCII_text.=" "; $k++; $char_counter++;} - while ($char_counter <= 102) {$ASCII_text.=" "; $char_counter++;} - $ASCII_text.="| $drop_count[$i] | $hour_count[$i] |\n"; - $CSV_text9.="\"$drop_count[$i]\",\"$hour_count[$i]\"\n"; - - } - } - + } $graph_stats[$i][0]="$time"; $graph_stats[$i][1]=trim($hour_count[$i]); $graph_stats[$i][2]=trim($drop_count[$i]); @@ -2475,7 +2518,7 @@ else ##### Answered wait time breakdown $MAIN.="\n"; -$MAIN.="---------- $rpt_type_verbiage "._QXZ("ANSWERED TIME BREAKDOWN IN SECONDS", 40)." "._QXZ("DOWNLOAD")."\n"; +$MAIN.="---------- $rpt_type_verbiage "._QXZ("ANSWERED TIME BREAKDOWN IN SECONDS", 40)." "._QXZ("DOWNLOAD")."\n"; $MAIN.="+------+-------------------------------------------------------------------------------------------+------------+\n"; $MAIN.="| "._QXZ("HOUR",4)." | 0 5 10 15 20 25 30 35 40 45 50 55 60 90 +90 | "._QXZ("TOTAL",10)." |\n"; $MAIN.="+------+-------------------------------------------------------------------------------------------+------------+\n"; diff --git a/www/vicidial/AST_CLOSERsummary_hourly.php b/www/vicidial/AST_CLOSERsummary_hourly.php index 59242786..b0cd470a 100644 --- a/www/vicidial/AST_CLOSERsummary_hourly.php +++ b/www/vicidial/AST_CLOSERsummary_hourly.php @@ -24,6 +24,7 @@ # 141114-0012 - Finalized adding QXZ translation to all admin files # 141230-1511 - Added code for on-the-fly language translations display # 150516-1300 - Fixed Javascript element problem, Issue #857 +# 151125-1609 - Added search archive option # $startMS = microtime(); @@ -65,6 +66,8 @@ if (isset($_GET["file_download"])) {$file_download=$_GET["file_download"];} elseif (isset($_POST["file_download"])) {$file_download=$_POST["file_download"];} 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"];} $MT[0]='0'; if (strlen($shift)<2) {$shift='ALL';} @@ -92,6 +95,22 @@ if ($qm_conf_ct > 0) ##### END SETTINGS LOOKUP ##### ########################################### +### ARCHIVED DATA CHECK CONFIGURATION +$archives_available="N"; +$table_name="vicidial_closer_log"; +$archive_table_name=use_archive_table($table_name); +if ($archive_table_name!=$table_name) {$archives_available="Y";} + +if ($search_archived_data) + { + $vicidial_closer_log_table=use_archive_table("vicidial_closer_log"); + } +else + { + $vicidial_closer_log_table="vicidial_closer_log"; + } +############# + $stmt = "SELECT local_gmt FROM servers where active='Y' limit 1;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} @@ -438,7 +457,7 @@ if ($bareformat < 1) $MAIN.="\n"; $MAIN.="\n"; $MAIN.="           "; - $MAIN.=""._QXZ("DOWNLOAD")." | "; + $MAIN.=""._QXZ("DOWNLOAD")." | "; $MAIN.=""._QXZ("MODIFY")." | "; $MAIN.=""._QXZ("REPORTS").""; $MAIN.="\n"; @@ -452,6 +471,11 @@ if ($bareformat < 1) $MAIN.="\n"; $MAIN.="\n"; $MAIN.="\n"; + if ($archives_available=="Y") + { + $MAIN.="
"._QXZ("Search archived data")."\n"; + } + $MAIN.="
                      "; $MAIN.="\n"; @@ -631,7 +655,7 @@ else $hTOTmax_queue_seconds = 0; $hTOTdrop_count = 0; - $stmt = "SELECT status,length_in_sec,queue_seconds,call_date,UNIX_TIMESTAMP(call_date),phone_number,campaign_id from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='$group[$i]';"; + $stmt = "SELECT status,length_in_sec,queue_seconds,call_date,UNIX_TIMESTAMP(call_date),phone_number,campaign_id from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='$group[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$ASCII_text.="$stmt\n";} $calls_to_parse = mysqli_num_rows($rslt); diff --git a/www/vicidial/AST_DIDstats.php b/www/vicidial/AST_DIDstats.php index 70e355b2..306c5a4f 100644 --- a/www/vicidial/AST_DIDstats.php +++ b/www/vicidial/AST_DIDstats.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2015 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -26,6 +26,7 @@ # 141020-0848 - Added 9am-10pm and 10am-6pm options # 141113-2040 - Finalized adding QXZ translation to all admin files # 141230-1508 - Added code for on-the-fly language translations display +# 151125-1614 - Added search archive option # $startMS = microtime(); @@ -54,6 +55,8 @@ if (isset($_GET["file_download"])) {$file_download=$_GET["file_download"];} elseif (isset($_POST["file_download"])) {$file_download=$_POST["file_download"];} 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 (strlen($shift)<2) {$shift='ALL';} @@ -79,6 +82,22 @@ if ($qm_conf_ct > 0) ##### END SETTINGS LOOKUP ##### ########################################### +### ARCHIVED DATA CHECK CONFIGURATION +$archives_available="N"; +$table_name="vicidial_did_log"; +$archive_table_name=use_archive_table($table_name); +if ($archive_table_name!=$table_name) {$archives_available="Y";} + +if ($search_archived_data) + { + $vicidial_did_log_table=use_archive_table("vicidial_did_log"); + } +else + { + $vicidial_did_log_table="vicidial_did_log"; + } +############# + if ($non_latin < 1) { $PHP_AUTH_USER = preg_replace('/[^-_0-9a-zA-Z]/', '', $PHP_AUTH_USER); @@ -381,7 +400,7 @@ while ($groups_to_print > $o) $o++; } $MAIN.="\n"; -$MAIN.="\n"; +$MAIN.="\n"; $MAIN.="\n"; -$MAIN.="\n"; + +if ($archives_available=="Y") + { + $MAIN.="


"._QXZ("Search archived data")."\n"; + } + +$MAIN.="
\n"; $MAIN.="\n"; $MAIN.="  "; $MAIN.="\n"; $MAIN.="\n"; $MAIN.="           "; - $MAIN.=""._QXZ("DOWNLOAD")." | "; + $MAIN.=""._QXZ("DOWNLOAD")." | "; $MAIN.=""._QXZ("MODIFY")." | "; $MAIN.=""._QXZ("REPORTS")." | "; $MAIN.=""._QXZ("OUTBOUND REPORT")." \n"; @@ -541,6 +568,10 @@ $MAIN.="
"._QXZ("Display as").":  "; $MAIN.="\n
"; +if ($archives_available=="Y") + { + $MAIN.="
"._QXZ("Search archived data")."
\n"; + } $MAIN.="    \n"; $MAIN.="\n"; @@ -571,11 +602,11 @@ else ##### Grab all records for the IVR for the specified time period if ($type == 'inbound') { - $stmt="select uniqueid,extension,start_time,comment_a,comment_b,comment_d,UNIX_TIMESTAMP(start_time),phone_ext from live_inbound_log where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and comment_a IN($group_SQL) order by uniqueid,start_time;"; + $stmt="select uniqueid,extension,start_time,comment_a,comment_b,comment_d,UNIX_TIMESTAMP(start_time),phone_ext from ".$live_inbound_log_table." where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and comment_a IN($group_SQL) order by uniqueid,start_time;"; } else { - $stmt="select uniqueid,caller_code,event_date,campaign_id,menu_id,menu_action,UNIX_TIMESTAMP(event_date),caller_code from vicidial_outbound_ivr_log where event_date >= '$query_date_BEGIN' and event_date <= '$query_date_END' and campaign_id IN($group_SQL) order by uniqueid,event_date,menu_action desc;"; + $stmt="select uniqueid,caller_code,event_date,campaign_id,menu_id,menu_action,UNIX_TIMESTAMP(event_date),caller_code from ".$vicidial_outbound_ivr_log_table." where event_date >= '$query_date_BEGIN' and event_date <= '$query_date_END' and campaign_id IN($group_SQL) order by uniqueid,event_date,menu_action desc;"; } $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} @@ -759,7 +790,7 @@ else if ($type == 'inbound') { ##### Grab all records for the IVR for the specified time period - $stmt="select status,length_in_sec from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and uniqueid IN($FLOWunique_calls_list[$s]);"; + $stmt="select status,length_in_sec from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and uniqueid IN($FLOWunique_calls_list[$s]);"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$ASCII_text.="$stmt\n";} $vcl_statuses_to_print = mysqli_num_rows($rslt); @@ -893,7 +924,7 @@ else if ($type == 'inbound') { $inb_15min_array=array(); - $stmt="select uniqueid, SEC_TO_TIME((TIME_TO_SEC(min(start_time)) DIV 900) * 900) as stime from live_inbound_log where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and comment_a IN($group_SQL) group by uniqueid"; + $stmt="select uniqueid, SEC_TO_TIME((TIME_TO_SEC(min(start_time)) DIV 900) * 900) as stime from ".$live_inbound_log_table." where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and comment_a IN($group_SQL) group by uniqueid"; $rslt=mysql_to_mysqli($stmt, $link); while ($row=mysqli_fetch_row($rslt)) { @@ -905,7 +936,7 @@ else else { $inb_15min_array=array(); - $stmt="select uniqueid, SEC_TO_TIME((TIME_TO_SEC(min(event_date)) DIV 900) * 900) as stime from vicidial_outbound_ivr_log where event_date >= '$query_date_BEGIN' and event_date <= '$query_date_END' and campaign_id IN($group_SQL) and menu_action='' group by uniqueid"; + $stmt="select uniqueid, SEC_TO_TIME((TIME_TO_SEC(min(event_date)) DIV 900) * 900) as stime from ".$vicidial_outbound_ivr_log_table." where event_date >= '$query_date_BEGIN' and event_date <= '$query_date_END' and campaign_id IN($group_SQL) and menu_action='' group by uniqueid"; $rslt=mysql_to_mysqli($stmt, $link); while ($row=mysqli_fetch_row($rslt)) { diff --git a/www/vicidial/AST_LISTS_pass_report.php b/www/vicidial/AST_LISTS_pass_report.php index d9f8f76d..690efc2a 100644 --- a/www/vicidial/AST_LISTS_pass_report.php +++ b/www/vicidial/AST_LISTS_pass_report.php @@ -13,6 +13,7 @@ # 141114-0827 - Finalized adding QXZ translation to all admin files # 141230-0919 - Added code for on-the-fly language translations display # 150516-1303 - Fixed Javascript element problem, Issue #857 +# 151125-1640 - Added search archive option # $startMS = microtime(); @@ -39,6 +40,8 @@ if (isset($_GET["report_display_type"])) {$report_display_type=$_GET["report_ elseif (isset($_POST["report_display_type"])) {$report_display_type=$_POST["report_display_type"];} if (isset($_GET["use_lists"])) {$use_lists=$_GET["use_lists"];} elseif (isset($_POST["use_lists"])) {$use_lists=$_POST["use_lists"];} +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 = 'Lists Pass Report'; @@ -65,6 +68,22 @@ if ($qm_conf_ct > 0) ##### END SETTINGS LOOKUP ##### ########################################### +### ARCHIVED DATA CHECK CONFIGURATION +$archives_available="N"; +$table_name="vicidial_log"; +$archive_table_name=use_archive_table($table_name); +if ($archive_table_name!=$table_name) {$archives_available="Y";} + +if ($search_archived_data) + { + $vicidial_log_table=use_archive_table("vicidial_log"); + } +else + { + $vicidial_log_table="vicidial_log"; + } +############# + if ($non_latin < 1) { $PHP_AUTH_USER = preg_replace('/[^-_0-9a-zA-Z]/', '', $PHP_AUTH_USER); @@ -458,6 +477,10 @@ $MAIN.=_QXZ("Display as").":
"; $MAIN.="  "; +if ($archives_available=="Y") + { + $MAIN.="
"._QXZ("Search archived data")."\n"; + } $MAIN.="

\n"; $MAIN.="\n"; $MAIN.="         "; @@ -513,7 +536,7 @@ else $TOTALleads = 0; $OUToutput .= "\n"; - $OUToutput .= "---------- "._QXZ("LIST ID SUMMARY",19)." "._QXZ("DOWNLOAD")."\n"; + $OUToutput .= "---------- "._QXZ("LIST ID SUMMARY",19)." "._QXZ("DOWNLOAD")."\n"; $OUToutput .= "+------------+------------------------------------------+----------+------------+----------+"; $OUToutput .= "---------+---------+---------+---------+---------+---------+"; @@ -866,37 +889,37 @@ else $HA_results = mysqli_num_rows($rslt); if ($HA_results > 0) {$row=mysqli_fetch_row($rslt); $HA_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=1 and status IN($human_answered_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count=1 and status IN($human_answered_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $HA_one_results = mysqli_num_rows($rslt); if ($HA_one_results > 0) {$row=mysqli_fetch_row($rslt); $HA_one_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=2 and status IN($human_answered_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count=2 and status IN($human_answered_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $HA_two_results = mysqli_num_rows($rslt); if ($HA_two_results > 0) {$row=mysqli_fetch_row($rslt); $HA_two_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=3 and status IN($human_answered_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count=3 and status IN($human_answered_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $HA_three_results = mysqli_num_rows($rslt); if ($HA_three_results > 0) {$row=mysqli_fetch_row($rslt); $HA_three_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count='4' and status IN($human_answered_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count='4' and status IN($human_answered_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $HA_four_results = mysqli_num_rows($rslt); if ($HA_four_results > 0) {$row=mysqli_fetch_row($rslt); $HA_four_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count='5' and status IN($human_answered_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count='5' and status IN($human_answered_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $HA_five_results = mysqli_num_rows($rslt); if ($HA_five_results > 0) {$row=mysqli_fetch_row($rslt); $HA_five_count = $row[0];} - $stmt="select count(distinct lead_id) from vicidial_log where status IN($human_answered_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(distinct lead_id) from ".$vicidial_log_table." where status IN($human_answered_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $HA_all_results = mysqli_num_rows($rslt); @@ -975,37 +998,37 @@ else $SA_results = mysqli_num_rows($rslt); if ($SA_results > 0) {$row=mysqli_fetch_row($rslt); $SA_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=1 and status IN($sale_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count=1 and status IN($sale_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $SA_one_results = mysqli_num_rows($rslt); if ($SA_one_results > 0) {$row=mysqli_fetch_row($rslt); $SA_one_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=2 and status IN($sale_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count=2 and status IN($sale_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $SA_two_results = mysqli_num_rows($rslt); if ($SA_two_results > 0) {$row=mysqli_fetch_row($rslt); $SA_two_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=3 and status IN($sale_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count=3 and status IN($sale_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $SA_three_results = mysqli_num_rows($rslt); if ($SA_three_results > 0) {$row=mysqli_fetch_row($rslt); $SA_three_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count='4' and status IN($sale_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count='4' and status IN($sale_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $SA_four_results = mysqli_num_rows($rslt); if ($SA_four_results > 0) {$row=mysqli_fetch_row($rslt); $SA_four_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count='5' and status IN($sale_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count='5' and status IN($sale_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $SA_five_results = mysqli_num_rows($rslt); if ($SA_five_results > 0) {$row=mysqli_fetch_row($rslt); $SA_five_count = $row[0];} - $stmt="select count(distinct lead_id) from vicidial_log where status IN($sale_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(distinct lead_id) from ".$vicidial_log_table." where status IN($sale_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $SA_all_results = mysqli_num_rows($rslt); @@ -1084,37 +1107,37 @@ else $DN_results = mysqli_num_rows($rslt); if ($DN_results > 0) {$row=mysqli_fetch_row($rslt); $DN_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=1 and status IN($dnc_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count=1 and status IN($dnc_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $DN_one_results = mysqli_num_rows($rslt); if ($DN_one_results > 0) {$row=mysqli_fetch_row($rslt); $DN_one_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=2 and status IN($dnc_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count=2 and status IN($dnc_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $DN_two_results = mysqli_num_rows($rslt); if ($DN_two_results > 0) {$row=mysqli_fetch_row($rslt); $DN_two_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=3 and status IN($dnc_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count=3 and status IN($dnc_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $DN_three_results = mysqli_num_rows($rslt); if ($DN_three_results > 0) {$row=mysqli_fetch_row($rslt); $DN_three_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count='4' and status IN($dnc_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count='4' and status IN($dnc_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $DN_four_results = mysqli_num_rows($rslt); if ($DN_four_results > 0) {$row=mysqli_fetch_row($rslt); $DN_four_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count='5' and status IN($dnc_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count='5' and status IN($dnc_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $DN_five_results = mysqli_num_rows($rslt); if ($DN_five_results > 0) {$row=mysqli_fetch_row($rslt); $DN_five_count = $row[0];} - $stmt="select count(distinct lead_id) from vicidial_log where status IN($dnc_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(distinct lead_id) from ".$vicidial_log_table." where status IN($dnc_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $DN_all_results = mysqli_num_rows($rslt); @@ -1193,37 +1216,37 @@ else $CC_results = mysqli_num_rows($rslt); if ($CC_results > 0) {$row=mysqli_fetch_row($rslt); $CC_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=1 and status IN($customer_contact_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count=1 and status IN($customer_contact_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $CC_one_results = mysqli_num_rows($rslt); if ($CC_one_results > 0) {$row=mysqli_fetch_row($rslt); $CC_one_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=2 and status IN($customer_contact_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count=2 and status IN($customer_contact_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $CC_two_results = mysqli_num_rows($rslt); if ($CC_two_results > 0) {$row=mysqli_fetch_row($rslt); $CC_two_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=3 and status IN($customer_contact_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count=3 and status IN($customer_contact_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $CC_three_results = mysqli_num_rows($rslt); if ($CC_three_results > 0) {$row=mysqli_fetch_row($rslt); $CC_three_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count='4' and status IN($customer_contact_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count='4' and status IN($customer_contact_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $CC_four_results = mysqli_num_rows($rslt); if ($CC_four_results > 0) {$row=mysqli_fetch_row($rslt); $CC_four_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count='5' and status IN($customer_contact_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count='5' and status IN($customer_contact_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $CC_five_results = mysqli_num_rows($rslt); if ($CC_five_results > 0) {$row=mysqli_fetch_row($rslt); $CC_five_count = $row[0];} - $stmt="select count(distinct lead_id) from vicidial_log where status IN($customer_contact_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(distinct lead_id) from ".$vicidial_log_table." where status IN($customer_contact_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $CC_all_results = mysqli_num_rows($rslt); @@ -1302,37 +1325,37 @@ else $UW_results = mysqli_num_rows($rslt); if ($UW_results > 0) {$row=mysqli_fetch_row($rslt); $UW_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=1 and status IN($unworkable_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count=1 and status IN($unworkable_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $UW_one_results = mysqli_num_rows($rslt); if ($UW_one_results > 0) {$row=mysqli_fetch_row($rslt); $UW_one_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=2 and status IN($unworkable_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count=2 and status IN($unworkable_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $UW_two_results = mysqli_num_rows($rslt); if ($UW_two_results > 0) {$row=mysqli_fetch_row($rslt); $UW_two_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=3 and status IN($unworkable_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count=3 and status IN($unworkable_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $UW_three_results = mysqli_num_rows($rslt); if ($UW_three_results > 0) {$row=mysqli_fetch_row($rslt); $UW_three_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count='4' and status IN($unworkable_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count='4' and status IN($unworkable_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $UW_four_results = mysqli_num_rows($rslt); if ($UW_four_results > 0) {$row=mysqli_fetch_row($rslt); $UW_four_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count='5' and status IN($unworkable_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count='5' and status IN($unworkable_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $UW_five_results = mysqli_num_rows($rslt); if ($UW_five_results > 0) {$row=mysqli_fetch_row($rslt); $UW_five_count = $row[0];} - $stmt="select count(distinct lead_id) from vicidial_log where status IN($unworkable_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(distinct lead_id) from ".$vicidial_log_table." where status IN($unworkable_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $UW_all_results = mysqli_num_rows($rslt); @@ -1411,37 +1434,37 @@ else $BA_results = mysqli_num_rows($rslt); if ($BA_results > 0) {$row=mysqli_fetch_row($rslt); $BA_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=1 and status IN($scheduled_callback_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count=1 and status IN($scheduled_callback_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $BA_one_results = mysqli_num_rows($rslt); if ($BA_one_results > 0) {$row=mysqli_fetch_row($rslt); $BA_one_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=2 and status IN($scheduled_callback_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count=2 and status IN($scheduled_callback_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $BA_two_results = mysqli_num_rows($rslt); if ($BA_two_results > 0) {$row=mysqli_fetch_row($rslt); $BA_two_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=3 and status IN($scheduled_callback_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count=3 and status IN($scheduled_callback_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $BA_three_results = mysqli_num_rows($rslt); if ($BA_three_results > 0) {$row=mysqli_fetch_row($rslt); $BA_three_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count='4' and status IN($scheduled_callback_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count='4' and status IN($scheduled_callback_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $BA_four_results = mysqli_num_rows($rslt); if ($BA_four_results > 0) {$row=mysqli_fetch_row($rslt); $BA_four_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count='5' and status IN($scheduled_callback_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count='5' and status IN($scheduled_callback_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $BA_five_results = mysqli_num_rows($rslt); if ($BA_five_results > 0) {$row=mysqli_fetch_row($rslt); $BA_five_count = $row[0];} - $stmt="select count(distinct lead_id) from vicidial_log where status IN($scheduled_callback_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(distinct lead_id) from ".$vicidial_log_table." where status IN($scheduled_callback_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $BA_all_results = mysqli_num_rows($rslt); @@ -1520,37 +1543,37 @@ else $MP_results = mysqli_num_rows($rslt); if ($MP_results > 0) {$row=mysqli_fetch_row($rslt); $MP_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=1 and status IN($completed_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count=1 and status IN($completed_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $MP_one_results = mysqli_num_rows($rslt); if ($MP_one_results > 0) {$row=mysqli_fetch_row($rslt); $MP_one_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=2 and status IN($completed_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count=2 and status IN($completed_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $MP_two_results = mysqli_num_rows($rslt); if ($MP_two_results > 0) {$row=mysqli_fetch_row($rslt); $MP_two_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=3 and status IN($completed_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count=3 and status IN($completed_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $MP_three_results = mysqli_num_rows($rslt); if ($MP_three_results > 0) {$row=mysqli_fetch_row($rslt); $MP_three_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count='4' and status IN($completed_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count='4' and status IN($completed_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $MP_four_results = mysqli_num_rows($rslt); if ($MP_four_results > 0) {$row=mysqli_fetch_row($rslt); $MP_four_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count='5' and status IN($completed_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(*) from ".$vicidial_log_table." where called_count='5' and status IN($completed_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $MP_five_results = mysqli_num_rows($rslt); if ($MP_five_results > 0) {$row=mysqli_fetch_row($rslt); $MP_five_count = $row[0];} - $stmt="select count(distinct lead_id) from vicidial_log where status IN($completed_statuses) and list_id='$LISTIDlists[$i]';"; + $stmt="select count(distinct lead_id) from ".$vicidial_log_table." where status IN($completed_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $MP_all_results = mysqli_num_rows($rslt); diff --git a/www/vicidial/AST_OUTBOUNDsummary_interval.php b/www/vicidial/AST_OUTBOUNDsummary_interval.php index cfedfe2b..f492f5a8 100644 --- a/www/vicidial/AST_OUTBOUNDsummary_interval.php +++ b/www/vicidial/AST_OUTBOUNDsummary_interval.php @@ -24,6 +24,7 @@ # 141114-0822 - Finalized adding QXZ translation to all admin files # 141230-0912 - Added code for on-the-fly language translations display # 150516-1305 - Fixed Javascript element problem, Issue #857 +# 151125-1632 - Added search archive option # $startMS = microtime(); @@ -63,6 +64,8 @@ if (isset($_GET["file_download"])) {$file_download=$_GET["file_download"];} elseif (isset($_POST["file_download"])) {$file_download=$_POST["file_download"];} 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"];} $MT[0]='0'; if (strlen($shift)<2) {$shift='ALL';} @@ -92,6 +95,30 @@ if ($qm_conf_ct > 0) ##### END SETTINGS LOOKUP ##### ########################################### +### ARCHIVED DATA CHECK CONFIGURATION +$archives_available="N"; +$log_tables_array=array("vicidial_log", "vicidial_closer_log", "vicidial_agent_log"); +for ($t=0; $t         "; - $MAIN.=""._QXZ("DOWNLOAD")." | "; + $MAIN.=""._QXZ("DOWNLOAD")." | "; $MAIN.=""._QXZ("MODIFY")." | "; $MAIN.=""._QXZ("REPORTS").""; $MAIN.="


\n"; @@ -594,6 +621,10 @@ if ($bareformat < 1) $MAIN.="\n
"; + if ($archives_available=="Y") + { + $MAIN.=""._QXZ("Search archived data")."\n"; + } $MAIN.="
        "; $MAIN.="\n"; @@ -775,7 +806,7 @@ else $u=0; ##### Gather Agent time records - $stmt="select event_time,UNIX_TIMESTAMP(event_time),campaign_id,pause_sec,wait_sec,talk_sec,dispo_sec from vicidial_agent_log where event_time >= '$query_date_BEGIN' and event_time <= '$query_date_END' and campaign_id IN('$group_drop[$i]','$group[$i]');"; + $stmt="select event_time,UNIX_TIMESTAMP(event_time),campaign_id,pause_sec,wait_sec,talk_sec,dispo_sec from ".$vicidial_agent_log_table." where event_time >= '$query_date_BEGIN' and event_time <= '$query_date_END' and campaign_id IN('$group_drop[$i]','$group[$i]');"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$ASCII_text.="$stmt\n";} $AGENTtime_to_print = mysqli_num_rows($rslt); @@ -793,7 +824,7 @@ else } ##### Gather outbound calls - $stmt = "SELECT status,length_in_sec,call_date,UNIX_TIMESTAMP(call_date),phone_number,campaign_id,uniqueid,lead_id from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='$group[$i]';"; + $stmt = "SELECT status,length_in_sec,call_date,UNIX_TIMESTAMP(call_date),phone_number,campaign_id,uniqueid,lead_id from ".$vicidial_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='$group[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$ASCII_text.="$stmt\n";} $calls_to_parse = mysqli_num_rows($rslt); @@ -834,7 +865,7 @@ else $length_in_secZ=0; $queue_secondsZ=0; $agent_alert_delayZ=0; - $stmt="select status,length_in_sec,queue_seconds,agent_alert_delay,call_date,UNIX_TIMESTAMP(call_date),phone_number,campaign_id,closecallid,lead_id,uniqueid from vicidial_closer_log,vicidial_inbound_groups where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and group_id=campaign_id and campaign_id='$group_drop[$i]';"; + $stmt="select status,length_in_sec,queue_seconds,agent_alert_delay,call_date,UNIX_TIMESTAMP(call_date),phone_number,campaign_id,closecallid,lead_id,uniqueid from ".$vicidial_closer_log_table.",vicidial_inbound_groups where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and group_id=campaign_id and campaign_id='$group_drop[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$ASCII_text.="$stmt\n";} $INallcalls_to_printZ = mysqli_num_rows($rslt); diff --git a/www/vicidial/AST_VDADstats.php b/www/vicidial/AST_VDADstats.php index dd108c27..e924caaf 100644 --- a/www/vicidial/AST_VDADstats.php +++ b/www/vicidial/AST_VDADstats.php @@ -45,6 +45,7 @@ # 141230-1353 - Added code for on-the-fly language translations display # 150516-1306 - Fixed Javascript element problem, Issue #857 # 150619-0137 - Added option to calculate 'Percent of DROP Calls taken out of Answers' differently +# 151125-1615 - Added search archive option # $startMS = microtime(); @@ -89,6 +90,8 @@ 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 (strlen($shift)<2) {$shift='ALL';} if (strlen($bottom_graph)<2) {$bottom_graph='NO';} @@ -125,6 +128,34 @@ if (file_exists('options.php')) require('options.php'); } +### ARCHIVED DATA CHECK CONFIGURATION +$archives_available="N"; +$log_tables_array=array("vicidial_log", "user_call_log", "vicidial_carrier_log", "vicidial_closer_log", "vicidial_agent_log"); +for ($t=0; $t
"._QXZ("Search archived data")."\n"; + } + echo " "._QXZ("Campaigns").":
"; echo "\n"; -$MAIN.=""._QXZ("Show hourly results")."
"._QXZ("Show disposition statuses")."
"._QXZ("Ignore after-hours calls")."
"._QXZ("DOWNLOAD")." | "._QXZ("MODIFY")." | "._QXZ("REPORTS")."\n"; +$MAIN.=""._QXZ("Show hourly results")."
"._QXZ("Show disposition statuses")."
"._QXZ("Ignore after-hours calls"); +if ($archives_available=="Y") + { + $MAIN.="
"._QXZ("Search archived data")."\n"; + } +$MAIN.="
"._QXZ("DOWNLOAD")." | "._QXZ("MODIFY")." | "._QXZ("REPORTS")."\n"; $MAIN.=""; $MAIN.="
\n\n";
 
@@ -645,7 +669,7 @@ else
 	$CSV_text.="\n\n";
 
 	if ($show_disposition_statuses) {
-		$dispo_stmt="select distinct status from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id in (" . $groups_selected_str . ") $big_shift_time_SQL_clause order by status;";
+		$dispo_stmt="select distinct status from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id in (" . $groups_selected_str . ") $big_shift_time_SQL_clause order by status;";
 		#echo $dispo_stmt."
"; $dispo_rslt=mysql_to_mysqli($dispo_stmt, $link); $dispo_str=""; @@ -813,7 +837,7 @@ else ### GRAB ALL RECORDS WITHIN RANGE FROM THE DATABASE ### - $stmt="select queue_seconds,UNIX_TIMESTAMP(call_date),length_in_sec,status,term_reason,call_date,user from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id in (" . $groups_selected_str . ");"; + $stmt="select queue_seconds,UNIX_TIMESTAMP(call_date),length_in_sec,status,term_reason,call_date,user from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id in (" . $groups_selected_str . ");"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$ASCII_text.="$stmt\n";} $records_to_grab = mysqli_num_rows($rslt); diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php index 16d8c4d7..968972df 100644 --- a/www/vicidial/admin.php +++ b/www/vicidial/admin.php @@ -33468,15 +33468,15 @@ if ($ADD==1300) else {$bgcolor='bgcolor="#9BB9FB"';} - # truncate description and carrier if they are more than 30 characters - if (strlen($row[2])>30) + # truncate description and carrier if they are more than 60 characters + if (strlen($row[2])>60) { - while (strlen($row[2])>30) {$row[2] = preg_replace("/.$/",'',$row[2]);} + while (strlen($row[2])>60) {$row[2] = preg_replace("/.$/",'',$row[2]);} $row[2] .= '...'; } - if (strlen($row[3])>30) + if (strlen($row[3])>40) { - while (strlen($row[3])>30) {$row[3] = preg_replace("/.$/",'',$row[3]);} + while (strlen($row[3])>40) {$row[3] = preg_replace("/.$/",'',$row[3]);} $row[3] .= '...'; } diff --git a/www/vicidial/call_report_export.php b/www/vicidial/call_report_export.php index 9d139c68..de492341 100644 --- a/www/vicidial/call_report_export.php +++ b/www/vicidial/call_report_export.php @@ -45,6 +45,7 @@ # 150727-2143 - Enabled user features for hiding phone numbers and lead data # 150903-1536 - Added compatibility for custom fields data options # 150909-0747 - Fixed issues with translated select list values, issue #885 +# 151125-1621 - Added search archive option # $startMS = microtime(); @@ -89,6 +90,8 @@ 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["search_archived_data"])) {$search_archived_data=$_GET["search_archived_data"];} + elseif (isset($_POST["search_archived_data"])) {$search_archived_data=$_POST["search_archived_data"];} if (strlen($shift)<2) {$shift='ALL';} @@ -116,6 +119,43 @@ if ($qm_conf_ct > 0) } ##### END SETTINGS LOOKUP ##### ########################################### + +### ARCHIVED DATA CHECK CONFIGURATION +$archives_available="N"; +$log_tables_array=array("vicidial_log", "vicidial_closer_log", "vicidial_agent_log", "vicidial_log_extended", "recording_log", "vicidial_carrier_log", "vicidial_cpd_log", "vicidial_did_log", "vicidial_outbound_ivr_log"); +for ($t=0; $t 0) { if ($export_fields == 'EXTENDED') { - $stmt = "SELECT vl.call_date,vl.phone_number,vl.status,vl.user,vu.full_name,vl.campaign_id,vi.vendor_lead_code,vi.source_id,vi.list_id,vi.gmt_offset_now,vi.phone_code,vi.phone_number,vi.title,vi.first_name,vi.middle_initial,vi.last_name,vi.address1,vi.address2,vi.address3,vi.city,vi.state,vi.province,vi.postal_code,vi.country_code,vi.gender,vi.date_of_birth,vi.alt_phone,vi.email,vi.security_phrase,vi.comments,vl.length_in_sec,vl.user_group,vl.alt_dial,vi.rank,vi.owner,vi.lead_id,vl.uniqueid,vi.entry_list_id, ifnull(val.dispo_sec+val.dead_sec,0)$export_fields_SQL from vicidial_users vu,vicidial_list vi,vicidial_log vl LEFT OUTER JOIN vicidial_agent_log val ON vl.uniqueid=val.uniqueid and vl.lead_id=val.lead_id and vl.user=val.user where vl.call_date >= '$query_date 00:00:00' and vl.call_date <= '$end_date 23:59:59' and vu.user=vl.user and vi.lead_id=vl.lead_id $list_SQL $campaign_SQL $user_group_SQL $status_SQL order by vl.call_date limit 100000;"; + $stmt = "SELECT vl.call_date,vl.phone_number,vl.status,vl.user,vu.full_name,vl.campaign_id,vi.vendor_lead_code,vi.source_id,vi.list_id,vi.gmt_offset_now,vi.phone_code,vi.phone_number,vi.title,vi.first_name,vi.middle_initial,vi.last_name,vi.address1,vi.address2,vi.address3,vi.city,vi.state,vi.province,vi.postal_code,vi.country_code,vi.gender,vi.date_of_birth,vi.alt_phone,vi.email,vi.security_phrase,vi.comments,vl.length_in_sec,vl.user_group,vl.alt_dial,vi.rank,vi.owner,vi.lead_id,vl.uniqueid,vi.entry_list_id, ifnull(val.dispo_sec+val.dead_sec,0)$export_fields_SQL from vicidial_users vu,vicidial_list vi,".$vicidial_log_table." vl LEFT OUTER JOIN ".$vicidial_agent_log_table." val ON vl.uniqueid=val.uniqueid and vl.lead_id=val.lead_id and vl.user=val.user where vl.call_date >= '$query_date 00:00:00' and vl.call_date <= '$end_date 23:59:59' and vu.user=vl.user and vi.lead_id=vl.lead_id $list_SQL $campaign_SQL $user_group_SQL $status_SQL order by vl.call_date limit 100000;"; } else { - $stmt = "SELECT vl.call_date,vl.phone_number,vl.status,vl.user,vu.full_name,vl.campaign_id,vi.vendor_lead_code,vi.source_id,vi.list_id,vi.gmt_offset_now,vi.phone_code,vi.phone_number,vi.title,vi.first_name,vi.middle_initial,vi.last_name,vi.address1,vi.address2,vi.address3,vi.city,vi.state,vi.province,vi.postal_code,vi.country_code,vi.gender,vi.date_of_birth,vi.alt_phone,vi.email,vi.security_phrase,vi.comments,vl.length_in_sec,vl.user_group,vl.alt_dial,vi.rank,vi.owner,vi.lead_id,vl.uniqueid,vi.entry_list_id$export_fields_SQL from vicidial_users vu,vicidial_log vl,vicidial_list vi where vl.call_date >= '$query_date 00:00:00' and vl.call_date <= '$end_date 23:59:59' and vu.user=vl.user and vi.lead_id=vl.lead_id $list_SQL $campaign_SQL $user_group_SQL $status_SQL order by vl.call_date limit 100000;"; + $stmt = "SELECT vl.call_date,vl.phone_number,vl.status,vl.user,vu.full_name,vl.campaign_id,vi.vendor_lead_code,vi.source_id,vi.list_id,vi.gmt_offset_now,vi.phone_code,vi.phone_number,vi.title,vi.first_name,vi.middle_initial,vi.last_name,vi.address1,vi.address2,vi.address3,vi.city,vi.state,vi.province,vi.postal_code,vi.country_code,vi.gender,vi.date_of_birth,vi.alt_phone,vi.email,vi.security_phrase,vi.comments,vl.length_in_sec,vl.user_group,vl.alt_dial,vi.rank,vi.owner,vi.lead_id,vl.uniqueid,vi.entry_list_id$export_fields_SQL from vicidial_users vu,".$vicidial_log_table." vl,vicidial_list vi where vl.call_date >= '$query_date 00:00:00' and vl.call_date <= '$end_date 23:59:59' and vu.user=vl.user and vi.lead_id=vl.lead_id $list_SQL $campaign_SQL $user_group_SQL $status_SQL order by vl.call_date limit 100000;"; } $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} @@ -568,11 +608,11 @@ if ($run_export > 0) { if ($export_fields == 'EXTENDED') { - $stmtA = "SELECT vl.call_date,vl.phone_number,vl.status,vl.user,vu.full_name,vl.campaign_id,vi.vendor_lead_code,vi.source_id,vi.list_id,vi.gmt_offset_now,vi.phone_code,vi.phone_number,vi.title,vi.first_name,vi.middle_initial,vi.last_name,vi.address1,vi.address2,vi.address3,vi.city,vi.state,vi.province,vi.postal_code,vi.country_code,vi.gender,vi.date_of_birth,vi.alt_phone,vi.email,vi.security_phrase,vi.comments,vl.length_in_sec,vl.user_group,vl.queue_seconds,vi.rank,vi.owner,vi.lead_id,vl.closecallid,vi.entry_list_id,vl.uniqueid, ifnull(val.dispo_sec+val.dead_sec,0)$export_fields_SQL from vicidial_users vu,vicidial_list vi,vicidial_closer_log vl LEFT OUTER JOIN vicidial_agent_log val ON vl.uniqueid=val.uniqueid and vl.lead_id=val.lead_id and vl.user=val.user where vl.call_date >= '$query_date 00:00:00' and vl.call_date <= '$end_date 23:59:59' and vu.user=vl.user and vi.lead_id=vl.lead_id $list_SQL $group_SQL $user_group_SQL $status_SQL order by vl.call_date limit 100000;"; + $stmtA = "SELECT vl.call_date,vl.phone_number,vl.status,vl.user,vu.full_name,vl.campaign_id,vi.vendor_lead_code,vi.source_id,vi.list_id,vi.gmt_offset_now,vi.phone_code,vi.phone_number,vi.title,vi.first_name,vi.middle_initial,vi.last_name,vi.address1,vi.address2,vi.address3,vi.city,vi.state,vi.province,vi.postal_code,vi.country_code,vi.gender,vi.date_of_birth,vi.alt_phone,vi.email,vi.security_phrase,vi.comments,vl.length_in_sec,vl.user_group,vl.queue_seconds,vi.rank,vi.owner,vi.lead_id,vl.closecallid,vi.entry_list_id,vl.uniqueid, ifnull(val.dispo_sec+val.dead_sec,0)$export_fields_SQL from vicidial_users vu,vicidial_list vi,".$vicidial_closer_log_table." vl LEFT OUTER JOIN ".$vicidial_agent_log_table." val ON vl.uniqueid=val.uniqueid and vl.lead_id=val.lead_id and vl.user=val.user where vl.call_date >= '$query_date 00:00:00' and vl.call_date <= '$end_date 23:59:59' and vu.user=vl.user and vi.lead_id=vl.lead_id $list_SQL $group_SQL $user_group_SQL $status_SQL order by vl.call_date limit 100000;"; } else { - $stmtA = "SELECT vl.call_date,vl.phone_number,vl.status,vl.user,vu.full_name,vl.campaign_id,vi.vendor_lead_code,vi.source_id,vi.list_id,vi.gmt_offset_now,vi.phone_code,vi.phone_number,vi.title,vi.first_name,vi.middle_initial,vi.last_name,vi.address1,vi.address2,vi.address3,vi.city,vi.state,vi.province,vi.postal_code,vi.country_code,vi.gender,vi.date_of_birth,vi.alt_phone,vi.email,vi.security_phrase,vi.comments,vl.length_in_sec,vl.user_group,vl.queue_seconds,vi.rank,vi.owner,vi.lead_id,vl.closecallid,vi.entry_list_id,vl.uniqueid$export_fields_SQL from vicidial_users vu,vicidial_closer_log vl,vicidial_list vi where vl.call_date >= '$query_date 00:00:00' and vl.call_date <= '$end_date 23:59:59' and vu.user=vl.user and vi.lead_id=vl.lead_id $list_SQL $group_SQL $user_group_SQL $status_SQL order by vl.call_date limit 100000;"; + $stmtA = "SELECT vl.call_date,vl.phone_number,vl.status,vl.user,vu.full_name,vl.campaign_id,vi.vendor_lead_code,vi.source_id,vi.list_id,vi.gmt_offset_now,vi.phone_code,vi.phone_number,vi.title,vi.first_name,vi.middle_initial,vi.last_name,vi.address1,vi.address2,vi.address3,vi.city,vi.state,vi.province,vi.postal_code,vi.country_code,vi.gender,vi.date_of_birth,vi.alt_phone,vi.email,vi.security_phrase,vi.comments,vl.length_in_sec,vl.user_group,vl.queue_seconds,vi.rank,vi.owner,vi.lead_id,vl.closecallid,vi.entry_list_id,vl.uniqueid$export_fields_SQL from vicidial_users vu,".$vicidial_closer_log_table." vl,vicidial_list vi where vl.call_date >= '$query_date 00:00:00' and vl.call_date <= '$end_date 23:59:59' and vu.user=vl.user and vi.lead_id=vl.lead_id $list_SQL $group_SQL $user_group_SQL $status_SQL order by vl.call_date limit 100000;"; } $rslt=mysql_to_mysqli($stmtA, $link); if ($DB) {echo "$stmt\n";} @@ -777,7 +817,7 @@ if ($run_export > 0) $rec_id=''; $rec_filename=''; $rec_location=''; - $stmt = "SELECT recording_id,filename,location from recording_log where vicidial_id='$export_vicidial_id[$i]' order by recording_id desc LIMIT 10;"; + $stmt = "SELECT recording_id,filename,location from ".$recording_log_table." where vicidial_id='$export_vicidial_id[$i]' order by recording_id desc LIMIT 10;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $recordings_ct = mysqli_num_rows($rslt); @@ -816,7 +856,7 @@ if ($run_export > 0) { $uniqueidTEST = $export_uniqueid[$i]; $uniqueidTEST = preg_replace('/\..*$/','',$uniqueidTEST); - $stmt = "SELECT caller_code,server_ip from vicidial_log_extended where uniqueid LIKE \"$uniqueidTEST%\" and lead_id='$export_lead_id[$i]' LIMIT 1;"; + $stmt = "SELECT caller_code,server_ip from ".$vicidial_log_extended_table." where uniqueid LIKE \"$uniqueidTEST%\" and lead_id='$export_lead_id[$i]' LIMIT 1;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $vle_ct = mysqli_num_rows($rslt); @@ -838,7 +878,7 @@ if ($run_export > 0) { $uniqueidTEST = $export_uniqueid[$i]; $uniqueidTEST = preg_replace('/\..*$/','',$uniqueidTEST); - $stmt = "SELECT caller_code,server_ip from vicidial_log_extended where uniqueid LIKE \"$uniqueidTEST%\" and lead_id='$export_lead_id[$i]' LIMIT 1;"; + $stmt = "SELECT caller_code,server_ip from ".$vicidial_log_extended_table." where uniqueid LIKE \"$uniqueidTEST%\" and lead_id='$export_lead_id[$i]' LIMIT 1;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $vle_ct = mysqli_num_rows($rslt); @@ -849,7 +889,7 @@ if ($run_export > 0) $export_call_id[$i] = $row[0]; } - $stmt = "SELECT hangup_cause,dialstatus,channel,dial_time,answered_time from vicidial_carrier_log where uniqueid LIKE \"$uniqueidTEST%\" and lead_id='$export_lead_id[$i]' LIMIT 1;"; + $stmt = "SELECT hangup_cause,dialstatus,channel,dial_time,answered_time from ".$vicidial_carrier_log_table." where uniqueid LIKE \"$uniqueidTEST%\" and lead_id='$export_lead_id[$i]' LIMIT 1;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $vcarl_ct = mysqli_num_rows($rslt); @@ -859,7 +899,7 @@ if ($run_export > 0) $extended_data_b = "\t$row[0]\t$row[1]\t$row[2]\t$row[3]\t$row[4]"; } - $stmt = "SELECT result from vicidial_cpd_log where callerid='$export_call_id[$i]' LIMIT 1;"; + $stmt = "SELECT result from ".$vicidial_cpd_log_table." where callerid='$export_call_id[$i]' LIMIT 1;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $vcpdl_ct = mysqli_num_rows($rslt); @@ -869,7 +909,7 @@ if ($run_export > 0) $extended_data_c = "\t$row[0]"; } - $stmt = "SELECT extension,did_id from vicidial_did_log where uniqueid='$export_uniqueid[$i]' LIMIT 1;"; + $stmt = "SELECT extension,did_id from ".$vicidial_did_log_table." where uniqueid='$export_uniqueid[$i]' LIMIT 1;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "$stmt\n";} $vcdid_ct = mysqli_num_rows($rslt); @@ -932,7 +972,7 @@ if ($run_export > 0) $IVRdelimiter='|'; if ($export_fields=='ALTERNATE_1') {$IVRdelimiter='^';} - $stmt="select menu_id,UNIX_TIMESTAMP(event_date) from vicidial_outbound_ivr_log where event_date >= '$query_date 00:00:00' and event_date <= '$end_date 23:59:59' and uniqueid='$export_uniqueid[$i]' order by event_date,menu_action desc;"; + $stmt="select menu_id,UNIX_TIMESTAMP(event_date) from ".$vicidial_outbound_ivr_log_table." where event_date >= '$query_date 00:00:00' and event_date <= '$end_date 23:59:59' and uniqueid='$export_uniqueid[$i]' order by event_date,menu_action desc;"; $rslt=mysql_to_mysqli($stmt, $link); # $ivr_path = "$stmt|$export_uniqueid[$i]|"; if ($DB) {$MAIN.="$stmt\n";} @@ -1309,6 +1349,12 @@ else echo ""._QXZ("Export Fields").":
\n"; echo "\n"; + + if ($archives_available=="Y") + { + echo "

"._QXZ("Search archived data")."
\n"; + } + ### bottom of first column echo "\n"; diff --git a/www/vicidial/fcstats.php b/www/vicidial/fcstats.php index 4980f384..636c51a3 100644 --- a/www/vicidial/fcstats.php +++ b/www/vicidial/fcstats.php @@ -30,6 +30,7 @@ # 141114-0017 - Finalized adding QXZ translation to all admin files # 141230-1345 - Added code for on-the-fly language translations display # 150516-1317 - Fixed Javascript element problem, Issue #857 +# 151125-1642 - Added search archive option # $startMS = microtime(); @@ -56,6 +57,8 @@ if (isset($_GET["file_download"])) {$file_download=$_GET["file_download"];} elseif (isset($_POST["file_download"])) {$file_download=$_POST["file_download"];} 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 (strlen($shift)<2) {$shift='ALL';} @@ -84,6 +87,28 @@ if ($qm_conf_ct > 0) ##### END SETTINGS LOOKUP ##### ########################################### +### ARCHIVED DATA CHECK CONFIGURATION +$archives_available="N"; +$log_tables_array=array("vicidial_xfer_log", "vicidial_closer_log"); +for ($t=0; $t"._QXZ("AM")."\n"; $HTML_text.="\n"; $HTML_text.="\n"; $HTML_text.="\n"; + +if ($archives_available=="Y") + { + $HTML_text.=""._QXZ("Search archived data")."\n"; + } + + $HTML_text.="\n"; $HTML_text.="\n"; -$HTML_text.="           "._QXZ("DOWNLOAD")." | "._QXZ("MODIFY")." | "._QXZ("REPORTS")."
\n"; +$HTML_text.="           "._QXZ("DOWNLOAD")." | "._QXZ("MODIFY")." | "._QXZ("REPORTS")."
\n"; $HTML_text.="\n\n"; $HTML_text.="
\n\n";
@@ -397,7 +429,7 @@ while ($ssrow=mysqli_fetch_row($sale_dispo_rslt)) {
 $sale_dispo_str.="|";
 if ($DB) {$HTML_text.=_QXZ("Sale dispo string").": $sale_dispo_str\n";}
 
-$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysqli_real_escape_string($link, $group) . "' and status in ($sale_dispos);";
+$stmt="select count(*) from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysqli_real_escape_string($link, $group) . "' and status in ($sale_dispos);";
 $rslt=mysql_to_mysqli($stmt, $link);
 if ($DB) {$HTML_text.="$stmt\n";}
 $row=mysqli_fetch_row($rslt);
@@ -476,7 +508,7 @@ $OTHER_graph=$graph_header.""._QXZ("OTHER")."= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysqli_real_escape_string($link, $group) . "' and user is not null group by user;";
 if ($non_latin > 0) {$rslt=mysql_to_mysqli("SET NAMES 'UTF8'", $link);}
 $rslt=mysql_to_mysqli($stmt, $link);
 if ($DB) {$ASCII_text.="$stmt\n";}
@@ -520,7 +552,7 @@ while ($i < $users_to_print)
 		{$full_name[$i] = '               ';}
 
 	$A1=0; $A2=0; $A3=0; $A4=0; $A5=0; $A6=0; $A7=0; $A8=0; $A9=0; $DROP=0; $OTHER=0; $sales=0; 
-	$stmt="select vc.status,count(distinct vc.lead_id) from vicidial_xfer_log vx, vicidial_closer_log vc where vx.call_date >= '$query_date_BEGIN' and vx.call_date <= '$query_date_END' and vc.call_date >= '$query_date_BEGIN' and vc.call_date <= '$query_date_END' and  vc.campaign_id='" . mysqli_real_escape_string($link, $group) . "' and vx.campaign_id='" . mysqli_real_escape_string($link, $group) . "' and vx.user='$userRAW[$i]' and vc.lead_id=vx.lead_id and vc.xfercallid=vx.xfercallid group by vc.status;";
+	$stmt="select vc.status,count(distinct vc.lead_id) from ".$vicidial_xfer_log_table." vx, ".$vicidial_closer_log_table." vc where vx.call_date >= '$query_date_BEGIN' and vx.call_date <= '$query_date_END' and vc.call_date >= '$query_date_BEGIN' and vc.call_date <= '$query_date_END' and  vc.campaign_id='" . mysqli_real_escape_string($link, $group) . "' and vx.campaign_id='" . mysqli_real_escape_string($link, $group) . "' and vx.user='$userRAW[$i]' and vc.lead_id=vx.lead_id and vc.xfercallid=vx.xfercallid group by vc.status;";
 	if ($non_latin > 0) {$rslt=mysql_to_mysqli("SET NAMES 'UTF8'", $link);}
 	$rslt=mysql_to_mysqli($stmt, $link);
 	if ($DB) {$ASCII_text.="$stmt\n";}
@@ -617,7 +649,7 @@ $totDROP =		sprintf("%5s", $totDROP);
 $totOTHER =		sprintf("%5s", $totOTHER);
 
 
-$stmt="select avg(queue_seconds) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysqli_real_escape_string($link, $group) . "';";
+$stmt="select avg(queue_seconds) from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysqli_real_escape_string($link, $group) . "';";
 $rslt=mysql_to_mysqli($stmt, $link);
 if ($DB) {$ASCII_text.="$stmt\n";}
 $row=mysqli_fetch_row($rslt);
@@ -728,7 +760,7 @@ $SALES2_graph=$graph_header.""._QXZ("SALES").""._QXZ("CONV")." %";
 ###########################
 
-$stmt="select user,count(*) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysqli_real_escape_string($link, $group) . "' and user is not null group by user;";
+$stmt="select user,count(*) from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysqli_real_escape_string($link, $group) . "' and user is not null group by user;";
 if ($non_latin > 0) {$rslt=mysql_to_mysqli("SET NAMES 'UTF8'", $link);}
 $rslt=mysql_to_mysqli($stmt, $link);
 if ($DB) {$ASCII_text.="$stmt\n";}
@@ -771,7 +803,7 @@ while ($i < $users_to_print)
 		{$full_name[$i] = '               ';}
 
 	$A1=0; $A2=0; $A3=0; $A4=0; $A5=0; $A6=0; $A7=0; $A8=0; $A9=0; $DROP=0; $OTHER=0; $sales=0; $uTOP=0; $uBOT=0; $points=0;
-	$stmt="select status,count(*) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysqli_real_escape_string($link, $group) . "' and user='$userRAW[$i]' group by status;";
+	$stmt="select status,count(*) from ".$vicidial_closer_log_table." where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysqli_real_escape_string($link, $group) . "' and user='$userRAW[$i]' group by status;";
 	if ($non_latin > 0) {$rslt=mysql_to_mysqli("SET NAMES 'UTF8'", $link);}
 	$rslt=mysql_to_mysqli($stmt, $link);
 	if ($DB) {$ASCII_text.="$stmt\n";}