| [ 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 * 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.2 2005/04/11 16:01:44 rodolphe Exp $ 20 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/fourn/product/index.php,v $ 21 * 22 */ 23 24 /*! 25 \file htdocs/product/index.php 26 \ingroup product 27 \brief Page accueil des produits et services 28 \version $Revision: 1.2 $ 29 */ 30 31 require ("./pre.inc.php"); 32 33 if (!$user->rights->produit->lire) accessforbidden(); 34 35 /* 36 * Affichage page accueil 37 * 38 */ 39 40 llxHeader("","",$langs->trans("ProductsAndServices")); 41 42 print_titre($langs->trans("ProductsAndServicesArea")); 43 44 print '<table border="0" width="100%">'; 45 46 print '<tr><td valign="top" width="30%">'; 47 48 /* 49 * Zone recherche produit/service 50 */ 51 print '<form method="post" action="liste.php">'; 52 print '<table class="noborder" width="100%">'; 53 print "<tr class=\"liste_titre\">\n"; 54 print '<td colspan="3">'.$langs->trans("Search").'</td></tr>'; 55 print "<tr $bc[0]><td>"; 56 print $langs->trans("Ref").' :</td><td><input class="flat" type="text" size="20" name="sf_ref"></td><td><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>'; 57 print "<tr $bc[0]><td>"; 58 print $langs->trans("Label").' :</td><td><input class="flat" type="text" size="20" name="snom"></td><td><input class="button" type="submit" value="'.$langs->trans("Search").'"></td></tr>'; 59 print "</table></form><br>\n"; 60 61 /* 62 * Nombre de produits et/ou services 63 */ 64 $prodser = array(); 65 $sql = "SELECT count(*), fk_product_type FROM ".MAIN_DB_PREFIX."product as p GROUP BY fk_product_type"; 66 if ($db->query($sql)) 67 { 68 $num = $db->num_rows(); 69 $i = 0; 70 while ($i < $num) 71 { 72 $row = $db->fetch_row($i); 73 $prodser[$row[1]] = $row[0]; 74 $i++; 75 } 76 $db->free(); 77 } 78 79 print '<table class="noborder" width="100%">'; 80 print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").'</td></tr>'; 81 if ($conf->produit->enabled) 82 { 83 print "<tr $bc[0]>"; 84 print '<td><a href="liste.php?type=0">'.$langs->trans("Products").'</a></td><td>'.round($prodser[0]).'</td>'; 85 print "</tr>"; 86 } 87 if ($conf->service->enabled) 88 { 89 print "<tr $bc[1]>"; 90 print '<td><a href="liste.php?type=1">'.$langs->trans("Services").'</a></td><td>'.round($prodser[1]).'</td>'; 91 print "</tr>"; 92 } 93 print '</table>'; 94 95 print '</td><td valign="top" width="70%">'; 96 97 98 /* 99 * Derniers produits/services en vente 100 */ 101 $sql = "SELECT p.rowid, p.label, p.price, p.ref, p.fk_product_type"; 102 $sql .= " FROM ".MAIN_DB_PREFIX."product as p "; 103 $sql .= " WHERE p.fk_product_type=0"; 104 $sql .= " ORDER BY p.datec DESC "; 105 $sql .= $db->plimit(15 ,0); 106 107 $resql = $db->query($sql) ; 108 109 if ($resql) 110 { 111 $num = $db->num_rows($resql); 112 113 $i = 0; 114 115 $typeprodser[0]=$langs->trans("Product"); 116 $typeprodser[1]=$langs->trans("Service"); 117 118 if ($num > 0) 119 { 120 print '<table class="noborder" width="100%">'; 121 122 print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("LastProducts").'</td></tr>'; 123 124 $var=True; 125 while ($i < $num) 126 { 127 $objp = $db->fetch_object($resql); 128 $var=!$var; 129 print "<tr $bc[$var]>"; 130 print "<td><a href=\"fiche.php?id=$objp->rowid\">"; 131 if ($objp->fk_product_type) print img_object($langs->trans("ShowService"),"service"); 132 else print img_object($langs->trans("ShowProduct"),"product"); 133 print "</a> <a href=\"fiche.php?id=$objp->rowid\">$objp->ref</a></td>\n"; 134 print "<td>$objp->label</td>"; 135 print "<td>".$typeprodser[$objp->fk_product_type]."</td>"; 136 print "</tr>\n"; 137 $i++; 138 } 139 $db->free($resql); 140 141 print "</table>"; 142 } 143 } 144 else 145 { 146 dolibarr_print_error(); 147 } 148 149 print '</td></tr></table>'; 150 151 $db->close(); 152 153 llxFooter("<em>Dernière modification $Date: 2005/04/11 16:01:44 $ révision $Revision: 1.2 $</em>"); 154 ?>
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 |
|