diff --git a/bin/AST_VDlist_summary_export.pl b/bin/AST_VDlist_summary_export.pl index 3b8bbeef..8d5a41a0 100644 --- a/bin/AST_VDlist_summary_export.pl +++ b/bin/AST_VDlist_summary_export.pl @@ -357,6 +357,65 @@ $Ealert .= "\n"; $Ealert .= "-------------------------------------------------------------------------------------\n"; $Ealert .= "LIST REPORT FOR $timestamp: $outfile\n"; $Ealert .= "TOTAL LEADS IN SYSTEM: $TOTAL_LEADS\n"; +$Ealert .= "\n"; +$Ealert .= "TOTAL LEADS IN SYSTEM BY STATUS:\n"; + +### gather status subtotals +$stmtA = "select count(*),status from vicidial_list where list_id>99 group by status order by status;"; +if ($DB) {print "|$stmtA|\n";} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$i=0; +while ($sthArows > $i) + { + @aryA = $sthA->fetchrow_array; + $Tcount[$i] = $aryA[0]; + $Tstatus[$i] = $aryA[1]; + $i++; + } +$sthA->finish(); + +$i=0; +$k=0; +$m=0; +foreach(@Tstatus) + { + $stmtA = "select status_name from vicidial_statuses where status='$Tstatus[$i]';"; + if ($DB) {print "|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $Tstatus_name[$i] = $aryA[0]; + } + $sthA->finish(); + if (length($Tstatus_name[$i])<1) + { + $stmtA = "select status_name from vicidial_campaign_statuses where status='$Tstatus[$i]';"; + if ($DB) {print "|$stmtA|\n";} + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $Tstatus_name[$i] = $aryA[0]; + } + $sthA->finish(); + } + + $Tstatus[$i] = sprintf("%-7s", $Tstatus[$i]); + $Tstatus_name[$i] = sprintf("%-20s", $Tstatus_name[$i]); while (length($Tstatus_name[$i])>20) {$Tstatus_name[$i] =~ s/.$//gi;} + $Tcount[$i] = sprintf("%7s", $Tcount[$i]); + + $Ealert .= "$Tstatus[$i] - $Tstatus_name[$i]: $Tcount[$i]\n"; + + $i++; + } + print "script execution time in seconds: $secZ minutes: $secZm\n"; print out "$Ealert"; diff --git a/docs/REQUIRED_APPS_INSTALL.txt b/docs/REQUIRED_APPS_INSTALL.txt index 27ece627..ec60ca9c 100644 --- a/docs/REQUIRED_APPS_INSTALL.txt +++ b/docs/REQUIRED_APPS_INSTALL.txt @@ -339,9 +339,9 @@ make install mkdir /usr/src/asterisk cd /usr/src/asterisk -wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.2.30.2.tar.gz -wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.2.27.tar.gz -wget http://ftp.digium.com/pub/libpri/releases/libpri-1.2.8.tar.gz +wget http://downloads.digium.com/pub/asterisk/releases/asterisk-1.2.30.2.tar.gz +wget http://downloads.digium.com/pub/zaptel/releases/zaptel-1.2.27.tar.gz +wget http://downloads.digium.com/pub/libpri/releases/libpri-1.2.8.tar.gz gunzip asterisk-1.2.30.2.tar.gz tar xvf asterisk-1.2.30.2.tar gunzip zaptel-1.2.27.tar.gz diff --git a/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt b/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt index 16b1f63f..39d8da50 100644 --- a/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt +++ b/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt @@ -386,6 +386,7 @@ Choose Report Display Options|| To select more than 1 campaign, hold down the Ctrl key and click|| CPD AMD Action -<\/B> If you are using the Sangoma ParaXip Call Progress Detection software then you will want to enable this setting either setting it to DISPO which will disposition the call as AA and hang it up if the call is being processed and has not been sent to an agent yet or MESSAGE which will send the call to the defined Answering Machine Message for this campaign. Default is DISABLED|| CPD AMD Action:|| +Click here for user multiple day status detail report|| ############################################################ CLIENT diff --git a/www/vicidial/AST_agent_days_detail.php b/www/vicidial/AST_agent_days_detail.php new file mode 100644 index 00000000..34d040f4 --- /dev/null +++ b/www/vicidial/AST_agent_days_detail.php @@ -0,0 +1,523 @@ + LICENSE: AGPLv2 +# +# CHANGES +# +# 90206-2202 - First build +# + + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['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["end_date"])) {$end_date=$_GET["end_date"];} + elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["shift"])) {$shift=$_GET["shift"];} + elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];} +if (isset($_GET["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +if (strlen($shift)<2) {$shift='ALL';} + +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin FROM system_settings;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$qm_conf_ct = mysql_num_rows($rslt); +$i=0; +while ($i < $qm_conf_ct) + { + $row=mysql_fetch_row($rslt); + $non_latin = $row[0]; + $i++; + } +##### END SETTINGS LOOKUP ##### +########################################### + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; +if ($DB) {echo "|$stmt|\n";} +if ($non_latin > 0) { $rslt=mysql_query("SET NAMES 'UTF8'");} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$MT[0]=''; +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($query_date)) {$query_date = $NOW_DATE;} +if (!isset($end_date)) {$end_date = $NOW_DATE;} + +$stmt="select campaign_id from vicidial_campaigns;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$campaigns_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $campaigns_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } + +$i=0; +$group_string='|'; +$group_ct = count($group); +while($i < $group_ct) + { + $group_string .= "$group[$i]|"; + $group_SQL .= "'$group[$i]',"; + $groupQS .= "&group[]=$group[$i]"; + $i++; + } +if ( (ereg("--ALL--",$group_string) ) or ($group_ct < 1) ) + {$group_SQL = "";} +else + { + $group_SQL = eregi_replace(",$",'',$group_SQL); + $group_SQL = "and campaign_id IN($group_SQL)"; + } + +$customer_interactive_statuses=''; +$stmt="select status from vicidial_statuses where human_answered='Y';"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$statha_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $statha_to_print) + { + $row=mysql_fetch_row($rslt); + $customer_interactive_statuses .= "|$row[0]"; + $i++; + } +$stmt="select status from vicidial_campaign_statuses where human_answered='Y';"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$statha_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $statha_to_print) + { + $row=mysql_fetch_row($rslt); + $customer_interactive_statuses .= "|$row[0]"; + $i++; + } +if (strlen($customer_interactive_statuses)>0) + {$customer_interactive_statuses .= '|';} + +#$customer_interactive_statuses = '|NI|DNC|CALLBK|AP|SALE|COMP|HAP1|HAP2|HBED|DIED|'; +#$customer_interactive_statuses = '|NI|DNC|CALLBK|XFER|C2|B7|B8|C1|'; + +$LINKbase = "$PHP_SELF?query_date=$query_date&end_date=$end_date&shift=$shift&DB=$DB&user=$user$groupQS"; + +?> + + + + + +\n"; +echo "
\n";
+
+
+if (strlen($group[0]) < 1)
+{
+echo "\n";
+echo "PLEASE SELECT A USER AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
+echo " NOTE: stats taken from shift specified\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$time_BEGIN=$AM_shift_BEGIN;
+	$time_END=$AM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "03:45:00";}   
+	if (strlen($time_END) < 6) {$time_END = "15:15:00";}
+	}
+if ($shift == 'PM') 
+	{
+	$time_BEGIN=$PM_shift_BEGIN;
+	$time_END=$PM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "15:15:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:15:00";}
+	}
+if ($shift == 'ALL') 
+	{
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:59:59";}
+	}
+$query_date_BEGIN = "$query_date $time_BEGIN";   
+$query_date_END = "$end_date $time_END";
+
+if (strlen($user_group)>0) {$ugSQL="and vicidial_agent_log.user_group='$user_group'";}
+else {$ugSQL='';}
+
+echo "VICIDIAL: Agent Status Detail: $user                     $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENT Details -------------\n\n";
+
+
+
+
+
+$statuses='-';
+$statusesTXT='';
+$statusesHEAD='';
+$statusesHTML='';
+$statusesARY[0]='';
+$j=0;
+$dates='-';
+$datesARY[0]='';
+$date_namesARY[0]='';
+$k=0;
+
+$stmt="select date_format(event_time, '%Y-%m-%d') as date,count(*) as calls,status from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and vicidial_agent_log.user=$user $group_SQL $user_group_SQL group by date,status order by date,status desc limit 500000;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	if ( ($row[1] > 0) and (strlen($row[2]) > 0) )
+		{
+		$date[$i] =			$row[0];
+		$calls[$i] =		$row[1];
+		$status[$i] =		$row[2];
+		if ( (!eregi("-$status[$i]-", $statuses)) and (strlen($status[$i])>0) )
+			{
+			$statusesTXT = sprintf("%8s", $status[$i]);
+			$statusesHEAD .= "----------+";
+			$statusesHTML .= " $statusesTXT |";
+			$statuses .= "$status[$i]-";
+			$statusesARY[$j] = $status[$i];
+			$j++;
+			}
+		if (!eregi("-$date[$i]-", $dates))
+			{
+			$dates .= "$date[$i]-";
+			$datesARY[$k] = $date[$i];
+			$k++;
+			}
+		}
+	$i++;
+	}
+
+echo "CALL STATS BREAKDOWN:\n";
+echo "+------------+--------+--------+--------+$statusesHEAD\n";
+echo "| DATE       | CALLS  | CIcalls| DNC/CI%|$statusesHTML\n";
+echo "+------------+--------+--------+--------+$statusesHEAD\n";
+
+
+### BEGIN loop through each user ###
+$m=0;
+$CIScountTOT=0;
+$DNCcountTOT=0;
+while ($m < $k)
+	{
+	$Sdate=$datesARY[$m];
+	$Scalls=$calls[$m];
+	$SstatusesHTML='';
+	$CIScount=0;
+	$DNCcount=0;
+
+	### BEGIN loop through each status ###
+	$n=0;
+	while ($n < $j)
+		{
+		$Sstatus=$statusesARY[$n];
+		$SstatusTXT='';
+		### BEGIN loop through each stat line ###
+		$i=0; $status_found=0;
+		while ($i < $rows_to_print)
+			{
+#			if ( (eregi("$date[$i]", $Sdate)) and ($Sstatus=="$status[$i]") )
+			if ( ($Sdate=="$date[$i]") and ($Sstatus=="$status[$i]") )
+				{
+				$Scalls =		($Scalls + $calls[$i]);
+				if (eregi("\|$status[$i]\|",$customer_interactive_statuses))
+					{
+					$CIScount =	($CIScount + $calls[$i]);
+					$CIScountTOT =	($CIScountTOT + $calls[$i]);
+					}
+				if (eregi("DNC", $status[$i]))
+					{
+					$DNCcount =	($DNCcount + $calls[$i]);
+					$DNCcountTOT =	($DNCcountTOT + $calls[$i]);
+					}
+				$SstatusTXT = sprintf("%8s", $calls[$i]);
+				$SstatusesHTML .= " $SstatusTXT |";
+				$status_found++;
+				}
+			$i++;
+			}
+		if ($status_found < 1)
+			{
+			$SstatusesHTML .= "        0 |";
+			}
+		### END loop through each stat line ###
+		$n++;
+		}
+	### END loop through each status ###
+	$TOTcalls=($TOTcalls + $Scalls);
+
+	$RAWdate = $Sdate;
+	$RAWcalls = $Scalls;
+	$RAWcis = $CIScount;
+	$Scalls =	sprintf("%6s", $Scalls);
+	$CIScount =	sprintf("%6s", $CIScount);
+
+	$Sdate =		sprintf("%-10s", $Sdate);
+		while(strlen($Suser)>10) {$Suser = substr("$Sdate", 0, -1);}
+
+	if ( ($DNCcount < 1) or ($CIScount < 1) )
+		{$DNCcountPCTs=0;}
+	else
+		{
+		$DNCcountPCTs = ( ($DNCcount / $CIScount) * 100);
+		}
+	$RAWdncPCT = $DNCcountPCTs;
+#	$DNCcountPCTs = round($DNCcountPCTs,2);
+	$DNCcountPCTs = round($DNCcountPCTs);
+#	$DNCcountPCTs = sprintf("%3.2f", $DNCcountPCTs);
+	$DNCcountPCTs = sprintf("%6s", $DNCcountPCTs);
+
+	$Toutput = "| $Sdate | $Scalls | $CIScount | $DNCcountPCTs%|$SstatusesHTML\n";
+
+	$TOPsorted_output[$m] = $Toutput;
+
+	if ($stage == 'ID')
+		{
+		$TOPsort[$m] =	'' . sprintf("%08s", $RAWdate) . '-----' . $m . '-----' . sprintf("%020s", $RAWdate);
+		$TOPsortTALLY[$m]=$RAWcalls;
+		}
+	if ($stage == 'CALLS')
+		{
+		$TOPsort[$m] =	'' . sprintf("%08s", $RAWcalls) . '-----' . $m . '-----' . sprintf("%020s", $RAWdate);
+		$TOPsortTALLY[$m]=$RAWcalls;
+		}
+	if ($stage == 'TIME')
+		{
+		$TOPsort[$m] =	'' . sprintf("%08s", $Stime) . '-----' . $m . '-----' . sprintf("%020s", $RAWdate);
+		$TOPsortTALLY[$m]=$Stime;
+		}
+	if ($stage == 'CI')
+		{
+		$TOPsort[$m] =	'' . sprintf("%08s", $RAWcis) . '-----' . $m . '-----' . sprintf("%020s", $RAWdate);
+		$TOPsortTALLY[$m]=$RAWcis;
+		}
+	if ($stage == 'DNCCI')
+		{
+		$TOPsort[$m] =	'' . sprintf("%08s", $RAWdncPCT) . '-----' . $m . '-----' . sprintf("%020s", $RAWdate);
+		$TOPsortTALLY[$m]=$RAWdncPCT;
+		}
+	if (!ereg("ID|TIME|CALLS|CI|DNCCI",$stage))
+		{echo "$Toutput";}
+
+	if ($TOPsortMAX < $TOPsortTALLY[$m]) {$TOPsortMAX = $TOPsortTALLY[$m];}
+
+	$m++;
+	}
+### END loop through each user ###
+
+$TOT_AGENTS = sprintf("%4s", $m);
+
+
+### BEGIN sort through output to display properly ###
+if (ereg("ID|TIME|CALLS|CI|DNCCI",$stage))
+	{
+	if (ereg("ID",$stage))
+		{sort($TOPsort, SORT_NUMERIC);}
+	if (ereg("TIME|CALLS|CI|DNCCI",$stage))
+		{rsort($TOPsort, SORT_NUMERIC);}
+
+	$m=0;
+	while ($m < $k)
+		{
+		$sort_split = explode("-----",$TOPsort[$m]);
+		$i = $sort_split[1];
+		$sort_order[$m] = "$i";
+		echo "$TOPsorted_output[$i]";
+		$m++;
+		}
+	}
+### END sort through output to display properly ###
+
+
+
+###### LAST LINE FORMATTING ##########
+### BEGIN loop through each status ###
+$SUMstatusesHTML='';
+$n=0;
+while ($n < $j)
+	{
+	$Scalls=0;
+	$Sstatus=$statusesARY[$n];
+	$SUMstatusTXT='';
+	### BEGIN loop through each stat line ###
+	$i=0; $status_found=0;
+	while ($i < $rows_to_print)
+		{
+		if ($Sstatus=="$status[$i]")
+			{
+			$Scalls =		($Scalls + $calls[$i]);
+			$status_found++;
+			}
+		$i++;
+		}
+	### END loop through each stat line ###
+	if ($status_found < 1)
+		{
+		$SUMstatusesHTML .= "        0 |";
+		}
+	else
+		{
+		$SUMstatusTXT = sprintf("%8s", $Scalls);
+		$SUMstatusesHTML .= " $SUMstatusTXT |";
+		}
+	$n++;
+	}
+### END loop through each status ###
+
+$TOTcalls = sprintf("%7s", $TOTcalls);
+$CIScountTOT = sprintf("%7s", $CIScountTOT);
+if ( ($DNCcountTOT < 1) or ($CIScountTOT < 1) )
+	{$DNCcountPCT=0;}
+else
+	{
+	$DNCcountPCT = ( ($DNCcountTOT / $CIScountTOT) * 100);
+	}
+#$DNCcountPCT = round($DNCcountPCT,2);
+$DNCcountPCT = round($DNCcountPCT);
+#$DNCcountPCT = sprintf("%3.2f", $DNCcountPCT);
+$DNCcountPCT = sprintf("%6s", $DNCcountPCT);
+
+
+echo "+------------+--------+--------+--------+$statusesHEAD\n";
+echo "| TOTALS     | $TOTcalls| $CIScountTOT| $DNCcountPCT%|$SUMstatusesHTML\n";
+echo "+------------+--------+--------+--------+$statusesHEAD\n";
+
+echo "\n\n
"; + +} + + +echo "\n"; +echo "VICIDIAL: Agent Status\n"; +echo "
\n"; +echo "
Dates:
"; +echo "\n"; +echo "\n"; +echo "
to
\n"; +echo "
Campaigns:
"; +echo "\n"; +echo "
User:
"; +echo "\n"; +echo "
Shift:
"; +echo "

