diff --git a/htdocs/compta/ca.php3 b/htdocs/compta/ca.php3 index 5ed0673fc62..358b1bff9db 100644 --- a/htdocs/compta/ca.php3 +++ b/htdocs/compta/ca.php3 @@ -39,45 +39,64 @@ if ($user->societe_id > 0) print_titre("Chiffres d'affaires en euros HT"); -print "
| "; $sql = "SELECT sum(f.amount) as amount , date_format(f.datef,'%Y-%m') as dm"; $sql .= " FROM llx_facture as f WHERE f.paye = 1"; + if ($socidp) { $sql .= " AND f.fk_soc = $socidp"; } $sql .= " GROUP BY dm DESC"; -pt($db, $sql,"Par mois"); - -print " | ";
-
-$sql = "SELECT sum(f.amount) as amount, month(f.datef) as dm";
-$sql .= " FROM llx_facture as f WHERE f.paye = 1";
-if ($socidp)
-{
- $sql .= " AND f.fk_soc = $socidp";
+$result = $db->query($sql);
+if ($result) {
+ $num = $db->num_rows();
+ $i = 0;
+ $var=True;
+ while ($i < $num)
+ {
+ $row = $db->fetch_row($i);
+ $cum[$row[1]] = $row[0];
+ $i++;
+ }
}
-$sql .= " GROUP BY dm";
-
-pt($db, $sql,"Mois cumulés");
-print " "; -$sql = "SELECT sum(f.amount) as amount, year(f.datef) as dm"; -$sql .= " FROM llx_facture as f WHERE f.paye = 1"; -if ($socidp) +print '
|