[ 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/clients/ -> 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.2 2005/02/18 14:18:47 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/stats/clients/gain.php,v $
  20   *
  21   */
  22  require ("./pre.inc.php");
  23  
  24  if (!$user->rights->telephonie->lire) accessforbidden();
  25  
  26  llxHeader('','Telephonie - Statistiques');
  27  
  28  $h = 0;
  29  $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/clients/index.php';
  30  $head[$h][1] = "Global";
  31  $h++;
  32  
  33  $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/clients/gain.php';
  34  $head[$h][1] = "Gain";
  35  $hselected = $h;
  36  $h++;
  37  
  38  $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/clients/alerte.php';
  39  $head[$h][1] = "Alerte";
  40  $h++;
  41  
  42  dolibarr_fiche_head($head, $hselected, "Clients");
  43  
  44  print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
  45  
  46  print '<tr><td width="70%" valign="top">';
  47  
  48  $page = $_GET["page"];
  49  $sortfield = $_GET["sortfield"];
  50  $sortorder = $_GET["sortorder"];
  51  
  52  if ($sortorder == "") $sortorder="DESC";
  53  if ($sortfield == "") $sortfield="marge";
  54  
  55  $sql = "SELECT nom, ca, gain, cout, marge, idp";
  56  $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_client_stats";
  57  $sql .= " , " .MAIN_DB_PREFIX."societe";
  58  $sql .= " WHERE idp = fk_client_comm";
  59  $sql .= " ORDER BY $sortfield $sortorder ";// . $db->plimit($conf->liste_limit+1, $offset);
  60  
  61  if ($db->query($sql))
  62  {
  63    $num = $db->num_rows();
  64    $i = 0;
  65  
  66    print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
  67    print '<tr class="liste_titre">';
  68    print_liste_field_titre("Client","gain.php","nom");
  69    print_liste_field_titre("Marge","gain.php","marge",'','','align="right"');
  70    print_liste_field_titre("Gain Total","gain.php","gain",'','','align="right"');
  71    print_liste_field_titre("Vente","gain.php","ca",'','','align="right"');
  72    print_liste_field_titre("Achat","gain.php","cout",'','','align="right"');
  73    print "</tr>\n";
  74    $var=True;
  75  
  76    while ($i < $num)
  77      {
  78        $row = $db->fetch_row($i);    
  79        $var=!$var;
  80  
  81        print "<tr $bc[$var]>";
  82        print '<td><a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$row[5].'">'.$row[0].'</a></td>'."\n";
  83  
  84        $marge = round($row[4],2);
  85  
  86        if ($marge < 0)
  87      {
  88        print '<td align="right"><b><font color="red">'.$marge."</font></b> %</td>\n";
  89      }
  90        else
  91      {
  92        print '<td align="right">'.$marge." %</td>\n";
  93      }
  94        print '<td align="right">'.price($row[2])." HT</td>\n";
  95        print '<td align="right">'.price($row[1])." HT</td>\n";
  96        print '<td align="right">'.price($row[3])." HT</td>\n";
  97  
  98        print "</tr>\n";
  99        $i++;
 100      }
 101    print "</table>";
 102    $db->free();
 103  }
 104  else 
 105  {
 106    print $db->error() . ' ' . $sql;
 107  }
 108  
 109  print '</td></tr>';
 110  
 111  print '</table>';
 112  
 113  
 114  
 115  $db->close();
 116  
 117  llxFooter("<em>Derni&egrave;re modification $Date: 2005/02/18 14:18:47 $ r&eacute;vision $Revision: 1.2 $</em>");
 118  ?>


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