Modif presentation

This commit is contained in:
Rodolphe Quiedeville 2005-11-14 09:56:22 +00:00
parent 376702ad75
commit 7e29e2ee74
2 changed files with 22 additions and 6 deletions

View File

@ -28,9 +28,9 @@ class GraphDistributeurCommission extends GraphBar {
{ {
$this->db = $DB; $this->db = $DB;
$this->file = $file; $this->file = $file;
$this->year = strftime("%Y",time());
$this->client = 0; $this->client = 0;
$this->titre = "Commission mensuelle"; $this->titre = "Commission mensuelle ".$this->year;
$this->barcolor = "orange"; $this->barcolor = "orange";
$this->showframe = true; $this->showframe = true;
@ -65,18 +65,17 @@ class GraphDistributeurCommission extends GraphBar {
$row = $this->db->fetch_row($resql); $row = $this->db->fetch_row($resql);
$datas[$i] = $row[1]; $datas[$i] = $row[1];
$comms[$row[0]] = $row[1];
$labels[$i] = substr($row[0],-2)."/".substr($row[0],2,2); $labels[$i] = substr($row[0],-2)."/".substr($row[0],2,2);
$sqli = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats"; $sqli = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats";
$sqli .= " (graph,ord,legend,valeur)"; $sqli .= " (graph,ord,legend,valeur)";
$sqli .= " VALUES ('distributeur.commission.mensuel.".$distributeur."'"; $sqli .= " VALUES ('distributeur.commission.mensuel.".$distributeur."'";
$sqli .= ",'$i','".$row[0]."','".$datas[$i]."');"; $sqli .= ",'$i','".$row[0]."','".$datas[$i]."');";
$resqli = $this->db->query($sqli); $resqli = $this->db->query($sqli);
$i++; $i++;
} }
$this->db->free($resql); $this->db->free($resql);
} }
else else
@ -84,6 +83,13 @@ class GraphDistributeurCommission extends GraphBar {
print $this->db->error() . ' ' . $sql; print $this->db->error() . ' ' . $sql;
} }
for ($i = 1 ; $i < 13 ; $i++)
{
$idx = $this->year.substr('0'.$i,-2);
$datas[$i-1] = $comms[$idx];
$labels[$i-1] = $i;
}
if (sizeof($datas)) if (sizeof($datas))
{ {
$this->GraphDraw($this->file, $datas, $labels); $this->GraphDraw($this->file, $datas, $labels);

View File

@ -30,7 +30,7 @@ class GraphDistributeurGain extends GraphBar {
$this->file = $file; $this->file = $file;
$this->client = 0; $this->client = 0;
$this->titre = "Gain mensuel"; $this->titre = "Gain mensuel ".strftime("%Y",time());
$this->barcolor = "pink"; $this->barcolor = "pink";
$this->showframe = true; $this->showframe = true;
@ -39,6 +39,7 @@ class GraphDistributeurGain extends GraphBar {
Function GraphMakeGraph($distributeur=0) Function GraphMakeGraph($distributeur=0)
{ {
$num = 0; $num = 0;
$year = strftime("%Y",time());
$sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats";
$sql .= " WHERE graph='distributeur.gain.mensuel.".$distributeur."';"; $sql .= " WHERE graph='distributeur.gain.mensuel.".$distributeur."';";
@ -62,6 +63,7 @@ class GraphDistributeurGain extends GraphBar {
$i = 0; $i = 0;
$j = -1; $j = -1;
$datas = array(); $datas = array();
$gains = array();
$labels = array(); $labels = array();
while ($i < $num) while ($i < $num)
@ -69,6 +71,7 @@ class GraphDistributeurGain extends GraphBar {
$row = $this->db->fetch_row($resql); $row = $this->db->fetch_row($resql);
$datas[$i] = $row[1]; $datas[$i] = $row[1];
$gains[$row[0]] = $row[1];
$labels[$i] = substr($row[0],-2)."/".substr($row[0],2,2); $labels[$i] = substr($row[0],-2)."/".substr($row[0],2,2);
$sqli = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats"; $sqli = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats";
@ -88,6 +91,13 @@ class GraphDistributeurGain extends GraphBar {
print $this->db->error() . ' ' . $sql; print $this->db->error() . ' ' . $sql;
} }
for ($i = 1 ; $i < 13 ; $i++)
{
$idx = $year.substr('0'.$i,-2);
$datas[$i-1] = $gains[$idx];
$labels[$i-1] = $i;
}
if (sizeof($datas)) if (sizeof($datas))
{ {
$this->GraphDraw($this->file, $datas, $labels); $this->GraphDraw($this->file, $datas, $labels);