-- --------------------------------------------------------
-- Server OS:                    Linux
-- HeidiSQL Version:             11.0.0.5919
-- --------------------------------------------------------


USE laundry;

-- Dumping structure for trigger laundry.kegiatan_laundry_after_update
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER `kegiatan_laundry_after_update` AFTER UPDATE ON `kegiatan_laundry` FOR EACH ROW BEGIN
	IF NEW.STATUS = 2 THEN
		UPDATE laundry.kegiatan_pelipatan lipat
		   SET lipat.STATUS = 2
		 WHERE lipat.KEGIATAN = OLD.ID;
		 
		UPDATE laundry.kegiatan_pencucian cuci
		   SET cuci.STATUS = 2
		 WHERE cuci.KEGIATAN = OLD.ID;
		 
		UPDATE laundry.kegiatan_pengeringan kering
		   SET kering.STATUS = 2
		 WHERE kering.KEGIATAN = OLD.ID;
		 
		UPDATE laundry.kegiatan_penjahitan jahit
		   SET jahit.STATUS = 2
		 WHERE jahit.KEGIATAN = OLD.ID;
		 
		UPDATE laundry.kegiatan_perendaman rendam
		   SET rendam.STATUS = 2
		 WHERE rendam.KEGIATAN = OLD.ID;
	END IF;
END//
DELIMITER ;

