[ 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/ -> ca.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: ca.php,v 1.5 2005/12/01 15:07:38 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/stats/commerciaux/ca.php,v $
  20   *
  21   */
  22  require ("./pre.inc.php");
  23  
  24  if (!$user->rights->telephonie->lire) accessforbidden();
  25  
  26  llxHeader('','Telephonie - Statistiques - Commerciaux');
  27  
  28  /*
  29   *
  30   *
  31   *
  32   */
  33  
  34  $h = 0;
  35  
  36  $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/index.php';
  37  $head[$h][1] = "Global";
  38  $h++;
  39  
  40  $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/ca.php';
  41  $head[$h][1] = "CA";
  42  $hselected = $h;
  43  $h++;
  44  
  45  $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/mensuel.php';
  46  $head[$h][1] = "Mensuel";
  47  $h++;
  48  
  49  $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/contrats.php';
  50  $head[$h][1] = "Contrats";
  51  $h++;
  52  
  53  dolibarr_fiche_head($head, $hselected, "Commerciaux");
  54  
  55  print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
  56  print '<tr><td width="30%" valign="top">';
  57  
  58  $sql = "SELECT date_format(f.date,'%Y%m'), sum(f.cout_vente)";
  59  $sql .= ", c.name, c.firstname, c.rowid";
  60  $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f";
  61  $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
  62  $sql .= " , ".MAIN_DB_PREFIX."user as c";
  63  
  64  $sql .= " WHERE l.rowid = f.fk_ligne";
  65  $sql .= " AND l.fk_commercial_sign = c.rowid";
  66  $sql .= " GROUP BY date_format(f.date,'%Y%m') DESC, c.rowid DESC";
  67  
  68  print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
  69  
  70  print '<tr class="liste_titre"><td width="50%" valign="top">Nom</td><td align="center">Date</td><td>&nbsp;</td></tr>';
  71  
  72  $resql = $db->query($sql);
  73  if ($resql)
  74  {
  75    $num = $db->num_rows();
  76    $i = 0;
  77    $datas = array();
  78    $legends = array();
  79    $total = 0;
  80    while ($i < $num)
  81      {
  82        $row = $db->fetch_row($i);    
  83  
  84        $var=!$var;
  85  
  86        print "<tr $bc[$var]>";
  87  
  88        print '<td width="50%" valign="top">';
  89        print '<a href="commercial.php?commid='.$row[4];
  90        print '">'.$row[3]." ". $row[2].'</a></td><td align="center">'.$row[0].'</td>';
  91        print '<td align="right">'.price($row[1]).'</td></tr>';
  92        $total += $row[1];
  93        $i++;
  94      }
  95    $db->free();
  96  }
  97  else 
  98  {
  99    print $db->error() . ' ' . $sql;
 100  }
 101  $var=!$var;
 102  
 103  print '</table><br />';
 104  
 105  
 106  
 107  print '</td>';
 108  
 109  print '</td><td valign="top" width="70%">';
 110  
 111  
 112  print '</td></tr>';
 113  
 114  
 115  print '</table>';
 116  
 117  
 118  
 119  $db->close();
 120  
 121  llxFooter("<em>Derni&egrave;re modification $Date: 2005/12/01 15:07:38 $ r&eacute;vision $Revision: 1.5 $</em>");
 122  ?>


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