[ 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/ -> my.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: my.php,v 1.3 2005/09/12 13:58:53 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/client/my.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 - Mes clients');
  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  $sql = "SELECT s.idp as socidp, s.nom, count(l.ligne) as ligne, cs.ca";
  66  $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
  67  $sql .= " ,".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
  68  
  69  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."telephonie_client_stats as cs ON s.idp=cs.fk_client_comm";
  70  
  71  $sql .= " WHERE l.fk_client_comm = s.idp ";
  72  $sql .= " AND l.fk_commercial_suiv = ".$user->id;
  73  
  74  if ($_GET["search_client"])
  75  {
  76    $sel = urldecode($_GET["search_client"]);
  77    $sql .= " AND s.nom LIKE '%".$sel."%'";
  78  }
  79  
  80  $sql .= " GROUP BY s.idp";
  81  
  82  $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
  83  
  84  $result = $db->query($sql);
  85  if ($result)
  86  {
  87    $num = $db->num_rows();
  88    $i = 0;
  89    
  90    $urladd= "&amp;statut=".$_GET["statut"];
  91  
  92    $titre = "Les clients de ".$user->fullname;
  93  
  94    print_barre_liste($titre, $page, "my.php", $urladd, $sortfield, $sortorder, '', $num);
  95  
  96    //print '<a href="myxls.php">Exporter dans un tableur</a>';
  97  
  98    print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
  99    print '<tr class="liste_titre">';
 100    print_liste_field_titre("Client","my.php","s.nom","","",' width="50%"');
 101    print '<td width="25%" align="center">Nb Lignes';
 102    print '</td><td width="25%" align="right">Chiffre d\'affaire</td>';
 103    print "</tr>\n";
 104  
 105    print '<tr class="liste_titre">';
 106    print '<form action="my.php" method="GET">';
 107    print '<td><input type="text" name="search_client" value="'. $_GET["search_client"].'" size="12"></td>';  
 108    print '<td><input type="submit" value="Chercher"></td><td>&nbsp;</td>';
 109  
 110    print '</form>';
 111    print '</tr>';
 112  
 113    $var=True;
 114  
 115    $ligne = new LigneTel($db);
 116  
 117    while ($i < min($num,$conf->liste_limit))
 118      {
 119        $obj = $db->fetch_object($i);    
 120        $var=!$var;
 121  
 122        print "<tr $bc[$var]><td>";
 123  
 124        print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->socidp.'">';
 125        print img_file();      
 126        print '</a>&nbsp;';
 127  
 128        print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->socidp.'">'.$obj->nom.'</a></td>';
 129        print '<td align="center">'.$obj->ligne."</td>\n";
 130  
 131        print '<td align="right">'.price($obj->ca)." euros HT</td>\n";
 132  
 133  
 134        print "</tr>\n";
 135        $i++;
 136      }
 137    print "</table>";
 138    $db->free();
 139  }
 140  else 
 141  {
 142    print $db->error() . ' ' . $sql;
 143  }
 144  
 145  $db->close();
 146  
 147  llxFooter("<em>Derni&egrave;re modification $Date: 2005/09/12 13:58:53 $ r&eacute;vision $Revision: 1.3 $</em>");
 148  ?>


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