From 9e5197a2ff142fd2f18dadbfbf1f71de4691ab27 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 8 May 2004 14:31:02 +0000 Subject: [PATCH] New: Affiche nombre des produits/services en vente en plus de hors vente. Affiche le type du produit (produit ou service) dnas liste derniers produits/services. --- htdocs/product/index.php | 56 ++++++++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 336f04654c6..26970f00cbc 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -1,5 +1,6 @@ + * Copyright (C) 20004 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -40,45 +41,57 @@ llxHeader("","","Accueil Produits et services"); print_titre("Produits et services"); -print ''; +print '
'; print '
'; + /* - * Produits en ventes et hors vente + * Nombre de produits et/ou services */ -$sql = "SELECT count(*), fk_product_type FROM ".MAIN_DB_PREFIX."product as p WHERE envente = 0 GROUP BY fk_product_type"; +$prodser = array(); +$sql = "SELECT count(*), fk_product_type, envente FROM ".MAIN_DB_PREFIX."product as p GROUP BY fk_product_type"; if ($db->query($sql)) { $num = $db->num_rows(); $i = 0; - $phv[0] = 0; - $phv[1] = 0; while ($i < $num) { $row = $db->fetch_row($i); - $phv[$row[1]] = $row[0]; + $prodser[$row[1]][$row[2]] = $row[0]; $i++; } $db->free(); } - print ''; -print ''; -print ""; -print ''; +print ''; +if (defined("MAIN_MODULE_PRODUIT") && MAIN_MODULE_PRODUIT) +{ + print ""; + print ''; + print ""; + print ""; + print ''; + print ""; +} if (defined("MAIN_MODULE_SERVICE") && MAIN_MODULE_SERVICE) { - print ""; - print ''; + print ""; + print ''; + print ""; + print ""; + print ''; + print ""; } print '
Hors vente
Produits hors vente'.$phv[0].'
Nombre
Produits hors vente'.round($prodser[0][0]).'
Produits en vente'.round($prodser[0][1]).'
Services hors vente'.$phv[1].'
Services hors vente'.round($prodser[1][0]).'
Services en vente'.round($prodser[1][1]).'
'; + print '
'; + /* - * Derniers produits + * Derniers produits/services en vente */ -$sql = "SELECT p.rowid, p.label, p.price, p.ref FROM ".MAIN_DB_PREFIX."product as p WHERE envente=1"; +$sql = "SELECT p.rowid, p.label, p.price, p.ref, p.fk_product_type FROM ".MAIN_DB_PREFIX."product as p WHERE envente=1"; $sql .= " ORDER BY p.datec DESC "; $sql .= $db->plimit(15 ,0); $result = $db->query($sql) ; @@ -88,12 +101,15 @@ if ($result) $num = $db->num_rows(); $i = 0; - + + $typeprodser[0]="Produit"; + $typeprodser[1]="Service"; + if ($num > 0) { - print ''; + print '
'; - print ''; + print ''; $var=True; while ($i < $num) @@ -103,8 +119,10 @@ if ($result) print ""; print "\n"; - print "\n"; + print "rowid\">$objp->ref\n"; + print ""; + print ""; + print "\n"; $i++; } $db->free();
Derniers produits et services
Derniers produits/services en vente enregistrés
rowid\">"; print img_file(); - print " rowid\">$objp->ref$objp->label
$objp->label".$typeprodser[$objp->fk_product_type]."