Added new Real-Time Whiteboard multi-report
git-svn-id: svn://192.168.202.10@2848 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -218,6 +218,8 @@ OTHER CHANGES:
|
||||
to agents when scheduled callbacks are triggered while they are logged
|
||||
in to the agent screen. Read the HELP for instructions to set up.
|
||||
|
||||
55. Added new Real-Time Whiteboard multi-report
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,856 @@
|
||||
<?php
|
||||
# AST_rt_whiteboard_rpt.php
|
||||
#
|
||||
# Copyright (C) 2017 Matt Florell <vicidial@gmail.com>, Joe Johnson <freewermadmin@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# Real-time report that allows users to create a customized, graphical display of various data sets
|
||||
#
|
||||
# 171027-2352 - First build
|
||||
#
|
||||
|
||||
$startMS = microtime();
|
||||
|
||||
require("dbconnect_mysqli.php");
|
||||
require("functions.php");
|
||||
|
||||
if (file_exists('options.php'))
|
||||
{
|
||||
require('options.php');
|
||||
}
|
||||
|
||||
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
|
||||
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
|
||||
$PHP_SELF=$_SERVER['PHP_SELF'];
|
||||
if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];}
|
||||
elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];}
|
||||
if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];}
|
||||
elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];}
|
||||
if (isset($_GET["query_time"])) {$query_time=$_GET["query_time"];}
|
||||
elseif (isset($_POST["query_time"])) {$query_time=$_POST["query_time"];}
|
||||
if (isset($_GET["end_time"])) {$end_time=$_GET["end_time"];}
|
||||
elseif (isset($_POST["end_time"])) {$end_time=$_POST["end_time"];}
|
||||
if (isset($_GET["campaigns"])) {$campaigns=$_GET["campaigns"];}
|
||||
elseif (isset($_POST["campaigns"])) {$campaigns=$_POST["campaigns"];}
|
||||
if (isset($_GET["users"])) {$users=$_GET["users"];}
|
||||
elseif (isset($_POST["users"])) {$users=$_POST["users"];}
|
||||
if (isset($_GET["user_groups"])) {$user_groups=$_GET["user_groups"];}
|
||||
elseif (isset($_POST["user_groups"])) {$user_groups=$_POST["user_groups"];}
|
||||
if (isset($_GET["groups"])) {$groups=$_GET["groups"];}
|
||||
elseif (isset($_POST["groups"])) {$groups=$_POST["groups"];}
|
||||
if (isset($_GET["dids"])) {$dids=$_GET["dids"];}
|
||||
elseif (isset($_POST["dids"])) {$dids=$_POST["dids"];}
|
||||
if (isset($_GET["file_download"])) {$file_download=$_GET["file_download"];}
|
||||
elseif (isset($_POST["file_download"])) {$file_download=$_POST["file_download"];}
|
||||
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["DB"])) {$DB=$_GET["DB"];}
|
||||
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
|
||||
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 (!$query_date) {$query_date=date("Y-m-d");}
|
||||
if (!$end_date) {$end_date=date("Y-m-d");}
|
||||
if (!$query_time) {$query_time="08:00:00";}
|
||||
if (!$end_time) {$end_time="17:00:00";}
|
||||
|
||||
if (strlen($shift)<2) {$shift='ALL';}
|
||||
$report_name="Real-Time Whiteboard Report";
|
||||
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,enable_languages,language_method,admin_screen_colors FROM system_settings;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {$MAIN.="$stmt\n";}
|
||||
$qm_conf_ct = mysqli_num_rows($rslt);
|
||||
if ($qm_conf_ct > 0)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
$outbound_autodial_active = $row[1];
|
||||
$slave_db_server = $row[2];
|
||||
$reports_use_slave_db = $row[3];
|
||||
$SSenable_languages = $row[4];
|
||||
$SSlanguage_method = $row[5];
|
||||
$admin_screen_colors = $row[6];
|
||||
}
|
||||
##### END SETTINGS LOOKUP #####
|
||||
###########################################
|
||||
|
||||
$stmt = "SELECT local_gmt FROM servers where active='Y' limit 1;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {$MAIN.="$stmt\n";}
|
||||
$gmt_conf_ct = mysqli_num_rows($rslt);
|
||||
$dst = date("I");
|
||||
if ($gmt_conf_ct > 0)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$local_gmt = $row[0];
|
||||
$epoch_offset = (($local_gmt + $dst) * 3600);
|
||||
}
|
||||
|
||||
if ($non_latin < 1)
|
||||
{
|
||||
$PHP_AUTH_USER = preg_replace('/[^-_0-9a-zA-Z]/', '', $PHP_AUTH_USER);
|
||||
$PHP_AUTH_PW = preg_replace('/[^-_0-9a-zA-Z]/', '', $PHP_AUTH_PW);
|
||||
}
|
||||
else
|
||||
{
|
||||
$PHP_AUTH_PW = preg_replace("/'|\"|\\\\|;/","",$PHP_AUTH_PW);
|
||||
$PHP_AUTH_USER = preg_replace("/'|\"|\\\\|;/","",$PHP_AUTH_USER);
|
||||
}
|
||||
|
||||
$stmt="SELECT selected_language from vicidial_users where user='$PHP_AUTH_USER';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$sl_ct = mysqli_num_rows($rslt);
|
||||
if ($sl_ct > 0)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$VUselected_language = $row[0];
|
||||
}
|
||||
|
||||
$auth=0;
|
||||
$reports_auth=0;
|
||||
$admin_auth=0;
|
||||
$auth_message = user_authorization($PHP_AUTH_USER,$PHP_AUTH_PW,'REPORTS',1);
|
||||
if ($auth_message == 'GOOD')
|
||||
{$auth=1;}
|
||||
|
||||
if ($auth > 0)
|
||||
{
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and user_level > 7 and view_reports='1';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$admin_auth=$row[0];
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and user_level > 6 and view_reports='1';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$reports_auth=$row[0];
|
||||
|
||||
if ($reports_auth < 1)
|
||||
{
|
||||
$VDdisplayMESSAGE = _QXZ("You are not allowed to view reports");
|
||||
Header ("Content-type: text/html; charset=utf-8");
|
||||
echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n";
|
||||
exit;
|
||||
}
|
||||
if ( ($reports_auth > 0) and ($admin_auth < 1) )
|
||||
{
|
||||
$ADD=999999;
|
||||
$reports_only_user=1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$VDdisplayMESSAGE = _QXZ("Login incorrect, please try again");
|
||||
if ($auth_message == 'LOCK')
|
||||
{
|
||||
$VDdisplayMESSAGE = _QXZ("Too many login attempts, try again in 15 minutes");
|
||||
Header ("Content-type: text/html; charset=utf-8");
|
||||
echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n";
|
||||
exit;
|
||||
}
|
||||
Header("WWW-Authenticate: Basic realm=\"CONTACT-CENTER-ADMIN\"");
|
||||
Header("HTTP/1.0 401 Unauthorized");
|
||||
echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$PHP_AUTH_PW|$auth_message|\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER';";
|
||||
if ($DB) {$MAIN.="|$stmt|\n";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$LOGuser_group = $row[0];
|
||||
|
||||
$stmt="SELECT allowed_campaigns,allowed_reports,admin_viewable_groups,admin_viewable_call_times from vicidial_user_groups where user_group='$LOGuser_group';";
|
||||
if ($DB) {$MAIN.="|$stmt|\n";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$LOGallowed_campaigns = $row[0];
|
||||
$LOGallowed_reports = $row[1];
|
||||
$LOGadmin_viewable_groups = $row[2];
|
||||
$LOGadmin_viewable_call_times = $row[3];
|
||||
|
||||
if ( (!preg_match("/$report_name,/",$LOGallowed_reports)) and (!preg_match("/ALL REPORTS/",$LOGallowed_reports)) )
|
||||
{
|
||||
Header("WWW-Authenticate: Basic realm=\"CONTACT-CENTER-ADMIN\"");
|
||||
Header("HTTP/1.0 401 Unauthorized");
|
||||
echo _QXZ("You are not allowed to view this report").": |$PHP_AUTH_USER|$report_name|\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$LOGadmin_viewable_groupsSQL='';
|
||||
$whereLOGadmin_viewable_groupsSQL='';
|
||||
if ( (!preg_match('/\-\-ALL\-\-/i',$LOGadmin_viewable_groups)) and (strlen($LOGadmin_viewable_groups) > 3) )
|
||||
{
|
||||
$rawLOGadmin_viewable_groupsSQL = preg_replace("/ -/",'',$LOGadmin_viewable_groups);
|
||||
$rawLOGadmin_viewable_groupsSQL = preg_replace("/ /","','",$rawLOGadmin_viewable_groupsSQL);
|
||||
$LOGadmin_viewable_groupsSQL = "and user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')";
|
||||
$whereLOGadmin_viewable_groupsSQL = "where user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')";
|
||||
}
|
||||
|
||||
$LOGadmin_viewable_call_timesSQL='';
|
||||
$whereLOGadmin_viewable_call_timesSQL='';
|
||||
if ( (!preg_match('/\-\-ALL\-\-/i', $LOGadmin_viewable_call_times)) and (strlen($LOGadmin_viewable_call_times) > 3) )
|
||||
{
|
||||
$rawLOGadmin_viewable_call_timesSQL = preg_replace("/ -/",'',$LOGadmin_viewable_call_times);
|
||||
$rawLOGadmin_viewable_call_timesSQL = preg_replace("/ /","','",$rawLOGadmin_viewable_call_timesSQL);
|
||||
$LOGadmin_viewable_call_timesSQL = "and call_time_id IN('---ALL---','$rawLOGadmin_viewable_call_timesSQL')";
|
||||
$whereLOGadmin_viewable_call_timesSQL = "where call_time_id IN('---ALL---','$rawLOGadmin_viewable_call_timesSQL')";
|
||||
}
|
||||
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
$STARTtime = date("U");
|
||||
if (!isset($groups)) {$groups = array();}
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
if (!isset($end_date)) {$end_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER';";
|
||||
if ($DB) {$MAIN.="|$stmt|\n";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$LOGuser_group = $row[0];
|
||||
|
||||
$stmt="SELECT allowed_campaigns,allowed_reports,admin_viewable_groups,admin_viewable_call_times from vicidial_user_groups where user_group='$LOGuser_group';";
|
||||
if ($DB) {$MAIN.="|$stmt|\n";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$LOGallowed_campaigns = $row[0];
|
||||
$LOGallowed_reports = $row[1];
|
||||
$LOGadmin_viewable_groups = $row[2];
|
||||
$LOGadmin_viewable_call_times = $row[3];
|
||||
|
||||
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORTS/",$LOGallowed_reports)) )
|
||||
{
|
||||
Header("WWW-Authenticate: Basic realm=\"CONTACT-CENTER-ADMIN\"");
|
||||
Header("HTTP/1.0 401 Unauthorized");
|
||||
echo _QXZ("You are not allowed to view this report").": |$PHP_AUTH_USER|$report_name|\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$stmt="SELECT campaign_id from vicidial_campaigns $whereLOGallowed_campaignsSQL order by campaign_id;";
|
||||
if ($DB) {$MAIN.="$stmt\n";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$campaigns_to_print = mysqli_num_rows($rslt);
|
||||
$i=0;
|
||||
$campaign_string='|';
|
||||
$campaigns_selected=count($campaigns);
|
||||
while ($i < $campaigns_to_print)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$campaign_list[$i] = $row[0];
|
||||
$campaign_string .= "$campaign_list[$i]|";
|
||||
for ($j=0; $j<$campaigns_selected; $j++) {
|
||||
if ($campaigns[$j] && $campaign_list[$i]==$campaigns[$j]) {$campaign_name_str.="$campaign_list[$i] - $campaign_names[$i], ";}
|
||||
if ($campaigns[$j]=="--ALL--") {$campaigns_selected_str.="'$campaign_list[$i]', ";}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
$i=0;
|
||||
$users_string='|';
|
||||
$users_ct = count($users);
|
||||
while($i < $users_ct)
|
||||
{
|
||||
$users_string .= "$users[$i]|";
|
||||
$i++;
|
||||
}
|
||||
$stmt="SELECT user, full_name from vicidial_users $whereLOGadmin_viewable_groupsSQL order by user";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {$MAIN.="$stmt\n";}
|
||||
$users_to_print = mysqli_num_rows($rslt);
|
||||
$i=0;
|
||||
$user_array=array(); # For quick full-name reference
|
||||
while ($i < $users_to_print)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$user_list[$i]=$row[0];
|
||||
$user_names[$i]=$row[1];
|
||||
$user_array["$row[0]"]=$row[1];
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
$i=0;
|
||||
$user_groups_string='|';
|
||||
$user_groups_ct = count($user_groups);
|
||||
while($i < $user_groups_ct)
|
||||
{
|
||||
$user_groups_string .= "$user_groups[$i]|";
|
||||
$i++;
|
||||
}
|
||||
$stmt="SELECT user_group, group_name from vicidial_user_groups $whereLOGadmin_viewable_groupsSQL order by user_group";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {$MAIN.="$stmt\n";}
|
||||
$user_groups_to_print = mysqli_num_rows($rslt);
|
||||
$i=0;
|
||||
$user_group_array=array(); # For quick full-name reference
|
||||
while ($i < $user_groups_to_print)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$user_group_list[$i]=$row[0];
|
||||
$user_group_names[$i]=$row[1];
|
||||
$user_group_array["$row[0]"]=$row[1];
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
$stmt="SELECT group_id,group_name from vicidial_inbound_groups $whereLOGadmin_viewable_groupsSQL order by group_id;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {$MAIN.="$stmt\n";}
|
||||
$groups_to_print = mysqli_num_rows($rslt);
|
||||
$i=0;
|
||||
#$LISTgroups[$i]='---NONE---';
|
||||
#$i++;
|
||||
# $groups_to_print++;
|
||||
$groups_string='|';
|
||||
while ($i < $groups_to_print)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$LISTgroups[$i] = $row[0];
|
||||
$LISTgroup_names[$i] = $row[1];
|
||||
$LISTgroup_ids[$i] = $row[2];
|
||||
$groups_string .= "$LISTgroups[$i]|";
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
$i=0;
|
||||
$group_string='|';
|
||||
$group_ct = count($groups);
|
||||
while($i < $group_ct)
|
||||
{
|
||||
if ( (strlen($groups[$i]) > 0) and (preg_match("/\|$groups[$i]\|/",$groups_string)) )
|
||||
{
|
||||
$group_string .= "$groups[$i]|";
|
||||
$group_SQL .= "'$groups[$i]',";
|
||||
$groupQS .= "&groups[]=$groups[$i]";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
if ( (preg_match('/\s\-\-NONE\-\-\s/',$group_string) ) or ($group_ct < 1) )
|
||||
{
|
||||
$group_SQL = "''";
|
||||
}
|
||||
else
|
||||
{
|
||||
$group_SQL = preg_replace('/,$/i', '',$group_SQL);
|
||||
}
|
||||
if (strlen($group_SQL)<3) {$group_SQL="''";}
|
||||
|
||||
|
||||
$i=0;
|
||||
$dids_string='|';
|
||||
$dids_ct = count($dids);
|
||||
while($i < $dids_ct)
|
||||
{
|
||||
$dids_string .= "$dids[$i]|";
|
||||
$i++;
|
||||
}
|
||||
$stmt="SELECT did_pattern,did_description,did_id from vicidial_inbound_dids $whereLOGadmin_viewable_groupsSQL order by did_pattern;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {$MAIN.="$stmt\n";}
|
||||
$dids_to_print = mysqli_num_rows($rslt);
|
||||
$i=0;
|
||||
$did_array=array(); # For quick full-name reference
|
||||
while ($i < $dids_to_print)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$did_pattern[$i]=$row[0];
|
||||
$did_description[$i]=$row[1];
|
||||
$did_ids[$i]=$row[2];
|
||||
$did_array["$row[0]"]=$row[1];
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$MT[0]='';
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
$STARTtime = date("U");
|
||||
if (!isset($campaigns)) {$campaign = array();}
|
||||
if (!isset($users)) {$users = array();}
|
||||
if (!isset($user_groups)) {$user_groups = array();}
|
||||
if (!isset($dids)) {$dids = array();}
|
||||
if (!isset($groups)) {$groups = array();}
|
||||
if (!isset($report_display_type)) {$report_display_type = "HTML";}
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
if (!isset($end_date)) {$end_date = $NOW_DATE;}
|
||||
|
||||
$i=0;
|
||||
$campaigns_string='|';
|
||||
$campaign_ct = count($campaigns);
|
||||
while($i < $campaign_ct)
|
||||
{
|
||||
if (in_array("--ALL--", $campaigns))
|
||||
{
|
||||
$campaigns_string = "--ALL--";
|
||||
$campaign_SQL .= "'$campaigns[$i]',";
|
||||
$campaignQS = "&campaign[]=--ALL--";
|
||||
}
|
||||
else if ( (strlen($campaigns[$i]) > 0) and (!preg_match("/\|$campaigns[$i]\|/",$campaigns_string)) )
|
||||
{
|
||||
$campaigns_string .= "$campaigns[$i]|";
|
||||
$campaign_SQL .= "'$campaigns[$i]',";
|
||||
$campaignQS .= "&campaigns[]=$campaigns[$i]";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
if ( (preg_match('/\-\-ALL\-\-/',$campaign_string) ) or ($campaign_ct < 1) )
|
||||
{
|
||||
$campaign_SQL = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
$campaign_SQL = preg_replace('/,$/i', '',$campaign_SQL);
|
||||
$WHEREcampaign_SQL=" where campaign_id in ($campaign_SQL) ";
|
||||
$campaign_SQL=" and campaign_id in ($campaign_SQL) ";
|
||||
}
|
||||
if (strlen($campaign_SQL)<3)
|
||||
{
|
||||
$campaign_SQL="";
|
||||
}
|
||||
|
||||
$i=0;
|
||||
$users_string='|';
|
||||
$user_ct = count($users);
|
||||
while($i < $user_ct)
|
||||
{
|
||||
if (in_array("--ALL--", $users))
|
||||
{
|
||||
$users_string = "--ALL--";
|
||||
$user_SQL .= "'$users[$i]',";
|
||||
$userQS = "&users[]=--ALL--";
|
||||
}
|
||||
else if ( (strlen($users[$i]) > 0) and (!preg_match("/\|$users[$i]\|/",$users_string)) )
|
||||
{
|
||||
$users_string .= "$users[$i]|";
|
||||
$user_SQL .= "'$users[$i]',";
|
||||
$userQS .= "&users[]=$users[$i]";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
if ( (preg_match('/\-\-ALL\-\-/',$users_string) ) or ($user_ct < 1) )
|
||||
{
|
||||
$user_SQL = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
$user_SQL = preg_replace('/,$/i', '',$user_SQL);
|
||||
$user_SQL = "and agent_user IN($user_SQL)";
|
||||
}
|
||||
if (strlen($user_SQL)<3) {$user_SQL="";}
|
||||
|
||||
$i=0;
|
||||
$user_groups_string='|';
|
||||
$user_group_ct = count($user_groups);
|
||||
while($i < $user_group_ct)
|
||||
{
|
||||
if (in_array("--ALL--", $user_groups))
|
||||
{
|
||||
$user_groups_string = "--ALL--";
|
||||
$user_group_SQL .= "'$user_groups[$i]',";
|
||||
$user_groupQS = "&users[]=--ALL--";
|
||||
}
|
||||
else if ( (strlen($user_groups[$i]) > 0) and (!preg_match("/\|$user_groups[$i]\|/",$user_groups_string)) )
|
||||
{
|
||||
$user_groups_string .= "$user_groups[$i]|";
|
||||
$user_group_SQL .= "'$user_groups[$i]',";
|
||||
$user_groupQS .= "&users[]=$user_groups[$i]";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
if ( (preg_match('/\-\-ALL\-\-/',$user_groups_string) ) or ($user_group_ct < 1) )
|
||||
{
|
||||
$user_group_SQL = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
$user_group_SQL = preg_replace('/,$/i', '',$user_group_SQL);
|
||||
$user_group_SQL = "and user_group IN($user_group_SQL)";
|
||||
}
|
||||
if (strlen($user_group_SQL)<3) {$user_group_SQL="";}
|
||||
|
||||
$i=0;
|
||||
$groups_string='|';
|
||||
$group_ct = count($groups);
|
||||
while($i < $group_ct)
|
||||
{
|
||||
if (in_array("--ALL--", $groups))
|
||||
{
|
||||
$groups_string = "--ALL--";
|
||||
$group_SQL .= "'$groups[$i]',";
|
||||
$groupQS = "&users[]=--ALL--";
|
||||
}
|
||||
else if ( (strlen($groups[$i]) > 0) and (!preg_match("/\|$groups[$i]\|/",$groups_string)) )
|
||||
{
|
||||
$groups_string .= "$groups[$i]|";
|
||||
$group_SQL .= "'$groups[$i]',";
|
||||
$groupQS .= "&users[]=$groups[$i]";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
if ( (preg_match('/\-\-ALL\-\-/',$groups_string) ) or ($group_ct < 1) )
|
||||
{
|
||||
$group_SQL = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
$group_SQL = preg_replace('/,$/i', '',$group_SQL);
|
||||
$group_SQL = "and agent_user IN($group_SQL)";
|
||||
}
|
||||
if (strlen($group_SQL)<3) {$group_SQL="";}
|
||||
|
||||
|
||||
|
||||
##### BEGIN Define colors and logo #####
|
||||
$SSmenu_background='015B91';
|
||||
$SSframe_background='D9E6FE';
|
||||
$SSstd_row1_background='9BB9FB';
|
||||
$SSstd_row2_background='B9CBFD';
|
||||
$SSstd_row3_background='8EBCFD';
|
||||
$SSstd_row4_background='B6D3FC';
|
||||
$SSstd_row5_background='FFFFFF';
|
||||
$SSalt_row1_background='BDFFBD';
|
||||
$SSalt_row2_background='99FF99';
|
||||
$SSalt_row3_background='CCFFCC';
|
||||
|
||||
if ($admin_screen_colors != 'default')
|
||||
{
|
||||
$asc_stmt = "SELECT menu_background,frame_background,std_row1_background,std_row2_background,std_row3_background,std_row4_background,std_row5_background,alt_row1_background,alt_row2_background,alt_row3_background,web_logo FROM vicidial_screen_colors where colors_id='$admin_screen_colors';";
|
||||
$asc_rslt=mysql_to_mysqli($stmt, $link);
|
||||
$qm_conf_ct = mysqli_num_rows($rslt);
|
||||
if ($qm_conf_ct > 0)
|
||||
{
|
||||
$asc_row=mysqli_fetch_row($asc_rslt);
|
||||
$SSmenu_background = $asc_row[0];
|
||||
$SSframe_background = $asc_row[1];
|
||||
$SSstd_row1_background = $asc_row[2];
|
||||
$SSstd_row2_background = $asc_row[3];
|
||||
$SSstd_row3_background = $asc_row[4];
|
||||
$SSstd_row4_background = $asc_row[5];
|
||||
$SSstd_row5_background = $asc_row[6];
|
||||
$SSalt_row1_background = $asc_row[7];
|
||||
$SSalt_row2_background = $asc_row[8];
|
||||
$SSalt_row3_background = $asc_row[9];
|
||||
$SSweb_logo = $asc_row[10];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$NWB = " <a href=\"javascript:openNewWindow('help.php?ADD=99999";
|
||||
$NWE = "')\"><IMG SRC=\"help.gif\" WIDTH=20 HEIGHT=20 BORDER=0 ALT=\"HELP\" ALIGN=TOP></A>";
|
||||
|
||||
$rerun_rpt_URL="$PHP_SELF?query_date=$query_date&end_date=$end_date&report_display_type=$report_display_type$campaignQS$userQS$managerQS&SUBMIT=$SUBMIT";
|
||||
|
||||
$HEADER.="<HTML>\n";
|
||||
$HEADER.="<HEAD>\n";
|
||||
$HEADER.="<link rel=\"stylesheet\" href=\"vicidial_stylesheet.php\" type=\"text/css\">";
|
||||
$HEADER.="<script language=\"JavaScript\" src=\"calendar_db.js\"></script>\n";
|
||||
$HEADER.="<link rel=\"stylesheet\" href=\"calendar.css\">\n";
|
||||
$HEADER.="<link rel=\"stylesheet\" href=\"horizontalbargraph.css\">\n";
|
||||
# $HEADER.="<link rel=\"stylesheet\" type=\"text/css\" href=\"vicidial_stylesheet.css\" />\n";
|
||||
$HEADER.="<script src='chart/Chart.js'></script>\n";
|
||||
$HEADER.="<script language=\"JavaScript\" src=\"vicidial_chart_functions.js\"></script>\n";
|
||||
$HEADER.="<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
$HEADER.="<TITLE>"._QXZ("$report_name")."</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
|
||||
$short_header=1;
|
||||
|
||||
$MAIN.="<FORM ACTION=\"$PHP_SELF\" METHOD=GET name=vicidial_report id=vicidial_report>\n";
|
||||
$MAIN.="<b>"._QXZ("$report_name")."</b> $NWB#rt_whiteboard_report$NWE\n";
|
||||
|
||||
$MAIN.="<span id='report_control_panel' style='display:block'>";
|
||||
$MAIN.="<TABLE CELLPADDING=3 CELLSPACING=3 border='0' class=\"question_td\"><TR>";
|
||||
$MAIN.="<TD VALIGN='TOP' width='300'>";
|
||||
$MAIN.="<FONT class='embossed'>"._QXZ("Report Type").":</font> $NWB#rt_whiteboard_report-report_type$NWE<BR>";
|
||||
|
||||
$MAIN.="<SELECT NAME=report_type ID=report_type class='form_field sm_shadow round_corners' style='width:270px' onChange=HighlightRelatedFields(this.value)>\n";
|
||||
$MAIN.="<option value='' selected>-- Select a report --</option>";
|
||||
$MAIN.="<option value='status_performance_total'>Disposition Totals</option>";
|
||||
$MAIN.="<option value='agent_performance_total'>Agent Performance Totals</option>";
|
||||
$MAIN.="<option value='agent_performance_rates'>Agent Performance Rates</option>";
|
||||
$MAIN.="<option value='team_performance_total'>Team Performance Totals</option>";
|
||||
$MAIN.="<option value='team_performance_rates'>Team Performance Rates</option>";
|
||||
$MAIN.="<option value='floor_performance_total'>Floor Performance Totals (ticker)</option>";
|
||||
$MAIN.="<option value='floor_performance_rates'>Floor Performance Rates (ticker)</option>";
|
||||
$MAIN.="<option value='ingroup_performance_total'>Ingroup Performance Total</option>"; # (ticker)
|
||||
$MAIN.="<option value='ingroup_performance_rates'>Ingroup Performance Rates</option>"; # (ticker)
|
||||
$MAIN.="<option value='did_performance_total'>DID Performance Total</option>"; # (ticker)
|
||||
$MAIN.="<option value='did_performance_rates'>DID Performance Rates</option>"; # (ticker)
|
||||
$MAIN.="</SELECT>\n";
|
||||
|
||||
$MAIN.="</TD>\n";
|
||||
|
||||
$MAIN.="<TD VALIGN=TOP width='300'> <FONT class='embossed'>"._QXZ("Campaigns").":</font> $NWB#rt_whiteboard_report-parameters$NWE<BR>";
|
||||
$MAIN.="<SELECT SIZE=5 NAME=campaigns ID=campaigns multiple class='form_field sm_shadow round_corners' style='width:270px'>\n";
|
||||
#if (preg_match('/\-\-ALL\-\-/',$campaign_string))
|
||||
# {$MAIN.="<option value=\"--ALL--\" selected>-- "._QXZ("ALL CAMPAIGNS")." --</option>\n";}
|
||||
#else
|
||||
# {$MAIN.="<option value=\"--ALL--\">-- "._QXZ("ALL CAMPAIGNS")." --</option>\n";}
|
||||
$MAIN.="<option value=\"--ALL--\"".(in_array("--ALL--", $campaigns) ? " selected" : "").">-- "._QXZ("ALL CAMPAIGNS")." --</option>\n";
|
||||
$o=0;
|
||||
# $campaign_SQL="";
|
||||
while ($campaigns_to_print > $o)
|
||||
{
|
||||
$selected="";
|
||||
if (in_array($campaign_list[$o], $campaigns) && !in_array("--ALL--", $campaigns)) {
|
||||
$selected="selected";
|
||||
}
|
||||
if (in_array($campaign_list[$o], $campaigns) || in_array("--ALL--", $campaigns)) {
|
||||
# $campaign_SQL.="'$campaigns[$o]',";
|
||||
}
|
||||
$MAIN.="<option $selected value=\"$campaign_list[$o]\">$campaign_list[$o]</option>\n";
|
||||
$o++;
|
||||
}
|
||||
# $campaign_SQL=preg_replace("/,$/", "", $campaign_SQL);
|
||||
$MAIN.="</SELECT>\n";
|
||||
$MAIN.="</TD>\n";
|
||||
|
||||
$MAIN.="<TD VALIGN=TOP ALIGN='LEFT' width='400'>";
|
||||
$MAIN.="<FONT class='embossed'>"._QXZ("Status flags").":</font> $NWB#rt_whiteboard_report-parameters$NWE<BR>";
|
||||
$MAIN.="<SELECT SIZE=5 NAME='status_flags' ID='status_flags' multiple class='form_field sm_shadow round_corners' style='width:270px'>\n";
|
||||
$MAIN.="<option value='--ALL--'>"._QXZ("ALL FLAGS")."</option>\n";
|
||||
$MAIN.="<option value='selectable'>"._QXZ("AGENT SELECTABLE")."</option>\n";
|
||||
$MAIN.="<option value='human_answered'>"._QXZ("HUMAN ANSWERED")."</option>\n";
|
||||
$MAIN.="<option value='sale'>"._QXZ("SALE")."</option>\n";
|
||||
$MAIN.="<option value='dnc'>"._QXZ("DNC")."</option>\n";
|
||||
$MAIN.="<option value='customer_contact'>"._QXZ("CUSTOMER CONTACT")."</option>\n";
|
||||
$MAIN.="<option value='not_interested'>"._QXZ("NOT INTERESTED")."</option>\n";
|
||||
$MAIN.="<option value='unworkable'>"._QXZ("UNWORKABLE")."</option>\n";
|
||||
$MAIN.="<option value='scheduled_callback'>"._QXZ("SCHEDULED CALLBACK")."</option>\n";
|
||||
$MAIN.="<option value='completed'>"._QXZ("COMPLETED CALL")."</option>\n";
|
||||
$MAIN.="<option value='answering_machine'>"._QXZ("ANSWERING MACHINE")."</option>\n";
|
||||
$MAIN.="</SELECT>\n";
|
||||
$MAIN.="</TD>\n";
|
||||
$MAIN.="</TR>\n";
|
||||
$MAIN.="<TR>";
|
||||
|
||||
$MAIN.="<TD VALIGN=TOP width='300'><FONT class='embossed'>"._QXZ("User Groups").": $NWB#rt_whiteboard_report-parameters$NWE</font><BR>";
|
||||
$MAIN.="<SELECT SIZE=5 NAME='user_groups' ID='user_groups' multiple class='form_field sm_shadow round_corners' style='width:270px'>\n";
|
||||
if (preg_match('/\-\-ALL\-\-/',$user_groups_string))
|
||||
{$MAIN.="<option value=\"--ALL--\" selected>-- "._QXZ("ALL USER GROUPS")." --</option>\n";}
|
||||
else
|
||||
{$MAIN.="<option value=\"--ALL--\">-- "._QXZ("ALL USER GROUPS")." --</option>\n";}
|
||||
$o=0;
|
||||
while ($user_groups_to_print > $o)
|
||||
{
|
||||
if (preg_match("/$user_group_list[$o]\|/i",$user_groups_string)) {$MAIN.="<option selected value=\"$user_group_list[$o]\">$user_group_list[$o] - $user_group_names[$o]</option>\n";}
|
||||
else {$MAIN.="<option value=\"$user_group_list[$o]\">$user_group_list[$o] - $user_group_names[$o]</option>\n";}
|
||||
$o++;
|
||||
}
|
||||
$MAIN.="</SELECT>\n";
|
||||
$MAIN.="</TD>\n";
|
||||
|
||||
$MAIN.="<TD VALIGN=TOP width='300'><FONT class='embossed'>"._QXZ("Users").": $NWB#rt_whiteboard_report-parameters$NWE</font><BR>";
|
||||
$MAIN.="<SELECT SIZE=5 NAME='users' ID='users' multiple class='form_field sm_shadow round_corners' style='width:270px'>\n";
|
||||
if (preg_match('/\-\-ALL\-\-/',$users_string))
|
||||
{$MAIN.="<option value=\"--ALL--\" selected>-- "._QXZ("ALL USERS")." --</option>\n";}
|
||||
else
|
||||
{$MAIN.="<option value=\"--ALL--\">-- "._QXZ("ALL USERS")." --</option>\n";}
|
||||
$o=0;
|
||||
while ($users_to_print > $o)
|
||||
{
|
||||
if (preg_match("/$user_list[$o]\|/i",$users_string)) {$MAIN.="<option selected value=\"$user_list[$o]\">$user_list[$o] - $user_names[$o]</option>\n";}
|
||||
else {$MAIN.="<option value=\"$user_list[$o]\">$user_list[$o] - $user_names[$o]</option>\n";}
|
||||
$o++;
|
||||
}
|
||||
$MAIN.="</SELECT>\n";
|
||||
$MAIN.="</TD>\n";
|
||||
|
||||
$MAIN.="<TD VALIGN=MIDDLE ALIGN='LEFT' nowrap width='400'> <FONT class='embossed'>"._QXZ("Start date/time").":</font>";
|
||||
$MAIN.="<INPUT TYPE=hidden NAME=DB VALUE=\"$DB\">\n";
|
||||
$MAIN.="<INPUT TYPE=TEXT NAME=query_date ID=query_date SIZE=10 MAXLENGTH=10 VALUE=\"$query_date\" class='form_field sm_shadow round_corners'>";
|
||||
|
||||
$MAIN.="<script language=\"JavaScript\">\n";
|
||||
$MAIN.="function openNewWindow(url)\n";
|
||||
$MAIN.=" {\n";
|
||||
$MAIN.=" window.open (url,\"\",'width=620,height=300,scrollbars=yes,menubar=yes,address=yes');\n";
|
||||
$MAIN.=" }\n";
|
||||
$MAIN.="var o_cal = new tcal ({\n";
|
||||
$MAIN.=" // form name\n";
|
||||
$MAIN.=" 'formname': 'vicidial_report',\n";
|
||||
$MAIN.=" // input name\n";
|
||||
$MAIN.=" 'controlname': 'query_date'\n";
|
||||
$MAIN.="});\n";
|
||||
$MAIN.="o_cal.a_tpl.yearscroll = false;\n";
|
||||
$MAIN.="// o_cal.a_tpl.weekstart = 1; // Monday week start\n";
|
||||
$MAIN.="</script>\n";
|
||||
|
||||
$MAIN.=" <INPUT TYPE=TEXT NAME=query_time ID=query_time SIZE=10 MAXLENGTH=8 VALUE=\"$query_time\" class='form_field sm_shadow round_corners'> $NWB#rt_whiteboard_report-start_date$NWE";
|
||||
|
||||
/*
|
||||
$MAIN.="<BR><FONT class='embossed'>"._QXZ("to")."</font><BR><INPUT TYPE=TEXT NAME=end_date ID=end_date SIZE=10 MAXLENGTH=10 VALUE=\"$end_date\" class='form_field sm_shadow round_corners'>";
|
||||
$MAIN.="<script language=\"JavaScript\">\n";
|
||||
$MAIN.="var o_cal = new tcal ({\n";
|
||||
$MAIN.=" // form name\n";
|
||||
$MAIN.=" 'formname': 'vicidial_report',\n";
|
||||
$MAIN.=" // input name\n";
|
||||
$MAIN.=" 'controlname': 'end_date'\n";
|
||||
$MAIN.="});\n";
|
||||
$MAIN.="o_cal.a_tpl.yearscroll = false;\n";
|
||||
$MAIN.="// o_cal.a_tpl.weekstart = 1; // Monday week start\n";
|
||||
$MAIN.="</script>\n";
|
||||
$MAIN.=" <INPUT TYPE=TEXT NAME=end_time ID=end_time SIZE=10 MAXLENGTH=8 VALUE=\"$end_time\" class='form_field sm_shadow round_corners'>\n";
|
||||
*/
|
||||
|
||||
$MAIN.="<BR><FONT class='embossed'>"._QXZ("OR")."</font><BR>";
|
||||
$MAIN.="<FONT class='embossed'>"._QXZ("Show results for the past")." <input type='text' class='form_field sm_shadow round_corners' size='2' maxlength='2' name='hourly_display' id='hourly_display' value=''> "._QXZ("hours")."</font> $NWB#rt_whiteboard_report-show_results$NWE";
|
||||
$MAIN.="</TD>\n";
|
||||
|
||||
$MAIN.="</TR>\n";
|
||||
$MAIN.="<TR>";
|
||||
|
||||
$MAIN.="<TD VALIGN=TOP width='300'><FONT class='embossed'>"._QXZ("In-groups").": $NWB#rt_whiteboard_report-parameters$NWE</font><BR>";
|
||||
$MAIN.="<SELECT SIZE=5 NAME=groups ID=groups multiple class='form_field sm_shadow round_corners' style='width:270px'>\n";
|
||||
if (preg_match('/\-\-ALL\-\-/',$groups_string))
|
||||
{$MAIN.="<option value=\"--ALL--\" selected>-- "._QXZ("ALL IN-GROUPS")." --</option>\n";}
|
||||
else
|
||||
{$MAIN.="<option value=\"--ALL--\">-- "._QXZ("ALL IN-GROUPS")." --</option>\n";}
|
||||
$o=0;
|
||||
while ($groups_to_print > $o)
|
||||
{
|
||||
if (preg_match("/$LISTgroups[$o]\|/i",$groups_string)) {$MAIN.="<option selected value=\"$LISTgroups[$o]\">$LISTgroups[$o] - $LISTgroup_names[$o]</option>\n";}
|
||||
else {$MAIN.="<option value=\"$LISTgroups[$o]\">$LISTgroups[$o] - $LISTgroup_names[$o]</option>\n";}
|
||||
$o++;
|
||||
}
|
||||
$MAIN.="</SELECT>\n";
|
||||
$MAIN.="</TD>\n";
|
||||
|
||||
$MAIN.="<TD VALIGN=TOP width='300'><FONT class='embossed'>"._QXZ("DIDs").": $NWB#rt_whiteboard_report-parameters$NWE</font><BR>";
|
||||
$MAIN.="<SELECT SIZE=5 NAME=dids ID=dids multiple class='form_field sm_shadow round_corners' style='width:270px'>\n";
|
||||
if (preg_match('/\-\-ALL\-\-/',$dids_string))
|
||||
{$MAIN.="<option value=\"--ALL--\" selected>-- "._QXZ("ALL DIDS")." --</option>\n";}
|
||||
else
|
||||
{$MAIN.="<option value=\"--ALL--\">-- "._QXZ("ALL DIDS")." --</option>\n";}
|
||||
$o=0;
|
||||
while ($dids_to_print > $o)
|
||||
{
|
||||
if (preg_match("/$did_ids[$o]\|/i",$dids_string)) {$MAIN.="<option selected value=\"$did_ids[$o]\">$did_pattern[$o] - $did_description[$o]</option>\n";}
|
||||
else {$MAIN.="<option value=\"$did_ids[$o]\">$did_pattern[$o] - $did_description[$o]</option>\n";}
|
||||
$o++;
|
||||
}
|
||||
$MAIN.="</SELECT>\n";
|
||||
$MAIN.="</TD>\n";
|
||||
|
||||
$MAIN.="<TD VALIGN='TOP' ALIGN='CENTER' width='400'>";
|
||||
$MAIN.="<table border='0' cellpadding='2' cellspacing='0'>";
|
||||
$MAIN.="<tr>";
|
||||
$MAIN.="<td align='right' class='panel_td'><FONT class='embossed'>"._QXZ("Target per unit").":</font></td>";
|
||||
$MAIN.="<td align='left' class='panel_td'><input type='text' size='5' maxlength='5' name='target_per_agent' id='target_per_agent' value='$target_per_agent' class='form_field sm_shadow round_corners'> $NWB#rt_whiteboard_report-target_per_unit$NWE</td>";
|
||||
$MAIN.="</tr><tr>";
|
||||
$MAIN.="<td align='right' class='panel_td'><FONT class='embossed'>"._QXZ("Target gross sales").":</font></td>";
|
||||
$MAIN.="<td align='left' class='panel_td'><input type='text' size='5' maxlength='5' name='target_gross' id='target_gross' value='$target_gross' class='form_field sm_shadow round_corners'> $NWB#rt_whiteboard_report-target_gross_sales$NWE</td>";
|
||||
$MAIN.="</tr></table>";
|
||||
$MAIN.="<BR><INPUT TYPE=button NAME='run_report' class='green_btn sm_shadow round_corners' style='width:150px' VALUE='"._QXZ("RUN REPORT")."' onClick='StartRefresh()'> <INPUT TYPE=button NAME='goto_reports' ID='goto_reports' class='red_btn sm_shadow round_corners' style='width:150px' VALUE='"._QXZ("REPORTS")."'>";
|
||||
$MAIN.="</TD>\n";
|
||||
|
||||
$MAIN.="</TR></TABLE></span>\n";
|
||||
|
||||
|
||||
########################
|
||||
|
||||
|
||||
$MAIN.="<span id='report_display_panel' style='display:none'>";
|
||||
$MAIN.="<TABLE CELLPADDING=0 border='0' CELLSPACING=3 BGCOLOR='#".$SSframe_background."' width='90%' height='*' class='question_td'><TR>";
|
||||
|
||||
$MAIN.="<TD ALIGN=left width='150' class='embossed'>";
|
||||
$MAIN.="<input type='button' id='stop_report' name='stop_report' class='red_btn sm_shadow round_corners' style='width:140px' value='<<< "._QXZ("CONTROL PANEL")."' onClick='StopRefresh()'>";
|
||||
$MAIN.="</TD>";
|
||||
|
||||
$MAIN.="<TD ALIGN=center width='*' class='embossed'>";
|
||||
$MAIN.=_QXZ("Refresh rate").": ";
|
||||
$MAIN.="<select name='refresh_rate' id='refresh_rate' class='form_field sm_shadow round_corners'>";
|
||||
$MAIN.="<option value='5'>5 "._QXZ("seconds")."</option>";
|
||||
$MAIN.="<option value='10'>10 "._QXZ("seconds")."</option>";
|
||||
$MAIN.="<option value='15'>15 "._QXZ("seconds")."</option>";
|
||||
$MAIN.="<option value='20'>20 "._QXZ("seconds")."</option>";
|
||||
$MAIN.="<option value='30'>30 "._QXZ("seconds")."</option>";
|
||||
$MAIN.="<option value='45'>45 "._QXZ("seconds")."</option>";
|
||||
$MAIN.="<option value='60'>60 "._QXZ("seconds")."</option>";
|
||||
$MAIN.="</select>";
|
||||
$MAIN.=" ";
|
||||
$MAIN.=_QXZ("Start date/time").": ";
|
||||
$MAIN.="<INPUT TYPE=TEXT NAME=query_date2 ID=query_date2 SIZE=10 MAXLENGTH=10 VALUE=\"$query_date\" class='form_field sm_shadow round_corners'>";
|
||||
$MAIN.="<script language=\"JavaScript\">\n";
|
||||
$MAIN.="function openNewWindow(url)\n";
|
||||
$MAIN.=" {\n";
|
||||
$MAIN.=" window.open (url,\"\",'width=620,height=300,scrollbars=yes,menubar=yes,address=yes');\n";
|
||||
$MAIN.=" }\n";
|
||||
$MAIN.="var o_cal = new tcal ({\n";
|
||||
$MAIN.=" // form name\n";
|
||||
$MAIN.=" 'formname': 'vicidial_report',\n";
|
||||
$MAIN.=" // input name\n";
|
||||
$MAIN.=" 'controlname': 'query_date'\n";
|
||||
$MAIN.="});\n";
|
||||
$MAIN.="o_cal.a_tpl.yearscroll = false;\n";
|
||||
$MAIN.="// o_cal.a_tpl.weekstart = 1; // Monday week start\n";
|
||||
$MAIN.="</script>\n";
|
||||
$MAIN.="<INPUT TYPE=TEXT NAME=query_time2 ID=query_time2 SIZE=10 MAXLENGTH=8 VALUE=\"$query_time\" class='form_field sm_shadow round_corners'>";
|
||||
|
||||
$MAIN.=" "._QXZ("OR")." "._QXZ("Show results for the past")." <input type='text' class='form_field sm_shadow round_corners' size='2' maxlength='2' name='hourly_display2' id='hourly_display2' value=''> "._QXZ("hours");
|
||||
$MAIN.="</TD>";
|
||||
|
||||
$MAIN.="<TD ALIGN=right width='150' class='embossed'>";
|
||||
$MAIN.="<input type='button' id='adjust_report' name='adjust_report' class='green_btn sm_shadow round_corners' style='width:140px' value='"._QXZ("ADJUST RATE/TIME")."'>";
|
||||
$MAIN.="</TD>";
|
||||
|
||||
$MAIN.="<TD VALIGN=TOP width='180' align='left' rowspan=3 class='embossed'><BR><BR><BR>";
|
||||
$MAIN.="<div class='embossed border2px round_corners sm_shadow std_row1' style='width:160px'>"._QXZ("Total Calls").":<BR><span id='total_calls_div'></span> </div><BR>";
|
||||
$MAIN.="<div class='embossed border2px round_corners sm_shadow std_row2' style='width:160px'>"._QXZ("Total Sales").":<BR><span id='total_sales_div'></span> </div><BR>";
|
||||
$MAIN.="<div class='embossed border2px round_corners sm_shadow std_row3' style='width:160px'>"._QXZ("Total Conv Rate").":<BR><span id='total_conv_div'></span> </div><BR>";
|
||||
$MAIN.="<div class='embossed border2px round_corners sm_shadow std_row4' style='width:160px'>"._QXZ("Total Time").":<BR><span id='total_time_div'></span> </div><BR>";
|
||||
$MAIN.="<div class='embossed border2px round_corners sm_shadow std_row5' style='width:160px'>"._QXZ("Total CPH").":<BR><span id='total_cph_div'></span> </div><BR>";
|
||||
$MAIN.="<div class='embossed border2px round_corners sm_shadow std_row1' style='width:160px'>"._QXZ("Total SPH").":<BR><span id='total_sph_div'></span> </div>";
|
||||
$MAIN.="</TD>";
|
||||
$MAIN.="</TR>";
|
||||
|
||||
$MAIN.="<TR>";
|
||||
$MAIN.="<TD VALIGN=TOP colspan='3' width='*'>";
|
||||
$MAIN.="<span id='top_10_display' style='display:none'>";
|
||||
$MAIN.="</span>";
|
||||
$MAIN.="<div align='center' id='loading_display' style='display:none'>";
|
||||
$MAIN.="<BR><BR><BR><BR><BR><div align='center' class='embossed border2px round_corners sm_shadow' style='background-color:#FFF;width:250px;height:125px'><BR><BR>"._QXZ("LOADING. PLEASE WAIT...")."<BR><BR><img src='/vicidial/images/loader.gif' width='220' height='19'></div>";
|
||||
$MAIN.="</div>";
|
||||
$MAIN.="<span id='graph_display' style='display:block'>";
|
||||
$MAIN.="<canvas id='MainReportCanvas'></canvas>";
|
||||
$MAIN.="<p align='center'><input type='button' class='green_btn sm_shadow round_corners' style='width:250px' value='"._QXZ("SHOW TOP 10 PERFORMERS")."' onClick=\"ToggleVisibility('top_10_display'); ToggleVisibility('graph_display');\"></p>";
|
||||
$MAIN.="</span>";
|
||||
$MAIN.="</TD>";
|
||||
$MAIN.="</TR>";
|
||||
|
||||
|
||||
$MAIN.="<TR>";
|
||||
$MAIN.="<TD VALIGN=TOP colspan='3'>";
|
||||
$MAIN.="<span id='parameters_span'></span>";
|
||||
$MAIN.="</TD>";
|
||||
$MAIN.="</TR></TABLE>";
|
||||
|
||||
|
||||
$MAIN.="</span>";
|
||||
$MAIN.="</TD></TR></TABLE>";
|
||||
$MAIN.="<input type='hidden' size='50' name='hidden_display' id='hidden_display'>";
|
||||
$MAIN.="</FORM>";
|
||||
|
||||
|
||||
$MAIN.="</BODY>";
|
||||
$MAIN.="<script language=\"JavaScript\" src=\"vicidial_whiteboard_functions.js\"></script>\n";
|
||||
$MAIN.="</HTML>";
|
||||
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
|
||||
echo "$HEADER";
|
||||
require("admin_header.php");
|
||||
echo "$MAIN";
|
||||
flush();
|
||||
|
||||
?>
|
||||
@@ -120,9 +120,9 @@ $PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
|
||||
$PHP_SELF=$_SERVER['PHP_SELF'];
|
||||
$QUERY_STRING = getenv("QUERY_STRING");
|
||||
|
||||
$Vreports = 'NONE, Real-Time Main Report, Real-Time Campaign Summary, Inbound Report, Inbound Report by DID, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound DID Summary Report, Agent DID Report, Inbound IVR Report, Inbound Forecasting Report, Advanced Forecasting Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Fronter - Closer Report, Fronter - Closer Detail Report, Lists Campaign Statuses Report, Lists Statuses Report, Campaign Status List Report, Export Calls Report, Export Leads Report, Agent Time Detail, Agent Status Detail, Agent Inbound Status Summary, Agent Performance Detail, Team Performance Detail, Performance Comparison Report, Single Agent Daily, Single Agent Daily Time, User Group Login Report, User Group Hourly Report, User Group Detail Hourly Report, User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report, Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Maximum System Stats, Maximum Stats Detail, Search Leads Logs, Email Log Report, Carrier Log Report, Campaign Debug, Asterisk Debug, Hangup Cause Report, Lists Pass Report, Called Counts List IDs Report, Agent Debug Log Report, Agent Parked Call Report, Agent-Manager Chat Log, Recording Access Log Report, API Log Report, Real-Time Monitoring Log Report';
|
||||
$Vreports = 'NONE, Real-Time Main Report, Real-Time Campaign Summary, Real-Time Whiteboard Report, Inbound Report, Inbound Report by DID, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound DID Summary Report, Agent DID Report, Inbound IVR Report, Inbound Forecasting Report, Advanced Forecasting Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Fronter - Closer Report, Fronter - Closer Detail Report, Lists Campaign Statuses Report, Lists Statuses Report, Campaign Status List Report, Export Calls Report, Export Leads Report, Agent Time Detail, Agent Status Detail, Agent Inbound Status Summary, Agent Performance Detail, Team Performance Detail, Performance Comparison Report, Single Agent Daily, Single Agent Daily Time, User Group Login Report, User Group Hourly Report, User Group Detail Hourly Report, User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report, Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Maximum System Stats, Maximum Stats Detail, Search Leads Logs, Email Log Report, Carrier Log Report, Campaign Debug, Asterisk Debug, Hangup Cause Report, Lists Pass Report, Called Counts List IDs Report, Agent Debug Log Report, Agent Parked Call Report, Agent-Manager Chat Log, Recording Access Log Report, API Log Report, Real-Time Monitoring Log Report';
|
||||
|
||||
$UGreports = 'ALL REPORTS, NONE, Real-Time Main Report, Real-Time Campaign Summary, Inbound Report, Inbound Report by DID, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound DID Summary Report, Agent DID Report, Inbound Email Report, Inbound Chat Report, Inbound IVR Report, Inbound Forecasting Report, Advanced Forecasting Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Fronter - Closer Report, Fronter - Closer Detail Report, Lists Campaign Statuses Report, Lists Statuses Report, Campaign Status List Report, Export Calls Report, Export Leads Report, Agent Time Detail, Agent Status Detail, Agent Inbound Status Summary, Agent Performance Detail, Team Performance Detail, Performance Comparison Report, Single Agent Daily, Single Agent Daily Time, User Group Login Report, User Group Hourly Report, User Group Detail Hourly Report, User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report, Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Custom Reports Links, CallCard Search, Maximum System Stats, Maximum Stats Detail, Search Leads Logs, Email Log Report, Lists Pass Report, Called Counts List IDs Report, Front Page System Summary, Report Page Servers Summary, Admin Utilities Page, Agent Debug Log Report, Agent Parked Call Report, Agent-Manager Chat Log, Recording Access Log Report, API Log Report, Real-Time Monitoring Log Report';
|
||||
$UGreports = 'ALL REPORTS, NONE, Real-Time Main Report, Real-Time Campaign Summary, Real-Time Whiteboard Report, Inbound Report, Inbound Report by DID, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound DID Summary Report, Agent DID Report, Inbound Email Report, Inbound Chat Report, Inbound IVR Report, Inbound Forecasting Report, Advanced Forecasting Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Fronter - Closer Report, Fronter - Closer Detail Report, Lists Campaign Statuses Report, Lists Statuses Report, Campaign Status List Report, Export Calls Report, Export Leads Report, Agent Time Detail, Agent Status Detail, Agent Inbound Status Summary, Agent Performance Detail, Team Performance Detail, Performance Comparison Report, Single Agent Daily, Single Agent Daily Time, User Group Login Report, User Group Hourly Report, User Group Detail Hourly Report, User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report, Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Custom Reports Links, CallCard Search, Maximum System Stats, Maximum Stats Detail, Search Leads Logs, Email Log Report, Lists Pass Report, Called Counts List IDs Report, Front Page System Summary, Report Page Servers Summary, Admin Utilities Page, Agent Debug Log Report, Agent Parked Call Report, Agent-Manager Chat Log, Recording Access Log Report, API Log Report, Real-Time Monitoring Log Report';
|
||||
|
||||
$Vtables = 'NONE,log_noanswer,did_agent_log,contact_information';
|
||||
|
||||
@@ -4198,12 +4198,13 @@ else
|
||||
# 171011-1450 - Added webphone_layout option to phones and user groups
|
||||
# 171018-1314 - Added scheduled_callbacks_email_alert campaign option
|
||||
# 171018-2234 - Added server function to clear agent conferences
|
||||
# 171028-0913 - Added Real-Time Whiteboard Report
|
||||
#
|
||||
|
||||
# make sure you have added a user to the vicidial_users MySQL table with at least user_level 9 to access this page the first time
|
||||
|
||||
$admin_version = '2.14-638a';
|
||||
$build = '171018-2234';
|
||||
$admin_version = '2.14-639a';
|
||||
$build = '171028-0913';
|
||||
|
||||
$STARTtime = date("U");
|
||||
$SQLdate = date("Y-m-d H:i:s");
|
||||
@@ -39263,6 +39264,8 @@ if ($ADD==999999)
|
||||
# echo "<BR> Real-Time IAX: <a href=\"AST_timeonVDADall.php?IAXmonitorLINK=1\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK size=2>"._QXZ("Listen")."</a></FONT> - <a href=\"AST_timeonVDADall.php?IAXmonitorLINK=2\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK size=2>"._QXZ("Barge")."</a></FONT><BR><BR>\n";
|
||||
if ( (preg_match("/Real-Time Campaign Summary/",$LOGallowed_reports)) or (preg_match("/ALL REPORTS/",$LOGallowed_reports)) )
|
||||
{echo "<LI><a href=\"AST_timeonVDADallSUMMARY.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK size=2>"._QXZ("Real-Time Campaign Summary")."</a></FONT>\n";}
|
||||
if ( (preg_match("/Real-Time Whiteboard Report/",$LOGallowed_reports)) or (preg_match("/ALL REPORTS/",$LOGallowed_reports)) )
|
||||
{echo "<LI><a href=\"AST_rt_whiteboard_rpt.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK size=2>"._QXZ("Real-Time Whiteboard Report")."</a></FONT>\n";}
|
||||
echo "</UL><BR>\n";
|
||||
echo "<B>"._QXZ("Inbound and Outbound Calling Reports")."</B><BR>\n";
|
||||
echo "<UL>\n";
|
||||
|
||||
@@ -139,6 +139,7 @@
|
||||
# 171006-2058 - Added lists-inbound_list_script_override entry
|
||||
# 171011-1505 - Added webphone_layout entries
|
||||
# 171018-2203 - Added campaigns-scheduled_callbacks_email_alert entry
|
||||
# 171020-0028 - Added whiteboard report entry
|
||||
#
|
||||
|
||||
|
||||
@@ -6758,6 +6759,39 @@ if ($SSqc_features_active > 0)
|
||||
<?php echo _QXZ("<U>TYPE</U> = The type of monitoring session that the manager was running"); ?><BR>
|
||||
|
||||
|
||||
|
||||
<BR><BR><BR><BR>
|
||||
<A NAME="rt_whiteboard_report">
|
||||
<BR>
|
||||
<B><?php echo _QXZ("Real-Time Whiteboard report"); ?> -</B><?php echo _QXZ("This report allows the user to display reports in a large graph form with associated statistics printed with the report, and the report will be refreshed at a set interval. This is useful for overhead projections where the user needs to display a set of data in a comprehensive, easy-to-read format. Also, when the user selects a report to display, any report option relevant to that report will be highlighted in red: campaigns, status flags, etc...."); ?><BR><BR>
|
||||
<A NAME="rt_whiteboard_report-report_type">
|
||||
<?php echo _QXZ("<U>Report Type</U> = The type of report to display."); ?><BR>
|
||||
<UL>
|
||||
<?php echo _QXZ("<LI>Disposition Totals - A breakdown of disposition totals of calls made."); ?><BR>
|
||||
<?php echo _QXZ("<LI>Agent Performance Totals - Shows total calls and sales for agents within a specified date-time range."); ?><BR>
|
||||
<?php echo _QXZ("<LI>Agent Performance Rates - Shows conversion rates for agents within a specified date-time range."); ?><BR>
|
||||
<?php echo _QXZ("<LI>Team Performance Totals - Shows total calls and sales for teams/user groups within a specified date-time range."); ?><BR>
|
||||
<?php echo _QXZ("<LI>Team Performance Rates - Shows converstion rates for teams/user groups within a specified date-time range."); ?><BR>
|
||||
<?php echo _QXZ("<LI>Floor Performance Totals (ticker) - Shows cumulative total of sales in a -ticker- format-line graph, with an option to draw a target gross sales."); ?><BR>
|
||||
<?php echo _QXZ("<LI>Floor Performance Rates (ticker) - Shows time-elapsed conversion in a -ticker- format-line graph, with an option to draw a target conversion rate."); ?><BR>
|
||||
<?php echo _QXZ("<LI>Ingroup Performance Total - Shows total calls and sales for selected ingroups within a specified date-time range."); ?><BR>
|
||||
<?php echo _QXZ("<LI>Ingroup Performance Rates - Shows conversion rates for selected ingroups within a specified date-time range."); ?><BR>
|
||||
<?php echo _QXZ("<LI>DID Performance Total - Shows total calls and sales for selected DIDs within a specified date-time range."); ?><BR>
|
||||
<?php echo _QXZ("<LI>DID Performance Rates - Shows conversion rates for selected DIDs within a specified date-time range."); ?><BR>
|
||||
</UL><BR>
|
||||
<A NAME="rt_whiteboard_report-parameters">
|
||||
<?php echo _QXZ("<U>User Groups,In-groups,Campaigns,Users,DIDs,Status flags</U> = Parameters that may or may not be required based on the type of report run. Available options are dependent on the user permissions. Additionally, selecting specific campaigns combined with selecting -ALL- for ingroups will restrict the -ALL- selection to only ingroups for the selected campaigns. Specific campaign selection will also limit the statuses counted if any status flags are selected."); ?><BR>
|
||||
<A NAME="rt_whiteboard_report-target_per_unit">
|
||||
<?php echo _QXZ("<U>Target per unit</U> = The target number of sales per -unit-, which refers to users,user groups,ingroups,DIDs,etc depending on the report type selected, displayed as a horizontal line."); ?><BR>
|
||||
<A NAME="rt_whiteboard_report-target_gross_sales">
|
||||
<?php echo _QXZ("<U>Target gross sales</U> = The target number of total sales for ticker reports, displayed as a horizontal line.."); ?><BR>
|
||||
<A NAME="rt_whiteboard_report-start_date">
|
||||
<?php echo _QXZ("<U>Start date/time</U> = If filled out, the starting date and time that the report will use up through the current date and time when compiling the report."); ?><BR>
|
||||
<A NAME="rt_whiteboard_report-show_results">
|
||||
<?php echo _QXZ("<U>Show results for the past X hours</U> = If filled out and the start date-time is NOT filled out, the selected report will compile data starting at the time X hours ago up through the current time, which makes it a dynamic starting time as opposed to the set date-time used in the previous parameter."); ?><BR>
|
||||
|
||||
|
||||
|
||||
<BR><BR><BR><BR>
|
||||
<B><FONT SIZE=3><?php echo _QXZ("Nanpa cellphone filtering"); ?></FONT></B><BR><BR>
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,335 @@
|
||||
<?php
|
||||
# vicidial_stylesheet.php
|
||||
#
|
||||
# Copyright (C) 2017 Matt Florell <vicidial@gmail.com>, Joe Johnson <freewermadmin@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CSS/PHP file that uses the system-defined screen colors to display report elements
|
||||
#
|
||||
# 170830-2123 - First build
|
||||
#
|
||||
|
||||
require("dbconnect_mysqli.php");
|
||||
require("functions.php");
|
||||
header("Content-type: text/css");
|
||||
|
||||
require("screen_colors.php");
|
||||
?>
|
||||
/* TEXT/DISPLAY STYLES */
|
||||
.vertical-text {
|
||||
-ms-writing-mode: tb-rl;
|
||||
-webkit-writing-mode: vertical-rl;
|
||||
-moz-writing-mode: vertical-rl;
|
||||
-ms-writing-mode: vertical-rl;
|
||||
writing-mode: vertical-rl;
|
||||
white-space:nowrap;
|
||||
display:block;
|
||||
top:0;
|
||||
width:20px;
|
||||
height:20px;
|
||||
}
|
||||
div.scrolling {
|
||||
height: 77px;
|
||||
width: 320px;
|
||||
overflow: auto;
|
||||
border: 1px solid #666;
|
||||
background-color: #FFF;
|
||||
padding: 2px;
|
||||
}
|
||||
redalert {font-size: 18px; font-weight:bold; font-family: Arial, Sans-Serif; color: white ; background: #FF0000}
|
||||
.sm_shadow {box-shadow: 2px 2px 2px #000000;}
|
||||
.round_corners {
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.embossed {
|
||||
text-shadow: -1px -1px 2px #fff, 1px 1px 2px #000;
|
||||
opacity: 1.0;
|
||||
}
|
||||
.green {color: black; background-color: #99FF99}
|
||||
.red {color: black; background-color: #FF9999}
|
||||
.orange {color: black; background-color: #FFCC99}
|
||||
|
||||
.std_row1 {background-color: <?php echo $SSstd_row1_background; ?>}
|
||||
.std_row2 {background-color: <?php echo $SSstd_row2_background; ?>}
|
||||
.std_row3 {background-color: <?php echo $SSstd_row3_background; ?>}
|
||||
.std_row4 {background-color: <?php echo $SSstd_row4_background; ?>}
|
||||
.std_row5 {background-color: <?php echo $SSstd_row5_background; ?>}
|
||||
.alt_row1 {background-color: <?php echo $SSalt_row1_background; ?>}
|
||||
.alt_row2 {background-color: <?php echo $SSalt_row2_background; ?>}
|
||||
.alt_row3 {background-color: <?php echo $SSalt_row3_background; ?>}
|
||||
|
||||
.border2px {border:solid 2px #<?php echo $SSmenu_background; ?>}
|
||||
|
||||
|
||||
|
||||
.records_list_x{
|
||||
background-color: #<?php echo $SSstd_row2_background; ?>;
|
||||
}
|
||||
.records_list_x:hover{background-color: #E6E6E6;}
|
||||
.records_list_y{
|
||||
background-color: #<?php echo $SSstd_row1_background; ?>;
|
||||
}
|
||||
.records_list_y:hover{background-color: #E6E6E6;}
|
||||
.insetshadow {
|
||||
color: #202020;
|
||||
letter-spacing: .1em;
|
||||
text-shadow:
|
||||
-1px -1px 1px #111,
|
||||
2px 2px 1px #363636;
|
||||
}
|
||||
.elegantshadow {
|
||||
color: #131313;
|
||||
background-color: #e7e5e4;
|
||||
letter-spacing: .15em;
|
||||
text-shadow:
|
||||
1px -1px 0 #767676,
|
||||
-1px 2px 1px #737272,
|
||||
-2px 4px 1px #767474,
|
||||
-3px 6px 1px #787777,
|
||||
-4px 8px 1px #7b7a7a,
|
||||
-5px 10px 1px #7f7d7d,
|
||||
-6px 12px 1px #828181,
|
||||
-7px 14px 1px #868585,
|
||||
-8px 16px 1px #8b8a89,
|
||||
-9px 18px 1px #8f8e8d,
|
||||
-10px 20px 1px #949392,
|
||||
-11px 22px 1px #999897,
|
||||
-12px 24px 1px #9e9c9c,
|
||||
-13px 26px 1px #a3a1a1,
|
||||
-14px 28px 1px #a8a6a6,
|
||||
-15px 30px 1px #adabab,
|
||||
-16px 32px 1px #b2b1b0,
|
||||
-17px 34px 1px #b7b6b5,
|
||||
-18px 36px 1px #bcbbba,
|
||||
-19px 38px 1px #c1bfbf,
|
||||
-20px 40px 1px #c6c4c4,
|
||||
-21px 42px 1px #cbc9c8,
|
||||
-22px 44px 1px #cfcdcd,
|
||||
-23px 46px 1px #d4d2d1,
|
||||
-24px 48px 1px #d8d6d5,
|
||||
-25px 50px 1px #dbdad9,
|
||||
-26px 52px 1px #dfdddc,
|
||||
-27px 54px 1px #e2e0df,
|
||||
-28px 56px 1px #e4e3e2;
|
||||
}
|
||||
|
||||
/* FORM ELEMENTS */
|
||||
.form_field {
|
||||
font-family: Arial, Sans-Serif;
|
||||
font-size: 10px;
|
||||
margin-bottom: 3px;
|
||||
background-color: #<?php echo $SSalt_row3_background; ?>;
|
||||
padding: 2px;
|
||||
border: solid 1px #<?php echo $SSmenu_background; ?>;
|
||||
}
|
||||
.required_field {
|
||||
font-family: Arial, Sans-Serif;
|
||||
font-size: 10px;
|
||||
margin-bottom: 3px;
|
||||
background-color: #FFCCCC;
|
||||
padding: 2px;
|
||||
border: groove 2px #990000;
|
||||
background-position: top;
|
||||
}
|
||||
textarea.chat_box {
|
||||
font-family: Arial, Sans-Serif;
|
||||
font-size: 10px;
|
||||
margin-bottom: 3px;
|
||||
padding: 2px;
|
||||
border: solid 1px #000066;
|
||||
}
|
||||
textarea.chat_box_ended {
|
||||
font-family: Arial, Sans-Serif;
|
||||
font-size: 10px;
|
||||
margin-bottom: 3px;
|
||||
padding: 2px;
|
||||
border: solid 1px #000066;
|
||||
background-color:#999999;
|
||||
}
|
||||
.cust_form {
|
||||
font-family: Sans-Serif;
|
||||
font-size: 10px;
|
||||
overflow: hidden;
|
||||
}
|
||||
input.red_btn{
|
||||
font-family: Arial, Sans-Serif;
|
||||
font-size: 12px;
|
||||
color:#FFFFFF;
|
||||
font-weight:bold;
|
||||
background-color:#990000;
|
||||
border:2px solid;
|
||||
border-top-color:#FFCCCC;
|
||||
border-left-color:#FFCCCC;
|
||||
border-right-color:#330000;
|
||||
border-bottom-color:#330000;
|
||||
}
|
||||
input.green_btn{
|
||||
font-family: Arial, Sans-Serif;
|
||||
font-size: 12px;
|
||||
color:#FFFFFF;
|
||||
font-weight:bold;
|
||||
background-color:#009900;
|
||||
border:2px solid;
|
||||
border-top-color:#CCFFCC;
|
||||
border-left-color:#CCFFCC;
|
||||
border-right-color:#003300;
|
||||
border-bottom-color:#003300;
|
||||
}
|
||||
input.blue_btn{
|
||||
font-family: Arial, Sans-Serif;
|
||||
font-size: 12px;
|
||||
color:#FFFFFF;
|
||||
font-weight:bold;
|
||||
background-color:#000099;
|
||||
border:2px solid;
|
||||
border-top-color:#CCCCFF;
|
||||
border-left-color:#CCCCFF;
|
||||
border-right-color:#000033;
|
||||
border-bottom-color:#000033;
|
||||
}
|
||||
input.tiny_red_btn{
|
||||
color:#FFFFFF;
|
||||
font-size:9px;
|
||||
font-weight:bold;
|
||||
background-color:#993333;
|
||||
border:1px solid;
|
||||
border-top-color:#FFCCCC;
|
||||
border-left-color:#FFCCCC;
|
||||
border-right-color:#660000;
|
||||
border-bottom-color:#660000;
|
||||
filter:progid:DXImageTransform.Microsoft.Gradient
|
||||
(GradientType=0,StartColorStr='#00ffffff',EndColorStr='#ff660000');}
|
||||
input.tiny_blue_btn{
|
||||
color:#FFFFFF;
|
||||
font-size:9px;
|
||||
font-weight:bold;
|
||||
background-color:#3333FF;
|
||||
border:1px solid;
|
||||
border-top-color:#CCCCFF;
|
||||
border-left-color:#CCCCFF;
|
||||
border-right-color:#000066;
|
||||
border-bottom-color:#000066;
|
||||
filter:progid:DXImageTransform.Microsoft.Gradient
|
||||
(GradientType=0,StartColorStr='#00ffffff',EndColorStr='#ff000066');}
|
||||
input.tiny_yellow_btn{
|
||||
color:#000000;
|
||||
font-size:9px;
|
||||
font-weight:bold;
|
||||
background-color:#FFFF00;
|
||||
border:1px solid;
|
||||
border-top-color:#FFFFCC;
|
||||
border-left-color:#FFFFCC;
|
||||
border-right-color:#333300;
|
||||
border-bottom-color:#333300;
|
||||
filter:progid:DXImageTransform.Microsoft.Gradient
|
||||
(GradientType=0,StartColorStr='#00ffffff',EndColorStr='#ffFFFF00');}
|
||||
input.tiny_green_btn{
|
||||
color:#FFFFFF;
|
||||
font-size:9px;
|
||||
font-weight:bold;
|
||||
background-color:#009900;
|
||||
border:1px solid;
|
||||
border-top-color:#CCFFCC;
|
||||
border-left-color:#CCFFCC;
|
||||
border-right-color:#003300;
|
||||
border-bottom-color:#003300;
|
||||
filter:progid:DXImageTransform.Microsoft.Gradient
|
||||
(GradientType=0,StartColorStr='#00ffffff',EndColorStr='#FF003300');}
|
||||
|
||||
/* TABLE ELEMENTS */
|
||||
TABLE.question_td {
|
||||
-moz-border-radius: 10px 10px 10px 10px;
|
||||
-webkit-border-radius: 10px 10px 10px 10px;
|
||||
border-radius: 10px 10px 10px 10px;
|
||||
box-shadow: 5px 5px 12px #000000;
|
||||
padding: 5px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
color: black;
|
||||
font-size: 12pt;
|
||||
font-weight: bold;
|
||||
background: #<?php echo $SSframe_background; ?>;
|
||||
color: #000000;
|
||||
vertical-align: top;
|
||||
border:solid 2px #<?php echo $SSmenu_background; ?>
|
||||
}
|
||||
TD.panel_td {
|
||||
padding: 5px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
color: black;
|
||||
font-size: 12pt;
|
||||
font-weight: bold;
|
||||
background: #<?php echo $SSframe_background; ?>;
|
||||
color: #000000;
|
||||
vertical-align: top;
|
||||
}
|
||||
TD.search_td {
|
||||
-moz-border-radius: 5px 5px 5px 5px;
|
||||
-webkit-border-radius: 5px 5px 5px 5px;
|
||||
border-radius: 5px 5px 5px 5px;
|
||||
padding: 5px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
color: black;
|
||||
font-size: 8pt;
|
||||
font-weight: bold;
|
||||
background: #FB9BB9;
|
||||
color: #000000;
|
||||
vertical-align: top;
|
||||
border:solid 2px #600
|
||||
}
|
||||
|
||||
/* DIV ELEMENTS */
|
||||
div.shadowbox
|
||||
{
|
||||
box-shadow: 6px 6px 3px #888888;
|
||||
border:2px solid;
|
||||
border-radius:25px;
|
||||
FONT-WEIGHT: bold;
|
||||
FONT-SIZE: 12pt;
|
||||
FONT-FAMILY: Courier;
|
||||
padding-left:25px;
|
||||
}
|
||||
div.shadowbox_1st
|
||||
{
|
||||
background-color:#66FF66;
|
||||
box-shadow: 6px 6px 3px #888888;
|
||||
border:2px solid;
|
||||
border-radius:25px;
|
||||
padding-left:10px;
|
||||
FONT-WEIGHT: bold;
|
||||
FONT-SIZE: 12pt;
|
||||
FONT-FAMILY: Courier;
|
||||
}
|
||||
div.shadowbox_2nd
|
||||
{
|
||||
background-color:#FFFF66;
|
||||
box-shadow: 6px 6px 3px #888888;
|
||||
border:2px solid;
|
||||
border-radius:25px;
|
||||
FONT-WEIGHT: bold;
|
||||
FONT-SIZE: 12pt;
|
||||
FONT-FAMILY: Courier;
|
||||
padding-left:10px;
|
||||
}
|
||||
div.shadowbox_3rd
|
||||
{
|
||||
background-color:#66FFFF;
|
||||
box-shadow: 6px 6px 3px #888888;
|
||||
border:2px solid;
|
||||
border-radius:25px;
|
||||
FONT-WEIGHT: bold;
|
||||
FONT-SIZE: 12pt;
|
||||
FONT-FAMILY: Courier;
|
||||
padding-left:10px;
|
||||
}
|
||||
div.shadowbox_4th
|
||||
{
|
||||
background-color:#FF6666;
|
||||
box-shadow: 6px 6px 3px #888888;
|
||||
border:2px solid;
|
||||
border-radius:25px;
|
||||
FONT-WEIGHT: bold;
|
||||
FONT-SIZE: 12pt;
|
||||
FONT-FAMILY: Courier;
|
||||
padding-left:10px;
|
||||
}
|
||||
@@ -0,0 +1,666 @@
|
||||
// vicidial_whiteboard_functions.php
|
||||
//
|
||||
// Copyright (C) 2017 Matt Florell <vicidial@gmail.com>, Joe Johnson <freewermadmin@gmail.com> LICENSE: AGPLv2
|
||||
//
|
||||
// Javascript file used in AST_rt_whiteboard_reports.php
|
||||
//
|
||||
// 171027-2352 - First build
|
||||
//
|
||||
|
||||
var main_canvas = document.getElementById("MainReportCanvas");
|
||||
var size = {
|
||||
width: window.innerWidth || document.body.clientWidth,
|
||||
height: window.innerHeight || document.body.clientHeight
|
||||
}
|
||||
main_canvas.width=size.width-220;
|
||||
main_canvas.height=size.height-220;
|
||||
|
||||
// global chart names
|
||||
var MainGraph=null;
|
||||
var ChartsHidden=null;
|
||||
var LabelArray_holder=new Array();
|
||||
var CallCountArray_holder=new Array();
|
||||
var SaleCountArray_holder=new Array();
|
||||
var TotalCallCountArray_holder=new Array();
|
||||
var TotalSaleCountArray_holder=new Array();
|
||||
var TimeArray_holder=new Array();
|
||||
var ConvRateArray_holder=new Array();
|
||||
var CPHArray_holder=new Array();
|
||||
var SPHArray_holder=new Array();
|
||||
var TPAArray_holder=new Array();
|
||||
var TGArray_holder=new Array();
|
||||
|
||||
function StartRefresh(refresh_rate) {
|
||||
document.getElementById("loading_display").style.display="block";
|
||||
if (!refresh_rate) {refresh_rate=5;}
|
||||
document.getElementById("query_date2").value=document.getElementById("query_date").value;
|
||||
// document.getElementById("end_date2").value=document.getElementById("end_date").value;
|
||||
document.getElementById("query_time2").value=document.getElementById("query_time").value;
|
||||
// document.getElementById("end_time2").value=document.getElementById("end_time").value;
|
||||
document.getElementById("hourly_display2").value=document.getElementById("hourly_display").value;
|
||||
ToggleVisibility('report_control_panel');
|
||||
ToggleVisibility('report_display_panel');
|
||||
ChartsHidden=null;
|
||||
rInt=window.setInterval(function() {RefreshReportWindow()}, (refresh_rate*1000));
|
||||
}
|
||||
function StopRefresh() {
|
||||
MainGraph.clear();
|
||||
document.getElementById("parameters_span").innerHTML='';
|
||||
ToggleVisibility('report_control_panel');
|
||||
ToggleVisibility('report_display_panel');
|
||||
clearInterval(rInt);
|
||||
}
|
||||
|
||||
function ToggleVisibility(span_name) {
|
||||
var span_vis = document.getElementById(span_name).style;
|
||||
if (span_vis.display=='none') { span_vis.display = 'block'; } else { span_vis.display = 'none'; }
|
||||
}
|
||||
|
||||
function sortFunction(a, b) {
|
||||
if (a[0] === b[0])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (a[0] > b[0]) ? -1 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
function HighlightRelatedFields(report_type) {
|
||||
|
||||
switch(report_type) {
|
||||
case "agent_performance_total":
|
||||
case "agent_performance_rates":
|
||||
case "team_performance_total":
|
||||
case "team_performance_rates":
|
||||
var related_fields = ["campaigns", "user_groups", "users", "groups", "target_per_agent", "query_date", "query_time", "status_flags"];
|
||||
break;
|
||||
case "floor_performance_total":
|
||||
case "floor_performance_rates":
|
||||
var related_fields = ["campaigns", "target_gross", "query_date", "query_time", "hourly_display", "status_flags"];
|
||||
break;
|
||||
case "ingroup_performance_total":
|
||||
case "ingroup_performance_rates":
|
||||
var related_fields = ["campaigns", "groups", "target_per_agent", "query_date", "query_time", "status_flags"];
|
||||
break;
|
||||
case "did_performance_total":
|
||||
case "did_performance_rates":
|
||||
var related_fields = ["dids", "groups", "target_per_agent", "query_date", "query_time", "status_flags"];
|
||||
break;
|
||||
case "status_performance_total":
|
||||
var related_fields = ["campaigns", "groups", "users", "query_date", "query_time", "status_flags"];
|
||||
break;
|
||||
}
|
||||
|
||||
var form_elements = document.getElementById("vicidial_report").elements;
|
||||
for (var i=0, element; element=form_elements[i++];) {
|
||||
if (element.type=="text" || element.type=="select-one" || element.type=="select-multiple") {
|
||||
element.className='form_field sm_shadow round_corners';
|
||||
for (var j=0; j<related_fields.length; j++) {
|
||||
if (related_fields[j]==element.id) {
|
||||
element.className='required_field sm_shadow round_corners';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById("goto_reports").onclick = function() {
|
||||
location.href = "./admin.php?ADD=999999";
|
||||
};
|
||||
document.getElementById("adjust_report").onclick = function() {
|
||||
document.getElementById("query_date").value=document.getElementById("query_date2").value;
|
||||
// document.getElementById("end_date").value=document.getElementById("end_date2").value;
|
||||
document.getElementById("query_time").value=document.getElementById("query_time2").value;
|
||||
// document.getElementById("end_time").value=document.getElementById("end_time2").value;
|
||||
document.getElementById("hourly_display").value=document.getElementById("hourly_display2").value;
|
||||
clearInterval(rInt);
|
||||
var new_refresh_rate=document.getElementById("refresh_rate").value;
|
||||
rInt=window.setInterval(function() {RefreshReportWindow()}, (new_refresh_rate*1000));
|
||||
};
|
||||
|
||||
|
||||
function RefreshReportWindow() {
|
||||
document.getElementById("loading_display").style.display="none";
|
||||
var query_date=document.getElementById("query_date").value;
|
||||
// var end_date=document.getElementById("end_date").value;
|
||||
var query_time=document.getElementById("query_time").value;
|
||||
// var end_time=document.getElementById("end_time").value;
|
||||
var hourly_display=document.getElementById("hourly_display").value;
|
||||
var target_gross=document.getElementById("target_gross").value;
|
||||
var target_per_agent=document.getElementById("target_per_agent").value;
|
||||
var rpt_field = document.getElementById("report_type");
|
||||
var report_type = rpt_field.options[rpt_field.selectedIndex].value;
|
||||
|
||||
if (!target_per_agent) {target_per_agent=0;}
|
||||
if (!target_gross) {target_gross=0;}
|
||||
var size = {
|
||||
width: window.innerWidth || document.body.clientWidth,
|
||||
height: window.innerHeight || document.body.clientHeight
|
||||
}
|
||||
// main_canvas.width=size.width-40;
|
||||
// main_canvas.height=size.height-60;
|
||||
|
||||
|
||||
var xmlhttp=false;
|
||||
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
|
||||
{
|
||||
xmlhttp = new XMLHttpRequest();
|
||||
}
|
||||
if (xmlhttp)
|
||||
{
|
||||
var rpt_query = "&rpt_type="+report_type+"&query_date="+query_date+"&query_time="+query_time+"&target_gross="+target_gross+"&target_per_agent="+target_per_agent+"&hourly_display="+hourly_display;
|
||||
|
||||
var InvForm = document.forms[0];
|
||||
var x = 0;
|
||||
var query_date_str="Start date: "+query_date+" "+query_time;
|
||||
if (hourly_display && hourly_display>0)
|
||||
{
|
||||
query_date_str="Displaying last "+hourly_display+" hours";
|
||||
}
|
||||
|
||||
var campaign_parameters_str="";
|
||||
for (x=0;x<InvForm.campaigns.length;x++)
|
||||
{
|
||||
if (InvForm.campaigns[x].selected)
|
||||
{
|
||||
rpt_query +="&campaigns[]="+InvForm.campaigns[x].value;
|
||||
campaign_parameters_str+=InvForm.campaigns[x].value+", ";
|
||||
}
|
||||
}
|
||||
|
||||
var user_groups_parameters_str="";
|
||||
for (x=0;x<InvForm.user_groups.length;x++)
|
||||
{
|
||||
if (InvForm.user_groups[x].selected)
|
||||
{
|
||||
rpt_query +="&user_groups[]="+InvForm.user_groups[x].value;
|
||||
user_groups_parameters_str+=InvForm.user_groups[x].value+", ";
|
||||
}
|
||||
}
|
||||
|
||||
var users_parameters_str="";
|
||||
for (x=0;x<InvForm.users.length;x++)
|
||||
{
|
||||
if (InvForm.users[x].selected)
|
||||
{
|
||||
rpt_query +="&users[]="+InvForm.users[x].value;
|
||||
users_parameters_str+=InvForm.users[x].value+", ";
|
||||
}
|
||||
}
|
||||
|
||||
var groups_parameters_str="";
|
||||
for (x=0;x<InvForm.groups.length;x++)
|
||||
{
|
||||
if (InvForm.groups[x].selected)
|
||||
{
|
||||
rpt_query +="&groups[]="+InvForm.groups[x].value;
|
||||
groups_parameters_str+=InvForm.groups[x].value+", ";
|
||||
}
|
||||
}
|
||||
|
||||
var did_parameters_str="";
|
||||
for (x=0;x<InvForm.dids.length;x++)
|
||||
{
|
||||
if (InvForm.dids[x].selected)
|
||||
{
|
||||
rpt_query +="&dids[]="+InvForm.dids[x].value;
|
||||
did_parameters_str+=InvForm.dids[x].text+", ";
|
||||
}
|
||||
}
|
||||
|
||||
var status_flags_parameters_str="";
|
||||
for (x=0;x<InvForm.status_flags.length;x++)
|
||||
{
|
||||
if (InvForm.status_flags[x].selected)
|
||||
{
|
||||
rpt_query +="&status_flags[]="+InvForm.status_flags[x].value;
|
||||
status_flags_parameters_str+=InvForm.status_flags[x].text+", ";
|
||||
}
|
||||
}
|
||||
|
||||
var regRPTtype = new RegExp("floor_performance","g");
|
||||
var regRPTtotal = new RegExp("total","g");
|
||||
var regRPTrates = new RegExp("rates","g");
|
||||
var regRPTcomma = new RegExp(", $","g");
|
||||
var regRPTpipe = new RegExp("|$","g");
|
||||
|
||||
var CPstr=campaign_parameters_str.replace(regRPTcomma, '');
|
||||
var UGPstr=user_groups_parameters_str.replace(regRPTcomma, '');
|
||||
var USPstr=users_parameters_str.replace(regRPTcomma, '');
|
||||
var GPstr=groups_parameters_str.replace(regRPTcomma, '');
|
||||
var DPstr=did_parameters_str.replace(regRPTcomma, '');
|
||||
var SFstr=status_flags_parameters_str.replace(regRPTcomma, '');
|
||||
|
||||
|
||||
var report_parameters="<div class='embossed border2px round_corners sm_shadow alt_row1'>";
|
||||
report_parameters+="Report Type: "+report_type+"<BR>\n";
|
||||
report_parameters+=query_date_str+"<BR>\n";
|
||||
if (campaign_parameters_str.length>0) {report_parameters+="Campaigns: "+CPstr+"<BR>\n";}
|
||||
if (user_groups_parameters_str.length>0) {report_parameters+="User groups: "+UGPstr+"<BR>\n";}
|
||||
if (users_parameters_str.length>0) {report_parameters+="Users: "+USPstr+"<BR>\n";}
|
||||
if (groups_parameters_str.length>0) {report_parameters+="In-groups: "+GPstr+"<BR>\n";}
|
||||
if (did_parameters_str.length>0) {report_parameters+="DIDs: "+DPstr+"<BR>\n";}
|
||||
if (status_flags_parameters_str.length>0) {report_parameters+="Status flags: "+SFstr+"<BR>\n";}
|
||||
report_parameters+="</div>\n";
|
||||
|
||||
document.getElementById("parameters_span").innerHTML=report_parameters;
|
||||
|
||||
xmlhttp.open('POST', 'whiteboard_reports.php');
|
||||
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
|
||||
xmlhttp.send(rpt_query);
|
||||
xmlhttp.onreadystatechange = function()
|
||||
{
|
||||
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
|
||||
{
|
||||
response_txt = null;
|
||||
response_txt = xmlhttp.responseText;
|
||||
// document.getElementById("report_display_panel").innerHTML=report_type+" - "+response_txt; return 0;
|
||||
|
||||
var report_result_array=response_txt.split("\n");
|
||||
var arrayLength = report_result_array.length;
|
||||
|
||||
// var main_canvas = document.getElementById("MainReportCanvas");
|
||||
|
||||
// Define all arrays here - don't care if it's long - easier to deal with for now.
|
||||
var LabelArray=new Array();
|
||||
var CallCountArray=new Array();
|
||||
var SaleCountArray=new Array();
|
||||
var TotalCallCountArray=new Array();
|
||||
var TotalSaleCountArray=new Array();
|
||||
var TimeArray=new Array();
|
||||
var ConvRateArray=new Array();
|
||||
var CPHArray=new Array();
|
||||
var Top10Array=new Array();
|
||||
var SPHArray=new Array();
|
||||
var TPAArray=new Array(); // Target per agent
|
||||
var TGArray=new Array(); // Target per agent
|
||||
|
||||
var TotalCallCount=0;
|
||||
var TotalSaleCount=0;
|
||||
var TotalTime=0;
|
||||
var TotalCPH=0;
|
||||
var TotalSPH=0;
|
||||
var Top10Entries=0;
|
||||
var PrevTop10Value=0;
|
||||
var Top10Limit="off";
|
||||
|
||||
for (var i = 0; i < arrayLength; i++)
|
||||
{
|
||||
var agent_array=report_result_array[i].split("|");
|
||||
var agent_array_length=agent_array.length;
|
||||
if (report_type.match(regRPTtype))
|
||||
{
|
||||
LabelArray[i]=agent_array[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
var agent_label=agent_array[0];
|
||||
if (typeof agent_array[1] !== "undefined") {agent_label+=" - "+agent_array[1];}
|
||||
LabelArray[i]=agent_label;
|
||||
}
|
||||
|
||||
CallCountArray[i]=agent_array[2]; // TotalCallCount+=parseInt(agent_array[2]);
|
||||
SaleCountArray[i]=agent_array[3]; // TotalSaleCount+=parseInt(agent_array[3]);
|
||||
|
||||
if (report_type=="status_performance_total")
|
||||
{
|
||||
Top10Array[i]=[parseInt(agent_array[2]),agent_array[0],agent_array[1]];
|
||||
}
|
||||
else if (report_type.match(regRPTrates))
|
||||
{
|
||||
Top10Array[i]=[agent_array[5],agent_array[0],agent_array[1]];
|
||||
}
|
||||
else
|
||||
{
|
||||
Top10Array[i]=[parseInt(agent_array[3]),agent_array[0],agent_array[1]];
|
||||
}
|
||||
|
||||
TimeArray[i]=agent_array[4];
|
||||
if (report_type.match(regRPTtype) || report_type=="status_performance_total") // If the cumulative floor report, use the last entries from the TotalCall and TotalSale above (m
|
||||
{
|
||||
TotalTime=parseInt(agent_array[4]);
|
||||
}
|
||||
else
|
||||
{
|
||||
TotalTime+=parseInt(agent_array[4]);
|
||||
}
|
||||
ConvRateArray[i]=agent_array[5];
|
||||
CPHArray[i]=agent_array[6];
|
||||
SPHArray[i]=agent_array[7];
|
||||
TotalCallCountArray[i]=agent_array[8]; TotalCallCount=agent_array[8];
|
||||
TotalSaleCountArray[i]=agent_array[9]; TotalSaleCount=agent_array[9];
|
||||
TPAArray[i]=target_per_agent;
|
||||
TGArray[i]=target_gross;
|
||||
}
|
||||
|
||||
Top10Array.sort(sortFunction);
|
||||
}
|
||||
|
||||
var Top10HTMLChart="<div class='embossed border2px round_corners sm_shadow alt_row1' align='center'><table cellpadding='8' valign='top'>";
|
||||
Top10HTMLChart+="<tr>";
|
||||
Top10HTMLChart+="<th colspan='3'><font size='+2'>TOP 10 PERFORMERS</font></th>";
|
||||
Top10HTMLChart+="<td align='right'><input type='button' class='red_btn sm_shadow' style='width:20px;height:20px' value=' X' onClick=\"ToggleVisibility('top_10_display'); ToggleVisibility('graph_display');\"></td>";
|
||||
Top10HTMLChart+="</tr>";
|
||||
Top10HTMLChart+="<tr>";
|
||||
Top10HTMLChart+="<th>RANK</th>";
|
||||
Top10HTMLChart+="<th>NAME</th>";
|
||||
Top10HTMLChart+="<th></th>";
|
||||
Top10HTMLChart+="</tr>";
|
||||
|
||||
var breakloop="no";
|
||||
var prev_ranking=0;
|
||||
for (var i = 0; i < arrayLength; i++)
|
||||
{
|
||||
var trClass="std_row"+((i%2)+1);
|
||||
if (i>0 && Top10Array[i][0]==Top10Array[(i-1)][0])
|
||||
{
|
||||
var ranking=prev_ranking+" (tie)";
|
||||
}
|
||||
else
|
||||
{
|
||||
var ranking=(i+1);
|
||||
prev_ranking=ranking;
|
||||
if (i>=10) {breakloop="yes";}
|
||||
}
|
||||
if (breakloop=="no")
|
||||
{
|
||||
Top10HTMLChart+="<tr class='"+trClass+"'>";
|
||||
Top10HTMLChart+="<td align='right'><B>"+ranking+".</B></td>";
|
||||
Top10HTMLChart+="<td align='left'><B>"+Top10Array[i][1];
|
||||
if (typeof Top10Array[i][2] !== "undefined" && report_type!="status_performance_total") {Top10HTMLChart+=" - "+Top10Array[i][2];}
|
||||
Top10HTMLChart+="</B></td>";
|
||||
Top10HTMLChart+="<td align='center' colspan='2'><B>"+Top10Array[i][0];
|
||||
if (report_type.match(regRPTrates)) {Top10HTMLChart+=" %";} // Irritating, but necessary.
|
||||
Top10HTMLChart+="</B></td>";
|
||||
Top10HTMLChart+="</tr>";
|
||||
}
|
||||
else
|
||||
{
|
||||
i=arrayLength;
|
||||
}
|
||||
}
|
||||
Top10HTMLChart+="<tr>";
|
||||
Top10HTMLChart+="<th colspan='4'><input type='button' class='green_btn sm_shadow round_corners' style='width:250px' value='SHOW PERFORMANCE CHART' onClick=\"ToggleVisibility('top_10_display'); ToggleVisibility('graph_display');\"></th>";
|
||||
Top10HTMLChart+="</tr>";
|
||||
Top10HTMLChart+="</table><BR><BR></div>";
|
||||
document.getElementById("top_10_display").innerHTML=Top10HTMLChart;
|
||||
|
||||
var TotalCPH=TotalCallCount/(TotalTime/3600);
|
||||
var TotalSPH=TotalSaleCount/(TotalTime/3600);
|
||||
var TotalConvRate=(TotalSaleCount/TotalCallCount)*100;
|
||||
|
||||
var TotalHours = Math.floor(TotalTime / 3600);
|
||||
TotalTime = TotalTime - TotalHours * 3600;
|
||||
var TotalMinutes = Math.floor(TotalTime / 60);
|
||||
var TotalSeconds = TotalTime - TotalMinutes * 60;
|
||||
TotalMinutes="0"+TotalMinutes;
|
||||
TotalSeconds="0"+TotalSeconds;
|
||||
|
||||
if (response_txt && response_txt=="REPORT RETURNED NO RESULTS") {
|
||||
document.getElementById("total_calls_div").innerHTML="** NO RESULTS **";
|
||||
document.getElementById("total_sales_div").innerHTML="** NO RESULTS **";
|
||||
document.getElementById("total_time_div").innerHTML="** NO RESULTS **";
|
||||
document.getElementById("total_cph_div").innerHTML="** NO RESULTS **";
|
||||
document.getElementById("total_sph_div").innerHTML="** NO RESULTS **";
|
||||
document.getElementById("total_conv_div").innerHTML="** NO RESULTS **";
|
||||
} else {
|
||||
document.getElementById("total_calls_div").innerHTML=TotalCallCount;
|
||||
document.getElementById("total_sales_div").innerHTML=TotalSaleCount;
|
||||
document.getElementById("total_time_div").innerHTML=TotalHours+":"+TotalMinutes.slice(-2)+":"+TotalSeconds.slice(-2);
|
||||
document.getElementById("total_cph_div").innerHTML=Math.round(TotalCPH*100)/100;
|
||||
document.getElementById("total_sph_div").innerHTML=Math.round(TotalSPH*100)/100;
|
||||
document.getElementById("total_conv_div").innerHTML=Math.round(TotalConvRate*100)/100+"%";
|
||||
}
|
||||
// document.getElementById("totals_span").innerHTML='';
|
||||
// document.getElementById("parameters_span").innerHTML=response_txt;
|
||||
|
||||
|
||||
var label_title=query_date+" "+query_time;
|
||||
var hide_total="true";
|
||||
var hide_rates="true";
|
||||
var graph_type='bar';
|
||||
|
||||
if (LabelArray) { // Seems to return 3 times above. Dunno why
|
||||
|
||||
if (report_type.match(regRPTtotal)) {hide_total="false";}
|
||||
if (report_type.match(regRPTrates)) {hide_rates="false";}
|
||||
if (report_type.match(regRPTtype)) {graph_type='line';}
|
||||
if (LabelArray.length!=LabelArray_holder.length) {
|
||||
if (MainGraph)
|
||||
{
|
||||
MainGraph.destroy();
|
||||
}
|
||||
|
||||
if (report_type.match(regRPTtype))
|
||||
{
|
||||
MainGraph=new Chart(main_canvas, {
|
||||
type: graph_type,
|
||||
// options: { elements: { point: { radius: 0 } } }, // no dots
|
||||
data: {
|
||||
datasets: [
|
||||
{label: 'Total calls', data: TotalCallCountArray, backgroundColor: "rgba(153,153,255,0.5)", hidden: hide_total}, // dataset 0, see below
|
||||
{label: 'Total sales', data: TotalSaleCountArray, backgroundColor: "rgba(255,153,153,0.5)", hidden: hide_total}, // dataset 1, see below
|
||||
{label: 'Calls per hour', data: CPHArray, backgroundColor: "rgba(255,255,0,0.5)", hidden: hide_rates}, // dataset 2, see below
|
||||
{label: 'Sales per hour', data: SPHArray, backgroundColor: "rgba(153,255,153,0.5)", hidden: hide_rates}, // dataset 3, see below
|
||||
{label: 'Conversion rate %', data: ConvRateArray, backgroundColor: "rgba(255,153,255,0.5)", hidden: hide_rates}, // dataset 4, see below
|
||||
{label: 'Target gross', data: TGArray, type: 'line', pointRadius: 0, backgroundColor: "rgba(153,255,255,0.5)", hidden: hide_total} // dataset 5, see below
|
||||
],
|
||||
labels: LabelArray
|
||||
}
|
||||
});
|
||||
if (report_type.match(regRPTtotal))
|
||||
{
|
||||
if (!ChartsHidden)
|
||||
{
|
||||
ChartsHidden="false|false|true|true|true|false";
|
||||
}
|
||||
var hidden_array=ChartsHidden.split("|");
|
||||
MainGraph.data.datasets[0].hidden=(hidden_array[0] == 'true');
|
||||
MainGraph.data.datasets[1].hidden=(hidden_array[1] == 'true');
|
||||
MainGraph.data.datasets[2].hidden=(hidden_array[2] == 'true');
|
||||
MainGraph.data.datasets[3].hidden=(hidden_array[3] == 'true');
|
||||
MainGraph.data.datasets[4].hidden=(hidden_array[4] == 'true');
|
||||
MainGraph.data.datasets[5].hidden=(hidden_array[5] == 'true');
|
||||
|
||||
MainGraph.update();
|
||||
}
|
||||
if (report_type.match(regRPTrates))
|
||||
{
|
||||
if (!ChartsHidden)
|
||||
{
|
||||
ChartsHidden="true|true|false|false|false|true";
|
||||
}
|
||||
var hidden_array=ChartsHidden.split("|");
|
||||
MainGraph.data.datasets[0].hidden=(hidden_array[0] == 'true');
|
||||
MainGraph.data.datasets[1].hidden=(hidden_array[1] == 'true');
|
||||
MainGraph.data.datasets[2].hidden=(hidden_array[2] == 'true');
|
||||
MainGraph.data.datasets[3].hidden=(hidden_array[3] == 'true');
|
||||
MainGraph.data.datasets[4].hidden=(hidden_array[4] == 'true');
|
||||
MainGraph.data.datasets[5].hidden=(hidden_array[5] == 'true');
|
||||
|
||||
MainGraph.update();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MainGraph=new Chart(main_canvas, {
|
||||
type: 'bar',
|
||||
// options: { elements: { point: { radius: 0 } } }, // no dots
|
||||
data: {
|
||||
datasets: [
|
||||
{label: 'Total calls', data: CallCountArray, backgroundColor: "rgba(153,153,255,0.5)", hidden: false}, // dataset 0, see below
|
||||
{label: 'Total sales', data: SaleCountArray, backgroundColor: "rgba(255,153,153,0.5)", hidden: false}, // dataset 1, see below
|
||||
{label: 'Sales per hour', data: SPHArray, backgroundColor: "rgba(153,255,153,0.5)", hidden: false}, // dataset 2, see below
|
||||
{label: 'Conversion rate %', data: ConvRateArray, backgroundColor: "rgba(255,255,0,0.5)", hidden: false}, // dataset 3, see below
|
||||
{label: 'Target per unit', data: TPAArray, type: 'line', pointRadius: 0, backgroundColor: "rgba(153,255,255,0.5)", hidden: false} // dataset 4, see below
|
||||
],
|
||||
labels: LabelArray
|
||||
},
|
||||
options: {
|
||||
scales:{
|
||||
xAxes: [{
|
||||
stacked: true
|
||||
}],
|
||||
}
|
||||
}
|
||||
});
|
||||
if (report_type.match(regRPTtotal))
|
||||
{
|
||||
if (!ChartsHidden)
|
||||
{
|
||||
ChartsHidden="false|false|true|true|false";
|
||||
}
|
||||
var hidden_array=ChartsHidden.split("|");
|
||||
MainGraph.data.datasets[0].hidden=(hidden_array[0] == 'true');
|
||||
MainGraph.data.datasets[1].hidden=(hidden_array[1] == 'true');
|
||||
MainGraph.data.datasets[2].hidden=(hidden_array[2] == 'true');
|
||||
MainGraph.data.datasets[3].hidden=(hidden_array[3] == 'true');
|
||||
MainGraph.data.datasets[4].hidden=(hidden_array[4] == 'true');
|
||||
|
||||
MainGraph.update();
|
||||
}
|
||||
if (report_type.match(regRPTrates))
|
||||
{
|
||||
if (!ChartsHidden)
|
||||
{
|
||||
ChartsHidden="true|true|false|false|true";
|
||||
}
|
||||
var hidden_array=ChartsHidden.split("|");
|
||||
MainGraph.data.datasets[0].hidden=(hidden_array[0] == 'true');
|
||||
MainGraph.data.datasets[1].hidden=(hidden_array[1] == 'true');
|
||||
MainGraph.data.datasets[2].hidden=(hidden_array[2] == 'true');
|
||||
MainGraph.data.datasets[3].hidden=(hidden_array[3] == 'true');
|
||||
MainGraph.data.datasets[4].hidden=(hidden_array[4] == 'true');
|
||||
|
||||
MainGraph.update();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var update_graph_flag=0;
|
||||
for (var j=0; j<LabelArray.length; j++) {
|
||||
if (report_type.match(regRPTtype))
|
||||
{
|
||||
if (TotalCallCountArray[j]!=TotalCallCountArray_holder[j])
|
||||
{
|
||||
MainGraph.data.datasets[0].data[j]=TotalCallCountArray[j];
|
||||
update_graph_flag++;
|
||||
}
|
||||
if (TotalSaleCountArray[j]!=TotalSaleCountArray_holder[j])
|
||||
{
|
||||
MainGraph.data.datasets[1].data[j]=TotalSaleCountArray[j];
|
||||
update_graph_flag++;
|
||||
}
|
||||
if (CPHArray[j]!=CPHArray_holder[j])
|
||||
{
|
||||
MainGraph.data.datasets[2].data[j]=CPHArray[j];
|
||||
update_graph_flag++;
|
||||
}
|
||||
if (SPHArray[j]!=SPHArray_holder[j])
|
||||
{
|
||||
MainGraph.data.datasets[3].data[j]=SPHArray[j];
|
||||
update_graph_flag++;
|
||||
}
|
||||
if (ConvRateArray[j]!=ConvRateArray_holder[j])
|
||||
{
|
||||
MainGraph.data.datasets[4].data[j]=ConvRateArray[j];
|
||||
update_graph_flag++;
|
||||
}
|
||||
if (TGArray[j]!=TGArray_holder[j])
|
||||
{
|
||||
MainGraph.data.datasets[5].data[j]=TGArray[j];
|
||||
update_graph_flag++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CallCountArray[j]!=CallCountArray_holder[j])
|
||||
{
|
||||
MainGraph.data.datasets[0].data[j]=CallCountArray[j];
|
||||
update_graph_flag++;
|
||||
}
|
||||
if (SaleCountArray[j]!=SaleCountArray_holder[j])
|
||||
{
|
||||
MainGraph.data.datasets[1].data[j]=SaleCountArray[j];
|
||||
update_graph_flag++;
|
||||
}
|
||||
if (SPHArray[j]!=SPHArray_holder[j])
|
||||
{
|
||||
MainGraph.data.datasets[2].data[j]=SPHArray[j];
|
||||
update_graph_flag++;
|
||||
}
|
||||
if (ConvRateArray[j]!=ConvRateArray_holder[j])
|
||||
{
|
||||
MainGraph.data.datasets[3].data[j]=ConvRateArray[j];
|
||||
update_graph_flag++;
|
||||
}
|
||||
if (TPAArray[j]!=TPAArray_holder[j])
|
||||
{
|
||||
MainGraph.data.datasets[4].data[j]=TPAArray[j];
|
||||
update_graph_flag++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (update_graph_flag>0)
|
||||
{
|
||||
MainGraph.update();
|
||||
}
|
||||
}
|
||||
var hidden_charts="";
|
||||
for (var j=0; j<MainGraph.data.datasets.length; j++)
|
||||
{
|
||||
hidden_charts+=(!MainGraph.isDatasetVisible(j))+"|";
|
||||
}
|
||||
ChartsHidden=hidden_charts.replace(regRPTpipe, '');
|
||||
document.getElementById("hidden_display").value=ChartsHidden;
|
||||
|
||||
LabelArray_holder=LabelArray;
|
||||
CallCountArray_holder=CallCountArray;
|
||||
SaleCountArray_holder=SaleCountArray;
|
||||
TotalCallCountArray_holder=TotalCallCountArray;
|
||||
TotalSaleCountArray_holder=TotalSaleCountArray;
|
||||
TimeArray_holder=TimeArray;
|
||||
ConvRateArray_holder=ConvRateArray;
|
||||
CPHArray_holder=CPHArray;
|
||||
SPHArray_holder=SPHArray;
|
||||
TPAArray_holder=TPAArray;
|
||||
TGArray_holder=TGArray;
|
||||
// document.getElementById("canvas_message").innerHTML="URL: "+rpt_query+"<BR>\n";
|
||||
// document.getElementById("canvas_message").innerHTML+="Hide total: "+hide_total+"<BR>\n";
|
||||
// document.getElementById("canvas_message").innerHTML+="Hide rates: "+hide_rates+"<BR>\n";
|
||||
// document.getElementById("canvas_message").innerHTML+="Graph type: "+graph_type+"<BR>\n";
|
||||
// document.getElementById("canvas_message").innerHTML+="Target per agent: "+graph_type+"<BR>\n";
|
||||
// document.getElementById("canvas_message").innerHTML+="Result: "+response_txt+"<BR>\n";
|
||||
}
|
||||
// MainGraph.update();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
myLineChart.destroy();
|
||||
myLineChart.data.datasets[0].data[2] = 50; // Would update the first dataset's value of 'March' to be 50
|
||||
myLineChart.update(); // Calling update now animates the position of March from 90 to 50.
|
||||
|
||||
var mixedChart = new Chart(ctx, {
|
||||
type: 'bar',
|
||||
data: {
|
||||
datasets: [{
|
||||
label: 'Bar Dataset',
|
||||
data: [10, 20, 30, 40]
|
||||
}, {
|
||||
label: 'Line Dataset',
|
||||
data: [50, 50, 50, 50],
|
||||
|
||||
// Changes this dataset to become a line
|
||||
type: 'line'
|
||||
}],
|
||||
labels: ['January', 'February', 'March', 'April']
|
||||
},
|
||||
options: options
|
||||
});
|
||||
*/
|
||||
delete xmlhttp;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,608 @@
|
||||
<?php
|
||||
# whiteboard_reports.php
|
||||
#
|
||||
# Copyright (C) 2017 Matt Florell <vicidial@gmail.com>, Joe Johnson <freewermadmin@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# A PHP file that is for generating the stats that are displayed in the whiteboard report. Returns values.
|
||||
#
|
||||
# 171027-2352 - First build
|
||||
#
|
||||
|
||||
require("dbconnect_mysqli.php");
|
||||
require("functions.php");
|
||||
|
||||
if (file_exists('options.php'))
|
||||
{
|
||||
require('options.php');
|
||||
}
|
||||
|
||||
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
|
||||
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
|
||||
$PHP_SELF=$_SERVER['PHP_SELF'];
|
||||
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
|
||||
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
|
||||
if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];}
|
||||
elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];}
|
||||
if (isset($_GET["query_time"])) {$query_time=$_GET["query_time"];}
|
||||
elseif (isset($_POST["query_time"])) {$query_time=$_POST["query_time"];}
|
||||
if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];}
|
||||
elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];}
|
||||
if (isset($_GET["end_time"])) {$end_time=$_GET["end_time"];}
|
||||
elseif (isset($_POST["end_time"])) {$end_time=$_POST["end_time"];}
|
||||
if (isset($_GET["hourly_display"])) {$hourly_display=$_GET["hourly_display"];}
|
||||
elseif (isset($_POST["hourly_display"])) {$hourly_display=$_POST["hourly_display"];}
|
||||
if (isset($_GET["commission_rates"])) {$commission_rates=$_GET["commission_rates"];}
|
||||
elseif (isset($_POST["commission_rates"])) {$commission_rates=$_POST["commission_rates"];}
|
||||
if (isset($_GET["campaigns"])) {$campaigns=$_GET["campaigns"];}
|
||||
elseif (isset($_POST["campaigns"])) {$campaigns=$_POST["campaigns"];}
|
||||
if (isset($_GET["users"])) {$users=$_GET["users"];}
|
||||
elseif (isset($_POST["users"])) {$users=$_POST["users"];}
|
||||
if (isset($_GET["user_groups"])) {$user_groups=$_GET["user_groups"];}
|
||||
elseif (isset($_POST["user_groups"])) {$user_groups=$_POST["user_groups"];}
|
||||
if (isset($_GET["groups"])) {$groups=$_GET["groups"];}
|
||||
elseif (isset($_POST["groups"])) {$groups=$_POST["groups"];}
|
||||
if (isset($_GET["dids"])) {$dids=$_GET["dids"];}
|
||||
elseif (isset($_POST["dids"])) {$dids=$_POST["dids"];}
|
||||
if (isset($_GET["status_flags"])) {$status_flags=$_GET["status_flags"];}
|
||||
elseif (isset($_POST["status_flags"])) {$status_flags=$_POST["status_flags"];}
|
||||
if (isset($_GET["target_gross"])) {$target_gross=$_GET["target_gross"];}
|
||||
elseif (isset($_POST["target_gross"])) {$target_gross=$_POST["target_gross"];}
|
||||
if (isset($_GET["target_per_agent"])) {$target_per_agent=$_GET["target_per_agent"];}
|
||||
elseif (isset($_POST["target_per_agent"])) {$target_per_agent=$_POST["target_per_agent"];}
|
||||
if (isset($_GET["target_per_team"])) {$target_per_team=$_GET["target_per_team"];}
|
||||
elseif (isset($_POST["target_per_team"])) {$target_per_team=$_POST["target_per_team"];}
|
||||
if (isset($_GET["rpt_type"])) {$rpt_type=$_GET["rpt_type"];}
|
||||
elseif (isset($_POST["rpt_type"])) {$rpt_type=$_POST["rpt_type"];}
|
||||
|
||||
if (!$query_date) {$query_date=date("Y-m-d");}
|
||||
if (!$query_time) {$query_time="08:00:00";}
|
||||
|
||||
if (!$end_date) {$end_date=date("Y-m-d");}
|
||||
if (!$end_time) {$end_time=date("H:i:00");}
|
||||
|
||||
if ($hourly_display)
|
||||
{
|
||||
$query_date=date("Y-m-d", date("U")-(3600*$hourly_display));
|
||||
$query_time=date("H:i:00", date("U")-(3600*$hourly_display));
|
||||
$end_date=date("Y-m-d");
|
||||
$end_time=date("H:i:00");
|
||||
}
|
||||
|
||||
$rpt_string="";
|
||||
|
||||
$query_date=preg_replace("/[^0-9\-]/", "", $query_date);
|
||||
$end_date=preg_replace("/[^0-9\-]/", "", $end_date);
|
||||
$query_time=preg_replace("/[^0-9\:]/", "", $query_time);
|
||||
$end_time=preg_replace("/[^0-9\:]/", "", $end_time);
|
||||
|
||||
if (preg_match("/status_performance/", $rpt_type)) {
|
||||
if (!$campaigns || in_array("--ALL--", $campaigns)) {
|
||||
$campaign_id_SQL="";
|
||||
} else {
|
||||
$campaign_id_SQL=" and campaign_id in ('".implode("','", $campaigns)."')";
|
||||
}
|
||||
if (!$groups || in_array("--ALL--", $groups)) {
|
||||
if ($campaign_id_SQL=="") {
|
||||
$group_SQL="";
|
||||
} else {
|
||||
$ingroup_stmt="SELECT closer_campaigns from vicidial_campaigns where campaign_id in ('".implode("','", $campaigns)."')";
|
||||
$ingroup_rslt=mysql_to_mysqli($ingroup_stmt, $link);
|
||||
$group_str="";
|
||||
while ($ig_row=mysqli_fetch_row($ingroup_rslt)) {
|
||||
$group_str.=$ig_row[0];
|
||||
$group_str=preg_replace('/ -$/', "", $group_str);
|
||||
}
|
||||
$group_str=trim($group_str);
|
||||
$groups=explode(" ", $group_str);
|
||||
$group_SQL=" and campaign_id in ('".implode("','", $groups)."')";
|
||||
}
|
||||
} else {
|
||||
$group_SQL=" and campaign_id in ('".implode("','", $groups)."')";
|
||||
}
|
||||
if (!$users || in_array("--ALL--", $users)) {
|
||||
$user_SQL="";
|
||||
} else {
|
||||
$user_SQL=" and user in ('".implode("','", $users)."')";
|
||||
}
|
||||
if (!$status_flags || in_array("--ALL--", $status_flags)) {
|
||||
$status_SQL="";
|
||||
} else {
|
||||
$flag_SQL="";
|
||||
for ($s=0; $s<count($status_flags); $s++) {
|
||||
$flag_SQL.=$status_flags[$s]."='Y' or ";
|
||||
}
|
||||
$flag_SQL=preg_replace('/ or $/', "", $flag_SQL);
|
||||
|
||||
$status_stmt="SELECT distinct status from vicidial_statuses where ($flag_SQL) UNION SELECT distinct status from vicidial_campaign_statuses where ($flag_SQL) $campaign_id_SQL";
|
||||
$status_rslt=mysql_to_mysqli($status_stmt, $link);
|
||||
$status_str="";
|
||||
while ($status_row=mysqli_fetch_row($status_rslt)) {
|
||||
$status_str.="'$status_row[0]',";
|
||||
}
|
||||
$status_str=preg_replace('/,$/', "", $status_str);
|
||||
$status_SQL=" and status in ($status_str) ";
|
||||
}
|
||||
|
||||
$sale_stmt="SELECT distinct status from vicidial_statuses where sale='Y' $status_SQL UNION SELECT distinct status from vicidial_campaign_statuses where sale='Y' $campaign_id_SQL $status_SQL";
|
||||
$sale_rslt=mysql_to_mysqli($sale_stmt, $link);
|
||||
$sale_dispos=array();
|
||||
if ($DB) {$rpt_string.=$sale_stmt."<BR>\n";}
|
||||
while($sale_row=mysqli_fetch_row($sale_rslt)) {
|
||||
array_push($sale_dispos, $sale_row[0]);
|
||||
}
|
||||
|
||||
$shift_start="$query_date $query_time";
|
||||
$shift_end="$end_date $end_time";
|
||||
|
||||
$outbound_max_time_stmt="SELECT if(min(call_date) is null, 0, min(call_date)), if(max(call_date) is null, 0, max(call_date)) From vicidial_log where call_date>='$query_date $query_time' and call_date<='$end_date $end_time' $campaign_id_SQL $user_SQL $status_SQL";
|
||||
$rslt=mysql_to_mysqli($outbound_max_time_stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
if ($row[0]>0) {$shift_start=$row[0];}
|
||||
if ($row[1]>0) {$shift_end=$row[1];}
|
||||
|
||||
$inbound_max_time_stmt="SELECT if(min(call_date) is null, 0, min(call_date)), if(max(call_date) is null, 0, max(call_date)) From vicidial_closer_log where call_date>='$query_date $query_time' and call_date<='$end_date $end_time' $group_SQL $user_SQL $status_SQL";
|
||||
$rslt=mysql_to_mysqli($inbound_max_time_stmt, $link);
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
if ($row[0]>0 && preg_replace("/[^0-9]/", "", $row[0])<preg_replace("/[^0-9]/", "", $shift_start)) {$shift_start=$row[0];}
|
||||
if (preg_replace("/[^0-9]/", "", $row[1])>preg_replace("/[^0-9]/", "", $shift_end)) {$shift_end=$row[1];}
|
||||
|
||||
$time_stmt="SELECT TIMESTAMPDIFF(SECOND,'$shift_start','$shift_end')";
|
||||
$time_rslt=mysql_to_mysqli($time_stmt, $link);
|
||||
$time_row=mysqli_fetch_row($time_rslt);
|
||||
$shift_duration=$time_row[0];
|
||||
|
||||
$outbound_stmt="SELECT status, count(*) From vicidial_log where call_date>='$query_date $query_time' and call_date<='$end_date $end_time' $campaign_id_SQL $user_SQL $status_SQL group by status order by status";
|
||||
$status_counts=array();
|
||||
$rslt=mysql_to_mysqli($outbound_stmt, $link);
|
||||
while ($row=mysqli_fetch_row($rslt)) {
|
||||
if ($row[1]!="") {
|
||||
$status_counts["$row[0]"][0]+=$row[1];
|
||||
if (in_array($row[0], $sale_dispos)) {
|
||||
$status_counts["$row[0]"][1]+=$row[1];
|
||||
}
|
||||
}
|
||||
$status_counts["$row[0]"][2]+=$row[2];
|
||||
}
|
||||
|
||||
$inbound_stmt="SELECT status, count(*) from vicidial_closer_log where call_date>='$query_date $query_time' and call_date<='$end_date $end_time' $group_SQL $user_SQL $status_SQL group by status order by status";
|
||||
$rslt=mysql_to_mysqli($inbound_stmt, $link);
|
||||
while ($row=mysqli_fetch_row($rslt)) {
|
||||
if ($row[1]!="") {
|
||||
$status_counts["$row[0]"][0]+=$row[1];
|
||||
if (in_array($row[0], $sale_dispos)) {
|
||||
$status_counts["$row[0]"][1]+=$row[1];
|
||||
}
|
||||
}
|
||||
$status_counts["$row[0]"][2]+=$row[2];
|
||||
}
|
||||
|
||||
if (count($status_counts)==0) {
|
||||
$rpt_string="REPORT RETURNED NO RESULTS";
|
||||
} else {
|
||||
while(list($key, $val)=each($status_counts)) {
|
||||
|
||||
$val[0]+=0;
|
||||
$val[1]+=0;
|
||||
$total_calls+=$val[0];
|
||||
$total_sales+=$val[1];
|
||||
|
||||
|
||||
$conv_rate=sprintf("%.2f", 100*MathZDC($val[1], $val[0])); # Conversion rate
|
||||
$cph=sprintf("%.2f", (MathZDC($val[0], ($shift_duration/3600)))); # SPH - this is based on total time since start_time. Switch to $val[2] if you want it based on the individual agent's total time in the dialer.
|
||||
$sph=sprintf("%.2f", (MathZDC($val[1], ($shift_duration/3600)))); # SPH - this is based on total time since start_time. Switch to $val[2] if you want it based on the individual agent's total time in the dialer.
|
||||
$rpt_string.="$key|$full_name|$val[0]|$val[1]|$shift_duration|$conv_rate|$cph|$sph|$total_calls|$total_sales\n";
|
||||
# Agent/user group, total calls, total sales, total time, conversion rate, sales per hour
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match("/(agent|team)_performance/", $rpt_type)) {
|
||||
|
||||
if (!$campaigns || in_array("--ALL--", $campaigns)) {
|
||||
$campaign_id_SQL="";
|
||||
} else {
|
||||
$campaign_id_SQL=" and campaign_id in ('".implode("','", $campaigns)."')";
|
||||
}
|
||||
if (!$users || in_array("--ALL--", $users)) {
|
||||
$user_SQL="";
|
||||
} else {
|
||||
$user_SQL=" and user in ('".implode("','", $users)."')";
|
||||
}
|
||||
if (!$groups || in_array("--ALL--", $groups)) {
|
||||
$group_SQL="";
|
||||
} else {
|
||||
$group_SQL=" and campaign_id in ('".implode("','", $groups)."')";
|
||||
}
|
||||
if (!$user_groups || in_array("--ALL--", $user_groups)) {
|
||||
$user_group_SQL="";
|
||||
} else {
|
||||
$user_group_SQL=" and user_group in ('".implode("','", $user_groups)."')";
|
||||
}
|
||||
if (!$status_flags || in_array("--ALL--", $status_flags)) {
|
||||
$status_SQL="";
|
||||
} else {
|
||||
$flag_SQL="";
|
||||
for ($s=0; $s<count($status_flags); $s++) {
|
||||
$flag_SQL.=$status_flags[$s]."='Y' or ";
|
||||
}
|
||||
$flag_SQL=preg_replace('/ or $/', "", $flag_SQL);
|
||||
|
||||
$status_stmt="SELECT distinct status from vicidial_statuses where ($flag_SQL) UNION SELECT distinct status from vicidial_campaign_statuses where ($flag_SQL) $campaign_id_SQL";
|
||||
$status_rslt=mysql_to_mysqli($status_stmt, $link);
|
||||
$status_str="";
|
||||
while ($status_row=mysqli_fetch_row($status_rslt)) {
|
||||
$status_str.="'$status_row[0]',";
|
||||
}
|
||||
$status_str=preg_replace('/,$/', "", $status_str);
|
||||
$status_SQL=" and status in ($status_str) ";
|
||||
}
|
||||
|
||||
|
||||
$time_stmt="SELECT TIMESTAMPDIFF(SECOND,'$query_date $query_time',IF(UNIX_TIMESTAMP(now())<UNIX_TIMESTAMP('$end_date $end_time'),now(),'$end_date $end_time'))";
|
||||
$time_rslt=mysql_to_mysqli($time_stmt, $link);
|
||||
$time_row=mysqli_fetch_row($time_rslt);
|
||||
$shift_duration=$time_row[0];
|
||||
|
||||
$sale_stmt="SELECT distinct status from vicidial_statuses where sale='Y' $status_SQL UNION SELECT distinct status from vicidial_campaign_statuses where sale='Y' $campaign_id_SQL $status_SQL";
|
||||
$sale_rslt=mysql_to_mysqli($sale_stmt, $link);
|
||||
$sale_dispos=array();
|
||||
if ($DB) {$rpt_string.=$sale_stmt."<BR>\n";}
|
||||
while($sale_row=mysqli_fetch_row($sale_rslt)) {
|
||||
array_push($sale_dispos, $sale_row[0]);
|
||||
}
|
||||
|
||||
if (preg_match("/agent_performance/", $rpt_type)) {
|
||||
$stmt="SELECT user, status, sum(pause_sec+wait_sec+talk_sec+dispo_sec), count(*) from vicidial_agent_log where event_time>='$query_date $query_time' and event_time<='$end_date $end_time' $campaign_id_SQL $user_SQL $user_group_SQL $status_SQL group by user, status order by user, status";
|
||||
} else if (preg_match("/team_performance/", $rpt_type)) {
|
||||
$stmt="SELECT user_group, status, sum(pause_sec+wait_sec+talk_sec+dispo_sec), count(*) from vicidial_agent_log where event_time>='$query_date $query_time' and event_time<='$end_date $end_time' $campaign_id_SQL $user_SQL $user_group_SQL $status_SQL group by user_group, status order by user_group, status";
|
||||
}
|
||||
|
||||
if ($DB) {$rpt_string.=$stmt."<BR>\n";}
|
||||
|
||||
$agent_counts=array();
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
while ($row=mysqli_fetch_row($rslt)) {
|
||||
if ($row[1]!="") {
|
||||
$agent_counts["$row[0]"][0]+=$row[3];
|
||||
if (in_array($row[1], $sale_dispos)) {
|
||||
$agent_counts["$row[0]"][1]+=$row[3];
|
||||
}
|
||||
}
|
||||
$agent_counts["$row[0]"][2]+=$row[2];
|
||||
}
|
||||
|
||||
if (count($agent_counts)==0) {
|
||||
$rpt_string="REPORT RETURNED NO RESULTS";
|
||||
} else {
|
||||
while(list($key, $val)=each($agent_counts)) {
|
||||
$user_stmt="SELECT full_name from vicidial_users where user='$key'";
|
||||
$user_rslt=mysql_to_mysqli($user_stmt, $link);
|
||||
while ($user_row=mysqli_fetch_row($user_rslt)) {
|
||||
$full_name=$user_row[0];
|
||||
}
|
||||
if (!$full_name) {$full_name="N/A";}
|
||||
$val[0]+=0;
|
||||
$val[1]+=0;
|
||||
$total_calls+=$val[0];
|
||||
$total_sales+=$val[1];
|
||||
|
||||
|
||||
$conv_rate=sprintf("%.2f", 100*MathZDC($val[1], $val[0])); # Conversion rate
|
||||
$cph=sprintf("%.2f", (MathZDC($val[0], ($shift_duration/3600)))); # SPH - this is based on total time since start_time. Switch to $val[2] if you want it based on the individual agent's total time in the dialer.
|
||||
$sph=sprintf("%.2f", (MathZDC($val[1], ($shift_duration/3600)))); # SPH - this is based on total time since start_time. Switch to $val[2] if you want it based on the individual agent's total time in the dialer.
|
||||
$rpt_string.="$key|$full_name|$val[0]|$val[1]|$shift_duration|$conv_rate|$cph|$sph|$total_calls|$total_sales\n";
|
||||
# Agent/user group, total calls, total sales, total time, conversion rate, sales per hour
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match("/floor_performance/", $rpt_type)) {
|
||||
if ($hourly_display) {
|
||||
$query_date=date("Y-m-d", date("U")-(3600*$hourly_display));
|
||||
$query_time=date("H:i:00", date("U")-(3600*$hourly_display));
|
||||
$start_epoch=date("U")-(3600*$hourly_display);
|
||||
} else {
|
||||
$start_epoch=strtotime("$query_date $query_time");
|
||||
}
|
||||
|
||||
$end_date=date("Y-m-d");
|
||||
$end_time=date("H:i:00");
|
||||
$end_epoch=date("U");
|
||||
|
||||
# Create ungodly array to store counts
|
||||
$call_counts=array();
|
||||
while($start_epoch<$end_epoch) {
|
||||
$key=date("Y-m-d H:i", $start_epoch);
|
||||
$call_counts["$key"][0]=0; # Calls
|
||||
$call_counts["$key"][1]=0; # Sales
|
||||
$call_counts["$key"][2]=0; # Cumulative calls
|
||||
$call_counts["$key"][3]=0; # Cumulative sales
|
||||
$start_epoch+=60;
|
||||
}
|
||||
|
||||
if (in_array("--ALL--", $campaigns)) {
|
||||
$campaign_id_SQL="";
|
||||
} else {
|
||||
$campaign_id_SQL=" and vicidial_agent_log.campaign_id in ('".implode("','", $campaigns)."')";
|
||||
}
|
||||
if (!$status_flags || in_array("--ALL--", $status_flags)) {
|
||||
$status_SQL="";
|
||||
} else {
|
||||
$flag_SQL="";
|
||||
for ($s=0; $s<count($status_flags); $s++) {
|
||||
$flag_SQL.=$status_flags[$s]."='Y' or ";
|
||||
}
|
||||
$flag_SQL=preg_replace('/ or $/', "", $flag_SQL);
|
||||
|
||||
$status_stmt="SELECT distinct status from vicidial_statuses where ($flag_SQL) UNION SELECT distinct status from vicidial_campaign_statuses where ($flag_SQL) $campaign_id_SQL";
|
||||
$status_rslt=mysql_to_mysqli($status_stmt, $link);
|
||||
$status_str="";
|
||||
while ($status_row=mysqli_fetch_row($status_rslt)) {
|
||||
$status_str.="'$status_row[0]',";
|
||||
}
|
||||
$status_str=preg_replace('/,$/', "", $status_str);
|
||||
$status_SQL=" and status in ($status_str) ";
|
||||
}
|
||||
|
||||
$sale_stmt="SELECT distinct status from vicidial_statuses where sale='Y' $status_SQL UNION SELECT distinct status from vicidial_campaign_statuses where sale='Y' and campaign_id in ('".implode("','", $campaigns)."') $status_SQL";
|
||||
# $rpt_string.="$sale_stmt\n";
|
||||
$sale_rslt=mysql_to_mysqli($sale_stmt, $link);
|
||||
$sale_dispos=array();
|
||||
while($sale_row=mysqli_fetch_row($sale_rslt)) {
|
||||
array_push($sale_dispos, $sale_row[0]);
|
||||
}
|
||||
|
||||
$stmt="SELECT substr(event_time+INTERVAL (pause_sec+wait_sec+talk_sec+dispo_sec) SECOND, 1, 16) as call_end_time_min, status, count(*) from vicidial_agent_log where event_time>='$query_date $query_time' and event_time<='$end_date $end_time' $campaign_id_SQL $user_SQL $user_group_SQL $status_SQL group by call_end_time_min, status order by call_end_time_min, status";
|
||||
# $rpt_string.="$stmt\n";
|
||||
if ($DB) {$rpt_string.=$stmt."<BR>\n";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$total_calls=0; $total_sales=0;
|
||||
while ($row=mysqli_fetch_row($rslt)) {
|
||||
$key=$row[0];
|
||||
$status=$row[1];
|
||||
$calls=$row[2];
|
||||
$total_calls+=$calls;
|
||||
$call_counts["$key"][0]+=$calls;
|
||||
$call_counts["$key"][2]=$total_calls;
|
||||
if (in_array($status, $sale_dispos)) {
|
||||
$total_sales+=$calls;
|
||||
$call_counts["$key"][1]+=$calls;
|
||||
}
|
||||
$call_counts["$key"][3]=$total_sales;
|
||||
}
|
||||
|
||||
if (count($call_counts)==0) {
|
||||
$rpt_string="REPORT RETURNED NO RESULTS";
|
||||
} else {
|
||||
$mins=0;
|
||||
ksort($call_counts);
|
||||
$prev_calls=0;
|
||||
$prev_sales=0;
|
||||
while(list($key, $val)=each($call_counts)) {
|
||||
# if($val[2]>0) { // With time ranges, trim off the starting time in case person running report sets it before they start dialing.
|
||||
$mins++;
|
||||
$shift_duration=$mins*60;
|
||||
$hours=$mins/60;
|
||||
$val[0]+=0;
|
||||
$val[1]+=0;
|
||||
if ($val[2]==0) {$val[2]=$prev_calls;}
|
||||
if ($val[3]==0) {$val[3]=$prev_sales;}
|
||||
$conv=sprintf("%.2f", (100*MathZDC($val[3],$val[2])));
|
||||
$cph=sprintf("%.2f", ($val[2]/$hours));
|
||||
$sph=sprintf("%.2f", ($val[3]/$hours));
|
||||
$rpt_string.="$key||$val[0]|$val[1]|$shift_duration|$conv|$cph|$sph|$val[2]|$val[3]\n";
|
||||
$prev_calls=$val[2];
|
||||
$prev_sales=$val[3];
|
||||
# }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match("/(did|ingroup)_performance/", $rpt_type)) {
|
||||
if (!$campaigns || in_array("--ALL--", $campaigns)) {
|
||||
$campaign_id_SQL="";
|
||||
} else {
|
||||
$campaign_id_SQL=" and campaign_id in ('".implode("','", $campaigns)."')";
|
||||
}
|
||||
if (!$groups || in_array("--ALL--", $groups)) {
|
||||
$group_SQL="";
|
||||
$ingroup_SQL="";
|
||||
} else {
|
||||
$group_SQL=" and campaign_id in ('".implode("','", $groups)."')";
|
||||
$ingroup_SQL=" and group_id in ('".implode("','", $groups)."')";
|
||||
}
|
||||
if (!$user_groups || in_array("--ALL--", $user_groups)) {
|
||||
$user_group_SQL="";
|
||||
} else {
|
||||
$user_group_SQL=" and user_group in ('".implode("','", $user_groups)."')";
|
||||
}
|
||||
if (!$dids || in_array("--ALL--", $dids)) {
|
||||
$did_SQL="";
|
||||
} else {
|
||||
$did_SQL=" and vid.did_id in ('".implode("','", $dids)."')";
|
||||
}
|
||||
if (!$status_flags || in_array("--ALL--", $status_flags)) {
|
||||
$status_SQL="";
|
||||
} else {
|
||||
$flag_SQL="";
|
||||
for ($s=0; $s<count($status_flags); $s++) {
|
||||
$flag_SQL.=$status_flags[$s]."='Y' or ";
|
||||
}
|
||||
$flag_SQL=preg_replace('/ or $/', "", $flag_SQL);
|
||||
|
||||
$status_stmt="SELECT distinct status from vicidial_statuses where ($flag_SQL) UNION SELECT distinct status from vicidial_campaign_statuses where ($flag_SQL) $campaign_id_SQL";
|
||||
$status_rslt=mysql_to_mysqli($status_stmt, $link);
|
||||
$status_str="";
|
||||
while ($status_row=mysqli_fetch_row($status_rslt)) {
|
||||
$status_str.="'$status_row[0]',";
|
||||
}
|
||||
$status_str=preg_replace('/,$/', "", $status_str);
|
||||
$status_SQL=" and status in ($status_str) ";
|
||||
}
|
||||
|
||||
# print_r($groups);
|
||||
|
||||
# Get all ingroups, and later all DIDs if necessary, for the selected campaigns
|
||||
if (in_array("--ALL--", $campaigns) || $campaign_id_SQL!="") {
|
||||
$ingrp_stmt="SELECT closer_campaigns from vicidial_campaigns where active='Y' $campaign_id_SQL";
|
||||
if ($DB) {$rpt_string.=$ingrp_stmt."<BR>\n";}
|
||||
$ingrp_rslt=mysql_to_mysqli($ingrp_stmt, $link);
|
||||
# append to existing did array
|
||||
while ($ingrp_row=mysqli_fetch_row($ingrp_rslt)) {
|
||||
$ingrp_row[0]=preg_replace("/ -$/", "", $ingrp_row[0]);
|
||||
$ingrp_array=explode(" ", $ingrp_row[0]);
|
||||
$groups=array_merge($groups, $ingrp_array);
|
||||
}
|
||||
$groups=array_unique($groups);
|
||||
$group_SQL=" and campaign_id in ('".implode("','", $groups)."')";
|
||||
$ingroup_SQL=" and group_id in ('".implode("','", $groups)."')";
|
||||
}
|
||||
|
||||
# DID level only
|
||||
if (preg_match("/did_performance/", $rpt_type)) {
|
||||
if (in_array("--ALL--", $groups) || $user_group_SQL!="") {
|
||||
$did_stmt="SELECT did_id from vicidial_inbound_dids where did_route='IN_GROUP' $ingroup_SQL";
|
||||
if ($DB) {$rpt_string.=$did_stmt."<BR>\n";}
|
||||
$did_rslt=mysql_to_mysqli($did_stmt, $link);
|
||||
# append to existing did array
|
||||
while ($did_row=mysqli_fetch_row($did_rslt)) {
|
||||
array_push($dids, $did_row[0]);
|
||||
}
|
||||
$dids=array_unique($dids);
|
||||
$did_SQL=" and vid.did_id in ('".implode("','", $dids)."')";
|
||||
}
|
||||
}
|
||||
|
||||
$sale_stmt="SELECT distinct status from vicidial_statuses where sale='Y' $status_SQL UNION SELECT distinct status from vicidial_campaign_statuses where sale='Y' $campaign_id_SQL $status_SQL"; # Leave it for all campaigns, given the nature.
|
||||
# $rpt_string.="$sale_stmt\n";
|
||||
$sale_rslt=mysql_to_mysqli($sale_stmt, $link);
|
||||
$sale_dispos=array();
|
||||
while($sale_row=mysqli_fetch_row($sale_rslt)) {
|
||||
array_push($sale_dispos, $sale_row[0]);
|
||||
}
|
||||
|
||||
if (preg_match("/did_performance/", $rpt_type)) {
|
||||
# $stmt="SELECT user, status, sum(pause_sec+wait_sec+talk_sec+dispo_sec), count(*) from vicidial_agent_log where event_time>='$query_date $query_time' and event_time<='$end_date $end_time' $campaign_id_SQL $user_SQL $user_group_SQL group by user, status order by user, status";
|
||||
$stmt="SELECT vid.did_pattern, vcl.status, sum(vcl.length_in_sec-vcl.queue_seconds) as call_length, count(*) From vicidial_closer_log vcl, vicidial_did_log vdl, vicidial_inbound_dids vid where vcl.call_date>='$query_date $query_time' and vcl.call_date<='$end_date $end_time' and vcl.uniqueid=vdl.uniqueid and vdl.did_id=vid.did_id $did_SQL $status_SQL group by did_pattern, did_description, status order by did_pattern, status";
|
||||
} else if (preg_match("/ingroup_performance/", $rpt_type)) {
|
||||
# $stmt="SELECT user_group, status, sum(pause_sec+wait_sec+talk_sec+dispo_sec), count(*) from vicidial_agent_log where event_time>='$query_date $query_time' and event_time<='$end_date $end_time' $campaign_id_SQL $user_SQL $user_group_SQL group by user_group, status order by user_group, status";
|
||||
$stmt="SELECT campaign_id, status, sum(length_in_sec-queue_seconds), count(*) from vicidial_closer_log where call_date>='$query_date $query_time' and call_date<='$end_date $end_time' $group_SQL $status_SQL group by campaign_id, status order by campaign_id, status";
|
||||
}
|
||||
|
||||
if ($DB) {$rpt_string.=$stmt."<BR>\n";}
|
||||
|
||||
$inbound_counts=array();
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
while ($row=mysqli_fetch_row($rslt)) {
|
||||
if ($row[1]!="") {
|
||||
$inbound_counts["$row[0]"][0]+=$row[3];
|
||||
if (in_array($row[1], $sale_dispos)) {
|
||||
$inbound_counts["$row[0]"][1]+=$row[3];
|
||||
}
|
||||
}
|
||||
$inbound_counts["$row[0]"][2]+=$row[2];
|
||||
}
|
||||
|
||||
$total_calls=0; $total_sales=0;
|
||||
|
||||
if (count($inbound_counts)==0) {
|
||||
$rpt_string="REPORT RETURNED NO RESULTS";
|
||||
} else {
|
||||
while(list($key, $val)=each($inbound_counts)) {
|
||||
|
||||
if (preg_match("/did_performance/", $rpt_type)) {
|
||||
$user_stmt="SELECT did_description from vicidial_inbound_dids where did_pattern='$key'";
|
||||
} else {
|
||||
$user_stmt="SELECT group_name from vicidial_inbound_groups where group_id='$key'";
|
||||
}
|
||||
$user_rslt=mysql_to_mysqli($user_stmt, $link);
|
||||
while ($user_row=mysqli_fetch_row($user_rslt)) {
|
||||
$full_name=$user_row[0];
|
||||
}
|
||||
if (!$full_name) {$full_name="N/A";}
|
||||
$val[0]+=0;
|
||||
$val[1]+=0;
|
||||
$total_calls+=$val[0];
|
||||
$total_sales+=$val[1];
|
||||
|
||||
$shift_duration=$val[2];
|
||||
$conv_rate=sprintf("%.2f", 100*MathZDC($val[1], $val[0])); # Conversion rate
|
||||
$cph=sprintf("%.2f", (MathZDC($val[0], ($shift_duration/3600)))); # SPH - this is based on total time since start_time. Switch to $val[2] if you want it based on the individual agent's total time in the dialer.
|
||||
$sph=sprintf("%.2f", (MathZDC($val[1], ($shift_duration/3600)))); # SPH - this is based on total time since start_time. Switch to $val[2] if you want it based on the individual agent's total time in the dialer.
|
||||
$rpt_string.="$key|$full_name|$val[0]|$val[1]|$shift_duration|$conv_rate|$cph|$sph|$total_calls|$total_sales\n";
|
||||
# Agent/user group, total calls, total sales, total time, conversion rate, sales per hour
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($rpt_type=="floor_performance_hourly") {
|
||||
$rpt_string="";
|
||||
if (in_array("--ALL--", $campaigns)) {
|
||||
$campaign_id_SQL="";
|
||||
} else {
|
||||
$campaign_id_SQL=" and vicidial_agent_log.campaign_id in ('".implode("','", $campaigns)."')";
|
||||
}
|
||||
if (!$status_flags || in_array("--ALL--", $status_flags)) {
|
||||
$status_SQL="";
|
||||
} else {
|
||||
$flag_SQL="";
|
||||
for ($s=0; $s<count($status_flags); $s++) {
|
||||
$flag_SQL.=$status_flags[$s]."='Y' or ";
|
||||
}
|
||||
$flag_SQL=preg_replace('/ or $/', "", $flag_SQL);
|
||||
|
||||
$status_stmt="SELECT distinct status from vicidial_statuses where ($flag_SQL) UNION SELECT distinct status from vicidial_campaign_statuses where ($flag_SQL) $campaign_id_SQL";
|
||||
$status_rslt=mysql_to_mysqli($status_stmt, $link);
|
||||
$status_str="";
|
||||
while ($status_row=mysqli_fetch_row($status_rslt)) {
|
||||
$status_str.="'$status_row[0]',";
|
||||
}
|
||||
$status_str=preg_replace('/,$/', "", $status_str);
|
||||
$status_SQL=" and status in ($status_str) ";
|
||||
}
|
||||
|
||||
$sale_stmt="SELECT distinct status from vicidial_statuses where sale='Y' $status_SQL UNION SELECT distinct status from vicidial_campaign_statuses where sale='Y' and campaign_id in ('".implode("','", $campaigns)."') $status_SQL";
|
||||
# $rpt_string.="$sale_stmt\n";
|
||||
$sale_rslt=mysql_to_mysqli($sale_stmt, $link);
|
||||
$sale_dispos=array();
|
||||
while($sale_row=mysqli_fetch_row($sale_rslt)) {
|
||||
array_push($sale_dispos, $sale_row[0]);
|
||||
}
|
||||
|
||||
$stmt="SELECT substr(event_time+INTERVAL (pause_sec+wait_sec+talk_sec+dispo_sec) SECOND, 1, 13) as call_end_time_hour, count(*) from vicidial_agent_log where event_time>='$query_date $query_time' and event_time<='$end_date $end_time' and status in ('".implode("','", $sale_dispos)."') $campaign_id_SQL $status_SQL group by call_end_time_hour order by call_end_time_hour";
|
||||
$rpt_string.="$stmt\n";
|
||||
if ($DB) {$rpt_string.=$stmt."<BR>\n";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$cumulative_sale_counts=array();
|
||||
$total_sales=0;
|
||||
while ($row=mysqli_fetch_row($rslt)) {
|
||||
$total_sales+=$row[1];
|
||||
$cumulative_sale_counts["$row[0]"]=$total_sales;
|
||||
}
|
||||
|
||||
$start_unix=strtotime("$query_date $query_time");
|
||||
$end_unix=strtotime("$end_date $end_time");
|
||||
#if ($end_unix>=date("U")) {$end_unix=date("U");}
|
||||
$cumulative_hours_array=array();
|
||||
while($start_unix<=$end_unix) {
|
||||
$array_date=date("Y-m-d H", $start_unix);
|
||||
$cumulative_hours_array["$array_date"]=0;
|
||||
if ($cumulative_sale_counts["$array_date"]>0) {$total_sales=$cumulative_sale_counts["$array_date"];}
|
||||
|
||||
# Don't continue displaying sales beyond the current time
|
||||
if ($start_unix<=date("U")) {$cumulative_hours_array["$array_date"]=$total_sales;}
|
||||
$start_unix+=3600;
|
||||
}
|
||||
|
||||
if (count($cumulative_hours_array)==0) {
|
||||
$rpt_string="REPORT RETURNED NO RESULTS";
|
||||
} else {
|
||||
while(list($key, $val)=each($cumulative_hours_array)) {
|
||||
$rpt_string.="$key|$val\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo trim($rpt_string);
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user