FIX Autofill / clear qty in inventory page
This commit is contained in:
parent
d388ac58be
commit
6c589955a6
@ -428,69 +428,74 @@ $help_url = '';
|
|||||||
llxHeader('', $langs->trans('Inventory'), $help_url);
|
llxHeader('', $langs->trans('Inventory'), $help_url);
|
||||||
|
|
||||||
// Part to show record
|
// Part to show record
|
||||||
if ($object->id > 0) {
|
if ($object->id <= 0) {
|
||||||
$res = $object->fetch_optionals();
|
dol_print_error('', 'Bad value for object id');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
$head = inventoryPrepareHead($object);
|
|
||||||
print dol_get_fiche_head($head, 'inventory', $langs->trans("Inventory"), -1, 'stock');
|
|
||||||
|
|
||||||
$formconfirm = '';
|
$res = $object->fetch_optionals();
|
||||||
|
|
||||||
// Confirmation to delete
|
$head = inventoryPrepareHead($object);
|
||||||
if ($action == 'delete') {
|
print dol_get_fiche_head($head, 'inventory', $langs->trans("Inventory"), -1, 'stock');
|
||||||
|
|
||||||
|
$formconfirm = '';
|
||||||
|
|
||||||
|
// Confirmation to delete
|
||||||
|
if ($action == 'delete') {
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteInventory'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 1);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteInventory'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 1);
|
||||||
}
|
}
|
||||||
// Confirmation to delete line
|
// Confirmation to delete line
|
||||||
if ($action == 'deleteline') {
|
if ($action == 'deleteline') {
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid.'&page='.$page.$paramwithsearch, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid.'&page='.$page.$paramwithsearch, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clone confirmation
|
// Clone confirmation
|
||||||
if ($action == 'clone') {
|
if ($action == 'clone') {
|
||||||
// Create an array for form
|
// Create an array for form
|
||||||
$formquestion = array();
|
$formquestion = array();
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneMyObject', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneMyObject', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Confirmation to close
|
// Confirmation to close
|
||||||
if ($action == 'record') {
|
if ($action == 'record') {
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Close'), $langs->trans('ConfirmFinish'), 'update', '', 0, 1);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Close'), $langs->trans('ConfirmFinish'), 'update', '', 0, 1);
|
||||||
$action = 'view';
|
$action = 'view';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Confirmation to close
|
// Confirmation to close
|
||||||
if ($action == 'confirm_cancel') {
|
if ($action == 'confirm_cancel') {
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Cancel'), $langs->trans('ConfirmCancel'), 'cancel_record', '', 0, 1);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Cancel'), $langs->trans('ConfirmCancel'), 'cancel_record', '', 0, 1);
|
||||||
$action = 'view';
|
$action = 'view';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call Hook formConfirm
|
// Call Hook formConfirm
|
||||||
$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
|
$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
|
||||||
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
$formconfirm .= $hookmanager->resPrint;
|
$formconfirm .= $hookmanager->resPrint;
|
||||||
} elseif ($reshook > 0) {
|
} elseif ($reshook > 0) {
|
||||||
$formconfirm = $hookmanager->resPrint;
|
$formconfirm = $hookmanager->resPrint;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print form confirm
|
// Print form confirm
|
||||||
print $formconfirm;
|
print $formconfirm;
|
||||||
|
|
||||||
|
|
||||||
// Object card
|
// Object card
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/product/inventory/list.php">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/product/inventory/list.php">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
$morehtmlref = '<div class="refidno">';
|
$morehtmlref = '<div class="refidno">';
|
||||||
/*
|
/*
|
||||||
// Ref bis
|
// Ref bis
|
||||||
$morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->inventory->creer, 'string', '', 0, 1);
|
$morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->inventory->creer, 'string', '', 0, 1);
|
||||||
$morehtmlref.=$form->editfieldval("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->inventory->creer, 'string', '', null, null, '', 1);
|
$morehtmlref.=$form->editfieldval("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->inventory->creer, 'string', '', null, null, '', 1);
|
||||||
// Thirdparty
|
// Thirdparty
|
||||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1);
|
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1);
|
||||||
// Project
|
// Project
|
||||||
if (!empty($conf->project->enabled))
|
if (!empty($conf->project->enabled))
|
||||||
{
|
{
|
||||||
$langs->load("projects");
|
$langs->load("projects");
|
||||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||||
if ($user->rights->inventory->creer)
|
if ($user->rights->inventory->creer)
|
||||||
@ -519,46 +524,46 @@ if ($object->id > 0) {
|
|||||||
$morehtmlref.='';
|
$morehtmlref.='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
$morehtmlref .= '</div>';
|
$morehtmlref .= '</div>';
|
||||||
|
|
||||||
|
|
||||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||||
|
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
print '<div class="fichehalfleft">';
|
print '<div class="fichehalfleft">';
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
print '<table class="border centpercent tableforfield">'."\n";
|
print '<table class="border centpercent tableforfield">'."\n";
|
||||||
|
|
||||||
// Common attributes
|
// Common attributes
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
||||||
|
|
||||||
// Other attributes. Fields from hook formObjectOptions and Extrafields.
|
// Other attributes. Fields from hook formObjectOptions and Extrafields.
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
||||||
|
|
||||||
//print '<tr><td class="titlefield fieldname_invcode">'.$langs->trans("InventoryCode").'</td><td>INV'.$object->id.'</td></tr>';
|
//print '<tr><td class="titlefield fieldname_invcode">'.$langs->trans("InventoryCode").'</td><td>INV'.$object->id.'</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '<div class="clearboth"></div>';
|
print '<div class="clearboth"></div>';
|
||||||
|
|
||||||
print dol_get_fiche_end();
|
print dol_get_fiche_end();
|
||||||
|
|
||||||
print '<form id="formrecord" name="formrecord" method="POST" action="'.$_SERVER["PHP_SELF"].'?page='.$page.'&id='.$object->id.'">';
|
print '<form id="formrecord" name="formrecord" method="POST" action="'.$_SERVER["PHP_SELF"].'?page='.$page.'&id='.$object->id.'">';
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
print '<input type="hidden" name="action" value="updateinventorylines">';
|
print '<input type="hidden" name="action" value="updateinventorylines">';
|
||||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||||
if ($backtopage) {
|
if ($backtopage) {
|
||||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Buttons for actions
|
// Buttons for actions
|
||||||
if ($action != 'record') {
|
if ($action != 'record') {
|
||||||
print '<div class="tabsAction">'."\n";
|
print '<div class="tabsAction">'."\n";
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
@ -593,11 +598,11 @@ if ($object->id > 0) {
|
|||||||
if ($object->status != Inventory::STATUS_DRAFT && $object->status != Inventory::STATUS_VALIDATED) {
|
if ($object->status != Inventory::STATUS_DRAFT && $object->status != Inventory::STATUS_VALIDATED) {
|
||||||
print '<br><br>';
|
print '<br><br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($object->status == Inventory::STATUS_VALIDATED) {
|
if ($object->status == Inventory::STATUS_VALIDATED) {
|
||||||
print '<center>';
|
print '<center>';
|
||||||
if (!empty($conf->use_javascript_ajax)) {
|
if (!empty($conf->use_javascript_ajax)) {
|
||||||
if ($permissiontoadd) {
|
if ($permissiontoadd) {
|
||||||
@ -618,7 +623,7 @@ if ($object->id > 0) {
|
|||||||
jQuery(".realqty").trigger("change");
|
jQuery(".realqty").trigger("change");
|
||||||
})
|
})
|
||||||
console.log("Values filled (after click on fillwithexpected)");
|
console.log("Values filled (after click on fillwithexpected)");
|
||||||
disablebuttonmakemovementandclose();
|
/* disablebuttonmakemovementandclose(); */
|
||||||
return false;
|
return false;
|
||||||
});';
|
});';
|
||||||
print '});';
|
print '});';
|
||||||
@ -633,11 +638,11 @@ if ($object->id > 0) {
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '</center>';
|
print '</center>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Popup for mass barcode scanning
|
// Popup for mass barcode scanning
|
||||||
if ($action == 'updatebyscaning') {
|
if ($action == 'updatebyscaning') {
|
||||||
if ($permissiontoadd) {
|
if ($permissiontoadd) {
|
||||||
// Output the javascript to manage the scanner tool.
|
// Output the javascript to manage the scanner tool.
|
||||||
print '<script>';
|
print '<script>';
|
||||||
@ -864,14 +869,14 @@ if ($object->id > 0) {
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
include DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||||
$formother = new FormOther($db);
|
$formother = new FormOther($db);
|
||||||
print $formother->getHTMLScannerForm("barcodescannerjs", 'all');
|
print $formother->getHTMLScannerForm("barcodescannerjs", 'all');
|
||||||
}
|
}
|
||||||
|
|
||||||
//Call method to undo changes in real qty
|
//Call method to undo changes in real qty
|
||||||
print '<script>';
|
print '<script>';
|
||||||
print 'jQuery(document).ready(function() {
|
print 'jQuery(document).ready(function() {
|
||||||
$("#clearqty").on("click", function() {
|
$("#clearqty").on("click", function() {
|
||||||
console.log("Clear all values");
|
console.log("Clear all values");
|
||||||
disablebuttonmakemovementandclose();
|
/* disablebuttonmakemovementandclose(); */
|
||||||
jQuery(".realqty").val("");
|
jQuery(".realqty").val("");
|
||||||
jQuery(".realqty").trigger("change");
|
jQuery(".realqty").trigger("change");
|
||||||
return false; /* disable submit */
|
return false; /* disable submit */
|
||||||
@ -882,55 +887,55 @@ if ($object->id > 0) {
|
|||||||
id = id.split("_")[1];
|
id = id.split("_")[1];
|
||||||
tmpvalue = $("#id_"+id+"_input_tmp").val()
|
tmpvalue = $("#id_"+id+"_input_tmp").val()
|
||||||
$("#id_"+id+"_input")[0].value = tmpvalue;
|
$("#id_"+id+"_input")[0].value = tmpvalue;
|
||||||
disablebuttonmakemovementandclose();
|
/* disablebuttonmakemovementandclose(); */
|
||||||
return false; /* disable submit */
|
return false; /* disable submit */
|
||||||
});
|
});
|
||||||
});';
|
});';
|
||||||
print '</script>';
|
print '</script>';
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
//print '<div class="fichehalfleft">';
|
//print '<div class="fichehalfleft">';
|
||||||
print '<div class="clearboth"></div>';
|
print '<div class="clearboth"></div>';
|
||||||
|
|
||||||
//print load_fiche_titre($langs->trans('Consumption'), '', '');
|
//print load_fiche_titre($langs->trans('Consumption'), '', '');
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table id="tablelines" class="noborder noshadow centpercent">';
|
print '<table id="tablelines" class="noborder noshadow centpercent">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Warehouse").'</td>';
|
print '<td>'.$langs->trans("Warehouse").'</td>';
|
||||||
print '<td>'.$langs->trans("Product").'</td>';
|
print '<td>'.$langs->trans("Product").'</td>';
|
||||||
if (isModEnabled('productbatch')) {
|
if (isModEnabled('productbatch')) {
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $langs->trans("Batch");
|
print $langs->trans("Batch");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
print '<td class="right">'.$langs->trans("ExpectedQty").'</td>';
|
print '<td class="right">'.$langs->trans("ExpectedQty").'</td>';
|
||||||
if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) {
|
if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) {
|
||||||
print '<td class="right">'.$langs->trans('PMPExpected').'</td>';
|
print '<td class="right">'.$langs->trans('PMPExpected').'</td>';
|
||||||
print '<td class="right">'.$langs->trans('ExpectedValuation').'</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">'.$form->textwithpicto($langs->trans("RealQty"), $langs->trans("InventoryRealQtyHelp")).'</td>';
|
||||||
print '<td class="right">'.$langs->trans('PMPReal').'</td>';
|
print '<td class="right">'.$langs->trans('PMPReal').'</td>';
|
||||||
print '<td class="right">'.$langs->trans('RealValuation').'</td>';
|
print '<td class="right">'.$langs->trans('RealValuation').'</td>';
|
||||||
} else {
|
} else {
|
||||||
print '<td class="right">';
|
print '<td class="right">';
|
||||||
print $form->textwithpicto($langs->trans("RealQty"), $langs->trans("InventoryRealQtyHelp"));
|
print $form->textwithpicto($langs->trans("RealQty"), $langs->trans("InventoryRealQtyHelp"));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if ($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) {
|
if ($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) {
|
||||||
// Actions or link to stock movement
|
// Actions or link to stock movement
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
} else {
|
} else {
|
||||||
// Actions or link to stock movement
|
// Actions or link to stock movement
|
||||||
print '<td class="right">';
|
print '<td class="right">';
|
||||||
//print $langs->trans("StockMovement");
|
//print $langs->trans("StockMovement");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Line to add a new line in inventory
|
// Line to add a new line in inventory
|
||||||
if ($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) {
|
if ($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) {
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $formproduct->selectWarehouses((GETPOSTISSET('fk_warehouse') ? GETPOST('fk_warehouse', 'int') : $object->fk_warehouse), 'fk_warehouse', 'warehouseopen', 1, 0, 0, '', 0, 0, array(), 'maxwidth300');
|
print $formproduct->selectWarehouses((GETPOSTISSET('fk_warehouse') ? GETPOST('fk_warehouse', 'int') : $object->fk_warehouse), 'fk_warehouse', 'warehouseopen', 1, 0, 0, '', 0, 0, array(), 'maxwidth300');
|
||||||
@ -966,22 +971,22 @@ if ($object->id > 0) {
|
|||||||
print '<input type="submit" class="button paddingright" name="addline" value="'.$langs->trans("Add").'">';
|
print '<input type="submit" class="button paddingright" name="addline" value="'.$langs->trans("Add").'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Request to show lines of inventory (prefilled after start/validate step)
|
// Request to show lines of inventory (prefilled after start/validate step)
|
||||||
$sql = 'SELECT id.rowid, id.datec as date_creation, id.tms as date_modification, id.fk_inventory, id.fk_warehouse,';
|
$sql = 'SELECT id.rowid, id.datec as date_creation, id.tms as date_modification, id.fk_inventory, id.fk_warehouse,';
|
||||||
$sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated, id.fk_movement, id.pmp_real, id.pmp_expected';
|
$sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated, id.fk_movement, id.pmp_real, id.pmp_expected';
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'inventorydet as id';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.'inventorydet as id';
|
||||||
$sql .= ' WHERE id.fk_inventory = '.((int) $object->id);
|
$sql .= ' WHERE id.fk_inventory = '.((int) $object->id);
|
||||||
$sql .= $db->order('id.rowid', 'ASC');
|
$sql .= $db->order('id.rowid', 'ASC');
|
||||||
$sql .= $db->plimit($limit, $offset);
|
$sql .= $db->plimit($limit, $offset);
|
||||||
|
|
||||||
$cacheOfProducts = array();
|
$cacheOfProducts = array();
|
||||||
$cacheOfWarehouses = array();
|
$cacheOfWarehouses = array();
|
||||||
|
|
||||||
//$sql = '';
|
//$sql = '';
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
if (!empty($limit != 0) || $num > $limit || $page) {
|
if (!empty($limit != 0) || $num > $limit || $page) {
|
||||||
@ -1159,41 +1164,43 @@ if ($object->id > 0) {
|
|||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) {
|
if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) {
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
print '<td colspan="4">'.$langs->trans("Total").'</td>';
|
print '<td colspan="4">'.$langs->trans("Total").'</td>';
|
||||||
print '<td class="right" colspan="2">'.price($totalExpectedValuation).'</td>';
|
print '<td class="right" colspan="2">'.price($totalExpectedValuation).'</td>';
|
||||||
print '<td class="right" id="totalRealValuation" colspan="3">'.price($totalRealValuation).'</td>';
|
print '<td class="right" id="totalRealValuation" colspan="3">'.price($totalRealValuation).'</td>';
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
if ($object->status == $object::STATUS_VALIDATED) {
|
if ($object->status == $object::STATUS_VALIDATED) {
|
||||||
print '<center><input id="submitrecord" type="submit" class="button button-save" name="save" value="'.$langs->trans("Save").'"></center>';
|
print '<center><input id="submitrecord" type="submit" class="button button-save" name="save" value="'.$langs->trans("Save").'"></center>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
// Call method to disable the button if no qty entered yet for inventory
|
// Call method to disable the button if no qty entered yet for inventory
|
||||||
|
/*
|
||||||
if ($object->status != $object::STATUS_VALIDATED || !$hasinput) {
|
if ($object->status != $object::STATUS_VALIDATED || !$hasinput) {
|
||||||
print '<script type="text/javascript">
|
print '<script type="text/javascript">
|
||||||
jQuery(document).ready(function() {
|
jQuery(document).ready(function() {
|
||||||
console.log("Call disablebuttonmakemovementandclose because status = '.((int) $object->status).' or $hasinput = '.((int) $hasinput).'");
|
console.log("Call disablebuttonmakemovementandclose because status = '.((int) $object->status).' or $hasinput = '.((int) $hasinput).'");
|
||||||
disablebuttonmakemovementandclose();
|
disablebuttonmakemovementandclose();
|
||||||
});
|
});
|
||||||
</script>';
|
</script>';
|
||||||
}
|
}
|
||||||
print '</form>';
|
*/
|
||||||
|
|
||||||
print '<script type="text/javascript">
|
print '</form>';
|
||||||
|
|
||||||
|
print '<script type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
$(".paginationnext:last").click(function(e){
|
$(".paginationnext:last").click(function(e){
|
||||||
@ -1233,13 +1240,13 @@ if ($object->id > 0) {
|
|||||||
}});
|
}});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>';
|
</script>';
|
||||||
|
|
||||||
|
|
||||||
if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) {
|
if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) {
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$('.realqty').on('change', function () {
|
$('.realqty').on('change', function () {
|
||||||
let realqty = $(this).closest('tr').find('.realqty').val();
|
let realqty = $(this).closest('tr').find('.realqty').val();
|
||||||
let inputPmp = $(this).closest('tr').find('input[class*=realpmp]');
|
let inputPmp = $(this).closest('tr').find('input[class*=realpmp]');
|
||||||
let realpmp = $(inputPmp).val();
|
let realpmp = $(inputPmp).val();
|
||||||
@ -1248,9 +1255,9 @@ if ($object->id > 0) {
|
|||||||
$(this).closest('tr').find('input[name^=realvaluation]').val(realval.toFixed(2));
|
$(this).closest('tr').find('input[name^=realvaluation]').val(realval.toFixed(2));
|
||||||
}
|
}
|
||||||
updateTotalValuation();
|
updateTotalValuation();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('input[class*=realpmp]').on('change', function () {
|
$('input[class*=realpmp]').on('change', function () {
|
||||||
let inputQtyReal = $(this).closest('tr').find('.realqty');
|
let inputQtyReal = $(this).closest('tr').find('.realqty');
|
||||||
let realqty = $(inputQtyReal).val();
|
let realqty = $(inputQtyReal).val();
|
||||||
let inputPmp = $(this).closest('tr').find('input[class*=realpmp]');
|
let inputPmp = $(this).closest('tr').find('input[class*=realpmp]');
|
||||||
@ -1267,9 +1274,9 @@ if ($object->id > 0) {
|
|||||||
$('.realqty').trigger('change');
|
$('.realqty').trigger('change');
|
||||||
updateTotalValuation();
|
updateTotalValuation();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('input[name^=realvaluation]').on('change', function () {
|
$('input[name^=realvaluation]').on('change', function () {
|
||||||
let inputQtyReal = $(this).closest('tr').find('.realqty');
|
let inputQtyReal = $(this).closest('tr').find('.realqty');
|
||||||
let realqty = $(inputQtyReal).val();
|
let realqty = $(inputQtyReal).val();
|
||||||
let inputPmp = $(this).closest('tr').find('input[class*=realpmp]');
|
let inputPmp = $(this).closest('tr').find('input[class*=realpmp]');
|
||||||
@ -1282,9 +1289,9 @@ if ($object->id > 0) {
|
|||||||
$('.realqty').trigger('change');
|
$('.realqty').trigger('change');
|
||||||
updateTotalValuation();
|
updateTotalValuation();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function updateTotalValuation() {
|
function updateTotalValuation() {
|
||||||
let total = 0;
|
let total = 0;
|
||||||
$('input[name^=realvaluation]').each(function( index ) {
|
$('input[name^=realvaluation]').each(function( index ) {
|
||||||
let val = $(this).val();
|
let val = $(this).val();
|
||||||
@ -1297,11 +1304,10 @@ if ($object->id > 0) {
|
|||||||
$('#totalRealValuation').html(total.toLocaleString('fr-FR', {
|
$('#totalRealValuation').html(total.toLocaleString('fr-FR', {
|
||||||
maximumFractionDigits: currencyFractionDigits
|
maximumFractionDigits: currencyFractionDigits
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user