[ 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/stats/distributeurs/ -> resultats.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: resultats.php,v 1.7 2005/11/29 09:35:53 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/stats/distributeurs/resultats.php,v $
  20   *
  21   */
  22  require ("./pre.inc.php");
  23  require DOL_DOCUMENT_ROOT.'/telephonie/distributeurtel.class.php';
  24  
  25  if (!$user->rights->telephonie->lire) accessforbidden();
  26  
  27  llxHeader('','Telephonie - Statistiques - Distributeur');
  28  
  29  /*
  30   *
  31   *
  32   *
  33   */
  34  $h = 0;
  35  
  36  $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/index.php';
  37  $head[$h][1] = "Prise d'ordre";
  38  $h++;
  39  $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/resultats.php';
  40  $head[$h][1] = "Résultats";
  41  $hselected = $h;
  42  $h++;
  43  
  44  $year = strftime("%Y",time());
  45  $total = 0;
  46  $var = True;
  47  dolibarr_fiche_head($head, $hselected, "Distributeurs");
  48  
  49  print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
  50  
  51  print '<tr><td valign="top" width="70%">';
  52  print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=telephoniegraph&file=distributeurs/resultat.mensuel.'.$year.'.png" alt="Resultat mensuel" title="Resultat mensuel">'."\n";
  53  print '</td><td valign="top" width="30%">';
  54  print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
  55  print '<tr class="liste_titre"><td>Mois</td><td align="right">Resultat</td></tr>';
  56  
  57  $sql = "SELECT valeur,legend FROM ".MAIN_DB_PREFIX."telephonie_stats";  
  58  $sql .= " WHERE graph = 'distributeur.resultat.mensuel'";
  59  $sql .= " ORDER BY legend DESC";  
  60  $resql = $db->query($sql);
  61    
  62  if ($resql)
  63  {
  64    while ($row = $db->fetch_row($resql))
  65      {
  66        print "<tr $bc[$var]><td>".$row[1].'</td>';  
  67        print '<td align="right">'.price($row[0]).'</td></tr>';
  68        $total += $row[0];
  69        $var=!$var;
  70      }
  71    $db->free();
  72  }
  73  else 
  74  {
  75    print $db->error() . ' ' . $sql;
  76  }
  77  print "<tr $bc[$var]><td>Total</td>";
  78  print '<td align="right">'.price($total).'</td></tr>';
  79  print '</table>';
  80  
  81  print '</td></tr><tr><td valign="top" width="70%">';
  82  
  83  print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=telephoniegraph&file=distributeurs/gain.mensuel.'.$year.'.png" alt="Gain mensuel" title="Gain mensuel">'."\n";
  84  print '</td><td valign="top" width="30%">';
  85  print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
  86  print '<tr class="liste_titre"><td>Mois</td><td align="right">Gain</td></tr>';
  87  
  88  $sql = "SELECT sum(valeur),legend FROM ".MAIN_DB_PREFIX."telephonie_stats";  
  89  $sql .= " WHERE graph = 'distributeur.gain.mensuel'";
  90  $sql .= " GROUP BY legend DESC";  
  91  $resql = $db->query($sql);
  92  $total = 0;
  93  if ($resql)
  94  {
  95    while ($row = $db->fetch_row($resql))
  96      {
  97        print "<tr $bc[$var]><td>".$row[1].'</td>';  
  98        print '<td align="right">'.price($row[0]).'</td></tr>';
  99        $total += $row[0];
 100        $var=!$var;
 101      }
 102    $db->free();
 103  }
 104  else 
 105  {
 106    print $db->error() . ' ' . $sql;
 107  }
 108  print "<tr $bc[$var]><td>Total</td>";
 109  print '<td align="right">'.price($total).'</td></tr>';
 110  print '</table>';
 111  
 112  print '</td></tr><tr><td valign="top" width="70%">';
 113  print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=telephoniegraph&file=distributeurs/commission.mensuel.'.$year.'.png" alt="Commission mensuelle" title="Commission mensuelle">'."\n";
 114  
 115  print '</td><td valign="top" width="30%">';
 116  
 117  print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
 118  print '<tr class="liste_titre"><td>Mois</td><td align="right">Commission</td></tr>';
 119  
 120  $sql = "SELECT valeur,legend FROM ".MAIN_DB_PREFIX."telephonie_stats";  
 121  $sql .= " WHERE graph = 'distributeur.commission.mensuel'";
 122  $sql .= " GROUP BY legend DESC";  
 123  $resql = $db->query($sql);
 124  $total = 0;  
 125  if ($resql)
 126  {
 127    while ($row = $db->fetch_row($resql))
 128      {
 129        print "<tr $bc[$var]><td>".$row[1].'</td>';  
 130        print '<td align="right">'.price($row[0]).'</td></tr>';
 131        $total += $row[0];
 132        $var=!$var;
 133      }
 134    $db->free();
 135  }
 136  else 
 137  {
 138    print $db->error() . ' ' . $sql;
 139  }
 140  print "<tr $bc[$var]><td>Total</td>";
 141  print '<td align="right">'.price($total).'</td></tr>';
 142  print '</table>';
 143  
 144  print '</td></tr><tr><td valign="top" width="70%">';
 145  
 146  print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=telephoniegraph&file=distributeurs/ca.mensuel.'.$year.'.png" alt="Ca mensuel" title="Ca mensuel">'."\n";
 147  print '</td><td valign="top" width="30%">';
 148  print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
 149  print '<tr class="liste_titre"><td>Mois</td><td align="right">Ca</td></tr>';
 150  
 151  $sql = "SELECT sum(valeur),legend FROM ".MAIN_DB_PREFIX."telephonie_stats";  
 152  $sql .= " WHERE graph = 'distributeur.ca.mensuel'";
 153  $sql .= " GROUP BY legend DESC";  
 154  $resql = $db->query($sql);
 155  $total = 0;
 156  if ($resql)
 157  {
 158    while ($row = $db->fetch_row($resql))
 159      {
 160        print "<tr $bc[$var]><td>".$row[1].'</td>';  
 161        print '<td align="right">'.price($row[0]).'</td></tr>';
 162        $total += $row[0];
 163        $var=!$var;
 164      }
 165    $db->free();
 166  }
 167  else 
 168  {
 169    print $db->error() . ' ' . $sql;
 170  }
 171  print "<tr $bc[$var]><td>Total</td>";
 172  print '<td align="right">'.price($total).'</td></tr>';
 173  print '</table>';
 174  
 175  print '</td></tr>';
 176  
 177  print '</table>';
 178  $db->close();
 179  
 180  llxFooter("<em>Derni&egrave;re modification $Date: 2005/11/29 09:35:53 $ r&eacute;vision $Revision: 1.7 $</em>");
 181  ?>


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