FIX : Move column "Real Qty" just before "Real PMP" column

This commit is contained in:
Adrien Raze 2022-04-28 11:45:55 +02:00
parent 25fbd3b385
commit ed4610b36b

View File

@ -910,15 +910,17 @@ if ($object->id > 0) {
print '</td>';
}
print '<td class="right">'.$langs->trans("ExpectedQty").'</td>';
print '<td class="right">';
print $form->textwithpicto($langs->trans("RealQty"), $langs->trans("InventoryRealQtyHelp"));
print '</td>';
if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) {
print '<td class="right">'.$langs->trans('PMPExpected').'</td>';
print '<td class="right">'.$langs->trans('ExpectedValuation').'</td>';
print '<td class="right">'.$form->textwithpicto($langs->trans("RealQty"), $langs->trans("InventoryRealQtyHelp")).'</td>';
print '<td class="right">'.$langs->trans('PMPReal').'</td>';
print '<td class="right">'.$langs->trans('RealValuation').'</td>';
}
} else {
print '<td class="right">';
print $form->textwithpicto($langs->trans("RealQty"), $langs->trans("InventoryRealQtyHelp"));
print '</td>';
}
if ($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) {
// Actions or link to stock movement
print '<td class="center">';
@ -1041,7 +1043,6 @@ if ($object->id > 0) {
// Real quantity
if ($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) {
print '<td class="right">';
$qty_view = GETPOST("id_".$obj->rowid) && price2num(GETPOST("id_".$obj->rowid), 'MS') >= 0 ? GETPOST("id_".$obj->rowid) : $obj->qty_view;
//if (!$hasinput && $qty_view !== null && $obj->qty_stock != $qty_view) {
@ -1049,11 +1050,6 @@ if ($object->id > 0) {
$hasinput = true;
}
print '<a id="undochangesqty_'.$obj->rowid.'" href="#" class="undochangesqty reposition marginrightonly" title="'.dol_escape_htmltag($langs->trans("Clear")).'">';
print img_picto('', 'eraser', 'class="opacitymedium"');
print '</a>';
print '<input type="text" class="maxwidth75 right realqty" name="id_'.$obj->rowid.'" id="id_'.$obj->rowid.'_input" value="'.$qty_view.'">';
print '</td>';
if (! empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) {
//PMP Expected
if (! empty($obj->pmp_expected)) $pmp_expected = $obj->pmp_expected;
@ -1066,6 +1062,14 @@ if ($object->id > 0) {
print '<td class="right">';
print price($pmp_valuation);
print '</td>';
print '<td class="right">';
print '<a id="undochangesqty_'.$obj->rowid.'" href="#" class="undochangesqty reposition marginrightonly" title="'.dol_escape_htmltag($langs->trans("Clear")).'">';
print img_picto('', 'eraser', 'class="opacitymedium"');
print '</a>';
print '<input type="text" class="maxwidth50 right realqty" name="id_'.$obj->rowid.'" id="id_'.$obj->rowid.'_input" value="'.$qty_view.'">';
print '</td>';
//PMP Real
print '<td class="right">';
@ -1081,18 +1085,22 @@ if ($object->id > 0) {
$totalExpectedValuation += $pmp_valuation;
$totalRealValuation += $pmp_valuation_real;
}
} else {
print '<td class="right">';
print '<a id="undochangesqty_'.$obj->rowid.'" href="#" class="undochangesqty reposition marginrightonly" title="'.dol_escape_htmltag($langs->trans("Clear")).'">';
print img_picto('', 'eraser', 'class="opacitymedium"');
print '</a>';
print '<input type="text" class="maxwidth50 right realqty" name="id_'.$obj->rowid.'" id="id_'.$obj->rowid.'_input" value="'.$qty_view.'">';
print '</td>';
}
// Picto delete line
print '<td class="right">';
print '<a class="reposition" href="'.DOL_URL_ROOT.'/product/inventory/inventory.php?id='.$object->id.'&lineid='.$obj->rowid.'&action=deleteline&token='.newToken().'">'.img_delete().'</a>';
$qty_tmp = price2num(GETPOST("id_".$obj->rowid."_input_tmp", 'MS')) >= 0 ? GETPOST("id_".$obj->rowid."_input_tmp") : $qty_view;
print '<input type="hidden" class="maxwidth75 right realqty" name="id_'.$obj->rowid.'_input_tmp" id="id_'.$obj->rowid.'_input_tmp" value="'.$qty_tmp.'">';
print '<input type="hidden" class="maxwidth50 right realqty" name="id_'.$obj->rowid.'_input_tmp" id="id_'.$obj->rowid.'_input_tmp" value="'.$qty_tmp.'">';
print '</td>';
} else {
print '<td class="right nowraponall">';
print $obj->qty_view; // qty found
print '</td>';
if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) {
//PMP Expected
if (! empty($obj->pmp_expected)) $pmp_expected = $obj->pmp_expected;
@ -1105,6 +1113,10 @@ if ($object->id > 0) {
print price($pmp_valuation);
print '</td>';
print '<td class="right nowraponall">';
print $obj->qty_view; // qty found
print '</td>';
//PMP Real
print '<td class="right">';
if (! empty($obj->pmp_real)) $pmp_real = $obj->pmp_real;
@ -1119,7 +1131,11 @@ if ($object->id > 0) {
$totalExpectedValuation += $pmp_valuation;
$totalRealValuation += $pmp_valuation_real;
}
} else {
print '<td class="right nowraponall">';
print $obj->qty_view; // qty found
print '</td>';
}
if ($obj->fk_movement > 0) {
$stockmovment = new MouvementStock($db);
$stockmovment->fetch($obj->fk_movement);