20 lines
561 B
SQL
20 lines
561 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`isLogifloraDay`(vShipped DATE, vWarehouse INT)
|
|
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 ;
|