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

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

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

revision 1.2 by rodolphe, Wed Jun 15 14:09:07 2005 UTC revision 1.3 by rodolphe, Tue Oct 18 10:37:57 2005 UTC
# Line 32  $img_root = DOL_DATA_ROOT."/graph/teleph Line 32  $img_root = DOL_DATA_ROOT."/graph/teleph
32    
33  $nbval = 14;  $nbval = 14;
34    
35  $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats";  /*
36  $sql .= " WHERE graph = 'communications.duree'";   * Remplacé par ...statistiques-fournisseurs.php
37     *
38  $resql = $db->query($sql);   $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats";
39     $sql .= " WHERE graph = 'communications.duree'";
 $sql = "SELECT date_format(date, '%m'), sum(duree), count(duree)";  
 $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details";  
 $sql .= " GROUP BY date_format(date, '%Y%m') ASC";  
   
 $resql = $db->query($sql);  
   
   
 _deal($db, $resql, "communications.duree", $kilomindurees, $labels);  
40    
41     $resql = $db->query($sql);
42    
43  $file = $img_root . "communications/duree.png";   $sql = "SELECT date_format(date, '%m'), sum(duree), count(duree)";
44  $graphgain = new GraphBar ($db, $file);   $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details";
45  $graphgain->show_console = 0 ;   $sql .= " GROUP BY date_format(date, '%Y%m') ASC";
46  $graphgain->width = 480 ;   $resql = $db->query($sql);
47  $graphgain->titre = "Nb minutes (milliers)";  
48  print $graphgain->titre."\n";   _deal($db, $resql, "communications.duree", $kilomindurees, $labels);
49  $graphgain->GraphDraw($file, $kilomindurees, $labels);  
50     $file = $img_root . "communications/duree.png";
51     $graphgain = new GraphBar ($db, $file);
52     $graphgain->show_console = 0 ;
53     $graphgain->width = 480 ;
54     $graphgain->titre = "Nb minutes (milliers)";
55     print $graphgain->titre."\n";
56     $graphgain->GraphDraw($file, $kilomindurees, $labels);
57    */
58    
59  /*  /*
60   *   *
# Line 114  $graphgain->titre = "Nb minutes -> porta Line 115  $graphgain->titre = "Nb minutes -> porta
115  print $graphgain->titre."\n";  print $graphgain->titre."\n";
116  $graphgain->GraphDraw($file, $kilomindurees_mob, $labels);  $graphgain->GraphDraw($file, $kilomindurees_mob, $labels);
117    
   
   
   
   
118  function _deal($db, $resql, $graph, &$data, &$labels)  function _deal($db, $resql, $graph, &$data, &$labels)
119  {  {
120    global $nbval;    global $nbval;
121    
122  if ($resql)    if ($resql)
123  {      {      
124          $num = $db->num_rows($resql);
125    $num = $db->num_rows($resql);        $lim = ($num - $nbval);
126    $lim = ($num - $nbval);        $i = 0;
127    $i = 0;        $j = 0;
128    $j = 0;        
129          while ($i < $num)
   while ($i < $num)  
     {  
       $row = $db->fetch_row($resql);  
   
       if ($i >= $lim )  
130          {          {
131            $labels[$j] = $row[0];            $row = $db->fetch_row($resql);
           $data[$j] = ($row[1]/60000);  
     
           $sqli = " INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats";  
           $sqli .= " (graph, ord, legend, valeur) VALUES (";  
           $sqli .= "'".$graph."','".$j."','".$row[0]."','".($row[1]/60)."')";  
132                        
133            if (!$resqli = $db->query($sqli))            if ($i >= $lim )
134              {              {
135                print $db->error();                $labels[$j] = $row[0];
136                  $data[$j] = ($row[1]/60000);
137                  
138                  $sqli = " INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats";
139                  $sqli .= " (graph, ord, legend, valeur) VALUES (";
140                  $sqli .= "'".$graph."','".$j."','".$row[0]."','".($row[1]/60)."')";
141                  
142                  if (!$resqli = $db->query($sqli))
143                    {
144                      print $db->error();
145                    }
146                  $j++;
147              }              }
148            $j++;            $i++;
149          }          }
150        $i++;      }  
     }  
151  }  }
   
   
 }  
   
152  ?>  ?>

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

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