Clean option for replenishment on real stock.

This commit is contained in:
Laurent Destailleur 2020-11-13 11:06:51 +01:00
parent b2245e462a
commit a98d025f5a
3 changed files with 44 additions and 56 deletions

View File

@ -483,13 +483,15 @@ if ($virtualdiffersfromphysical)
print '</tr>'."\n"; print '</tr>'."\n";
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("UseVirtualStockByDefault").'</td>'; print '<td>';
print $form->textwithpicto($langs->trans("UseRealStockByDefault"), $langs->trans("ReplenishmentCalculation"));
print '</td>';
print '<td class="right">'; print '<td class="right">';
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_USE_VIRTUAL_STOCK'); print ajax_constantonoff('STOCK_USE_REAL_STOCK_BY_DEFAULT_FOR_REPLENISHMENT');
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_USE_VIRTUAL_STOCK", $arrval, $conf->global->STOCK_USE_VIRTUAL_STOCK); print $form->selectarray("STOCK_USE_REAL_STOCK_BY_DEFAULT_FOR_REPLENISHMENT", $arrval, $conf->global->STOCK_USE_REAL_STOCK_BY_DEFAULT_FOR_REPLENISHMENT);
} }
print "</td>\n"; print "</td>\n";
print "</tr>\n"; print "</tr>\n";

View File

@ -122,8 +122,9 @@ DesiredStockDesc=This stock amount will be the value used to fill the stock by r
StockToBuy=To order StockToBuy=To order
Replenishment=Replenishment Replenishment=Replenishment
ReplenishmentOrders=Replenishment orders ReplenishmentOrders=Replenishment orders
VirtualDiffersFromPhysical=According to increase/decrease stock options, physical stock and virtual stock (physical + current orders) may differ VirtualDiffersFromPhysical=According to increase/decrease stock options, physical stock and virtual stock (physical stock + open orders) may differ
UseVirtualStockByDefault=Use virtual stock by default, instead of physical stock, for replenishment feature UseRealStockByDefault=Use real stock, instead of virtual stock, for replenishment feature
ReplenishmentCalculation=Amount to order will be (desired quantity - real stock) instead of (desired quantity - virtual stock)
UseVirtualStock=Use virtual stock UseVirtualStock=Use virtual stock
UsePhysicalStock=Use physical stock UsePhysicalStock=Use physical stock
CurentSelectionMode=Current selection mode CurentSelectionMode=Current selection mode

View File