\n"; +echo "\n"; +echo "
        "; +echo ""; +if (strlen($user) > 1) + { + echo " USER | \n"; + echo " USER STATS | \n"; + } +else + {echo " USERS | \n";} +echo "REPORTS \n"; +echo "
"; + +echo "
\n\n"; + +echo "\n"; +echo "\n"; +echo "
\n\n\n\n\n\n\n\n\n\n";
+
+$m=0;
+while ($m < $k)
+	{
+	$sort_split = explode("-----",$TOPsort[$m]);
+	$i = $sort_split[1];
+	$sort_order[$m] = "$i";
+
+	if ( ($TOPsortTALLY[$i] < 1) or ($TOPsortMAX < 1) )
+		{echo "              \n";}
+	else
+		{
+		echo "              ";
+		$TOPsortPLOT = ( ($TOPsortTALLY[$i] / $TOPsortMAX) * 120 );
+		$h=0;
+		while ($h <= $TOPsortPLOT)
+			{
+			echo " ";
+			$h++;
+			}
+		echo "\n";
+		}
+	$m++;
+	}
+
+echo "\n";
+
+?>
+
+
\ No newline at end of file
diff --git a/www/vicidial/AST_agent_status_detail.php b/www/vicidial/AST_agent_status_detail.php
new file mode 100644
index 00000000..9d576f70
--- /dev/null
+++ b/www/vicidial/AST_agent_status_detail.php
@@ -0,0 +1,591 @@
+    LICENSE: AGPLv2
+#
+# CHANGES
+#
+# 90206-1554 - First build
+#
+
+
+require("dbconnect.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['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["end_date"]))				{$end_date=$_GET["end_date"];}
+	elseif (isset($_POST["end_date"]))		{$end_date=$_POST["end_date"];}
+if (isset($_GET["group"]))					{$group=$_GET["group"];}
+	elseif (isset($_POST["group"]))			{$group=$_POST["group"];}
+if (isset($_GET["user_group"]))				{$user_group=$_GET["user_group"];}
+	elseif (isset($_POST["user_group"]))	{$user_group=$_POST["user_group"];}
+if (isset($_GET["shift"]))					{$shift=$_GET["shift"];}
+	elseif (isset($_POST["shift"]))			{$shift=$_POST["shift"];}
+if (isset($_GET["stage"]))					{$stage=$_GET["stage"];}
+	elseif (isset($_POST["stage"]))			{$stage=$_POST["stage"];}
+if (isset($_GET["DB"]))						{$DB=$_GET["DB"];}
+	elseif (isset($_POST["DB"]))			{$DB=$_POST["DB"];}
+if (isset($_GET["submit"]))					{$submit=$_GET["submit"];}
+	elseif (isset($_POST["submit"]))		{$submit=$_POST["submit"];}
+if (isset($_GET["SUBMIT"]))					{$SUBMIT=$_GET["SUBMIT"];}
+	elseif (isset($_POST["SUBMIT"]))		{$SUBMIT=$_POST["SUBMIT"];}
+
+if (strlen($shift)<2) {$shift='ALL';}
+
+#############################################
+##### START SYSTEM_SETTINGS LOOKUP #####
+$stmt = "SELECT use_non_latin FROM system_settings;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$qm_conf_ct = mysql_num_rows($rslt);
+$i=0;
+while ($i < $qm_conf_ct)
+	{
+	$row=mysql_fetch_row($rslt);
+	$non_latin =					$row[0];
+	$i++;
+	}
+##### END SETTINGS LOOKUP #####
+###########################################
+
+$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
+$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
+
+$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
+if ($DB) {echo "|$stmt|\n";}
+if ($non_latin > 0) { $rslt=mysql_query("SET NAMES 'UTF8'");}
+$rslt=mysql_query($stmt, $link);
+$row=mysql_fetch_row($rslt);
+$auth=$row[0];
+
+  if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
+	{
+    Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
+    Header("HTTP/1.0 401 Unauthorized");
+    echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
+    exit;
+	}
+
+$MT[0]='';
+$NOW_DATE = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$STARTtime = date("U");
+if (!isset($group)) {$group = '';}
+if (!isset($query_date)) {$query_date = $NOW_DATE;}
+if (!isset($end_date)) {$end_date = $NOW_DATE;}
+
+$stmt="select campaign_id from vicidial_campaigns;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$campaigns_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $campaigns_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$groups[$i] =$row[0];
+	$i++;
+	}
+$stmt="select user_group from vicidial_user_groups;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$user_groups_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $user_groups_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$user_groups[$i] =$row[0];
+	$i++;
+	}
+
+$i=0;
+$group_string='|';
+$group_ct = count($group);
+while($i < $group_ct)
+	{
+	$group_string .= "$group[$i]|";
+	$group_SQL .= "'$group[$i]',";
+	$groupQS .= "&group[]=$group[$i]";
+	$i++;
+	}
+if ( (ereg("--ALL--",$group_string) ) or ($group_ct < 1) )
+	{$group_SQL = "";}
+else
+	{
+	$group_SQL = eregi_replace(",$",'',$group_SQL);
+	$group_SQL = "and campaign_id IN($group_SQL)";
+	}
+
+$i=0;
+$user_group_string='|';
+$user_group_ct = count($user_group);
+while($i < $user_group_ct)
+	{
+	$user_group_string .= "$user_group[$i]|";
+	$user_group_SQL .= "'$user_group[$i]',";
+	$user_groupQS .= "&user_group[]=$user_group[$i]";
+	$i++;
+	}
+if ( (ereg("--ALL--",$user_group_string) ) or ($user_group_ct < 1) )
+	{$user_group_SQL = "";}
+else
+	{
+	$user_group_SQL = eregi_replace(",$",'',$user_group_SQL);
+	$user_group_SQL = "and vicidial_agent_log.user_group IN($user_group_SQL)";
+	}
+
+if ($DB) {echo "$user_group_string|$user_group_ct|$user_groupQS|$i
";} + +$stmt="select vsc_id,vsc_name from vicidial_status_categories;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$statcats_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $statcats_to_print) + { + $row=mysql_fetch_row($rslt); + $vsc_id[$i] = $row[0]; + $vsc_name[$i] = $row[1]; + $vsc_count[$i] = 0; + $i++; + } + +$customer_interactive_statuses=''; +$stmt="select status from vicidial_statuses where human_answered='Y';"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$statha_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $statha_to_print) + { + $row=mysql_fetch_row($rslt); + $customer_interactive_statuses .= "|$row[0]"; + $i++; + } +$stmt="select status from vicidial_campaign_statuses where human_answered='Y';"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$statha_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $statha_to_print) + { + $row=mysql_fetch_row($rslt); + $customer_interactive_statuses .= "|$row[0]"; + $i++; + } +if (strlen($customer_interactive_statuses)>0) + {$customer_interactive_statuses .= '|';} + +#$customer_interactive_statuses = '|NI|DNC|CALLBK|AP|SALE|COMP|HAP1|HAP2|HBED|DIED|'; +#$customer_interactive_statuses = '|NI|DNC|CALLBK|XFER|C2|B7|B8|C1|'; + +$LINKbase = "$PHP_SELF?query_date=$query_date&end_date=$end_date$groupQS$user_groupQS&shift=$shift&DB=$DB"; + +?> + + + + + +\n"; +echo "
\n";
+
+
+if ( (strlen($group[0]) < 1) or (strlen($user_group[0]) < 1) )
+{
+echo "\n";
+echo "PLEASE SELECT A CAMPAIGN OR USER GROUP AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
+echo " NOTE: stats taken from shift specified\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$time_BEGIN=$AM_shift_BEGIN;
+	$time_END=$AM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "03:45:00";}   
+	if (strlen($time_END) < 6) {$time_END = "15:15:00";}
+	}
+if ($shift == 'PM') 
+	{
+	$time_BEGIN=$PM_shift_BEGIN;
+	$time_END=$PM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "15:15:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:15:00";}
+	}
+if ($shift == 'ALL') 
+	{
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:59:59";}
+	}
+$query_date_BEGIN = "$query_date $time_BEGIN";   
+$query_date_END = "$end_date $time_END";
+
+if (strlen($user_group)>0) {$ugSQL="and vicidial_agent_log.user_group='$user_group'";}
+else {$ugSQL='';}
+
+echo "VICIDIAL: Agent Status Detail                        $NOW_TIME\n";
+
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- AGENTS Details -------------\n\n";
+
+
+
+
+
+$statuses='-';
+$statusesTXT='';
+$statusesHEAD='';
+$statusesHTML='';
+$statusesARY[0]='';
+$j=0;
+$users='-';
+$usersARY[0]='';
+$user_namesARY[0]='';
+$k=0;
+
+$stmt="select count(*) as calls,full_name,vicidial_users.user,status from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user $group_SQL $user_group_SQL group by user,full_name,status order by full_name,user,status desc limit 500000;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$rows_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $rows_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	if ( ($row[0] > 0) and (strlen($row[3]) > 0) )
+		{
+		$calls[$i] =		$row[0];
+		$full_name[$i] =	$row[1];
+		$user[$i] =			$row[2];
+		$status[$i] =		$row[3];
+		if ( (!eregi("-$status[$i]-", $statuses)) and (strlen($status[$i])>0) )
+			{
+			$statusesTXT = sprintf("%8s", $status[$i]);
+			$statusesHEAD .= "----------+";
+			$statusesHTML .= " $statusesTXT |";
+			$statuses .= "$status[$i]-";
+			$statusesARY[$j] = $status[$i];
+			$j++;
+			}
+		if (!eregi("-$user[$i]-", $users))
+			{
+			$users .= "$user[$i]-";
+			$usersARY[$k] = $user[$i];
+			$user_namesARY[$k] = $full_name[$i];
+			$k++;
+			}
+		}
+	$i++;
+	}
+
+echo "CALL STATS BREAKDOWN:\n";
+echo "+-----------------+----------+--------+--------+--------+$statusesHEAD\n";
+echo "| USER NAME       | ID       | CALLS  | CIcalls| DNC/CI%|$statusesHTML\n";
+echo "+-----------------+----------+--------+--------+--------+$statusesHEAD\n";
+
+
+### BEGIN loop through each user ###
+$m=0;
+$CIScountTOT=0;
+$DNCcountTOT=0;
+while ($m < $k)
+	{
+	$Suser=$usersARY[$m];
+	$Sfull_name=$user_namesARY[$m];
+	$Scalls=$calls[$m];
+	$SstatusesHTML='';
+	$CIScount=0;
+	$DNCcount=0;
+
+	### BEGIN loop through each status ###
+	$n=0;
+	while ($n < $j)
+		{
+		$Sstatus=$statusesARY[$n];
+		$SstatusTXT='';
+		### BEGIN loop through each stat line ###
+		$i=0; $status_found=0;
+		while ($i < $rows_to_print)
+			{
+			if ( ($Suser=="$user[$i]") and ($Sstatus=="$status[$i]") )
+				{
+				$Scalls =		($Scalls + $calls[$i]);
+				if (eregi("\|$status[$i]\|",$customer_interactive_statuses))
+					{
+					$CIScount =	($CIScount + $calls[$i]);
+					$CIScountTOT =	($CIScountTOT + $calls[$i]);
+					}
+				if (eregi("DNC", $status[$i]))
+					{
+					$DNCcount =	($DNCcount + $calls[$i]);
+					$DNCcountTOT =	($DNCcountTOT + $calls[$i]);
+					}
+				$SstatusTXT = sprintf("%8s", $calls[$i]);
+				$SstatusesHTML .= " $SstatusTXT |";
+				$status_found++;
+				}
+			$i++;
+			}
+		if ($status_found < 1)
+			{
+			$SstatusesHTML .= "        0 |";
+			}
+		### END loop through each stat line ###
+		$n++;
+		}
+	### END loop through each status ###
+	$TOTcalls=($TOTcalls + $Scalls);
+
+	$RAWuser = $Suser;
+	$RAWcalls = $Scalls;
+	$RAWcis = $CIScount;
+	$Scalls =	sprintf("%6s", $Scalls);
+	$CIScount =	sprintf("%6s", $CIScount);
+
+	if ($non_latin < 1)
+		{
+		 $Sfull_name=	sprintf("%-15s", $Sfull_name); 
+			while(strlen($Sfull_name)>15) {$Sfull_name = substr("$Sfull_name", 0, -1);}
+		 $Suser =		sprintf("%-8s", $Suser);
+			while(strlen($Suser)>8) {$Suser = substr("$Suser", 0, -1);}
+		}
+	else
+		{	
+			$Sfull_name=	sprintf("%-45s", $Sfull_name); 
+		 while(mb_strlen($Sfull_name,'utf-8')>15) {$Sfull_name = mb_substr("$Sfull_name", 0, -1,'utf-8');}
+
+			$Suser =	sprintf("%-24s", $Suser);
+		 while(mb_strlen($Suser,'utf-8')>8) {$Suser = mb_substr("$Suser", 0, -1,'utf-8');}
+		}
+
+	if ( ($DNCcount < 1) or ($CIScount < 1) )
+		{$DNCcountPCTs=0;}
+	else
+		{
+		$DNCcountPCTs = ( ($DNCcount / $CIScount) * 100);
+		}
+	$RAWdncPCT = $DNCcountPCTs;
+#	$DNCcountPCTs = round($DNCcountPCTs,2);
+	$DNCcountPCTs = round($DNCcountPCTs);
+#	$DNCcountPCTs = sprintf("%3.2f", $DNCcountPCTs);
+	$DNCcountPCTs = sprintf("%6s", $DNCcountPCTs);
+
+	$Toutput = "| $Sfull_name | $Suser | $Scalls | $CIScount | $DNCcountPCTs%|$SstatusesHTML\n";
+
+	$TOPsorted_output[$m] = $Toutput;
+
+	if ($stage == 'ID')
+		{
+		$TOPsort[$m] =	'' . sprintf("%08s", $RAWuser) . '-----' . $m . '-----' . sprintf("%020s", $RAWuser);
+		$TOPsortTALLY[$m]=$RAWcalls;
+		}
+	if ($stage == 'CALLS')
+		{
+		$TOPsort[$m] =	'' . sprintf("%08s", $RAWcalls) . '-----' . $m . '-----' . sprintf("%020s", $RAWuser);
+		$TOPsortTALLY[$m]=$RAWcalls;
+		}
+	if ($stage == 'TIME')
+		{
+		$TOPsort[$m] =	'' . sprintf("%08s", $Stime) . '-----' . $m . '-----' . sprintf("%020s", $RAWuser);
+		$TOPsortTALLY[$m]=$Stime;
+		}
+	if ($stage == 'CI')
+		{
+		$TOPsort[$m] =	'' . sprintf("%08s", $RAWcis) . '-----' . $m . '-----' . sprintf("%020s", $RAWuser);
+		$TOPsortTALLY[$m]=$RAWcis;
+		}
+	if ($stage == 'DNCCI')
+		{
+		$TOPsort[$m] =	'' . sprintf("%08s", $RAWdncPCT) . '-----' . $m . '-----' . sprintf("%020s", $RAWuser);
+		$TOPsortTALLY[$m]=$RAWdncPCT;
+		}
+	if (!ereg("ID|TIME|CALLS|CI|DNCCI",$stage))
+		{echo "$Toutput";}
+
+	if ($TOPsortMAX < $TOPsortTALLY[$m]) {$TOPsortMAX = $TOPsortTALLY[$m];}
+
+	$m++;
+	}
+### END loop through each user ###
+
+$TOT_AGENTS = sprintf("%4s", $m);
+
+
+### BEGIN sort through output to display properly ###
+if (ereg("ID|TIME|CALLS|CI|DNCCI",$stage))
+	{
+	if (ereg("ID",$stage))
+		{sort($TOPsort, SORT_NUMERIC);}
+	if (ereg("TIME|CALLS|CI|DNCCI",$stage))
+		{rsort($TOPsort, SORT_NUMERIC);}
+
+	$m=0;
+	while ($m < $k)
+		{
+		$sort_split = explode("-----",$TOPsort[$m]);
+		$i = $sort_split[1];
+		$sort_order[$m] = "$i";
+		echo "$TOPsorted_output[$i]";
+		$m++;
+		}
+	}
+### END sort through output to display properly ###
+
+
+
+###### LAST LINE FORMATTING ##########
+### BEGIN loop through each status ###
+$SUMstatusesHTML='';
+$n=0;
+while ($n < $j)
+	{
+	$Scalls=0;
+	$Sstatus=$statusesARY[$n];
+	$SUMstatusTXT='';
+	### BEGIN loop through each stat line ###
+	$i=0; $status_found=0;
+	while ($i < $rows_to_print)
+		{
+		if ($Sstatus=="$status[$i]")
+			{
+			$Scalls =		($Scalls + $calls[$i]);
+			$status_found++;
+			}
+		$i++;
+		}
+	### END loop through each stat line ###
+	if ($status_found < 1)
+		{
+		$SUMstatusesHTML .= "        0 |";
+		}
+	else
+		{
+		$SUMstatusTXT = sprintf("%8s", $Scalls);
+		$SUMstatusesHTML .= " $SUMstatusTXT |";
+		}
+	$n++;
+	}
+### END loop through each status ###
+
+$TOTcalls = sprintf("%7s", $TOTcalls);
+$CIScountTOT = sprintf("%7s", $CIScountTOT);
+$DNCcountPCT = ( ($DNCcountTOT / $CIScountTOT) * 100);
+$DNCcountPCT = round($DNCcountPCT,2);
+$DNCcountPCT = sprintf("%3.2f", $DNCcountPCT);
+if ( ($DNCcountTOT < 1) or ($CIScountTOT < 1) )
+	{$DNCcountPCT=0;}
+else
+	{
+	$DNCcountPCT = ( ($DNCcountTOT / $CIScountTOT) * 100);
+	}
+#$DNCcountPCT = round($DNCcountPCT,2);
+$DNCcountPCT = round($DNCcountPCT);
+#$DNCcountPCT = sprintf("%3.2f", $DNCcountPCT);
+$DNCcountPCT = sprintf("%6s", $DNCcountPCT);
+
+
+echo "+-----------------+----------+--------+--------+--------+$statusesHEAD\n";
+echo "|  TOTALS        AGENTS:$TOT_AGENTS | $TOTcalls| $CIScountTOT| $DNCcountPCT%|$SUMstatusesHTML\n";
+echo "+----------------------------+--------+--------+--------+$statusesHEAD\n";
+
+echo "\n\n
"; + +} + + +echo "\n"; +echo "VICIDIAL: Agent Status\n"; +echo "
\n"; +echo "
Dates:
"; +echo "\n"; +echo "\n"; +echo "
to
\n"; +echo "
Campaigns:
"; +echo "\n"; +echo "
User Groups:
"; +echo "\n"; +echo "
Shift:
"; +echo "

