diff --git a/htdocs/telephonie/stats/distributeurs/distributeur.php b/htdocs/telephonie/stats/distributeurs/distributeur.php index fe014573a98ebe00b799bca78b4f9d1b824e99d2..d580100d345ecf2f6152264f9f33bf41d3dec041 100644 --- a/htdocs/telephonie/stats/distributeurs/distributeur.php +++ b/htdocs/telephonie/stats/distributeurs/distributeur.php @@ -102,6 +102,8 @@ if ($_GET["id"]) print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=telephoniegraph&file=distributeurs/'.$_GET["id"].'/clients.hebdomadaire.png" alt="Nouveaux clients" title="Nouveaux clients"><br /><br />'."\n"; + print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=telephoniegraph&file=distributeurs/'.$_GET["id"].'/resultat.mensuel.png" alt="Commission mensuelle" title="Commission mensuelle"><br /><br />'."\n"; + print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=telephoniegraph&file=distributeurs/'.$_GET["id"].'/gain.mensuel.png" alt="Gain mensuel" title="Gain mensuel"><br /><br />'."\n"; print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=telephoniegraph&file=distributeurs/'.$_GET["id"].'/commission.mensuel.png" alt="Commission mensuelle" title="Commission mensuelle"><br /><br />'."\n"; diff --git a/htdocs/telephonie/stats/distributeurs/distributeur.resultat.class.php b/htdocs/telephonie/stats/distributeurs/distributeur.resultat.class.php new file mode 100644 index 0000000000000000000000000000000000000000..4389ece8c397b863d406733b658a88ffae5e9da0 --- /dev/null +++ b/htdocs/telephonie/stats/distributeurs/distributeur.resultat.class.php @@ -0,0 +1,90 @@ +<?PHP +/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php"); + +class GraphDistributeurResultat extends GraphBar { + + Function GraphDistributeurResultat($DB, $file) + { + $this->db = $DB; + $this->file = $file; + $this->client = 0; + $this->titre = "Resultat mensuel"; + + $this->barcolor = "green"; + $this->showframe = true; + } + + Function GraphMakeGraph($distributeur=0) + { + $comms = array(); + $gains = array(); + $num = 0; + + $this->no_xaxis_title=1; + + $sql = "SELECT legend, valeur"; + $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_stats"; + $sql .= " WHERE graph = 'distributeur.gain.mensuel.".$distributeur."'"; + $sql .= " ORDER BY ord ASC"; + $resql = $this->db->query($sql); + + if ($resql) + { + while ($row = $this->db->fetch_row($resql)) + { + $gains[$row[0]] = $row[1]; + } + } + + $sql = "SELECT legend, valeur"; + $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_stats"; + $sql .= " WHERE graph = 'distributeur.commission.mensuel.".$distributeur."'"; + $sql .= " ORDER BY ord ASC"; + $resql = $this->db->query($sql); + + if ($resql) + { + while ($row = $this->db->fetch_row($resql)) + { + $comms[$row[0]] = $row[1]; + } + } + + $datas = array(); + $labels = array(); + $year = strftime("%Y",time()); + for ($i = 1 ; $i < 13 ; $i++) + { + $idx = $year.substr('0'.$i,-2); + $datas[$i-1] = $gains[$idx] - $comms[$idx]; + $labels[$i-1] = $i; + } + + if (sizeof($datas)) + { + $this->GraphDraw($this->file, $datas, $labels); + } + } +} +?>