Fix : ordered should display qty in supplier order not yet send

This commit is contained in:
Maxime Kohlhaas 2014-07-03 17:57:36 +02:00
parent 51e4fa0d36
commit f2248d5bc8

View File

@ -478,21 +478,21 @@ while ($i < ($limit ? min($num, $limit) : $num))
$stock = $prod->stock_reel; $stock = $prod->stock_reel;
} }
$ordered = $prod->stats_commande_fournisseur['qty']-$prod->stats_reception['qty']; $ordered = $prod->stats_commande_fournisseur['qty'];
$warning=''; $warning='';
if ($objp->alertstock && ($stock < $objp->alertstock))
if ($objp->seuil_stock_alerte && ($stock < $objp->seuil_stock_alerte))
{ {
$warning = img_warning($langs->trans('StockTooLow')) . ' '; $warning = img_warning($langs->trans('StockTooLow')) . ' ';
} }
//depending on conf, use either physical stock or //depending on conf, use either physical stock or
//virtual stock to compute the stock to buy value //virtual stock to compute the stock to buy value
$stocktobuy = max(max($objp->desiredstock, $objp->alertstock) - $stock - $ordered, 0); //echo $objp->desiredstock." * ".$stock." * ".$ordered."<br>";
$stocktobuy = max($objp->desiredstock - $stock - $ordered, 0);
$disabled = ''; $disabled = '';
if($ordered > 0) { if($ordered > 0) {
$compare = $usevirtualstock ? $stock : $stock + $ordered; if($stock + $ordered >= $objp->desiredstock) {
if($compare >= $objp->desiredstock) {
$picto = img_picto('', './img/yes', '', 1); $picto = img_picto('', './img/yes', '', 1);
$disabled = 'disabled="disabled"'; $disabled = 'disabled="disabled"';
} }