-- --------------------------------------------------------
-- Server OS:                    Linux
-- HeidiSQL Version:             11.2.0.6213
-- --------------------------------------------------------

USE mutu;

-- Dumping structure for procedure mutu.kalkulasiDataIndikator
DROP PROCEDURE IF EXISTS `kalkulasiDataIndikator`;
DELIMITER //
CREATE PROCEDURE `kalkulasiDataIndikator`(
	IN `PDTINDIKATOR` INT
)
BEGIN
	DECLARE VNUM, VDNUM INT;
	
	SELECT 
		SUM(ddi.NUM)
		, SUM(ddi.DENUM)
	INTO
		VNUM
		,VDNUM
	FROM
		mutu.data_dasar_indikator ddi
	WHERE ddi.DATA_INDIKATOR = PDTINDIKATOR AND ddi.`STATUS` = 1;
	
	UPDATE data_indikator SET NUM = VNUM, DENUM = VDNUM, DATA_DASAR = 1 WHERE ID = PDTINDIKATOR;
END//
DELIMITER ;

