[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/telephonie/stats/lignes/ -> statut.class.php (source)

   1  <?PHP
   2  /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   *
   4   * This program is free software; you can redistribute it and/or modify
   5   * it under the terms of the GNU General Public License as published by
   6   * the Free Software Foundation; either version 2 of the License, or
   7   * (at your option) any later version.
   8   *
   9   * This program is distributed in the hope that it will be useful,
  10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12   * GNU General Public License for more details.
  13   *
  14   * You should have received a copy of the GNU General Public License
  15   * along with this program; if not, write to the Free Software
  16   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17   *
  18   * $Id: statut.class.php,v 1.2 2005/03/10 15:14:21 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/stats/lignes/statut.class.php,v $
  20   *
  21   */
  22  
  23  require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/pie.class.php");
  24  
  25  class GraphLignesStatut extends GraphPie {
  26  
  27    Function GraphLignesStatut($DB, $file)
  28    {
  29      $this->db = $DB;
  30      $this->file = $file;
  31  
  32      $this->client = 0;
  33      $this->titre = "Statuts des lignes";
  34  
  35      $this->barcolor = "yellow";
  36      $this->showframe = true;
  37    }
  38  
  39    Function GraphMakeGraph($commercial_id=0)
  40    {
  41      $num = 0;
  42  
  43      if ($commercial_id > 0)
  44        {
  45      $cuser = new User($this->db, $commercial_id);
  46      $cuser->fetch();
  47      $this->titre = "Statuts des lignes de ".$cuser->fullname;
  48        }
  49  
  50  
  51      $sql = "SELECT statut, count(*)";
  52      $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne";
  53      $sql .= " WHERE statut in (2,3,6,7)";
  54  
  55      if ($commercial_id > 0)
  56        {
  57      $sql .= " AND fk_commercial_sign =".$commercial_id;
  58        }
  59  
  60      $sql .= " GROUP BY statut ASC";
  61      
  62  
  63      $statuts[-1] = "Attente";
  64      $statuts[1] = "A commander";
  65      $statuts[2] = "Commandée";
  66      $statuts[3] = "Activée";
  67      $statuts[4] = "A résilier";
  68      $statuts[5] = "Resil en cours";
  69      $statuts[6] = "Resiliée";
  70      $statuts[7] = "Rejetée";
  71  
  72  
  73      $colors_def[2] = 'blue';
  74      $colors_def[3] = 'green';
  75      $colors_def[6] = 'red';
  76      $colors_def[7] = 'black';
  77  
  78      $this->colors = array();
  79  
  80      if ($this->db->query($sql))
  81        {
  82      $num = $this->db->num_rows();
  83      $i = 0;
  84      $datas = array();
  85      $labels = array();
  86      
  87      while ($i < $num)
  88        {
  89          $row = $this->db->fetch_row();
  90          
  91          $datas[$i] = $row[1];
  92          $labels[$i] = $statuts[$row[0]];
  93          array_push($this->colors, $colors_def[$row[0]]);    
  94          $i++;
  95        }
  96      
  97      $this->db->free();
  98        }
  99      else 
 100        {
 101      print $this->db->error() . ' ' . $sql;
 102        }
 103  
 104    
 105      $this->GraphDraw($this->file, $datas, $labels);
 106    }
 107  }   
 108  ?>


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics