[ 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/tarifs/ -> index.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: index.php,v 1.7 2005/08/30 13:15:15 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/tarifs/index.php,v $
  20   *
  21   */
  22  require ("./pre.inc.php");
  23  
  24  llxHeader();
  25  
  26  /*
  27   * Sécurité accés client
  28   */
  29  if ($user->societe_id > 0) 
  30  {
  31    $action = '';
  32    $socidp = $user->societe_id;
  33  }
  34  
  35  
  36  
  37  /*
  38   * Recherche
  39   *
  40   *
  41   */
  42  if ($mode == 'search') {
  43    if ($mode-search == 'soc') {
  44      $sql = "SELECT s.idp FROM ".MAIN_DB_PREFIX."societe as s ";
  45      $sql .= " WHERE lower(s.nom) like '%".strtolower($socname)."%'";
  46    }
  47        
  48    if ( $db->query($sql) ) {
  49      if ( $db->num_rows() == 1) {
  50        $obj = $db->fetch_object(0);
  51        $socid = $obj->idp;
  52      }
  53      $db->free();
  54    }
  55  }
  56  
  57  $page = $_GET["page"];
  58  $sortorder = $_GET["sortorder"];
  59  $sortfield = $_GET["sortfield"];
  60  
  61  if ($sortorder == "") $sortorder="ASC";
  62  if ($sortfield == "") $sortfield="t.libelle ASC, d.rowid ";
  63  
  64  $offset = $conf->liste_limit * $page ;
  65  
  66  /*
  67   * Mode Liste
  68   *
  69   *
  70   *
  71   */
  72  
  73  $sql = "SELECT d.rowid as grille, d.libelle as tarif_desc, d.type_tarif";
  74  $sql .= " , t.libelle as tarif, t.rowid as tarif_id";
  75  $sql .= " , m.temporel, m.fixe";
  76  $sql .= " , u.code";
  77  $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille as d";
  78  $sql .= ","    . MAIN_DB_PREFIX."telephonie_tarif_grille_rights as r";
  79  $sql .= ","    . MAIN_DB_PREFIX."telephonie_tarif_montant as m";
  80  $sql .= ","    . MAIN_DB_PREFIX."telephonie_tarif as t";
  81  $sql .= ","    . MAIN_DB_PREFIX."user as u";
  82  
  83  $sqlc .= " WHERE d.rowid = m.fk_tarif_desc";
  84  $sqlc .= " AND m.fk_tarif = t.rowid";
  85  $sqlc .= " AND m.fk_user = u.rowid";
  86  
  87  $sqlc .= " AND d.rowid = r.fk_grille";
  88  $sqlc .= " AND r.fk_user =".$user->id;
  89  $sqlc .= " AND r.pread = 1";
  90  
  91  if ($_GET["search_libelle"])
  92  {
  93    $sqlc .=" AND t.libelle LIKE '%".$_GET["search_libelle"]."%'";
  94  }
  95  
  96  if ($_GET["search_grille"])
  97  {
  98    $sqlc .=" AND d.libelle LIKE '%".$_GET["search_grille"]."%'";
  99  }
 100  
 101  if ($_GET["type"])
 102  {
 103    $sqlc .= " AND d.type_tarif = '".$_GET["type"]."'";
 104  }
 105  
 106  $sql = $sql . $sqlc . " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
 107  
 108  
 109  $resql = $db->query($sql);
 110  if ($resql)
 111  {
 112    $num = $db->num_rows($resql);
 113    $i = 0;
 114    
 115    print_barre_liste("Tarifs", $page, "index.php", "&type=".$_GET["type"], $sortfield, $sortorder, '', $num);
 116  
 117    print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
 118    print '<tr class="liste_titre">';
 119  
 120    print_liste_field_titre("Tarif","index.php","d.libelle");
 121  
 122    print_liste_field_titre("Destination","index.php","t.libelle", "&type=".$_GET["type"]);
 123  
 124    print_liste_field_titre("Cout / min","index.php","temporel", "&type=".$_GET["type"]);
 125    print "</td>";
 126    print "<td>Cout fixe</td>";
 127    print '<td align="center">Type</td><td align="center">User</td>';
 128    print "</tr>\n";
 129  
 130    print '<tr class="liste_titre">';
 131    print '<form action="index.php" method="GET">';
 132    print '<input type="hidden" name="type" value="'.$_GET["type"].'">';
 133    print '<td><input type="text" name="search_grille" size="10" value="'.$_GET["search_grille"].'"></td>';
 134    print '<td><input type="text" name="search_libelle" size="20" value="'.$_GET["search_libelle"].'"></td>';
 135    print '<td>&nbsp;</td>';
 136    print '<td>&nbsp;</td>';
 137    print '<td>&nbsp;</td>';
 138    print '<td><input type="submit"></td>';
 139    print '</form>';
 140    print '</tr>';
 141  
 142    $var=True;
 143  
 144    while ($i < min($num,$conf->liste_limit))
 145      {
 146        $obj = $db->fetch_object($resql);
 147        $var=!$var;
 148  
 149        print "<tr $bc[$var]>";
 150  
 151        print '<td><a href="grille.php?id='.$obj->grille.'">';
 152        print $obj->tarif_desc."</td>\n";
 153        print '<td><a href="tarif.php?id='.$obj->tarif_id.'">';
 154        print $obj->tarif."</a></td>\n";
 155        print "<td>".sprintf("%01.4f",$obj->temporel)."</td>\n";
 156        print "<td>".sprintf("%01.4f",$obj->fixe)."</td>\n";
 157        print '<td align="center">'.$obj->type_tarif."</td>\n";
 158        print '<td align="center">'.$obj->code."</td>\n";
 159        print "</tr>\n";
 160        $i++;
 161      }
 162    print "</table>";
 163    $db->free();
 164  }
 165  else 
 166  {
 167    print $db->error() . ' ' . $sql;
 168  }
 169  
 170  $db->close();
 171  
 172  llxFooter("<em>Derni&egrave;re modification $Date: 2005/08/30 13:15:15 $ r&eacute;vision $Revision: 1.7 $</em>");
 173  ?>


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