[ 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/ -> index.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: index.php,v 1.8 2005/11/14 13:45:59 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/stats/distributeurs/index.php,v $
  20   *
  21   */
  22  require ("./pre.inc.php");
  23  
  24  if (!$user->rights->telephonie->lire) accessforbidden();
  25  if (!$user->rights->telephonie->stats->lire) accessforbidden();
  26  
  27  llxHeader('','Telephonie - Statistiques - Distributeurs');
  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] = "Prise d'ordre";
  39  $hselected = $h;
  40  $h++;
  41  $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/resultats.php';
  42  $head[$h][1] = "Résultats";
  43  $h++;
  44  dolibarr_fiche_head($head, $hselected, "Distributeurs");
  45  
  46  print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
  47  
  48  print '<tr><td width="50%" valign="top">';
  49  
  50  print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
  51  print '<tr class="liste_titre">';
  52  print '<td>Distributeur</td><td align="right">Prise d\'ordre</td></tr>';
  53  
  54  $sql = "SELECT sum(p.montant), d.nom, d.rowid";
  55  $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_distributeur as d";
  56  $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat_priseordre as p";
  57  
  58  $sql .= " WHERE p.fk_distributeur = d.rowid";
  59  $sql .= " GROUP BY d.rowid";
  60  
  61  $resql = $db->query($sql);
  62  
  63  if ($resql)
  64  {
  65    $num = $db->num_rows();
  66    $i = 0;
  67    $total = 0;
  68  
  69    while ($i < $num)
  70      {
  71        $row = $db->fetch_row($i);    
  72  
  73        $var=!$var;
  74  
  75        print "<tr $bc[$var]>";
  76  
  77        print '<td><a href="distributeur.php?id='.$row[2].'">'.$row[1].'</a></td>';
  78  
  79        print '<td align="right">'.price($row[0]).'</td></tr>';
  80        $i++;
  81      }
  82    $db->free();
  83  }
  84  else 
  85  {
  86    print $db->error() . ' ' . $sql;
  87  }
  88  print '</table><br />';
  89  
  90  
  91  /*
  92   * Commerciaux
  93   *
  94   */
  95  
  96  print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
  97  print '<tr class="liste_titre">';
  98  print '<td>Distributeur</td><td>Commercial</td><td align="right">Prise d\'ordre</td></tr>';
  99  
 100  $sql = "SELECT sum(p.montant), d.nom, u.firstname, u.name, u.rowid";
 101  $sql .= " FROM ".MAIN_DB_PREFIX."user as u";
 102  $sql .= " , ".MAIN_DB_PREFIX."telephonie_distributeur as d";
 103  $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat_priseordre as p";
 104  $sql .= " , ".MAIN_DB_PREFIX."telephonie_distributeur_commerciaux as dc";
 105  
 106  $sql .= " WHERE p.fk_commercial = u.rowid";
 107  $sql .= " AND dc.fk_user = u.rowid";
 108  $sql .= " AND p.fk_distributeur = d.rowid";
 109  $sql .= " GROUP BY u.rowid";
 110  
 111  $resql = $db->query($sql);
 112  
 113  if ($resql)
 114  {
 115    $num = $db->num_rows();
 116    $i = 0;
 117    $total = 0;
 118  
 119    while ($i < $num)
 120      {
 121        $row = $db->fetch_row($i);    
 122        $var=!$var;
 123        print "<tr $bc[$var]>";
 124        print '<td>'.$row[1].'</a></td>';
 125        print '<td><a href="commercial.php?id='.$row[4].'">'.$row[2]." ".$row[3].'</a></td>';
 126        print '<td align="right">'.price($row[0]).'</td></tr>';
 127        $i++;
 128      }
 129    $db->free();
 130  }
 131  else 
 132  {
 133    print $db->error() . ' ' . $sql;
 134  }
 135  
 136  
 137  
 138  print '</table><br />';
 139  
 140  
 141  print '</td><td width="50%" valign="top">&nbsp;</td></tr>';
 142  print '</table><br />';
 143  
 144  $db->close();
 145  
 146  llxFooter("<em>Derni&egrave;re modification $Date: 2005/11/14 13:45:59 $ r&eacute;vision $Revision: 1.8 $</em>");
 147  ?>


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