Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE OR REPLACE VIEW esq_ceac_planclase.v_syllabus_evaluacion AS
- SELECT DISTINCT dp.idperiodo,
- pa.nombre AS nperiodo,
- mu.iddepartamento,
- mu.idmateria_unica,
- translate(mu.nombre::text, 'áéíóúÁÉÍÓÚäëïöüÄËÏÖÜ'::text, 'aeiouAEIOUaeiouAEIOU'::text) AS nmateria_unica,
- d.nombre AS ndepartamento,
- da.idpersonal AS idpersonal_docente,
- pe.cedula,
- (((COALESCE(pe.apellido1, ''::character varying)::text || ' '::text) || COALESCE(pe.apellido2, ''::character varying)::text) || ' '::text) || COALESCE(pe.nombres, ''::character varying)::text AS docente,
- pe.correo_personal_institucional AS correo,
- 0 AS idconfiguracion,
- 'TEORIA'::character varying AS tipo_configuracion,
- d.idfacultad,
- f.nombre AS nfacultad,
- translate(mu.nombre::text, 'áéíóúÁÉÍÓÚäëïöüÄËÏÖÜ'::text, 'aeiouAEIOUaeiouAEIOU'::text) AS nombre,
- CASE
- WHEN pl.idregistro IS NOT NULL THEN pl.estado
- ELSE 'NE'::text
- END AS estado,
- CASE
- WHEN pl.idregistro IS NOT NULL THEN pl.idregistro
- ELSE 0::numeric
- END AS idsyllabus,
- 0 AS iddistributivo_compartido,
- ((dp.idperiodo::text || abs(mu.idmateria_unica)::text) || da.idpersonal::text)::numeric AS idregistro
- FROM esq_distributivos.distribucion_academica da
- JOIN esq_distributivos.departamento_periodo dp ON dp.id_departamento_periodo = da.iddepartamento_periodo
- JOIN esq_distributivos.departamento_docente dc ON dc.idpersonal = da.idpersonal
- JOIN esq_distributivos.departamento d ON d.iddepartamento = dp.iddepartamento
- JOIN esq_distributivos.materia_unica mu ON mu.idmateria_unica = da.idmateria_unica
- JOIN esq_datos_personales.personal pe ON pe.idpersonal = da.idpersonal
- JOIN esq_periodos_academicos.periodo_academico pa ON pa.idperiodo = dp.idperiodo
- JOIN esq_inscripciones.facultad f ON f.idfacultad = d.idfacultad
- LEFT JOIN esq_ceac_planclase.tbl_syllabus pl ON pl.id_personal = da.idpersonal::numeric AND pl.id_periodo_academico = dp.idperiodo AND pl.id_materia = da.idmateria_unica
- WHERE da.idpersonal > 0 AND mu.idmateria_unica > 0 and da.habilitado = 'S'
- UNION ALL
- SELECT DISTINCT dp.idperiodo,
- pa1.nombre AS nperiodo,
- mc.iddepartamento,
- mc.idmateria_unica,
- ((((mc.nombre::text || ' ('::text) || c.descripcion::text) || ' '::text) || c.numero_horas) || 'HRS. )'::text AS nmateria_unica,
- d1.nombre AS ndepartamento,
- da1.idpersonal AS idpersonal_docente,
- pec.cedula,
- (((COALESCE(pec.apellido1, ''::character varying)::text || ' '::text) || COALESCE(pec.apellido2, ''::character varying)::text) || ' '::text) || COALESCE(pec.nombres, ''::character varying)::text AS docente,
- pec.correo_personal_institucional AS correo,
- da1.idconfiguracion,
- c.descripcion AS tipo_configuracion,
- d1.idfacultad,
- f1.nombre AS nfacultad,
- translate(mc.nombre::text, 'áéíóúÁÉÍÓÚäëïöüÄËÏÖÜ'::text, 'aeiouAEIOUaeiouAEIOU'::text) AS nombre,
- CASE
- WHEN pl.idregistro IS NOT NULL THEN pl.estado
- ELSE 'NE'::text
- END AS estado,
- CASE
- WHEN pl.idregistro IS NOT NULL THEN pl.idregistro
- ELSE 0::numeric
- END AS idsyllabus,
- da1.iddistributivo_compartido,
- (((((dp.idperiodo::text || abs(mc.idmateria_unica)::text) || da1.idpersonal::text) || da1.idconfiguracion::text) || da1.iddistributivo::text) || da1.iddistributivo_compartido::text)::numeric AS idregistro
- FROM esq_distributivos.distribucion_academica dac
- JOIN esq_distributivos.distribucion_academica_compartida da1 ON da1.iddistributivo = dac.iddistributivo AND da1.habilitado::text = 'S'::text
- JOIN esq_distributivos.departamento_docente dc ON dc.idpersonal = da1.idpersonal
- JOIN esq_distributivos.departamento_periodo dp ON dp.id_departamento_periodo = dac.iddepartamento_periodo
- JOIN esq_distributivos.departamento d1 ON d1.iddepartamento = dp.iddepartamento
- JOIN esq_distributivos.materia_unica_compartida_configuracion c ON c.idconfiguracion = da1.idconfiguracion
- JOIN esq_distributivos.materia_unica mc ON mc.idmateria_unica = c.idmateria_unica
- JOIN esq_datos_personales.personal pec ON pec.idpersonal = da1.idpersonal
- JOIN esq_periodos_academicos.periodo_academico pa1 ON pa1.idperiodo = dp.idperiodo
- JOIN esq_inscripciones.facultad f1 ON f1.idfacultad = d1.idfacultad
- LEFT JOIN esq_ceac_planclase.tbl_syllabus pl ON pl.id_personal = da1.idpersonal::numeric AND pl.id_periodo_academico = dp.idperiodo AND pl.id_materia = mc.idmateria_unica
- WHERE da1.idpersonal > 0 AND mc.idmateria_unica > 0 AND c.descripcion::text = 'TEORIA'::text;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement