[ 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/commerciaux/ -> 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.15 2005/08/24 08:55:11 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/stats/commerciaux/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 - Commerciaux');
  28  
  29  /*
  30   *
  31   *
  32   *
  33   */
  34  
  35  $h = 0;
  36  
  37  $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/index.php';
  38  $head[$h][1] = "Global";
  39  $hselected = $h;
  40  $h++;
  41  
  42  $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/ca.php';
  43  $head[$h][1] = "CA";
  44  $h++;
  45  
  46  $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/mensuel.php';
  47  $head[$h][1] = "Mensuel";
  48  $h++;
  49  
  50  $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/contrats.php';
  51  $head[$h][1] = "Contrats";
  52  $h++;
  53  
  54  dolibarr_fiche_head($head, $hselected, "Commerciaux");
  55  
  56  print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
  57  print '<tr><td width="30%" valign="top">';
  58  
  59  /*                */
  60  
  61  $sql = "SELECT count(*) as cc , c.name, c.firstname, c.rowid";
  62  $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
  63  $sql .= " , ".MAIN_DB_PREFIX."user as c";
  64  $sql .= " LEFT JOIN llx_telephonie_distributeur_commerciaux as dc ON dc.fk_user = c.rowid";
  65  
  66  $sql .= " WHERE c.rowid = l.fk_commercial_suiv";
  67  $sql .= " AND l.statut <> 7";
  68  $sql .= " AND dc.fk_distributeur IS NULL";
  69  $sql .= " GROUP BY c.name ORDER BY cc DESC";
  70  
  71  print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
  72  print '<tr class="liste_titre"><td colspan="3">Lignes suivies</td></tr>';
  73  print '<tr class="liste_titre"><td width="50%" valign="top">Nom</td><td align="center">Nb Lignes</td><td>&nbsp;</td></tr>';
  74  
  75  $resql = $db->query($sql);
  76  if ($resql)
  77  {
  78    $num = $db->num_rows();
  79    $i = 0;
  80    $datas = array();
  81    $legends = array();
  82    $total = 0;
  83    while ($i < $num)
  84      {
  85        $row = $db->fetch_row($i);    
  86  
  87        $var=!$var;
  88  
  89        print "<tr $bc[$var]>";
  90  
  91        print '<td width="50%" valign="top">';
  92        print '<a href="commercial.php?commid='.$row[3];
  93        print '">'.$row[2]." ". $row[1].'</a></td><td align="center">'.$row[0].'</td>';
  94        print '<td><a href="'.DOL_URL_ROOT.'/telephonie/ligne/liste.php?commercial_suiv='.$row[3].'">Voir</a></td></tr>';
  95        $total += $row[0];
  96        $i++;
  97      }
  98    $db->free();
  99  }
 100  else 
 101  {
 102    print $db->error() . ' ' . $sql;
 103  }
 104  $var=!$var;
 105  print "<tr $bc[$var]>";
 106  print '<td width="50%" valign="top">Total</td><td align="center">'.$total.'</td>';
 107  print '<td>&nbsp;</td></tr>';
 108  print '</table><br />';
 109  
 110  print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
 111  print '<tr class="liste_titre"><td colspan="3">Lignes signées</td></tr>';
 112  print '<tr class="liste_titre"><td width="50%" valign="top">Nom</td><td align="center">Nb Lignes</td><td>&nbsp;</td></tr>';
 113  
 114  $sql = "SELECT count(*) as cc , c.name, c.firstname, c.rowid";
 115  $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
 116  $sql .= " , ".MAIN_DB_PREFIX."user as c";
 117  $sql .= " LEFT JOIN llx_telephonie_distributeur_commerciaux as dc ON dc.fk_user = c.rowid";
 118  $sql .= " WHERE c.rowid = l.fk_commercial_sign";
 119  $sql .= " AND l.statut <> 7";
 120  $sql .= " AND dc.fk_distributeur IS NULL";
 121  $sql .= " GROUP BY c.name ORDER BY cc DESC";
 122  
 123  $resql = $db->query($sql);
 124  if ($resql)
 125  {
 126    $num = $db->num_rows();
 127    $i = 0;
 128    $datas = array();
 129    $legends = array();
 130    $total= 0 ;
 131    while ($i < $num)
 132      {
 133        $row = $db->fetch_row($i);    
 134  
 135        $var=!$var;
 136  
 137        print "<tr $bc[$var]>";
 138  
 139        print '<td width="50%" valign="top">';
 140        print '<a href="commercial.php?commid='.$row[3];
 141        print '">'.$row[2]." ". $row[1].'</a></td><td align="center">'.$row[0].'</td>';
 142        print '<td><a href="'.DOL_URL_ROOT.'/telephonie/ligne/liste.php?commercial_sign='.$row[3].'">Voir</a></td></tr>';
 143        $total += $row[0];
 144        $i++;
 145      }
 146    $db->free();
 147  }
 148  else 
 149  {
 150    print $db->error() . ' ' . $sql;
 151  }
 152  $var=!$var;
 153  print "<tr $bc[$var]>";
 154  print '<td width="50%" valign="top">Total</td><td align="center">'.$total.'</td>';
 155  print '<td>&nbsp;</td></tr>';
 156  print '</table>';
 157  
 158  print '</td>';
 159  
 160  print '</td><td valign="top" width="70%">';
 161  
 162  print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=telephoniegraph&file=lignes/commandes.hebdomadaire.png" alt="Commandes de ligne par semaines" title="Commandes de ligne par semaines"><br /><br />'."\n";
 163  
 164  print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=telephoniegraph&file=lignes/commandes.mensuels.png" alt="Commandes de ligne par mois" title="Commandes de ligne par mois"><br /><br />'."\n";
 165  
 166  print '</td></tr>';
 167  print '</table>';
 168  
 169  $db->close();
 170  
 171  llxFooter("<em>Derni&egrave;re modification $Date: 2005/08/24 08:55:11 $ r&eacute;vision $Revision: 1.15 $</em>");
 172  ?>


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