----------------------------INICIO PROCEDIMIENTO ------------------------
IF OBJECT_ID('sp2CES_ALU_VerificaFoliosByIdConfigTipoCer', 'P') IS NOT NULL
DROP PROC sp2CES_ALU_VerificaFoliosByIdConfigTipoCer
GO
CREATE PROCEDURE [dbo].[sp2CES_ALU_VerificaFoliosByIdConfigTipoCer]
(
@idConfigTipoCer INT
/* --------------------------------------------------------------------------------------------------------------
FECHA | AUTOR | DESCRIPCION
07/jul./2017 | Luis Bernal |
--------------------------------------------------------------------------------------------------------------*/
)
AS
BEGIN
SET NOCOUNT ON;
SELECT DISTINCT cccd.iFolioClaveCer,
COUNT(cfci.iFolio) AS NumFoliosCreados
FROM dbo.Ctrl_ConfigCertificados AS ccc
INNER JOIN dbo.Ctrl_ConfigCertificadosDet AS cccd ON cccd.idConfgTipoCer = ccc.idConfigTipoCer
LEFT JOIN dbo.Ctrl_FormatosCertificadosImpresos AS cfci ON cfci.iFolioClaveCer = cccd.iFolio
WHERE ccc.idConfigTipoCer = @idConfigTipoCer
GROUP BY cccd.iFolioClaveCer
END