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

   1  <?php
   2  /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2004-2005 Laurent Destailleur  <eldy@users.sourceforge.net>
   4   *
   5   * This program is free software; you can redistribute it and/or modify
   6   * it under the terms of the GNU General Public License as published by
   7   * the Free Software Foundation; either version 2 of the License, or
   8   * (at your option) any later version.
   9   *
  10   * This program is distributed in the hope that it will be useful,
  11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13   * GNU General Public License for more details.
  14   *
  15   * You should have received a copy of the GNU General Public License
  16   * along with this program; if not, write to the Free Software
  17   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18   *
  19   * $Id: liste.php,v 1.20 2005/12/03 21:16:18 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/expedition/liste.php,v $
  21   */
  22  
  23  /**
  24          \file       htdocs/expedition/liste.php
  25          \ingroup    expedition
  26          \brief      Page de la liste des expéditions/livraisons
  27  */
  28  
  29  require ("./pre.inc.php");
  30  
  31  if (!$user->rights->expedition->lire) accessforbidden();
  32  
  33  // Sécurité accés client
  34  if ($user->societe_id > 0) 
  35  {
  36    $action = '';
  37    $socidp = $user->societe_id;
  38  }
  39  
  40  $sortfield=isset($_GET["sortfield"])?$_GET["sortfield"]:"";
  41  $sortorder=isset($_GET["sortorder"])?$_GET["sortorder"]:"";
  42  if (! $sortfield) $sortfield="e.rowid";
  43  if (! $sortorder) $sortorder="DESC";
  44  
  45  $limit = $conf->liste_limit;
  46  $offset = $limit * $_GET["page"] ;
  47  
  48  
  49  
  50  /******************************************************************************/
  51  /*                                                                            */
  52  /*                   Fin des  Actions                                         */
  53  /*                                                                            */
  54  /******************************************************************************/
  55  
  56  
  57  llxHeader('',$langs->trans('ListOfSendings'),'ch-expedition.html');
  58  
  59  $sql = "SELECT e.rowid, e.ref,".$db->pdate("e.date_expedition")." as date_expedition, e.fk_statut" ;
  60  $sql .= " FROM ".MAIN_DB_PREFIX."expedition as e";
  61  if ($socidp) $sql.=", ".MAIN_DB_PREFIX."commande as c";
  62  $sql_add = " WHERE ";
  63  if ($socidp)
  64  { 
  65    $sql.= $sql_add . " e.fk_commande = c.rowid AND c.fk_soc = ".$socidp; 
  66    $sql_add = " AND ";
  67  }
  68  if (strlen($_POST["sf_ref"]) > 0)
  69  {
  70    $sql.= $sql_add . " e.ref like '%".$_POST["sf_ref"] . "%'";
  71  }
  72  
  73  $expedition = new Expedition($db);
  74  
  75  $sql .= " ORDER BY $sortfield $sortorder";
  76  $sql .= $db->plimit($limit + 1,$offset);
  77  
  78  $resql=$db->query($sql);
  79  if ($resql)
  80  {
  81    $num = $db->num_rows($resql);
  82    
  83    print_barre_liste($langs->trans('ListOfSendings'), $_GET["page"], "liste.php","&amp;socidp=$socidp",$sortfield,$sortorder,'',$num);
  84    
  85    $i = 0;
  86    print '<table class="noborder" width="100%">';
  87    
  88    print '<tr class="liste_titre">';
  89    print_liste_field_titre($langs->trans("Ref"),"liste.php","e.ref","","&amp;socidp=$socidp",'width="15%"',$sortfield);
  90    print_liste_field_titre($langs->trans("Date"),"liste.php","e.date_expedition","","&amp;socidp=$socidp", 'width="25%" align="right" colspan="2"',$sortfield);
  91    print_liste_field_titre($langs->trans("Status"),"liste.php","e.fk_statut","","&amp;socidp=$socidp",'width="10%" align="center"',$sortfield);
  92    print "</tr>\n";
  93    $var=True;
  94    
  95    while ($i < min($num,$limit))
  96      {
  97        $objp = $db->fetch_object($resql);
  98        
  99        $var=!$var;
 100        print "<tr $bc[$var]>";
 101        print "<td><a href=\"fiche.php?id=$objp->rowid\">".img_object($langs->trans("ShowSending"),"sending").'</a>&nbsp;';
 102        print "<a href=\"fiche.php?id=$objp->rowid\">".$objp->ref."</a></td>\n";
 103        
 104        $now = time();
 105        $lim = 3600 * 24 * 15 ;
 106        
 107        if ( ($now - $objp->date_expedition) > $lim && $objp->statutid == 1 )
 108      {
 109        print "<td><b> &gt; 15 jours</b></td>";
 110      }
 111        else
 112      {
 113        print "<td>&nbsp;</td>";
 114      }
 115        
 116        print "<td align=\"right\">";
 117        $y = strftime("%Y",$objp->date_expedition);
 118        $m = strftime("%m",$objp->date_expedition);
 119        
 120        print strftime("%d",$objp->date_expedition)."\n";
 121        print " <a href=\"propal.php?year=$y&amp;month=$m\">";
 122        print strftime("%B",$objp->date_expedition)."</a>\n";
 123        print " <a href=\"propal.php?year=$y\">";
 124        print strftime("%Y",$objp->date_expedition)."</a></TD>\n";      
 125        
 126        print '<td align="center">'.$expedition->statuts[$objp->fk_statut].'</td>';
 127        print "</tr>\n";
 128        
 129        $i++;
 130      }
 131    
 132    print "</table>";
 133    $db->free($resql);
 134  }
 135  else
 136  {
 137    dolibarr_print_error($db);
 138  }
 139  
 140  $db->close();
 141  
 142  llxFooter('$Date: 2005/12/03 21:16:18 $ - $Revision: 1.20 $');
 143  
 144  ?>


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