From 7c5ead0315aba1350128adf05a6c3f9e5d8772ac Mon Sep 17 00:00:00 2001 From: mattf Date: Tue, 26 Jan 2010 15:06:15 +0000 Subject: [PATCH] fixed SO call route issue added DID stats display to user_stats.php script git-svn-id: svn://192.168.202.10@1318 3d104415-ff17-0410-8863-d5cf3c621b8a --- agi/agi-DID_route.agi | 2 +- agi/agi-VDAD_ALL_inbound.agi | 4 +- .../TO_BE_TRANSLATED_2.4.txt | 21 + www/vicidial/admin.php | 1 + www/vicidial/user_stats.php | 721 ++++++++++-------- 5 files changed, 418 insertions(+), 331 deletions(-) create mode 100644 translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt diff --git a/agi/agi-DID_route.agi b/agi/agi-DID_route.agi index a1755952..4d988355 100644 --- a/agi/agi-DID_route.agi +++ b/agi/agi-DID_route.agi @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# agi-DID_route.agi version 2.4y +# agi-DID_route.agi version 2.4 # # runs when a call comes into an inbound context on a trunk. This script will # send the calls to various places depending on the settings for each DID. diff --git a/agi/agi-VDAD_ALL_inbound.agi b/agi/agi-VDAD_ALL_inbound.agi index dd271275..796b5366 100644 --- a/agi/agi-VDAD_ALL_inbound.agi +++ b/agi/agi-VDAD_ALL_inbound.agi @@ -1497,11 +1497,11 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) ) ################################################################ ##### Attempt to send call to an agent on this server only ##### + if ($agent_search_method =~ /^SO/) + {$agent_search_method = 'LO';} if ( ($agent_search_method =~ /^SO|^LO/) && ($skipLOSO < 1) ) { - if ($agent_search_method =~ /^SO/) - {$agent_search_method = 'LO';} ### Get count of number of calls in this group that are ahead of this call $stmtA = "SELECT count(*) FROM vicidial_auto_calls where status = 'LIVE' and server_ip='$VARserver_ip' and campaign_id = '$channel_group' and call_time < \"$SQLdateBEGIN\" and lead_id != '$insert_lead_id';"; if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} diff --git a/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt b/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt new file mode 100644 index 00000000..c5d7f6c1 --- /dev/null +++ b/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt @@ -0,0 +1,21 @@ +############################################################ ADMIN +All users in the system, even not logged-in users|| +The NOT-LOGGED-IN-AGENTS option allows all users in the system to be displayed, even if they are not logged-in curently|| +Voicemail ID|| +This is the voicemail box that calls will be directed to in an AGENTDIRECT in-group at the drop time if the in-group has the drop method set to VOICEMAIL and the Voicemail field set to AGENTVMAIL|| +In an AGENTDIRECT in-group, setting this to AGENTVMAIL will select the User voicemail ID to use|| +Record Call|| +This option allows you to set the calls coming into this DID to be recorded. Y will record the entire call, Y_QUEUESTOP will record the call until the call is hungup or enters an in-group queue, N will not record the call. Default is N.|| +Click here to see a list of recordings and calls for this DID|| + + +############################################################ CLIENT + + + +############################################################ MANAGER Manual + + + +############################################################ AGENT Manual + diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php index 84a49878..70233c51 100644 --- a/www/vicidial/admin.php +++ b/www/vicidial/admin.php @@ -20038,6 +20038,7 @@ if ($ADD==3311) echo "

