24 |
|
|
25 |
class GraphCommercialGain extends GraphBar { |
class GraphCommercialGain extends GraphBar { |
26 |
|
|
27 |
Function GraphCommercialGain($DB, $file) |
Function GraphCommercialGain($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 = "Gain mensuel"; |
$this->titre = "Gain mensuel"; |
34 |
|
if ($this->year > 0) |
35 |
|
{ |
36 |
|
$this->titre = "Gain mensuel ".$this->year; |
37 |
|
} |
38 |
$this->barcolor = "pink"; |
$this->barcolor = "pink"; |
39 |
$this->showframe = true; |
$this->showframe = true; |
40 |
} |
} |
46 |
if ($commercial > 0) |
if ($commercial > 0) |
47 |
{ |
{ |
48 |
$sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats"; |
$sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats"; |
49 |
$sql .= " WHERE graph='commercial.gain.mensuel.".$commercial."';"; |
$sql .= " WHERE graph='commercial.gain.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 |
|
|
59 |
$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; |
$sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; |
60 |
$sql .= " WHERE l.rowid = f.fk_ligne"; |
$sql .= " WHERE l.rowid = f.fk_ligne"; |
61 |
$sql .= " AND l.fk_commercial_sign = ".$commercial; |
$sql .= " AND l.fk_commercial_sign = ".$commercial; |
62 |
|
if ($this->year > 0) |
63 |
|
{ |
64 |
|
$sql .= " AND date_format(f.date,'%Y')='".$this->year."'"; |
65 |
|
} |
66 |
$sql .= " GROUP BY date_format(f.date,'%Y%m') ASC"; |
$sql .= " GROUP BY date_format(f.date,'%Y%m') ASC"; |
67 |
|
|
68 |
$resql = $this->db->query($sql); |
$resql = $this->db->query($sql); |