[ 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/fourn/commande/ -> 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.13 2005/08/31 21:56:06 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/fourn/commande/liste.php,v $
  21   */
  22  
  23  /** 
  24          \file       htdocs/fourn/commande/liste.php
  25          \ingroup    fournisseur
  26          \brief      Liste des commandes fournisseurs
  27          \version    $Revision: 1.13 $
  28  */
  29  
  30  require ("./pre.inc.php");
  31  
  32  $langs->load("orders");
  33  
  34  
  35  $page  = ( is_numeric($_GET["page"]) ?  $_GET["page"] : 0 );
  36  $socid = ( is_numeric($_GET["socid"]) ? $_GET["socid"] : 0 );
  37  $sortorder = $_GET["sortorder"];
  38  $sortfield = $_GET["sortfield"];
  39  
  40  $title = $langs->trans("SuppliersOrders");
  41  
  42  if (!$user->rights->fournisseur->commande->lire) accessforbidden();
  43  
  44  // Sécurité accés client/fournisseur
  45  if ($user->societe_id > 0) $socid = $user->societe_id;
  46  
  47  
  48  if ($socid > 0)
  49  {
  50    $fourn = new Fournisseur($db);
  51    $fourn->fetch($socid);
  52    $title .= ' (<a href="liste.php">'.$fourn->nom.'</a>)';
  53  }
  54  
  55  llxHeader('',$title);
  56  
  57  
  58  if ($sortorder == "") $sortorder="DESC";
  59  if ($sortfield == "") $sortfield="cf.date_creation";
  60  $offset = $conf->liste_limit * $page ;
  61  
  62  
  63  /*
  64   * Mode Liste
  65   */
  66  
  67  $sql = "SELECT s.idp, s.nom, ".$db->pdate("cf.date_commande")." as dc,";
  68  $sql .= " cf.rowid,cf.ref, cf.fk_statut";
  69  $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,";
  70  $sql .= " ".MAIN_DB_PREFIX."commande_fournisseur as cf";
  71  $sql .= " WHERE cf.fk_soc = s.idp ";
  72  
  73  if ($socid)
  74  {
  75      $sql .= " AND s.idp=$socid";
  76  }
  77  
  78  if (strlen($_GET["statut"]))
  79  {
  80      $sql .= " AND fk_statut =".$_GET["statut"];
  81  }
  82  
  83  if (strlen($_GET["search_ref"]))
  84  {
  85      $sql .= " AND cf.ref LIKE '%".$_GET["search_ref"]."%'";
  86  }
  87  
  88  if (strlen($_GET["search_nom"]))
  89  {
  90      $sql .= " AND s.nom LIKE '%".$_GET["search_nom"]."%'";
  91  }
  92  
  93  $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
  94  
  95  $resql = $db->query($sql);
  96  if ($resql)
  97  {
  98      $num = $db->num_rows($resql);
  99      $i = 0;
 100  
 101  
 102      print_barre_liste($title, $page, "liste.php", "", $sortfield, $sortorder, '', $num);
 103  
 104      print '<table class="liste">';
 105      print '<tr class="liste_titre">';
 106      print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"cf.ref");
 107      print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom");
 108      print_liste_field_titre($langs->trans("OrderDate"),$_SERVER["PHP_SELF"],"dc","","",'align="center"');
 109      print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"cf.fk_statut","","",'align="center"');
 110      print "</tr>\n";
 111  
 112      print '<tr class="liste_titre">';
 113      print '<form action="liste.php" method="GET">';
 114      print '<td><input type="text" class="flat" name="search_ref" value="'.$_GET["search_ref"].'"></td>';
 115      print '<td><input type="text" class="flat" name="search_nom" value="'.$_GET["search_nom"].'"></td>';
 116      print '<td colspan="2" class="liste_titre" align="right">';
 117      print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
 118      print '</td>';
 119      print '</form>';
 120      print '</tr>';
 121  
 122      $var=true;
 123  
 124      while ($i < min($num,$conf->liste_limit))
 125      {
 126          $obj = $db->fetch_object($resql);
 127          $var=!$var;
 128  
 129          print "<tr $bc[$var]>";
 130  
 131          // Ref
 132          print '<td><a href="'.DOL_URL_ROOT.'/fourn/commande/fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowOrder"),"order").' '.$obj->ref.'</a></td>'."\n";
 133  
 134          // Société
 135          print '<td><a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowCompany"),"company").' ';
 136          print $obj->nom.'</a></td>'."\n";
 137  
 138          // Date
 139          print "<td align=\"center\" width=\"100\">";
 140          if ($obj->dc)
 141          {
 142              print dolibarr_print_date($obj->dc,"%e %b %Y");
 143          }
 144          else
 145          {
 146              print "-";
 147          }
 148          print '</td>';
 149  
 150          // Statut
 151          print '<td align="center"><img src="statut'.$obj->fk_statut.'.png"></td>';
 152  
 153          print "</tr>\n";
 154          $i++;
 155      }
 156      print "</table>";
 157      $db->free($resql);
 158  }
 159  else
 160  {
 161      dolibarr_print_error($db);
 162  }
 163  
 164  $db->close();
 165  
 166  llxFooter('$Date: 2005/08/31 21:56:06 $ - $Revision: 1.13 $');
 167  ?>


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