salix/db/routines/vn/triggers/duaTax_beforeInsert.sql

10 lines
263 B
MySQL
Raw Normal View History

DELIMITER $$
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` TRIGGER `vn`.`duaTax_beforeInsert`
BEFORE INSERT ON `duaTax`
FOR EACH ROW
BEGIN
SET NEW.rate = duaTax_getRate(NEW.duaFk, NEW.taxClassFk);
SET NEW.tax = NEW.base * NEW.rate / 100;
END$$
DELIMITER ;