From d51ad5aa89b43fb8a8b382c19a5b9f49e72565bf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 24 Jan 2004 16:37:30 +0000 Subject: [PATCH] =?UTF-8?q?Le=20CA=20par=20utilisateur=20et=20soci=E9t=E9?= =?UTF-8?q?=20ne=20doit=20pas=20inclure=20les=20factures=20=E0=20l'=E9tat?= =?UTF-8?q?=20brouillons.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/compta/stats/cabyuser.php | 11 ++++++----- htdocs/compta/stats/casoc.php | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) 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