2024-07-22 09:52:42 +00:00
|
|
|
DELIMITER $$
|
2024-08-20 08:06:10 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`receipt_beforeInsert`
|
2024-07-22 09:52:42 +00:00
|
|
|
BEFORE INSERT ON `receipt`
|
|
|
|
FOR EACH ROW
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
DECLARE vIsAutoConciliated BOOLEAN;
|
|
|
|
|
|
|
|
IF NEW.isConciliate = FALSE THEN
|
|
|
|
SELECT isAutoConciliated INTO vIsAutoConciliated
|
|
|
|
FROM accounting a
|
|
|
|
JOIN accountingType at2 ON at2.id = a.accountingTypeFk
|
|
|
|
WHERE a.id = NEW.bankFk;
|
|
|
|
|
|
|
|
SET NEW.isConciliate = vIsAutoConciliated;
|
|
|
|
END IF;
|
2024-07-22 09:52:42 +00:00
|
|
|
END$$
|
|
|
|
DELIMITER ;
|