2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-08-20 08:06:10 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`entry_isInventoryOrPrevious`(vSelf INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
RETURNS int(11)
|
|
|
|
DETERMINISTIC
|
|
|
|
BEGIN
|
|
|
|
DECLARE vIsInventoryOrPrevious BOOL;
|
|
|
|
|
|
|
|
SELECT ec.inventorySupplierFk = e.supplierFk OR t.landed < c.inventoried
|
|
|
|
INTO vIsInventoryOrPrevious
|
|
|
|
FROM entry e
|
|
|
|
JOIN travel t ON e.travelFk = t.id
|
|
|
|
JOIN entryConfig ec
|
|
|
|
JOIN config c
|
|
|
|
WHERE e.id = vSelf;
|
|
|
|
|
|
|
|
RETURN vIsInventoryOrPrevious;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|