[ Index ] |
|
Code source de Dolibarr 2.0.1 |
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: enservice.php,v 1.17 2005/07/03 13:07:59 eldy Exp $ 20 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/contrat/enservice.php,v $ 21 * 22 */ 23 24 /** 25 \file htdocs/contrat/enservice.php 26 \ingroup contrat 27 \brief Page liste des contrats en service 28 \version $Revision: 1.17 $ 29 */ 30 31 require ("./pre.inc.php"); 32 33 $langs->load("products"); 34 $langs->load("companies"); 35 36 llxHeader(); 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 41 $statut=isset($_GET["statut"])?$_GET["statut"]:1; 42 $socid=$_GET["socid"]; 43 44 45 /* 46 * Sécurité accés client 47 */ 48 if ($user->societe_id > 0) 49 { 50 $action = ''; 51 $socid = $user->societe_id; 52 } 53 54 55 if ($page == -1) { $page = 0 ; } 56 57 $limit = $conf->liste_limit; 58 $offset = $limit * $page ; 59 60 if (! $sortfield) $sortfield="cd.date_ouverture"; 61 if (! $sortorder) $sortorder="DESC"; 62 63 64 $sql = "SELECT s.nom, c.rowid as cid, s.idp as sidp, cd.rowid, cd.label, cd.statut, p.rowid as pid,"; 65 $sql .= " ".$db->pdate("cd.date_ouverture")." as date_ouverture,"; 66 $sql .= " ".$db->pdate("cd.date_fin_validite")." as date_fin_validite"; 67 $sql .= " FROM ".MAIN_DB_PREFIX."contrat as c"; 68 $sql .= " , ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."product as p"; 69 $sql .= " , ".MAIN_DB_PREFIX."contratdet as cd"; 70 $sql .= " WHERE c.fk_soc = s.idp AND cd.fk_product = p.rowid AND cd.statut = 4"; 71 $sql .= " AND cd.fk_contrat = c.rowid"; 72 if ($socid > 0) 73 { 74 $sql .= " AND s.idp = $socid"; 75 } 76 $sql .= " ORDER BY $sortfield $sortorder"; 77 $sql .= $db->plimit($limit + 1 ,$offset); 78 79 $resql=$db->query($sql); 80 if ($resql) 81 { 82 $num = $db->num_rows($resql); 83 $i = 0; 84 85 print_barre_liste($langs->trans("ListOfRunningServices"), $page, "enservice.php", "&sref=$sref&snom=$snom", $sortfield, $sortorder,'',$num); 86 87 print '<table class="noborder" width="100%">'; 88 89 print '<tr class="liste_titre">'; 90 print_liste_field_titre($langs->trans("Contract"),"enservice.php", "c.rowid","","","",$sortfield); 91 print_liste_field_titre($langs->trans("Service"),"enservice.php", "p.label","","","",$sortfield); 92 print_liste_field_titre($langs->trans("Company"),"enservice.php", "s.nom","","","",$sortfield); 93 print_liste_field_titre($langs->trans("DateStartRealShort"),"enservice.php", "cd.date_ouverture",'','',' align="center"',$sortfield); 94 print_liste_field_titre($langs->trans("DateEndPlannedShort"),"enservice.php", "cd.date_fin_validite",'','',' align="center"',$sortfield); 95 print_liste_field_titre($langs->trans("Status"),"enservice.php", "cd.statut","","","",$sortfield); 96 print "</tr>\n"; 97 98 $now=mktime(); 99 $var=True; 100 while ($i < min($num,$limit)) 101 { 102 $obj = $db->fetch_object($resql); 103 $var=!$var; 104 print "<tr $bc[$var]>"; 105 print '<td><a href="fiche.php?id='.$obj->cid.'">'.img_object($langs->trans("ShowContract"),"contract").' '.$obj->cid.'</a></td>'; 106 print '<td><a href="../product/fiche.php?id='.$obj->pid.'">'.img_object($langs->trans("ShowService"),"service").' '.dolibarr_trunc($obj->label,20).'</a></td>'; 107 print '<td><a href="../comm/fiche.php?socid='.$obj->sidp.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($obj->nom,44).'</a></td>'; 108 print '<td align="center">'.dolibarr_print_date($obj->date_ouverture).'</td>'; 109 print '<td align="center">'.($obj->date_fin_validite?dolibarr_print_date($obj->date_fin_validite):' '); 110 if ($obj->date_fin_validite < mktime()) print img_warning($langs->trans("Late")); 111 else print ' '; 112 print '</td>'; 113 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>'; 114 print "</tr>\n"; 115 $i++; 116 } 117 $db->free($resql); 118 119 print "</table>"; 120 121 } 122 else 123 { 124 dolibarr_print_error($db); 125 } 126 127 128 $db->close(); 129 130 llxFooter('$Date: 2005/07/03 13:07:59 $ - $Revision: 1.17 $'); 131 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 12:29:37 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |