DROP PROCEDURE DSS_GetTasa
GO

CREATE PROCEDURE DSS_GetTasa
	@id_empr INT,
	@id_mone INT
AS
BEGIN

	DECLARE @tasa NUMERIC(13, 8) = 1,
	        @tasa_empr NUMERIC(13, 8) = 1
	        
	        
	SELECT @tasa = tasa
	FROM SICLAMON WHERE id_mone = @id_mone
	
	SELECT TOP 1 @tasa_empr = tasa 
	FROM       CONTEMPR em
	INNER JOIN SICLAMON mo ON em.id_mone = mo.id_mone
	WHERE em.id_empr = @id_empr
	
	SET @tasa = @tasa / @tasa_empr
		
	SELECT CAST(1 / @tasa AS NUMERIC(18, 2)) tasa

END