[ 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/ca/ -> gain.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: gain.php,v 1.9 2005/09/07 16:14:55 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/ca/gain.php,v $
  20   *
  21   */
  22  require ("./pre.inc.php");
  23  
  24  /*
  25   * Sécurité accés client
  26   */
  27  
  28  if (!$user->rights->telephonie->ca->lire) accessforbidden();
  29  
  30  llxHeader('','Telephonie - CA par client');
  31  
  32  /*
  33   *
  34   *
  35   *
  36   */
  37  print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
  38  
  39  print '<tr><td width="50%" valign="top">';
  40  
  41  $page = $_GET["page"];
  42  $sortorder = $_GET["sortorder"];
  43  $sortfield = $_GET["sortfield"];
  44  $offset = $conf->liste_limit * $page ;
  45  $pageprev = $page - 1;
  46  $pagenext = $page + 1;
  47  
  48  if ($sortorder == "") $sortorder="DESC";
  49  if ($sortfield == "") $sortfield="ca";
  50  
  51  $sql = "SELECT nom, ca, gain, cout, marge, fk_client_comm";
  52  $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_client_stats";
  53  $sql .= " , " .MAIN_DB_PREFIX."societe";
  54  $sql .= " WHERE idp = fk_client_comm";
  55  $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
  56  $resql = $db->query($sql);
  57  if ($resql)
  58  {
  59    $num = $db->num_rows($resql);
  60    $i = 0;
  61  
  62    print_barre_liste("CA cumulé par client", $page, "gain.php", $urladd, $sortfield, $sortorder, '', $num);
  63  
  64    print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
  65    print '<tr class="liste_titre"><td>Client</td><td align="right">Chiffre d\'affaire</td>';
  66    print '<td align="right">Gain</td>';
  67  
  68    print_liste_field_titre("Marge","gain.php","marge",'','','align="right"');
  69    print "<td>&nbsp;</td></tr>\n";
  70    $var=True;
  71  
  72    while ($i < min($num,$conf->liste_limit))
  73      {
  74        $row = $db->fetch_row($resql);    
  75        $var=!$var;
  76  
  77        $marge = $row[4];
  78  
  79        print "<tr $bc[$var]>";
  80        print '<td><a href="'.DOL_URL_ROOT.'/telephonie/client/stats.php?id='.$row[5].'">'.$row[0]."</a></td>\n";
  81        print '<td align="right">'.price($row[1])." HT</td>\n";
  82        print '<td align="right">'.price($row[2])." HT</td>\n";
  83        print '<td align="right">'.number_format(round($marge), 2, '.', ' ')." %</td>\n";
  84        if ($marge < 0)
  85      {
  86        print '<td align="center">!!</td>';
  87      }
  88        else
  89      {
  90        print '<td>&nbsp;</td>';
  91      }
  92        print "</tr>\n";
  93        $i++;
  94      }
  95    print "</table>";
  96    $db->free($resql);
  97  }
  98  else 
  99  {
 100    print $db->error() . ' ' . $sql;
 101  }
 102  
 103  //print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=telephoniegraph&file=ca/gain_moyen_par_client.png" alt="Gain moyen par client"><br /><br />';
 104  
 105  print '</td></tr>';
 106  print '</table>';
 107  
 108  $db->close();
 109  
 110  llxFooter("<em>Derni&egrave;re modification $Date: 2005/09/07 16:14:55 $ r&eacute;vision $Revision: 1.9 $</em>");
 111  ?>


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