[ 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/contrat/ -> services.php (source)

   1  <?php
   2  /* Copyright (C) 2001-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: services.php,v 1.9 2005/11/14 20:13:25 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/contrat/services.php,v $
  21   */
  22  
  23  /**
  24          \file       htdocs/contrat/services.php
  25          \ingroup    contrat
  26          \brief      Page liste des contrats en service
  27          \version    $Revision: 1.9 $
  28  */
  29  
  30  require ("./pre.inc.php");
  31  
  32  $langs->load("products");
  33  $langs->load("companies");
  34  
  35  
  36  $mode = isset($_GET["mode"])?$_GET["mode"]:$_POST["mode"];
  37  $sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
  38  $sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
  39  $page = isset($_GET["page"])?$_GET["page"]:$_POST["page"];
  40  if ($page == -1) { $page = 0 ; }
  41  $limit = $conf->liste_limit;
  42  $offset = $limit * $page ;
  43  
  44  if (! $sortfield) $sortfield="c.rowid";
  45  if (! $sortorder) $sortorder="ASC";
  46  
  47  $filter=isset($_GET["filter"])?$_GET["filter"]:$_POST["filter"];
  48  $search_nom=isset($_GET["search_nom"])?$_GET["search_nom"]:$_POST["search_nom"];
  49  $search_contract=isset($_GET["search_contract"])?$_GET["search_contract"]:$_POST["search_contract"];
  50  $search_service=isset($_GET["search_service"])?$_GET["search_service"]:$_POST["search_service"];
  51  $statut=isset($_GET["statut"])?$_GET["statut"]:1;
  52  $socid=$_GET["socid"];
  53  
  54  // Sécurité accés client
  55  if ($user->societe_id > 0) 
  56  {
  57    $action = '';
  58    $socid = $user->societe_id;
  59  }
  60  
  61  
  62  llxHeader();
  63  
  64  
  65  $sql = "SELECT s.nom, c.rowid as cid, s.idp as sidp, cd.rowid, cd.label, cd.statut, p.rowid as pid,";
  66  $sql.= " ".$db->pdate("cd.date_ouverture_prevue")." as date_ouverture_prevue,";
  67  $sql.= " ".$db->pdate("cd.date_ouverture")." as date_ouverture,";
  68  $sql.= " ".$db->pdate("cd.date_fin_validite")." as date_fin_validite,";
  69  $sql.= " ".$db->pdate("cd.date_cloture")." as date_cloture";
  70  $sql.= " FROM ".MAIN_DB_PREFIX."contrat as c";
  71  $sql.= " , ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."product as p";
  72  $sql.= " , ".MAIN_DB_PREFIX."contratdet as cd";
  73  $sql.= " WHERE c.statut > 0";
  74  $sql.= " AND c.rowid = cd.fk_contrat";
  75  $sql.= " AND c.fk_soc = s.idp AND cd.fk_product = p.rowid";
  76  if ($mode == "0") $sql.= " AND cd.statut = 0";
  77  if ($mode == "4") $sql.= " AND cd.statut = 4";
  78  if ($mode == "5") $sql.= " AND cd.statut = 5";
  79  if ($filter == "expired") $sql.= " AND date_fin_validite < sysdate()";
  80  if ($search_nom)      $sql.= " AND s.nom like '%".$search_nom."%'";
  81  if ($search_contract) $sql.= " AND c.rowid = '".$search_contract."'";
  82  if ($search_service)  $sql.= " AND (p.ref like '%".$search_service."%' OR p.label like '%".$search_service."%')";
  83  if ($socid > 0)       $sql.= " AND s.idp = $socid";
  84  $sql .= " ORDER BY $sortfield $sortorder";
  85  $sql .= $db->plimit($limit + 1 ,$offset);
  86  
  87  $resql=$db->query($sql);
  88  if ($resql)
  89  {
  90      $num = $db->num_rows($resql);
  91      $i = 0;
  92  
  93      $param='';
  94      if ($search_contract) $param.='&amp;search_contract='.urlencode($search_contract);
  95      if ($search_nom)      $param.='&amp;search_nom='.urlencode($search_nom);
  96      if ($search_service)  $param.='&amp;search_service='.urlencode($search_service);
  97      if ($mode)            $param.='&amp;mode='.$mode;
  98      if ($filter)          $param.='&amp;filter='.$filter;
  99  
 100      print_barre_liste($langs->trans("ListOfServices"), $page, "services.php", $param, $sortfield, $sortorder,'',$num);
 101  
 102      print '<table class="liste" width="100%">';
 103  
 104      print '<tr class="liste_titre">';
 105      print_liste_field_titre($langs->trans("Contract"),"services.php", "c.rowid","$param","","",$sortfield);
 106      print_liste_field_titre($langs->trans("Service"),"services.php", "p.label","$param","","",$sortfield);
 107      print_liste_field_titre($langs->trans("Company"),"services.php", "s.nom","$param","","",$sortfield);
 108      // Date debut
 109      if ($mode == "0") print_liste_field_titre($langs->trans("DateStartPlannedShort"),"services.php", "cd.date_ouverture_prevue","$param",'',' align="center"',$sortfield);
 110      if ($mode == "" || $mode > 0) print_liste_field_titre($langs->trans("DateStartRealShort"),"services.php", "cd.date_ouverture","$param",'',' align="center"',$sortfield);
 111      // Date fin
 112      if ($mode == "" || $mode < 5) print_liste_field_titre($langs->trans("DateEndPlannedShort"),"services.php", "cd.date_fin_validite","$param",'',' align="center"',$sortfield);
 113      else print_liste_field_titre($langs->trans("DateEndRealShort"),"services.php", "cd.date_cloture","$param",'',' align="center"',$sortfield);
 114      print_liste_field_titre($langs->trans("Status"),"services.php", "cd.statut","$param","","",$sortfield);
 115      print "</tr>\n";
 116  
 117      print '<form method="POST" action="services.php">';
 118      print '<tr class="liste_titre">';
 119      print '<td class="liste_titre">';
 120      print '<input type="hidden" name="filter" value="'.$filter.'">';
 121      print '<input type="hidden" name="mode" value="'.$mode.'">';
 122      print '<input type="text" class="flat" size="3" name="search_contract" value="'.stripslashes($search_contract).'">';
 123      print '</td>';
 124      print '<td class="liste_titre">';
 125      print '<input type="text" class="flat" size="18" name="search_service" value="'.stripslashes($search_service).'">';
 126      print '</td>';
 127      print '<td class="liste_titre" valign="right">';
 128      print '<input type="text" class="flat" size="24" name="search_nom" value="'.stripslashes($search_nom).'">';
 129      print '</td>';
 130      print '<td class="liste_titre">&nbsp;</td>';
 131      print '<td class="liste_titre">&nbsp;</td>';
 132      print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
 133      print "</td>";
 134      print "</tr>\n";
 135      print '</form>';
 136  
 137      $now=mktime();
 138      $var=True;
 139      while ($i < min($num,$limit))
 140      {
 141          $obj = $db->fetch_object($resql);
 142          $var=!$var;
 143          print "<tr $bc[$var]>";
 144          print '<td><a href="fiche.php?id='.$obj->cid.'">'.img_object($langs->trans("ShowContract"),"contract").' '.$obj->cid.'</a></td>';
 145          print '<td><a href="../product/fiche.php?id='.$obj->pid.'">'.img_object($langs->trans("ShowService"),"service").' '.dolibarr_trunc($obj->label,20).'</a></td>';
 146          print '<td><a href="../comm/fiche.php?socid='.$obj->sidp.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($obj->nom,44).'</a></td>';
 147          // Date debut
 148          if ($mode == "0") {
 149              print '<td align="center">';
 150              print ($obj->date_ouverture_prevue?dolibarr_print_date($obj->date_ouverture_prevue):'&nbsp;');
 151              if ($obj->date_ouverture_prevue && ($obj->date_ouverture_prevue < (time() - $conf->contrat->services->inactifs->warning_delay)))
 152              print img_picto($langs->trans("Late"),"warning");
 153              else print '&nbsp;&nbsp;&nbsp;&nbsp;';
 154              print '</td>';
 155          }
 156          if ($mode == "" || $mode > 0) print '<td align="center">'.($obj->date_ouverture?dolibarr_print_date($obj->date_ouverture):'&nbsp;').'</td>';
 157          // Date fin
 158          if ($mode == "" || $mode < 5) print '<td align="center">'.($obj->date_fin_validite?dolibarr_print_date($obj->date_fin_validite):'&nbsp;');
 159          else print '<td align="center">'.dolibarr_print_date($obj->date_cloture);
 160          // Icone warning
 161          if ($obj->date_fin_validite && $obj->date_fin_validite < (time() - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5) print img_warning($langs->trans("Late"));
 162          else print '&nbsp;&nbsp;&nbsp;&nbsp;';
 163          print '</td>';
 164          print '<td align="center"><a href="'.DOL_URL_ROOT.'/contrat/ligne.php?id='.$obj->cid.'&ligne='.$obj->rowid.'"><img src="./statut'.$obj->statut.'.png" border="0" alt="statut"></a></td>';
 165          print "</tr>\n";
 166          $i++;
 167      }
 168      $db->free($resql);
 169  
 170      print "</table>";
 171  
 172  }
 173  else
 174  {
 175      dolibarr_print_error($db);
 176  }
 177  
 178  
 179  $db->close();
 180  
 181  llxFooter('$Date: 2005/11/14 20:13:25 $ - $Revision: 1.9 $');
 182  ?>


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