salix/db/changes/10271-wisemen/02-triggerReceipt.sql

18 lines
365 B
MySQL
Raw Normal View History

2021-01-20 12:54:55 +00:00
DROP TRIGGER IF EXISTS vn.receipt_beforInsert;
DELIMITER $$
$$
CREATE TRIGGER receipt_beforInsert
BEFORE INSERT
ON receipt FOR EACH ROW
BEGIN
SELECT isAutoConciliated INTO @isAutoConciliated
FROM accounting a
JOIN accountingType at2 ON at2.id = a.accountingTypeFk
WHERE a.id =NEW.bankFk;
SET NEW.isConciliate = @isAutoConciliated;
END
$$
DELIMITER ;