[ 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: graph-statistiques-communications.php,v 1.3 2005/10/18 10:37:57 rodolphe Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/script/graph-statistiques-communications.php,v $ 20 * 21 * 22 * Generation des graphiques 23 * 24 * 25 * 26 */ 27 require ("../../master.inc.php"); 28 29 require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); 30 31 $img_root = DOL_DATA_ROOT."/graph/telephonie/"; 32 33 $nbval = 14; 34 35 /* 36 * Remplacé par ...statistiques-fournisseurs.php 37 * 38 $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats"; 39 $sql .= " WHERE graph = 'communications.duree'"; 40 41 $resql = $db->query($sql); 42 43 $sql = "SELECT date_format(date, '%m'), sum(duree), count(duree)"; 44 $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; 45 $sql .= " GROUP BY date_format(date, '%Y%m') ASC"; 46 $resql = $db->query($sql); 47 48 _deal($db, $resql, "communications.duree", $kilomindurees, $labels); 49 50 $file = $img_root . "communications/duree.png"; 51 $graphgain = new GraphBar ($db, $file); 52 $graphgain->show_console = 0 ; 53 $graphgain->width = 480 ; 54 $graphgain->titre = "Nb minutes (milliers)"; 55 print $graphgain->titre."\n"; 56 $graphgain->GraphDraw($file, $kilomindurees, $labels); 57 */ 58 59 /* 60 * 61 * 62 */ 63 64 $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats"; 65 $sql .= " WHERE graph = 'communications.duree_mobiles'"; 66 67 $resql = $db->query($sql); 68 69 $sql = "SELECT date_format(date, '%m'), sum(duree), count(duree)"; 70 $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; 71 $sql .= " WHERE numero like '06%'"; 72 $sql .= " GROUP BY date_format(date, '%Y%m') ASC"; 73 74 $resql = $db->query($sql); 75 76 if ($resql) 77 { 78 $durees = array(); 79 $kilomindurees = array(); 80 $labels = array(); 81 82 $num = $db->num_rows($resql); 83 $lim = ($num - $nbval); 84 $i = 0; 85 $j = 0; 86 87 while ($i < $num) 88 { 89 $row = $db->fetch_row($resql); 90 if ($i >= $lim ) 91 { 92 $labels[$j] = $row[0]; 93 $durees[$j] = $row[1]; 94 $kilomindurees_mob[$j] = ($row[1]/60000); 95 96 $sqli = " INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats"; 97 $sqli .= " (graph, ord, legend, valeur) VALUES ("; 98 $sqli .= "'communications.duree_mobiles','".$j."','".$row[0]."','".($row[1]/60)."')"; 99 100 if (!$resqli = $db->query($sqli)) 101 { 102 print $db->error(); 103 } 104 $j++; 105 } 106 $i++; 107 } 108 } 109 110 $file = $img_root . "communications/duree_mob.png"; 111 $graphgain = new GraphBar ($db, $file); 112 $graphgain->show_console = 0 ; 113 $graphgain->width = 480 ; 114 $graphgain->titre = "Nb minutes -> portables (milliers)"; 115 print $graphgain->titre."\n"; 116 $graphgain->GraphDraw($file, $kilomindurees_mob, $labels); 117 118 function _deal($db, $resql, $graph, &$data, &$labels) 119 { 120 global $nbval; 121 122 if ($resql) 123 { 124 $num = $db->num_rows($resql); 125 $lim = ($num - $nbval); 126 $i = 0; 127 $j = 0; 128 129 while ($i < $num) 130 { 131 $row = $db->fetch_row($resql); 132 133 if ($i >= $lim ) 134 { 135 $labels[$j] = $row[0]; 136 $data[$j] = ($row[1]/60000); 137 138 $sqli = " INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats"; 139 $sqli .= " (graph, ord, legend, valeur) VALUES ("; 140 $sqli .= "'".$graph."','".$j."','".$row[0]."','".($row[1]/60)."')"; 141 142 if (!$resqli = $db->query($sqli)) 143 { 144 print $db->error(); 145 } 146 $j++; 147 } 148 $i++; 149 } 150 } 151 } 152 ?>
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 |
![]() |