USE `inventory`;
DROP TRIGGER IF EXISTS `penerimaan_barang_before_update`;
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER `penerimaan_barang_before_update` BEFORE UPDATE ON `penerimaan_barang` FOR EACH ROW BEGIN
	DECLARE VPENYEDIA INT;
	/*
	IF NEW.JENIS = 3 THEN
		SELECT p.ID INTO VPENYEDIA FROM penyedia p WHERE p.REF_ID = NEW.REF_REKANAN LIMIT 1;
		IF FOUND_ROWS() > 0 THEN
			SET NEW.REKANAN = VPENYEDIA;
		END IF;
	END IF;
	*/
END//
DELIMITER ;
SET SQL_MODE=@OLDTMP_SQL_MODE;