diff --git a/agc_2-X/trunk/www/vicidial/call_report_export.php b/agc_2-X/trunk/www/vicidial/call_report_export.php index 41935fd0..26ad6fa1 100644 --- a/agc_2-X/trunk/www/vicidial/call_report_export.php +++ b/agc_2-X/trunk/www/vicidial/call_report_export.php @@ -63,6 +63,7 @@ # 210911-1907 - Fix for --ALL-- selection user-group permission issue # 211119-1500 - Fix for status names # 220301-1603 - Added allow_web_debug system setting +# 230622-1652 - Added filtering by time (hours), and option for single user exports. # $startMS = microtime(); @@ -76,10 +77,16 @@ $PHP_SELF=$_SERVER['PHP_SELF']; $PHP_SELF = preg_replace('/\.php.*/i','.php',$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["query_hour"])) {$query_hour=$_GET["query_hour"];} + elseif (isset($_POST["query_hour"])) {$query_hour=$_POST["query_hour"];} if (isset($_GET["date_field"])) {$date_field=$_GET["date_field"];} elseif (isset($_POST["date_field"])) {$date_field=$_POST["date_field"];} if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];} elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];} +if (isset($_GET["end_hour"])) {$end_hour=$_GET["end_hour"];} + elseif (isset($_POST["end_hour"])) {$end_hour=$_POST["end_hour"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];} elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} if (isset($_GET["group"])) {$group=$_GET["group"];} @@ -129,6 +136,8 @@ if (!isset($list_id)) {$list_id = array();} if (!isset($status)) {$status = array();} if (!isset($query_date)) {$query_date = $NOW_DATE;} if (!isset($end_date)) {$end_date = $NOW_DATE;} +if (!isset($query_hour)) {$query_hour = "00";} +if (!isset($end_hour)) {$end_hour = "23";} if (strlen($shift)<2) {$shift='ALL';} $report_name = 'Export Calls Report'; @@ -161,6 +170,8 @@ if ($SSallow_web_debug < 1) {$DB=0;} $query_date = preg_replace('/[^- \:\_0-9a-zA-Z]/', '', $query_date); $end_date = preg_replace('/[^- \:\_0-9a-zA-Z]/', '', $end_date); +$query_hour = preg_replace('/[^0-9]/', '', $query_hour); +$end_hour = preg_replace('/[^0-9]/', '', $end_hour); $date_field = preg_replace('/[^-\.\_0-9a-zA-Z]/', '', $date_field); $submit = preg_replace('/[^-_0-9a-zA-Z]/', '', $submit); $SUBMIT = preg_replace('/[^-_0-9a-zA-Z]/', '', $SUBMIT); @@ -172,6 +183,9 @@ $custom_fields = preg_replace('/[^-_0-9a-zA-Z]/', '', $custom_fields); $call_notes = preg_replace('/[^-_0-9a-zA-Z]/', '', $call_notes); $export_fields = preg_replace('/[^-_0-9a-zA-Z]/', '', $export_fields); $search_archived_data = preg_replace('/[^-_0-9a-zA-Z]/', '', $search_archived_data); +$query_time=$query_hour.":00:00"; +$end_time=$end_hour.":59:59"; + # Variables filtered further down in the code # $campaign @@ -184,11 +198,13 @@ 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); + $user = preg_replace('/[^-_0-9a-zA-Z]/', '', $user); } else { $PHP_AUTH_USER = preg_replace('/[^-_0-9\p{L}]/u', '', $PHP_AUTH_USER); $PHP_AUTH_PW = preg_replace('/[^-_0-9\p{L}]/u', '', $PHP_AUTH_PW); + $user = preg_replace('/[^-_0-9\p{L}]/u', '', $user); } ### ARCHIVED DATA CHECK CONFIGURATION @@ -416,6 +432,16 @@ if ( (!preg_match('/\-\-ALL\-\-/i', $LOGadmin_viewable_call_times)) and (strlen( ##### START RUN THE EXPORT AND OUTPUT FLAT DATA FILE ##### if ($run_export > 0) { + + if ($user) + { + $user_SQL=" and vl.user='$user' "; + } + else + { + $user_SQL=""; + } + if ($date_field=="entry_date") { $date_field = "vi.entry_date"; # Since entry_date only appears when the EXTENDED export option is selected, EXTENDED will automatically be used when entry_date is selected as the date field. @@ -721,11 +747,11 @@ if ($run_export > 0) { if ( ($export_fields == 'EXTENDED') or ($export_fields == 'EXTENDED_2') or ($export_fields == 'EXTENDED_3') or ($export_fields == 'EXTENDED_4') ) { - $stmt = "SELECT vl.call_date,vl.phone_number,vl.status,vl.user,vu.full_name,vl.campaign_id,vi.vendor_lead_code,vi.source_id,vi.list_id,vi.gmt_offset_now,vi.phone_code,vi.phone_number,vi.title,vi.first_name,vi.middle_initial,vi.last_name,vi.address1,vi.address2,vi.address3,vi.city,vi.state,vi.province,vi.postal_code,vi.country_code,vi.gender,vi.date_of_birth,vi.alt_phone,vi.email,vi.security_phrase,vi.comments,vl.length_in_sec,vl.user_group,vl.alt_dial,vi.rank,vi.owner,vi.lead_id,vl.uniqueid,vi.entry_list_id, ifnull(val.dispo_sec+val.dead_sec,0)$export_fields_SQL from vicidial_users vu,vicidial_list vi,".$vicidial_log_table." vl LEFT OUTER JOIN ".$vicidial_agent_log_table." val ON vl.uniqueid=val.uniqueid and vl.lead_id=val.lead_id and vl.user=val.user where ".$date_field." >= '$query_date 00:00:00' and ".$date_field." <= '$end_date 23:59:59' and vu.user=vl.user and vi.lead_id=vl.lead_id $list_SQL $campaign_SQL $user_group_SQL $status_SQL order by ".$date_field." limit 1000000;"; + $stmt = "SELECT vl.call_date,vl.phone_number,vl.status,vl.user,vu.full_name,vl.campaign_id,vi.vendor_lead_code,vi.source_id,vi.list_id,vi.gmt_offset_now,vi.phone_code,vi.phone_number,vi.title,vi.first_name,vi.middle_initial,vi.last_name,vi.address1,vi.address2,vi.address3,vi.city,vi.state,vi.province,vi.postal_code,vi.country_code,vi.gender,vi.date_of_birth,vi.alt_phone,vi.email,vi.security_phrase,vi.comments,vl.length_in_sec,vl.user_group,vl.alt_dial,vi.rank,vi.owner,vi.lead_id,vl.uniqueid,vi.entry_list_id, ifnull(val.dispo_sec+val.dead_sec,0)$export_fields_SQL from vicidial_users vu,vicidial_list vi,".$vicidial_log_table." vl LEFT OUTER JOIN ".$vicidial_agent_log_table." val ON vl.uniqueid=val.uniqueid and vl.lead_id=val.lead_id and vl.user=val.user where ".$date_field." >= '$query_date $query_time' and ".$date_field." <= '$end_date $end_time' and vu.user=vl.user and vi.lead_id=vl.lead_id $list_SQL $campaign_SQL $user_SQL $user_group_SQL $status_SQL order by ".$date_field." limit 1000000;"; } else { - $stmt = "SELECT vl.call_date,vl.phone_number,vl.status,vl.user,vu.full_name,vl.campaign_id,vi.vendor_lead_code,vi.source_id,vi.list_id,vi.gmt_offset_now,vi.phone_code,vi.phone_number,vi.title,vi.first_name,vi.middle_initial,vi.last_name,vi.address1,vi.address2,vi.address3,vi.city,vi.state,vi.province,vi.postal_code,vi.country_code,vi.gender,vi.date_of_birth,vi.alt_phone,vi.email,vi.security_phrase,vi.comments,vl.length_in_sec,vl.user_group,vl.alt_dial,vi.rank,vi.owner,vi.lead_id,vl.uniqueid,vi.entry_list_id$export_fields_SQL from vicidial_users vu,".$vicidial_log_table." vl,vicidial_list vi where ".$date_field." >= '$query_date 00:00:00' and ".$date_field." <= '$end_date 23:59:59' and vu.user=vl.user and vi.lead_id=vl.lead_id $list_SQL $campaign_SQL $user_group_SQL $status_SQL order by ".$date_field." limit 1000000;"; + $stmt = "SELECT vl.call_date,vl.phone_number,vl.status,vl.user,vu.full_name,vl.campaign_id,vi.vendor_lead_code,vi.source_id,vi.list_id,vi.gmt_offset_now,vi.phone_code,vi.phone_number,vi.title,vi.first_name,vi.middle_initial,vi.last_name,vi.address1,vi.address2,vi.address3,vi.city,vi.state,vi.province,vi.postal_code,vi.country_code,vi.gender,vi.date_of_birth,vi.alt_phone,vi.email,vi.security_phrase,vi.comments,vl.length_in_sec,vl.user_group,vl.alt_dial,vi.rank,vi.owner,vi.lead_id,vl.uniqueid,vi.entry_list_id$export_fields_SQL from vicidial_users vu,".$vicidial_log_table." vl,vicidial_list vi where ".$date_field." >= '$query_date $query_time' and ".$date_field." <= '$end_date $end_time' and vu.user=vl.user and vi.lead_id=vl.lead_id $list_SQL $campaign_SQL $user_SQL $user_group_SQL $status_SQL order by ".$date_field." limit 1000000;"; } $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$DBout .= "$stmt\n";} @@ -867,11 +893,11 @@ if ($run_export > 0) { if ( ($export_fields == 'EXTENDED') or ($export_fields == 'EXTENDED_2') or ($export_fields == 'EXTENDED_3') or ($export_fields == 'EXTENDED_4') ) { - $stmtA = "SELECT vl.call_date,vl.phone_number,vl.status,vl.user,vu.full_name,vl.campaign_id,vi.vendor_lead_code,vi.source_id,vi.list_id,vi.gmt_offset_now,vi.phone_code,vi.phone_number,vi.title,vi.first_name,vi.middle_initial,vi.last_name,vi.address1,vi.address2,vi.address3,vi.city,vi.state,vi.province,vi.postal_code,vi.country_code,vi.gender,vi.date_of_birth,vi.alt_phone,vi.email,vi.security_phrase,vi.comments,vl.length_in_sec,vl.user_group,vl.queue_seconds,vi.rank,vi.owner,vi.lead_id,vl.closecallid,vi.entry_list_id,vl.uniqueid,val.campaign_id, ifnull(val.dispo_sec+val.dead_sec,0)$export_fields_SQL from vicidial_users vu,vicidial_list vi,".$vicidial_closer_log_table." vl LEFT OUTER JOIN ".$vicidial_agent_log_table." val ON vl.uniqueid=val.uniqueid and vl.lead_id=val.lead_id and vl.user=val.user where ".$date_field." >= '$query_date 00:00:00' and ".$date_field." <= '$end_date 23:59:59' and vu.user=vl.user and vi.lead_id=vl.lead_id $list_SQL $group_SQL $user_group_SQL $status_SQL order by ".$date_field." limit 1000000;"; + $stmtA = "SELECT vl.call_date,vl.phone_number,vl.status,vl.user,vu.full_name,vl.campaign_id,vi.vendor_lead_code,vi.source_id,vi.list_id,vi.gmt_offset_now,vi.phone_code,vi.phone_number,vi.title,vi.first_name,vi.middle_initial,vi.last_name,vi.address1,vi.address2,vi.address3,vi.city,vi.state,vi.province,vi.postal_code,vi.country_code,vi.gender,vi.date_of_birth,vi.alt_phone,vi.email,vi.security_phrase,vi.comments,vl.length_in_sec,vl.user_group,vl.queue_seconds,vi.rank,vi.owner,vi.lead_id,vl.closecallid,vi.entry_list_id,vl.uniqueid,val.campaign_id, ifnull(val.dispo_sec+val.dead_sec,0)$export_fields_SQL from vicidial_users vu,vicidial_list vi,".$vicidial_closer_log_table." vl LEFT OUTER JOIN ".$vicidial_agent_log_table." val ON vl.uniqueid=val.uniqueid and vl.lead_id=val.lead_id and vl.user=val.user where ".$date_field." >= '$query_date $query_time' and ".$date_field." <= '$end_date $end_time' and vu.user=vl.user and vi.lead_id=vl.lead_id $list_SQL $group_SQL $user_SQL $user_group_SQL $status_SQL order by ".$date_field." limit 1000000;"; } else { - $stmtA = "SELECT vl.call_date,vl.phone_number,vl.status,vl.user,vu.full_name,vl.campaign_id,vi.vendor_lead_code,vi.source_id,vi.list_id,vi.gmt_offset_now,vi.phone_code,vi.phone_number,vi.title,vi.first_name,vi.middle_initial,vi.last_name,vi.address1,vi.address2,vi.address3,vi.city,vi.state,vi.province,vi.postal_code,vi.country_code,vi.gender,vi.date_of_birth,vi.alt_phone,vi.email,vi.security_phrase,vi.comments,vl.length_in_sec,vl.user_group,vl.queue_seconds,vi.rank,vi.owner,vi.lead_id,vl.closecallid,vi.entry_list_id,vl.uniqueid,val.campaign_id$export_fields_SQL from vicidial_users vu,vicidial_list vi,".$vicidial_closer_log_table." vl LEFT OUTER JOIN ".$vicidial_agent_log_table." val ON vl.uniqueid=val.uniqueid and vl.lead_id=val.lead_id and vl.user=val.user where ".$date_field." >= '$query_date 00:00:00' and ".$date_field." <= '$end_date 23:59:59' and vu.user=vl.user and vi.lead_id=vl.lead_id $list_SQL $group_SQL $user_group_SQL $status_SQL order by ".$date_field." limit 1000000;"; + $stmtA = "SELECT vl.call_date,vl.phone_number,vl.status,vl.user,vu.full_name,vl.campaign_id,vi.vendor_lead_code,vi.source_id,vi.list_id,vi.gmt_offset_now,vi.phone_code,vi.phone_number,vi.title,vi.first_name,vi.middle_initial,vi.last_name,vi.address1,vi.address2,vi.address3,vi.city,vi.state,vi.province,vi.postal_code,vi.country_code,vi.gender,vi.date_of_birth,vi.alt_phone,vi.email,vi.security_phrase,vi.comments,vl.length_in_sec,vl.user_group,vl.queue_seconds,vi.rank,vi.owner,vi.lead_id,vl.closecallid,vi.entry_list_id,vl.uniqueid,val.campaign_id$export_fields_SQL from vicidial_users vu,vicidial_list vi,".$vicidial_closer_log_table." vl LEFT OUTER JOIN ".$vicidial_agent_log_table." val ON vl.uniqueid=val.uniqueid and vl.lead_id=val.lead_id and vl.user=val.user where ".$date_field." >= '$query_date $query_time' and ".$date_field." <= '$end_date $end_time' and vu.user=vl.user and vi.lead_id=vl.lead_id $list_SQL $group_SQL $user_SQL $user_group_SQL $status_SQL order by ".$date_field." limit 1000000;"; } $rslt=mysql_to_mysqli($stmtA, $link); if ($DB) {$DBout .= "$stmtA\n";} @@ -1351,7 +1377,7 @@ if ($run_export > 0) $IVRdelimiter='|'; if ($export_fields=='ALTERNATE_1') {$IVRdelimiter='^';} - $stmt="select menu_id,UNIX_TIMESTAMP(event_date) from ".$vicidial_outbound_ivr_log_table." where event_date >= '$query_date 00:00:00' and event_date <= '$end_date 23:59:59' and uniqueid='$export_uniqueid[$i]' order by event_date,menu_action desc;"; + $stmt="select menu_id,UNIX_TIMESTAMP(event_date) from ".$vicidial_outbound_ivr_log_table." where event_date >= '$query_date $query_time' and event_date <= '$end_date $end_time' and uniqueid='$export_uniqueid[$i]' order by event_date,menu_action desc;"; $rslt=mysql_to_mysqli($stmt, $link); # $ivr_path = "$stmt|$export_uniqueid[$i]|"; if ($DB) {$MAIN.="$stmt\n";} @@ -1645,7 +1671,16 @@ else echo "\n"; echo "\n"; echo "\n"; - + echo "\n"; echo "
"; echo "\n"; @@ -1688,8 +1723,8 @@ else echo ""; echo "| \n";
- echo ""._QXZ("Date Range").": \n"; # "._QXZ("to")." \n"; - echo ""; + echo " \n"; - echo ""._QXZ("Date Field").": $NWB#call_export_report-date_field$NWE \n"; - echo "\n"; + echo ""._QXZ("User").": \n"; + echo " $NWB#call_export_report-user$NWE\n"; echo " \n"; - echo ""._QXZ("Header Row").": $NWB#call_export_report-header_row$NWE \n"; - echo "\n"; + echo ""._QXZ("Date Field").": \n"; + echo " $NWB#call_export_report-date_field$NWE\n"; echo " \n"; - echo ""._QXZ("Recording Fields").": $NWB#call_export_report-rec_fields$NWE \n"; + echo ""._QXZ("Header Row").": \n"; + echo " $NWB#call_export_report-header_row$NWE\n"; + + echo " \n"; + + echo ""._QXZ("Rec Fields").": \n"; echo "\n"; + echo " $NWB#call_export_report-rec_fields$NWE\n"; if ($custom_fields_enabled > 0) { echo " \n"; - echo ""._QXZ("Custom Fields").": $NWB#call_export_report-custom_fields$NWE \n"; - echo "\n"; + echo ""._QXZ("Custom Fields").": \n"; + echo " $NWB#call_export_report-custom_fields$NWE\n"; } echo " \n"; - echo ""._QXZ("Per Call Notes").": $NWB#call_export_report-call_notes$NWE \n"; - echo "\n"; + echo ""._QXZ("Per Call Notes").": \n"; + echo " $NWB#call_export_report-call_notes$NWE\n"; echo " \n"; - echo ""._QXZ("Export Fields").": $NWB#call_export_report-export_fields$NWE \n"; + echo ""._QXZ("Export Type").":$NWB#call_export_report-export_type$NWE \n"; echo "\n"; if ($archives_available=="Y") { - echo " "._QXZ("Search archived data")." $NWB#call_export_report-search_archived_data$NWE \n"; + echo " \n"; } ### bottom of first column @@ -1816,7 +1874,7 @@ else $o=0; while ($statuses_to_print > $o) { - if (preg_match("/\|$LISTstatus[$o]\|/",$list_string)) + if (preg_match("/\|$LISTstatus[$o]\|/",$status_string)) {echo "\n";} else {echo "\n";} diff --git a/agc_2-X/trunk/www/vicidial/fcstats_detail.php b/agc_2-X/trunk/www/vicidial/fcstats_detail.php index a728e0b5..80231147 100644 --- a/agc_2-X/trunk/www/vicidial/fcstats_detail.php +++ b/agc_2-X/trunk/www/vicidial/fcstats_detail.php @@ -44,6 +44,7 @@ # 190216-0808 - Fix for user-group, in-group and campaign allowed/permissions matching issues # 191013-0851 - Fixes for PHP7 # 220228-1955 - Added allow_web_debug system setting +# 230621-1434 - Fixed download bug, added option to see unanswered transfers # $startMS = microtime(); @@ -73,6 +74,8 @@ if (isset($_GET["shift"])) {$shift=$_GET["shift"];} elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];} if (isset($_GET["show_summary"])) {$show_summary=$_GET["show_summary"];} elseif (isset($_POST["show_summary"])) {$show_summary=$_POST["show_summary"];} +if (isset($_GET["show_unanswered_xfers"])) {$show_unanswered_xfers=$_GET["show_unanswered_xfers"];} + elseif (isset($_POST["show_unanswered_xfers"])) {$show_unanswered_xfers=$_POST["show_unanswered_xfers"];} if (isset($_GET["submit"])) {$submit=$_GET["submit"];} elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} @@ -140,6 +143,7 @@ $shift = preg_replace("/\<|\>|\'|\"|\\\\|;/","",$shift); $show_summary = preg_replace('/[^-_0-9a-zA-Z]/', '', $show_summary); $file_download = preg_replace('/[^-_0-9a-zA-Z]/', '', $file_download); $report_display_type = preg_replace('/[^-_0-9a-zA-Z]/', '', $report_display_type); +$show_unanswered_xfers = preg_replace('/[^-_0-9a-zA-Z]/', '', $show_unanswered_xfers); # Variables filtered further down in the code # $user_group @@ -671,8 +675,9 @@ if ($archives_available=="Y") $HTML_text.=""._QXZ("Search archived data")." \n"; } $HTML_text.=""._QXZ("Show fronter/closer summary")." \n"; +$HTML_text.=""._QXZ("Show unanswered transfers")." \n"; $HTML_text.=" \n"; -$HTML_text.=""._QXZ("DOWNLOAD")." | "._QXZ("MODIFY")." | "._QXZ("REPORTS")." \n"; +$HTML_text.=""._QXZ("DOWNLOAD")." | "._QXZ("MODIFY")." | "._QXZ("REPORTS")." \n"; $HTML_text.=" | ";
@@ -761,6 +766,8 @@ if ($campaign_ct>0 || $user_group_ct>0 || $user_ct>0) {
*/
$complete_xfer_log=array();
+ $complete_fronter_stats=array();
+ $complete_closer_stats=array();
$xfer_log_stmt="select * from vicidial_xfer_log where campaign_id in ('" . implode("','", array_map(array($link, 'real_escape_string'), $group)) . "') and call_date>='$query_date_BEGIN' and call_date<='$query_date_END' $user_SQL";
if ($DB) {echo "$xfer_log_stmt\n";}
$xfer_log_rslt=mysql_to_mysqli($xfer_log_stmt, $link);
@@ -768,6 +775,7 @@ if ($campaign_ct>0 || $user_group_ct>0 || $user_ct>0) {
$temp_array=array();
$xfercallid=$xfer_row["xfercallid"];
$closer=$xfer_row["closer"];
+ if ($closer=="VDXL" && $show_unanswered_xfers) {$closer="VDCL";}
$campaign_id="";
$lead_stmt="select * from vicidial_list where lead_id='$xfer_row[lead_id]'";
@@ -788,6 +796,16 @@ if ($campaign_ct>0 || $user_group_ct>0 || $user_ct>0) {
$campaign_id=$fronter_row["campaign_id"];
$ingroup=$xfer_row["campaign_id"];
+ if($user_group=="") # sometimes NULL in closer_log
+ {
+ $val_stmt="select user_group, abs(timestampdiff(SECOND, '$xfer_row[call_date]', event_time)) as time_diff from vicidial_agent_log where user='$user' order by time_diff asc limit 1";
+ $val_rslt=mysql_to_mysqli($val_stmt, $link);
+ while ($val_row=mysqli_fetch_array($val_rslt))
+ {
+ $user_group=$val_row["user_group"];
+ }
+ }
+
#$uniqueid=$fronter_row["uniqueid"];
#$agent_log_stmt="select * From vicidial_agent_log where uniqueid='$uniqueid' $campaignSQL";
#$agent_log_rslt=mysql_to_mysqli($agent_log_stmt, $link);
@@ -807,6 +825,16 @@ if ($campaign_ct>0 || $user_group_ct>0 || $user_ct>0) {
$user_group=$closer_row["user_group"];
$ingroup=$xfer_row["campaign_id"];
+ if($user_group=="") # sometimes NULL in closer_log
+ {
+ $val_stmt="select user_group, abs(timestampdiff(SECOND, '$xfer_row[call_date]', event_time)) as time_diff from vicidial_agent_log where user='$user' order by time_diff asc limit 1";
+ $val_rslt=mysql_to_mysqli($val_stmt, $link);
+ while ($val_row=mysqli_fetch_array($val_rslt))
+ {
+ $user_group=$val_row["user_group"];
+ }
+ }
+
$uniqueid=$closer_row["uniqueid"];
$agent_log_stmt="select campaign_id From vicidial_agent_log where uniqueid='$uniqueid' and event_time>='$query_date_BEGIN' and event_time<='$query_date_END' $campaign_SQL $user_group_SQL";
$agent_log_rslt=mysql_to_mysqli($agent_log_stmt, $link);
@@ -823,7 +851,7 @@ if ($campaign_ct>0 || $user_group_ct>0 || $user_ct>0) {
$closer_xfer_log_stmt="select uniqueid, campaign_id, call_date, status from vicidial_closer_log where campaign_id in ('" . implode("','", array_map(array($link, 'real_escape_string'), $group)) . "') and call_date>='$xfer_row[call_date]' and call_date<='$xfer_row[call_date]'+INTERVAL 1 HOUR and xfercallid='$xfercallid' and user='$closer' $user_SQL $user_group_SQL order by call_date asc limit 1";
$closer_xfer_log_rslt=mysql_to_mysqli($closer_xfer_log_stmt, $link);
- if ($DB) {echo "$closer_xfer_log_stmt\n";}
+ if ($DB) {echo "$closer_xfer_log_stmt|".mysqli_num_rows($closer_xfer_log_rslt)."\n";}
if (mysqli_num_rows($closer_xfer_log_rslt)>0) {
$closer_xfer_row=mysqli_fetch_array($closer_xfer_log_rslt);
$closer_uid=$closer_xfer_row["uniqueid"];
@@ -833,6 +861,7 @@ if ($campaign_ct>0 || $user_group_ct>0 || $user_ct>0) {
$closer_agent_log_stmt="select campaign_id, user_group from vicidial_agent_log where user='$closer' and uniqueid='$closer_uid' and event_time>='$query_date_BEGIN' and event_time<='$query_date_END' $user_SQL $user_group_SQL $campaign_SQL"; #$campaignSQL necessary?
$closer_agent_log_rslt=mysql_to_mysqli($closer_agent_log_stmt, $link);
+ if ($DB) {echo "$closer_agent_log_stmt|".mysqli_num_rows($closer_agent_log_rslt)."\n";}
if (mysqli_num_rows($closer_agent_log_rslt)>0) {
$closer_agent_log_row=mysqli_fetch_array($closer_agent_log_rslt);
$closer_campaign=$closer_agent_log_row["campaign_id"];
@@ -840,6 +869,15 @@ if ($campaign_ct>0 || $user_group_ct>0 || $user_ct>0) {
array_push($temp_array, "$closer_campaign", "$closer_ingroup", "$closer", "$closer_user_group", "$closer_call_date", "$status");
array_push($complete_xfer_log, $temp_array);
+
+ $complete_fronter_stats["$user"]["$status"]++;
+ $complete_closer_stats["$closer"]["$status"]++;
+ } else if ($closer=="VDCL" && $show_unanswered_xfers) {
+ array_push($temp_array, "$closer_ingroup", "$closer_ingroup", "$closer", "ADMIN", "$closer_call_date", "$status");
+ array_push($complete_xfer_log, $temp_array);
+
+ $complete_fronter_stats["$user"]["$status"]++;
+ $complete_closer_stats["$closer"]["$status"]++;
}
}
}
@@ -862,6 +900,7 @@ if (count($complete_xfer_log)>0) {
$HTML_text.="| "._QXZ("CALL DATE (INITIAL)", 19)." | "._QXZ("LEAD ID", 9)." | "._QXZ("PHONE NUMBER", 20)." | "._QXZ("PROVINCE", 20)." | "._QXZ("USER", 20)." | "._QXZ("USER GROUP - FRONTER", 20)." | "._QXZ("FRONT CAMP", 10)." | "._QXZ("INBOUND/XFER GROUP", 20)." | "._QXZ("RECVD CAMP", 10)." | "._QXZ("RCVD GROUP", 20)." | "._QXZ("USER", 20)." | "._QXZ("USER GROUP - CLOSER", 20)." | "._QXZ("RECEIPT DATE", 19)." | "._QXZ("STATUS", 6)." |\n";
$CSV_text1="\""._QXZ("CALL DATE (INITIAL)")."\",\""._QXZ("LEAD ID")."\",\""._QXZ("PHONE NUMBER")."\",\""._QXZ("PROVINCE")."\",\""._QXZ("USER")."\",\""._QXZ("USER GROUP - FRONTER")."\",\""._QXZ("FRONT CAMP")."\",\""._QXZ("INBOUND/XFER GROUP")."\",\""._QXZ("RECVD CAMP")."\",\""._QXZ("RCVD GROUP")."\",\""._QXZ("USER")."\",\""._QXZ("USER GROUP - CLOSER")."\",\""._QXZ("RECEIPT DATE")."\",\""._QXZ("STATUS")."\"\n";
$HTML_text.=$output_header;
+ $total_transfers=0;
for($i=0; $i