This commit is contained in:
Rodolphe Quiedeville 2006-01-11 09:48:21 +00:00
parent 89511a9683
commit 62e65c32d4
5 changed files with 35 additions and 21 deletions

View File

@ -24,12 +24,25 @@
*/ */
require ("../../master.inc.php"); require ("../../master.inc.php");
$verbose = 0; $verbose = 0;
$year = strftime("%Y",time());
for ($i = 1 ; $i <= sizeof($argv) ; $i++) for ($i = 1 ; $i <= sizeof($argv) ; $i++)
{ {
if ($argv[$i] == "-v") if ($argv[$i] == "-v")
$verbose = 1; $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/lignetel.class.php");
require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php");
require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie-tarif.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"); require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/commerciaux/groupes/groupe.ca.class.php");
$error = 0; $error = 0;
$year = strftime("%Y",time());
if (strftime("%m",time()) == 1)
{
$year = $year -1;
}
/* /*
* Création des répertoires * Création des répertoires
* *
@ -101,6 +111,7 @@ if ($resql)
if ($verbose) print "Graph : ca distributeur ".$row[0]."\n"; if ($verbose) print "Graph : ca distributeur ".$row[0]."\n";
if ($verbose==2) print "Graph : ca distributeur $file\n"; if ($verbose==2) print "Graph : ca distributeur $file\n";
$graph = new GraphDistributeurCa($db, $file); $graph = new GraphDistributeurCa($db, $file);
$graph->year = $year;
$graph->width = 500; $graph->width = 500;
$graph->height = 260; $graph->height = 260;
$graph->GraphMakeGraph($row[0]); $graph->GraphMakeGraph($row[0]);
@ -111,6 +122,7 @@ if ($resql)
$file = $dir."gain.mensuel.png"; $file = $dir."gain.mensuel.png";
if ($verbose) print "Graph : gain distributeur ".$row[0]."\n"; if ($verbose) print "Graph : gain distributeur ".$row[0]."\n";
$graph = new GraphDistributeurGain($db, $file); $graph = new GraphDistributeurGain($db, $file);
$graph->year = $year;
$graph->width = 500; $graph->width = 500;
$graph->height = 260; $graph->height = 260;
$graph->GraphMakeGraph($row[0]); $graph->GraphMakeGraph($row[0]);
@ -121,6 +133,7 @@ if ($resql)
$file = $dir."commission.mensuel.png"; $file = $dir."commission.mensuel.png";
if ($verbose) print "Graph : commission distributeur ".$row[0]."\n"; if ($verbose) print "Graph : commission distributeur ".$row[0]."\n";
$graph = new GraphDistributeurCommission($db, $file); $graph = new GraphDistributeurCommission($db, $file);
$graph->year = $year;
$graph->width = 500; $graph->width = 500;
$graph->height = 260; $graph->height = 260;
$graph->GraphMakeGraph($row[0]); $graph->GraphMakeGraph($row[0]);
@ -131,6 +144,7 @@ if ($resql)
$file = $dir."resultat.mensuel.png"; $file = $dir."resultat.mensuel.png";
if ($verbose) print "Graph : resultat distributeur ".$row[0]."\n"; if ($verbose) print "Graph : resultat distributeur ".$row[0]."\n";
$graph = new GraphDistributeurResultat($db, $file); $graph = new GraphDistributeurResultat($db, $file);
$graph->year = $year;
$graph->width = 500; $graph->width = 500;
$graph->height = 260; $graph->height = 260;
$graph->GraphMakeGraph($row[0]); $graph->GraphMakeGraph($row[0]);
@ -145,6 +159,7 @@ if ($resql)
$file = $img_root . "distributeurs/gain.mensuel.$year.png"; $file = $img_root . "distributeurs/gain.mensuel.$year.png";
if ($verbose) print "Graph : gain distributeur $file\n"; if ($verbose) print "Graph : gain distributeur $file\n";
$graph = new GraphDistributeurGain($db, $file); $graph = new GraphDistributeurGain($db, $file);
$graph->year = $year;
$graph->width = 500; $graph->width = 500;
$graph->height = 260; $graph->height = 260;
$graph->GraphMakeGraph(0); $graph->GraphMakeGraph(0);
@ -152,6 +167,7 @@ $graph->GraphMakeGraph(0);
$file = $img_root . "distributeurs/ca.mensuel.$year.png"; $file = $img_root . "distributeurs/ca.mensuel.$year.png";
if ($verbose) print "Graph : ca distributeur $file\n"; if ($verbose) print "Graph : ca distributeur $file\n";
$graph = new GraphDistributeurCa($db, $file); $graph = new GraphDistributeurCa($db, $file);
$graph->year = $year;
$graph->width = 500; $graph->width = 500;
$graph->height = 260; $graph->height = 260;
$graph->GraphMakeGraph(0); $graph->GraphMakeGraph(0);
@ -159,6 +175,7 @@ $graph->GraphMakeGraph(0);
$file = $img_root . "distributeurs/commission.mensuel.$year.png"; $file = $img_root . "distributeurs/commission.mensuel.$year.png";
if ($verbose) print "Graph : commission distributeur $file\n"; if ($verbose) print "Graph : commission distributeur $file\n";
$graph = new GraphDistributeurCommission($db, $file); $graph = new GraphDistributeurCommission($db, $file);
$graph->year = $year;
$graph->width = 500; $graph->width = 500;
$graph->height = 260; $graph->height = 260;
$graph->GraphMakeGraph(0); $graph->GraphMakeGraph(0);
@ -166,6 +183,7 @@ $graph->GraphMakeGraph(0);
$file = $img_root . "distributeurs/resultat.mensuel.$year.png"; $file = $img_root . "distributeurs/resultat.mensuel.$year.png";
if ($verbose) print "Graph : resultat distributeur $file\n"; if ($verbose) print "Graph : resultat distributeur $file\n";
$graph = new GraphDistributeurResultat($db, $file); $graph = new GraphDistributeurResultat($db, $file);
$graph->year = $year;
$graph->width = 500; $graph->width = 500;
$graph->height = 260; $graph->height = 260;
$graph->GraphMakeGraph(0); $graph->GraphMakeGraph(0);

View File

@ -1,5 +1,5 @@
<?PHP <?PHP
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2005-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * 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->db = $DB;
$this->file = $file; $this->file = $file;
$this->client = 0; $this->client = 0;
$this->year = strftime("%Y",time()); $this->year = strftime("%Y",time());
$this->titre = "Chiffre d'affaire ".$this->year;
$this->barcolor = "blue"; $this->barcolor = "blue";
$this->showframe = true; $this->showframe = true;
} }
Function GraphMakeGraph($distributeur=0) Function GraphMakeGraph($distributeur=0)
{ {
$this->titre = "Chiffre d'affaire ".$this->year;
$num = 0; $num = 0;
$year = strftime("%Y",time());
$sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats";
if ($distributeur > 0) if ($distributeur > 0)
@ -127,7 +125,7 @@ class GraphDistributeurCa extends GraphBar {
for ($i = 1 ; $i < 13 ; $i++) for ($i = 1 ; $i < 13 ; $i++)
{ {
$idx = $year.substr('0'.$i,-2); $idx = $this->year.substr('0'.$i,-2);
if ($cas[$idx]) if ($cas[$idx])
{ {
$datas[$i-1] = $cas[$idx]; $datas[$i-1] = $cas[$idx];

View File

@ -1,5 +1,5 @@
<?PHP <?PHP
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2005-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * 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->file = $file;
$this->year = strftime("%Y",time()); $this->year = strftime("%Y",time());
$this->client = 0; $this->client = 0;
$this->titre = "Commissions mensuelles reversées ".$this->year;
$this->barcolor = "orange"; $this->barcolor = "orange";
$this->showframe = true; $this->showframe = true;
} }
Function GraphMakeGraph($distributeur=0) Function GraphMakeGraph($distributeur=0)
{ {
$this->titre = "Commissions mensuelles reversées ".$this->year;
$num = 0; $num = 0;
$this->no_xaxis_title=1; $this->no_xaxis_title=1;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats";

View File

@ -28,10 +28,8 @@ class GraphDistributeurGain extends GraphBar {
{ {
$this->db = $DB; $this->db = $DB;
$this->file = $file; $this->file = $file;
$this->client = 0; $this->client = 0;
$this->year = strftime("%Y",time()); $this->year = strftime("%Y",time());
$this->titre = "Marges effectuées sur les lignes ".$this->year;
$this->barcolor = "pink"; $this->barcolor = "pink";
$this->showframe = true; $this->showframe = true;
@ -39,8 +37,9 @@ class GraphDistributeurGain extends GraphBar {
Function GraphMakeGraph($distributeur=0) Function GraphMakeGraph($distributeur=0)
{ {
$this->titre = "Marges effectuées sur les lignes ".$this->year;
$num = 0; $num = 0;
$year = strftime("%Y",time());
$sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats";
if ($distributeur > 0) if ($distributeur > 0)
@ -127,7 +126,7 @@ class GraphDistributeurGain extends GraphBar {
for ($i = 1 ; $i < 13 ; $i++) for ($i = 1 ; $i < 13 ; $i++)
{ {
$idx = $year.substr('0'.$i,-2); $idx = $this->year.substr('0'.$i,-2);
$datas[$i-1] = $gains[$idx]; $datas[$i-1] = $gains[$idx];
$labels[$i-1] = $month[$i]; $labels[$i-1] = $month[$i];
} }

View File

@ -1,5 +1,5 @@
<?PHP <?PHP
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2005-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * 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->file = $file;
$this->client = 0; $this->client = 0;
$this->year = strftime("%Y",time()); $this->year = strftime("%Y",time());
$this->titre = "Resultat mensuel ".$this->year." (marges - commissions)";
$this->year = strftime("%Y",time());
$this->barcolor = "green"; $this->barcolor = "green";
$this->showframe = true; $this->showframe = true;
} }
Function GraphMakeGraph($distributeur=0) Function GraphMakeGraph($distributeur=0)
{ {
$this->titre = "Resultat mensuel ".$this->year." (marges - commissions)";
$comms = array(); $comms = array();
$gains = array(); $gains = array();
$num = 0; $num = 0;