Work on inventory module

This commit is contained in:
Laurent Destailleur 2021-04-07 02:24:15 +02:00
parent 0219a18a5c
commit 4ccb27ad40
3 changed files with 81 additions and 56 deletions

View File

@ -241,7 +241,7 @@ StockAtDatePastDesc=You can view here the stock (real stock) at a given date in
StockAtDateFutureDesc=You can view here the stock (virtual stock) at a given date in future
CurrentStock=Current stock
InventoryRealQtyHelp=Set value to 0 to reset qty<br>Keep field empty, or remove line, to keep unchanged
UpdateByScaning=Update by scaning
UpdateByScaning=Fill real qty by scaning
UpdateByScaningProductBarcode=Update by scan (product barcode)
UpdateByScaningLot=Update by scan (lot|serial barcode)
DisableStockChangeOfSubProduct=Deactivate the stock change for all the subproducts of this Kit during this movement.
@ -251,5 +251,6 @@ SelectAStockMovementFileToImport=select a stock movement file to import
InfoTemplateImport=Uploaded file needs to have this format (* are mandatory fields):<br>Source Warehouse* | Target Warehouse* | Product* | Quantity* | Lot/serial number<br>CSV character separator must be "<b>%s</b>"
LabelOfInventoryMovemement=Inventory %s
ReOpen=Reopen
ConfirmFinish=Confirm closing
ObjectNotFound=%s not found
ConfirmFinish=Do you confirm the closing of the inventory ? This will generate all stock movements to update your stock.
ObjectNotFound=%s not found
MakeMovementsAndClose=Generate movements and close

View File

@ -384,6 +384,15 @@ if ($object->id > 0) {
print dol_get_fiche_end();
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="updateinventorylines">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
if ($backtopage) {
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
}
// Buttons for actions
if ($action != 'record') {
print '<div class="tabsAction">'."\n";
@ -402,64 +411,71 @@ if ($object->id > 0) {
}
}
if ($object->status == Inventory::STATUS_VALIDATED) {
// Save
if ($object->status == $object::STATUS_VALIDATED) {
if ($object->status == Inventory::STATUS_VALIDATED) {
if ($permissiontoadd) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=record">'.$langs->trans("MakeMovementsAndClose").'</a>'."\n";
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('MakeMovementsAndClose').'</a>'."\n";
}
}
if ($permissiontoadd) {
/*
if (!empty($conf->barcode->enabled)) {
print '<a href="#" class="butAction">'.$langs->trans("UpdateByScaningProductBarcode").'</a>';
}
if (!empty($conf->productbatch->enabled)) {
print '<a href="#" class="butAction">'.$langs->trans('UpdateByScaningLot').'</a>';
}*/
if (!empty($conf->barcode->enabled) || !empty($conf->productbatch->enabled)) {
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=updatebyscaning" class="butAction">'.$langs->trans("UpdateByScaning").'</a>';
}
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Save").'</a>'."\n";
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=confirm_cancel">'.$langs->trans("Cancel").'</a>'."\n";
}
}
if ($object->status == Inventory::STATUS_VALIDATED) {
if ($permissiontoadd) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=confirm_cancel">'.$langs->trans("Cancel").'</a>'."\n";
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=record">'.$langs->trans("Close").'</a>'."\n";
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Finish').'</a>'."\n";
}
}
/*if ($object->status == Inventory::STATUS_VALIDATED)
{
if ($permissiontoadd)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=edit">'.$langs->trans("RecordVerb").'</a>'."\n";
}
else
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('RecordVerb').'</a>'."\n";
}
}*/
}
print '</div>'."\n";
}
if ($action == 'updatebyscaning') {
print '<div class="div-for-modal">';
print 'TODO';
if ($object->status == Inventory::STATUS_VALIDATED) {
print '<center>';
if ($permissiontoadd) {
/*
if (!empty($conf->barcode->enabled)) {
print '<a href="#" class="butAction">'.$langs->trans("UpdateByScaningProductBarcode").'</a>';
}
if (!empty($conf->productbatch->enabled)) {
print '<a href="#" class="butAction">'.$langs->trans('UpdateByScaningLot').'</a>';
}*/
if (!empty($conf->barcode->enabled) || !empty($conf->productbatch->enabled)) {
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=updatebyscaning" class="">'.$langs->trans("UpdateByScaning").'</a>';
}
} else {
print '<a class="classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Save").'</a>'."\n";
}
print '<br>';
print '<br>';
print '</center>';
}
if ($action == 'updatebyscaning') {
print '<div class="div-for-modal-topright" style="padding: 15px">';
print '<center><strong>Barcode scanner tool...</strong></center><br>';
print 'Scan a product barcode<br>';
print '<input type="text" name="barcodeproduct" class="width200" autofocus> &nbsp; &nbsp; Qty <input type="text" name="barcodeproductqty" class="width50 right" value="1"><br>';
print '<br>'.$langs->trans("or").'<br>';
print '<br>';
print 'Scan a product lot or serial number<br>';
print '<input type="text" name="barcodelotserial" class="width200"> &nbsp; &nbsp; Qty <input type="text" name="barcodelotserialqty" class="width50 right" value="1"><br>';
print '<br>';
print '<span class="opacitymedium">'.$langs->trans("FeatureNotYetAvailable").'</span>';
// TODO Add javascript so each scan will add qty into the inventory page + an ajax save.
print '</div>';
}
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="updateinventorylines">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
if ($backtopage) {
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
}
print '<div class="fichecenter">';
//print '<div class="fichehalfleft">';
print '<div class="clearboth"></div>';
@ -495,7 +511,7 @@ if ($object->id > 0) {
print $formproduct->selectWarehouses((GETPOSTISSET('fk_warehouse') ? GETPOST('fk_warehouse', 'int') : $object->fk_warehouse), 'fk_warehouse', 'warehouseopen', 1, 0, 0, '', 0, 0, array(), 'maxwidth300');
print '</td>';
print '<td>';
print $form->select_produits((GETPOSTISSET('fk_product') ? GETPOST('fk_product', 'int') : $object->fk_product), 'fk_product', '', 0, 0, 1, 2, '', 0, null, 0, '1', 0, 'maxwidth300');
print $form->select_produits((GETPOSTISSET('fk_product') ? GETPOST('fk_product', 'int') : $object->fk_product), 'fk_product', '', 0, 0, -1, 2, '', 0, null, 0, '1', 0, 'maxwidth300');
print '</td>';
if ($conf->productbatch->enabled) {
print '<td>';
@ -593,15 +609,10 @@ if ($object->id > 0) {
print '</table>';
// Save
if ($object->status == $object::STATUS_VALIDATED) {
print '<div class="center">';
print '<input type="submit" class="button button-save" name="save" value="'.$langs->trans("Save").'">';
print '</div>';
}
print '</div>';
print '<center><input type="submit" class="button button-save" name="save" value="'.$langs->trans("Save").'"></center>';
print '</div>';
print '</form>';

View File

@ -985,6 +985,19 @@ div.div-for-modal {
z-index: 100;
}
div.div-for-modal-topright {
/* display: none; */
position:absolute;
top: 0;
right: 0;
width:50%; /* adjust as per your needs */
height:250px; /* adjust as per your needs */
background: #fff;
border: 1px solid #bbb;
box-shadow: 2px 2px 20px #ddd;
z-index: 1100;
}
<?php
// Add a nowrap on smartphone, so long list of field used for filter are overflowed with clip
if ($conf->browser->layout == 'phone') {