From 879afaa59e0251639e66981be8d00668f6800da3 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Fri, 18 Feb 2022 12:16:50 +0100 Subject: [PATCH 1/8] NEW : Beginning of PMP management on inventory --- .../install/mysql/migration/15.0.0-16.0.0.sql | 2 + .../mysql/tables/llx_inventorydet-stock.sql | 2 + htdocs/langs/en_US/products.lang | 4 + htdocs/product/inventory/inventory.php | 86 ++++++++++++++++++- .../product/stock/tpl/extrafields_add.tpl.php | 2 +- 5 files changed, 91 insertions(+), 5 deletions(-) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index b78e53bd287..85d8763a4fe 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -237,4 +237,6 @@ ALTER TABLE llx_advtargetemailing RENAME TO llx_mailing_advtarget; ALTER TABLE llx_mailing ADD UNIQUE uk_mailing(titre, entity); +ALTER TABLE llx_inventorydet ADD COLUMN pmp_real double DEFAULT NULL; +ALTER TABLE llx_inventorydet ADD COLUMN valuation_real double DEFAULT NULL; diff --git a/htdocs/install/mysql/tables/llx_inventorydet-stock.sql b/htdocs/install/mysql/tables/llx_inventorydet-stock.sql index 8b75f68460d..5ce878124b6 100644 --- a/htdocs/install/mysql/tables/llx_inventorydet-stock.sql +++ b/htdocs/install/mysql/tables/llx_inventorydet-stock.sql @@ -29,6 +29,8 @@ CREATE TABLE llx_inventorydet qty_stock double DEFAULT NULL, -- Value or real stock we have, when we start the inventory (may be updated during intermediary steps). qty_view double DEFAULT NULL, -- Quantity found during inventory. It is the targeted value, filled during edition of inventory. qty_regulated double DEFAULT NULL, -- Never used. Deprecated because we already have the fk_movement now. + pmp_real double DEFAULT NULL, -- Never used. Deprecated because we already have the fk_movement now. + valuation_real double DEFAULT NULL, -- Never used. Deprecated because we already have the fk_movement now. fk_movement integer NULL -- can contain the id of stock movement we recorded to make the inventory regulation of this line ) ENGINE=innodb; diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 14715670882..947b743fa7a 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -411,3 +411,7 @@ Rank=Rank SwitchOnSaleStatus=Switch on sale status SwitchOnPurchaseStatus=Switch on purchase status StockMouvementExtraFields= Extra Fields (stock mouvement) +PMPExpected=Expected PMP +ExpectedValuation=Expected Valuation +PMPReal=Real PMP +RealValuation=Real Valuation \ No newline at end of file diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 95c9e2972cb..795e3ad11bb 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -45,7 +45,8 @@ $fk_warehouse = GETPOST('fk_warehouse', 'int'); $fk_product = GETPOST('fk_product', 'int'); $lineid = GETPOST('lineid', 'int'); $batch = GETPOST('batch', 'alphanohtml'); - +$totalExpectedValuation = 0; +$totalRealValuation = 0; if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $result = restrictedArea($user, 'stock', $id); } else { @@ -863,6 +864,12 @@ if ($object->id > 0) { print ''; print $form->textwithpicto($langs->trans("RealQty"), $langs->trans("InventoryRealQtyHelp")); print ''; + if(!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { + print ''.$langs->trans('PMPExpected').''; + print ''.$langs->trans('ExpectedValuation').''; + print ''.$langs->trans('PMPReal').''; + print ''.$langs->trans('RealValuation').''; + } if ($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) { // Actions or link to stock movement print ''; @@ -893,6 +900,16 @@ if ($object->id > 0) { print ''; print ''; print ''; + if(!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } // Actions print ''; print ''; @@ -902,7 +919,7 @@ if ($object->id > 0) { // 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 .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated, id.fk_movement'; + $sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated, id.fk_movement, id.pmp_real, id.valuation_real'; $sql .= ' FROM '.MAIN_DB_PREFIX.'inventorydet as id'; $sql .= ' WHERE id.fk_inventory = '.((int) $object->id); @@ -988,6 +1005,36 @@ if ($object->id > 0) { print ''; print ''; print ''; + if(! empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { + //PMP Expected + $pmp_valuation = $product_static->pmp * $valuetoshow; + print ''; + print price($product_static->pmp); + print ''; + print ''; + print price($pmp_valuation); + print ''; + //PMP Real + print ''; + print ''; + print img_picto('', 'eraser', 'class="opacitymedium"'); + print ''; + + if(! empty($obj->pmp_real)) $pmp_real = $obj->pmp_real; + else $pmp_real = $product_static->pmp; + $pmp_valuation_real = $pmp_real * $qty_view; + print ''; + print ''; + print ''; + print ''; + print img_picto('', 'eraser', 'class="opacitymedium"'); + print ''; + print ''; + print ''; + + $totalExpectedValuation += $pmp_valuation; + $totalRealValuation += $pmp_valuation_real; + } // Picto delete line print ''; @@ -999,7 +1046,31 @@ if ($object->id > 0) { print ''; print $obj->qty_view; // qty found print ''; - print ''; + if(!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { + //PMP Expected + $pmp_valuation = $product_static->pmp * $valuetoshow; + $pmp_valuation_real = $pmp_real * $obj->qty_view; + print ''; + print price($product_static->pmp); + print ''; + print ''; + print price($pmp_valuation); + print ''; + + //PMP Real + print ''; + if(! empty($obj->pmp_real)) $pmp_real = $obj->pmp_real; + else $pmp_real = $product_static->pmp; + print price($pmp_real); + print ''; + print ''; + print price($pmp_valuation_real); + print ''; + print ''; + + $totalExpectedValuation += $pmp_valuation; + $totalRealValuation += $pmp_valuation_real; + } if ($obj->fk_movement > 0) { $stockmovment = new MouvementStock($db); $stockmovment->fetch($obj->fk_movement); @@ -1014,7 +1085,14 @@ if ($object->id > 0) { } else { dol_print_error($db); } - + if(!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { + print ''; + print ''.$langs->trans("Total").''; + print ''.price($totalExpectedValuation).''; + print ''.price($totalRealValuation).''; + print ''; + print ''; + } print ''; print ''; diff --git a/htdocs/product/stock/tpl/extrafields_add.tpl.php b/htdocs/product/stock/tpl/extrafields_add.tpl.php index 62921f0a6e0..aec8c971deb 100644 --- a/htdocs/product/stock/tpl/extrafields_add.tpl.php +++ b/htdocs/product/stock/tpl/extrafields_add.tpl.php @@ -44,7 +44,7 @@ if (empty($reshook)) { $params = array(); if (isset($tpl_context)) $params['tpl_context'] = $tpl_context; $params['cols'] = $parameters['colspanvalue']; - print $movement->showOptionals($extrafields, 'create', $params); +// print $movement->showOptionals($extrafields, 'create', $params); } ?> From 5c2c06de3b2fd5bc6f74c829bf9c28dabfdaa673 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Fri, 18 Feb 2022 15:39:56 +0100 Subject: [PATCH 2/8] NEW : JS inventory autocalc input --- htdocs/product/inventory/inventory.php | 76 +++++++++++++++++++++++--- 1 file changed, 67 insertions(+), 9 deletions(-) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 795e3ad11bb..06c8ae0d2f5 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -1016,20 +1016,15 @@ if ($object->id > 0) { print ''; //PMP Real print ''; - print ''; - print img_picto('', 'eraser', 'class="opacitymedium"'); - print ''; + if(! empty($obj->pmp_real)) $pmp_real = $obj->pmp_real; else $pmp_real = $product_static->pmp; $pmp_valuation_real = $pmp_real * $qty_view; - print ''; + print ''; print ''; print ''; - print ''; - print img_picto('', 'eraser', 'class="opacitymedium"'); - print ''; - print ''; + print ''; print ''; $totalExpectedValuation += $pmp_valuation; @@ -1089,7 +1084,7 @@ if ($object->id > 0) { print ''; print ''.$langs->trans("Total").''; print ''.price($totalExpectedValuation).''; - print ''.price($totalRealValuation).''; + print ''.price($totalRealValuation).''; print ''; print ''; } @@ -1115,6 +1110,69 @@ if ($object->id > 0) { '; } print ''; + + + if(! empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { + ?> + + Date: Mon, 21 Feb 2022 14:25:18 +0100 Subject: [PATCH 3/8] new pmp column --- .../install/mysql/migration/15.0.0-16.0.0.sql | 2 +- .../mysql/tables/llx_inventorydet-stock.sql | 4 +- .../inventory/class/inventory.class.php | 4 ++ htdocs/product/inventory/inventory.php | 62 +++++++++++++------ 4 files changed, 51 insertions(+), 21 deletions(-) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 85d8763a4fe..2667ac03e0e 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -238,5 +238,5 @@ ALTER TABLE llx_advtargetemailing RENAME TO llx_mailing_advtarget; ALTER TABLE llx_mailing ADD UNIQUE uk_mailing(titre, entity); ALTER TABLE llx_inventorydet ADD COLUMN pmp_real double DEFAULT NULL; -ALTER TABLE llx_inventorydet ADD COLUMN valuation_real double DEFAULT NULL; +ALTER TABLE llx_inventorydet ADD COLUMN pmp_expected double DEFAULT NULL; diff --git a/htdocs/install/mysql/tables/llx_inventorydet-stock.sql b/htdocs/install/mysql/tables/llx_inventorydet-stock.sql index 5ce878124b6..8999b0e298b 100644 --- a/htdocs/install/mysql/tables/llx_inventorydet-stock.sql +++ b/htdocs/install/mysql/tables/llx_inventorydet-stock.sql @@ -29,8 +29,8 @@ CREATE TABLE llx_inventorydet qty_stock double DEFAULT NULL, -- Value or real stock we have, when we start the inventory (may be updated during intermediary steps). qty_view double DEFAULT NULL, -- Quantity found during inventory. It is the targeted value, filled during edition of inventory. qty_regulated double DEFAULT NULL, -- Never used. Deprecated because we already have the fk_movement now. - pmp_real double DEFAULT NULL, -- Never used. Deprecated because we already have the fk_movement now. - valuation_real double DEFAULT NULL, -- Never used. Deprecated because we already have the fk_movement now. + pmp_real double DEFAULT NULL, + pmp_expected double DEFAULT NULL, fk_movement integer NULL -- can contain the id of stock movement we recorded to make the inventory regulation of this line ) ENGINE=innodb; diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index 92061972e60..81300d6bac8 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -755,6 +755,8 @@ class InventoryLine extends CommonObjectLine 'qty_stock' => array('type'=>'double', 'label'=>'QtyFound', 'visible'=>1, 'enabled'=>1, 'position'=>32, 'index'=>1, 'help'=>'Qty we found/want (to define during draft edition)'), 'qty_view' => array('type'=>'double', 'label'=>'QtyBefore', 'visible'=>1, 'enabled'=>1, 'position'=>33, 'index'=>1, 'help'=>'Qty before (filled once movements are validated)'), 'qty_regulated' => array('type'=>'double', 'label'=>'QtyDelta', 'visible'=>1, 'enabled'=>1, 'position'=>34, 'index'=>1, 'help'=>'Qty aadded or removed (filled once movements are validated)'), + 'pmp_real' => array('type'=>'double', 'label'=>'PMPReal', 'visible'=>1, 'enabled'=>1, 'position'=>35), + 'pmp_expected' => array('type'=>'double', 'label'=>'PMPExpected', 'visible'=>1, 'enabled'=>1, 'position'=>36), ); /** @@ -771,6 +773,8 @@ class InventoryLine extends CommonObjectLine public $qty_stock; public $qty_view; public $qty_regulated; + public $pmp_real; + public $pmp_expected; /** diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 06c8ae0d2f5..b593fc1b414 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -127,7 +127,7 @@ if (empty($reshook)) { $db->begin(); $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'; + $sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated, id.pmp_real'; $sql .= ' FROM '.MAIN_DB_PREFIX.'inventorydet as id'; $sql .= ' WHERE id.fk_inventory = '.((int) $object->id); @@ -176,14 +176,26 @@ if (empty($reshook)) { $datemovement = ''; //$inventorycode = 'INV'.$object->id; $inventorycode = 'INV-'.$object->ref; + $price = 0; + if(!empty($line->pmp_real) && !empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) $price = $line->pmp_real; - $idstockmove = $stockmovment->_create($user, $line->fk_product, $line->fk_warehouse, $stock_movement_qty, $movement_type, 0, $langs->trans('LabelOfInventoryMovemement', $object->ref), $inventorycode, $datemovement, '', '', $line->batch); + $idstockmove = $stockmovment->_create($user, $line->fk_product, $line->fk_warehouse, $stock_movement_qty, $movement_type, $price, $langs->trans('LabelOfInventoryMovemement', $object->ref), $inventorycode, $datemovement, '', '', $line->batch); if ($idstockmove < 0) { $error++; setEventMessages($stockmovment->error, $stockmovment->errors, 'errors'); break; } + if(!empty($line->pmp_real) && !empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { + $sqlpmp = 'UPDATE '.MAIN_DB_PREFIX.'product SET pmp = '.((float) $line->pmp_real).' WHERE rowid = '.((int) $line->fk_product); + $resqlpmp = $db->query($sqlpmp); + if(! $resqlpmp) { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + break; + } + } + // Update line with id of stock movement (and the start quantity if it has changed this last recording) $sqlupdate = "UPDATE ".MAIN_DB_PREFIX."inventorydet"; $sqlupdate .= " SET fk_movement = ".((int) $idstockmove); @@ -247,6 +259,8 @@ if (empty($reshook)) { if ($result > 0) { $inventoryline->qty_stock = price2num(GETPOST('stock_qty_'.$lineid, 'alpha'), 'MS'); // The new value that was set in as hidden field $inventoryline->qty_view = $qtytoupdate; // The new value we want + $inventoryline->pmp_real = price2num(GETPOST('realpmp_'.$lineid, 'alpha'), 'MS'); + $inventoryline->pmp_expected = price2num(GETPOST('expectedpmp_'.$lineid, 'alpha'), 'MS'); $resultupdate = $inventoryline->update($user); } } else { @@ -584,6 +598,7 @@ if ($object->id > 0) { var object = $(this)[0]; var objecttofill = $("#"+object.id+"_input")[0]; objecttofill.value = object.innerText; + jQuery(".realqty").trigger("change"); }) console.log("Values filled (after click on fillwithexpected)"); disablebuttonmakemovementandclose(); @@ -829,6 +844,7 @@ if ($object->id > 0) { $("#clearqty").on("click", function() { console.log("Clear all values"); jQuery(".realqty").val(""); + jQuery(".realqty").trigger("change"); return false; /* disable submit */ }); $(".undochangesqty").on("click", function undochangesqty() { @@ -919,7 +935,7 @@ if ($object->id > 0) { // 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 .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated, id.fk_movement, id.pmp_real, id.valuation_real'; + $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 .= ' WHERE id.fk_inventory = '.((int) $object->id); @@ -1007,9 +1023,12 @@ if ($object->id > 0) { print ''; if(! empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { //PMP Expected - $pmp_valuation = $product_static->pmp * $valuetoshow; + if(! empty($obj->pmp_expected)) $pmp_expected = $obj->pmp_expected; + else $pmp_expected = $product_static->pmp; + $pmp_valuation = $pmp_expected * $valuetoshow; print ''; - print price($product_static->pmp); + print price($pmp_expected); + print ''; print ''; print ''; print price($pmp_valuation); @@ -1021,10 +1040,10 @@ if ($object->id > 0) { if(! empty($obj->pmp_real)) $pmp_real = $obj->pmp_real; else $pmp_real = $product_static->pmp; $pmp_valuation_real = $pmp_real * $qty_view; - print ''; + print ''; print ''; print ''; - print ''; + print ''; print ''; $totalExpectedValuation += $pmp_valuation; @@ -1043,10 +1062,11 @@ if ($object->id > 0) { print ''; if(!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { //PMP Expected - $pmp_valuation = $product_static->pmp * $valuetoshow; - $pmp_valuation_real = $pmp_real * $obj->qty_view; + if(! empty($obj->pmp_expected)) $pmp_expected = $obj->pmp_expected; + else $pmp_expected = $product_static->pmp; + $pmp_valuation = $pmp_expected * $valuetoshow; print ''; - print price($product_static->pmp); + print price($pmp_expected); print ''; print ''; print price($pmp_valuation); @@ -1056,6 +1076,7 @@ if ($object->id > 0) { print ''; if(! empty($obj->pmp_real)) $pmp_real = $obj->pmp_real; else $pmp_real = $product_static->pmp; + $pmp_valuation_real = $pmp_real * $obj->qty_view; print price($pmp_real); print ''; print ''; @@ -1117,25 +1138,26 @@ if ($object->id > 0) { Date: Mon, 28 Mar 2022 16:02:18 +0200 Subject: [PATCH 6/8] update pmp real even if it's not edit --- htdocs/product/inventory/inventory.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 536aaf7d354..895ff8105cd 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -268,6 +268,8 @@ if (empty($reshook)) { $result = $inventoryline->fetch($lineid); if ($result > 0) { $inventoryline->qty_view = null; // The new value we want + $inventoryline->pmp_real = price2num(GETPOST('realpmp_'.$lineid, 'alpha'), 'MS'); + $inventoryline->pmp_expected = price2num(GETPOST('expectedpmp_'.$lineid, 'alpha'), 'MS'); $resultupdate = $inventoryline->update($user); } } From 67e7c91c3ed34b1c8a0f94c0e5032e4ee7ce8edb Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Mon, 11 Apr 2022 15:47:38 +0200 Subject: [PATCH 7/8] pmp inventory conf MAIN_PRODUCT_PERENTITY_SHARED --- htdocs/product/inventory/inventory.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 2b21de99079..77cdc965164 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -194,6 +194,15 @@ if (empty($reshook)) { setEventMessages($db->lasterror(), null, 'errors'); break; } + if(!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { + $sqlpmp = 'UPDATE '.MAIN_DB_PREFIX.'product_perentity SET pmp = '.((float) $line->pmp_real).' WHERE fk_product = '.((int) $line->fk_product).' AND entity='.$conf->entity; + $resqlpmp = $db->query($sqlpmp); + if (! $resqlpmp) { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + break; + } + } } // Update line with id of stock movement (and the start quantity if it has changed this last recording) From ddb50264aeb5c132ec89aa39c09c074f0b65e234 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 11 Apr 2022 13:58:59 +0000 Subject: [PATCH 8/8] Fixing style errors. --- htdocs/product/inventory/inventory.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 77cdc965164..9cef5671041 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -194,15 +194,15 @@ if (empty($reshook)) { setEventMessages($db->lasterror(), null, 'errors'); break; } - if(!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sqlpmp = 'UPDATE '.MAIN_DB_PREFIX.'product_perentity SET pmp = '.((float) $line->pmp_real).' WHERE fk_product = '.((int) $line->fk_product).' AND entity='.$conf->entity; - $resqlpmp = $db->query($sqlpmp); - if (! $resqlpmp) { - $error++; - setEventMessages($db->lasterror(), null, 'errors'); - break; - } - } + if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { + $sqlpmp = 'UPDATE '.MAIN_DB_PREFIX.'product_perentity SET pmp = '.((float) $line->pmp_real).' WHERE fk_product = '.((int) $line->fk_product).' AND entity='.$conf->entity; + $resqlpmp = $db->query($sqlpmp); + if (! $resqlpmp) { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + break; + } + } } // Update line with id of stock movement (and the start quantity if it has changed this last recording)