Ajout totaux

This commit is contained in:
Rodolphe Quiedeville 2005-11-16 12:33:38 +00:00
parent 9686c908f3
commit 06f1ddeeb0

View File

@ -43,6 +43,7 @@ $h++;
$year = strftime("%Y",time()); $year = strftime("%Y",time());
$total = 0; $total = 0;
$var = True;
dolibarr_fiche_head($head, $hselected, "Distributeurs"); dolibarr_fiche_head($head, $hselected, "Distributeurs");
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
@ -88,14 +89,15 @@ $sql = "SELECT sum(valeur),legend FROM ".MAIN_DB_PREFIX."telephonie_stats";
$sql .= " WHERE graph = 'distributeur.gain.mensuel'"; $sql .= " WHERE graph = 'distributeur.gain.mensuel'";
$sql .= " GROUP BY legend DESC"; $sql .= " GROUP BY legend DESC";
$resql = $db->query($sql); $resql = $db->query($sql);
$total = 0;
if ($resql) if ($resql)
{ {
while ($row = $db->fetch_row($resql)) while ($row = $db->fetch_row($resql))
{ {
$var=!$var;
print "<tr $bc[$var]><td>".$row[1].'</td>'; print "<tr $bc[$var]><td>".$row[1].'</td>';
print '<td align="right">'.price($row[0]).'</td></tr>'; print '<td align="right">'.price($row[0]).'</td></tr>';
$total += $row[0];
$var=!$var;
} }
$db->free(); $db->free();
} }
@ -103,6 +105,8 @@ else
{ {
print $db->error() . ' ' . $sql; print $db->error() . ' ' . $sql;
} }
print "<tr $bc[$var]><td>Total</td>";
print '<td align="right">'.price($total).'</td></tr>';
print '</table>'; print '</table>';
print '</td></tr><tr><td valign="top" width="70%">'; print '</td></tr><tr><td valign="top" width="70%">';
@ -117,28 +121,31 @@ $sql = "SELECT valeur,legend FROM ".MAIN_DB_PREFIX."telephonie_stats";
$sql .= " WHERE graph = 'distributeur.commission.mensuel'"; $sql .= " WHERE graph = 'distributeur.commission.mensuel'";
$sql .= " GROUP BY legend DESC"; $sql .= " GROUP BY legend DESC";
$resql = $db->query($sql); $resql = $db->query($sql);
$total = 0;
if ($resql) if ($resql)
{
while ($row = $db->fetch_row($resql))
{ {
while ($row = $db->fetch_row($resql)) print "<tr $bc[$var]><td>".$row[1].'</td>';
{ print '<td align="right">'.price($row[0]).'</td></tr>';
$var=!$var; $total += $row[0];
print "<tr $bc[$var]><td>".$row[1].'</td>'; $var=!$var;
print '<td align="right">'.price($row[0]).'</td></tr>';
}
$db->free();
} }
else $db->free();
{ }
print $db->error() . ' ' . $sql; else
} {
print '</table>'; print $db->error() . ' ' . $sql;
}
print "<tr $bc[$var]><td>Total</td>";
print '<td align="right">'.price($total).'</td></tr>';
print '</table>';
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
$db->close(); $db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>"); llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");