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_getCurrency`(vCurrency INT,
|
2024-01-15 11:31:03 +00:00
|
|
|
vSupplierFk INT
|
|
|
|
)
|
|
|
|
RETURNS int(11)
|
|
|
|
NOT DETERMINISTIC
|
|
|
|
READS SQL DATA
|
|
|
|
BEGIN
|
|
|
|
DECLARE vIsDollarAccount BOOL;
|
|
|
|
|
|
|
|
SELECT account LIKE '___4______' INTO vIsDollarAccount
|
|
|
|
FROM vn.supplier WHERE id = vSupplierFk;
|
|
|
|
|
|
|
|
IF vIsDollarAccount THEN
|
|
|
|
RETURN 2;
|
|
|
|
ELSE
|
|
|
|
RETURN vCurrency;
|
|
|
|
END IF;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|