17 lines
351 B
SQL
17 lines
351 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `stock`.`outbound_beforeInsert`
|
|
BEFORE INSERT ON `outbound`
|
|
FOR EACH ROW
|
|
BEGIN
|
|
SET NEW.lack = NEW.quantity;
|
|
SET NEW.isPicked = NEW.isPicked OR NEW.dated < util.VN_CURDATE();
|
|
|
|
CALL visible_log(
|
|
NEW.isPicked,
|
|
NEW.warehouseFk,
|
|
NEW.itemFk,
|
|
-NEW.quantity
|
|
);
|
|
END$$
|
|
DELIMITER ;
|