filter on stock alert

This commit is contained in:
Cédric Salvador 2013-09-04 11:43:47 +02:00
parent bbae47c48f
commit 6015a36183
3 changed files with 9 additions and 2 deletions

View File

@ -95,3 +95,4 @@ ReplenishmentOrders=Replenishment orders
UseVirtualStock=Use virtual stock instead of physical stock UseVirtualStock=Use virtual stock instead of physical stock
RuleForStockReplenishment=Rule for stocks replenishment RuleForStockReplenishment=Rule for stocks replenishment
SelectProduct=Select at least one product SelectProduct=Select at least one product
AlertOnly= Alerts only

View File

@ -95,3 +95,4 @@ ReplenishmentOrders=Commandes de réapprovisionnement
UseVirtualStock=Utiliser le stock théorique à la place du stock physique UseVirtualStock=Utiliser le stock théorique à la place du stock physique
RuleForStockReplenishment=Règle de gestion du réapprovisionnement des stocks RuleForStockReplenishment=Règle de gestion du réapprovisionnement des stocks
SelectProduct=Sélectionnez au moins un produit SelectProduct=Sélectionnez au moins un produit
AlertOnly = Alertes seulement

View File

@ -47,6 +47,7 @@ $snom = GETPOST('snom', 'alpha');
$sall = GETPOST('sall', 'alpha'); $sall = GETPOST('sall', 'alpha');
$type = GETPOST('type','int'); $type = GETPOST('type','int');
$tobuy = GETPOST('tobuy', 'int'); $tobuy = GETPOST('tobuy', 'int');
$salerte = GETPOST('salerte', 'alpha');
$sortfield = GETPOST('sortfield','alpha'); $sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha'); $sortorder = GETPOST('sortorder','alpha');
@ -66,10 +67,11 @@ $offset = $limit * $page ;
* Actions * Actions
*/ */
if (isset($_POST['button_removefilter'])) { if (isset($_POST['button_removefilter']) || isset($_POST['valid'])) {
$sref = ''; $sref = '';
$snom = ''; $snom = '';
$sal = ''; $sal = '';
$salerte = '';
} }
//orders creation //orders creation
@ -206,6 +208,9 @@ $sql .= ', p.duration, p.tobuy, p.seuil_stock_alerte';
$sql .= ', p.desiredstock'; $sql .= ', p.desiredstock';
$sql .= ' HAVING (p.desiredstock > SUM(s.reel) or SUM(s.reel) is NULL)'; $sql .= ' HAVING (p.desiredstock > SUM(s.reel) or SUM(s.reel) is NULL)';
$sql .= ' AND p.desiredstock > 0'; $sql .= ' AND p.desiredstock > 0';
if ($salerte == 'on') {
$sql .= ' AND SUM(s.reel) < p.seuil_stock_alerte AND p.seuil_stock_alerte is not NULL';
}
$sql .= $db->order($sortfield,$sortorder); $sql .= $db->order($sortfield,$sortorder);
$sql .= $db->plimit($limit + 1, $offset); $sql .= $db->plimit($limit + 1, $offset);
$resql = $db->query($sql); $resql = $db->query($sql);
@ -365,7 +370,7 @@ if ($resql) {
'</td>'; '</td>';
} }
echo '<td class="liste_titre">&nbsp;</td>', echo '<td class="liste_titre">&nbsp;</td>',
'<td class="liste_titre">&nbsp;</td>', '<td class="liste_titre" align="right">' . $langs->trans('AlertOnly') . '&nbsp;<input type="checkbox" name="salerte"></td>',
'<td class="liste_titre" align="right">&nbsp;</td>', '<td class="liste_titre" align="right">&nbsp;</td>',
'<td class="liste_titre">&nbsp;</td>', '<td class="liste_titre">&nbsp;</td>',
'<td class="liste_titre">&nbsp;</td>', '<td class="liste_titre">&nbsp;</td>',