From 9c8004b645ac3524de797c93ab05a7ed3e5830f0 Mon Sep 17 00:00:00 2001 From: mattf Date: Mon, 10 Feb 2020 21:19:35 +0000 Subject: [PATCH] Update to mobile app web pages Updates to email integration with Gmail git-svn-id: svn://192.168.202.10@3197 3d104415-ff17-0410-8863-d5cf3c621b8a --- agc_2-X/trunk/docs/Email_user_manual.txt | 8 +- .../vicidial/AST_rt_whiteboard_rpt_mobile.php | 48 +- agc_2-X/trunk/www/vicidial/admin_mobile.php | 116 ++- .../vicidial/agent_sales_report_mobile.php | 955 ++++++++++++++++++ .../www/vicidial/vicidial_stylesheet.php | 4 + 5 files changed, 1087 insertions(+), 44 deletions(-) create mode 100644 agc_2-X/trunk/www/vicidial/agent_sales_report_mobile.php diff --git a/agc_2-X/trunk/docs/Email_user_manual.txt b/agc_2-X/trunk/docs/Email_user_manual.txt index f8a0fb2d..edcdfd99 100644 --- a/agc_2-X/trunk/docs/Email_user_manual.txt +++ b/agc_2-X/trunk/docs/Email_user_manual.txt @@ -1,4 +1,4 @@ -EMAIL HANDLING DOC Started: 2012-12-23 Updated: 2017-04-05 +EMAIL HANDLING DOC Started: 2012-12-23 Updated: 2020-02-10 (example of how to set up an email account with Gmail is at the bottom) @@ -232,6 +232,12 @@ the database, then the email message is erased. This is a limitation of the software that "sweeps" the email account, which is why IMAP is the preferred protocol. +There are several settings within the Gmail "Settings" screen for IMAP settings +that you may need to modify to ensure that VICIdial has access to your mailbox. + +You may need to go into your Google Account "Security "settings and enable the +"Less secure app access" setting in order to use the IMAP connection for email. + NOTES: diff --git a/agc_2-X/trunk/www/vicidial/AST_rt_whiteboard_rpt_mobile.php b/agc_2-X/trunk/www/vicidial/AST_rt_whiteboard_rpt_mobile.php index f9fb80dc..0a3832f1 100644 --- a/agc_2-X/trunk/www/vicidial/AST_rt_whiteboard_rpt_mobile.php +++ b/agc_2-X/trunk/www/vicidial/AST_rt_whiteboard_rpt_mobile.php @@ -123,7 +123,7 @@ if ($sl_ct > 0) $auth=0; $reports_auth=0; $admin_auth=0; -$auth_message = user_authorization($PHP_AUTH_USER,$PHP_AUTH_PW,'REPORTS',1); +$auth_message = user_authorization($PHP_AUTH_USER,$PHP_AUTH_PW,'REPORTS',1,0); if ($auth_message == 'GOOD') {$auth=1;} @@ -581,12 +581,12 @@ $HEADER.="\n"; $MAIN.="
\n"; -$MAIN.=""._QXZ("$report_name")." $NWB#rt_whiteboard_report$NWE\n"; +# $MAIN.=""._QXZ("$report_name")." $NWB#rt_whiteboard_report$NWE\n"; $MAIN.=""; $MAIN.=""; $MAIN.="\n"; $MAIN.="\n"; $MAIN.="\n"; $MAIN.="\n"; $MAIN.=""; $MAIN.="\n"; $MAIN.=""; $MAIN.=""; $MAIN.="\n"; $MAIN.="\n"; $MAIN.="\n"; $MAIN.="\n"; -$MAIN.="\n"; $MAIN.="\n"; $MAIN.="\n"; @@ -777,7 +777,7 @@ $MAIN.=""; $MAIN.=""; $MAIN.=""; echo ""; - echo ""; + echo ""; echo ""; echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; echo ""; echo " 0) {echo " onclick=\"window.document.location='realtime_report_mobile.php?report_display_type=HTML';\"";} echo ">"; echo ""; echo ""; + echo ""; + echo " 0) {echo " onclick=\"window.document.location='realtime_report_mobile.php?report_display_type=HTML';\"";} echo ">"; + echo ""; + echo ""; + + echo " 0) {echo " onclick=\"window.document.location='realtime_report_mobile.php?report_display_type=HTML';\"";} echo ">"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo " 0) {echo " onclick=\"window.document.location='realtime_report_mobile.php?report_display_type=HTML';\"";} echo ">"; + echo ""; + echo ""; + echo ""; + echo " 0) {echo " onclick=\"window.document.location='realtime_report_mobile.php?report_display_type=HTML';\"";} echo ">"; + echo ""; + echo ""; + + echo " 0) {echo " onclick=\"window.document.location='realtime_report_mobile.php?report_display_type=HTML';\"";} echo ">"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo " 0) {echo " onclick=\"window.document.location='realtime_report_mobile.php?report_display_type=HTML';\"";} echo ">"; echo ""; echo ""; echo ""; echo "
"._QXZ("Report Type").": $NWB#rt_whiteboard_report-report_type$NWE"; -$MAIN.="\n"; $MAIN.=""; $MAIN.=""; $MAIN.=""; @@ -604,7 +604,7 @@ $MAIN.="
"._QXZ("Campaigns").": $NWB#rt_whiteboard_report-parameters$NWE
"; -$MAIN.="\n"; #if (preg_match('/\-\-ALL\-\-/',$campaign_string)) # {$MAIN.="\n";} #else @@ -630,7 +630,7 @@ $MAIN.="
"; $MAIN.=""._QXZ("Status flags").": $NWB#rt_whiteboard_report-parameters$NWE
"; -$MAIN.="\n"; $MAIN.="\n"; $MAIN.="\n"; $MAIN.="\n"; @@ -655,7 +655,7 @@ $MAIN.="
"._QXZ("In-groups").": $NWB#rt_whiteboard_report-parameters$NWE
"; -$MAIN.="\n"; if (preg_match('/\-\-ALL\-\-/',$groups_string)) {$MAIN.="\n";} else @@ -671,7 +671,7 @@ $MAIN.="\n"; $MAIN.="
"._QXZ("DIDs").": $NWB#rt_whiteboard_report-parameters$NWE
"; -$MAIN.="\n"; if (preg_match('/\-\-ALL\-\-/',$dids_string)) {$MAIN.="\n";} else @@ -689,7 +689,7 @@ $MAIN.="
"._QXZ("User Groups").": $NWB#rt_whiteboard_report-parameters$NWE
"; -$MAIN.="\n"; if (preg_match('/\-\-ALL\-\-/',$user_groups_string)) {$MAIN.="\n";} else @@ -705,7 +705,7 @@ $MAIN.="\n"; $MAIN.="
"._QXZ("Users").": $NWB#rt_whiteboard_report-parameters$NWE
"; -$MAIN.="\n"; if (preg_match('/\-\-ALL\-\-/',$users_string)) {$MAIN.="\n";} else @@ -722,10 +722,10 @@ $MAIN.="
"._QXZ("Start date/time").":"; +$MAIN.=" "._QXZ("Start date/time").": $NWB#rt_whiteboard_report-start_date$NWE"; $MAIN.="
\n"; -$MAIN.=""; - +$MAIN.=""; +/* $MAIN.="\n"; +*/ +$MAIN.="  "; -$MAIN.="   $NWB#rt_whiteboard_report-start_date$NWE"; - -$MAIN.="
"._QXZ("OR")."
"; -$MAIN.=""._QXZ("Results for the past")." "._QXZ("hours")." $NWB#rt_whiteboard_report-show_results$NWE"; +$MAIN.="

