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

   1  <?php
   2  /* Copyright (C) 2003-2004 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: index.php,v 1.35 2005/09/26 22:47:23 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/commande/index.php,v $
  21   */
  22  
  23  /**
  24          \file       htdocs/commande/index.php
  25          \ingroup    compta
  26          \brief      Page acceuil zone comptabilité
  27          \version    $Revision: 1.35 $
  28  */
  29  
  30  require ("./pre.inc.php");
  31  
  32  if (!$user->rights->commande->lire) accessforbidden();
  33  
  34  $langs->load("orders");
  35  
  36  // Sécurité accés client
  37  $socidp='';
  38  if ($_GET["socidp"]) { $socidp=$_GET["socidp"]; }
  39  if ($user->societe_id > 0) 
  40  {
  41    $action = '';
  42    $socidp = $user->societe_id;
  43  }
  44  
  45  
  46  
  47  llxHeader("",$langs->trans("Orders"),"Commande");
  48  
  49  print_fiche_titre($langs->trans("OrdersArea"));
  50  
  51  print '<table width="100%" class="notopnoleftnoright">';
  52  
  53  print '<tr><td valign="top" width="30%" class="notopnoleft">';
  54  
  55  /*
  56   * Zone recherche
  57   */
  58  $var=false;
  59  print '<table class="noborder" width="100%">';
  60  print '<form method="post" action="liste.php">';
  61  print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchOrder").'</td></tr>';
  62  print '<tr '.$bc[$var].'><td>';
  63  print $langs->trans("Ref").':</td><td><input type="text" class="flat" name="sf_ref" size=18></td><td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
  64  print '<tr '.$bc[$var].'><td nowrap>'.$langs->trans("Other").':</td><td><input type="text" class="flat" name="sall" size="18"></td>';
  65  print '</tr>';
  66  print "</form></table><br>\n";
  67  
  68  
  69  /*
  70   * Commandes à valider
  71   */
  72  $sql = "SELECT c.rowid, c.ref, s.nom, s.idp FROM ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."societe as s";
  73  $sql .= " WHERE c.fk_soc = s.idp AND c.fk_statut = 0";
  74  if ($socidp) $sql .= " AND c.fk_soc = ".$socidp;
  75  
  76  if ( $db->query($sql) )
  77  {
  78      $langs->load("orders");
  79      $num = $db->num_rows();
  80      if ($num)
  81      {
  82          $i = 0;
  83          print '<table class="noborder" width="100%">';
  84          print '<tr class="liste_titre">';
  85          print '<td colspan="2">'.$langs->trans("DraftOrders").'</td></tr>';
  86          $var = True;
  87          while ($i < $num)
  88          {
  89              $var=!$var;
  90              $obj = $db->fetch_object();
  91              print "<tr $bc[$var]><td nowrap><a href=\"fiche.php?id=$obj->rowid\">".img_object($langs->trans("ShowOrder"),"order").' '.$obj->ref."</a></td>";
  92              print '<td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($obj->nom,24).'</a></td></tr>';
  93              $i++;
  94          }
  95          print "</table><br>";
  96      }
  97  }
  98  
  99  /*
 100   * Commandes à traiter
 101   */
 102  $sql = "SELECT c.rowid, c.ref, s.nom, s.idp FROM ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."societe as s";
 103  $sql .= " WHERE c.fk_soc = s.idp AND c.fk_statut = 1";
 104  if ($socidp) $sql .= " AND c.fk_soc = ".$socidp;
 105  $sql .= " ORDER BY c.rowid DESC";
 106  
 107  if ( $db->query($sql) )
 108  {
 109      print '<table class="noborder" width="100%">';
 110      print '<tr class="liste_titre">';
 111      print '<td colspan="2">'.$langs->trans("OrdersToProcess").'</td></tr>';
 112  
 113      $num = $db->num_rows();
 114      if ($num)
 115      {
 116          $i = 0;
 117          $var = True;
 118          while ($i < $num)
 119          {
 120              $var=!$var;
 121              $obj = $db->fetch_object();
 122              print "<tr $bc[$var]><td nowrap><a href=\"fiche.php?id=$obj->rowid\">".img_object($langs->trans("ShowOrder"),"order")." ".$obj->ref."</a></td>";
 123              print '<td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.'</a></td></tr>';
 124              $i++;
 125          }
 126      }
 127  
 128      print "</table><br>";
 129  }
 130  
 131  
 132  print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
 133  
 134  
 135  /*
 136   * Commandes en cours
 137   */
 138  $sql = "SELECT c.rowid, c.ref, s.nom, s.idp FROM ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."societe as s";
 139  $sql .= " WHERE c.fk_soc = s.idp AND c.fk_statut = 2 ";
 140  if ($socidp) $sql .= " AND c.fk_soc = ".$socidp;
 141  $sql .= " ORDER BY c.rowid DESC";
 142  
 143  if ( $db->query($sql) )
 144  {
 145      print '<table class="noborder" width="100%">';
 146      print '<tr class="liste_titre">';
 147      print '<td colspan="2">'.$langs->trans("OnProcessOrders").' ('.$num.')</td></tr>';
 148  
 149      $num = $db->num_rows();
 150      if ($num)
 151      {
 152          $i = 0;
 153          $var = True;
 154          while ($i < $num)
 155          {
 156              $var=!$var;
 157              $obj = $db->fetch_object();
 158              print "<tr $bc[$var]><td width=\"30%\"><a href=\"fiche.php?id=$obj->rowid\">".img_object($langs->trans("ShowOrder"),"order").' ';
 159              print $obj->ref.'</a></td>';
 160              print '<td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$obj->idp.'">'.$obj->nom.'</a></td></tr>';
 161              $i++;
 162          }
 163      }
 164      print "</table><br>";
 165  }
 166  
 167  /*
 168   * Dernières commandes traitées
 169   */
 170  $max=5;
 171  
 172  $sql = "SELECT c.rowid, c.ref, s.nom, s.idp,";
 173  $sql.= " ".$db->pdate("date_cloture")." as datec";
 174  $sql.= " FROM ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."societe as s";
 175  $sql.= " WHERE c.fk_soc = s.idp and c.fk_statut > 2";
 176  if ($socidp) $sql .= " AND c.fk_soc = ".$socidp;
 177  $sql.= " ORDER BY c.tms DESC";
 178  $sql.= $db->plimit($max, 0);
 179  
 180  $resql=$db->query($sql);
 181  if ($resql)
 182  {
 183      print '<table class="noborder" width="100%">';
 184      print '<tr class="liste_titre">';
 185      print '<td colspan="3">'.$langs->trans("LastClosedOrders",$max).'</td></tr>';
 186  
 187      $num = $db->num_rows($resql);
 188      if ($num)
 189      {
 190          $i = 0;
 191          $var = True;
 192          while ($i < $num)
 193          {
 194              $var=!$var;
 195              $obj = $db->fetch_object($resql);
 196              print "<tr $bc[$var]><td><a href=\"fiche.php?id=$obj->rowid\">".img_object($langs->trans("ShowOrders"),"order").' ';
 197              print $obj->ref.'</a></td>';
 198              print '<td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$obj->idp.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.'</a></td>';
 199              print '<td>'.dolibarr_print_date($obj->datec).'</td>';
 200              print '</tr>';
 201              $i++;
 202          }
 203      }
 204      print "</table><br>";
 205  }
 206  
 207  
 208  
 209  
 210  print '</td></tr></table>';
 211  
 212  $db->close();
 213  
 214  llxFooter('$Date: 2005/09/26 22:47:23 $ - $Revision: 1.35 $');
 215  
 216  ?>


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