62 |
} |
} |
63 |
} |
} |
64 |
$datetime = time(); |
$datetime = time(); |
65 |
|
|
66 |
|
|
67 |
|
$sql = "SELECT date_format(datepo, '%m'), sum(montant)"; |
68 |
|
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_priseordre as p"; |
69 |
|
$sql .= " WHERE p.fk_distributeur > 0"; |
70 |
|
$sql .= " AND date_format(datepo, '%Y') = '".strftime('%Y',$datetime)."'"; |
71 |
|
$sql .= " GROUP BY date_format(datepo, '%Y%m')"; |
72 |
|
$resql = $this->db->query($sql); |
73 |
|
$x_dis_datas = array(); |
74 |
|
if ($resql) |
75 |
|
{ |
76 |
|
while ($row = $this->db->fetch_row($resql)) |
77 |
|
{ |
78 |
|
$x_dis_datas[$row[0]]= $row[1]; |
79 |
|
} |
80 |
|
} |
81 |
|
else |
82 |
|
{ |
83 |
|
print $sql; |
84 |
|
} |
85 |
|
|
86 |
|
|
87 |
foreach ($this->commerciaux as $commercial) |
foreach ($this->commerciaux as $commercial) |
88 |
{ |
{ |
89 |
$datas = array(); |
$datas = array(); |
109 |
|
|
110 |
for ($j = 0; $j < 12 ; $j++) |
for ($j = 0; $j < 12 ; $j++) |
111 |
{ |
{ |
112 |
$datas[$j] = $xdatas[substr("00".($j+1),-2)]; |
$datas[$j] = 0; // on pre-remplit de 0 sinon bug de jpgraph |
113 |
|
if ($xdatas[substr("00".($j+1),-2)]) |
114 |
|
$datas[$j] = $xdatas[substr("00".($j+1),-2)]; |
115 |
|
} |
116 |
|
|
117 |
|
if ($commercial == 18) |
118 |
|
{ |
119 |
|
for ($j = 0; $j < 12 ; $j++) |
120 |
|
{ |
121 |
|
print $datas[$j]." "; |
122 |
|
if ($x_dis_datas[substr("00".($j+1),-2)]) |
123 |
|
{ |
124 |
|
$datas[$j] = $datas[$j] + $x_dis_datas[substr("00".($j+1),-2)]; |
125 |
|
} |
126 |
|
print $datas[$j]."\n"; |
127 |
|
} |
128 |
} |
} |
129 |
|
|
130 |
$bplot = new BarPlot($datas); |
$bplot = new BarPlot($datas); |
131 |
$bplot->SetFillColor($this->barcolor[$i]); |
$bplot->SetFillColor($this->barcolor[$i]); |
132 |
$bplot->SetLegend($comm_names[$commercial]); |
$bplot->SetLegend($comm_names[$commercial]); |
133 |
|
//$bplot->value->Show(); |
134 |
|
//$bplot->value->SetFont(FF_ARIAL,FS_BOLD,10); |
135 |
|
//$bplot->value->SetAngle(45); |
136 |
|
//$bplot->value->SetFormat('%0.1f'); |
137 |
|
|
138 |
array_push($gbspl, $bplot); |
array_push($gbspl, $bplot); |
139 |
$i++; |
$i++; |
140 |
} |
} |
156 |
} |
} |
157 |
|
|
158 |
|
|
|
|
|
159 |
$graph->xaxis->SetTickLabels($labels); |
$graph->xaxis->SetTickLabels($labels); |
160 |
|
|
161 |
// Display the graph |
// Display the graph |
|
|
|
162 |
$graph->img->SetImgFormat("png"); |
$graph->img->SetImgFormat("png"); |
163 |
$graph->Stroke($this->file); |
|
164 |
|
print $graph->Stroke($this->file); |
165 |
} |
} |
166 |
} |
} |
167 |
|
|