[ 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: resiliation.week.class.php,v 1.3 2005/02/16 13:33:30 rodolphe Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/stats/lignes/resiliation.week.class.php,v $ 20 * 21 */ 22 23 24 require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); 25 26 class GraphLignesResiliationWeek extends GraphBar { 27 28 Function GraphLignesResiliationWeek($DB, $file) 29 { 30 $this->db = $DB; 31 $this->file = $file; 32 33 $this->client = 0; 34 $this->titre = "Résiliation de lignes par semaine"; 35 36 $this->barcolor = "red"; 37 $this->showframe = true; 38 } 39 40 41 Function ReadDatas() 42 { 43 $num = 0; 44 45 $sql = "SELECT count(*), date_format(tms,'%y%v')"; 46 $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne_statut"; 47 $sql .= " WHERE statut = 6"; 48 $sql .= " GROUP BY date_format(tms,'%y%v') ASC"; 49 50 if ($this->db->query($sql)) 51 { 52 $num = $this->db->num_rows(); 53 54 $i = 0; 55 $j = 0; 56 $this->datas = array(); 57 $this->labels = array(); 58 $oldweek = 0; 59 $clients = array(); 60 61 while ($i < $num) 62 { 63 $row = $this->db->fetch_row(); 64 65 $this->datas[$row[1]] = $row[0]; 66 $this->labels[$i] = $row[1]; 67 68 $i++; 69 } 70 71 $this->db->free(); 72 } 73 else 74 { 75 print $this->db->error() . ' ' . $sql; 76 } 77 } 78 /* 79 * 80 * 81 */ 82 Function GraphMakeGraph() 83 { 84 85 $this->ReadDatas(); 86 87 $datas_new = array(); 88 $labels_new = array(); 89 90 $max = strftime("%y%V", time()); 91 $week = $max; 92 $year = substr($week,0,2); 93 $smwee = substr($max, -2); 94 95 for ($i = 0 ; $i < 18 ; $i++) 96 { 97 98 $datas_new[$i] = $this->datas[$year.$smwee]; 99 100 $labels_new[$i] = ceil($smwee); 101 102 if (($smwee - 1) == 0) 103 { 104 $smwee = strftime("%V",mktime(12,0,2,12,31,"20".substr("00".($year - 1), -2))); 105 106 if ($smwee == '01') 107 { 108 $smwee = 52; 109 } 110 111 $year = substr("00".($year - 1), -2); 112 } 113 else 114 { 115 $smwee = substr("00".($smwee -1), -2); 116 } 117 } 118 119 $datas_new = array_reverse($datas_new); 120 $labels_new = array_reverse($labels_new); 121 122 $this->GraphDraw($this->file, $datas_new, $labels_new); 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 |
![]() |