mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
added an option to use virtual stock instead of physical stock
This commit is contained in:
parent
737aa7819f
commit
9b4601bcf2
|
|
@ -73,6 +73,11 @@ if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL'
|
|||
if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", GETPOST('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER','alpha'),'chaine',0,'',$conf->entity);
|
||||
}
|
||||
|
||||
if($action == 'USE_VIRTUAL_STOCK') {
|
||||
$db->begin();
|
||||
$res = dolibarr_set_const($db, "USE_VIRTUAL_STOCK", GETPOST('USE_VIRTUAL_STOCK','alpha'),'chaine',0,'',$conf->entity);
|
||||
}
|
||||
|
||||
if($action)
|
||||
{
|
||||
if (! $res > 0) $error++;
|
||||
|
|
@ -89,6 +94,7 @@ if($action)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
|
@ -136,6 +142,19 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'
|
|||
print '</form>';
|
||||
print "</td>\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 '</table>';
|
||||
print '<br>';
|
||||
|
|
|
|||
|
|
@ -64,7 +64,6 @@ StockLimitShort=Limit
|
|||
StockLimit=Stock limit for alerts
|
||||
PhysicalStock=Physical stock
|
||||
RealStock=Real Stock
|
||||
TheoreticalStock=Therocial stock
|
||||
VirtualStock=Virtual stock
|
||||
MininumStock=Minimum stock
|
||||
StockUp=Stock up
|
||||
|
|
@ -93,3 +92,4 @@ DesiredStock=Desired stock
|
|||
StockToBuy=Stock to buy
|
||||
Replenishment=Replenishment
|
||||
ReplenishmentOrders=Replenishment orders
|
||||
UseVirtualStock=Use virtual stock instead of physical stock
|
||||
|
|
|
|||
|
|
@ -64,7 +64,6 @@ StockLimitShort=Seuil
|
|||
StockLimit=Seuil d'alerte de stock
|
||||
PhysicalStock=Stock physique
|
||||
RealStock=Stock réel
|
||||
TheoreticalStock=Stock théorique
|
||||
VirtualStock=Stock théorique
|
||||
MininumStock=Stock minimum
|
||||
StockUp=Stock maximum
|
||||
|
|
@ -93,3 +92,4 @@ DesiredStock=Stock désiré
|
|||
StockToBuy=Stock à acheter
|
||||
Replenishment=Réapprovisionnement
|
||||
ReplenishmentOrders=Commandes de réapprovisionnement
|
||||
UseVirtualStock=Utiliser le stock théorique à la place du stock physique
|
||||
|
|
|
|||
|
|
@ -287,7 +287,12 @@ if ($resql)
|
|||
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);
|
||||
print_liste_field_titre($langs->trans("DesiredStock"),"replenish.php", "p.desiredstock",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PhysicalStock"),"replenish.php", "stock_physique",$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("StockToBuy"),"replenish.php", "",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Supplier"),"replenish.php", "",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print '<td> </td>';
|
||||
|
|
@ -366,12 +371,24 @@ if ($resql)
|
|||
print '<td align="right">'.$objp->desiredstock.'</td>';
|
||||
print '<td align="right">';
|
||||
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")).' ';
|
||||
print $objp->stock_physique;
|
||||
if($conf->global->USE_VIRTUAL_STOCK){
|
||||
$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>';
|
||||
//depending on conf, use either physical stock or
|
||||
//theoretical stock to compute the stock to buy value
|
||||
($conf->global->use_theoretical_stock? $stock = $objp->stock_théorique : $stock = $objp->stock_physique);
|
||||
//virtual stock to compute the stock to buy value
|
||||
$stocktobuy = $objp->desiredstock - $stock;
|
||||
print '<td align="right">'.$stocktobuy.'</td>';
|
||||
print '<input type="hidden" name="tobuy'.$i.'" value="'.$stocktobuy.'" >';
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user