\n"; +echo "\n"; +echo "
        "; +echo "           REPORTS \n"; +echo "
"; + +echo "
\n\n"; + +echo "\n"; +echo "\n"; +echo "
\n\n\n\n\n\n\n\n\n\n";
+
+$m=0;
+while ($m < $k)
+	{
+	$sort_split = explode("-----",$TOPsort[$m]);
+	$i = $sort_split[1];
+	$sort_order[$m] = "$i";
+
+	if ( ($TOPsortTALLY[$i] < 1) or ($TOPsortMAX < 1) )
+		{echo "                              \n";}
+	else
+		{
+		echo "                              ";
+		$TOPsortPLOT = ( ($TOPsortTALLY[$i] / $TOPsortMAX) * 110 );
+		$h=0;
+		while ($h <= $TOPsortPLOT)
+			{
+			echo " ";
+			$h++;
+			}
+		echo "\n";
+		}
+	$m++;
+	}
+
+echo "\n";
+
+?>
+
+
\ No newline at end of file
diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php
index 2b4edd37..5381a5f1 100644
--- a/www/vicidial/admin.php
+++ b/www/vicidial/admin.php
@@ -1549,6 +1549,7 @@ $build = '90202-0444';
 
 $STARTtime = date("U");
 $SQLdate = date("Y-m-d H:i:s");
