diff --git a/www/vicidial/AST_CLOSERstats.php b/www/vicidial/AST_CLOSERstats.php
index c2bea4d6..4c79340b 100644
--- a/www/vicidial/AST_CLOSERstats.php
+++ b/www/vicidial/AST_CLOSERstats.php
@@ -8,6 +8,7 @@
# 60619-1714 - Added variable filtering to eliminate SQL injection attack threat
# - Added required user/pass to gain access to this page
# 60905-1326 - Added queue time stats
+# 71008-1436 - Added shift to be defined in dbconnect.php
#
require("dbconnect.php");
@@ -19,6 +20,8 @@ if (isset($_GET["group"])) {$group=$_GET["group"];}
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];}
elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];}
+if (isset($_GET["shift"])) {$shift=$_GET["shift"];}
+ elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];}
if (isset($_GET["submit"])) {$submit=$_GET["submit"];}
elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];}
if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];}
@@ -27,6 +30,8 @@ if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
+if (strlen($shift)<2) {$shift='ALL';}
+
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
@@ -85,6 +90,13 @@ echo "\n";
+echo "\n";
echo "\n";
echo " MODIFY | REPORTS \n";
echo "\n\n";
@@ -100,14 +112,37 @@ echo "PLEASE SELECT A CAMPAIGN AND DATE ABOVE AND CLICK SUBMIT\n";
else
{
+if ($shift == 'AM')
+ {
+ $time_BEGIN=$AM_shift_BEGIN;
+ $time_END=$AM_shift_END;
+ if (strlen($time_BEGIN) < 6) {$time_BEGIN = "03:45:00";}
+ if (strlen($time_END) < 6) {$time_END = "15:15:00";}
+ }
+if ($shift == 'PM')
+ {
+ $time_BEGIN=$PM_shift_BEGIN;
+ $time_END=$PM_shift_END;
+ if (strlen($time_BEGIN) < 6) {$time_BEGIN = "15:15:00";}
+ if (strlen($time_END) < 6) {$time_END = "23:15:00";}
+ }
+if ($shift == 'ALL')
+ {
+ if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
+ if (strlen($time_END) < 6) {$time_END = "23:59:59";}
+ }
+$query_date_BEGIN = "$query_date $time_BEGIN";
+$query_date_END = "$query_date $time_END";
+
echo "VICIDIAL: Auto-dial Closer Stats $NOW_TIME\n";
echo "\n";
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
echo "---------- TOTALS\n";
-$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+$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='" . mysql_real_escape_string($group) . "';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
@@ -128,7 +163,7 @@ echo "Average Call Length for all Calls: $average_hold_seconds second
echo "\n";
echo "---------- DROPS\n";
-$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP' and (length_in_sec <= 999 or length_in_sec is null);";
+$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='" . mysql_real_escape_string($group) . "' and status='DROP' and (length_in_sec <= 999 or length_in_sec is null);";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
@@ -157,7 +192,7 @@ echo "Average hold time for DROP Calls: $average_hold_seconds second
echo "\n";
echo "---------- QUEUE STATS\n";
-$stmt="select count(*),sum(queue_seconds) from vicidial_closer_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='" . mysql_real_escape_string($group) . "' and (queue_seconds > 0);";
+$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='" . mysql_real_escape_string($group) . "' and (queue_seconds > 0);";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
@@ -208,7 +243,7 @@ echo "+--------------------------+------------+----------+--------+\n";
echo "| AGENT | CALLS | TIME M | AVRG M |\n";
echo "+--------------------------+------------+----------+--------+\n";
-$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 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='" . mysql_real_escape_string($group) . "' and vicidial_closer_log.user is not null and length_in_sec is not null and length_in_sec > 4 and vicidial_closer_log.user=vicidial_users.user group by vicidial_closer_log.user;";
+$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='" . mysql_real_escape_string($group) . "' and vicidial_closer_log.user is not null and length_in_sec is not null and length_in_sec > 4 and vicidial_closer_log.user=vicidial_users.user group by vicidial_closer_log.user;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$users_to_print = mysql_num_rows($rslt);
@@ -251,6 +286,7 @@ while ($i < $users_to_print)
$i++;
}
+if (!$TOTcalls) {$TOTcalls = 1;}
$TOTavg = ($TOTtime / $TOTcalls);
$TOTavg = round($TOTavg, 0);
$TOTavg_M = ($TOTavg / 60);
diff --git a/www/vicidial/AST_VDADstats.php b/www/vicidial/AST_VDADstats.php
index b9f50356..d8afbdd6 100644
--- a/www/vicidial/AST_VDADstats.php
+++ b/www/vicidial/AST_VDADstats.php
@@ -8,6 +8,7 @@
# 60619-1718 - Added variable filtering to eliminate SQL injection attack threat
# - Added required user/pass to gain access to this page
# 61215-1139 - Added drop percentage of answered and round-2 decimal
+# 71008-1436 - Added shift to be defined in dbconnect.php
#
header ("Content-type: text/html; charset=utf-8");
@@ -21,6 +22,8 @@ if (isset($_GET["group"])) {$group=$_GET["group"];}
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];}
elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];}
+if (isset($_GET["shift"])) {$shift=$_GET["shift"];}
+ elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];}
if (isset($_GET["submit"])) {$submit=$_GET["submit"];}
elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];}
if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];}
@@ -29,6 +32,8 @@ if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
+if (strlen($shift)<2) {$shift='ALL';}
+
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
@@ -87,6 +92,13 @@ echo "\n";
+echo "\n";
echo "\n";
echo " MODIFY | REPORTS \n";
echo "\n\n";
@@ -102,14 +114,37 @@ echo "PLEASE SELECT A CAMPAIGN AND DATE ABOVE AND CLICK SUBMIT\n";
else
{
+if ($shift == 'AM')
+ {
+ $time_BEGIN=$AM_shift_BEGIN;
+ $time_END=$AM_shift_END;
+ if (strlen($time_BEGIN) < 6) {$time_BEGIN = "03:45:00";}
+ if (strlen($time_END) < 6) {$time_END = "15:15:00";}
+ }
+if ($shift == 'PM')
+ {
+ $time_BEGIN=$PM_shift_BEGIN;
+ $time_END=$PM_shift_END;
+ if (strlen($time_BEGIN) < 6) {$time_BEGIN = "15:15:00";}
+ if (strlen($time_END) < 6) {$time_END = "23:15:00";}
+ }
+if ($shift == 'ALL')
+ {
+ if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
+ if (strlen($time_END) < 6) {$time_END = "23:59:59";}
+ }
+$query_date_BEGIN = "$query_date $time_BEGIN";
+$query_date_END = "$query_date $time_END";
+
echo "VICIDIAL: Auto-dial Stats $NOW_TIME\n";
echo "\n";
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
echo "---------- TOTALS\n";
-$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
@@ -129,7 +164,7 @@ echo "Average Call Length for all Calls in seconds: $average_hold_seconds\n";
echo "\n";
echo "---------- DROPS\n";
-$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP' and (length_in_sec <= 60 or length_in_sec is null);";
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP' and (length_in_sec <= 60 or length_in_sec is null);";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
@@ -137,7 +172,7 @@ $DROPcalls = sprintf("%10s", $row[0]);
$DROPcallsRAW = $row[0];
$DROPseconds = $row[1];
-$stmt="select count(*) from vicidial_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status NOT IN('NA','B');";
+$stmt="select count(*) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status NOT IN('NA','B');";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
@@ -175,7 +210,7 @@ echo "Average Length for DROP Calls in seconds: $average_hold_seconds\n";
echo "\n";
echo "---------- AUTO-DIAL NO ANSWERS\n";
-$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status IN('NA','B') and (length_in_sec <= 60 or length_in_sec is null);";
+$stmt="select count(*),sum(length_in_sec) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status IN('NA','B') and (length_in_sec <= 60 or length_in_sec is null);";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
@@ -238,7 +273,7 @@ while ($Cstatuses_to_print > $o)
$o++;
}
-$stmt="select count(*),status from vicidial_log where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='" . mysql_real_escape_string($group) . "' group by status;";
+$stmt="select count(*),status from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' group by status;";
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
@@ -292,7 +327,7 @@ echo "+--------------------------+------------+----------+--------+\n";
echo "| AGENT | CALLS | TIME M | AVRG M |\n";
echo "+--------------------------+------------+----------+--------+\n";
-$stmt="select vicidial_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_log,vicidial_users where call_date >= '$query_date 00:00:01' and call_date <= '$query_date 23:59:59' and campaign_id='" . mysql_real_escape_string($group) . "' and vicidial_log.user is not null and length_in_sec is not null and length_in_sec > 4 and vicidial_log.user=vicidial_users.user group by vicidial_log.user;";
+$stmt="select vicidial_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_log,vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and vicidial_log.user is not null and length_in_sec is not null and length_in_sec > 4 and vicidial_log.user=vicidial_users.user group by vicidial_log.user;";
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
@@ -343,6 +378,7 @@ while ($i < $users_to_print)
$i++;
}
+if (!$TOTcalls) {$TOTcalls = 1;}
$TOTavg = ($TOTtime / $TOTcalls);
$TOTavg = round($TOTavg, 0);
$TOTavg_M = ($TOTavg / 60);
@@ -370,7 +406,7 @@ $TOTcalls = sprintf("%10s", $TOTcalls);
$TOTtime = sprintf("%8s", $TOTtime);
$TOTavg = sprintf("%6s", $TOTavg);
-$stmt="select avg(wait_sec) from vicidial_agent_log where event_time >= '$query_date 00:00:01' and event_time <= '$query_date 23:59:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+$stmt="select avg(wait_sec) from vicidial_agent_log where event_time >= '$query_date_BEGIN' and event_time <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
diff --git a/www/vicidial/AST_agent_performance_detail.php b/www/vicidial/AST_agent_performance_detail.php
index 72779f6e..8d602b25 100644
--- a/www/vicidial/AST_agent_performance_detail.php
+++ b/www/vicidial/AST_agent_performance_detail.php
@@ -9,6 +9,7 @@
# - Added required user/pass to gain access to this page
# 70118-1705 - Added user_group filtering option
# 70201-1207 - Added non_latin UTF8 output code, widened USER ID to 8 chars
+# 71008-1436 - Changed shift to be defined in dbconnect.php
#
require("dbconnect.php");
@@ -141,25 +142,25 @@ else
{
if ($shift == 'AM')
{
- $query_date_BEGIN = "$query_date 03:45:00";
- $query_date_END = "$query_date 15:15:00";
- $time_BEGIN = "03:45:00";
- $time_END = "15:15:00";
+ $time_BEGIN=$AM_shift_BEGIN;
+ $time_END=$AM_shift_END;
+ if (strlen($time_BEGIN) < 6) {$time_BEGIN = "03:45:00";}
+ if (strlen($time_END) < 6) {$time_END = "15:15:00";}
}
if ($shift == 'PM')
{
- $query_date_BEGIN = "$query_date 15:15:00";
- $query_date_END = "$query_date 23:15:00";
- $time_BEGIN = "15:15:00";
- $time_END = "23:15:00";
+ $time_BEGIN=$PM_shift_BEGIN;
+ $time_END=$PM_shift_END;
+ if (strlen($time_BEGIN) < 6) {$time_BEGIN = "15:15:00";}
+ if (strlen($time_END) < 6) {$time_END = "23:15:00";}
}
if ($shift == 'ALL')
{
- $query_date_BEGIN = "$query_date 00:00:00";
- $query_date_END = "$query_date 23:59:59";
- $time_BEGIN = "00:00:00";
- $time_END = "23:59:59";
+ if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
+ if (strlen($time_END) < 6) {$time_END = "23:59:59";}
}
+$query_date_BEGIN = "$query_date $time_BEGIN";
+$query_date_END = "$query_date $time_END";
if (strlen($user_group)>0) {$ugSQL="and vicidial_agent_log.user_group='$user_group'";}
else {$ugSQL='';}
diff --git a/www/vicidial/dbconnect.php b/www/vicidial/dbconnect.php
index 5247e166..d31a326f 100644
--- a/www/vicidial/dbconnect.php
+++ b/www/vicidial/dbconnect.php
@@ -45,5 +45,8 @@ $ext_context = 'demo';
$recording_exten = '8309';
$WeBRooTWritablE = '1';
$non_latin = '0'; # set to 1 for UTF rules
-
+$AM_shift_BEGIN = '03:45:00';
+$AM_shift_END = '17:45:00';
+$PM_shift_BEGIN = '17:45:01';
+$PM_shift_END = '23:59:59';
?>