[ 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/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.6 2005/08/16 23:30:00 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/commande/liste.php,v $
  21   */
  22  
  23  /**
  24          \file       htdocs/compta/commande/liste.php
  25          \ingroup    commande
  26          \brief      Page liste des commandes
  27          \version    $Revision: 1.6 $
  28  */
  29  
  30  require ("./pre.inc.php");
  31  
  32  if (!$user->rights->commande->lire) accessforbidden();
  33  
  34  $begin=$_GET["begin"];
  35  $sortorder=$_GET["sortorder"];
  36  $sortfield=$_GET["sortfield"];
  37  if (! $sortfield) $sortfield="c.rowid";
  38  if (! $sortorder) $sortorder="DESC";
  39  
  40  $limit = $conf->liste_limit;
  41  $offset = $limit * $_GET["page"] ;
  42  
  43  // Sécurité accés client
  44  $socidp = $_GET["socidp"];
  45  if ($user->societe_id > 0)
  46  {
  47      $action = '';
  48      $socidp = $user->societe_id;
  49  }
  50  
  51  
  52  llxHeader();
  53  
  54  
  55  $sql = "SELECT s.nom, s.idp, c.rowid, c.ref, c.total_ht,".$db->pdate("c.date_commande")." as date_commande, c.fk_statut" ;
  56  $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c WHERE c.fk_soc = s.idp";
  57  if ($socidp)
  58  {
  59      $sql .= " AND s.idp = $socidp";
  60  }
  61  if ($_GET["month"] > 0)
  62  {
  63      $sql .= " AND date_format(c.date_commande, '%Y-%m') = '".$_GET["year"]."-".$_GET["month"]."'";
  64  }
  65  if ($_GET["year"] > 0)
  66  {
  67      $sql .= " AND date_format(c.date_commande, '%Y') = '".$_GET["year"]."'";
  68  }
  69  if (isset($_GET["status"]))
  70  {
  71      $sql .= " AND fk_statut = ".$_GET["status"];
  72  }
  73  if (isset($_GET["afacturer"]))
  74  {
  75      $sql .= " AND fk_statut >=1    AND c.facture = 0";
  76  }
  77  if (strlen($_POST["sf_ref"]) > 0)
  78  {
  79      $sql .= " AND c.ref like '%".$_POST["sf_ref"] . "%'";
  80  }
  81  $sql .= " ORDER BY $sortfield $sortorder";
  82  $sql .= $db->plimit($limit + 1,$offset);
  83  $resql = $db->query($sql);
  84  
  85  if ($resql)
  86  {
  87      if ($socidp)
  88      {
  89          $soc = new Societe($db);
  90          $soc->fetch($socidp);
  91          $title = $langs->trans("ListOfOrders") . " - ".$soc->nom;
  92      }
  93      else
  94      {
  95          $title = $langs->trans("ListOfOrders");
  96      }
  97      // Si page des commandes à facturer
  98      $link=DOL_URL_ROOT."/compta/commande/fiche.php";
  99      $title.=" - ".$langs->trans("StatusOrderToBill");
 100      $param="&amp;socidp=".$socidp."&amp;year=".$_GET["year"]."&amp;month=".$_GET["month"];
 101  
 102      $num = $db->num_rows($resql);
 103      print_barre_liste($title, $_GET["page"], "liste.php",$param,$sortfield,$sortorder,'',$num);
 104  
 105      $i = 0;
 106      print '<table class="noborder" width="100%">';
 107      print '<tr class="liste_titre">';
 108      print_liste_field_titre($langs->trans("Ref"),"liste.php","c.ref","",$param,'',$sortfield);
 109      print_liste_field_titre($langs->trans("Company"),"liste.php","s.nom","",$param,'',$sortfield);
 110      print_liste_field_titre($langs->trans("Date"),"liste.php","c.date_commande","",$param, 'align="center"',$sortfield);
 111      print_liste_field_titre($langs->trans("Status"),"liste.php","c.fk_statut","",$param,'align="center"',$sortfield);
 112      print "</tr>\n";
 113      $var=True;
 114  
 115      $generic_commande = new Commande($db);
 116  
 117      while ($i < min($num,$limit))
 118      {
 119          $objp = $db->fetch_object($resql);
 120  
 121          $var=!$var;
 122          print "<tr $bc[$var]>";
 123          print "<td><a href=\"".$link."?id=$objp->rowid\">".img_object($langs->trans("ShowOrder"),"order")." ".$objp->ref."</a></td>\n";
 124          print "<td><a href=\"".DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->idp."\">".img_object($langs->trans("ShowCompany"),"company")." ".$objp->nom."</a>";
 125          if (($objp->date_commande < (time() - $conf->commande->traitement->warning_delay)) && $objp->statutid == 1 )
 126          {
 127              print img_warning();
 128          }
 129          print "</td>";
 130  
 131          print "<td align=\"center\">";
 132          $y = strftime("%Y",$objp->date_commande);
 133          $m = strftime("%m",$objp->date_commande);
 134  
 135          print strftime("%d",$objp->date_commande)."\n";
 136          print " <a href=\"liste.php?year=$y&amp;month=$m\">";
 137          print strftime("%B",$objp->date_commande)."</a>\n";
 138          print " <a href=\"liste.php?year=$y\">";
 139          print strftime("%Y",$objp->date_commande)."</a></td>\n";
 140  
 141          print '<td align="center">'.$generic_commande->statuts[$objp->fk_statut].'</td>';
 142          print "</tr>\n";
 143  
 144          $total = $total + $objp->price;
 145          $subtotal = $subtotal + $objp->price;
 146  
 147          $i++;
 148      }
 149  
 150      print "</table>";
 151      $db->free($resql);
 152  }
 153  else
 154  {
 155      print dolibarr_print_error($db);
 156  }
 157  
 158  
 159  $db->close();
 160  
 161  llxFooter('$Date: 2005/08/16 23:30:00 $ - $Revision: 1.6 $');
 162  ?>


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