28 |
{ |
{ |
29 |
$this->db = $DB; |
$this->db = $DB; |
30 |
$this->file = $file; |
$this->file = $file; |
31 |
|
$this->year = strftime("%Y",time()); |
32 |
$this->client = 0; |
$this->client = 0; |
33 |
$this->titre = "Commission mensuelle"; |
$this->titre = "Commission mensuelle ".$this->year; |
34 |
|
|
35 |
$this->barcolor = "orange"; |
$this->barcolor = "orange"; |
36 |
$this->showframe = true; |
$this->showframe = true; |
65 |
$row = $this->db->fetch_row($resql); |
$row = $this->db->fetch_row($resql); |
66 |
|
|
67 |
$datas[$i] = $row[1]; |
$datas[$i] = $row[1]; |
68 |
|
$comms[$row[0]] = $row[1]; |
69 |
$labels[$i] = substr($row[0],-2)."/".substr($row[0],2,2); |
$labels[$i] = substr($row[0],-2)."/".substr($row[0],2,2); |
70 |
|
|
71 |
$sqli = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats"; |
$sqli = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats"; |
72 |
$sqli .= " (graph,ord,legend,valeur)"; |
$sqli .= " (graph,ord,legend,valeur)"; |
73 |
$sqli .= " VALUES ('distributeur.commission.mensuel.".$distributeur."'"; |
$sqli .= " VALUES ('distributeur.commission.mensuel.".$distributeur."'"; |
74 |
$sqli .= ",'$i','".$row[0]."','".$datas[$i]."');"; |
$sqli .= ",'$i','".$row[0]."','".$datas[$i]."');"; |
|
|
|
75 |
$resqli = $this->db->query($sqli); |
$resqli = $this->db->query($sqli); |
76 |
|
|
77 |
$i++; |
$i++; |
78 |
} |
} |
|
|
|
79 |
$this->db->free($resql); |
$this->db->free($resql); |
80 |
} |
} |
81 |
else |
else |
83 |
print $this->db->error() . ' ' . $sql; |
print $this->db->error() . ' ' . $sql; |
84 |
} |
} |
85 |
|
|
86 |
|
for ($i = 1 ; $i < 13 ; $i++) |
87 |
|
{ |
88 |
|
$idx = $this->year.substr('0'.$i,-2); |
89 |
|
$datas[$i-1] = $comms[$idx]; |
90 |
|
$labels[$i-1] = $i; |
91 |
|
} |
92 |
|
|
93 |
if (sizeof($datas)) |
if (sizeof($datas)) |
94 |
{ |
{ |
95 |
$this->GraphDraw($this->file, $datas, $labels); |
$this->GraphDraw($this->file, $datas, $labels); |