
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'WMAN_Modulos_GetInfo') )
DROP PROCEDURE WMAN_Modulos_GetInfo
GO

CREATE PROCEDURE WMAN_Modulos_GetInfo
	@id_modulo  INT,
	@vEliminado BIT
AS
BEGIN
SELECT * FROM Modulo WHERE activo = 1 ORDER BY id_modulo

	SELECT id_modulo, desc_modulo, conexion, base_datos, activo
	FROM Modulo
	ORDER BY id_modulo

END
GO

---------------------------------------------------------------------------------
---------------------------------------------------------------------------------

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'WMAN_Modulos_RepInfo') )
DROP PROCEDURE WMAN_Modulos_RepInfo
GO

CREATE PROCEDURE WMAN_Modulos_RepInfo
AS
BEGIN

	SELECT OP.desc_opc, AP.id_app, AP.desc_app, MO.id_modulo, MO.desc_modulo FROM Opciones OP
	INNER JOIN Aplicaciones AP ON AP.id_app = OP.id_app
	INNER JOIN Modulo MO ON MO.id_modulo = AP.id_modulo
	ORDER BY MO.id_modulo, AP.id_app, OP.id_opc

	RETURN

END
GO