feat: refs #6769 Requested changes
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Guillermo Bonet 2024-07-12 07:18:37 +02:00
parent dab386326f
commit 28b6dc901f
1 changed files with 9 additions and 17 deletions

View File

@ -12,24 +12,16 @@ BEGIN
* @vWarehouseFk Id de almacén
* @vDated Fecha a calcular, si es NULL muestra el histórico desde el inventario
*/
DECLARE vDateInventory DATETIME;
DECLARE vLifeScope DATE;
DECLARE vWarehouseInventoryFk INT;
DECLARE vSupplierInventoryFk INT;
DECLARE vDateInventory DATETIME
DEFAULT (
SELECT IF(vDated, uc.mockUtcTime, c.inventoried)
FROM config c
JOIN util.config uc
);
DECLARE vSupplierInventoryFk INT
DEFAULT (SELECT supplierFk FROM inventoryConfig);
SELECT IF(vDated, uc.mockUtcTime, c.inventoried) INTO vDateInventory
FROM config c
JOIN util.config uc;
SELECT vDateInventory - INTERVAL MAX(life) DAY
INTO vLifeScope
FROM itemType;
SELECT warehouseOutFk, supplierFk
INTO vWarehouseInventoryFk, vSupplierInventoryFk
FROM inventoryConfig;
IF NOT vWarehouseInventoryFk OR NOT vSupplierInventoryFk THEN
IF NOT vSupplierInventoryFk OR NOT vDateInventory THEN
CALL util.throw('Config variables are not set');
END IF;