Added Non-Agent API call_dispo_report function

Added URL columns to API Log Report
Added Time to/from to Agent Performancce Detail report

git-svn-id: svn://192.168.202.10@2906 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2018-02-08 22:34:57 +00:00
parent 5260a15ac4
commit 153111a401
4 changed files with 591 additions and 41 deletions
+57 -1
View File
@@ -1,4 +1,4 @@
NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2018-01-09
NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2018-02-08
This document describes the functions of an API(Application Programming
Interface) for all functions NOT directly relating to the VICIDIAL Agent screen.
@@ -45,6 +45,7 @@ phone_number_log - exports list of calls placed to one of more phone numbers
ccc_lead_info - outputs lead data for cross-cluster-communication call
lead_status_search - displays all field values of all leads that match the status and call date in request
call_status_stats - report on number of calls made by campaign and ingroup, with hourly and status breakdowns
call_dispo_report - call disposition breakdown report
New scripts:
/vicidial/non_agent_api.php - the script that is accessed to execute commands
@@ -132,6 +133,7 @@ Changes:
170615-0006 - Added DIAL status for manual dial agent calls that have not been answered, to 4 functions
171229-1602 - Added lead_status_search function
180109-1313 - Added call_status_stats function
180208-1655 - Added call_dispo_report function
API Functions use the 'function' variable
@@ -1528,6 +1530,60 @@ AGENTDIRECT|2|2|00-0,01-0,02-0,03-0,04-0,05-0,06-0,07-0,08-0,09-0,10-0,11-1,12-1
--------------------------------------------------------------------------------
call_dispo_report - call disposition breakdown report
NOTE: api user for this function must have user_level set to 9 and "view reports" enabled
REQUIRED FIELDS(one of the following)-
campaigns - Campaigns to return stats on. Use single dash delimiters if requesting more than one specific campaign
ingroups - In-Groups to return stats on. Use single dash delimiters if requesting more than one specific inbound group
dids - DIDs to return stats on. Use single dash delimiters if requesting more than one specific DID
OPTIONAL FIELDS-
query_date - Date to report on, leave blank to default to today's date. Must be in YYYY-MM-DD format
end_date - Date to report on, leave blank to default to today's date. Must be in YYYY-MM-DD format
statuses - List of specific statuses to report on. Leave blank for all, or use dash delimiters if requesting more than one status.
categories - List of specific status categories to report on. Leave blank for all, or use dash delimiters if requesting more than one category.
users - List of specific users to report on. Use single dash delimiters if requesting more than one specific user
status_breakdown - [0,1] Breakdown of all statuses within selected elements, default 0
show_percentages - [0,1] (Only works if status_breakdown above is enabled), will show percentages of statuses, default 0
file_download - [0,1] Download as a CSV file, default 0
Example URL strings for API calls:
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=call_dispo_report&ingroups=TEST_IN3-TEST_IN2&query_date=2018-02-05&end_date=2018-02-07
http://svn.eflo.net:40080/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=call_dispo_report&ingroups=TEST_IN3-TEST_IN2&query_date=2018-02-05&end_date=2018-02-07&status_breakdown=1
http://svn.eflo.net:40080/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=call_dispo_report&did_patterns=7275551113&query_date=2018-02-05&end_date=2018-02-07&status_breakdown=1
http://svn.eflo.net:40080/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=call_dispo_report&ingroups=TEST_IN3-TEST_IN2&query_date=2018-02-05&end_date=2018-02-07&status_breakdown=1&show_percentages=1
Example responses:
ERROR: call_dispo_report INVALID OR MISSING CAMPAIGNS, INGROUPS, OR DIDS
ERROR: call_dispo_report USER DOES NOT HAVE PERMISSION TO USE THIS FUNCTION
ERROR: call_dispo_report USER DOES NOT HAVE PERMISSION TO VIEW STATS
A SUCCESS response will not show "SUCCESS", but instead will just print the results in the following format:
CAMPAIGN,TOTAL CALLS
TEST_IN2,10
TEST_IN3,110
TOTAL,120
CAMPAIGN,TOTAL CALLS,ACFLTR,NP,WAITTO,CLOSOP,DROP,INCALL,RQXFER,TD,TESTAM
TEST_IN2,10,1,0,0,0,5,0,0,0,4
TEST_IN3,110,0,5,13,9,3,1,47,1,31
TOTAL,120,1,5,13,9,8,1,47,1,35
CAMPAIGN,TOTAL CALLS,ACFLTR,NP,WAITTO,CLOSOP,DROP,INCALL,RQXFER,TD,TESTAM
TEST_IN2,10,1 (10.0%),0 (0.0%),0 (0.0%),0 (0.0%),5 (50.0%),0 (0.0%),0 (0.0%),0 (0.0%),4 (40.0%)
TEST_IN3,110,0 (0.0%),5 (4.5%),13 (11.8%),9 (8.2%),3 (2.7%),1 (0.9%),47 (42.7%),1 (0.9%),31 (28.2%)
TOTAL,120,1 (0.8%),5 (4.2%),13 (10.8%),9 (7.5%),8 (6.7%),1 (0.8%),47 (39.2%),1 (0.8%),35 (29.2%)
--------------------------------------------------------------------------------
update_campaign - updates campaign information in the vicidial_campaigns table
+108 -30
View File
@@ -3,7 +3,7 @@
#
# This report is for viewing the a report of API activity to the vicidial_api_log table
#
# Copyright (C) 2017 Joe Johnson, Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2018 Joe Johnson, Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
#
@@ -12,6 +12,7 @@
# 170210-0700 - Reworked Show URLs code to be faster
# 170409-1553 - Added IP List validation code
# 170823-2241 - Added HTML formatting and screen colors, fixed CSV output bug
# 180206-2300 - Added option for displaying individual URL variables
#
$startMS = microtime();
@@ -67,9 +68,9 @@ if (!isset($api_date_end_T)) {$api_date_end_T="23:59:59";}
if (!isset($order_by)) {$order_by="api_date";}
$api_date_from="$api_date_D $api_date_T";
$api_date_to="$api_date_end_D $api_date_end_T";
$CSV_text="\"API ACCESS LOG REPORT\"\n";
$CSV_text.="\"API DATE RANGE:\",\"$api_date_from to $api_date_to\"\n";
$ASCII_rpt_header="API DATE RANGE: $api_date_from to $api_date_to\n";
$CSV_text="\""._QXZ("API ACCESS LOG REPORT")."\"\n";
$CSV_text.="\""._QXZ("API DATE RANGE").":\",\"$api_date_from to $api_date_to\"\n";
$ASCII_rpt_header=_QXZ("API DATE RANGE").": $api_date_from to $api_date_to\n";
#if (!isset($recording_date_D)) {$recording_date_D=$NOW_DATE;}
@@ -370,9 +371,9 @@ if ( (preg_match('/\-\-ALL\-\-/',$user_string) ) or ($user_ct < 1) )
{$vu_user_SQL = ""; $vra_user_SQL = ""; $user_SQL="";}
else
{
$ASCII_rpt_header.="USERS: ".implode(", ", $users)."\n";
$CSV_text.="\"USERS:\",\"".implode(", ", $users)."\"\n";
$GRAPH_header.="<th class='column_header grey_graph_cell'>SELECTED USERS</th>";
$ASCII_rpt_header.=_QXZ("USERS").": ".implode(", ", $users)."\n";
$CSV_text.="\""._QXZ("USERS").":\",\"".implode(", ", $users)."\"\n";
$GRAPH_header.="<th class='column_header grey_graph_cell'>"._QXZ("SELECTED USERS")."</th>";
}
$i=0;
@@ -390,9 +391,9 @@ if ( (preg_match('/\-\-ALL\-\-/',$agent_user_string) ) or ($agent_user_ct < 1) )
{$vu_agent_user_SQL = ""; $vra_agent_user_SQL = ""; $agent_user_SQL="";}
else
{
$ASCII_rpt_header.="AGENT USERS: ".implode(", ", $agent_users)."\n";
$CSV_text.="\"AGENT USERS:\",\"".implode(", ", $agent_users)."\"\n";
$GRAPH_header.="<th class='column_header grey_graph_cell'>SELECTED AGENTS</th>";
$ASCII_rpt_header.=_QXZ("AGENT USERS").": ".implode(", ", $agent_users)."\n";
$CSV_text.="\""._QXZ("AGENT USERS").":\",\"".implode(", ", $agent_users)."\"\n";
$GRAPH_header.="<th class='column_header grey_graph_cell'>"._QXZ("SELECTED AGENTS")."</th>";
}
$i=0;
@@ -410,9 +411,9 @@ if ( (preg_match('/\-\-ALL\-\-/',$function_string) ) or ($function_ct < 1) )
{$vu_function_SQL = ""; $vra_function_SQL = ""; $function_SQL="";}
else
{
$ASCII_rpt_header.="FUNCTIONS: ".implode(", ", $functions)."\n";
$CSV_text.="\"FUNCTIONS:\",\"".implode(", ", $functions)."\"\n";
$GRAPH_header.="<th class='column_header grey_graph_cell'>SELECTED FUNCTIONS</th>";
$ASCII_rpt_header.=_QXZ("FUNCTIONS").": ".implode(", ", $functions)."\n";
$CSV_text.="\""._QXZ("FUNCTIONS").":\",\"".implode(", ", $functions)."\"\n";
$GRAPH_header.="<th class='column_header grey_graph_cell'>"._QXZ("SELECTED FUNCTIONS")."</th>";
}
@@ -431,9 +432,9 @@ if ( (preg_match('/\-\-ALL\-\-/',$result_string) ) or ($result_ct < 1) )
{$vu_result_SQL = ""; $vra_result_SQL = ""; $result_SQL="";}
else
{
$ASCII_rpt_header.="RESULTS: ".implode(", ", $results)."\n";
$CSV_text.="\"RESULTS:\",\"".implode(", ", $results)."\"\n";
$GRAPH_header.="<th class='column_header grey_graph_cell'>SELECTED RESULTS</th>";
$ASCII_rpt_header.=_QXZ("RESULTS").": ".implode(", ", $results)."\n";
$CSV_text.="\""._QXZ("RESULTS").":\",\"".implode(", ", $results)."\"\n";
$GRAPH_header.="<th class='column_header grey_graph_cell'>"._QXZ("SELECTED RESULTS")."</th>";
}
/*
@@ -556,6 +557,10 @@ $HTML_head.="<script language=\"JavaScript\" src=\"calendar_db.js\"></script>\n"
$HTML_head.="<link rel=\"stylesheet\" href=\"calendar.css\">\n";
$HTML_head.="<link rel=\"stylesheet\" href=\"horizontalbargraph.css\">\n";
$HTML_text.="<script language=\"JavaScript\">\n";
$HTML_text.="function openNewWindow(url)\n";
$HTML_text.=" {\n";
$HTML_text.=" window.open (url,\"\",'width=620,height=300,scrollbars=yes,menubar=yes,address=yes');\n";
$HTML_text.=" }\n";
$HTML_text.="function ToggleSpan(spanID) {\n";
$HTML_text.=" if (document.getElementById(spanID).style.display == 'none') {\n";
$HTML_text.=" document.getElementById(spanID).style.display = 'block';\n";
@@ -572,6 +577,7 @@ $HTML_head.="<TITLE>"._QXZ("$report_name")."</TITLE></HEAD><BODY BGCOLOR=WHITE m
# require("admin_header.php");
$HTML_text.="<B>$report_name</B> $NWB#api_log_report$NWE<BR>";
$HTML_text.="<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
$HTML_text.="<FORM ACTION=\"$PHP_SELF\" METHOD=GET name=vicidial_report id=vicidial_report>\n";
@@ -693,20 +699,38 @@ if ($SUBMIT && $api_date_D && $api_date_T && $api_date_end_D && $api_date_end_T)
$ASCII_border="+---------------------+--------------------------------+------------+----------------------+--------------------------------+------------+----------------------+----------+-----------+-----------+\n";
if ($show_urls)
{
$ASCII_border="+---------------------+--------------------------------+------------+----------------------+--------------------------------+------------+----------------------+----------+-----------+-----------+----------------------+----------\n";
$URL_header=" REMOTE IP | URL";
$ASCII_border="+---------------------+--------------------------------+------------+----------------------+--------------------------------+------------+----------------------+----------+-----------+-----------+";
$container_id='API_LOG_URL_COLUMNS';
$container_stmt="select container_entry from vicidial_settings_containers where container_id='$container_id'";
$container_rslt=mysql_to_mysqli($container_stmt, $link);
if (mysqli_num_rows($container_rslt)>0)
{
$container_row=mysqli_fetch_row($container_rslt);
$url_vars=explode("\r\n", $container_row[0]);
$URL_header="";
for($u=0; $u<count($url_vars); $u++)
{
$URL_header.=sprintf("%-20s", $url_vars[$u])." | ";
$ASCII_border.="----------------------+";
}
}
$URL_header.=" "._QXZ("REMOTE IP", 19)." | "._QXZ("URL");
$ASCII_border.="----------------------+----------\n";
}
$TEXT.=$ASCII_rpt_header;
$TEXT.=sprintf("%110s", " ");
$TEXT.="<a href=\"$PHP_SELF?api_date_D=$api_date_D&api_date_T=$api_date_T&api_date_end_D=$api_date_end_D&api_date_end_T=$api_date_end_T$resultQS$functionQS$agent_userQS$userQS&file_download=1&show_urls=$show_urls&search_archived_data=$search_archived_data&SUBMIT=$SUBMIT\">"._QXZ("DOWNLOAD")."</a>\n";
$TEXT.=$ASCII_border;
$TEXT.="| <a href='$LINKbase&order_by=api_date'>API DATE</a> | <a href='$LINKbase&order_by=user'>USER</a> | <a href='$LINKbase&order_by=api_script'>API SCRIPT</a> | <a href='$LINKbase&order_by=function'>FUNCTION</a> | <a href='$LINKbase&order_by=agent_user'>AGENT USER</a> | <a href='$LINKbase&order_by=result'>RESULT</a> | <a href='$LINKbase&order_by=source'>SOURCE</a> | <a href='$LINKbase&order_by=run_time'>RUN TIME</a> | <a href='$LINKbase&order_by=webserver'>WEBSERVER</a> | <a href='$LINKbase&order_by=api_url'>API URL</a> |$URL_header\n";
$TEXT.="| <a href='$LINKbase&order_by=api_date'>"._QXZ("API DATE", 19)."</a> | <a href='$LINKbase&order_by=user'>"._QXZ("USER", 30)."</a> | <a href='$LINKbase&order_by=api_script'>"._QXZ("API SCRIPT", 10)."</a> | <a href='$LINKbase&order_by=function'>"._QXZ("FUNCTION", 20)."</a> | <a href='$LINKbase&order_by=agent_user'>"._QXZ("AGENT USER", 30)."</a> | <a href='$LINKbase&order_by=result'>"._QXZ("RESULT", 10)."</a> | <a href='$LINKbase&order_by=source'>"._QXZ("SOURCE", 20)."</a> | <a href='$LINKbase&order_by=run_time'>"._QXZ("RUN TIME", 8)."</a> | <a href='$LINKbase&order_by=webserver'>"._QXZ("WEBSERVER", 9)."</a> | <a href='$LINKbase&order_by=api_url'>"._QXZ("API URL", 9)."</a> | $URL_header\n";
$TEXT.=$ASCII_border;
$HTML.="<BR><table border='0' cellpadding='3' cellspacing='1'>";
$HTML.="<tr bgcolor='#".$SSstd_row1_background."'>";
$HTML.="<th colspan='".($show_urls ? "11" : "9")."'><font size='2'>$ASCII_rpt_header</font></th>";
$HTML.="<th colspan='".($show_urls ? (11+count($url_vars)) : "9")."'><font size='2'>$ASCII_rpt_header</font></th>";
$HTML.="<th><font size='2'><a href=\"$PHP_SELF?api_date_D=$api_date_D&api_date_T=$api_date_T&api_date_end_D=$api_date_end_D&api_date_end_T=$api_date_end_T$resultQS$functionQS$agent_userQS$userQS&file_download=1&show_urls=$show_urls&search_archived_data=$search_archived_data&SUBMIT=$SUBMIT\">"._QXZ("DOWNLOAD")."</a></font></th>";
$HTML.="</tr>\n";
$HTML.="<tr bgcolor='#".$SSstd_row1_background."'>";
@@ -724,13 +748,21 @@ if ($SUBMIT && $api_date_D && $api_date_T && $api_date_end_D && $api_date_end_T)
if ($show_urls)
{
$CSV_text.="\n\"API DATE\",\"USER\",\"API SCRIPT\",\"FUNCTION\",\"AGENT USER\",\"VALUE\",\"RESULT\",\"RESULT REASON\",\"SOURCE\",\"DATA\",\"RUN TIME\",\"WEBSERVER\",\"API URL\",\"REMOTE IP\",\"FULL URL STRING\"\n";
$CSV_text.="\n\""._QXZ("API DATE")."\",\""._QXZ("USER")."\",\""._QXZ("API SCRIPT")."\",\""._QXZ("FUNCTION")."\",\""._QXZ("AGENT USER")."\",\""._QXZ("VALUE")."\",\""._QXZ("RESULT")."\",\""._QXZ("RESULT REASON")."\",\""._QXZ("SOURCE")."\",\""._QXZ("DATA")."\",\""._QXZ("RUN TIME")."\",\""._QXZ("WEBSERVER")."\",\""._QXZ("API URL")."\"";
for($u=0; $u<count($url_vars); $u++)
{
$CSV_text.=",\"".$url_vars[$u]."\"";
$HTML.="<th><font size='2'>"._QXZ("$url_vars[$u]")."</font></th>";
}
$CSV_text.=",\""._QXZ("REMOTE IP")."\",\""._QXZ("FULL URL STRING")."\"\n";
$HTML.="<th><font size='2'>"._QXZ("REMOTE IP")."</font></th>";
$HTML.="<th><font size='2'>"._QXZ("FULL URL STRING")."</font></th>";
}
else
{
$CSV_text.="\n\"API DATE\",\"USER\",\"API SCRIPT\",\"FUNCTION\",\"AGENT USER\",\"VALUE\",\"RESULT\",\"RESULT REASON\",\"SOURCE\",\"DATA\",\"RUN TIME\",\"WEBSERVER\",\"API URL\"\n";
$CSV_text.="\n\""._QXZ("API DATE")."\",\""._QXZ("USER")."\",\""._QXZ("API SCRIPT")."\",\""._QXZ("FUNCTION")."\",\""._QXZ("AGENT USER")."\",\""._QXZ("VALUE")."\",\""._QXZ("RESULT")."\",\""._QXZ("RESULT REASON")."\",\""._QXZ("SOURCE")."\",\""._QXZ("DATA")."\",\""._QXZ("RUN TIME")."\",\""._QXZ("WEBSERVER")."\",\""._QXZ("API URL")."\"\n";
}
$HTML.="</tr>\n";
@@ -788,16 +820,62 @@ if ($SUBMIT && $api_date_D && $api_date_T && $api_date_end_D && $api_date_end_T)
$stmt="select remote_ip,url from $vicidial_api_urls_table where api_id='$api_id[$h]';";
if ($DB) {print $stmt."\n";}
$rslt=mysql_to_mysqli($stmt, $link);
while ($row=mysqli_fetch_array($rslt))
if (mysqli_num_rows($rslt)>0)
{
$full_url = $row["url"];
$remote_ip = $row["remote_ip"];
if ( ($VUmodify_same_user_level < 1) or ($VUuser_level < 9) or ($VUmodify_users < 1) )
{$full_url = preg_replace("/&pass=[\s\S]+?&/",'&pass=XXXX&',$full_url);}
$TEXT.=sprintf("%-20s", $row["remote_ip"])." | ";
$TEXT.=sprintf("%-2000s", $full_url)." | ";
while ($row=mysqli_fetch_array($rslt))
{
$full_url = $row["url"];
$remote_ip = $row["remote_ip"];
$key_array=array();
$val_array=array();
$CSV_vals="";
$url_ary=preg_split("/\?/", $full_url);
for($u=2; $u<count($url_ary); $u++)
{
$url_ary[1].="?".$url_ary[$u];
}
$var_ary=preg_split("/\&/", $url_ary[1]);
for ($v=0; $v<count($var_ary); $v++)
{
$keyval_pair=preg_split("/\=/", $var_ary[$v]);
array_push($key_array, strtolower($keyval_pair[0]));
array_push($val_array, substr(urldecode($keyval_pair[1]), 0, 20));
}
for ($v=0; $v<count($url_vars); $v++)
{
$val="";
$key=array_search(strtolower($url_vars[$v]), $key_array, false);
if($key) {$val=$val_array[$key];}
$TEXT.=sprintf("%-20s", substr($val, 0, 20))." | ";
$CSV_vals.=",\"$val\"";
$HTML.="<th><font size='2'>".($val=="" ? "&nbsp;" : $val)."</font></th>";
}
if ( ($VUmodify_same_user_level < 1) or ($VUuser_level < 9) or ($VUmodify_users < 1) )
{$full_url = preg_replace("/&pass=[\s\S]+?&/",'&pass=XXXX&',$full_url);}
$TEXT.=sprintf("%-20s", $row["remote_ip"])." | ";
$TEXT.=sprintf("%-2000s", $full_url)." | ";
}
}
else
{
$CSV_vals="";
for ($v=0; $v<count($url_vars); $v++)
{
$val="";
$TEXT.=sprintf("%-20s", $val)." | ";
$CSV_vals.=",\"$val\"";
$HTML.="<th><font size='2'>".($val=="" ? "&nbsp;" : $val)."</font></th>";
}
$TEXT.=sprintf("%-20s", "")." | ";
$TEXT.=sprintf("%-2000s", "")." | ";
}
$CSV_text.="\"$api_date[$h]\",\"$full_user[$h]\",\"$api_script[$h]\",\"$function[$h]\",\"$full_agent_user[$h]\",\"$value[$h]\",\"$result[$h]\",\"$result_reason[$h]\",\"$source[$h]\",\"$data[$h]\",\"$run_time[$h]\",\"$webserver[$h]\",\"$api_url[$h]\",\"$remote_ip\",\"$full_url\"\n";
$CSV_text.="\"$api_date[$h]\",\"$full_user[$h]\",\"$api_script[$h]\",\"$function[$h]\",\"$full_agent_user[$h]\",\"$value[$h]\",\"$result[$h]\",\"$result_reason[$h]\",\"$source[$h]\",\"$data[$h]\",\"$run_time[$h]\",\"$webserver[$h]\",\"$api_url[$h]\"$CSV_vals";
$CSV_text.=",\"$remote_ip\",\"$full_url\"\n";
$HTML.="<th><font size='2'>".($remote_ip=="" ? "&nbsp;" : $remote_ip)."</font></th>";
$HTML.="<th><font size='2'>".($full_url=="" ? "&nbsp;" : $full_url)."</font></th>";
}
@@ -1,7 +1,7 @@
<?php
# AST_agent_performance_detail.php
#
# Copyright (C) 2017 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2018 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
#
@@ -61,6 +61,7 @@
# 170409-1547 - Added IP List validation code
# 170829-0040 - Added screen color settings
# 171012-2015 - Fixed javascript/apache errors with graphs
# 180208-1724 - Added times to/from
#
$startMS = microtime();
@@ -75,6 +76,10 @@ 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["group"])) {$group=$_GET["group"];}
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
if (isset($_GET["user_group"])) {$user_group=$_GET["user_group"];}
@@ -108,7 +113,7 @@ if (isset($_GET["search_archived_data"])) {$search_archived_data=$_GET["search
if (isset($_GET["show_defunct_users"])) {$show_defunct_users=$_GET["show_defunct_users"];}
elseif (isset($_POST["show_defunct_users"])) {$show_defunct_users=$_POST["show_defunct_users"];}
if (strlen($shift)<2) {$shift='ALL';}
if (strlen($shift)<2) {$shift='--';}
if ($search_archived_data=="checked") {$agent_log_table="vicidial_agent_log_archive";} else {$agent_log_table="vicidial_agent_log";}
$TIME_HF_agentperfdetail = 'HF';
@@ -351,6 +356,8 @@ if (!isset($user_group)) {$user_group = array();}
if (!isset($users)) {$users = array();}
if (!isset($query_date)) {$query_date = $NOW_DATE;}
if (!isset($end_date)) {$end_date = $NOW_DATE;}
if (!isset($query_time)) {$query_time = "00:00:00";}
if (!isset($end_time)) {$end_time = "23:59:59";}
$i=0;
@@ -478,7 +485,7 @@ else
if ($DB) {$HTML_text.="$user_group_string|$user_group_ct|$user_groupQS|$i<BR>";}
$LINKbase = "$PHP_SELF?query_date=$query_date&end_date=$end_date$groupQS$user_groupQS&shift=$shift&DB=$DB&show_percentages=$show_percentages&live_agents=$live_agents&time_in_sec=$time_in_sec&search_archived_data=$search_archived_data&show_defunct_users=$show_defunct_users&breakdown_by_date=$breakdown_by_date&report_display_type=$report_display_type";
$LINKbase = "$PHP_SELF?query_date=$query_date&end_date=$end_date&query_time=$query_time&end_time=$end_time$groupQS$user_groupQS&shift=$shift&DB=$DB&show_percentages=$show_percentages&live_agents=$live_agents&time_in_sec=$time_in_sec&search_archived_data=$search_archived_data&show_defunct_users=$show_defunct_users&breakdown_by_date=$breakdown_by_date&report_display_type=$report_display_type";
require("screen_colors.php");
@@ -534,6 +541,8 @@ $HTML_text.="o_cal.a_tpl.yearscroll = false;\n";
$HTML_text.="// o_cal.a_tpl.weekstart = 1; // Monday week start\n";
$HTML_text.="</script>\n";
$HTML_text.="<BR><INPUT TYPE=TEXT NAME=query_time SIZE=10 MAXLENGTH=10 VALUE=\"$query_time\">";
$HTML_text.="<BR> "._QXZ("to")." <BR><INPUT TYPE=TEXT NAME=end_date SIZE=10 MAXLENGTH=10 VALUE=\"$end_date\">";
$HTML_text.="<script language=\"JavaScript\">\n";
@@ -547,6 +556,8 @@ $HTML_text.="o_cal.a_tpl.yearscroll = false;\n";
$HTML_text.="// o_cal.a_tpl.weekstart = 1; // Monday week start\n";
$HTML_text.="</script>\n";
$HTML_text.="<BR><INPUT TYPE=TEXT NAME=end_time SIZE=10 MAXLENGTH=10 VALUE=\"$end_time\">";
$HTML_text.="</TD><TD VALIGN=TOP> "._QXZ("Campaigns").":<BR>";
$HTML_text.="<SELECT SIZE=5 NAME=group[] multiple>\n";
if (preg_match('/\-\-ALL\-\-/',$group_string))
@@ -633,6 +644,10 @@ if (!$group)
else
{
$time_BEGIN=$query_time;
$time_END=$end_time;
if ($shift == 'AM')
{
$time_BEGIN=$AM_shift_BEGIN;
@@ -649,8 +664,8 @@ if ($shift == 'PM')
}
if ($shift == 'ALL')
{
if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
if (strlen($time_END) < 6) {$time_END = "23:59:59";}
$time_BEGIN = "00:00:00";
$time_END = "23:59:59";
}
$query_date_BEGIN = "$query_date $time_BEGIN";
$query_date_END = "$end_date $time_END";
+406 -5
View File
@@ -128,10 +128,11 @@
# 171129-0751 - Fixed issue with duplicate custom fields
# 171229-1602 - Added lead_status_search function
# 180109-1313 - Added call_status_stats function
# 180208-1655 - Added call_dispo_report function
#
$version = '2.14-104';
$build = '180109-1313';
$version = '2.14-105';
$build = '180208-1655';
$api_url_log = 0;
$startMS = microtime();
@@ -246,6 +247,8 @@ if (isset($_GET["status"])) {$status=$_GET["status"];}
elseif (isset($_POST["status"])) {$status=$_POST["status"];}
if (isset($_GET["statuses"])) {$statuses=$_GET["statuses"];}
elseif (isset($_POST["statuses"])) {$statuses=$_POST["statuses"];}
if (isset($_GET["categories"])) {$categories=$_GET["categories"];}
elseif (isset($_POST["categories"])) {$categories=$_POST["categories"];}
if (isset($_GET["user_field"])) {$user_field=$_GET["user_field"];}
elseif (isset($_POST["user_field"])) {$user_field=$_POST["user_field"];}
if (isset($_GET["list_id_field"])) {$list_id_field=$_GET["list_id_field"];}
@@ -388,6 +391,10 @@ if (isset($_GET["user_groups"])) {$user_groups=$_GET["user_groups"];}
elseif (isset($_POST["user_groups"])) {$user_groups=$_POST["user_groups"];}
if (isset($_GET["in_groups"])) {$in_groups=$_GET["in_groups"];}
elseif (isset($_POST["in_groups"])) {$in_groups=$_POST["in_groups"];}
if (isset($_GET["did_ids"])) {$did_ids=$_GET["did_ids"];}
elseif (isset($_POST["did_ids"])) {$did_ids=$_POST["did_ids"];}
if (isset($_GET["did_patterns"])) {$did_patterns=$_GET["did_patterns"];}
elseif (isset($_POST["did_patterns"])) {$did_patterns=$_POST["did_patterns"];}
if (isset($_GET["call_id"])) {$call_id=$_GET["call_id"];}
elseif (isset($_POST["call_id"])) {$call_id=$_POST["call_id"];}
if (isset($_GET["group"])) {$group=$_GET["group"];}
@@ -420,6 +427,12 @@ if (isset($_GET["ingroups"])) {$ingroups=$_GET["ingroups"];}
elseif (isset($_POST["ingroups"])) {$ingroups=$_POST["ingroups"];}
if (isset($_GET["campaign_name"])) {$campaign_name=$_GET["campaign_name"];}
elseif (isset($_POST["campaign_name"])) {$campaign_name=$_POST["campaign_name"];}
if (isset($_GET["did_ids"])) {$did_ids=$_GET["did_ids"];}
elseif (isset($_POST["did_ids"])) {$did_ids=$_POST["did_ids"];}
if (isset($_GET["did_patterns"])) {$did_patterns=$_GET["did_patterns"];}
elseif (isset($_POST["did_patterns"])) {$did_patterns=$_POST["did_patterns"];}
if (isset($_GET["users"])) {$users=$_GET["users"];}
elseif (isset($_POST["users"])) {$users=$_POST["users"];}
if (isset($_GET["auto_dial_level"])) {$auto_dial_level=$_GET["auto_dial_level"];}
elseif (isset($_POST["auto_dial_level"])) {$auto_dial_level=$_POST["auto_dial_level"];}
if (isset($_GET["adaptive_maximum_level"])) {$adaptive_maximum_level=$_GET["adaptive_maximum_level"];}
@@ -440,6 +453,12 @@ if (isset($_GET["lookup_state"])) {$lookup_state=$_GET["lookup_state"];}
elseif (isset($_POST["lookup_state"])) {$lookup_state=$_POST["lookup_state"];}
if (isset($_GET["type"])) {$type=$_GET["type"];}
elseif (isset($_POST["type"])) {$type=$_POST["type"];}
if (isset($_GET["status_breakdown"])) {$status_breakdown=$_GET["status_breakdown"];}
elseif (isset($_POST["status_breakdown"])) {$status_breakdown=$_POST["status_breakdown"];}
if (isset($_GET["show_percentages"])) {$show_percentages=$_GET["show_percentages"];}
elseif (isset($_POST["show_percentages"])) {$show_percentages=$_POST["show_percentages"];}
if (isset($_GET["file_download"])) {$file_download=$_GET["file_download"];}
elseif (isset($_POST["file_download"])) {$file_download=$_POST["file_download"];}
if (isset($_GET["force_entry_list_id"])) {$force_entry_list_id=$_GET["force_entry_list_id"];}
elseif (isset($_POST["force_entry_list_id"])) {$force_entry_list_id=$_POST["force_entry_list_id"];}
@@ -472,6 +491,19 @@ if ($qm_conf_ct > 0)
if ($non_latin < 1)
{
$users=preg_replace('/[^-_0-9a-zA-Z\,]/','',$users);
$did_patterns = preg_replace('/[^:\+\*\#\.\_0-9a-zA-Z\,]/','',$did_patterns);
$did_ids=preg_replace('/[^0-9\,]/','',$did_ids);
$query_date=preg_replace('/[^-0-9]/','',$query_date);
$query_time=preg_replace('/[^:0-9]/','',$query_time);
$end_date=preg_replace('/[^-0-9]/','',$end_date);
$end_time=preg_replace('/[^:0-9]/','',$end_time);
$statuses = preg_replace('/[^- \.\,\_0-9a-zA-Z]/','',$statuses);
$categories = preg_replace('/[^-_0-9a-zA-Z\,]/','',$categories);
$status_breakdown = preg_replace('/[^1Y]/','',$status_breakdown);
$show_percentages = preg_replace('/[^1Y]/','',$show_percentages);
$DB=preg_replace('/[^0-9]/','',$DB);
$user=preg_replace('/[^-_0-9a-zA-Z]/','',$user);
$pass=preg_replace('/[^-_0-9a-zA-Z]/','',$pass);
@@ -600,8 +632,8 @@ if ($non_latin < 1)
$group_alias_name = preg_replace('/[^- \+\_0-9a-zA-Z]/','',$group_alias_name);
$caller_id_number = preg_replace('/[^0-9]/','',$caller_id_number);
$caller_id_name = preg_replace('/[^- \+\_0-9a-zA-Z]/','',$caller_id_name);
$user_groups = preg_replace('/[^-\|\_0-9a-zA-Z]/','',$user_groups);
$in_groups = preg_replace('/[^-\|\_0-9a-zA-Z]/','',$in_groups);
$user_groups = preg_replace('/[^-\|\_0-9a-zA-Z\,]/','',$user_groups); #JCJ
$in_groups = preg_replace('/[^-\|\_0-9a-zA-Z\,]/','',$in_groups); #JCJ
$call_id = preg_replace('/[^0-9a-zA-Z]/','',$call_id);
$group = preg_replace('/[^-\|\_0-9a-zA-Z]/','',$group);
$expiration_date = preg_replace('/[^-_0-9a-zA-Z]/','',$expiration_date);
@@ -613,7 +645,7 @@ if ($non_latin < 1)
$camp_rg_only = preg_replace('/[^0-9]/','',$camp_rg_only);
$wrapup_seconds_override = preg_replace('/[^-0-9]/','',$wrapup_seconds_override);
$show_sub_status = preg_replace('/[^A-Z]/','',$show_sub_status);
$campaigns = preg_replace('/[^-\|\_0-9a-zA-Z]/','',$campaigns);
$campaigns = preg_replace('/[^-\|\_0-9a-zA-Z\,]/','',$campaigns); # JCJ
$campaign_name = preg_replace('/[^- \.\,\_0-9a-zA-Z]/','',$campaign_name);
$auto_dial_level = preg_replace('/[^\.0-9]/','',$auto_dial_level);
$adaptive_maximum_level = preg_replace('/[^\.0-9]/','',$adaptive_maximum_level);
@@ -627,6 +659,7 @@ if ($non_latin < 1)
$detail = preg_replace('/[^A-Z]/','',$detail);
$type = preg_replace('/[^A-Z]/','',$type);
$force_entry_list_id = preg_replace('/[^0-9]/','',$force_entry_list_id);
$file_download = preg_replace('/[^0-9]/','',$file_download);
}
else
{
@@ -9989,6 +10022,374 @@ if ($function == 'call_status_stats')
################################################################################
################################################################################
### call_dispo_report - call disposition breakdown report
################################################################################
if ($function == 'call_dispo_report')
{
if(strlen($campaigns)<2 && strlen($ingroups)<2 && strlen($did_ids)<2 && strlen($did_patterns)<2)
{
$result = 'ERROR';
$result_reason = "call_dispo_report INVALID OR MISSING CAMPAIGNS, INGROUPS, OR DIDS";
echo "$result: $result_reason - $source\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
echo "ERROR: Invalid Source: |$source|\n";
exit;
}
else
{
if ( (!preg_match("/ $function /",$api_allowed_functions)) and (!preg_match("/ALL_FUNCTIONS/",$api_allowed_functions)) )
{
$result = 'ERROR';
$result_reason = "auth USER DOES NOT HAVE PERMISSION TO USE THIS FUNCTION";
echo "$result: $result_reason: |$user|$function|\n";
$data = "$allowed_user";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
$stmt="SELECT count(*) from vicidial_users where user='$user' and view_reports='1' and user_level > 8 and active='Y';";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$allowed_user=$row[0];
if ($allowed_user < 1)
{
$result = 'ERROR';
$result_reason = "call_status_stats USER DOES NOT HAVE PERMISSION TO VIEW STATS";
echo "$result: $result_reason: |$user|$allowed_user|\n";
$data = "$allowed_user";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
{
if (!$query_date) {$query_date=date("Y-m-d");}
if (!$query_time) {$query_time="00:00:00";}
if (!$end_date) {$end_date=$query_date;}
if (!$end_time) {$end_time="23:59:59";}
if ($show_percentages && !$status_breakdown) {$show_percentages="";}
# COMPILE INBOUND CAMPAIGN CLAUSE
$skip_inbound=0;
if (strlen($ingroups)>0)
{
$ingroup_array=explode("-", $ingroups);
$inb_SQL="and campaign_id in ('".implode("', '", $ingroup_array)."')";
if (in_array("ALLGROUPS", $ingroup_array) || preg_match('/\-\-\-ALL\-\-\-/', $ingroups))
{
$inb_SQL="";
}
}
else
{
$skip_inbound=1;
}
########################
# COMPILE OUTBOUND CAMPAIGN CLAUSE
$skip_outbound=0; #
if (strlen($campaigns)>0)
{
$campaign_array=explode("-", $campaigns);
$campaign_SQL=" and campaign_id in ('".implode("', '", $campaign_array)."') ";
if (in_array("ALLCAMPAIGNS", $campaign_array) || preg_match('/\-\-\-ALL\-\-\-/', $campaigns))
{
$campaign_SQL="";
}
}
else
{
$skip_outbound=1;
}
########################
# COMPILE DID CLAUSE
$skip_dids=0;
if (strlen($did_patterns)>0 || strlen($did_ids)>0)
{
$did_id_array=explode("-", $did_ids);
$did_pattern_array=explode("-", $did_patterns);
$did_stmt="select did_id, did_pattern from vicidial_inbound_dids where did_pattern in ('".implode("','", $did_pattern_array)."')";
if ($DB) {$rpt_str.=$did_stmt."<BR>\n";}
$did_rslt=mysql_to_mysqli($did_stmt, $link);
while ($did_row=mysqli_fetch_row($did_rslt))
{
if (!in_array($did_row[0], $did_id_array))
{
array_push($did_id_array, $did_row[0]);
array_push($did_pattern_array, $did_row[1]);
}
}
}
if (count($did_id_array)>0 && $skip_inbound) # DON'T DO A REPORT FOR INGROUPS AND DIDS YET.
{
$did_SQL="and did_id in ('".implode("', '", $did_id_array)."')";
if (in_array("ALLDIDS", $did_id_array) || preg_match('/\-\-\-ALL\-\-\-/', $did_ids) || in_array("ALLPATTERNS", $did_pattern_array) || preg_match('/\-\-\-ALL\-\-\-/', $did_patterns))
{
$did_SQL="";
}
}
else
{
$skip_dids=1;
}
########################
# COMPILE STATUS CLAUSE
if (strlen($categories)>0 || strlen($statuses)>0)
{
$status_array=explode("-", $statuses);
$categories_array=explode("-", $categories);
$cat_stmt="select distinct statuses from vicidial_statuses where category in ('".implode("','", $categories_array)."') UNION select distinct statuses from vicidial_campaign_statuses where category in ('".implode("','", $categories_array)."') $campaign_SQL";
if ($DB) {$rpt_str.=$cat_stmt."<BR>\n";}
$cat_rslt=mysql_to_mysqli($cat_stmt, $link);
while($cat_row=mysqli_fetch_row($cat_rslt))
{
if (!in_array($cat_row[0], $status_array))
{
array_push($status_array, $cat_row[0]);
}
}
}
if (count($status_array)>0)
{
$status_SQL=" and status in ('".implode("', '", $status_array)."') ";
if (in_array("ALLSTATUSES", $status_array) || preg_match('/\-\-\-ALL\-\-\-/', $statuses) || in_array("ALLCATEGORIES", $categories_array) || preg_match('/\-\-\-ALL\-\-\-/', $categories))
{
$status_SQL="";
}
}
########################
# COMPILE USER CLAUSE
if (strlen($user_groups)>0 || strlen($users)>0)
{
$user_array=explode("-", $users);
$user_group_array=explode("-", $user_groups);
$ug_stmt="select user from vicidial_users where user_group in ('".implode("', '", $user_group_array)."')";
if ($DB) {$rpt_str.=$ug_stmt."<BR>\n";}
$ug_rslt=mysql_to_mysqli($ug_stmt, $link);
while ($ug_row=mysqli_fetch_row($ug_rslt))
{
if (!in_array($ug_row[0], $user_array))
{
array_push($user_array, $ug_row[0]);
}
}
}
if (count($user_array)>0)
{
$user_SQL=" and user in ('".implode("', '", $user_array)."') ";
if (in_array("ALLUSERS", $user_array) || preg_match('/\-\-\-ALL\-\-\-/', $users) || in_array("ALLGROUPS", $user_group_array) || preg_match('/\-\-\-ALL\-\-\-/', $user_groups))
{
$user_SQL="";
}
}
########################
$outbound_ct_array=array();
$inbound_ct_array=array();
$did_ct_array=array();
$status_ct_array=array();
$grand_total_array=array();
$grand_total_calls=0;
if (!$skip_outbound)
{
$stmt="select campaign_id, status, count(*) from vicidial_log where call_date>='$query_date $query_time' and call_date<='$end_date $end_time' $ingroup_SQL $status_SQL $user_SQL group by campaign_id, status order by campaign_id, status asc";
if ($DB) {$rpt_str.=$stmt."<BR>\n";}
$rslt=mysql_to_mysqli($stmt, $link);
while ($row=mysqli_fetch_row($rslt))
{
$outbound_ct_array{"$row[0]"}{"TOTAL CALLS"}+=$row[2];
$grand_total_calls+=$row[2];
if ($status_breakdown)
{
if (!in_array("$row[1]", $status_ct_array))
{
array_push($status_ct_array, "$row[1]");
}
$outbound_ct_array{"$row[0]"}{"$row[1]"}+=$row[2];
$grand_total_array{"$row[1]"}+=$row[2];
}
}
}
if (!$skip_inbound)
{
$stmt="select campaign_id, status, count(*) from vicidial_closer_log where call_date>='$query_date $query_time' and call_date<='$end_date $end_time' $inb_SQL $status_SQL $user_SQL group by campaign_id, status order by campaign_id, status asc";
if ($DB) {$rpt_str.=$stmt."<BR>\n";}
$rslt=mysql_to_mysqli($stmt, $link);
while ($row=mysqli_fetch_row($rslt))
{
$inbound_ct_array{"$row[0]"}{"TOTAL CALLS"}+=$row[2];
$grand_total_calls+=$row[2];
if ($status_breakdown)
{
if (!in_array("$row[1]", $status_ct_array))
{
array_push($status_ct_array, "$row[1]");
}
$inbound_ct_array{"$row[0]"}{"$row[1]"}+=$row[2];
$grand_total_array{"$row[1]"}+=$row[2];
}
}
}
if (!$skip_dids)
{
$stmt="select did_id, extension, campaign_id, status, count(*) from vicidial_did_log vdl, vicidial_closer_log vcl where vdl.call_date>='$query_date $query_time' and vdl.call_date<='$end_date $end_time' $did_SQL $status_SQL $user_SQL and vcl.uniqueid=vdl.uniqueid group by campaign_id, status order by campaign_id, status asc";
if ($DB) {$rpt_str.=$stmt."<BR>\n";}
$rslt=mysql_to_mysqli($stmt, $link);
while ($row=mysqli_fetch_row($rslt))
{
$did_ct_array{"$row[1]"}{"TOTAL CALLS"}+=$row[4];
$grand_total_calls+=$row[4];
if ($status_breakdown)
{
if (!in_array("$row[1]", $status_ct_array))
{
array_push($status_ct_array, "$row[3]");
}
$did_ct_array{"$row[1]"}{"$row[3]"}+=$row[4];
$grand_total_array{"$row[3]"}+=$row[4];
}
}
}
$rpt_str.="CAMPAIGN,TOTAL CALLS";
if ($status_breakdown)
{
for ($i=0; $i<count($status_ct_array); $i++)
{
$rpt_str.=",$status_ct_array[$i]";
}
}
$rpt_str.="\n";
while (list($key, $val)=each($outbound_ct_array))
{
$total_calls=$outbound_ct_array{$key}{"TOTAL CALLS"};
$rpt_str.="$key,".$outbound_ct_array{$key}{"TOTAL CALLS"};
unset($outbound_ct_array{$key}{"TOTAL CALLS"});
if ($status_breakdown)
{
for ($i=0; $i<count($status_ct_array); $i++)
{
$outbound_ct_array{$key}{"$status_ct_array[$i]"}+=0;
}
ksort($outbound_ct_array{$key});
while (list($key2, $val2)=each($outbound_ct_array{$key}))
{
$rpt_str.=",$val2";
if ($show_percentages)
{
$rpt_str.=" (";
$rpt_str.=sprintf("%.1f", (100*$val2/$total_calls));
$rpt_str.="%)";
}
}
}
$rpt_str.="\n";
}
while (list($key, $val)=each($inbound_ct_array))
{
$total_calls=$inbound_ct_array{$key}{"TOTAL CALLS"};
$rpt_str.="$key,".$inbound_ct_array{$key}{"TOTAL CALLS"};
unset($inbound_ct_array{$key}{"TOTAL CALLS"});
if ($status_breakdown)
{
for ($i=0; $i<count($status_ct_array); $i++)
{
$inbound_ct_array{$key}{"$status_ct_array[$i]"}+=0;
}
ksort($inbound_ct_array{$key});
while (list($key2, $val2)=each($inbound_ct_array{$key}))
{
$rpt_str.=",$val2";
if ($show_percentages)
{
$rpt_str.=" (";
$rpt_str.=sprintf("%.1f", (100*$val2/$total_calls));
$rpt_str.="%)";
}
}
}
$rpt_str.="\n";
}
while (list($key, $val)=each($did_ct_array))
{
$total_calls=$did_ct_array{$key}{"TOTAL CALLS"};
$rpt_str.="$key,".$did_ct_array{$key}{"TOTAL CALLS"};
unset($did_ct_array{$key}{"TOTAL CALLS"});
if ($status_breakdown)
{
for ($i=0; $i<count($status_ct_array); $i++)
{
$did_ct_array{$key}{"$status_ct_array[$i]"}+=0;
}
ksort($did_ct_array{$key});
while (list($key2, $val2)=each($did_ct_array{$key}))
{
$rpt_str.=",$val2";
if ($show_percentages)
{
$rpt_str.=" (";
$rpt_str.=sprintf("%.1f", (100*$val2/$total_calls));
$rpt_str.="%)";
}
}
}
$rpt_str.="\n";
}
$rpt_str.="TOTAL,$grand_total_calls";
ksort($grand_total_array);
while (list($key, $val)=each($grand_total_array))
{
$rpt_str.=",$val";
if ($show_percentages)
{
$rpt_str.=" (";
$rpt_str.=sprintf("%.1f", (100*$val/$grand_total_calls));
$rpt_str.="%)";
}
}
if ($file_download>0)
{
$CSVfilename = "API_call_dispo_report_$ENTRYdate.csv";
// We'll be outputting a TXT file
header('Content-type: application/octet-stream');
// It will be called LIST_101_20090209-121212.txt
header("Content-Disposition: attachment; filename=\"$CSVfilename\"");
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
ob_clean();
flush();
echo "$rpt_str";
exit;
}
else
{
header('Content-type: text/plain');
echo "$rpt_str";
if ($DB)
{
print_r($outbound_ct_array);
print_r($inbound_ct_array);
print_r($did_ct_array);
}
}
}
}
exit;
}
################################################################################
### END call_dispo_report
################################################################################
$result = 'ERROR';
$result_reason = "NO FUNCTION SPECIFIED";