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

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

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

revision 1.1 by rodolphe, Thu Dec 8 11:48:47 2005 UTC revision 1.2 by rodolphe, Thu Dec 8 14:10:10 2005 UTC
# Line 70  if ($resql) Line 70  if ($resql)
70        $data = array();        $data = array();
71        $datas = array();        $datas = array();
72        $moydata = array();        $moydata = array();
73          $moydatas = array();
74                
75        $sqla = "SELECT date, sum(duree)";        $sqla = "SELECT date, sum(duree)";
76        $sqla .= " FROM ".MAIN_DB_PREFIX."telephonie_import_cdr";        $sqla .= " FROM ".MAIN_DB_PREFIX."telephonie_import_cdr";
# Line 87  if ($resql) Line 88  if ($resql)
88              {              {
89                $jour = (substr($rowa[0],0,2) * 1);                $jour = (substr($rowa[0],0,2) * 1);
90                $data[$jour] = ($rowa[1]/60);                $data[$jour] = ($rowa[1]/60);
91                $total = $total + $data[$i];                $total = $total + $data[$jour];
               $moydata[$i] = $total / ($i+1);  
92                $i++;                $i++;
93                  $moydata[$jour] = $total / $i;
94              }              }
95          }          }
96    
97        for ($i = 0 ; $i < 31 ; $i++)        for ($i = 0 ; $i < 31 ; $i++)
98          {          {
99            $j = $i + 1;            $j = $i + 1;
100            $datas[$i] = $data[$j];            $datas[$i] = 0;
101              $moydatas[$i] = 0;
102              if ($data[$j])
103                $datas[$i] = $data[$j];
104              if ($moydata[$j])
105                $moydatas[$i] = $moydata[$j];
106            $labels[$i] = $j;            $labels[$i] = $j;
107          }          }
108                
# Line 119  if ($resql) Line 125  if ($resql)
125        $b2plot->SetColor("red");        $b2plot->SetColor("red");
126        $graph->Add($b2plot);        $graph->Add($b2plot);
127                
128        $lineplot = new LinePlot($moydata);            $lineplot = new LinePlot($moydatas);    
129        $lineplot->SetColor("blue");        $lineplot->SetColor("blue");
130        $graph->Add($lineplot);        $graph->Add($lineplot);
131                
132        $graph->img->SetImgFormat("png");        $graph->img->SetImgFormat("png");
133        $graph->Stroke($file);        $graph->Stroke($file);
         
   
134      }      }
135  }  }
136  else  else

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