From 054c6a5a81fbaf8d398f0a68cb7b801888df6ca6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 14 Feb 2004 02:04:29 +0000 Subject: [PATCH] =?UTF-8?q?Gestion=20du=20param=E8tre=20$conf->compta->mod?= =?UTF-8?q?e=20qui=20vaut=20'DEPENSES-RECETTES'=20par=20d=E9faut,=20sinon?= =?UTF-8?q?=20'CREANCES-DETTES'.=20Il=20d=E9termine=20le=20mode=20de=20cal?= =?UTF-8?q?cul=20du=20CA.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/compta/stats/cabyuser.php | 10 ++++++++-- htdocs/compta/stats/casoc.php | 13 +++++++++++-- htdocs/compta/stats/comp.php | 1 + htdocs/compta/stats/cumul.php | 12 ++++++++++-- htdocs/compta/stats/exercices.php | 1 + htdocs/compta/stats/index.php | 7 +++++-- htdocs/compta/stats/lib.inc.php | 1 + 7 files changed, 37 insertions(+), 8 deletions(-) diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index 65e94d2470f..712cb22e8b3 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -42,7 +42,10 @@ print_titre("Chiffre d'affaire par utilisateur (euros HT)"); */ $sql = "SELECT sum(f.total) as ca FROM ".MAIN_DB_PREFIX."facture as f"; -$sql .= " WHERE f.fk_user_valid is not NULL AND f.fk_statut = 1"; +$sql .= " WHERE f.fk_statut = 1"; +if ($conf->compta->mode != 'CREANCES-DETTES') { + $sql .= " AND f.paye = 1"; +} if ($socidp) { $sql .= " AND f.fk_soc = $socidp"; @@ -64,7 +67,10 @@ if ($catotal == 0) { $catotal = 1; }; $sql = "SELECT u.name, u.firstname, sum(f.total) as ca"; $sql .= " FROM ".MAIN_DB_PREFIX."user as u,".MAIN_DB_PREFIX."facture as f"; -$sql .= " WHERE f.fk_user_valid is not NULL and f.fk_statut = 1 AND f.fk_user_author = u.rowid"; +$sql .= " WHERE f.fk_statut = 1 AND f.fk_user_author = u.rowid"; +if ($conf->compta->mode != 'CREANCES-DETTES') { + $sql .= " AND f.paye = 1"; +} if ($socidp) { $sql .= " AND f.fk_soc = $socidp"; diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index f5037da50be..5184c6c7fba 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -42,7 +42,10 @@ print_titre("Chiffre d'affaire par soci */ $sql = "SELECT sum(f.total) as ca FROM ".MAIN_DB_PREFIX."facture as f"; -$sql .= " WHERE f.fk_user_valid = 1 AND f.fk_statut = 1"; +$sql .= " WHERE f.fk_statut = 1"; +if ($conf->compta->mode != 'CREANCES-DETTES') { + $sql .= " AND f.paye = 1"; +} if ($socidp) { $sql .= " AND f.fk_soc = $socidp"; @@ -56,6 +59,9 @@ if ($result) $catotal = $objp->ca; } } +else { + print $db->error() . "
" . $sql; +} print "
Cumul : ".price($catotal).""; @@ -64,7 +70,10 @@ if ($catotal == 0) { $catotal = 1; }; $sql = "SELECT s.nom, s.idp, sum(f.total) as ca"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; -$sql .= " WHERE f.fk_statut = 1 and f.fk_user_valid = 1 AND f.fk_soc = s.idp"; +$sql .= " WHERE f.fk_statut = 1 AND f.fk_soc = s.idp"; +if ($conf->compta->mode != 'CREANCES-DETTES') { + $sql .= " AND f.paye = 1"; +} if ($socidp) { $sql .= " AND f.fk_soc = $socidp"; diff --git a/htdocs/compta/stats/comp.php b/htdocs/compta/stats/comp.php index f627e483bbe..055ae41296d 100644 --- a/htdocs/compta/stats/comp.php +++ b/htdocs/compta/stats/comp.php @@ -1,5 +1,6 @@ + * Copyright (C) 2004 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/compta/stats/cumul.php b/htdocs/compta/stats/cumul.php index 07004cf5776..54586a965f9 100644 --- a/htdocs/compta/stats/cumul.php +++ b/htdocs/compta/stats/cumul.php @@ -41,7 +41,11 @@ print_titre("Chiffre d'affaire cumul print '
'; $sql = "SELECT sum(f.total) as amount , date_format(f.datef,'%Y-%m') as dm"; -$sql .= " FROM ".MAIN_DB_PREFIX."facture as f WHERE fk_user_valid is not NULL and f.paye = 1"; +$sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; +$sql .= " WHERE f.fk_statut = 1"; +if ($conf->compta->mode != 'CREANCES-DETTES') { + $sql .= " AND f.paye = 1"; +} if ($socidp) { $sql .= " AND f.fk_soc = $socidp"; @@ -53,7 +57,11 @@ pt($db, $sql,"Suivi cumul par mois"); print ""; $sql = "SELECT sum(f.total) as amount, year(f.datef) as dm"; -$sql .= " FROM ".MAIN_DB_PREFIX."facture as f WHERE fk_user_valid is not NULL and f.paye = 1"; +$sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; +$sql .= " WHERE f.fk_statut = 1"; +if ($conf->compta->mode != 'CREANCES-DETTES') { + $sql .= " AND f.paye = 1"; +} if ($socidp) { $sql .= " AND f.fk_soc = $socidp"; diff --git a/htdocs/compta/stats/exercices.php b/htdocs/compta/stats/exercices.php index d4529550940..781d5134712 100644 --- a/htdocs/compta/stats/exercices.php +++ b/htdocs/compta/stats/exercices.php @@ -1,5 +1,6 @@ + * Copyright (C) 2004 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 908db13f70e..c59ad29ff79 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -39,8 +39,11 @@ if ($user->societe_id > 0) print_titre("Chiffre d'affaire (".MAIN_MONNAIE." HT)"); $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"; +$sql .= " WHERE f.fk_statut = 1"; +if ($conf->compta->mode != 'CREANCES-DETTES') { + $sql .= " AND f.paye = 1"; +} if ($socidp) { $sql .= " AND f.fk_soc = $socidp"; diff --git a/htdocs/compta/stats/lib.inc.php b/htdocs/compta/stats/lib.inc.php index 407695213af..b6102b5d64e 100644 --- a/htdocs/compta/stats/lib.inc.php +++ b/htdocs/compta/stats/lib.inc.php @@ -1,5 +1,6 @@ + * Copyright (C) 2004 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by