[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?PHP 2 /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 * 18 * $Id: liste.php,v 1.10 2005/09/07 07:42:23 rodolphe Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/contrat/liste.php,v $ 20 * 21 */ 22 require ("./pre.inc.php"); 23 24 $page = $_GET["page"]; 25 $sortorder = $_GET["sortorder"]; 26 $sortfield = $_GET["sortfield"]; 27 28 llxHeader('','Telephonie - Contrats - Liste'); 29 30 /* 31 * 32 * 33 */ 34 35 if ($page == -1) { $page = 0 ; } 36 if ($sortorder == "") $sortorder="ASC"; 37 if ($sortfield == "") $sortfield="c.statut"; 38 39 $offset = $conf->liste_limit * $page ; 40 $pageprev = $page - 1; 41 $pagenext = $page + 1; 42 43 /* 44 * Mode Liste 45 * 46 * 47 * 48 */ 49 $sql = "SELECT c.rowid, c.ref, s.idp as socidp, c.statut, s.nom "; 50 $sql .= ", sf.idp as sfidp, sf.nom as sfnom"; 51 $sql .= ", sa.idp as saidp, sa.nom as sanom"; 52 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; 53 $sql .= " , ".MAIN_DB_PREFIX."societe as sf"; 54 $sql .= " , ".MAIN_DB_PREFIX."societe as sa"; 55 $sql .= " , ".MAIN_DB_PREFIX."societe_perms as sp"; 56 $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; 57 58 $sql .= " WHERE c.fk_client_comm = s.idp"; 59 $sql .= " AND c.fk_soc = sa.idp"; 60 $sql .= " AND c.fk_soc_facture = sf.idp"; 61 62 $sql .= " AND c.fk_client_comm = sp.fk_soc"; 63 $sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1"; 64 65 if ($_GET["search_contrat"]) 66 { 67 $sel = urldecode($_GET["search_contrat"]); 68 $sql .= " AND c.ref LIKE '%".$sel."%'"; 69 } 70 71 if ($_GET["search_client"]) 72 { 73 $sel = urldecode($_GET["search_client"]); 74 $sql .= " AND s.nom LIKE '%".$sel."%'"; 75 } 76 77 if ($_GET["search_client_facture"]) 78 { 79 $sel =urldecode($_GET["search_client_facture"]); 80 $sql .= " AND sf.nom LIKE '%".$sel."%'"; 81 } 82 83 if (strlen($_GET["statut"])) 84 { 85 $sql .= " AND c.statut = ".$_GET["statut"]; 86 } 87 88 $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); 89 90 $result = $db->query($sql); 91 if ($result) 92 { 93 $num = $db->num_rows(); 94 $i = 0; 95 96 $urladd= "&statut=".$_GET["statut"]; 97 98 print_barre_liste("Contrats", $page, "liste.php", $urladd, $sortfield, $sortorder, '', $num); 99 print"\n<!-- debut table -->\n"; 100 print '<form action="liste.php" method="GET">'."\n"; 101 print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; 102 print '<tr class="liste_titre">'; 103 104 print_liste_field_titre("Ref","liste.php","c.ref"); 105 print_liste_field_titre("Client","liste.php","s.nom"); 106 print_liste_field_titre("Client (Agence/Filiale)","liste.php","sa.nom"); 107 108 print '<td>Client facturé</td>'; 109 print '<td align="center">-</td>'; 110 111 print "</tr>\n"; 112 113 print '<tr class="liste_titre">'; 114 print '<td><input type="text" name="search_contrat" value="'. $_GET["search_contrat"].'" size="10"></td>'; 115 print '<td><input type="text" name="search_client" value="'. $_GET["search_client"].'" size="10"></td>'; 116 print '<td><input type="text" name="search_client_agence" value="'. $_GET["search_client_agence"].'" size="10"></td>'; 117 print '<td><input type="text" name="search_client_facture" value="'. $_GET["search_client_facture"].'" size="10"></td>'; 118 119 120 print '<td><input type="submit" class="button" value="'.$langs->trans("Search").'""></td>'; 121 print '</tr>'; 122 123 $var=True; 124 125 while ($i < min($num,$conf->liste_limit)) 126 { 127 $obj = $db->fetch_object(); 128 $var=!$var; 129 130 print "<tr $bc[$var]><td>"; 131 print '<img src="statut'.$obj->statut.'.png"> '; 132 print '<a href="'.DOL_URL_ROOT.'/telephonie/contrat/fiche.php?id='.$obj->rowid.'">'; 133 print img_file(); 134 print '</a> '; 135 136 print '<a href="fiche.php?id='.$obj->rowid.'">'.$obj->ref."</a></td>\n"; 137 138 print '<td><a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->socidp.'">'.stripslashes($obj->nom).'</a></td>'; 139 140 print '<td><a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->socidp.'">'.stripslashes($obj->sanom).'</a></td>'; 141 print '<td><a href="'.DOL_URL_ROOT.'/soc.php?socid='.$obj->sfidp.'">'.stripslashes($obj->sfnom).'</a></td>'; 142 143 print '<td align="center">-</td>'; 144 print "</tr>\n"; 145 $i++; 146 } 147 print "</table>"; 148 print '</form>'; 149 $db->free(); 150 } 151 else 152 { 153 print $db->error() . ' ' . $sql; 154 } 155 156 $db->close(); 157 158 llxFooter("<em>Dernière modification $Date: 2005/09/07 07:42:23 $ révision $Revision: 1.10 $</em>"); 159 ?>
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 |
![]() |