2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-01-25 16:33:54 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn2008`.`awb_recibida_afterDelete`
|
2024-01-15 11:31:03 +00:00
|
|
|
AFTER DELETE ON `awb_recibida`
|
|
|
|
FOR EACH ROW
|
|
|
|
IF (SELECT COUNT(*) FROM recibida_iva where recibida_id = OLD.recibida_id) = 0
|
|
|
|
AND
|
|
|
|
(SELECT COUNT(*) FROM recibida_vencimiento where recibida_id = OLD.recibida_id) = 0
|
|
|
|
AND
|
|
|
|
(SELECT contabilizada FROM recibida WHERE id = OLD.recibida_id) = 0
|
|
|
|
THEN
|
|
|
|
DELETE FROM recibida WHERE id = OLD.recibida_id;
|
|
|
|
END IF$$
|
|
|
|
DELIMITER ;
|