From 218dc16ed1d4bcff28ed2e967113628644af00d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Aug 2010 21:12:56 +0000 Subject: [PATCH] Add status (tosell/tobuy) on stock list --- htdocs/product/index.php | 13 ++++++++----- htdocs/product/liste.php | 27 +++++++++++++++++++-------- htdocs/product/reassort.php | 4 ++-- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 11c1e28e423..699bba7e198 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -105,10 +105,10 @@ print "
"; $prodser = array(); $prodser[0][0]=$prodser[0][1]=$prodser[1][0]=$prodser[1][1]=0; -$sql = "SELECT COUNT(p.rowid) as total, p.fk_product_type, p.tosell"; +$sql = "SELECT COUNT(p.rowid) as total, p.fk_product_type, p.tosell, p.tobuy"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= " WHERE p.entity = ".$conf->entity; -$sql.= " GROUP BY p.fk_product_type, p.tosell"; +$sql.= " GROUP BY p.fk_product_type, p.tosell, p.tobuy"; $result = $db->query($sql); while ($objp = $db->fetch_object($result)) { @@ -162,7 +162,7 @@ print ''; * Derniers produits/services en vente */ $max=15; -$sql = "SELECT p.rowid, p.label, p.price, p.ref, p.fk_product_type, p.tosell,"; +$sql = "SELECT p.rowid, p.label, p.price, p.ref, p.fk_product_type, p.tosell, p.tobuy,"; $sql.= " p.tms as datem"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= " WHERE p.entity = ".$conf->entity; @@ -192,7 +192,7 @@ if ($result) print ''; - print ''; + print ''; $var=True; @@ -229,8 +229,11 @@ if ($result) print dol_print_date($db->jdate($objp->datem),'day'); print ""; print '"; + print '"; print "\n"; $i++; } diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index 2b96e5aa62c..8563cba1686 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -123,7 +123,7 @@ else $sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,'; $sql.= ' p.fk_product_type, p.tms as datem,'; -$sql.= ' p.duration, p.tosell as statut, p.seuil_stock_alerte'; +$sql.= ' p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte'; $sql.= ' FROM '.MAIN_DB_PREFIX.'product as p'; // We'll need this table joined to the select in order to filter by categ if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_product as cp"; @@ -194,6 +194,10 @@ if ($resql) { $tosell = (isset($_GET["tosell"])?$_GET["tosell"]:$_POST["tosell"]); } + if (isset($_GET["tobuy"]) || isset($_POST["tobuy"])) + { + $tosell = (isset($_GET["tobuy"])?$_GET["tobuy"]:$_POST["tobuy"]); + } $helpurl=''; if (isset($_GET["type"]) && $_GET["type"] == 0) @@ -213,7 +217,7 @@ if ($resql) print '
'.$langs->trans("ProductDeleted",$_GET['delprod']).'

'; } - $param="&sref=".$sref.($sbarcode?"&sbarcode=".$sbarcode:"")."&snom=".$snom."&sall=".$sall."&tosell=".$tosell; + $param="&sref=".$sref.($sbarcode?"&sbarcode=".$sbarcode:"")."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy; $param.=($fourn_id?"&fourn_id=".$fourn_id:""); $param.=isset($type)?"&type=".$type:""; print_barre_liste($texte, $page, "liste.php", $param, $sortfield, $sortorder,'',$num); @@ -309,7 +313,8 @@ if ($resql) if ($conf->service->enabled && $type != 0) print_liste_field_titre($langs->trans("Duration"),"liste.php", "p.duration",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("SellingPrice"),"liste.php", "p.price",$param,"",'align="right"',$sortfield,$sortorder); if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1) print ''; - print_liste_field_titre($langs->trans("Status"),"liste.php", "p.tosell",$param,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Sell"),"liste.php", "p.tosell",$param,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Buy"),"liste.php", "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder); print "\n"; // Lignes des champs de filtre @@ -344,6 +349,9 @@ if ($resql) print ' '; print ''; } + print ''; print ''; + // Status (to buy) + print ''; - print "\n"; + // Status (to sell) + print ''; + + print "\n"; $i++; } @@ -449,11 +460,11 @@ if ($resql) { if ($sref || $snom || $sall || $sbarcode || $_POST["search"]) { - print_barre_liste('', $page, "liste.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell, $sortfield, $sortorder,'',$num); + print_barre_liste('', $page, "liste.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num); } else { - print_barre_liste('', $page, "liste.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":"")."&tosell=".$tosell, $sortfield, $sortorder,'',$num); + print_barre_liste('', $page, "liste.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":"")."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num); } } diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 4a318c122e7..0adc5d89358 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -332,11 +332,11 @@ if ($resql) { if ($sref || $snom || $sall || $_POST["search"]) { - print_barre_liste('', $page, "reassort.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$_POST["tosell"]."&tobuy=".$_POST["tobuy"], $sortfield, $sortorder,'',$num, 0, ''); + print_barre_liste('', $page, "reassort.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num, 0, ''); } else { - print_barre_liste('', $page, "reassort.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":""), $sortfield, $sortorder,'',$num, 0, ''); + print_barre_liste('', $page, "reassort.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":"")."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num, 0, ''); } }
'.$transRecordedType.'
'.$transRecordedType.'
'; - print $product_static->LibStatut($objp->tosell,5); + print $product_static->LibStatut($objp->tosell,5,0); print "'; + print $product_static->LibStatut($objp->tobuy,5,1); + print "
'.$langs->trans("Stock").'
'; + print ' '; + print ''; print ''; print ''; @@ -438,10 +446,13 @@ if ($resql) } } - // Statut - print ''.$product_static->LibStatut($objp->statut,5).''.$product_static->LibStatut($objp->tosell,5,0).'
'.$product_static->LibStatut($objp->tobuy,5,1).'