diff --git a/htdocs/telephonie/script/graph-statistiques-distributeurs.php b/htdocs/telephonie/script/graph-statistiques-distributeurs.php index 06d8f83ea8e..fc66b0d419f 100644 --- a/htdocs/telephonie/script/graph-statistiques-distributeurs.php +++ b/htdocs/telephonie/script/graph-statistiques-distributeurs.php @@ -24,12 +24,25 @@ */ require ("../../master.inc.php"); $verbose = 0; + +$year = strftime("%Y",time()); + for ($i = 1 ; $i <= sizeof($argv) ; $i++) { if ($argv[$i] == "-v") $verbose = 1; + + if ($argv[$i] == "-vv") + $verbose = 1; + + if ($argv[$i] == "-y") + { + $year = $argv[$i+1]; + } } +if ($verbose) print "Année $year\n"; + require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie-tarif.class.php"); @@ -43,11 +56,8 @@ require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/commerciaux/groupes/groupe.ga require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/commerciaux/groupes/groupe.ca.class.php"); $error = 0; -$year = strftime("%Y",time()); -if (strftime("%m",time()) == 1) -{ - $year = $year -1; -} + + /* * Création des répertoires * @@ -101,6 +111,7 @@ if ($resql) if ($verbose) print "Graph : ca distributeur ".$row[0]."\n"; if ($verbose==2) print "Graph : ca distributeur $file\n"; $graph = new GraphDistributeurCa($db, $file); + $graph->year = $year; $graph->width = 500; $graph->height = 260; $graph->GraphMakeGraph($row[0]); @@ -111,6 +122,7 @@ if ($resql) $file = $dir."gain.mensuel.png"; if ($verbose) print "Graph : gain distributeur ".$row[0]."\n"; $graph = new GraphDistributeurGain($db, $file); + $graph->year = $year; $graph->width = 500; $graph->height = 260; $graph->GraphMakeGraph($row[0]); @@ -121,6 +133,7 @@ if ($resql) $file = $dir."commission.mensuel.png"; if ($verbose) print "Graph : commission distributeur ".$row[0]."\n"; $graph = new GraphDistributeurCommission($db, $file); + $graph->year = $year; $graph->width = 500; $graph->height = 260; $graph->GraphMakeGraph($row[0]); @@ -131,6 +144,7 @@ if ($resql) $file = $dir."resultat.mensuel.png"; if ($verbose) print "Graph : resultat distributeur ".$row[0]."\n"; $graph = new GraphDistributeurResultat($db, $file); + $graph->year = $year; $graph->width = 500; $graph->height = 260; $graph->GraphMakeGraph($row[0]); @@ -145,6 +159,7 @@ if ($resql) $file = $img_root . "distributeurs/gain.mensuel.$year.png"; if ($verbose) print "Graph : gain distributeur $file\n"; $graph = new GraphDistributeurGain($db, $file); +$graph->year = $year; $graph->width = 500; $graph->height = 260; $graph->GraphMakeGraph(0); @@ -152,6 +167,7 @@ $graph->GraphMakeGraph(0); $file = $img_root . "distributeurs/ca.mensuel.$year.png"; if ($verbose) print "Graph : ca distributeur $file\n"; $graph = new GraphDistributeurCa($db, $file); +$graph->year = $year; $graph->width = 500; $graph->height = 260; $graph->GraphMakeGraph(0); @@ -159,6 +175,7 @@ $graph->GraphMakeGraph(0); $file = $img_root . "distributeurs/commission.mensuel.$year.png"; if ($verbose) print "Graph : commission distributeur $file\n"; $graph = new GraphDistributeurCommission($db, $file); +$graph->year = $year; $graph->width = 500; $graph->height = 260; $graph->GraphMakeGraph(0); @@ -166,6 +183,7 @@ $graph->GraphMakeGraph(0); $file = $img_root . "distributeurs/resultat.mensuel.$year.png"; if ($verbose) print "Graph : resultat distributeur $file\n"; $graph = new GraphDistributeurResultat($db, $file); +$graph->year = $year; $graph->width = 500; $graph->height = 260; $graph->GraphMakeGraph(0); diff --git a/htdocs/telephonie/stats/distributeurs/distributeur.ca.class.php b/htdocs/telephonie/stats/distributeurs/distributeur.ca.class.php index 2e2ce3f7aab..0ed87a63f40 100644 --- a/htdocs/telephonie/stats/distributeurs/distributeur.ca.class.php +++ b/htdocs/telephonie/stats/distributeurs/distributeur.ca.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2006 Rodolphe Quiedeville * * 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 @@ -28,19 +28,17 @@ class GraphDistributeurCa extends GraphBar { { $this->db = $DB; $this->file = $file; - $this->client = 0; $this->year = strftime("%Y",time()); - $this->titre = "Chiffre d'affaire ".$this->year; - $this->barcolor = "blue"; $this->showframe = true; } Function GraphMakeGraph($distributeur=0) { + $this->titre = "Chiffre d'affaire ".$this->year; $num = 0; - $year = strftime("%Y",time()); + $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats"; if ($distributeur > 0) @@ -127,7 +125,7 @@ class GraphDistributeurCa extends GraphBar { for ($i = 1 ; $i < 13 ; $i++) { - $idx = $year.substr('0'.$i,-2); + $idx = $this->year.substr('0'.$i,-2); if ($cas[$idx]) { $datas[$i-1] = $cas[$idx]; diff --git a/htdocs/telephonie/stats/distributeurs/distributeur.commission.class.php b/htdocs/telephonie/stats/distributeurs/distributeur.commission.class.php index 1a22e0f6dd1..2b713b3b243 100644 --- a/htdocs/telephonie/stats/distributeurs/distributeur.commission.class.php +++ b/htdocs/telephonie/stats/distributeurs/distributeur.commission.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2006 Rodolphe Quiedeville * * 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 @@ -30,14 +30,14 @@ class GraphDistributeurCommission extends GraphBar { $this->file = $file; $this->year = strftime("%Y",time()); $this->client = 0; - $this->titre = "Commissions mensuelles reversées ".$this->year; - $this->barcolor = "orange"; $this->showframe = true; } Function GraphMakeGraph($distributeur=0) { + $this->titre = "Commissions mensuelles reversées ".$this->year; + $num = 0; $this->no_xaxis_title=1; $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats"; diff --git a/htdocs/telephonie/stats/distributeurs/distributeur.gain.class.php b/htdocs/telephonie/stats/distributeurs/distributeur.gain.class.php index f8f2e20dc1a..e02c3564a55 100644 --- a/htdocs/telephonie/stats/distributeurs/distributeur.gain.class.php +++ b/htdocs/telephonie/stats/distributeurs/distributeur.gain.class.php @@ -28,10 +28,8 @@ class GraphDistributeurGain extends GraphBar { { $this->db = $DB; $this->file = $file; - $this->client = 0; $this->year = strftime("%Y",time()); - $this->titre = "Marges effectuées sur les lignes ".$this->year; $this->barcolor = "pink"; $this->showframe = true; @@ -39,8 +37,9 @@ class GraphDistributeurGain extends GraphBar { Function GraphMakeGraph($distributeur=0) { + $this->titre = "Marges effectuées sur les lignes ".$this->year; $num = 0; - $year = strftime("%Y",time()); + $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats"; if ($distributeur > 0) @@ -127,7 +126,7 @@ class GraphDistributeurGain extends GraphBar { for ($i = 1 ; $i < 13 ; $i++) { - $idx = $year.substr('0'.$i,-2); + $idx = $this->year.substr('0'.$i,-2); $datas[$i-1] = $gains[$idx]; $labels[$i-1] = $month[$i]; } diff --git a/htdocs/telephonie/stats/distributeurs/distributeur.resultat.class.php b/htdocs/telephonie/stats/distributeurs/distributeur.resultat.class.php index c1310a84f8e..4b9f6fc4618 100644 --- a/htdocs/telephonie/stats/distributeurs/distributeur.resultat.class.php +++ b/htdocs/telephonie/stats/distributeurs/distributeur.resultat.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2006 Rodolphe Quiedeville * * 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 @@ -30,14 +30,13 @@ class GraphDistributeurResultat extends GraphBar { $this->file = $file; $this->client = 0; $this->year = strftime("%Y",time()); - $this->titre = "Resultat mensuel ".$this->year." (marges - commissions)"; - $this->year = strftime("%Y",time()); $this->barcolor = "green"; $this->showframe = true; } Function GraphMakeGraph($distributeur=0) { + $this->titre = "Resultat mensuel ".$this->year." (marges - commissions)"; $comms = array(); $gains = array(); $num = 0;