"; +$MAIN.=""._QXZ("OR Past")." "._QXZ("hours")." $NWB#rt_whiteboard_report-show_results$NWE"; $MAIN.="
"; $MAIN.=""; $MAIN.=""; -$MAIN.=""; -$MAIN.=""; +$MAIN.=""; +$MAIN.=""; $MAIN.=""; -$MAIN.=""; -$MAIN.=""; +$MAIN.=""; +$MAIN.=""; $MAIN.="
"._QXZ("Target per unit").": $NWB#rt_whiteboard_report-target_per_unit$NWE"._QXZ("Target per unit").": $NWB#rt_whiteboard_report-target_per_unit$NWE
"._QXZ("Target gross sales").": $NWB#rt_whiteboard_report-target_gross_sales$NWE"._QXZ("Target sales").": $NWB#rt_whiteboard_report-target_gross_sales$NWE
"; $MAIN.="
"; $MAIN.=_QXZ("Refresh rate").": "; -$MAIN.=""; $MAIN.=""; $MAIN.=""; $MAIN.=""; @@ -790,7 +790,7 @@ $MAIN.=""; $MAIN.=""; $MAIN.="
"; $MAIN.=_QXZ("Start date/time").": "; -$MAIN.=""; +$MAIN.=""; $MAIN.="\n"; -$MAIN.=""; +$MAIN.=""; -$MAIN.="
"._QXZ("OR")." "._QXZ("Show results for the past")." "._QXZ("hours"); +$MAIN.="
"._QXZ("OR")." "._QXZ("Show results for the past")." "._QXZ("hours"); $MAIN.="
"; diff --git a/agc_2-X/trunk/www/vicidial/admin_mobile.php b/agc_2-X/trunk/www/vicidial/admin_mobile.php index af556ac0..c2edd06a 100644 --- a/agc_2-X/trunk/www/vicidial/admin_mobile.php +++ b/agc_2-X/trunk/www/vicidial/admin_mobile.php @@ -1,14 +1,15 @@ , Joe Johnson LICENSE: AGPLv2 +# Copyright (C) 2020 Matt Florell , Joe Johnson LICENSE: AGPLv2 # # CHANGES # 190205-1702 - First Build +# 200210-1618 - Added links to more mobile-compatible reports # -$admin_version = '2.14-1a'; -$build = '190205-1702'; +$admin_version = '2.14-2a'; +$build = '200210-1618'; $startMS = microtime(); @@ -820,12 +821,14 @@ if ($ADD==999990) $stmt="SELECT extension,user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id from vicidial_live_agents $whereLOGallowed_campaignsSQL"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_to_mysqli($stmt, $link); - $agent_incall=0; $agent_total=0; + $agent_incall=0; $agent_total=0; $agent_paused=0; $agent_waiting=0; while($row=mysqli_fetch_array($rslt)) { $status=$row[3]; $agent_total++; if ( (preg_match("/INCALL/i",$status)) or (preg_match("/QUEUE/i",$status)) ) {$agent_incall++; } + if ( (preg_match("/PAUSED/i",$status))) {$agent_paused++; } + if ( (preg_match("/READY/i",$status)) or (preg_match("/CLOSER/i",$status)) ) {$agent_waiting++; } } if (preg_match("/MXAG/",$SShosted_settings)) { @@ -847,20 +850,61 @@ if ($ADD==999990) if ($LOGview_reports==1) { - echo "
\n"; + echo "
\n"; echo ""; - echo ""._QXZ("Real-Time Reports")."
\n"; + + ### Report link ### + echo "SHOW REPORTS"; + + ### Reports to show ### + echo "
\n"; + echo ""; + + echo "
\n"; echo "
\n"; } @@ -868,25 +912,48 @@ if ($ADD==999990) echo " 0) {echo " onclick=\"window.document.location='realtime_report_mobile.php?report_display_type=HTML';\"";} echo ">"; echo "
"._QXZ("Agents Logged In")."     "._QXZ("Agents In Calls")."   "._QXZ("Active Calls")."   "._QXZ("Calls Ringing")."
$agent_total$agent_incall
"._QXZ("Agents Paused")."   "._QXZ("Agents Waiting")."
$agent_paused$agent_waiting
"._QXZ("Active Calls")."   "._QXZ("Calls Ringing")."
$agent_incall$ringing_calls
"; echo "

