diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index 6edd5c53451..c1b2d7c4d6f 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -33,7 +33,7 @@ if ($user->societe_id > 0) */ llxHeader(); -print_titre("Chiffre d'affaire par utilisateur"); +print_titre("Chiffre d'affaire par utilisateur (euros HT)"); /* * Ca total @@ -41,9 +41,10 @@ print_titre("Chiffre d'affaire par utilisateur"); */ $sql = "SELECT sum(f.total) as ca FROM llx_facture as f"; +$sql .= " WHERE f.fk_user_valid is not NULL AND f.fk_statut = 1"; if ($socidp) { - $sql .= " WHERE f.fk_soc = $socidp"; + $sql .= " AND f.fk_soc = $socidp"; } $result = $db->query($sql); if ($result) @@ -55,14 +56,14 @@ if ($result) } } -print "Total : ".price($catotal); +print "
Cumul : ".price($catotal).""; if ($catotal == 0) { $catotal = 1; }; $sql = "SELECT u.name, u.firstname, sum(f.total) as ca"; $sql .= " FROM llx_user as u,llx_facture as f"; -$sql .= " WHERE f.fk_user_author = u.rowid"; +$sql .= " WHERE f.fk_user_valid is not NULL and f.fk_statut = 1 AND f.fk_user_author = u.rowid"; if ($socidp) { $sql .= " AND f.fk_soc = $socidp"; @@ -76,7 +77,7 @@ if ($result) if ($num > 0) { $i = 0; - print "

"; + print "

"; print ""; print ""; print ''; diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index 2caeffb8ba0..e1aff6fd823 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -33,7 +33,7 @@ if ($user->societe_id > 0) */ llxHeader(); -print_titre("Chiffre d'affaire par société"); +print_titre("Chiffre d'affaire par société (euros HT)"); /* * Ca total @@ -41,9 +41,10 @@ print_titre("Chiffre d'affaire par soci */ $sql = "SELECT sum(f.total) as ca FROM llx_facture as f"; +$sql .= " WHERE f.fk_user_valid = 1 AND f.fk_statut = 1"; if ($socidp) { - $sql .= " WHERE f.fk_soc = $socidp"; + $sql .= " AND f.fk_soc = $socidp"; } $result = $db->query($sql); if ($result) @@ -55,14 +56,14 @@ if ($result) } } -print "
Total : ".price($catotal)."
"; +print "
Cumul : ".price($catotal).""; if ($catotal == 0) { $catotal = 1; }; $sql = "SELECT s.nom, s.idp, sum(f.total) as ca"; $sql .= " FROM llx_societe as s,llx_facture as f"; -$sql .= " WHERE f.fk_soc = s.idp"; +$sql .= " WHERE f.fk_statut = 1 and f.fk_user_valid = 1 AND f.fk_soc = s.idp"; if ($socidp) { $sql .= " AND f.fk_soc = $socidp"; @@ -76,7 +77,7 @@ if ($result) if ($num > 0) { $i = 0; - print "

UtilisateurMontantPourcentage
"; + print "

"; print ""; print ""; print '';
SociétéMontantPourcentage