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


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