+$REPORTdate = date("Y-m-d");
 $MT[0]='';
 $US='_';
 $active_lists=0;
@@ -11926,6 +11927,7 @@ if ($ADD==3)
 		echo "

Click here for user time sheet\n"; echo "

Click here for user status\n"; echo "

Click here for user stats\n"; + echo "

Click here for user multiple day status detail report\n"; echo "

Click here for user CallBack Holds\n"; } } @@ -17845,14 +17847,19 @@ if ($ADD==999999) VICIDIAL: Server Stats and Reports

  • TIME ON VDAD (per campaign)   (all campaigns SUMMARY)     SIP Listen - Barge     IAX Listen - Barge -
  • VDAD REPORT + +
  • VDAD CAMPAIGN OUTBOUND REPORT
  • INBOUND/CLOSER REPORT
  • INBOUND/CLOSER SERVICE_LEVEL REPORT -
  • AGENT PERFORMANCE DETAIL +
  • AGENT PERFORMANCE DETAIL     + AGENT STATUS DETAIL     + SINGLE AGENT DAILY +
  • FRONTER - CLOSER REPORT
  • AGENT SPREADSHEET PERFORMANCE
  • USER TIMECLOCK REPORT     USER GROUP TIMECLOCK STATUS REPORT +
  • SERVER PERFORMANCE 0) diff --git a/www/vicidial/user_stats.php b/www/vicidial/user_stats.php index 49c8cd91..911b3827 100644 --- a/www/vicidial/user_stats.php +++ b/www/vicidial/user_stats.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2009 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -14,6 +14,7 @@ # 80523-2012 - Added vicidial timeclock records display # 80617-1402 - Fixed timeclock total logged-in time # 81210-1634 - Added server recording display options +# 90208-0504 - Added link to multi-day report and fixed call status summary section # header ("Content-type: text/html; charset=utf-8"); @@ -119,21 +120,19 @@ echo " &nb echo "\n"; -echo "           $user - $full_name\n"; +echo "           $user - $full_name

    \n"; -echo " - VICIDIAL Time Sheet\n"; -echo " - User Status\n"; -echo " - Modify User\n"; +echo "
    \n"; +echo "VICIDIAL Time Sheet\n"; +echo " | User Status\n"; +echo " | Modify User\n"; +echo " | User multiple day status detail report"; +echo "
    \n"; echo "\n"; echo "\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); - $statuses_to_print = mysql_num_rows($rslt); - echo "
    \n"; ##### vicidial agent talk time and status ##### @@ -143,38 +142,61 @@ echo "VICIDIAL TALK TIME AND STATUS:\n"; echo "
    \n"; echo "\n"; - $total_calls=0; - $o=0; - while ($statuses_to_print > $o) { - $row=mysql_fetch_row($rslt); - if (eregi("1$|3$|5$|7$|9$", $o)) - {$bgcolor='bgcolor="#B9CBFD"';} - else - {$bgcolor='bgcolor="#9BB9FB"';} - - $call_seconds = $row[2]; - $call_hours = ($call_seconds / 3600); - $call_hours_int = round($call_hours, 2); - $call_hours_int = intval("$call_hours_int"); - $call_minutes = ($call_hours - $call_hours_int); - $call_minutes = ($call_minutes * 60); - $call_minutes_int = round($call_minutes, 0); - if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} - - echo ""; - echo "\n"; - echo "\n"; - $total_calls = ($total_calls + $row[0]); - - $call_seconds=0; - $o++; +$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]; + $p++; + $o++; } - $stmt="SELECT 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'"; - $rslt=mysql_query($stmt, $link); - $counts_to_print = mysql_num_rows($rslt); - $row=mysql_fetch_row($rslt); - $call_seconds = $row[0]; +$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) + { + $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"';} + + $call_seconds = $call_sec[$o]; $call_hours = ($call_seconds / 3600); $call_hours_int = round($call_hours, 2); $call_hours_int = intval("$call_hours_int"); @@ -183,6 +205,24 @@ echo ""; + echo "\n"; + echo "\n"; + $total_calls = ($total_calls + $counts[$o]); + $total_sec = ($total_sec + $call_sec[$o]); + $call_seconds=0; + $o++; + } + +$call_seconds = $total_sec; +$call_hours = ($call_seconds / 3600); +$call_hours_int = round($call_hours, 2); +$call_hours_int = intval("$call_hours_int"); +$call_minutes = ($call_hours - $call_hours_int); +$call_minutes = ($call_minutes * 60); +$call_minutes_int = round($call_minutes, 0); +if ($call_minutes_int < 10) {$call_minutes_int = "0$call_minutes_int";} + echo "\n"; echo "
    STATUSCOUNTHOURS:MINUTES
    $row[1] $row[0] $call_hours_int:$call_minutes_int
    STATUSCOUNT$status[$o] $counts[$o] $call_hours_int:$call_minutes_int
    TOTAL CALLS $total_calls $call_hours_int:$call_minutes_int
    \n"; diff --git a/www/vicidial/user_status.php b/www/vicidial/user_status.php index ce92ca13..728bcb11 100644 --- a/www/vicidial/user_status.php +++ b/www/vicidial/user_status.php @@ -1,13 +1,14 @@ LICENSE: AGPLv2 +# Copyright (C) 2009 Matt Florell LICENSE: AGPLv2 # # CHANGES # # 60619-1738 - Added variable filtering to eliminate SQL injection attack threat # 80603-1452 - Added manager timeclock force login/logout of user # 81118-1034 - Disabled change campaign because it does not work +# 90208-0511 - Added link to user multi-day status report # header ("Content-type: text/html; charset=utf-8"); @@ -169,7 +170,7 @@ echo "\n"
    - +
    " ?>   VICIDIAL ADMIN: User Status for  
    @@ -442,9 +443,13 @@ if ($modify_timeclock_log > 0) } +$REPORTdate = date("Y-m-d"); +echo "
    \n"; echo "VICIDIAL Time Sheet\n"; -echo " - User Stats\n"; -echo " - Modify User\n"; +echo " | User Stats\n"; +echo " | Modify User\n"; +echo " | User multiple day status detail report"; +echo "
    \n"; echo "\n"; echo "
    " ?>   VICIDIAL ADMIN: User Status for  
    \n";