24 |
|
|
25 |
class GraphCommercialChiffreAffaire extends GraphBar { |
class GraphCommercialChiffreAffaire extends GraphBar { |
26 |
|
|
27 |
Function GraphCommercialChiffreAffaire($DB, $file) |
Function GraphCommercialChiffreAffaire($DB, $file, $year=0) |
28 |
{ |
{ |
29 |
$this->db = $DB; |
$this->db = $DB; |
30 |
$this->file = $file; |
$this->file = $file; |
31 |
|
$this->year = $year; |
32 |
$this->client = 0; |
$this->client = 0; |
33 |
$this->titre = "Chiffre d'affaire"; |
$this->titre = "Chiffre d'affaire"; |
34 |
|
if ($this->year > 0) |
35 |
|
{ |
36 |
|
$this->titre .= " ".$year; |
37 |
|
} |
38 |
$this->barcolor = "blue"; |
$this->barcolor = "blue"; |
39 |
$this->showframe = true; |
$this->showframe = true; |
40 |
} |
} |
47 |
{ |
{ |
48 |
$sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats"; |
$sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats"; |
49 |
$sql .= " WHERE graph='commercial.ca.mensuel.".$commercial."';"; |
$sql .= " WHERE graph='commercial.ca.mensuel.".$commercial."';"; |
50 |
|
if ($this->year > 0) |
51 |
|
{ |
52 |
|
$sql .= " AND legend like '".$this->year."%'"; |
53 |
|
} |
54 |
$resql = $this->db->query($sql); |
$resql = $this->db->query($sql); |
55 |
} |
} |
56 |
|
|
60 |
$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; |
$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; |
61 |
$sql .= " WHERE l.rowid = f.fk_ligne"; |
$sql .= " WHERE l.rowid = f.fk_ligne"; |
62 |
$sql .= " AND l.fk_commercial_sign = ".$commercial; |
$sql .= " AND l.fk_commercial_sign = ".$commercial; |
63 |
|
if ($this->year > 0) |
64 |
|
{ |
65 |
|
$sql .= " AND date_format(f.date,'%Y')='".$this->year."'"; |
66 |
|
} |
67 |
$sql .= " GROUP BY date_format(f.date,'%Y%m') ASC"; |
$sql .= " GROUP BY date_format(f.date,'%Y%m') ASC"; |
68 |
|
|
69 |
$resql = $this->db->query($sql); |
$resql = $this->db->query($sql); |
81 |
$row = $this->db->fetch_row($resql); |
$row = $this->db->fetch_row($resql); |
82 |
|
|
83 |
$datas[$i] = $row[1]; |
$datas[$i] = $row[1]; |
84 |
$labels[$i] = substr($row[0],-2)."/".substr($row[0],2,2); |
$labels[$i] = substr($row[0],-2); |
85 |
|
|
86 |
if ($commercial > 0) |
if ($commercial > 0) |
87 |
{ |
{ |