@ -80,7 +80,6 @@ if (!$sortorder) {
$sortorder = 'ASC'; $sortorder = 'ASC';
} }
// Define virtualdiffersfromphysical
$virtualdiffersfromphysical = 0; $virtualdiffersfromphysical = 0;
if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
|| !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)
@ -92,7 +91,11 @@ if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
$virtualdiffersfromphysical = 1; // According to increase/decrease stock options, virtual and physical stock may differs. $virtualdiffersfromphysical = 1; // According to increase/decrease stock options, virtual and physical stock may differs.
} }
$usevirtualstock = !empty($conf->global->STOCK_USE_VIRTUAL_STOCK); if ($virtualdiffersfromphysical) {
$usevirtualstock = empty($conf->global->STOCK_USE_REAL_STOCK_BY_DEFAULT_FOR_REPLENISHMENT) ? 1 : 0;
} else {
$usevirtualstock = 0;
}
if ($mode == 'physical') $usevirtualstock = 0; if ($mode == 'physical') $usevirtualstock = 0;
if ($mode == 'virtual') $usevirtualstock = 1; if ($mode == 'virtual') $usevirtualstock = 1;
@ -526,22 +529,23 @@ print load_fiche_titre($langs->trans('Replenishment'), '', 'stock');
print dol_get_fiche_head($head, 'replenish', '', -1, ''); print dol_get_fiche_head($head, 'replenish', '', -1, '');
print '<span class="opacitymedium">'.$langs->trans("ReplenishmentStatusDesc").'</span><br>'."\n"; print '<span class="opacitymedium">'.$langs->trans("ReplenishmentStatusDesc").'</span>'."\n";
if (empty($fk_warhouse) && !empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) { if (empty($fk_warhouse) && !empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) {
print '<span class="opacitymedium">'.$langs->trans("ReplenishmentStatusDescPerWarehouse").'</span>'."<br>\n"; print '<span class="opacitymedium">'.$langs->trans("ReplenishmentStatusDescPerWarehouse").'</span>'."<br>\n";
} }
print '<br>';
if ($usevirtualstock == 1) if ($usevirtualstock == 1)
{ {
print $langs->trans("CurentSelectionMode").': '; print $langs->trans("CurentSelectionMode").': ';
print $langs->trans("CurentlyUsingVirtualStock"); print '<span class="a-mesure">'.$langs->trans("UseVirtualStock").'</span>';
print ' (<a href="'.$_SERVER["PHP_SELF"].'?mode=physical&fk_supplier='.$fk_supplier.'&fk_entrepot='.$fk_entrepot.'">'.$langs->trans("UsePhysicalStock").'</a>)'; print ' <a class="a-mesure-disabled" href="'.$_SERVER["PHP_SELF"].'?mode=physical&fk_supplier='.$fk_supplier.'&fk_entrepot='.$fk_entrepot.'">'.$langs->trans("UsePhysicalStock").'</a>';
print '<br>'; print '<br>';
} }
if ($usevirtualstock == 0) if ($usevirtualstock == 0)
{ {
print $langs->trans("CurentSelectionMode").': '; print $langs->trans("CurentSelectionMode").': ';
print $langs->trans("CurentlyUsingPhysicalStock"); print '<a class="a-mesure-disabled" href="'.$_SERVER["PHP_SELF"].'?mode=virtual&fk_supplier='.$fk_supplier.'&fk_entrepot='.$fk_entrepot.'">'.$langs->trans("UseVirtualStock").'</a>';
print ' (<a href="'.$_SERVER["PHP_SELF"].'?mode=virtual&fk_supplier='.$fk_supplier.'&fk_entrepot='.$fk_entrepot.'">'.$langs->trans("UseVirtualStock").'</a>)'; print ' <span class="a-mesure">'.$langs->trans("UsePhysicalStock").'</span>';
print '<br>'; print '<br>';
} }
print '<br>'."\n"; print '<br>'."\n";
@ -591,54 +595,33 @@ print '<input type="hidden" name="mode" value="'.$mode.'">';
if ($search_ref || $search_label || $sall || $salert || $draftorder || GETPOST('search', 'alpha')) { if ($search_ref || $search_label || $sall || $salert || $draftorder || GETPOST('search', 'alpha')) {
$filters = '&search_ref='.$search_ref.'&search_label='.$search_label; $filters = '&search_ref='.urlencode($search_ref).'&search_label='.urlencode($search_label);
$filters .= '&sall='.$sall; $filters .= '&sall='.urlencode($sall);
$filters .= '&salert='.$salert; $filters .= '&salert='.urlencode($salert);
$filters .= '&draftorder='.$draftorder; $filters .= '&draftorder='.urlencode($draftorder);
$filters .= '&mode='.$mode; $filters .= '&mode='.urlencode($mode);
$filters .= '&fk_supplier='.$fk_supplier; $filters .= '&fk_supplier='.urlencode($fk_supplier);
$filters .= '&fk_entrepot='.$fk_entrepot; $filters .= '&fk_entrepot='.urlencode($fk_entrepot);
print_barre_liste(
$texte,
$page,
'replenish.php',
$filters,
$sortfield,
$sortorder,
'',
$num
);
} else { } else {
$filters = '&search_ref='.$search_ref.'&search_label='.$search_label; $filters = '&search_ref='.urlencode($search_ref).'&search_label='.urlencode($search_label);
$filters .= '&fourn_id='.$fourn_id; $filters .= '&fourn_id='.urlencode($fourn_id);
$filters .= (isset($type) ? '&type='.$type : ''); $filters .= (isset($type) ? '&type='.urlencode($type) : '');
$filters .= '&='.$salert; $filters .= '&='.urlencode($salert);
$filters .= '&draftorder='.$draftorder; $filters .= '&draftorder='.urlencode($draftorder);
$filters .= '&mode='.$mode; $filters .= '&mode='.urlencode($mode);
$filters .= '&fk_supplier='.$fk_supplier; $filters .= '&fk_supplier='.urlencode($fk_supplier);
$filters .= '&fk_entrepot='.$fk_entrepot; $filters .= '&fk_entrepot='.urlencode($fk_entrepot);
print_barre_liste(
$texte,
$page,
'replenish.php',
$filters,
$sortfield,
$sortorder,
'',
$num
);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$filters .= '&limit='.urlencode($limit); $filters .= '&limit='.urlencode($limit);
} }
$param = (isset($type) ? '&type='.$type : ''); $param = (isset($type) ? '&type='.urlencode($type) : '');
$param .= '&fourn_id='.$fourn_id.'&search_label='.$search_label.'&includeproductswithoutdesiredqty='.$includeproductswithoutdesiredqty.'&salert='.$salert.'&draftorder='.$draftorder; $param .= '&fourn_id='.urlencode($fourn_id).'&search_label='.urlencode($search_label).'&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty).'&salert='.urlencode($salert).'&draftorder='.urlencode($draftorder);
$param .= '&search_ref='.$search_ref; $param .= '&search_ref='.urlencode($search_ref);
$param .= '&mode='.$mode; $param .= '&mode='.urlencode($mode);
$param .= '&fk_supplier='.$fk_supplier; $param .= '&fk_supplier='.urlencode($fk_supplier);
$param .= '&fk_entrepot='.$fk_entrepot; $param .= '&fk_entrepot='.urlencode($fk_entrepot);
$stocklabel = $langs->trans('Stock'); $stocklabel = $langs->trans('Stock');
$stocklabelbis = $langs->trans('Stock'); $stocklabelbis = $langs->trans('Stock');
@ -651,6 +634,8 @@ if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entre
} }
$texte = $langs->trans('Replenishment'); $texte = $langs->trans('Replenishment');
print '<br>';
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
if (!empty($conf->global->REPLENISH_ALLOW_VARIABLESIZELIST)) { if (!empty($conf->global->REPLENISH_ALLOW_VARIABLESIZELIST)) {
@ -664,7 +649,7 @@ if (!empty($conf->global->REPLENISH_ALLOW_VARIABLESIZELIST)) {
'', '',
$num, $num,
$nbtotalofrecords, $nbtotalofrecords,
'object_stock.png', '',
0, 0,
'', '',
'', '',
@ -681,7 +666,7 @@ if (!empty($conf->global->REPLENISH_ALLOW_VARIABLESIZELIST)) {
'', '',
$num, $num,
$nbtotalofrecords, $nbtotalofrecords,
'object_stock.png' ''
); );
} }