From f7f9dbff54faf6f1e52458083f011a9386dc2e5b Mon Sep 17 00:00:00 2001 From: mattf Date: Thu, 19 Jul 2012 18:16:31 +0000 Subject: [PATCH] Added percentages to Agent Time Detail report Fixed small issue with fcstats.php report git-svn-id: svn://192.168.202.10@1842 3d104415-ff17-0410-8863-d5cf3c621b8a --- .../www/vicidial/AST_agent_time_detail.php | 80 +++++++++++++++---- agc_2-X/trunk/www/vicidial/fcstats.php | 2 +- 2 files changed, 67 insertions(+), 15 deletions(-) diff --git a/agc_2-X/trunk/www/vicidial/AST_agent_time_detail.php b/agc_2-X/trunk/www/vicidial/AST_agent_time_detail.php index 0a44187d..6a140092 100644 --- a/agc_2-X/trunk/www/vicidial/AST_agent_time_detail.php +++ b/agc_2-X/trunk/www/vicidial/AST_agent_time_detail.php @@ -392,17 +392,21 @@ else $max_dead=1; $max_customer=1; $GRAPH=""; - $GRAPH2=""; + $GRAPH2=""; $graph_header="
CALLSTIME CLOCKAGENT TIMEWAITTALKTALKTIME%DISPOPAUSEDEADCUSTOMER
CALLSTIME CLOCKAGENT TIMEWAITWAIT %TALKTALKTIME%DISPODISPOTIME%PAUSEPAUSETIME%DEADDEADTIME%CUSTOMER
"; $CALLS_graph=$graph_header.""; $TIMECLOCK_graph=$graph_header.""; $AGENTTIME_graph=$graph_header.""; $WAIT_graph=$graph_header.""; + $WAITPCT_graph=$graph_header.""; $TALK_graph=$graph_header.""; $TALKPCT_graph=$graph_header.""; $DISPO_graph=$graph_header.""; + $DISPOPCT_graph=$graph_header.""; $PAUSE_graph=$graph_header.""; + $PAUSEPCT_graph=$graph_header.""; $DEAD_graph=$graph_header.""; + $DEADPCT_graph=$graph_header.""; $CUSTOMER_graph=$graph_header.""; while ($i < $users_to_print) @@ -570,15 +574,15 @@ else if ($file_download < 1) { $ASCII_text.="AGENT TIME BREAKDOWN:\n"; - $ASCII_text.="+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n"; - $ASCII_text.="| USER NAME | ID | CALLS | TIME CLOCK | AGENT TIME | WAIT | TALK | TALK TIME %| DISPO | PAUSE | DEAD | CUSTOMER | |$sub_statusesHTML\n"; - $ASCII_text.="+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n"; + $ASCII_text.="+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n"; + $ASCII_text.="| USER NAME | ID | CALLS | TIME CLOCK | AGENT TIME | WAIT | WAIT % | TALK | TALK TIME %| DISPO | DISPOTIME %| PAUSE | PAUSETIME %| DEAD | DEAD TIME %| CUSTOMER | |$sub_statusesHTML\n"; + $ASCII_text.="+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n"; } else { - $file_output .= "USER,ID,CALLS,TIME CLOCK,AGENT TIME,WAIT,TALK,TALK TIME %,DISPO,PAUSE,DEAD,CUSTOMER$sub_statusesFILE\n"; + $file_output .= "USER,ID,CALLS,TIME CLOCK,AGENT TIME,WAIT,WAIT %,TALK,TALK TIME %,DISPO,DISPO TIME %,PAUSE,PAUSE TIME %,DEAD,DEAD TIME %,CUSTOMER$sub_statusesFILE\n"; } ##### END print the output to screen or put into file output variable @@ -598,7 +602,11 @@ else $SstatusesHTML=''; $SstatusesFILE=''; $Stime[$m] = ($Swait[$m] + $Stalk[$m] + $Sdispo[$m] + $Spause[$m]); + $Swaitpct[$m]=(100*$Swait[$m]/$Stime[$m]); $Stalkpct[$m]=(100*$Stalk[$m]/$Stime[$m]); + $Sdispopct[$m]=(100*$Sdispo[$m]/$Stime[$m]); + $Spausepct[$m]=(100*$Spause[$m]/$Stime[$m]); + $Sdeadpct[$m]=(100*$Sdead[$m]/$Stime[$m]); $RAWuser = $Suser[$m]; $RAWcalls = $Scalls[$m]; $RAWtimeSEC = $Stime[$m]; @@ -611,7 +619,11 @@ else if (trim($Spause[$m])>$max_pause) {$max_pause=trim($Spause[$m]);} if (trim($Sdead[$m])>$max_dead) {$max_dead=trim($Sdead[$m]);} if (trim($Scustomer[$m])>$max_customer) {$max_customer=trim($Scustomer[$m]);} + if (trim($Swaitpct[$m])>$max_waitpct) {$max_waitpct=trim($Swaitpct[$m]);} if (trim($Stalkpct[$m])>$max_talkpct) {$max_talkpct=trim($Stalkpct[$m]);} + if (trim($Sdispopct[$m])>$max_dispopct) {$max_dispopct=trim($Sdispopct[$m]);} + if (trim($Spausepct[$m])>$max_pausepct) {$max_pausepct=trim($Spausepct[$m]);} + if (trim($Sdeadpct[$m])>$max_deadpct) {$max_deadpct=trim($Sdeadpct[$m]);} $graph_stats[$m][1]=trim($Scalls[$m]); $graph_stats[$m][3]=trim($Stime[$m]); $graph_stats[$m][4]=trim($Swait[$m]); @@ -621,8 +633,16 @@ else $graph_stats[$m][8]=trim($Sdead[$m]); $graph_stats[$m][9]=trim($Scustomer[$m]); $graph_stats[$m][10]=trim(sprintf("%01.2f", $Stalkpct[$m])); + $graph_stats[$m][11]=trim(sprintf("%01.2f", $Sdispopct[$m])); + $graph_stats[$m][12]=trim(sprintf("%01.2f", $Spausepct[$m])); + $graph_stats[$m][13]=trim(sprintf("%01.2f", $Sdeadpct[$m])); + $graph_stats[$m][14]=trim(sprintf("%01.2f", $Swaitpct[$m])); + $Swaitpct[$m]= sprintf("%01.2f", $Swaitpct[$m]); $Stalkpct[$m]= sprintf("%01.2f", $Stalkpct[$m]); + $Sdispopct[$m]= sprintf("%01.2f", $Sdispopct[$m]); + $Spausepct[$m]= sprintf("%01.2f", $Spausepct[$m]); + $Sdeadpct[$m]= sprintf("%01.2f", $Sdeadpct[$m]); $Swait[$m]= sec_convert($Swait[$m],$TIME_agenttimedetail); $Stalk[$m]= sec_convert($Stalk[$m],$TIME_agenttimedetail); $Sdispo[$m]= sec_convert($Sdispo[$m],$TIME_agenttimedetail); @@ -638,7 +658,11 @@ else $RAWpause = $Spause[$m]; $RAWdead = $Sdead[$m]; $RAWcustomer = $Scustomer[$m]; + $RAWwaitpct = $Swaitpct[$m]; $RAWtalkpct = $Stalkpct[$m]; + $RAWdispopct = $Sdispopct[$m]; + $RAWpausepct = $Spausepct[$m]; + $RAWdeadpct = $Sdeadpct[$m]; $n=0; $user_name_found=0; @@ -753,7 +777,11 @@ else } ### END loop through each status ### + $Swaitpct[$m]= sprintf("%9s", $Swaitpct[$m])."%"; $Stalkpct[$m]= sprintf("%9s", $Stalkpct[$m])."%"; + $Sdispopct[$m]= sprintf("%9s", $Sdispopct[$m])."%"; + $Spausepct[$m]= sprintf("%9s", $Spausepct[$m])."%"; + $Sdeadpct[$m]= sprintf("%9s", $Sdeadpct[$m])."%"; $Swait[$m]= sprintf("%10s", $Swait[$m]); $Stalk[$m]= sprintf("%10s", $Stalk[$m]); $Sdispo[$m]= sprintf("%10s", $Sdispo[$m]); @@ -781,7 +809,7 @@ else if ($file_download < 1) { - $Toutput = "| $Sname[$m] | $Suser[$m] | $Scalls[$m] | $StimeTC[$m]$TCuserAUTOLOGOUT| $Stime[$m] | $Swait[$m] | $Stalk[$m] | $Stalkpct[$m] | $Sdispo[$m] | $Spause[$m] | $Sdead[$m] | $Scustomer[$m] | |$SstatusesHTML\n"; + $Toutput = "| $Sname[$m] | $Suser[$m] | $Scalls[$m] | $StimeTC[$m]$TCuserAUTOLOGOUT| $Stime[$m] | $Swait[$m] | $Swaitpct[$m] | $Stalk[$m] | $Stalkpct[$m] | $Sdispo[$m] | $Sdispopct[$m] | $Spause[$m] | $Spausepct[$m] | $Sdead[$m] | $Sdeadpct[$m] | $Scustomer[$m] | |$SstatusesHTML\n"; $graph_stats[$m][0]=trim("$Suser[$m] - $Sname[$m]"); #CALLS | TIME CLOCK | AGENT TIME | WAIT | TALK | DISPO | PAUSE | DEAD | CUSTOMER | | LOGIN | TRAIN | TOILET | PRECAL | BREAK | | LUNCH | LAGGED } @@ -789,13 +817,17 @@ else { if (strlen($RAWtime)<1) {$RAWtime='0';} if (strlen($RAWwait)<1) {$RAWwait='0';} + if (strlen($RAWwaitpct)<0) {$RAWwaitpct='0.0%';} if (strlen($RAWtalk)<1) {$RAWtalk='0';} if (strlen($RAWtalkpct)<0) {$RAWtalkpct='0.0%';} if (strlen($RAWdispo)<1) {$RAWdispo='0';} + if (strlen($RAWdispopct)<0) {$RAWdispopct='0.0%';} if (strlen($RAWpause)<1) {$RAWpause='0';} + if (strlen($RAWpausepct)<0) {$RAWpausepct='0.0%';} if (strlen($RAWdead)<1) {$RAWdead='0';} + if (strlen($RAWdeadpct)<0) {$RAWdeadpct='0.0%';} if (strlen($RAWcustomer)<1) {$RAWcustomer='0';} - $fileToutput = "$RAWname,$RAWuser,$RAWcalls,$RAWtimeTC,$RAWtime,$RAWwait,$RAWtalk,$RAWtalkpct %,$RAWdispo,$RAWpause,$RAWdead,$RAWcustomer$SstatusesFILE\n"; + $fileToutput = "$RAWname,$RAWuser,$RAWcalls,$RAWtimeTC,$RAWtime,$RAWwait,$RAWwaitpct %,$RAWtalk,$RAWtalkpct %,$RAWdispo,$RAWdispopct %,$RAWpause,$RAWpausepct %,$RAWdead,$RAWdeadpct %,$RAWcustomer$SstatusesFILE\n"; } $TOPsorted_output[$m] = $Toutput; @@ -926,7 +958,11 @@ else ### END loop through each status ### ### call function to calculate and print dialable leads + $TOTwaitpct=sprintf("%01.2f", (100*$TOTwait/$TOTALtime)); $TOTtalkpct=sprintf("%01.2f", (100*$TOTtalk/$TOTALtime)); + $TOTdispopct=sprintf("%01.2f", (100*$TOTdispo/$TOTALtime)); + $TOTpausepct=sprintf("%01.2f", (100*$TOTpause/$TOTALtime)); + $TOTdeadpct=sprintf("%01.2f", (100*$TOTdead/$TOTALtime)); $TOTwait = sec_convert($TOTwait,$TIME_agenttimedetail); $TOTtalk = sec_convert($TOTtalk,$TIME_agenttimedetail); $TOTdispo = sec_convert($TOTdispo,$TIME_agenttimedetail); @@ -936,7 +972,11 @@ else $TOTALtime = sec_convert($TOTALtime,$TIME_agenttimedetail); $TOTtimeTC = sec_convert($TOTtimeTC,$TIME_agenttimedetail); + $hTOTwaitpct = sprintf("%10s", $TOTwaitpct)."%"; $hTOTtalkpct = sprintf("%10s", $TOTtalkpct)."%"; + $hTOTdispopct = sprintf("%10s", $TOTdispopct)."%"; + $hTOTpausepct = sprintf("%10s", $TOTpausepct)."%"; + $hTOTdeadpct = sprintf("%10s", $TOTdeadpct)."%"; $hTOTcalls = sprintf("%8s", $TOTcalls); $hTOTwait = sprintf("%11s", $TOTwait); $hTOTtalk = sprintf("%11s", $TOTtalk); @@ -952,9 +992,9 @@ else if ($file_download < 1) { - $ASCII_text.="+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n"; - $ASCII_text.="| TOTALS AGENTS:$hTOT_AGENTS | $hTOTcalls |$hTOTtimeTC |$hTOTALtime |$hTOTwait |$hTOTtalk |$hTOTtalkpct |$hTOTdispo |$hTOTpause |$hTOTdead |$hTOTcustomer | |$SUMstatusesHTML\n"; - $ASCII_text.="+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n"; + $ASCII_text.="+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n"; + $ASCII_text.="| TOTALS AGENTS:$hTOT_AGENTS | $hTOTcalls |$hTOTtimeTC |$hTOTALtime |$hTOTwait |$hTOTwaitpct |$hTOTtalk |$hTOTtalkpct |$hTOTdispo |$hTOTdispopct |$hTOTpause |$hTOTpausepct |$hTOTdead |$hTOTdeadpct |$hTOTcustomer | |$SUMstatusesHTML\n"; + $ASCII_text.="+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n"; if ($AUTOLOGOUTflag > 0) {echo " * denotes AUTOLOGOUT from timeclock\n";} $ASCII_text.="\n\n"; @@ -963,7 +1003,7 @@ else $Sstatus=$sub_statusesARY[$e]; $SstatusTXT=$Sstatus; if ($Sstatus=="") {$SstatusTXT="(blank)";} - $GRAPH2.=""; + $GRAPH2.=""; } for ($d=0; $d"; $CUSTOMER_graph.=" "; $TALKPCT_graph.=" "; + $DISPOPCT_graph.=" "; + $PAUSEPCT_graph.=" "; + $DEADPCT_graph.=" "; + $WAITPCT_graph.=" "; for ($e=0; $e
AGENT TIME BREAKDOWN
STATUSCALLS
TIME CLOCK
AGENT TIME
WAIT
WAIT %
TALK
TALK TIME %
DISPO
DISPO TIME %
PAUSE
PAUSE TIME %
DEAD
DEAD TIME %
CUSTOMER
$SstatusTXT$SstatusTXT".sec_convert($graph_stats[$d][8], 'HF')."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][9], 'HF')."
".$graph_stats[$d][0]."".$graph_stats[$d][10]." %
".$graph_stats[$d][0]."".$graph_stats[$d][11]." %
".$graph_stats[$d][0]."".$graph_stats[$d][12]." %
".$graph_stats[$d][0]."".$graph_stats[$d][13]." %
".$graph_stats[$d][0]."".$graph_stats[$d][14]." %
"; $DEAD_graph.="TOTAL:".trim($hTOTdead).""; $CUSTOMER_graph.="TOTAL:".trim($hTOTcustomer).""; + $WAITPCT_graph.="AVERAGE:".trim($hTOTwaitpct).""; $TALKPCT_graph.="AVERAGE:".trim($hTOTtalkpct).""; + $DISPOPCT_graph.="AVERAGE:".trim($hTOTdispopct).""; + $PAUSEPCT_graph.="AVERAGE:".trim($hTOTpausepct).""; + $DEADPCT_graph.="AVERAGE:".trim($hTOTdeadpct).""; for ($e=0; $e
 