"; + echo ""; echo "\n"; echo "
"; echo ""; # style='width: 40vw; max-width: 350px;' @@ -895,7 +962,7 @@ if ($ADD==999990) echo "

"; - + echo ""; echo "\n"; echo ""; echo ""; @@ -1175,7 +1242,7 @@ $ingroup_rslt=mysqli_query($link, $ingroup_stmt); while ($ingroup_row=mysqli_fetch_row($ingroup_rslt)) { $closer_campaigns=preg_replace('/ -$/', '', $ingroup_row[0]); - $campaign_ingroups=split(" ", $closer_campaigns); + $campaign_ingroups=explode(" ", $closer_campaigns); $ingroup_array=array_merge($ingroup_array, $campaign_ingroups); } $allowed_ingroups=array_unique($ingroup_array); @@ -1210,6 +1277,17 @@ echo $JS_text.$JS_calls; ?> +function ToggleReports() { + var link_text=document.getElementById('ReportLink').innerHTML; + if (link_text=="SHOW REPORTS") { + document.getElementById('ReportLink').innerHTML="HIDE REPORTS"; + document.getElementById('ReportStorageDiv').style="display:block"; + } else { + document.getElementById('ReportStorageDiv').style="display:none"; + document.getElementById('ReportLink').innerHTML="SHOW REPORTS"; + } +} + function LoadHourlyCharts() { if (campaign_calls_hours.length>0) { diff --git a/agc_2-X/trunk/www/vicidial/agent_sales_report_mobile.php b/agc_2-X/trunk/www/vicidial/agent_sales_report_mobile.php new file mode 100644 index 00000000..d11dcc1c --- /dev/null +++ b/agc_2-X/trunk/www/vicidial/agent_sales_report_mobile.php @@ -0,0 +1,955 @@ +\n"; +$JS_onload="onload = function() {\n"; + +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,enable_languages,language_method,report_default_format FROM system_settings;"; +$rslt=mysql_to_mysqli($stmt, $link); +if ($DB) {$HTML_text.="$stmt\n";} +$qm_conf_ct = mysqli_num_rows($rslt); +if ($qm_conf_ct > 0) + { + $row=mysqli_fetch_row($rslt); + $non_latin = $row[0]; + $outbound_autodial_active = $row[1]; + $slave_db_server = $row[2]; + $reports_use_slave_db = $row[3]; + $SSenable_languages = $row[4]; + $SSlanguage_method = $row[5]; + $SSreport_default_format = $row[6]; + } +##### END SETTINGS LOOKUP ##### +########################################### +# if (strlen($report_display_type)<2) {$report_display_type = $SSreport_default_format;} + +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,0); +if ($auth_message == 'GOOD') + {$auth=1;} + +if ($auth > 0) + { + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and user_level > 7 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_to_mysqli($stmt, $link); + $row=mysqli_fetch_row($rslt); + $admin_auth=$row[0]; + + $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and user_level > 6 and view_reports='1';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_to_mysqli($stmt, $link); + $row=mysqli_fetch_row($rslt); + $reports_auth=$row[0]; + + if ($reports_auth < 1) + { + $VDdisplayMESSAGE = _QXZ("You are not allowed to view reports"); + Header ("Content-type: text/html; charset=utf-8"); + echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n"; + exit; + } + if ( ($reports_auth > 0) and ($admin_auth < 1) ) + { + $ADD=999999; + $reports_only_user=1; + } + } +else + { + $VDdisplayMESSAGE = _QXZ("Login incorrect, please try again"); + if ($auth_message == 'LOCK') + { + $VDdisplayMESSAGE = _QXZ("Too many login attempts, try again in 15 minutes"); + Header ("Content-type: text/html; charset=utf-8"); + echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n"; + exit; + } + if ($auth_message == 'IPBLOCK') + { + $VDdisplayMESSAGE = _QXZ("Your IP Address is not allowed") . ": $ip"; + Header ("Content-type: text/html; charset=utf-8"); + echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n"; + exit; + } + Header("WWW-Authenticate: Basic realm=\"CONTACT-CENTER-ADMIN\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$PHP_AUTH_PW|$auth_message|\n"; + exit; + } + +##### BEGIN log visit to the vicidial_report_log table ##### +$LOGip = getenv("REMOTE_ADDR"); +$LOGbrowser = getenv("HTTP_USER_AGENT"); +$LOGscript_name = getenv("SCRIPT_NAME"); +$LOGserver_name = getenv("SERVER_NAME"); +$LOGserver_port = getenv("SERVER_PORT"); +$LOGrequest_uri = getenv("REQUEST_URI"); +$LOGhttp_referer = getenv("HTTP_REFERER"); +$LOGbrowser=preg_replace("/\'|\"|\\\\/","",$LOGbrowser); +$LOGrequest_uri=preg_replace("/\'|\"|\\\\/","",$LOGrequest_uri); +$LOGhttp_referer=preg_replace("/\'|\"|\\\\/","",$LOGhttp_referer); +if (preg_match("/443/i",$LOGserver_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} +if (($LOGserver_port == '80') or ($LOGserver_port == '443') ) {$LOGserver_port='';} +else {$LOGserver_port = ":$LOGserver_port";} +$LOGfull_url = "$HTTPprotocol$LOGserver_name$LOGserver_port$LOGrequest_uri"; + +$LOGhostname = php_uname('n'); +if (strlen($LOGhostname)<1) {$LOGhostname='X';} +if (strlen($LOGserver_name)<1) {$LOGserver_name='X';} + +$stmt="SELECT webserver_id FROM vicidial_webservers where webserver='$LOGserver_name' and hostname='$LOGhostname' LIMIT 1;"; +$rslt=mysql_to_mysqli($stmt, $link); +if ($DB) {echo "$stmt\n";} +$webserver_id_ct = mysqli_num_rows($rslt); +if ($webserver_id_ct > 0) + { + $row=mysqli_fetch_row($rslt); + $webserver_id = $row[0]; + } +else + { + ##### insert webserver entry + $stmt="INSERT INTO vicidial_webservers (webserver,hostname) values('$LOGserver_name','$LOGhostname');"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_to_mysqli($stmt, $link); + $affected_rows = mysqli_affected_rows($link); + $webserver_id = mysqli_insert_id($link); + } + +$stmt="INSERT INTO vicidial_report_log set event_date=NOW(), user='$PHP_AUTH_USER', ip_address='$LOGip', report_name='$report_name', browser='$LOGbrowser', referer='$LOGhttp_referer', notes='$LOGserver_name:$LOGserver_port $LOGscript_name |$group[0], $query_date, $end_date, $shift, $file_download, $report_display_type|', url='$LOGfull_url', webserver='$webserver_id';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_to_mysqli($stmt, $link); +$report_log_id = mysqli_insert_id($link); +##### END log visit to the vicidial_report_log table ##### + +if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) + { + mysqli_close($link); + $use_slave_server=1; + $db_source = 'S'; + require("dbconnect_mysqli.php"); + $HTML_text.="\n"; + } + +$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER';"; +if ($DB) {$HTML_text.="|$stmt|\n";} +$rslt=mysql_to_mysqli($stmt, $link); +$row=mysqli_fetch_row($rslt); +$LOGuser_group = $row[0]; + +$stmt="SELECT allowed_campaigns,allowed_reports,admin_viewable_groups,admin_viewable_call_times from vicidial_user_groups where user_group='$LOGuser_group';"; +if ($DB) {$HTML_text.="|$stmt|\n";} +$rslt=mysql_to_mysqli($stmt, $link); +$row=mysqli_fetch_row($rslt); +$LOGallowed_campaigns = $row[0]; +$LOGallowed_reports = $row[1]; +$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 "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n"; + exit; + } + +$LOGallowed_campaignsSQL=''; +$whereLOGallowed_campaignsSQL=''; +if ( (!preg_match('/\-ALL/i', $LOGallowed_campaigns)) ) + { + $rawLOGallowed_campaignsSQL = preg_replace("/ -/",'',$LOGallowed_campaigns); + $rawLOGallowed_campaignsSQL = preg_replace("/ /","','",$rawLOGallowed_campaignsSQL); + $LOGallowed_campaignsSQL = "and campaign_id IN('$rawLOGallowed_campaignsSQL')"; + $whereLOGallowed_campaignsSQL = "where campaign_id IN('$rawLOGallowed_campaignsSQL')"; + } +$regexLOGallowed_campaigns = " $LOGallowed_campaigns "; + +$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')"; + } + +###################################### + +$MT[0]=''; +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = array();} +if (!isset($user_group)) {$group = array();} +if (!isset($query_date_D)) {$query_date_D=$NOW_DATE;} +if (!isset($query_date_T)) {$query_date_T="00:00:00";} +if (!isset($refresh_rate)) {$refresh_rate="1000000";} +if (!isset($graph_type)) {$graph_type = "sale_graph";} +if (!isset($top_agents)) {$top_agents=10;} +if (!isset($sort_by)) {$sort_by="sales";} + +$query_date="$query_date_D $query_date_T"; +$end_date="$end_date_D $end_date_T"; + +$i=0; +$group_string='|'; +$group_ct = count($group); +while($i < $group_ct) + { + $group_string .= "$group[$i]|"; + $i++; + } + +$stmt="select campaign_id from vicidial_campaigns $whereLOGallowed_campaignsSQL order by campaign_id;"; +$rslt=mysql_to_mysqli($stmt, $link); +if ($DB) {$HTML_text.="$stmt\n";} +$campaigns_to_print = mysqli_num_rows($rslt); +$i=0; +while ($i < $campaigns_to_print) + { + $row=mysqli_fetch_row($rslt); + $groups[$i] =$row[0]; + if (preg_match('/\-ALL/',$group_string) ) + {$group[$i] = $groups[$i];} + $i++; + } + +####################################### +for ($i=0; $i $key, 'calls' => ($val[0]+0), 'sales' => ($val[1]+0), 'conv' => (round(1000*$val[1]/$val[0])/10)); + } + + foreach ($new_sales_ary as $key2 => $row2) { + $agent_ary[$key2] = $row2['agent']; + $calls_ary[$key2] = $row2['calls']; + $sales_ary[$key2] = $row2['sales']; + $conv_ary[$key2] = $row2['conv']; + + $gtotals_array['calls']+=$row2['calls']; + $gtotals_array['sales']+=$row2['sales']; + } + + // Sort the data with volume descending, edition ascending + // Add $data as the last parameter, to sort by the common key + if (($sort_by=="conversions" && $report_display_type=="TABLE") || ($graph_type=="conversion_graph" && $report_display_type=="GRAPH")) { + array_multisort($conv_ary, SORT_DESC, $sales_ary, SORT_DESC, $calls_ary, SORT_DESC, $agent_ary, SORT_ASC, $new_sales_ary); + } else if (($sort_by=="calls" && $report_display_type=="TABLE") || ($graph_type=="call_graph" && $report_display_type=="GRAPH")) { + array_multisort($calls_ary, SORT_DESC, $sales_ary, SORT_DESC, $conv_ary, SORT_DESC, $agent_ary, SORT_ASC, $new_sales_ary); + } else { + array_multisort($sales_ary, SORT_DESC, $conv_ary, SORT_DESC, $calls_ary, SORT_DESC, $agent_ary, SORT_ASC, $new_sales_ary); + } + + $AGENTSjs='var AGENTS=['; + $CALLSjs='var CALLS=['; + $SALESjs='var SALES=['; + $CONVERSION_RATEjs='var CONVERSION_RATE=['; + $j=0; + foreach ($new_sales_ary as $row) { + if ($j<$top_agents) { + $agent_str.=$row['agent']."|"; + $calls_str.=$row['calls']."|"; + $sales_str.=$row['sales']."|"; + $conv_str.=$row['conv']."|"; + + $AGENTSjs .= "'".$row['agent']."',"; + $CALLSjs .= "'".$row['calls']."',"; + $SALESjs .= "'".$row['sales']."',"; + $CONVERSION_RATEjs .= "'".$row['conv']."',"; + $j++; + } + } + $agent_str=preg_replace('/\|$/', "", $agent_str); + $calls_str=preg_replace('/\|$/', "", $calls_str); + $sales_str=preg_replace('/\|$/', "", $sales_str); + $conv_str=preg_replace('/\|$/', "", $conv_str); + + $AGENTSjs=preg_replace('/,$/', "", $AGENTSjs); + $CALLSjs=preg_replace('/,$/', "", $CALLSjs); + $SALESjs=preg_replace('/,$/', "", $SALESjs); + $CONVERSION_RATEjs=preg_replace('/,$/', "", $CONVERSION_RATEjs); + + $AGENTSjs.="];\n"; + $CALLSjs.="];\n"; + $SALESjs.="];\n"; + $CONVERSION_RATEjs.="];\n"; + $JS_arrays=$AGENTSjs.$CALLSjs.$SALESjs.$CONVERSION_RATEjs; + + if ($SUBMIT==_QXZ("REFRESH")) { + echo $agent_str."\n".$calls_str."\n".$sales_str."\n".$conv_str; + exit; + } +} + +###################################### +if ($DB) {$HTML_text.="$user_group_string|$user_group_ct|$user_groupQS|$i
";} + +require("screen_colors.php"); + +# $NWB = "   \"HELP\""; + +$NWB = "\"HELP\""; + +$HTML_head="\n"; +$HTML_head.="\n"; +if ($report_display_type=="TABLE") { + $HTML_head.=""; +} +$HTML_head.="\n"; + +$HTML_head.="\n"; +$HTML_head.="\n"; +$HTML_head.=""; + +$HTML_head.="\n"; +$HTML_head.="\n"; +$HTML_head.="\n"; +require("chart_button.php"); +$HTML_head.="\n"; +$HTML_head.="\n"; + +$HTML_head.="\n"; +$HTML_head.=""._QXZ("$report_name")."$group_S\n"; + +$HTML_text.="
"._QXZ("System Summary").":
"; +# $HTML_text.=""._QXZ("$report_name")." $NWB#team_performance_detail$NWE\n"; + +$HTML_text.="\n"; +$HTML_text.="\n"; + +$HTML_text.="\n"; + +$HTML_text.="\n"; +$HTML_text.="\n"; + +$HTML_text.="\n"; + +$HTML_text.=""; + +$HTML_text.=""; +$HTML_text.="\n"; +$HTML_text.="\n"; +$HTML_text.=""; + +$HTML_text.=""; +$HTML_text.=""; + +$HTML_text.="
"._QXZ("Campaigns").":
"; +$HTML_text.="
"._QXZ("Teams/User Groups").":
"; +$HTML_text.="
\n"; +$HTML_text.=_QXZ("Start date/time").":
"; +$HTML_text.=" "; +/* +$HTML_text.="\n"; +*/ +$HTML_text.=""; + +# $HTML_text.=" "._QXZ("OR")." "._QXZ("within the past")." "._QXZ("hours"); + +$HTML_text.="
"; +$HTML_text.=_QXZ("Refresh rate").":
"; +$HTML_text.=""; +$HTML_text.="
"; +$HTML_text.=_QXZ("Show results as").":
"; +$HTML_text.="
"; +$HTML_text.=_QXZ("Top agents to display").":
"; +$HTML_text.=""; +$HTML_text.="
"; +$HTML_text.="\n"; +$HTML_text.="
\n"; +$HTML_text.="\n"; + +$HTML_text.=""; + +$HTML_text.="
"; + +if ($report_display_type=="TABLE") { + $HTML_text="
"; + $HTML_text.="\n"; + $HTML_text.="\n"; + $HTML_text.="\n"; + $HTML_text.="\n"; + $HTML_text.="\n"; + $HTML_text.=""; + + $i=0; + foreach ($new_sales_ary as $row) { + if ($i%2==0) {$bgcolor=$SSstd_row2_background;} else {$bgcolor=$SSstd_row3_background;} + + if ($i<$top_agents) { + $HTML_text.="\n"; + $HTML_text.="\n"; + $HTML_text.="\n"; + $HTML_text.="\n"; + $HTML_text.="\n"; + $HTML_text.=""; + $i++; + } + } + + $HTML_text.="\n"; + $HTML_text.="\n"; + $HTML_text.="\n"; + $HTML_text.="\n"; + $HTML_text.="\n"; + $HTML_text.=""; + $HTML_text.="\n"; + $HTML_text.="
AGENT NAMECALLSSALESCONV %
".$row['agent']."".$row['calls']."".$row['sales']."".$row['conv']."%
TOTALS:".$gtotals_array['calls']."".$gtotals_array['sales'].""; + if ($gtotals_array['calls']>0) {$HTML_text.=(round(1000*$gtotals_array['sales']/$gtotals_array['calls'])/10)."%";} else {$HTML_text.="0.0%";} + $HTML_text.="
"; + $HTML_text.="
"; +} else if ($report_display_type=="GRAPH") { + $HTML_text="
"; + $HTML_text.="\n"; + $HTML_text.=""; + $HTML_text.=""; + $HTML_text.=""; + $HTML_text.=""; + $HTML_text.=""; + $HTML_text.="\n"; + $HTML_text.=""; + $HTML_text.="\n"; + $HTML_text.="
CALLSSALESCONVERSION
"; + $HTML_text.="
"; + $HTML_text.="
"; + $HTML_text.="
"; +} + + +$HTML_text.="\n"; +$HTML_text.="\n"; + + +header("Content-type: text/html; charset=utf-8"); +$JS_text.="\n"; + + +$HTML_text.=$GRAPH_text; +# $HTML_text.=$JS_text; + + + +echo $HTML_head; +$android_header=1; +require("admin_header.php"); +echo $HTML_text; +if ($report_display_type=="GRAPH") { +?> + + + + \ No newline at end of file diff --git a/agc_2-X/trunk/www/vicidial/vicidial_stylesheet.php b/agc_2-X/trunk/www/vicidial/vicidial_stylesheet.php index 8b63a9fe..bd56134c 100644 --- a/agc_2-X/trunk/www/vicidial/vicidial_stylesheet.php +++ b/agc_2-X/trunk/www/vicidial/vicidial_stylesheet.php @@ -468,6 +468,10 @@ TD.bsides { border-left:1pt solid black; border-right:1pt solid black; } +TD.text_overflow { + text-overflow: ellipis; + overflow: hidden; +} /* DIV ELEMENTS */ div.shadowbox