2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-07-22 09:52:42 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` FUNCTION `vn`.`isLogifloraDay`(vShipped DATE, vWarehouse INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
RETURNS tinyint(1)
|
|
|
|
DETERMINISTIC
|
|
|
|
BEGIN
|
|
|
|
|
|
|
|
DECLARE vIsLogifloraDay BOOLEAN;
|
|
|
|
|
|
|
|
SELECT COUNT(*) INTO vIsLogifloraDay
|
|
|
|
FROM edi.warehouseFloramondo wf
|
|
|
|
JOIN vn.floramondoConfig fc
|
|
|
|
WHERE wf.warehouseFk = vWarehouse
|
|
|
|
AND vShipped BETWEEN DATE(TIMESTAMPADD(DAY, wf.travellingDays , fc.nextLanded))
|
|
|
|
AND DATE(TIMESTAMPADD(DAY, wf.travellingDays + wf.dayRange , fc.nextLanded));
|
|
|
|
|
|
|
|
RETURN vIsLogifloraDay;
|
|
|
|
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|