"; + $GRAPH3="
 


"; # echo $GRAPH.$GRAPH2.$GRAPH3.$max; } else { - $file_output .= "TOTALS,$TOT_AGENTS,$TOTcalls,$TOTtimeTC,$TOTALtime,$TOTwait,$TOTtalk,$TOTtalkpct %,$TOTdispo,$TOTpause,$TOTdead,$TOTcustomer$SUMstatusesFILE\n"; + $file_output .= "TOTALS,$TOT_AGENTS,$TOTcalls,$TOTtimeTC,$TOTALtime,$TOTwait,$TOTwaitpct %,$TOTtalk,$TOTtalkpct %,$TOTdispo,$TOTpause,$TOTdead,$TOTcustomer$SUMstatusesFILE\n"; } } diff --git a/agc_2-X/trunk/www/vicidial/fcstats.php b/agc_2-X/trunk/www/vicidial/fcstats.php index 55d9c7d1..aa173a56 100644 --- a/agc_2-X/trunk/www/vicidial/fcstats.php +++ b/agc_2-X/trunk/www/vicidial/fcstats.php @@ -424,7 +424,7 @@ while ($i < $users_to_print) { $row=mysql_fetch_row($rslt); $recL=0; - if ( ($row[0]=='SALE') and ($recL < 1) ) {$A1=$row[1]; $recL++; $sales=($sales + $row[1]);} + if ( (preg_match("/\|$row[0]\|/", $sale_dispo_str)) and ($recL < 1) ) {$A1=$row[1]; $recL++; $sales=($sales + $row[1]);} # if ( ($row[0]=='A2') and ($recL < 1) ) {$A2=$row[1]; $recL++; $sales=($sales + $row[1]);} # if ( ($row[0]=='A3') and ($recL < 1) ) {$A3=$row[1]; $recL++; $sales=($sales + $row[1]);} # if ( ($row[0]=='A4') and ($recL < 1) ) {$A4=$row[1]; $recL++; $sales=($sales + $row[1]);}