Ajout ligne "Total" sur la page du chiffre d'affaire.

This commit is contained in:
Laurent Destailleur 2004-02-08 17:38:37 +00:00
parent 094df60244
commit dd800d4867

View File

@ -35,7 +35,7 @@ if ($user->societe_id > 0)
$socidp = $user->societe_id; $socidp = $user->societe_id;
} }
print_titre("Chiffres d'affaires (".MAIN_MONNAIE." HT)"); print_titre("Chiffre d'affaire (".MAIN_MONNAIE." HT)");
$sql = "SELECT sum(f.total) as amount , date_format(f.datef,'%Y-%m') as dm"; $sql = "SELECT sum(f.total) as amount , date_format(f.datef,'%Y-%m') as dm";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f WHERE f.paye = 1"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f WHERE f.paye = 1";
@ -80,8 +80,7 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{ {
print '<td align="center" width="10%">'.$annee.'</td>'; print '<td align="center" width="10%">'.$annee.'</td>';
} }
print '<td width="50%" rowspan="13">&nbsp;</td></tr>'; print '</tr>';
for ($mois = 1 ; $mois < 13 ; $mois++) for ($mois = 1 ; $mois < 13 ; $mois++)
{ {
$var=!$var; $var=!$var;
@ -97,11 +96,21 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++)
print price($cum[$case]); print price($cum[$case]);
} }
print "</td>"; print "</td>";
$total[$annee]+=$cum[$case];
} }
print '</tr>'; print '</tr>';
} }
// Affiche total
print "<tr><td align=\"right\">Total : </td>";
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{
print "<td align=\"right\"><b>".($total[$annee]?$total[$annee]:"&nbsp;")."</b></td>";
}
print "</tr>\n";
print "</table>"; print "</table>";
$db->close(); $db->close();