From dad788e80cec6f58867cd8282de88dea342ac2cc Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Tue, 15 Mar 2005 16:56:32 +0000 Subject: [PATCH] Ajoute les graph des lignes --- .../stats/graph/comm.nbmensuel.class.php | 35 ++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/htdocs/telephonie/stats/graph/comm.nbmensuel.class.php b/htdocs/telephonie/stats/graph/comm.nbmensuel.class.php index f7c41d7084c..3ced38baddc 100644 --- a/htdocs/telephonie/stats/graph/comm.nbmensuel.class.php +++ b/htdocs/telephonie/stats/graph/comm.nbmensuel.class.php @@ -32,7 +32,9 @@ class GraphCommNbMensuel extends GraphBar{ $this->file = $file; $this->showframe = true; $this->client = 0; - $this->titre = "Nombre de communication par mois"; + $this->contrat = 0; + $this->ligne = 0; + $this->titre = "Nombre de communications"; $this->barcolor = "bisque3"; @@ -52,17 +54,17 @@ class GraphCommNbMensuel extends GraphBar{ Function GetDatas() { - if ($this->client == 0) + $sql = "SELECT date_format(td.date,'%Y%m'), count(*)"; + $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details as td"; + + if ($this->client == 0 && $this->contrat == 0 && $this->ligne == 0) { - $sql = "SELECT date_format(date, '%Y%m'), count(*)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; - $sql .= " GROUP BY date_format(date, '%Y%m') ASC"; + $sql .= " GROUP BY date_format(td.date, '%Y%m') ASC"; } - else + elseif ($this->client > 0 && $this->contrat == 0 && $this->ligne == 0) { - $sql = "SELECT date_format(td.date,'%Y%m'), count(*)"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details as td"; + $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as s"; $sql .= " WHERE td.ligne = s.ligne"; @@ -70,7 +72,24 @@ class GraphCommNbMensuel extends GraphBar{ $sql .= " GROUP BY date_format(td.date,'%Y%m') ASC "; } + elseif ($this->client == 0 && $this->contrat > 0 && $this->ligne == 0) + { + $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as s"; + $sql .= " WHERE td.ligne = s.ligne"; + $sql .= " AND s.fk_contrat = ".$this->contrat; + + $sql .= " GROUP BY date_format(td.date,'%Y%m') ASC "; + } + elseif ($this->client == 0 && $this->contrat == 0 && $this->ligne > 0) + { + $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as s"; + + $sql .= " WHERE td.ligne = s.ligne"; + $sql .= " AND s.rowid = ".$this->ligne; + + $sql .= " GROUP BY date_format(td.date,'%Y%m') ASC "; + } if ($this->db->query($sql)) {