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