New: Add filters on stock movement
This commit is contained in:
parent
41b81f6a3a
commit
d7e460c18a
@ -193,8 +193,9 @@ if ($resql)
|
||||
print_liste_field_titre($langs->trans("Label"),"reassort.php", "p.label","&envente=$envente&".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","","",$sortfield,$sortorder);
|
||||
//print_liste_field_titre($langs->trans("TheoreticalStock"),"reassort.php", "stock_theorique","&envente=$envente&".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","",'align="right"',$sortfield,$sortorder);
|
||||
if ($conf->service->enabled && $type == 1) print_liste_field_titre($langs->trans("Duration"),"reassort.php", "p.duration","&envente=$envente&".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PhysicalStock"),"reassort.php", "stock_physique","&envente=$envente&".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("MininumStock"),"reassort.php", "p.seuil_stock_alerte","&envente=$envente&".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PhysicalStock"),"reassort.php", "stock_physique","&envente=$envente&".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","",'align="right"',$sortfield,$sortorder);
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print_liste_field_titre($langs->trans("Status"),"reassort.php", "p.envente","&envente=$envente&".(isset($type)?"&type=$type":"")."&fourn_id=$fourn_id&snom=$snom&sref=$sref","",'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
@ -212,9 +213,9 @@ if ($resql)
|
||||
print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
print '<td class="liste_titre" colspan="2">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png" alt="'.$langs->trans("RemoveFilter").'">';
|
||||
@ -264,8 +265,9 @@ if ($resql)
|
||||
print '</td>';
|
||||
}
|
||||
//print '<td align="right">'.$objp->stock_theorique.'</td>';
|
||||
print '<td align="right">'.$objp->stock_physique.'</td>';
|
||||
print '<td align="right">'.$objp->seuil_stock_alerte.'</td>';
|
||||
print '<td align="right">'.$objp->stock_physique.'</td>';
|
||||
print '<td align="right"><a href="'.DOL_URL_ROOT.'/product/stock/mouvement.php?idproduct='.$product_static->id.'">'.$langs->trans("Movements").'</a></td>';
|
||||
print '<td align="right" nowrap="nowrap">'.$product_static->LibStatut($objp->statut,5).'</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/product.class.php");
|
||||
|
||||
$langs->load("products");
|
||||
|
||||
@ -34,6 +35,9 @@ if (!$user->rights->produit->lire) accessforbidden();
|
||||
$page = $_GET["page"];
|
||||
$sortfield = $_GET["sortfield"];
|
||||
$sortorder = $_GET["sortorder"];
|
||||
$idproduct = isset($_GET["idproduct"])?$_GET["idproduct"]:$_PRODUCT["idproduct"];
|
||||
$year = isset($_GET["year"])?$_GET["year"]:$_POST["year"];
|
||||
$month = isset($_GET["month"])?$_GET["month"]:$_POST["month"];
|
||||
if ($page < 0) $page = 0;
|
||||
$offset = $conf->liste_limit * $page;
|
||||
|
||||
@ -67,6 +71,22 @@ if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
||||
{
|
||||
$sql.= " AND IFNULL(c.visible,1)=1";
|
||||
}
|
||||
if ($month > 0)
|
||||
{
|
||||
if ($year > 0)
|
||||
$sql.= " AND date_format(m.datem, '%Y-%m') = '$year-$month'";
|
||||
else
|
||||
$sql.= " AND date_format(m.datem, '%m') = '$month'";
|
||||
}
|
||||
if ($year > 0) $sql .= " AND date_format(m.datem, '%Y') = $year";
|
||||
if (! empty($_GET['search_product']))
|
||||
{
|
||||
$sql.= " AND p.label LIKE '%".addslashes($_GET['search_product'])."%'";
|
||||
}
|
||||
if (! empty($_GET['idproduct']))
|
||||
{
|
||||
$sql.= " AND p.rowid = '".$_GET['idproduct']."'";
|
||||
}
|
||||
$sql.= " ORDER BY $sortfield $sortorder ";
|
||||
$sql.= $db->plimit($conf->liste_limit + 1 ,$offset);
|
||||
|
||||
@ -76,6 +96,12 @@ if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
if ($idproduct)
|
||||
{
|
||||
$product = new Product($db);
|
||||
$product->fetch($idproduct);
|
||||
}
|
||||
|
||||
if ($_GET["id"])
|
||||
{
|
||||
$entrepot = new Entrepot($db);
|
||||
@ -159,6 +185,28 @@ if ($resql)
|
||||
print_liste_field_titre($langs->trans("Units"),"mouvement.php", "m.value","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
// Lignes des champs de filtre
|
||||
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td valign="right">';
|
||||
print $langs->trans('Month').': <input class="flat" type="text" size="2" maxlength="2" name="month" value="'.$month.'">';
|
||||
print ' '.$langs->trans('Year').': ';
|
||||
$max_year = date("Y");
|
||||
$syear = $year;
|
||||
$form->select_year($syear,'year',1, '', $max_year);
|
||||
print '</td>';
|
||||
print '<td align="left">';
|
||||
print '<input class="flat" type="text" size="20" name="search_product" value="'.($idproduct?$product->libelle:$_GET['search_product']).'">';
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
print '<td align="right"><input class="liste_titre" type="image" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
print '</form>';
|
||||
|
||||
$var=True;
|
||||
while ($i < min($num,$conf->liste_limit))
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user