[ 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/client/ -> liste.php (source)

   1  <?PHP
   2  /* Copyright (C) 2004-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: liste.php,v 1.3 2005/09/06 14:58:25 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/client/liste.php,v $
  20   *
  21   */
  22  require ("./pre.inc.php");
  23  
  24  
  25  $page = $_GET["page"];
  26  $sortorder = $_GET["sortorder"];
  27  $sortfield = $_GET["sortfield"];
  28  
  29  llxHeader('','Telephonie - Ligne - Liste');
  30  /*
  31   * Sécurité accés client
  32   */
  33  if ($user->societe_id > 0) 
  34  {
  35    $action = '';
  36    $socidp = $user->societe_id;
  37  }
  38  
  39  if ($sortorder == "") {
  40    $sortorder="ASC";
  41  }
  42  if ($sortfield == "") {
  43    $sortfield="s.nom";
  44  }
  45  
  46  /*
  47   * Recherche
  48   *
  49   *
  50   */
  51  
  52  if ($page == -1) { $page = 0 ; }
  53  
  54  $offset = $conf->liste_limit * $page ;
  55  $pageprev = $page - 1;
  56  $pagenext = $page + 1;
  57  
  58  /*
  59   * Mode Liste
  60   *
  61   *
  62   *
  63   */
  64  
  65  
  66  
  67  $sql = "SELECT s.idp as socidp, s.nom, count(l.ligne) as ligne, cs.ca";
  68  $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
  69  $sql .= ",".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
  70  $sql .= ",".MAIN_DB_PREFIX."societe_perms as sp";
  71  
  72  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."telephonie_client_stats as cs ON s.idp=cs.fk_client_comm";
  73  
  74  $sql .= " WHERE l.fk_client_comm = s.idp ";
  75  
  76  $sql .= " AND s.idp = sp.fk_soc";
  77  $sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1";
  78  
  79  if ($_GET["search_client"])
  80  {
  81    $sel = urldecode($_GET["search_client"]);
  82    $sql .= " AND s.nom LIKE '%".$sel."%'";
  83  }
  84  
  85  $sql .= " GROUP BY s.idp";
  86  
  87  $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
  88  
  89  $result = $db->query($sql);
  90  if ($result)
  91  {
  92    $num = $db->num_rows();
  93    $i = 0;
  94    
  95    $urladd= "&amp;statut=".$_GET["statut"];
  96  
  97    print_barre_liste("Clients", $page, "liste.php", $urladd, $sortfield, $sortorder, '', $num);
  98  
  99    print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
 100    print '<tr class="liste_titre">';
 101    print_liste_field_titre("Client","liste.php","s.nom","","",' width="50%"');
 102    print '<td width="25%" align="center">Nb Lignes';
 103    print '</td><td width="25%" align="right">CA</td>';
 104    print "</tr>\n";
 105  
 106    print '<tr class="liste_titre">';
 107    print '<form action="liste.php" method="GET">';
 108    print '<td><input type="text" name="search_client" value="'. $_GET["search_client"].'" size="12"></td>';  
 109    print '<td><input type="submit" class="button" value="'.$langs->trans("Search").'"></td><td>&nbsp;</td>';
 110  
 111    print '</form>';
 112    print '</tr>';
 113  
 114  
 115    $var=True;
 116  
 117    $ligne = new LigneTel($db);
 118  
 119    while ($i < min($num,$conf->liste_limit))
 120      {
 121        $obj = $db->fetch_object($i);    
 122        $var=!$var;
 123  
 124        print "<tr $bc[$var]><td>";
 125  
 126        print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->socidp.'">';
 127        print img_file();      
 128        print '</a>&nbsp;';
 129  
 130        print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->socidp.'">'.$obj->nom.'</a></td>';
 131        print '<td align="center">'.$obj->ligne."</td>\n";
 132  
 133        print '<td align="right">'.price($obj->ca)." euros HT</td>\n";
 134  
 135  
 136        print "</tr>\n";
 137        $i++;
 138      }
 139    print "</table>";
 140    $db->free();
 141  }
 142  else 
 143  {
 144    print $db->error() . ' ' . $sql;
 145  }
 146  
 147  $db->close();
 148  
 149  llxFooter("<em>Derni&egrave;re modification $Date: 2005/09/06 14:58:25 $ r&eacute;vision $Revision: 1.3 $</em>");
 150  ?>


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