[ 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-distributeurs.php,v 1.5 2005/12/07 15:23:57 rodolphe Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/script/graph-statistiques-distributeurs.php,v $ 20 * 21 * 22 * Generation des graphiques relatifs aux distributeurs 23 * 24 */ 25 require ("../../master.inc.php"); 26 $verbose = 0; 27 for ($i = 1 ; $i <= sizeof($argv) ; $i++) 28 { 29 if ($argv[$i] == "-v") 30 $verbose = 1; 31 } 32 33 require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); 34 require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); 35 require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie-tarif.class.php"); 36 require_once (DOL_DOCUMENT_ROOT."/telephonie/communication.class.php"); 37 38 require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); 39 require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/camenbert.class.php"); 40 require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/commerciaux/commercial.ca.class.php"); 41 require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/commerciaux/commercial.gain.class.php"); 42 require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/commerciaux/groupes/groupe.gain.class.php"); 43 require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/commerciaux/groupes/groupe.ca.class.php"); 44 45 $error = 0; 46 $year = strftime("%Y",time()); 47 /* 48 * Création des répertoires 49 * 50 */ 51 $dirs[0] = DOL_DATA_ROOT."/graph/"; 52 $dirs[1] = DOL_DATA_ROOT."/graph/telephonie/"; 53 $dirs[2] = DOL_DATA_ROOT."/graph/telephonie/distributeurs/"; 54 55 $img_root = DOL_DATA_ROOT."/graph/telephonie/"; 56 57 if (is_array($dirs)) 58 { 59 foreach ($dirs as $key => $value) 60 { 61 $dir = $value; 62 63 if (! file_exists($dir)) 64 { 65 umask(0); 66 if (! @mkdir($dir, 0755)) 67 { 68 print "Erreur: Le répertoire '$dir' n'existe pas et Dolibarr n'a pu le créer."; 69 } 70 else 71 { 72 print $dir ." créé\n"; 73 } 74 } 75 } 76 } 77 require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/distributeurs/distributeur.gain.class.php"); 78 require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/distributeurs/distributeur.ca.class.php"); 79 require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/distributeurs/distributeur.commission.class.php"); 80 require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/distributeurs/distributeur.resultat.class.php"); 81 /* 82 * Distributeurs 83 * 84 */ 85 $sql = "SELECT distinct fk_distributeur"; 86 $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_distributeur_commerciaux"; 87 88 $resql = $db->query($sql); 89 if ($resql) 90 { 91 while ($row = $db->fetch_row($resql)) 92 { 93 /* Ca */ 94 $dir = $img_root . "distributeurs/".$row[0]."/"; 95 _cdir($dir); 96 $file = $dir."ca.mensuel.png"; 97 if ($verbose) print "Graph : ca distributeur ".$row[0]."\n"; 98 if ($verbose==2) print "Graph : ca distributeur $file\n"; 99 $graph = new GraphDistributeurCa($db, $file); 100 $graph->width = 500; 101 $graph->height = 260; 102 $graph->GraphMakeGraph($row[0]); 103 104 /* Gain */ 105 $dir = $img_root . "distributeurs/".$row[0]."/"; 106 _cdir($dir); 107 $file = $dir."gain.mensuel.png"; 108 if ($verbose) print "Graph : gain distributeur ".$row[0]."\n"; 109 $graph = new GraphDistributeurGain($db, $file); 110 $graph->width = 500; 111 $graph->height = 260; 112 $graph->GraphMakeGraph($row[0]); 113 114 /* Commission */ 115 $dir = $img_root . "distributeurs/".$row[0]."/"; 116 _cdir($dir); 117 $file = $dir."commission.mensuel.png"; 118 if ($verbose) print "Graph : commission distributeur ".$row[0]."\n"; 119 $graph = new GraphDistributeurCommission($db, $file); 120 $graph->width = 500; 121 $graph->height = 260; 122 $graph->GraphMakeGraph($row[0]); 123 124 /* Resultat */ 125 $dir = $img_root . "distributeurs/".$row[0]."/"; 126 _cdir($dir); 127 $file = $dir."resultat.mensuel.png"; 128 if ($verbose) print "Graph : resultat distributeur ".$row[0]."\n"; 129 $graph = new GraphDistributeurResultat($db, $file); 130 $graph->width = 500; 131 $graph->height = 260; 132 $graph->GraphMakeGraph($row[0]); 133 } 134 } 135 136 /* 137 * Globaux 138 * 139 */ 140 /* Gain */ 141 $file = $img_root . "distributeurs/gain.mensuel.$year.png"; 142 if ($verbose) print "Graph : gain distributeur $file\n"; 143 $graph = new GraphDistributeurGain($db, $file); 144 $graph->width = 500; 145 $graph->height = 260; 146 $graph->GraphMakeGraph(0); 147 148 $file = $img_root . "distributeurs/ca.mensuel.$year.png"; 149 if ($verbose) print "Graph : ca distributeur $file\n"; 150 $graph = new GraphDistributeurCa($db, $file); 151 $graph->width = 500; 152 $graph->height = 260; 153 $graph->GraphMakeGraph(0); 154 155 $file = $img_root . "distributeurs/commission.mensuel.$year.png"; 156 if ($verbose) print "Graph : commission distributeur $file\n"; 157 $graph = new GraphDistributeurCommission($db, $file); 158 $graph->width = 500; 159 $graph->height = 260; 160 $graph->GraphMakeGraph(0); 161 162 $file = $img_root . "distributeurs/resultat.mensuel.$year.png"; 163 if ($verbose) print "Graph : resultat distributeur $file\n"; 164 $graph = new GraphDistributeurResultat($db, $file); 165 $graph->width = 500; 166 $graph->height = 260; 167 $graph->GraphMakeGraph(0); 168 169 170 function _cdir($dir) 171 { 172 if (! file_exists($dir)) 173 { 174 umask(0); 175 if (! @mkdir($dir, 0755)) 176 { 177 print "Erreur: Le répertoire '$dir' n'existe pas et Dolibarr n'a pu le créer."; 178 } 179 else 180 { 181 //print $dir ." créé\n"; 182 } 183 } 184 } 185 186 ?>
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 |
![]() |