From 9a8a068e0c481cb5fed84f9405daeb067d139ff9 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Mon, 24 Nov 2003 09:11:33 +0000 Subject: [PATCH] =?UTF-8?q?Ajout=20s=E9curit=E9=20acc=E9s=20client?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../compta/facture/stats/facturestats.class.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/stats/facturestats.class.php b/htdocs/compta/facture/stats/facturestats.class.php index 0ccd8920504..6cb4bb14c79 100644 --- a/htdocs/compta/facture/stats/facturestats.class.php +++ b/htdocs/compta/facture/stats/facturestats.class.php @@ -26,9 +26,10 @@ class FactureStats extends Stats { var $db ; - Function FactureStats($DB) + Function FactureStats($DB, $socidp=0) { $this->db = $DB; + $this->socidp = $socidp; } @@ -40,6 +41,10 @@ class FactureStats extends Stats { $sql = "SELECT date_format(datef,'%m') as dm, count(*) FROM llx_facture"; $sql .= " WHERE date_format(datef,'%Y') = $year AND fk_statut > 0"; + if ($this->socidp) + { + $sql .= " AND fk_soc = ".$this->socidp; + } $sql .= " GROUP BY dm DESC"; return $this->_getNbByMonth($year, $sql); @@ -64,6 +69,10 @@ class FactureStats extends Stats { $sql = "SELECT date_format(datef,'%m') as dm, sum(total) FROM llx_facture"; $sql .= " WHERE date_format(datef,'%Y') = $year AND fk_statut > 0"; + if ($this->socidp) + { + $sql .= " AND fk_soc = ".$this->socidp; + } $sql .= " GROUP BY dm DESC"; return $this->_getAmountByMonth($year, $sql); @@ -76,6 +85,10 @@ class FactureStats extends Stats { $sql = "SELECT date_format(datef,'%m') as dm, avg(total) FROM llx_facture"; $sql .= " WHERE date_format(datef,'%Y') = $year AND fk_statut > 0"; + if ($this->socidp) + { + $sql .= " AND fk_soc = ".$this->socidp; + } $sql .= " GROUP BY dm DESC"; return $this->_getAverageByMonth($year, $sql);