[ 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/ -> mensuel.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: mensuel.php,v 1.2 2005/09/20 12:42:05 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/stats/commerciaux/mensuel.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  $h++;
  40  
  41  $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/mensuel.php';
  42  $head[$h][1] = "Mensuel";
  43  $hselected = $h;
  44  $h++;
  45  
  46  dolibarr_fiche_head($head, $hselected, "Commerciaux");
  47  
  48  if (strlen($_GET["month"]) == 0)
  49  {
  50    $month = strftime("%m%Y",time());
  51  }
  52  else
  53  {
  54    $month = $_GET["month"];
  55  }
  56  
  57  $month_prev = strftime("%m%Y", mktime(12,12,12,substr($month,0,2), 1, substr($month,-4)) - (20*3600*24));
  58  $month_next = strftime("%m%Y", mktime(12,12,12,substr($month,0,2), 25, substr($month,-4)) + (10*3600*24));
  59  
  60  print "<br />Mois de : ".strftime("%B %Y", mktime(12,12,12,substr($month,0,2), 1, substr($month,-4)));
  61  print '&nbsp;(<a href="mensuel.php?month='.$month_prev.'">'.strftime("%B %Y", mktime(12,12,12,substr($month_prev,0,2), 1, substr($month_prev,-4)));
  62  print '&nbsp;-&nbsp;<a href="mensuel.php?month='.$month_next.'">'.strftime("%B %Y", mktime(12,12,12,substr($month_next,0,2), 1, substr($month_next,-4))).")";
  63  print "<br /><br />";
  64  
  65  print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
  66  
  67  print '<tr><td width="30%" valign="top">';
  68  
  69  print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
  70  
  71  print '<tr class="liste_titre"><td width="50%" valign="top">Nom</td><td align="center">Nb Lignes</td></tr>';
  72  
  73  
  74  $sql = "SELECT count(*) as cc , c.name, c.firstname, c.rowid";
  75  $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
  76  $sql .= " , ".MAIN_DB_PREFIX."user as c";
  77  $sql .= " WHERE c.rowid = l.fk_commercial";
  78  $sql .= " AND date_format(date_commande, '%m%Y') = '$month'";
  79  $sql .= " GROUP BY c.name ORDER BY cc DESC";
  80  
  81  $result = $db->query($sql);
  82  if ($result)
  83  {
  84    $num = $db->num_rows();
  85    $i = 0;
  86    $datas = array();
  87    $legends = array();
  88  
  89    while ($i < $num)
  90      {
  91        $row = $db->fetch_row($i);    
  92  
  93        $var=!$var;
  94  
  95        print "<tr $bc[$var]>";
  96  
  97        print '<td width="50%" valign="top">';
  98        print '<a href="index.php?commid='.$row[3];
  99        print '">'.$row[2]." ". $row[1].'</a></td><td align="center">'.$row[0].'</td></tr>';
 100        
 101        $i++;
 102      }
 103    $db->free();
 104  }
 105  else 
 106  {
 107    print $db->error() . ' ' . $sql;
 108  }
 109  
 110  print '</table>';
 111  
 112  print '</td>';
 113  
 114  print '</td><td valign="top" width="70%">';
 115  
 116  
 117  
 118  print '</td></tr>';
 119  
 120  
 121  print '</table>';
 122  
 123  
 124  
 125  $db->close();
 126  
 127  llxFooter("<em>Derni&egrave;re modification $Date: 2005/09/20 12:42:05 $ r&eacute;vision $Revision: 1.2 $</em>");
 128  ?>


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