38 |
require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/commerciaux/commercial.gain.class.php"); |
require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/commerciaux/commercial.gain.class.php"); |
39 |
require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/commerciaux/groupes/groupe.gain.class.php"); |
require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/commerciaux/groupes/groupe.gain.class.php"); |
40 |
require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/commerciaux/groupes/groupe.ca.class.php"); |
require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/commerciaux/groupes/groupe.ca.class.php"); |
41 |
|
$year = strftime("%Y",time()); |
42 |
$error = 0; |
$error = 0; |
43 |
|
|
44 |
/* |
/* |
171 |
$graph = new GraphCommerciauxContrats($db, $file); |
$graph = new GraphCommerciauxContrats($db, $file); |
172 |
$graph->GraphMakeGraph("signe"); |
$graph->GraphMakeGraph("signe"); |
173 |
|
|
174 |
|
/* |
175 |
|
* Prises d'ordres |
176 |
|
* |
177 |
|
*/ |
178 |
|
require_once (DOL_DOCUMENT_ROOT."/telephonie/stats/commerciaux/commercial.po.class.php"); |
179 |
|
|
180 |
|
$sql = "SELECT date_format(datepo,'%Y%m'), sum(montant), fk_commercial, fk_distributeur"; |
181 |
|
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_priseordre"; |
182 |
|
$sql .= " WHERE year(now()) = year(datepo)"; |
183 |
|
$sql .= " GROUP BY date_format(datepo,'%Y%m'), fk_commercial, fk_distributeur"; |
184 |
|
$sql .= " ORDER BY date_format(datepo,'%Y%m') ASC"; |
185 |
|
|
186 |
|
$resql = $db->query($sql); |
187 |
|
if ($resql) |
188 |
|
{ |
189 |
|
$datas_comm = array(); |
190 |
|
$labels_comm = array(); |
191 |
|
|
192 |
|
$datas_dist = array(); |
193 |
|
$labels_dist = array(); |
194 |
|
|
195 |
|
while ( $row = $db->fetch_row($resql) ) |
196 |
|
{ |
197 |
|
$datas_comm[$row[2]][$row[0]] += $row[1]; |
198 |
|
$datas_dist[$row[3]][$row[0]] += $row[1]; |
199 |
|
} |
200 |
|
|
201 |
|
foreach($datas_comm as $comm => $value) |
202 |
|
{ |
203 |
|
//print $comm."\n"; |
204 |
|
|
205 |
|
$file = $img_root . "commercials/".$comm."/po.$year.mensuel.png"; |
206 |
|
if ($verbose) print "Graph : Lignes commandes$file\n"; |
207 |
|
$graph = new GraphCommercialPO($db, $file); |
208 |
|
$graph->width = 400; |
209 |
|
$graph->GraphMakeGraph($value); |
210 |
|
} |
211 |
|
} |
212 |
?> |
?> |