Added agent-lag-time to agent_status action in alt_display.php
Modified for sale counts to be campaign-specific in Team Performance Detail report git-svn-id: svn://192.168.202.10@3298 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -16,10 +16,11 @@
|
||||
#
|
||||
# CHANGELOG:
|
||||
# 200827-1157 - First build
|
||||
# 200920-0906 - Added agent-lag-time to agent_status action
|
||||
#
|
||||
|
||||
$version = '2.14-1';
|
||||
$build = '200827-1157';
|
||||
$version = '2.14-2';
|
||||
$build = '200920-0906';
|
||||
$php_script = 'alt_display.php';
|
||||
$mel=1; # Mysql Error Log enabled = 1
|
||||
$mysql_log_count=11;
|
||||
@@ -443,8 +444,8 @@ if ($ACTION == 'top_panel_realtime')
|
||||
|
||||
################################################################################
|
||||
### agent_status - data-only compressed details for logged-in agent status
|
||||
### will output these fields: agent-status|call-time|dead_time|pause-code|calls-today|calls-waiting|waiting-time
|
||||
### example: PAUSED|0|0|BREAK|12|0|0
|
||||
### will output these fields: agent-status|call-time|dead_time|pause-code|calls-today|calls-waiting|waiting-time|agent-lag-time
|
||||
### example: PAUSED|0|0|BREAK|12|0|0|1
|
||||
################################################################################
|
||||
if ($ACTION == 'agent_status')
|
||||
{
|
||||
@@ -454,7 +455,7 @@ if ($ACTION == 'agent_status')
|
||||
$CIQcount=0;
|
||||
$wait_length=0;
|
||||
|
||||
$stmt="SELECT server_ip,status,lead_id,campaign_id,callerid,last_update_time,closer_campaigns,calls_today,pause_code,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_state_change),preview_lead_id,pause_code from vicidial_live_agents where user='$user';";
|
||||
$stmt="SELECT server_ip,status,lead_id,campaign_id,callerid,last_update_time,closer_campaigns,calls_today,pause_code,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_state_change),preview_lead_id,pause_code,UNIX_TIMESTAMP(last_update_time) from vicidial_live_agents where user='$user';";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'09008',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$cl_user_ct = mysqli_num_rows($rslt);
|
||||
@@ -474,6 +475,7 @@ if ($ACTION == 'agent_status')
|
||||
$VLAlast_state_change_epoch = $row[10];
|
||||
$VLApreview_lead_id = ($row[11] + 0);
|
||||
$VLApause_code = $row[12];
|
||||
$VLAlast_update_time_epoch = $row[13];
|
||||
if ( ($VLAstatus == 'INCALL') or ($VLAstatus == 'QUEUE') or ($VLAstatus == 'MQUEUE') ) {$agent_status = 'DEAD';}
|
||||
if ( ($VLAstatus == 'PAUSED') and ($VLAlead_id > 0) ) {$agent_status = 'DISPO';}
|
||||
if ( ($VLAstatus == 'PAUSED') and ($VLApreview_lead_id > 0) ) {$agent_status = 'PREVIEW';}
|
||||
@@ -560,8 +562,13 @@ if ($ACTION == 'agent_status')
|
||||
$wait_length = ($StarTtime - $CIQcall_time_epoch);
|
||||
}
|
||||
}
|
||||
if ($VLAlast_update_time_epoch > 10)
|
||||
{
|
||||
$lagged_length = ($StarTtime - $VLAlast_update_time_epoch);
|
||||
}
|
||||
|
||||
### END Calls in Queue section ###
|
||||
$stage="$agent_status|$call_length|$hangup_length|$VLApause_code|$VLAcalls_today|$CIQcount|$wait_length";
|
||||
$stage="$agent_status|$call_length|$hangup_length|$VLApause_code|$VLAcalls_today|$CIQcount|$wait_length|$lagged_length";
|
||||
echo "$stage\n";
|
||||
|
||||
if ($SSagent_debug_logging > 0) {vicidial_ajax_log($NOW_TIME,$startMS,$link,$ACTION,$php_script,$user,$stage,$lead_id,$session_name,$stmt);}
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
# 171012-2015 - Fixed javascript/apache errors with graphs
|
||||
# 180507-2315 - Added new help display
|
||||
# 191013-0825 - Fixes for PHP7
|
||||
# 200917-1720 - Modified for sale counts to be campaign-specific
|
||||
#
|
||||
|
||||
$startMS = microtime();
|
||||
@@ -623,10 +624,22 @@ $HTML_text.="</FONT>\n";
|
||||
$HTML_text.="</TD></TR></TABLE>";
|
||||
$HTML_text.="</FORM>\n\n";
|
||||
|
||||
$report_sale_array=array();
|
||||
$dispo_sale_stmt="select status, campaign_id from vicidial_campaign_statuses where sale='Y' $group_SQL UNION select status, 'VICIDIAL_SALE' from vicidial_statuses where sale='Y'";
|
||||
$dispo_sale_rslt=mysql_to_mysqli($dispo_sale_stmt, $link);
|
||||
while ($dispo_sale_row=mysqli_fetch_row($dispo_sale_rslt))
|
||||
{
|
||||
$status=$dispo_sale_row[0];
|
||||
$campaign=$dispo_sale_row[1];
|
||||
if (!$report_sale_array["$campaign"]) {$report_sale_array["$campaign"]="|";}
|
||||
$report_sale_array["$campaign"].="$status|";
|
||||
}
|
||||
# print_r($report_sale_array);
|
||||
|
||||
if ( ($SUBMIT=="SUBMIT") or ($SUBMIT==_QXZ("SUBMIT")) )
|
||||
{
|
||||
# Sale counts per rep
|
||||
$stmt="select max(event_time), ".$vicidial_agent_log_table.".user, ".$vicidial_agent_log_table.".lead_id, ".$vicidial_list_table.".status as current_status from ".$vicidial_agent_log_table.", ".$vicidial_list_table." where event_time>='$query_date' and event_time<='$end_date' $group_SQL and ".$vicidial_agent_log_table.".status in (select status from vicidial_campaign_statuses where sale='Y' $group_SQL UNION select status from vicidial_statuses where sale='Y') and ".$vicidial_agent_log_table.".lead_id=".$vicidial_list_table.".lead_id group by ".$vicidial_agent_log_table.".user, ".$vicidial_agent_log_table.".lead_id";
|
||||
$stmt="select max(event_time), ".$vicidial_agent_log_table.".user, ".$vicidial_agent_log_table.".lead_id, ".$vicidial_list_table.".status as current_status, ".$vicidial_agent_log_table.".campaign_id, ".$vicidial_agent_log_table.".status from ".$vicidial_agent_log_table.", ".$vicidial_list_table." where event_time>='$query_date' and event_time<='$end_date' $group_SQL and ".$vicidial_agent_log_table.".status in (select status from vicidial_campaign_statuses where sale='Y' $group_SQL UNION select status from vicidial_statuses where sale='Y') and ".$vicidial_agent_log_table.".lead_id=".$vicidial_list_table.".lead_id group by ".$vicidial_agent_log_table.".user, ".$vicidial_agent_log_table.".lead_id";
|
||||
if ($DB) {$ASCII_text.="$stmt\n";}
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$cancel_array=array();
|
||||
@@ -637,6 +650,8 @@ if ( ($SUBMIT=="SUBMIT") or ($SUBMIT==_QXZ("SUBMIT")) )
|
||||
$lead_id=$row["lead_id"];
|
||||
$user=$row["user"];
|
||||
$current_status=$row["current_status"];
|
||||
$campaign_id=$row["campaign_id"];
|
||||
$agent_status=$row["status"];
|
||||
if (preg_match("/QCCANC/i", $current_status))
|
||||
{
|
||||
$cancel_array[$row["user"]]++;
|
||||
@@ -647,16 +662,19 @@ if ( ($SUBMIT=="SUBMIT") or ($SUBMIT==_QXZ("SUBMIT")) )
|
||||
}
|
||||
else
|
||||
{
|
||||
$sale_array[$row["user"]]++;
|
||||
if (preg_match("/\|$agent_status\|/i", $report_sale_array["$campaign_id"]) || preg_match("/\|$agent_status\|/i", $report_sale_array["VICIDIAL_SALE"]))
|
||||
{
|
||||
$sale_array[$row["user"]]++;
|
||||
|
||||
# Get actual talk time for all calls made by the user for this particular lead. If cancelled and incomplete sales are to have their times
|
||||
# counted towards sales talk time, move the below lines OUTSIDE the curly bracket below, so the query runs regardless of what "type" of
|
||||
# sale it is.
|
||||
$sale_time_stmt="select sum(talk_sec)-sum(dead_sec) from ".$vicidial_agent_log_table." where user='$user' and lead_id='$lead_id' $group_SQL";
|
||||
if ($DB) {$ASCII_text.="$sale_time_stmt\n";}
|
||||
$sale_time_rslt=mysql_to_mysqli($sale_time_stmt, $link);
|
||||
$sale_time_row=mysqli_fetch_row($sale_time_rslt);
|
||||
$sales_talk_time_array[$row["user"]]+=$sale_time_row[0];
|
||||
# Get actual talk time for all calls made by the user for this particular lead. If cancelled and incomplete sales are to have their times
|
||||
# counted towards sales talk time, move the below lines OUTSIDE the curly bracket below, so the query runs regardless of what "type" of
|
||||
# sale it is.
|
||||
$sale_time_stmt="select sum(talk_sec)-sum(dead_sec) from ".$vicidial_agent_log_table." where user='$user' and lead_id='$lead_id' $group_SQL";
|
||||
if ($DB) {$ASCII_text.="$sale_time_stmt\n";}
|
||||
$sale_time_rslt=mysql_to_mysqli($sale_time_stmt, $link);
|
||||
$sale_time_row=mysqli_fetch_row($sale_time_rslt);
|
||||
$sales_talk_time_array[$row["user"]]+=$sale_time_row[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -827,7 +845,7 @@ if ( ($SUBMIT=="SUBMIT") or ($SUBMIT==_QXZ("SUBMIT")) )
|
||||
if ($contacts>0) {$average_contact_time=sec_convert(round(MathZDC($contact_talk_time, $contacts)), 'H');} else {$average_contact_time="00:00";}
|
||||
|
||||
$ASCII_text.="| ".sprintf("%-40s", $user_row["full_name"]);
|
||||
$ASCII_text.=" | <a href='user_stats.php?user=$user&begin_date=$query_date_D&end_date=$end_date_D'>".sprintf("%10s", "$user")."</a>";
|
||||
$ASCII_text.=" | <a href='user_stats.php?user=$user&begin_date=$query_date_D&end_date=$end_date_D'>".sprintf("%10s", substr("$user", 0, 10))."</a>";
|
||||
$ASCII_text.=" | ".sprintf("%5s", $calls); $group_calls+=$calls;
|
||||
$ASCII_text.=" | ".sprintf("%5s", $leads); $group_leads+=$leads;
|
||||
$ASCII_text.=" | ".sprintf("%8s", $contacts); $group_contacts+=$contacts;
|
||||
|
||||
Reference in New Issue
Block a user