[ 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/ -> distributeur.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: distributeur.php,v 1.10 2005/12/07 15:27:59 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/stats/distributeurs/distributeur.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  
  35  $h = 0;
  36  
  37  $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/index.php';
  38  $head[$h][1] = "Global";
  39  $h++;
  40  
  41  if ($_GET["id"])
  42  {
  43    $year = strftime("%Y",time());
  44    $distri = new DistributeurTelephonie($db);
  45    $distri->fetch($_GET["id"]);
  46  
  47    $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/distributeur.php?id='.$distri->id;
  48    $head[$h][1] = $distri->nom;
  49    $hselected = $h;
  50    $h++;
  51  
  52    dolibarr_fiche_head($head, $hselected, "Distributeur");
  53  
  54    print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
  55  
  56    print '<tr><td width="70%" valign="top">';
  57  
  58    print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=telephoniegraph&file=distributeurs/'.$_GET["id"].'/po.month.png" alt="Prise d\'ordre" title="Prise d\'ordre"><br /><br />'."\n";
  59  
  60    print '</td><td valign="top" width="30%">';
  61    
  62    print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
  63    print '<tr class="liste_titre">';
  64    print '<td>Mois</td><td align="right">Prise d\'ordre</td></tr>';
  65    
  66    $sql = "SELECT sum(p.montant), date_format(datepo, '%m-%Y')";
  67    $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_priseordre as p";  
  68    $sql .= " WHERE p.fk_distributeur = ".$_GET["id"];
  69    $sql .= " GROUP BY date_format(p.datepo, '%Y%m') DESC";  
  70    $resql = $db->query($sql);
  71    
  72    if ($resql)
  73      {
  74        $num = $db->num_rows();
  75        $i = 0;
  76        $total = 0;
  77        
  78        while ($row = $db->fetch_row($resql))
  79      {
  80        $var=!$var;      
  81        print "<tr $bc[$var]><td>".$row[1].'</td>';  
  82        print '<td align="right">'.price($row[0]).'</td></tr>';
  83      }
  84        $db->free();
  85      }
  86    else 
  87      {
  88        print $db->error() . ' ' . $sql;
  89      }
  90    print '</table>';
  91  
  92    print '</td></tr><tr><td valign="top" width="70%">';
  93    print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=telephoniegraph&file=distributeurs/'.$_GET["id"].'/clients.hebdomadaire.png" alt="Nouveaux clients" title="Nouveaux clients"><br /><br />'."\n";
  94    print '</td><td>';
  95  
  96    print '</td></tr><tr><td valign="top" width="70%">';
  97    print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=telephoniegraph&file=distributeurs/'.$_GET["id"].'/resultat.mensuel.png" alt="Resultat" title="Resultat"><br /><br />'."\n";
  98    print '</td><td valign="top" width="30%">';
  99    print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
 100    print '<tr class="liste_titre"><td>Mois</td><td align="right">Resultat</td></tr>';
 101    
 102    $sql = "SELECT valeur,legend FROM ".MAIN_DB_PREFIX."telephonie_stats";  
 103    $sql .= " WHERE graph = 'distributeur.resultat.mensuel.".$_GET["id"]."'";
 104    $sql .= " ORDER BY legend DESC";  
 105    $resql = $db->query($sql);
 106    
 107    if ($resql)
 108      {
 109        while ($row = $db->fetch_row($resql))
 110      {
 111        $var=!$var;      
 112        print "<tr $bc[$var]><td>".$row[1].'</td>';  
 113        print '<td align="right">'.price($row[0]).'</td></tr>';
 114      }
 115        $db->free();
 116      }
 117    else 
 118      {
 119        print $db->error() . ' ' . $sql;
 120      }
 121    print '</table>';
 122  
 123    print '</td></tr><tr><td valign="top" width="70%">';
 124    print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=telephoniegraph&file=distributeurs/'.$_GET["id"].'/gain.mensuel.png" alt="Gain mensuel" title="Gain mensuel"><br /><br />'."\n";
 125    print '</td><td valign="top" width="30%">';
 126    print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
 127    print '<tr class="liste_titre"><td>Mois</td><td align="right">Gain</td></tr>';
 128    
 129    $sql = "SELECT valeur,legend FROM ".MAIN_DB_PREFIX."telephonie_stats";  
 130    $sql .= " WHERE graph = 'distributeur.gain.mensuel.".$_GET["id"]."'";
 131    $sql .= " ORDER BY legend DESC";  
 132    $resql = $db->query($sql);
 133    
 134    if ($resql)
 135      {
 136        while ($row = $db->fetch_row($resql))
 137      {
 138        $var=!$var;      
 139        print "<tr $bc[$var]><td>".$row[1].'</td>';  
 140        print '<td align="right">'.price($row[0]).'</td></tr>';
 141      }
 142        $db->free();
 143      }
 144    else 
 145      {
 146        print $db->error() . ' ' . $sql;
 147      }
 148    print '</table>';
 149  
 150    print '</td></tr><tr><td valign="top" width="70%">';
 151    print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=telephoniegraph&file=distributeurs/'.$_GET["id"].'/commission.mensuel.png" alt="Commission mensuelle" title="Commission mensuelle"><br /><br />'."\n";
 152  
 153    print '</td><td valign="top" width="30%">';
 154    
 155    print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
 156    print '<tr class="liste_titre"><td>Mois</td><td align="right">Commission</td></tr>';
 157    
 158    $sql = "SELECT valeur,legend FROM ".MAIN_DB_PREFIX."telephonie_stats";  
 159    $sql .= " WHERE graph = 'distributeur.commission.mensuel.".$_GET["id"]."'";
 160    $sql .= " ORDER BY legend DESC";  
 161    $resql = $db->query($sql);
 162    
 163    if ($resql)
 164      {
 165        while ($row = $db->fetch_row($resql))
 166      {
 167        $var=!$var;      
 168        print "<tr $bc[$var]><td>".$row[1].'</td>';  
 169        print '<td align="right">'.price($row[0]).'</td></tr>';
 170      }
 171        $db->free();
 172      }
 173    else 
 174      {
 175        print $db->error() . ' ' . $sql;
 176      }
 177    print '</table>';
 178  
 179    print '</td></tr><tr><td valign="top" width="70%">';
 180    print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=telephoniegraph&file=distributeurs/'.$_GET["id"].'/ca.mensuel.png" alt="CA" title="CA"><br /><br />'."\n";
 181  
 182    print '</td><td valign="top" width="30%">';
 183    
 184    print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
 185    print '<tr class="liste_titre"><td>Mois</td><td align="right">CA</td></tr>';
 186    
 187    $sql = "SELECT valeur,legend FROM ".MAIN_DB_PREFIX."telephonie_stats";  
 188    $sql .= " WHERE graph = 'distributeur.ca.mensuel.".$_GET["id"]."'";
 189    $sql .= " ORDER BY legend DESC";  
 190    $resql = $db->query($sql);
 191    
 192    if ($resql)
 193      {
 194        while ($row = $db->fetch_row($resql))
 195      {
 196        $var=!$var;      
 197        print "<tr $bc[$var]><td>".$row[1].'</td>';  
 198        print '<td align="right">'.price($row[0]).'</td></tr>';
 199      }
 200        $db->free();
 201      }
 202    else 
 203      {
 204        print $db->error() . ' ' . $sql;
 205      }
 206    print '</table>';
 207  
 208  
 209  
 210    print '</td></tr>';
 211    print '</table>';
 212   
 213   $db->close();
 214  }
 215  
 216  llxFooter("<em>Derni&egrave;re modification $Date: 2005/12/07 15:27:59 $ r&eacute;vision $Revision: 1.10 $</em>");
 217  ?>


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