[ 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: distributeur.resultat.class.php,v 1.6 2005/11/16 12:43:13 rodolphe Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/stats/distributeurs/distributeur.resultat.class.php,v $ 20 * 21 */ 22 23 require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); 24 25 class GraphDistributeurResultat extends GraphBar { 26 27 Function GraphDistributeurResultat($DB, $file) 28 { 29 $this->db = $DB; 30 $this->file = $file; 31 $this->client = 0; 32 $this->year = strftime("%Y",time()); 33 $this->titre = "Resultat mensuel ".$this->year." (marges - commissions)"; 34 $this->year = strftime("%Y",time()); 35 $this->barcolor = "green"; 36 $this->showframe = true; 37 } 38 39 Function GraphMakeGraph($distributeur=0) 40 { 41 $comms = array(); 42 $gains = array(); 43 $num = 0; 44 $this->no_xaxis_title=1; 45 46 $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats"; 47 if ($distributeur > 0 ){ 48 $sql .= " WHERE graph='distributeur.resultat.mensuel.".$distributeur."'"; 49 } else { 50 $sql .= " WHERE graph='distributeur.resultat.mensuel'"; 51 } 52 $sql .= " AND legend like '".$this->year."%';"; 53 $resql = $this->db->query($sql); 54 55 $sql = "SELECT legend, valeur"; 56 $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_stats"; 57 if ($distributeur > 0 ){ 58 $sql .= " WHERE graph = 'distributeur.gain.mensuel.".$distributeur."'"; 59 } else { 60 $sql .= " WHERE graph = 'distributeur.gain.mensuel'"; 61 } 62 $sql .= " ORDER BY ord ASC;"; 63 $resql = $this->db->query($sql); 64 65 if ($resql) 66 { 67 while ($row = $this->db->fetch_row($resql)) 68 { 69 $gains[$row[0]] = $row[1]; 70 } 71 } 72 73 $sql = "SELECT legend, valeur"; 74 $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_stats"; 75 if ($distributeur > 0 ){ 76 $sql .= " WHERE graph = 'distributeur.commission.mensuel.".$distributeur."'"; 77 } else { 78 $sql .= " WHERE graph = 'distributeur.commission.mensuel'"; 79 } 80 $sql .= " ORDER BY ord ASC"; 81 $resql = $this->db->query($sql); 82 83 if ($resql) 84 { 85 while ($row = $this->db->fetch_row($resql)) 86 { 87 $comms[$row[0]] = $row[1]; 88 } 89 } 90 91 $datas = array(); 92 $labels = array(); 93 94 $month = array(); 95 $month[1] = 'J'; 96 $month[2] = 'F'; 97 $month[3] = 'M'; 98 $month[4] = 'A'; 99 $month[5] = 'M'; 100 $month[6] = 'J'; 101 $month[7] = 'J'; 102 $month[8] = 'A'; 103 $month[9] = 'S'; 104 $month[10] = 'O'; 105 $month[11] = 'N'; 106 $month[12] = 'D'; 107 108 for ($i = 1 ; $i < 13 ; $i++) 109 { 110 $idx = $this->year.substr('0'.$i,-2); 111 $datas[$i-1] = $gains[$idx] - $comms[$idx]; 112 $labels[$i-1] = $month[$i]; 113 114 if ($distributeur > 0 ){ 115 $sqli = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats"; 116 $sqli .= " (graph,ord,legend,valeur)"; 117 $sqli .= " VALUES ('distributeur.resultat.mensuel.".$distributeur."'"; 118 $sqli .= ",'$i','".$idx."','".$datas[$i-1]."');"; 119 $resqli = $this->db->query($sqli); 120 } else { 121 $sqli = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats"; 122 $sqli .= " (graph,ord,legend,valeur)"; 123 $sqli .= " VALUES ('distributeur.resultat.mensuel'"; 124 $sqli .= ",'$i','".$idx."','".$datas[$i-1]."');"; 125 $resqli = $this->db->query($sqli); 126 } 127 128 } 129 130 if (sizeof($datas)) 131 { 132 $this->GraphDraw($this->file, $datas, $labels); 133 } 134 } 135 } 136 ?>
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 |
![]() |