[ 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/ -> commercialca.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: commercialca.php,v 1.10 2005/12/01 15:11:19 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/stats/commerciaux/commercialca.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  $h = 0;
  32  
  33  $year = strftime("%Y",time());
  34  
  35  $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/index.php';
  36  $head[$h][1] = "Global";
  37  $h++;
  38  
  39  if ($_GET["commid"])
  40  {
  41    $comm = new User($db, $_GET["commid"]);
  42    $comm->fetch();
  43  
  44    $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/commercial.php?commid='.$comm->id;
  45    $head[$h][1] = $comm->fullname;
  46    $h++;
  47  
  48    $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/commercialca.php?commid='.$comm->id;
  49    $head[$h][1] = "CA";
  50    $hselected = $h;
  51    $h++;
  52  
  53    $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/commerciaux/lignes.php?commid='.$comm->id;
  54    $head[$h][1] = "Lignes";
  55    $h++;
  56  
  57    dolibarr_fiche_head($head, $hselected, "Commerciaux");
  58  
  59    print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
  60  
  61    print '<tr><td valign="top" width="70%">';
  62  
  63    print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=telephoniegraph&file=commercials/'.$comm->id.'/gain.mensuel.'.$year.'.png" alt="Gain mensuel" title="Gain mensuel">'."\n";
  64  
  65    print '</td><td width="30%" valign="top">';
  66  
  67    print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
  68    print '<tr class="liste_titre">';
  69    print '<td>Mois</td><td align="right">Marge</td></tr>';
  70    
  71    $sql = "SELECT legend, valeur";
  72    $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_stats";
  73    $sql .= " WHERE graph  = 'commercial.gain.mensuel.".$_GET["commid"]."'";
  74    $sql .= " AND legend like '".$year."%'";
  75    $sql .= " ORDER BY legend ASC;";
  76    $resql = $db->query($sql);
  77    
  78    if ($resql)
  79      {
  80        while ($row = $db->fetch_row($resql))
  81      {
  82        $var=!$var;      
  83        print "<tr $bc[$var]><td>".$row[0].'</td>';  
  84        print '<td align="right">'.price($row[1]).'</td></tr>';
  85      }
  86        $db->free($resql);
  87      }
  88    else 
  89      {
  90        print $db->error() . ' ' . $sql;
  91      }
  92    print '</table>';
  93  
  94    print '</td></tr><tr><td valign="top">';
  95  
  96    print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=telephoniegraph&file=commercials/'.$comm->id.'/ca.mensuel.'.$year.'.png" alt="Chiffre d\'affaire mensuel" title="Chiffre d\'affaire mensuel"><br /><br />'."\n";
  97    
  98    print '</td><td width="30%" valign="top">';
  99  
 100    print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
 101    print '<tr class="liste_titre">';
 102    print '<td>Mois</td><td align="right">CA</td></tr>';
 103    
 104    $sql = "SELECT legend, valeur";
 105    $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_stats";
 106    $sql .= " WHERE graph  = 'commercial.ca.mensuel.".$_GET["commid"]."'";
 107    $sql .= " AND legend like '".$year."%'";
 108    $sql .= " ORDER BY legend ASC;";
 109    $resql = $db->query($sql);
 110    
 111    if ($resql)
 112      {
 113        while ($row = $db->fetch_row($resql))
 114      {
 115        $var=!$var;      
 116        print "<tr $bc[$var]><td>".$row[0].'</td>';  
 117        print '<td align="right">'.price($row[1]).'</td></tr>';
 118      }
 119        $db->free($resql);
 120      }
 121    else 
 122      {
 123        print $db->error() . ' ' . $sql;
 124      }
 125    print '</table>';
 126  
 127  
 128    print '</td></tr>';
 129    print '</table>';
 130    
 131    $db->close();
 132   
 133  }
 134  
 135  llxFooter("<em>Derni&egrave;re modification $Date: 2005/12/01 15:11:19 $ r&eacute;vision $Revision: 1.10 $</em>");
 136  ?>


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