/[dolibarr]/dolibarr/htdocs/telephonie/stats/commerciaux/commercial.ca.class.php
ViewVC logotype

Diff of /dolibarr/htdocs/telephonie/stats/commerciaux/commercial.ca.class.php

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

revision 1.1 by rodolphe, Tue Feb 8 15:29:46 2005 UTC revision 1.2 by rodolphe, Thu Dec 1 14:32:36 2005 UTC
# Line 40  class GraphCommercialChiffreAffaire exte Line 40  class GraphCommercialChiffreAffaire exte
40    {    {
41      $num = 0;      $num = 0;
42    
43        if ($commercial > 0)
44          {
45            $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats";    
46            $sql .= " WHERE graph='commercial.ca.mensuel.".$commercial."';";
47            $resql = $this->db->query($sql);
48          }
49    
50    
51      $sql = "SELECT date_format(f.date,'%Y%m'), sum(f.cout_vente)";      $sql = "SELECT date_format(f.date,'%Y%m'), sum(f.cout_vente)";
52      $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f";      $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f";
53      $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l";      $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
# Line 47  class GraphCommercialChiffreAffaire exte Line 55  class GraphCommercialChiffreAffaire exte
55      $sql .= " AND l.fk_commercial_sign = ".$commercial;      $sql .= " AND l.fk_commercial_sign = ".$commercial;
56      $sql .= " GROUP BY date_format(f.date,'%Y%m') ASC";      $sql .= " GROUP BY date_format(f.date,'%Y%m') ASC";
57    
58      $result = $this->db->query($sql);      $resql = $this->db->query($sql);
59    
60      if ($result)      if ($resql)
61        {        {
62          $num = $this->db->num_rows();          $num = $this->db->num_rows($resql);
63          $i = 0;          $i = 0;
64          $j = -1;          $j = -1;
65          $datas = array();          $datas = array();
# Line 59  class GraphCommercialChiffreAffaire exte Line 67  class GraphCommercialChiffreAffaire exte
67                    
68          while ($i < $num)          while ($i < $num)
69            {            {
70              $row = $this->db->fetch_row();                    $row = $this->db->fetch_row($resql);        
71                                            
72              $datas[$i] = $row[1];              $datas[$i] = $row[1];
73              $labels[$i] = substr($row[0],-2)."/".substr($row[0],2,2);              $labels[$i] = substr($row[0],-2)."/".substr($row[0],2,2);
74    
75                if ($commercial > 0)
76                  {
77                    $sqli = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats";
78                    $sqli .= " (graph,ord,legend,valeur)";
79                    $sqli .= " VALUES ('commercial.ca.mensuel.".$commercial."'";
80                    $sqli .= ",'$i','".$row[0]."','".$datas[$i]."');";
81                    $resqli = $this->db->query($sqli);
82                  }
83              $i++;              $i++;
84            }            }
85                    
86          $this->db->free();          $this->db->free($resql);
87        }        }
88      else      else
89        {        {

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

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