-- --------------------------------------------------------
-- Server OS:                    Linux
-- HeidiSQL Version:             12.6.0.6765
-- --------------------------------------------------------



-- Dumping database structure for mutu
USE `mutu`;

-- Dumping structure for trigger mutu.verifikasi_after_update
DROP TRIGGER IF EXISTS `verifikasi_after_update`;
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER `verifikasi_after_update` AFTER UPDATE ON `verifikasi` FOR EACH ROW BEGIN
	IF NEW.STATUS = 0 AND OLD.STATUS = 1 AND OLD.STATUS != NEW.STATUS THEN
		UPDATE data_indikator 
		SET STATUS = 1
		WHERE YEAR(TANGGAL) = YEAR(OLD.PERIODE)
		AND MONTH(TANGGAL) = MONTH(OLD.PERIODE)
		AND RUANGAN = OLD.RUANGAN
		AND `INDIKATOR` = OLD.INDIKATOR;
	END IF;
END//
DELIMITER ;

