ALTER PROCEDURE [dbo].[sp_remResumenPagoFonasa]
(
@PERIODO INT = 0,
@MES INT = 0,
@ficini INT = 0,
@ficfin INT = 0,
@unineg INT = 0,
@DEP INT = 0,
@SEC INT = 0
)
AS
BEGIN
	SELECT
		SUM(dbo.remValorResultado(periodo,mes,ficha, 36)) AS TotalRemuneracion,
		SUM(dbo.remValorResultado(periodo,mes,ficha, 7)) AS Total7Porc
	FROM
		remTrabajadores
	WHERE
		periodo = @periodo
		AND mes = @MES
		AND	(ficha BETWEEN @ficini AND @ficfin)
		AND (@unineg = 0 or unidadNegocios = @unineg) 
		AND	(@DEP = 0 or departamento = @DEP) 
		AND (@SEC = 0 or seccion = @SEC)
		AND activo = 1
		AND instSalud = 7
END