added an option to use virtual stock instead of physical stock
This commit is contained in:
parent
d4aa2a0f79
commit
52cfecd0af
@ -142,6 +142,19 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print "<tr ".$bc[$var].">";
|
||||||
|
print '<td width="60%">'.$langs->trans("UseVirtualStock").'</td>';
|
||||||
|
print '<td width="160" align="right">';
|
||||||
|
print "<form method=\"post\" action=\"stock.php\">";
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print "<input type=\"hidden\" name=\"action\" value=\"USE_VIRTUAL_STOCK\">";
|
||||||
|
print $form->selectyesno("USE_VIRTUAL_STOCK",$conf->global->USE_VIRTUAL_STOCK,1);
|
||||||
|
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||||
|
print '</form>';
|
||||||
|
print "</td>\n";
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|||||||
@ -287,7 +287,12 @@ if ($resql)
|
|||||||
print_liste_field_titre($langs->trans("Label"),"replenish.php", "p.label",$param,"","",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Label"),"replenish.php", "p.label",$param,"","",$sortfield,$sortorder);
|
||||||
if (! empty($conf->service->enabled) && $type == 1) print_liste_field_titre($langs->trans("Duration"),"replenish.php", "p.duration",$param,"",'align="center"',$sortfield,$sortorder);
|
if (! empty($conf->service->enabled) && $type == 1) print_liste_field_titre($langs->trans("Duration"),"replenish.php", "p.duration",$param,"",'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("DesiredStock"),"replenish.php", "p.desiredstock",$param,"",'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("DesiredStock"),"replenish.php", "p.desiredstock",$param,"",'align="right"',$sortfield,$sortorder);
|
||||||
|
if($conf->global->USE_VIRTUAL_STOCK) {
|
||||||
|
print_liste_field_titre($langs->trans("VirtualStock"),"replenish.php", "",$param,"",'align="right"',$sortfield,$sortorder);
|
||||||
|
}
|
||||||
|
else {
|
||||||
print_liste_field_titre($langs->trans("PhysicalStock"),"replenish.php", "stock_physique",$param,"",'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("PhysicalStock"),"replenish.php", "stock_physique",$param,"",'align="right"',$sortfield,$sortorder);
|
||||||
|
}
|
||||||
print_liste_field_titre($langs->trans("StockToBuy"),"replenish.php", "",$param,"",'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("StockToBuy"),"replenish.php", "",$param,"",'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Supplier"),"replenish.php", "",$param,"",'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Supplier"),"replenish.php", "",$param,"",'align="right"',$sortfield,$sortorder);
|
||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
@ -366,12 +371,24 @@ if ($resql)
|
|||||||
print '<td align="right">'.$objp->desiredstock.'</td>';
|
print '<td align="right">'.$objp->desiredstock.'</td>';
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if(!$objp->stock_physique) $objp->stock_physique = 0;
|
if(!$objp->stock_physique) $objp->stock_physique = 0;
|
||||||
if ($objp->seuil_stock_alerte && ($objp->stock_physique < $objp->seuil_stock_alerte)) print img_warning($langs->trans("StockTooLow")).' ';
|
if($conf->global->USE_VIRTUAL_STOCK){
|
||||||
print $objp->stock_physique;
|
$product_static->fetch($product_static->id);
|
||||||
|
$result=$product_static->load_stats_commande(0,'1,2');
|
||||||
|
if ($result < 0) dol_print_error($db,$product_static->error);
|
||||||
|
$stock_commande_client = $product_static->stats_commande['qty'];
|
||||||
|
$result=$product_static->load_stats_commande_fournisseur(0,'3');
|
||||||
|
if ($result < 0) dol_print_error($db,$product_static->error);
|
||||||
|
$stock_commande_fournisseur = $product_static->stats_commande_fournisseur['qty'];
|
||||||
|
$stock = $objp->stock_physique - $stock_commande_client + $stock_commande_fournisseur;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$stock = $objp->stock_physique;
|
||||||
|
}
|
||||||
|
if ($objp->seuil_stock_alerte && ($stock < $objp->seuil_stock_alerte)) print img_warning($langs->trans("StockTooLow")).' ';
|
||||||
|
print $stock;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
//depending on conf, use either physical stock or
|
//depending on conf, use either physical stock or
|
||||||
//theoretical stock to compute the stock to buy value
|
//virtual stock to compute the stock to buy value
|
||||||
($conf->global->use_theoretical_stock? $stock = $objp->stock_théorique : $stock = $objp->stock_physique);
|
|
||||||
$stocktobuy = $objp->desiredstock - $stock;
|
$stocktobuy = $objp->desiredstock - $stock;
|
||||||
print '<td align="right">'.$stocktobuy.'</td>';
|
print '<td align="right">'.$stocktobuy.'</td>';
|
||||||
print '<input type="hidden" name="tobuy'.$i.'" value="'.$stocktobuy.'" >';
|
print '<input type="hidden" name="tobuy'.$i.'" value="'.$stocktobuy.'" >';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user