\n"; echo "
Click here to see a traffic report for this DID
\n"; + echo "
Click here to see a list of recordings and calls for this DID
\n"; if ($LOGdelete_dids > 0) { diff --git a/www/vicidial/user_stats.php b/www/vicidial/user_stats.php index cb93bce7..6f98b253 100644 --- a/www/vicidial/user_stats.php +++ b/www/vicidial/user_stats.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2010 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -20,6 +20,7 @@ # 90508-0644 - Changed to PHP long tags # 90524-2009 - Changed time display to use functions.php # 91130-2037 - Added user closer log manager flag display +# 100126-0847 - Added DID log display options # header ("Content-type: text/html; charset=utf-8"); @@ -46,6 +47,10 @@ if ($ss_conf_ct > 0) $PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; $PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; $PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["did_id"])) {$did_id=$_GET["did_id"];} + elseif (isset($_POST["did_id"])) {$did_id=$_POST["did_id"];} +if (isset($_GET["did"])) {$did=$_GET["did"];} + elseif (isset($_POST["did"])) {$did=$_POST["did"];} if (isset($_GET["begin_date"])) {$begin_date=$_GET["begin_date"];} elseif (isset($_POST["begin_date"])) {$begin_date=$_POST["begin_date"];} if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];} @@ -109,10 +114,20 @@ else exit; } - $stmt="SELECT full_name from vicidial_users where user='$user';"; - $rslt=mysql_query($stmt, $link); - $row=mysql_fetch_row($rslt); - $full_name = $row[0]; + if ($did > 0) + { + $stmt="SELECT did_description from vicidial_inbound_dids where did_pattern='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + } + else + { + $stmt="SELECT full_name from vicidial_users where user='$user';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $full_name = $row[0]; + } } @@ -122,9 +137,14 @@ else -ADMINISTRATION: User Stats <?php +if ($did > 0) + {echo "<title>ADMINISTRATION: DID Call Stats";} +else + {echo "<title>ADMINISTRATION: User Stats";} + + ##### BEGIN Set variables to make header show properly ##### $ADD = '3'; @@ -142,6 +162,14 @@ $users_color = '#FFFF99'; $users_font = 'BLACK'; $users_color = '#E6E6E6'; $subcamp_color = '#C6C6C6'; +if ($did > 0) + { + $hh = 'ingroups'; + $ADD = '3311'; + $ingroups_color = '#FFFF99'; + $ingroups_font = 'BLACK'; + $ingroups_color = '#E6E6E6'; + } ##### END Set variables to make header show properly ##### require("admin_header.php"); @@ -149,17 +177,25 @@ require("admin_header.php"); ?> -<TABLE WIDTH=770 BGCOLOR=#E6E6E6 cellpadding=2 cellspacing=0><TR BGCOLOR=#E6E6E6><TD ALIGN=LEFT><FONT FACE="ARIAL,HELVETICA" SIZE=2><B>   User Stats for <?php echo $user ?></TD><TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA" SIZE=2>   </TD></TR> - - - - +<TABLE WIDTH=770 BGCOLOR=#E6E6E6 cellpadding=2 cellspacing=0><TR BGCOLOR=#E6E6E6><TD ALIGN=LEFT><FONT FACE="ARIAL,HELVETICA" SIZE=2> <?php +if ($did > 0) + {echo "<B>   DID Call Stats for $user";} +else + {echo "<B>   User Stats for $user";} + +?> +</TD><TD ALIGN=RIGHT><FONT FACE="ARIAL,HELVETICA" SIZE=2>   </TD></TR> +<?php + + echo "<TR BGCOLOR=\"#F0F5FE\"><TD ALIGN=LEFT COLSPAN=2><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2><B>   \n"; echo "<form action=$PHP_SELF method=POST>\n"; echo "<input type=hidden name=DB value=\"$DB\">\n"; +echo "<input type=hidden name=did_id value=\"$did_id\">\n"; +echo "<input type=hidden name=did value=\"$did\">\n"; echo "<input type=text name=begin_date value=\"$begin_date\" size=10 maxsize=10> to \n"; echo "<input type=text name=end_date value=\"$end_date\" size=10 maxsize=10>  \n"; if (strlen($user)>1) @@ -172,10 +208,18 @@ echo "<input type=submit name=submit value=submit>\n"; echo "           $user - $full_name<BR><BR>\n"; echo "<center>\n"; -echo "<a href=\"./AST_agent_time_sheet.php?agent=$user\">Agent Time Sheet</a>\n"; -echo " | <a href=\"./user_status.php?user=$user\">User Status</a>\n"; -echo " | <a href=\"./admin.php?ADD=3&user=$user\">Modify User</a>\n"; -echo " | <a href=\"./AST_agent_days_detail.php?user=$user&query_date=$begin_date&end_date=$end_date&group[]=--ALL--&shift=ALL\">User multiple day status detail report</a>"; +if ($did > 0) + { + echo "<a href=\"./AST_DIDstats.php?group[0]=$did_id\">DID traffic report</a>\n"; + echo " | <a href=\"./admin.php?ADD=33111&did_id=$did_id\">Modify DID</a>\n"; + } +else + { + echo "<a href=\"./AST_agent_time_sheet.php?agent=$user\">Agent Time Sheet</a>\n"; + echo " | <a href=\"./user_status.php?user=$user\">User Status</a>\n"; + echo " | <a href=\"./admin.php?ADD=3&user=$user\">Modify User</a>\n"; + echo " | <a href=\"./AST_agent_days_detail.php?user=$user&query_date=$begin_date&end_date=$end_date&group[]=--ALL--&shift=ALL\">User multiple day status detail report</a>"; + } echo "</center>\n"; @@ -184,324 +228,326 @@ echo "<TR><TD ALIGN=LEFT COLSPAN=2>\n"; echo "<br><center>\n"; -##### vicidial agent talk time and status ##### -echo "<B>AGENT TALK TIME AND STATUS:</B>\n"; - -echo "<center><TABLE width=300 cellspacing=0 cellpadding=1>\n"; -echo "<tr><td><font size=2>STATUS</td><td align=right><font size=2>COUNT</td><td align=right><font size=2>HOURS:MM:SS</td></tr>\n"; - -$stmt="SELECT count(*),status, sum(length_in_sec) from vicidial_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' group by status order by status"; -$rslt=mysql_query($stmt, $link); -$VLstatuses_to_print = mysql_num_rows($rslt); -$total_calls=0; -$o=0; $p=0; -while ($VLstatuses_to_print > $o) +if ($did < 1) { - $row=mysql_fetch_row($rslt); - $counts[$p] = $row[0]; - $status[$p] = $row[1]; - $call_sec[$p] = $row[2]; - $p++; - $o++; - } + ##### vicidial agent talk time and status ##### + echo "<B>AGENT TALK TIME AND STATUS:</B>\n"; -$stmt="SELECT count(*),status, sum(length_in_sec) from vicidial_closer_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' group by status order by status"; -$rslt=mysql_query($stmt, $link); -$VCLstatuses_to_print = mysql_num_rows($rslt); -$o=0; -while ($VCLstatuses_to_print > $o) - { - $status_match=0; - $r=0; - $row=mysql_fetch_row($rslt); - while ($VLstatuses_to_print > $r) - { - if ($status[$r] == $row[1]) - { - $counts[$r] = ($counts[$r] + $row[0]); - $call_sec[$r] = ($call_sec[$r] + $row[2]); - $status_match++; - } - $r++; - } - if ($status_match < 1) + echo "<center><TABLE width=300 cellspacing=0 cellpadding=1>\n"; + echo "<tr><td><font size=2>STATUS</td><td align=right><font size=2>COUNT</td><td align=right><font size=2>HOURS:MM:SS</td></tr>\n"; + + $stmt="SELECT count(*),status, sum(length_in_sec) from vicidial_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' group by status order by status"; + $rslt=mysql_query($stmt, $link); + $VLstatuses_to_print = mysql_num_rows($rslt); + $total_calls=0; + $o=0; $p=0; + while ($VLstatuses_to_print > $o) { + $row=mysql_fetch_row($rslt); $counts[$p] = $row[0]; $status[$p] = $row[1]; $call_sec[$p] = $row[2]; - $VLstatuses_to_print++; $p++; + $o++; } - $o++; - } -$o=0; -$total_sec=0; -while ($o < $p) - { - if (eregi("1$|3$|5$|7$|9$", $o)) - {$bgcolor='bgcolor="#B9CBFD"';} - else - {$bgcolor='bgcolor="#9BB9FB"';} - - $call_hours_minutes = sec_convert($call_sec[$o],'H'); - - echo "<tr $bgcolor><td><font size=2>$status[$o]</td>"; - echo "<td align=right><font size=2> $counts[$o]</td>\n"; - echo "<td align=right><font size=2> $call_hours_minutes</td></tr>\n"; - $total_calls = ($total_calls + $counts[$o]); - $total_sec = ($total_sec + $call_sec[$o]); - $call_seconds=0; - $o++; - } - -$call_hours_minutes = sec_convert($total_sec,'H'); - -echo "<tr><td><font size=2>TOTAL CALLS </td><td align=right><font size=2> $total_calls</td><td align=right><font size=2> $call_hours_minutes</td></tr>\n"; -echo "</TABLE></center>\n"; - - -##### Login and Logout time from vicidial agent interface ##### - -echo "<br><br>\n"; - -echo "<center>\n"; - -echo "<B>AGENT LOGIN/LOGOUT TIME:</B>\n"; -echo "<TABLE width=500 cellspacing=0 cellpadding=1>\n"; -echo "<tr><td><font size=2>EVENT </td><td align=right><font size=2> DATE</td><td align=right><font size=2> CAMPAIGN</td><td align=right><font size=2> GROUP</td><td align=right><font size=2>HOURS:MM:SS</td></tr>\n"; - - $stmt="SELECT event,event_epoch,event_date,campaign_id,user_group from vicidial_user_log where user='" . mysql_real_escape_string($user) . "' and event_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and event_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59'"; + $stmt="SELECT count(*),status, sum(length_in_sec) from vicidial_closer_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' group by status order by status"; $rslt=mysql_query($stmt, $link); - $events_to_print = mysql_num_rows($rslt); - - $total_calls=0; + $VCLstatuses_to_print = mysql_num_rows($rslt); $o=0; - $event_start_seconds=''; - $event_stop_seconds=''; - while ($events_to_print > $o) { + while ($VCLstatuses_to_print > $o) + { + $status_match=0; + $r=0; $row=mysql_fetch_row($rslt); - if (eregi("LOGIN", $row[0])) + while ($VLstatuses_to_print > $r) + { + if ($status[$r] == $row[1]) + { + $counts[$r] = ($counts[$r] + $row[0]); + $call_sec[$r] = ($call_sec[$r] + $row[2]); + $status_match++; + } + $r++; + } + if ($status_match < 1) + { + $counts[$p] = $row[0]; + $status[$p] = $row[1]; + $call_sec[$p] = $row[2]; + $VLstatuses_to_print++; + $p++; + } + $o++; + } + + $o=0; + $total_sec=0; + while ($o < $p) + { + if (eregi("1$|3$|5$|7$|9$", $o)) {$bgcolor='bgcolor="#B9CBFD"';} else {$bgcolor='bgcolor="#9BB9FB"';} - if (ereg("LOGIN", $row[0])) - { - $event_start_seconds = $row[1]; - echo "<tr $bgcolor><td><font size=2>$row[0]</td>"; - echo "<td align=right><font size=2> $row[2]</td>\n"; - echo "<td align=right><font size=2> $row[3]</td>\n"; - echo "<td align=right><font size=2> $row[4]</td>\n"; - echo "<td align=right><font size=2> </td></tr>\n"; - } - if (ereg("LOGOUT", $row[0])) - { - if ($event_start_seconds) + $call_hours_minutes = sec_convert($call_sec[$o],'H'); + + echo "<tr $bgcolor><td><font size=2>$status[$o]</td>"; + echo "<td align=right><font size=2> $counts[$o]</td>\n"; + echo "<td align=right><font size=2> $call_hours_minutes</td></tr>\n"; + $total_calls = ($total_calls + $counts[$o]); + $total_sec = ($total_sec + $call_sec[$o]); + $call_seconds=0; + $o++; + } + + $call_hours_minutes = sec_convert($total_sec,'H'); + + echo "<tr><td><font size=2>TOTAL CALLS </td><td align=right><font size=2> $total_calls</td><td align=right><font size=2> $call_hours_minutes</td></tr>\n"; + echo "</TABLE></center>\n"; + + + ##### Login and Logout time from vicidial agent interface ##### + + echo "<br><br>\n"; + + echo "<center>\n"; + + echo "<B>AGENT LOGIN/LOGOUT TIME:</B>\n"; + echo "<TABLE width=500 cellspacing=0 cellpadding=1>\n"; + echo "<tr><td><font size=2>EVENT </td><td align=right><font size=2> DATE</td><td align=right><font size=2> CAMPAIGN</td><td align=right><font size=2> GROUP</td><td align=right><font size=2>HOURS:MM:SS</td></tr>\n"; + + $stmt="SELECT event,event_epoch,event_date,campaign_id,user_group from vicidial_user_log where user='" . mysql_real_escape_string($user) . "' and event_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and event_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59'"; + $rslt=mysql_query($stmt, $link); + $events_to_print = mysql_num_rows($rslt); + + $total_calls=0; + $o=0; + $event_start_seconds=''; + $event_stop_seconds=''; + while ($events_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("LOGIN", $row[0])) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if (ereg("LOGIN", $row[0])) { - - $event_stop_seconds = $row[1]; - $event_seconds = ($event_stop_seconds - $event_start_seconds); - $total_login_time = ($total_login_time + $event_seconds); - $event_hours_minutes = sec_convert($event_seconds,'H'); - + $event_start_seconds = $row[1]; echo "<tr $bgcolor><td><font size=2>$row[0]</td>"; echo "<td align=right><font size=2> $row[2]</td>\n"; echo "<td align=right><font size=2> $row[3]</td>\n"; echo "<td align=right><font size=2> $row[4]</td>\n"; - echo "<td align=right><font size=2> $event_hours_minutes</td></tr>\n"; - $event_start_seconds=''; - $event_stop_seconds=''; - } - else - { - echo "<tr $bgcolor><td><font size=2>$row[0]</td>"; - echo "<td align=right><font size=2> $row[2]</td>\n"; - echo "<td align=right><font size=2> $row[3]</td>\n"; echo "<td align=right><font size=2> </td></tr>\n"; } - } + if (ereg("LOGOUT", $row[0])) + { + if ($event_start_seconds) + { - $total_calls = ($total_calls + $row[0]); + $event_stop_seconds = $row[1]; + $event_seconds = ($event_stop_seconds - $event_start_seconds); + $total_login_time = ($total_login_time + $event_seconds); + $event_hours_minutes = sec_convert($event_seconds,'H'); - $call_seconds=0; - $o++; - } + echo "<tr $bgcolor><td><font size=2>$row[0]</td>"; + echo "<td align=right><font size=2> $row[2]</td>\n"; + echo "<td align=right><font size=2> $row[3]</td>\n"; + echo "<td align=right><font size=2> $row[4]</td>\n"; + echo "<td align=right><font size=2> $event_hours_minutes</td></tr>\n"; + $event_start_seconds=''; + $event_stop_seconds=''; + } + else + { + echo "<tr $bgcolor><td><font size=2>$row[0]</td>"; + echo "<td align=right><font size=2> $row[2]</td>\n"; + echo "<td align=right><font size=2> $row[3]</td>\n"; + echo "<td align=right><font size=2> </td></tr>\n"; + } + } -$total_login_hours_minutes = sec_convert($total_login_time,'H'); + $total_calls = ($total_calls + $row[0]); -echo "<tr><td><font size=2>TOTAL</td>"; -echo "<td align=right><font size=2> </td>\n"; -echo "<td align=right><font size=2> </td>\n"; -echo "<td align=right><font size=2> </td>\n"; -echo "<td align=right><font size=2> $total_login_hours_minutes</td></tr>\n"; + $call_seconds=0; + $o++; + } -echo "</TABLE></center>\n"; + $total_login_hours_minutes = sec_convert($total_login_time,'H'); + + echo "<tr><td><font size=2>TOTAL</td>"; + echo "<td align=right><font size=2> </td>\n"; + echo "<td align=right><font size=2> </td>\n"; + echo "<td align=right><font size=2> </td>\n"; + echo "<td align=right><font size=2> $total_login_hours_minutes</td></tr>\n"; + + echo "</TABLE></center>\n"; -##### vicidial_timeclock log records for user ##### + ##### vicidial_timeclock log records for user ##### -$total_login_time=0; -$SQday_ARY = explode('-',$begin_date); -$EQday_ARY = explode('-',$end_date); -$SQepoch = mktime(0, 0, 0, $SQday_ARY[1], $SQday_ARY[2], $SQday_ARY[0]); -$EQepoch = mktime(23, 59, 59, $EQday_ARY[1], $EQday_ARY[2], $EQday_ARY[0]); + $total_login_time=0; + $SQday_ARY = explode('-',$begin_date); + $EQday_ARY = explode('-',$end_date); + $SQepoch = mktime(0, 0, 0, $SQday_ARY[1], $SQday_ARY[2], $SQday_ARY[0]); + $EQepoch = mktime(23, 59, 59, $EQday_ARY[1], $EQday_ARY[2], $EQday_ARY[0]); -echo "<br><br>\n"; + echo "<br><br>\n"; -echo "<center>\n"; + echo "<center>\n"; -echo "<B>TIMECLOCK LOGIN/LOGOUT TIME:</B>\n"; -echo "<TABLE width=550 cellspacing=0 cellpadding=1>\n"; -echo "<tr><td><font size=2>ID </td><td><font size=2>EDIT </td><td align=right><font size=2>EVENT </td><td align=right><font size=2> DATE</td><td align=right><font size=2> IP ADDRESS</td><td align=right><font size=2> GROUP</td><td align=right><font size=2>HOURS:MM:SS</td></tr>\n"; + echo "<B>TIMECLOCK LOGIN/LOGOUT TIME:</B>\n"; + echo "<TABLE width=550 cellspacing=0 cellpadding=1>\n"; + echo "<tr><td><font size=2>ID </td><td><font size=2>EDIT </td><td align=right><font size=2>EVENT </td><td align=right><font size=2> DATE</td><td align=right><font size=2> IP ADDRESS</td><td align=right><font size=2> GROUP</td><td align=right><font size=2>HOURS:MM:SS</td></tr>\n"; - $stmt="SELECT event,event_epoch,user_group,login_sec,ip_address,timeclock_id,manager_user from vicidial_timeclock_log where user='" . mysql_real_escape_string($user) . "' and event_epoch >= '$SQepoch' and event_epoch <= '$EQepoch';"; - if ($DB>0) {echo "|$stmt|";} + $stmt="SELECT event,event_epoch,user_group,login_sec,ip_address,timeclock_id,manager_user from vicidial_timeclock_log where user='" . mysql_real_escape_string($user) . "' and event_epoch >= '$SQepoch' and event_epoch <= '$EQepoch';"; + if ($DB>0) {echo "|$stmt|";} + $rslt=mysql_query($stmt, $link); + $events_to_print = mysql_num_rows($rslt); + + $total_logs=0; + $o=0; + while ($events_to_print > $o) { + $row=mysql_fetch_row($rslt); + if ( ($row[0]=='START') or ($row[0]=='LOGIN') ) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $TC_log_date = date("Y-m-d H:i:s", $row[1]); + + $manager_edit=''; + if (strlen($row[6])>0) {$manager_edit = ' * ';} + + if (ereg("LOGIN", $row[0])) + { + $login_sec=''; + echo "<tr $bgcolor><td><font size=2><A HREF=\"./timeclock_edit.php?timeclock_id=$row[5]\">$row[5]</A></td>"; + echo "<td align=right><font size=2>$manager_edit</td>"; + echo "<td align=right><font size=2>$row[0]</td>"; + echo "<td align=right><font size=2> $TC_log_date</td>\n"; + echo "<td align=right><font size=2> $row[4]</td>\n"; + echo "<td align=right><font size=2> $row[2]</td>\n"; + echo "<td align=right><font size=2> </td></tr>\n"; + } + if (ereg("LOGOUT", $row[0])) + { + $login_sec = $row[3]; + $total_login_time = ($total_login_time + $login_sec); + $event_hours_minutes = sec_convert($login_sec,'H'); + + echo "<tr $bgcolor><td><font size=2><A HREF=\"./timeclock_edit.php?timeclock_id=$row[5]\">$row[5]</A></td>"; + echo "<td align=right><font size=2>$manager_edit</td>"; + echo "<td align=right><font size=2>$row[0]</td>"; + echo "<td align=right><font size=2> $TC_log_date</td>\n"; + echo "<td align=right><font size=2> $row[4]</td>\n"; + echo "<td align=right><font size=2> $row[2]</td>\n"; + echo "<td align=right><font size=2> $event_hours_minutes"; + if ($DB) {echo " - $total_login_time - $login_sec";} + echo "</td></tr>\n"; + } + $o++; + } + if (strlen($login_sec)<1) + { + $login_sec = ($STARTtime - $row[1]); + $total_login_time = ($total_login_time + $login_sec); + if ($DB) {echo "LOGIN ONLY - $total_login_time - $login_sec";} + } + $total_login_hours_minutes = sec_convert($total_login_time,'H'); + + if ($DB) {echo " - $total_login_time - $login_sec";} + + echo "<tr><td align=right><font size=2> </td>"; + echo "<td align=right><font size=2> </td>\n"; + echo "<td align=right><font size=2> </td>\n"; + echo "<td align=right><font size=2> </td>\n"; + echo "<td align=right><font size=2><font size=2>TOTAL </td>\n"; + echo "<td align=right><font size=2> $total_login_hours_minutes </td></tr>\n"; + + echo "</TABLE></center>\n"; + + + + ##### closer in-group selection logs ##### + + echo "<br><br>\n"; + + echo "<center>\n"; + + echo "<B>CLOSER IN-GROUP SELECTION LOGS:</B>\n"; + echo "<TABLE width=670 cellspacing=0 cellpadding=1>\n"; + echo "<tr><td><font size=1># </td><td><font size=2>DATE/TIME </td><td align=left><font size=2> CAMPAIGN</td><td align=left><font size=2>BLEND</td><td align=left><font size=2> GROUPS</td><td align=left><font size=2> MANAGER</td></tr>\n"; + + $stmt="select user,campaign_id,event_date,blended,closer_campaigns,manager_change from vicidial_user_closer_log where user='" . mysql_real_escape_string($user) . "' and event_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and event_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by event_date desc limit 1000;"; $rslt=mysql_query($stmt, $link); - $events_to_print = mysql_num_rows($rslt); + $logs_to_print = mysql_num_rows($rslt); - $total_logs=0; - $o=0; - while ($events_to_print > $o) { + $u=0; + while ($logs_to_print > $u) + { $row=mysql_fetch_row($rslt); - if ( ($row[0]=='START') or ($row[0]=='LOGIN') ) + if (eregi("1$|3$|5$|7$|9$", $u)) {$bgcolor='bgcolor="#B9CBFD"';} else {$bgcolor='bgcolor="#9BB9FB"';} - $TC_log_date = date("Y-m-d H:i:s", $row[1]); + $u++; + echo "<tr $bgcolor>"; + echo "<td><font size=1>$u</td>"; + echo "<td><font size=2>$row[2]</td>"; + echo "<td align=left><font size=2> $row[1]</td>\n"; + echo "<td align=left><font size=2> $row[3]</td>\n"; + echo "<td align=left><font size=2> $row[4] </td>\n"; + echo "<td align=left><font size=2> $row[5]</td>\n"; + echo "</tr>\n"; + } - $manager_edit=''; - if (strlen($row[6])>0) {$manager_edit = ' * ';} - if (ereg("LOGIN", $row[0])) - { - $login_sec=''; - echo "<tr $bgcolor><td><font size=2><A HREF=\"./timeclock_edit.php?timeclock_id=$row[5]\">$row[5]</A></td>"; - echo "<td align=right><font size=2>$manager_edit</td>"; - echo "<td align=right><font size=2>$row[0]</td>"; - echo "<td align=right><font size=2> $TC_log_date</td>\n"; - echo "<td align=right><font size=2> $row[4]</td>\n"; - echo "<td align=right><font size=2> $row[2]</td>\n"; - echo "<td align=right><font size=2> </td></tr>\n"; - } - if (ereg("LOGOUT", $row[0])) - { - $login_sec = $row[3]; - $total_login_time = ($total_login_time + $login_sec); - $event_hours_minutes = sec_convert($login_sec,'H'); + echo "</TABLE><BR><BR>\n"; - echo "<tr $bgcolor><td><font size=2><A HREF=\"./timeclock_edit.php?timeclock_id=$row[5]\">$row[5]</A></td>"; - echo "<td align=right><font size=2>$manager_edit</td>"; - echo "<td align=right><font size=2>$row[0]</td>"; - echo "<td align=right><font size=2> $TC_log_date</td>\n"; - echo "<td align=right><font size=2> $row[4]</td>\n"; - echo "<td align=right><font size=2> $row[2]</td>\n"; - echo "<td align=right><font size=2> $event_hours_minutes"; - if ($DB) {echo " - $total_login_time - $login_sec";} - echo "</td></tr>\n"; - } - $o++; + + ##### vicidial agent outbound calls for this time period ##### + + echo "<B>OUTBOUND CALLS FOR THIS TIME PERIOD: (10000 record limit)</B>\n"; + echo "<TABLE width=670 cellspacing=0 cellpadding=1>\n"; + echo "<tr><td><font size=1># </td><td><font size=2>DATE/TIME </td><td align=left><font size=2>LENGTH</td><td align=left><font size=2> STATUS</td><td align=left><font size=2> PHONE</td><td align=right><font size=2> CAMPAIGN</td><td align=right><font size=2> GROUP</td><td align=right><font size=2> LIST</td><td align=right><font size=2> LEAD</td><td align=right><font size=2> HANGUP REASON</td></tr>\n"; + + $stmt="select uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed,user_group,term_reason,alt_dial from vicidial_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by call_date desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + while ($logs_to_print > $u) + { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $u++; + echo "<tr $bgcolor>"; + echo "<td><font size=1>$u</td>"; + echo "<td><font size=2>$row[4]</td>"; + echo "<td align=left><font size=2> $row[7]</td>\n"; + echo "<td align=left><font size=2> $row[8]</td>\n"; + echo "<td align=left><font size=2> $row[10] </td>\n"; + echo "<td align=right><font size=2> $row[3] </td>\n"; + echo "<td align=right><font size=2> $row[14] </td>\n"; + echo "<td align=right><font size=2> $row[2] </td>\n"; + echo "<td align=right><font size=2> <A HREF=\"admin_modify_lead.php?lead_id=$row[1]\" target=\"_blank\">$row[1]</A> </td>\n"; + echo "<td align=right><font size=2> $row[15] </td></tr>\n"; + } + + + echo "</TABLE><BR><BR>\n"; } -if (strlen($login_sec)<1) - { - $login_sec = ($STARTtime - $row[1]); - $total_login_time = ($total_login_time + $login_sec); - if ($DB) {echo "LOGIN ONLY - $total_login_time - $login_sec";} - } -$total_login_hours_minutes = sec_convert($total_login_time,'H'); - -if ($DB) {echo " - $total_login_time - $login_sec";} - -echo "<tr><td align=right><font size=2> </td>"; -echo "<td align=right><font size=2> </td>\n"; -echo "<td align=right><font size=2> </td>\n"; -echo "<td align=right><font size=2> </td>\n"; -echo "<td align=right><font size=2><font size=2>TOTAL </td>\n"; -echo "<td align=right><font size=2> $total_login_hours_minutes </td></tr>\n"; - -echo "</TABLE></center>\n"; - - - -##### closer in-group selection logs ##### - -echo "<br><br>\n"; - -echo "<center>\n"; - -echo "<B>CLOSER IN-GROUP SELECTION LOGS:</B>\n"; -echo "<TABLE width=670 cellspacing=0 cellpadding=1>\n"; -echo "<tr><td><font size=1># </td><td><font size=2>DATE/TIME </td><td align=left><font size=2> CAMPAIGN</td><td align=left><font size=2>BLEND</td><td align=left><font size=2> GROUPS</td><td align=left><font size=2> MANAGER</td></tr>\n"; - -$stmt="select user,campaign_id,event_date,blended,closer_campaigns,manager_change from vicidial_user_closer_log where user='" . mysql_real_escape_string($user) . "' and event_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and event_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by event_date desc limit 1000;"; -$rslt=mysql_query($stmt, $link); -$logs_to_print = mysql_num_rows($rslt); - -$u=0; -while ($logs_to_print > $u) - { - $row=mysql_fetch_row($rslt); - if (eregi("1$|3$|5$|7$|9$", $u)) - {$bgcolor='bgcolor="#B9CBFD"';} - else - {$bgcolor='bgcolor="#9BB9FB"';} - - $u++; - echo "<tr $bgcolor>"; - echo "<td><font size=1>$u</td>"; - echo "<td><font size=2>$row[2]</td>"; - echo "<td align=left><font size=2> $row[1]</td>\n"; - echo "<td align=left><font size=2> $row[3]</td>\n"; - echo "<td align=left><font size=2> $row[4] </td>\n"; - echo "<td align=left><font size=2> $row[5]</td>\n"; - echo "</tr>\n"; - } - - -echo "</TABLE><BR><BR>\n"; - - -##### vicidial agent outbound calls for this time period ##### - -echo "<B>OUTBOUND CALLS FOR THIS TIME PERIOD: (10000 record limit)</B>\n"; -echo "<TABLE width=670 cellspacing=0 cellpadding=1>\n"; -echo "<tr><td><font size=1># </td><td><font size=2>DATE/TIME </td><td align=left><font size=2>LENGTH</td><td align=left><font size=2> STATUS</td><td align=left><font size=2> PHONE</td><td align=right><font size=2> CAMPAIGN</td><td align=right><font size=2> GROUP</td><td align=right><font size=2> LIST</td><td align=right><font size=2> LEAD</td><td align=right><font size=2> HANGUP REASON</td></tr>\n"; - -$stmt="select uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed,user_group,term_reason,alt_dial from vicidial_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by call_date desc limit 10000;"; -$rslt=mysql_query($stmt, $link); -$logs_to_print = mysql_num_rows($rslt); - -$u=0; -while ($logs_to_print > $u) - { - $row=mysql_fetch_row($rslt); - if (eregi("1$|3$|5$|7$|9$", $u)) - {$bgcolor='bgcolor="#B9CBFD"';} - else - {$bgcolor='bgcolor="#9BB9FB"';} - - $u++; - echo "<tr $bgcolor>"; - echo "<td><font size=1>$u</td>"; - echo "<td><font size=2>$row[4]</td>"; - echo "<td align=left><font size=2> $row[7]</td>\n"; - echo "<td align=left><font size=2> $row[8]</td>\n"; - echo "<td align=left><font size=2> $row[10] </td>\n"; - echo "<td align=right><font size=2> $row[3] </td>\n"; - echo "<td align=right><font size=2> $row[14] </td>\n"; - echo "<td align=right><font size=2> $row[2] </td>\n"; - echo "<td align=right><font size=2> <A HREF=\"admin_modify_lead.php?lead_id=$row[1]\" target=\"_blank\">$row[1]</A> </td>\n"; - echo "<td align=right><font size=2> $row[15] </td></tr>\n"; - } - - -echo "</TABLE><BR><BR>\n"; - ##### vicidial agent inbound calls for this time period ##### @@ -509,33 +555,54 @@ echo "<B>INBOUND/CLOSER CALLS FOR THIS TIME PERIOD: (10000 record limit)</B>\n"; echo "<TABLE width=670 cellspacing=0 cellpadding=1>\n"; echo "<tr><td><font size=1># </td><td><font size=2>DATE/TIME </td><td align=left><font size=2>LENGTH</td><td align=left><font size=2> STATUS</td><td align=left><font size=2> PHONE</td><td align=right><font size=2> CAMPAIGN</td><td align=right><font size=2> WAIT (S)</td><td align=right><font size=2> LIST</td><td align=right><font size=2> LEAD</td><td align=right><font size=2> HANGUP REASON</td></tr>\n"; - $stmt="select closecallid,lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed,queue_seconds,user_group,xfercallid,term_reason,uniqueid,agent_only from vicidial_closer_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by call_date desc limit 10000;"; - $rslt=mysql_query($stmt, $link); - $logs_to_print = mysql_num_rows($rslt); +$stmt="select call_date,length_in_sec,status,phone_number,campaign_id,queue_seconds,list_id,lead_id,term_reason from vicidial_closer_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by call_date desc limit 10000;"; +if ($did > 0) + { + $stmt="select start_time,length_in_sec,0,caller_code,0,0,0,extension,0 from call_log where channel_group='DID_INBOUND' and number_dialed='" . mysql_real_escape_string($user) . "' and start_time >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and start_time <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by start_time desc limit 10000;"; + } +$rslt=mysql_query($stmt, $link); +$logs_to_print = mysql_num_rows($rslt); - $u=0; - while ($logs_to_print > $u) { - $row=mysql_fetch_row($rslt); - if (eregi("1$|3$|5$|7$|9$", $u)) - {$bgcolor='bgcolor="#B9CBFD"';} +$u=0; +$TOTALinSECONDS=0; +while ($logs_to_print > $u) + { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + if ($did > 0) + { + if (strlen($row[7]) > 17) + { + $row[7] = substr($row[7], -9); + $row[7] = ($row[7] + 0); + } else - {$bgcolor='bgcolor="#9BB9FB"';} - - $u++; - echo "<tr $bgcolor>"; - echo "<td><font size=1>$u</td>"; - echo "<td><font size=2>$row[4]</td>"; - echo "<td align=left><font size=2> $row[7]</td>\n"; - echo "<td align=left><font size=2> $row[8]</td>\n"; - echo "<td align=left><font size=2> $row[10] </td>\n"; - echo "<td align=right><font size=2> $row[3] </td>\n"; - echo "<td align=right><font size=2> $row[14] </td>\n"; - echo "<td align=right><font size=2> $row[2] </td>\n"; - echo "<td align=right><font size=2> <A HREF=\"admin_modify_lead.php?lead_id=$row[1]\" target=\"_blank\">$row[1]</A> </td>\n"; - echo "<td align=right><font size=2> $row[17] </td></tr>\n"; + {$row[7]='0';} + } + $TOTALinSECONDS = ($TOTALinSECONDS + $row[1]); + $u++; + echo "<tr $bgcolor>"; + echo "<td><font size=1>$u</td>"; + echo "<td><font size=2>$row[0]</td>"; + echo "<td align=left><font size=2> $row[1]</td>\n"; + echo "<td align=left><font size=2> $row[2]</td>\n"; + echo "<td align=left><font size=2> $row[3] </td>\n"; + echo "<td align=right><font size=2> $row[4] </td>\n"; + echo "<td align=right><font size=2> $row[5] </td>\n"; + echo "<td align=right><font size=2> $row[6] </td>\n"; + echo "<td align=right><font size=2> <A HREF=\"admin_modify_lead.php?lead_id=$row[7]\" target=\"_blank\">$row[7]</A> </td>\n"; + echo "<td align=right><font size=2> $row[8] </td></tr>\n"; } +echo "<tr bgcolor=white>"; +echo "<td colspan=2><font size=2>TOTALS</td>"; +echo "<td align=left><font size=2> $TOTALinSECONDS</td>\n"; +echo "<td colspan=7><font size=2>   </td></tr>\n"; echo "</TABLE></center><BR><BR>\n"; @@ -602,50 +669,48 @@ echo "<tr><td><font size=1># </td><td align=left><font size=2> LEAD</td><td><fon echo "<td align=center><font size=2> $row[10] </td>\n"; echo "<td align=right><font size=2> $location   </td>\n"; echo "</tr>\n"; - } - echo "</TABLE><BR><BR>\n"; -##### vicidial agent outbound user manual calls for this time period ##### +if ($did < 1) + { + ##### vicidial agent outbound user manual calls for this time period ##### -echo "<B>MANUAL OUTBOUND CALLS FOR THIS TIME PERIOD: (10000 record limit)</B>\n"; -echo "<TABLE width=750 cellspacing=0 cellpadding=1>\n"; -echo "<tr><td><font size=1># </td><td><font size=2>DATE/TIME </td><td align=left><font size=2> CALL TYPE</td><td align=left><font size=2> SERVER</td><td align=left><font size=2> PHONE</td><td align=right><font size=2> DIALED</td><td align=right><font size=2> LEAD</td><td align=right><font size=2> CALLERID</td><td align=right><font size=2> ALIAS</td></tr>\n"; + echo "<B>MANUAL OUTBOUND CALLS FOR THIS TIME PERIOD: (10000 record limit)</B>\n"; + echo "<TABLE width=750 cellspacing=0 cellpadding=1>\n"; + echo "<tr><td><font size=1># </td><td><font size=2>DATE/TIME </td><td align=left><font size=2> CALL TYPE</td><td align=left><font size=2> SERVER</td><td align=left><font size=2> PHONE</td><td align=right><font size=2> DIALED</td><td align=right><font size=2> LEAD</td><td align=right><font size=2> CALLERID</td><td align=right><font size=2> ALIAS</td></tr>\n"; $stmt="select call_date,call_type,server_ip,phone_number,number_dialed,lead_id,callerid,group_alias_id from user_call_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by call_date desc limit 10000;"; $rslt=mysql_query($stmt, $link); $logs_to_print = mysql_num_rows($rslt); $u=0; - while ($logs_to_print > $u) { + while ($logs_to_print > $u) + { $row=mysql_fetch_row($rslt); if (eregi("1$|3$|5$|7$|9$", $u)) {$bgcolor='bgcolor="#B9CBFD"';} else {$bgcolor='bgcolor="#9BB9FB"';} - $u++; - echo "<tr $bgcolor>"; - echo "<td><font size=1>$u</td>"; - echo "<td><font size=2>$row[0]</td>"; - echo "<td align=left><font size=2> $row[1]</td>\n"; - echo "<td align=left><font size=2> $row[2]</td>\n"; - echo "<td align=left><font size=2> $row[3] </td>\n"; - echo "<td align=right><font size=2> $row[4] </td>\n"; - echo "<td align=right><font size=2> <A HREF=\"admin_modify_lead.php?lead_id=$row[5]\" target=\"_blank\">$row[5]</A> </td>\n"; - echo "<td align=right><font size=2> $row[6] </td>\n"; - echo "<td align=right><font size=2> $row[7] </td></tr>\n"; - + $u++; + echo "<tr $bgcolor>"; + echo "<td><font size=1>$u</td>"; + echo "<td><font size=2>$row[0]</td>"; + echo "<td align=left><font size=2> $row[1]</td>\n"; + echo "<td align=left><font size=2> $row[2]</td>\n"; + echo "<td align=left><font size=2> $row[3] </td>\n"; + echo "<td align=right><font size=2> $row[4] </td>\n"; + echo "<td align=right><font size=2> <A HREF=\"admin_modify_lead.php?lead_id=$row[5]\" target=\"_blank\">$row[5]</A> </td>\n"; + echo "<td align=right><font size=2> $row[6] </td>\n"; + echo "<td align=right><font size=2> $row[7] </td></tr>\n"; + } + echo "</TABLE><BR><BR>\n"; } -echo "</TABLE><BR><BR>\n"; - - - $ENDtime = date("U"); $RUNtime = ($ENDtime - $STARTtime);