[ 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/compta/deplacement/ -> index.php (source)

   1  <?php
   2  /* Copyright (C) 2003      Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2004-2005 Laurent Destailleur  <eldy@users.sourceforge.net>
   4   * Copyright (C) 2004      Eric Seigne          <eric.seigne@ryxeo.com>
   5   *
   6   * This program is free software; you can redistribute it and/or modify
   7   * it under the terms of the GNU General Public License as published by
   8   * the Free Software Foundation; either version 2 of the License, or
   9   * (at your option) any later version.
  10   *
  11   * This program is distributed in the hope that it will be useful,
  12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14   * GNU General Public License for more details.
  15   *
  16   * You should have received a copy of the GNU General Public License
  17   * along with this program; if not, write to the Free Software
  18   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  19   *
  20   * $Id: index.php,v 1.17 2005/12/03 00:36:02 eldy Exp $
  21   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/deplacement/index.php,v $
  22   */
  23  
  24  /**
  25          \file       htdocs/compta/deplacement/index.php
  26          \brief      Page liste des déplacements
  27  */
  28  
  29  require ("./pre.inc.php");
  30  require ("../../tva.class.php");
  31  
  32  $langs->load("companies");
  33  $langs->load("users");
  34  $langs->load("trips");
  35  
  36  
  37  llxHeader();
  38  
  39  $sortorder=$_GET["sortorder"];
  40  $sortfield=$_GET["sortfield"];
  41  $page=$_GET["page"];
  42  
  43  if (! $sortorder) $sortorder="DESC";
  44  if (! $sortfield) $sortfield="d.dated";
  45  
  46  
  47  if ($page == -1) { $page = 0 ; }
  48  
  49  $limit = $conf->liste_limit;
  50  $offset = $limit * $page ;
  51  $pageprev = $page - 1;
  52  $pagenext = $page + 1;
  53  
  54  $sql = "SELECT s.nom, s.idp,";                                  // Ou
  55  $sql.= " d.rowid, ".$db->pdate("d.dated")." as dd, d.km, ";     // Comment
  56  $sql.= " u.name, u.firstname";                                  // Qui
  57  $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u ";
  58  $sql.= " WHERE d.fk_soc = s.idp AND d.fk_user = u.rowid";
  59  
  60  if ($user->societe_id > 0)
  61  {
  62    $sql .= " AND s.idp = " . $user->societe_id;
  63  }
  64  
  65  $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit + 1 ,$offset);
  66  
  67  $resql=$db->query($sql);
  68  if ($resql)
  69  {
  70    $num = $db->num_rows($resql);
  71  
  72    print_barre_liste($langs->trans("ListOfTrips"), $page, "index.php","&socidp=$socidp",$sortfield,$sortorder,'',$num);
  73  
  74    $i = 0;
  75    print '<table class="noborder" width="100%">';
  76    print "<tr class=\"liste_titre\">";
  77    print_liste_field_titre($langs->trans("Ref"),"index.php","d.rowid","","&socidp=$socidp",'',$sortfield);
  78    print_liste_field_titre($langs->trans("Date"),"index.php","d.dated","","&socidp=$socidp",'',$sortfield);
  79    print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","","&socidp=$socidp",'',$sortfield);
  80    print_liste_field_titre($langs->trans("Person"),"index.php","u.name","","&socidp=$socidp",'',$sortfield);
  81    print_liste_field_titre($langs->trans("Distance"),"index.php","d.km","","&socidp=$socidp",'align="right"',$sortfield);
  82    print "</tr>\n";
  83  
  84    $var=true;
  85    while ($i < $num)
  86      {
  87        $objp = $db->fetch_object($resql);
  88        $soc = new Societe($db);
  89        $soc->fetch($objp->idp);
  90        $var=!$var;
  91        print "<tr $bc[$var]>";
  92        print '<td><a href="fiche.php?id='.$objp->rowid.'">'.img_object($langs->trans("ShowTrip"),"trip").' '.$objp->rowid.'</a></td>';
  93        print '<td>'.dolibarr_print_date($objp->dd).'</td>';
  94        print '<td>' . img_object($langs->trans("ShowCompany"),"company").' '.$soc->nom_url . '</a></td>';
  95        print '<td align="left"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$objp->rowid.'">'.img_object($langs->trans("ShowUser"),"user").' '.$objp->firstname.' '.$objp->name.'</a></td>';
  96        print '<td align="right">'.$objp->km.'</td>';
  97        print "</tr>\n";
  98        
  99        $i++;
 100      }
 101    
 102    print "</table>";
 103    $db->free($resql);
 104  }
 105  else
 106  {
 107    dolibarr_print_error($db);
 108  }
 109  $db->close();
 110  
 111  llxFooter('$Date: 2005/12/03 00:36:02 $ r&eacute;vision $Revision: 1.17 $');
 112  ?>


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