[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/telephonie/script/ -> graph-statistiques-destination.php (source)

   1  <?php
   2  /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   *
   4   * This program is free software; you can redistribute it and/or modify
   5   * it under the terms of the GNU General Public License as published by
   6   * the Free Software Foundation; either version 2 of the License, or
   7   * (at your option) any later version.
   8   *
   9   * This program is distributed in the hope that it will be useful,
  10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12   * GNU General Public License for more details.
  13   *
  14   * You should have received a copy of the GNU General Public License
  15   * along with this program; if not, write to the Free Software
  16   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17   *
  18   * $Id: graph-statistiques-destination.php,v 1.2 2005/05/16 09:49:32 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/script/graph-statistiques-destination.php,v $
  20   *
  21   *
  22   * Generation des graphiques clients
  23   *
  24   *
  25   */
  26  require  "../../master.inc.php";
  27  
  28  
  29  $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_stats_destination";
  30  
  31  if ($db->query($sql))
  32  {
  33  
  34  }
  35  
  36  $sql = "SELECT dest, count(cout_vente), sum(cout_vente), sum(duree)";
  37  $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details";
  38  $sql .= " GROUP BY dest";
  39  
  40  $resql = $db->query($sql);
  41  
  42  $dest = array();
  43  
  44  if ($resql)
  45  {
  46    $i = 0;
  47    $num = $db->num_rows($resql);
  48  
  49    while ($i < $num)
  50      {
  51  
  52        $row = $db->fetch_row();
  53        $dest[$i] = $row;
  54        $i++;
  55      }
  56    $db->free($resql);
  57  }
  58  else
  59  {
  60    print $db->error();
  61  }
  62  
  63  for ($i = 0 ; $i < $num ; $i++)
  64  {
  65    $dm = ($dest[$i][3]/$dest[$i][1]);
  66  
  67  
  68    $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_stats_destination";
  69    $sql .= " ( destination, nbappels, ca, duree, duree_moy)";
  70    $sql .= " VALUES ('".$dest[$i][0]."'";
  71    $sql .= ",".$dest[$i][1];
  72    $sql .= ",".$dest[$i][2];
  73    $sql .= ",".$dest[$i][3];
  74    $sql .= ",".ereg_replace(",",".",$dm).")";
  75  
  76    $resql = $db->query($sql);
  77  }
  78  
  79  ?>


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics