----------------------------INICIO PROCEDIMIENTO ------------------------
IF OBJECT_ID('sp2CES_ALU_ObtenerConfigDetalleByIdConfigTipoCer', 'P') IS NOT NULL
DROP PROC sp2CES_ALU_ObtenerConfigDetalleByIdConfigTipoCer
GO
CREATE PROCEDURE [dbo].[sp2CES_ALU_ObtenerConfigDetalleByIdConfigTipoCer]
(
@idConfigTipoCer INT
/* --------------------------------------------------------------------------------------------------------------
FECHA | AUTOR | DESCRIPCION
05/jul./2017 | Luis Bernal |
--------------------------------------------------------------------------------------------------------------*/
)
AS
BEGIN
SET NOCOUNT ON;
SELECT cccd.iFolio AS idConfigDet
,ISNULL(cp.sNombre, 'TODOS') AS sPlantel
,CASE WHEN cpe.sNombre IS NULL THEN 'TODOS' ELSE (coe.sNombre + ' - ' + cpe.sNombre + ' (' + cpe.sVersion + ')') END AS sPlanEst
,CASE WHEN cccd.sLogoIzq IS NULL THEN CAST(0 AS BIT) ELSE CAST(1 AS BIT) END AS bLogoIzq
,CASE WHEN cccd.sLogoDer IS NULL THEN CAST(0 AS BIT) ELSE CAST(1 AS BIT) END AS bLogoDer
FROM dbo.Ctrl_ConfigCertificadosDet AS cccd
LEFT JOIN dbo.Cat_Planteles AS cp ON cp.idPlantel = cccd.idPlantel
LEFT JOIN dbo.Cat_PlanEstudios AS cpe ON cpe.idPlanEstudios = cccd.idPlanEst
LEFT JOIN dbo.Cat_OfEduc AS coe ON coe.idOfEduc = cpe.idOfEduc
WHERE cccd.idConfgTipoCer = @idConfigTipoCer
END