diff --git a/htdocs/telephonie/stats/distributeurs/resultats.php b/htdocs/telephonie/stats/distributeurs/resultats.php
index 6b7357e1b7e..0b3909f5f23 100644
--- a/htdocs/telephonie/stats/distributeurs/resultats.php
+++ b/htdocs/telephonie/stats/distributeurs/resultats.php
@@ -43,6 +43,7 @@ $h++;
$year = strftime("%Y",time());
$total = 0;
+$var = True;
dolibarr_fiche_head($head, $hselected, "Distributeurs");
print '
';
@@ -88,14 +89,15 @@ $sql = "SELECT sum(valeur),legend FROM ".MAIN_DB_PREFIX."telephonie_stats";
$sql .= " WHERE graph = 'distributeur.gain.mensuel'";
$sql .= " GROUP BY legend DESC";
$resql = $db->query($sql);
-
+$total = 0;
if ($resql)
{
while ($row = $db->fetch_row($resql))
{
- $var=!$var;
print "| ".$row[1].' | ';
print ''.price($row[0]).' |
';
+ $total += $row[0];
+ $var=!$var;
}
$db->free();
}
@@ -103,6 +105,8 @@ else
{
print $db->error() . ' ' . $sql;
}
+print "| Total | ";
+print ''.price($total).' |
';
print '
';
print '| ';
@@ -117,28 +121,31 @@ $sql = "SELECT valeur,legend FROM ".MAIN_DB_PREFIX."telephonie_stats";
$sql .= " WHERE graph = 'distributeur.commission.mensuel'";
$sql .= " GROUP BY legend DESC";
$resql = $db->query($sql);
-
- if ($resql)
+$total = 0;
+if ($resql)
+{
+ while ($row = $db->fetch_row($resql))
{
- while ($row = $db->fetch_row($resql))
- {
- $var=!$var;
- print " |
| ".$row[1].' | ';
- print ''.price($row[0]).' |
';
- }
- $db->free();
+ print "| ".$row[1].' | ';
+ print ''.price($row[0]).' |
';
+ $total += $row[0];
+ $var=!$var;
}
- else
- {
- print $db->error() . ' ' . $sql;
- }
- print '';
+ $db->free();
+}
+else
+{
+ print $db->error() . ' ' . $sql;
+}
+print "| Total | ";
+print ''.price($total).' |
';
+print '';
- print '';
- print '';
-
- $db->close();
+print '';
+print '';
+
+$db->close();
llxFooter("Dernière modification $Date$ révision $Revision$");