[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> 4 * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 * 20 * $Id: liste.php,v 1.19 2005/09/15 00:37:03 marc_ocebo Exp $ 21 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/commande/liste.php,v $ 22 */ 23 24 /** 25 \file htdocs/commande/liste.php 26 \ingroup commande 27 \brief Page liste des commandes 28 \version $Revision: 1.19 $ 29 */ 30 31 32 require ('./pre.inc.php'); 33 34 $langs->load('orders'); 35 36 if (!$user->rights->commande->lire) 37 accessforbidden(); 38 39 $sref=isset($_GET['sref'])?$_GET['sref']:$_POST['sref']; 40 $sref_client=isset($_GET['sref_client'])?$_GET['sref_client']:(isset($_POST['sref_client'])?$_POST['sref_client']:''); 41 $snom=isset($_GET['snom'])?$_GET['snom']:$_POST['snom']; 42 $sall=isset($_GET['sall'])?$_GET['sall']:$_POST['sall']; 43 44 // Sécurité accés client 45 $socidp = $_GET['socidp']; 46 if ($user->societe_id > 0) 47 { 48 $action = ''; 49 $socidp = $user->societe_id; 50 } 51 52 53 llxHeader(); 54 55 $begin=$_GET['begin']; 56 $sortorder=$_GET['sortorder']; 57 $sortfield=$_GET['sortfield']; 58 59 if (! $sortfield) $sortfield='c.rowid'; 60 if (! $sortorder) $sortorder='DESC'; 61 62 $limit = $conf->liste_limit; 63 $offset = $limit * $_GET['page'] ; 64 65 $sql = 'SELECT s.nom, s.idp, c.rowid, c.ref, c.total_ht,'.$db->pdate('c.date_commande').' as date_commande, c.fk_statut' ; 66 $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'commande as c'; 67 $sql.= ' WHERE c.fk_soc = s.idp'; 68 if ($sref) 69 { 70 $sql .= " AND c.ref like '%".$sref."%'"; 71 } 72 if ($sall) 73 { 74 $sql .= " AND (c.ref like '%".$sall."%' OR c.note like '%".$sall."%')"; 75 } 76 if ($socidp) 77 { 78 $sql .= ' AND s.idp = '.$socidp; 79 } 80 if ($_GET['month'] > 0) 81 { 82 $sql .= " AND date_format(c.date_commande, '%Y-%m') = '$year-$month'"; 83 } 84 if ($_GET['year'] > 0) 85 { 86 $sql .= " AND date_format(c.date_commande, '%Y') = $year"; 87 } 88 if (isset($_GET['status'])) 89 { 90 $sql .= " AND fk_statut = ".$_GET['status']; 91 } 92 if (isset($_GET['afacturer'])) 93 { 94 $sql .= ' AND c.facture = 0'; 95 } 96 if (strlen($_POST['sf_ref']) > 0) 97 { 98 $sql .= " AND c.ref like '%".$_POST['sf_ref'] . "%'"; 99 } 100 if (!empty($snom)) 101 { 102 $sql .= ' AND s.nom like \'%'.$snom.'%\''; 103 } 104 if (!empty($sref_client)) 105 { 106 $sql .= ' AND c.ref_client like \'%'.$sref_client.'%\''; 107 } 108 109 $sql .= ' ORDER BY '.$sortfield.' '.$sortorder; 110 $sql .= $db->plimit($limit + 1,$offset); 111 112 $resql = $db->query($sql); 113 114 if ($resql) 115 { 116 if ($socidp) 117 { 118 $soc = new Societe($db); 119 $soc->fetch($socidp); 120 $title = $langs->trans('ListOfOrders') . ' - '.$soc->nom; 121 } 122 else 123 { 124 $title = $langs->trans('ListOfOrders'); 125 } 126 if ($_GET['status'] == 3) 127 $title.=' - '.$langs->trans('StatusOrderToBill'); 128 $num = $db->num_rows($resql); 129 print_barre_liste($title, $_GET['page'], 'liste.php','&socidp='.$socidp,$sortfield,$sortorder,'',$num); 130 $i = 0; 131 print '<table class="noborder" width="100%">'; 132 print '<tr class="liste_titre">'; 133 print_liste_field_titre($langs->trans('Ref'),'liste.php','c.ref','','&socidp='.$socidp,'width="25%"',$sortfield); 134 print_liste_field_titre($langs->trans('Company'),'liste.php','s.nom','','&socidp='.$socidp,'width="30%"',$sortfield); 135 print_liste_field_titre($langs->trans('RefCdeClient'),'liste.php','c.ref_client','','&socidp='.$socidp,'width="15%"',$sortfield); 136 print_liste_field_titre($langs->trans('Date'),'liste.php','c.date_commande','','&socidp='.$socidp, 'width="20%" align="right" colspan="2"',$sortfield); 137 print_liste_field_titre($langs->trans('Status'),'liste.php','c.fk_statut','','&socidp='.$socidp,'width="10%" align="center"',$sortfield); 138 print '</tr>'; 139 // Lignes des champs de filtre 140 print '<form method="get" action="liste.php">'; 141 print '<tr class="liste_titre">'; 142 print '<td class="liste_titre" valign="right">'; 143 print '<input class="flat" size="10" type="text" name="sref" value="'.$sref.'">'; 144 print '</td><td class="liste_titre" align="left">'; 145 print '<input class="flat" type="text" name="snom" value="'.$snom.'">'; 146 print '</td><td class="liste_titre" align="left">'; 147 print '<input class="flat" type="text" size="10" name="sref_client" value="'.$sref_client.'">'; 148 print '</td><td class="liste_titre"> '; 149 print '</td><td class="liste_titre"> '; 150 print '</td><td align="right" class="liste_titre">'; 151 print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans('Search').'">'; 152 print '</td></tr>'; 153 print '</form>'; 154 $var=True; 155 $generic_commande = new Commande($db); 156 while ($i < min($num,$limit)) 157 { 158 $objp = $db->fetch_object($resql); 159 $var=!$var; 160 print '<tr '.$bc[$var].'>'; 161 print '<td><a href="fiche.php?id='.$objp->rowid.'">'.img_object($langs->trans('ShowOrder'),'order').' '.$objp->ref.'</a></td>'; 162 print '<td><a href="../comm/fiche.php?socid='.$objp->idp.'">'.img_object($langs->trans('ShowCompany'),'company').' '.$objp->nom.'</a></td>'; 163 print '<td>'.$objp->ref_client.'</td>'; 164 $now = time(); 165 $lim = 3600 * 24 * 15 ; 166 if ( ($now - $objp->date_commande) > $lim && $objp->statutid == 1 ) 167 { 168 print '<td><b> > 15 jours</b></td>'; 169 } 170 else 171 { 172 print '<td> </td>'; 173 } 174 print '<td align="right">'; 175 $y = strftime('%Y',$objp->date_commande); 176 $m = strftime('%m',$objp->date_commande); 177 print strftime('%d',$objp->date_commande); 178 print ' <a href="liste.php?year='.$y.'&month='.$m.'">'; 179 print strftime('%B',$objp->date_commande).'</a>'; 180 print ' <a href="liste.php?year='.$y.'">'; 181 print strftime('%Y',$objp->date_commande).'</a></td>'; 182 print '<td align="center">'.$generic_commande->status_label_short[$objp->fk_statut].'</td>'; 183 print '</tr>'; 184 $total = $total + $objp->price; 185 $subtotal = $subtotal + $objp->price; 186 $i++; 187 } 188 print '</table>'; 189 $db->free($resql); 190 } 191 else 192 { 193 print dolibarr_print_error($db); 194 } 195 196 $db->close(); 197 198 llxFooter('$Date: 2005/09/15 00:37:03 $ - $Revision: 1.19 $'); 199 ?>
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 |
![]() |