Filtre sur l'année
This commit is contained in:
parent
95654ef8a7
commit
87bc054be3
@ -86,17 +86,17 @@ if ($resql)
|
|||||||
|
|
||||||
/* Chiffre d'affaire mensuel */
|
/* Chiffre d'affaire mensuel */
|
||||||
|
|
||||||
$file = $img_root . "commercials/".$row[0]."/ca.mensuel.png";
|
$file = $img_root . "commercials/".$row[0]."/ca.mensuel.$year.png";
|
||||||
if ($verbose) print "Graph : Lignes commandes$file\n";
|
if ($verbose) print "Graph : Lignes commandes$file\n";
|
||||||
$graph = new GraphCommercialChiffreAffaire($db, $file);
|
$graph = new GraphCommercialChiffreAffaire($db, $file, $year);
|
||||||
$graph->width = 400;
|
$graph->width = 400;
|
||||||
$graph->GraphMakeGraph($row[0]);
|
$graph->GraphMakeGraph($row[0]);
|
||||||
|
|
||||||
/* Gain */
|
/* Gain */
|
||||||
|
|
||||||
$file = $img_root . "commercials/".$row[0]."/gain.mensuel.png";
|
$file = $img_root . "commercials/".$row[0]."/gain.mensuel.$year.png";
|
||||||
if ($verbose) print "Graph : Lignes commandes$file\n";
|
if ($verbose) print "Graph : Lignes commandes$file\n";
|
||||||
$graph = new GraphCommercialGain($db, $file);
|
$graph = new GraphCommercialGain($db, $file, $year);
|
||||||
$graph->width = 400;
|
$graph->width = 400;
|
||||||
$graph->GraphMakeGraph($row[0]);
|
$graph->GraphMakeGraph($row[0]);
|
||||||
|
|
||||||
|
|||||||
@ -24,14 +24,17 @@ require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php");
|
|||||||
|
|
||||||
class GraphCommercialChiffreAffaire extends GraphBar {
|
class GraphCommercialChiffreAffaire extends GraphBar {
|
||||||
|
|
||||||
Function GraphCommercialChiffreAffaire($DB, $file)
|
Function GraphCommercialChiffreAffaire($DB, $file, $year=0)
|
||||||
{
|
{
|
||||||
$this->db = $DB;
|
$this->db = $DB;
|
||||||
$this->file = $file;
|
$this->file = $file;
|
||||||
|
$this->year = $year;
|
||||||
$this->client = 0;
|
$this->client = 0;
|
||||||
$this->titre = "Chiffre d'affaire";
|
$this->titre = "Chiffre d'affaire";
|
||||||
|
if ($this->year > 0)
|
||||||
|
{
|
||||||
|
$this->titre .= " ".$year;
|
||||||
|
}
|
||||||
$this->barcolor = "blue";
|
$this->barcolor = "blue";
|
||||||
$this->showframe = true;
|
$this->showframe = true;
|
||||||
}
|
}
|
||||||
@ -44,6 +47,10 @@ class GraphCommercialChiffreAffaire extends GraphBar {
|
|||||||
{
|
{
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats";
|
||||||
$sql .= " WHERE graph='commercial.ca.mensuel.".$commercial."';";
|
$sql .= " WHERE graph='commercial.ca.mensuel.".$commercial."';";
|
||||||
|
if ($this->year > 0)
|
||||||
|
{
|
||||||
|
$sql .= " AND legend like '".$this->year."%'";
|
||||||
|
}
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,6 +60,10 @@ class GraphCommercialChiffreAffaire extends GraphBar {
|
|||||||
$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
|
$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
|
||||||
$sql .= " WHERE l.rowid = f.fk_ligne";
|
$sql .= " WHERE l.rowid = f.fk_ligne";
|
||||||
$sql .= " AND l.fk_commercial_sign = ".$commercial;
|
$sql .= " AND l.fk_commercial_sign = ".$commercial;
|
||||||
|
if ($this->year > 0)
|
||||||
|
{
|
||||||
|
$sql .= " AND date_format(f.date,'%Y')='".$this->year."'";
|
||||||
|
}
|
||||||
$sql .= " GROUP BY date_format(f.date,'%Y%m') ASC";
|
$sql .= " GROUP BY date_format(f.date,'%Y%m') ASC";
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
@ -70,7 +81,7 @@ class GraphCommercialChiffreAffaire extends GraphBar {
|
|||||||
$row = $this->db->fetch_row($resql);
|
$row = $this->db->fetch_row($resql);
|
||||||
|
|
||||||
$datas[$i] = $row[1];
|
$datas[$i] = $row[1];
|
||||||
$labels[$i] = substr($row[0],-2)."/".substr($row[0],2,2);
|
$labels[$i] = substr($row[0],-2);
|
||||||
|
|
||||||
if ($commercial > 0)
|
if ($commercial > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -24,14 +24,17 @@ require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/graph/bar.class.php");
|
|||||||
|
|
||||||
class GraphCommercialGain extends GraphBar {
|
class GraphCommercialGain extends GraphBar {
|
||||||
|
|
||||||
Function GraphCommercialGain($DB, $file)
|
Function GraphCommercialGain($DB, $file, $year=0)
|
||||||
{
|
{
|
||||||
$this->db = $DB;
|
$this->db = $DB;
|
||||||
$this->file = $file;
|
$this->file = $file;
|
||||||
|
$this->year = $year;
|
||||||
$this->client = 0;
|
$this->client = 0;
|
||||||
$this->titre = "Gain mensuel";
|
$this->titre = "Gain mensuel";
|
||||||
|
if ($this->year > 0)
|
||||||
|
{
|
||||||
|
$this->titre = "Gain mensuel ".$this->year;
|
||||||
|
}
|
||||||
$this->barcolor = "pink";
|
$this->barcolor = "pink";
|
||||||
$this->showframe = true;
|
$this->showframe = true;
|
||||||
}
|
}
|
||||||
@ -43,7 +46,11 @@ class GraphCommercialGain extends GraphBar {
|
|||||||
if ($commercial > 0)
|
if ($commercial > 0)
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats";
|
||||||
$sql .= " WHERE graph='commercial.gain.mensuel.".$commercial."';";
|
$sql .= " WHERE graph='commercial.gain.mensuel.".$commercial."'";
|
||||||
|
if ($this->year > 0)
|
||||||
|
{
|
||||||
|
$sql .= " AND legend like '".$this->year."%'";
|
||||||
|
}
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,6 +59,10 @@ class GraphCommercialGain extends GraphBar {
|
|||||||
$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
|
$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
|
||||||
$sql .= " WHERE l.rowid = f.fk_ligne";
|
$sql .= " WHERE l.rowid = f.fk_ligne";
|
||||||
$sql .= " AND l.fk_commercial_sign = ".$commercial;
|
$sql .= " AND l.fk_commercial_sign = ".$commercial;
|
||||||
|
if ($this->year > 0)
|
||||||
|
{
|
||||||
|
$sql .= " AND date_format(f.date,'%Y')='".$this->year."'";
|
||||||
|
}
|
||||||
$sql .= " GROUP BY date_format(f.date,'%Y%m') ASC";
|
$sql .= " GROUP BY date_format(f.date,'%Y%m') ASC";
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user