/[dolibarr]/dolibarr/htdocs/telephonie/script/graph-statistiques-commerciaux.php
ViewVC logotype

Diff of /dolibarr/htdocs/telephonie/script/graph-statistiques-commerciaux.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by rodolphe, Wed May 4 13:10:48 2005 UTC revision 1.6 by rodolphe, Wed Sep 14 11:03:11 2005 UTC
# Line 38  require_once (DOL_DOCUMENT_ROOT."/teleph Line 38  require_once (DOL_DOCUMENT_ROOT."/teleph
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  /*  /*
# Line 171  if ($verbose) print "Graph : Commerciaux Line 171  if ($verbose) print "Graph : Commerciaux
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  ?>  ?>

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26