[ Index ] |
|
Code source de Dolibarr 2.0.1 |
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: appelsdureemoyenne.class.php,v 1.7 2005/08/09 14:12:51 rodolphe Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/stats/graph/appelsdureemoyenne.class.php,v $ 20 * 21 */ 22 23 require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); 24 25 class GraphAppelsDureeMoyenne extends GraphBar{ 26 27 28 Function GraphAppelsDureeMoyenne($DB, $file) 29 { 30 $this->db = $DB; 31 $this->file = $file; 32 33 $this->datas = array(); 34 $this->labels = array(); 35 36 $this->client = 0; 37 $this->contrat = 0; 38 $this->ligne = 0; 39 40 $this->titre = "Durée moyenne des appels par mois"; 41 $this->showframe = true; 42 $this->barcolor = "pink"; 43 } 44 45 Function Graph($datas='', $labels='') 46 { 47 $this->GetDatas(); 48 49 $this->width = 360; 50 51 if (sizeof($this->datas)) 52 { 53 $this->GraphDraw($this->file, $this->datas, $this->labels); 54 } 55 } 56 57 Function GetDatas() 58 { 59 $num = 0; 60 61 $sql = "SELECT date_format(td.date,'%Y%m'), sum(td.duree), count(td.duree)"; 62 $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details as td"; 63 64 if ($this->client == 0 && $this->contrat == 0 && $this->ligne == 0) 65 { 66 $sql .= " GROUP BY date_format(td.date,'%Y%m') ASC "; 67 } 68 elseif ($this->client > 0 && $this->contrat == 0 && $this->ligne == 0) 69 { 70 $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as s"; 71 72 $sql .= " WHERE td.ligne = s.ligne"; 73 $sql .= " AND s.fk_client_comm = ".$this->client; 74 $sql .= " GROUP BY date_format(td.date,'%Y%m') ASC "; 75 } 76 elseif ($this->client == 0 && $this->contrat > 0 && $this->ligne == 0) 77 { 78 79 $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as s"; 80 81 $sql .= " WHERE td.ligne = s.ligne"; 82 $sql .= " AND s.fk_contrat = ".$this->contrat; 83 $sql .= " GROUP BY date_format(td.date,'%Y%m') ASC "; 84 } 85 elseif ($this->client == 0 && $this->contrat == 0 && $this->ligne > 0) 86 { 87 88 $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as s"; 89 90 $sql .= " WHERE td.ligne = s.ligne"; 91 $sql .= " AND s.rowid = ".$this->ligne; 92 $sql .= " GROUP BY date_format(td.date,'%Y%m') ASC "; 93 } 94 95 if ($this->db->query($sql)) 96 { 97 $num = $this->db->num_rows(); 98 $i = 0; 99 100 while ($i < $num) 101 { 102 $row = $this->db->fetch_row(); 103 104 $this->labels[$i] = substr($row[0],4,2); 105 $this->datas[$i] = ($row[1] / $row[2] ) ; 106 107 $i++; 108 } 109 110 $this->db->free(); 111 } 112 else 113 { 114 print $this->db->error() . ' ' . $sql; 115 exit ; 116 } 117 118 119 if ($this->show_console) 120 { 121 print $this->client . " " . $cv[$i - 1]."\n"; 122 } 123 } 124 125 } 126 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 12:29:37 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |