Skip to content

Instantly share code, notes, and snippets.

@Osukaru
Created August 10, 2011 08:42
Show Gist options
  • Save Osukaru/1136387 to your computer and use it in GitHub Desktop.
Save Osukaru/1136387 to your computer and use it in GitHub Desktop.
CREATE OR REPLACE PROCEDURE MEDICINAV2."MED_EXP_LISTA" (nif IN VARCHAR2,
nuevo_exp IN VARCHAR2,
msg IN VARCHAR2,
dni_original IN VARCHAR2)
IS
smsg VARCHAR2 (100) := NULL;
stramitar VARCHAR2 (1) := NULL;
nro_exp NUMBER (4) := NULL;
nro_doc_borrador NUMBER (2) := NULL;
sid_exp VARCHAR2 (4) := NULL;
s_realizado VARCHAR2 (30) := NULL;
s_emitido VARCHAR2 (2) := NULL;
nro_expediente NUMBER (4) := NULL;
maximo_exp NUMBER;
n_datos NUMBER (3) := NULL;
nro_denegacion NUMBER (3) := NULL;
nif_antiguo VARCHAR2 (15);
id_cert NUMBER (2);
cont NUMBER (2);
id_soli NUMBER (2);
id_dene NUMBER (2);
token VARCHAR2 (20);
s_disabled VARCHAR2 (30) := NULL;
id_exp AV_CERTIFICADOS.ID_EXP%TYPE; --cuando tiene expediente
n_disabled VARCHAR2 (30) := NULL;
nom NUMBER;
--cuando es nuevo expediente
-- Se modifica el cursor para que cuando se trate de un DNI nuevo, se abra directamente un expediente, sin embargo si con el DNI antiguo tiene algun
-- expediente y éste esta abierto no se puede abrir un expediente nuevo. Alvaro Diez Escamilla 04/12/2008
CURSOR c_expediente (vnif VARCHAR2)
IS
SELECT 2 orden,
expediente,
emitido,
solicitud,
estado_solicitud,
fecha_solicitud,
cenmed_solicitud,
medico_solicitud,
otorrino,
estado_otorrino,
fecha_otorrino,
cenmed_otorrino,
medico_otorrino,
oftalmologico,
estado_oftalmologico,
fecha_oftalmologico,
cenmed_oftalmologico,
medico_oftalmologico,
limitacion,
estado_limitacion,
fecha_limitacion,
cenmed_limitacion,
medico_limitacion,
denegacion,
estado_denegacion,
fecha_denegacion,
cenmed_denegacion,
medico_denegacion,
examen,
estado_examen,
fecha_examen,
cenmed_examen,
medico_examen,
cardiologia,
estado_cardiologia,
fecha_cardiologia,
cenmed_cardiologia,
medico_cardiologia,
radiologia,
estado_radiologia,
fecha_radiologia,
cenmed_radiologia,
medico_radiologia,
psiquiatria,
estado_psiquiatria,
fecha_psiquiatria,
cenmed_psiquiatria,
medico_psiquiatria,
psicologia,
estado_psicologia,
fecha_psicologia,
cenmed_psicologia,
medico_psicologia,
laboratorio,
estado_laboratorio,
fecha_laboratorio,
cenmed_laboratorio,
medico_laboratorio,
suspension,
estado_suspension,
fecha_suspension,
cenmed_suspension,
medico_suspension,
x.dni
FROM av_consulta x
WHERE dni IN (SELECT dni
FROM av_pacient_dni_asoc
WHERE dni_antiguo = vnif
UNION
SELECT vnif FROM DUAL)
ORDER BY fecha_solicitud DESC, expediente DESC;
CURSOR c_exp_nombre (
maximo NUMBER
)
IS
SELECT expediente,
solicitud,
otorrino,
oftalmologico,
limitacion,
denegacion,
examen,
cardiologia,
radiologia,
psiquiatria,
psicologia,
laboratorio,
suspension
FROM av_consulta x, av_pacient_dni_asoc z
WHERE z.dni_antiguo(+) = x.dni
AND x.dni = nif
AND x.expediente = maximo
UNION
SELECT DISTINCT (expediente),
solicitud,
otorrino,
oftalmologico,
limitacion,
denegacion,
examen,
cardiologia,
radiologia,
psiquiatria,
psicologia,
laboratorio,
suspension
FROM av_consulta x, av_pacient_dni_asoc z
WHERE x.dni IN
(SELECT DISTINCT (z.dni)
FROM av_pacient_dni_asoc z
WHERE z.dni_antiguo =
(SELECT z.dni_antiguo
FROM AV_PACIENT_DNI_ASOC z
WHERE z.dni = nif))
AND x.expediente = maximo;
v_expediente c_expediente%ROWTYPE;
v_exp_nombre c_exp_nombre%ROWTYPE;
id_sesion RAW (128);
galletita OWA_COOKIE.cookie;
guanderlcander VARCHAR2 (15);
BEGIN
/* Detalle de los expedientes de un paciente */
---para el caso de un nuevo expediente
-- Se realizan estas consultas para saber si el expediente se encuentra abierto, para abrir o no un nuevo expediente.
IF NOT comprueba_cookie ()
THEN
OWA_UTIL.redirect_url ('entrada');
END IF;
--Recuperamos las cookies
galletita := OWA_COOKIE.get ('id_sesion');
id_sesion := galletita.vals (1);
BEGIN
SELECT dni_antiguo
INTO nif_antiguo
FROM av_pacient_dni_asoc
WHERE dni = nif;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
nif_antiguo := '1';
END;
--dni_original:= nif;
SELECT COUNT (id_exp)
INTO id_cert
FROM av_certificados
WHERE dni IN (nif_antiguo, nif)
AND id_exp = (SELECT MAX (id_exp)
FROM av_expedientes
WHERE dni = nif_antiguo OR dni = nif);
SELECT COUNT (id_exp)
INTO id_dene
FROM av_denegacion
WHERE dni IN (nif_antiguo, nif)
AND id_exp = (SELECT MAX (id_exp)
FROM av_expedientes
WHERE dni = nif_antiguo OR dni = nif);
SELECT COUNT (id_exp)
INTO id_soli
FROM av_solicitud
WHERE dni IN (nif_antiguo, nif)
AND id_exp = (SELECT MAX (id_exp)
FROM av_expedientes
WHERE dni = nif_antiguo OR dni = nif);
IF nuevo_exp = 'NUEVO' AND msg = 'T'
THEN
n_disabled := 'disabled="disabled"';
SELECT COUNT ( * )
INTO cont
FROM av_pacient_dni_asoc
WHERE dni = nif;
IF cont > 0
THEN
SELECT NVL (MAX (expediente), 0)
INTO maximo_exp
FROM av_consulta
WHERE dni IN
(SELECT DISTINCT (dni)
FROM av_pacient_dni_asoc
WHERE dni_antiguo = (SELECT dni_antiguo
FROM AV_PACIENT_DNI_ASOC
WHERE dni = nif))
AND dni IN
(SELECT DISTINCT (dni)
FROM av_pacient_dni_asoc
WHERE dni_antiguo =
(SELECT dni_antiguo
FROM AV_PACIENT_DNI_ASOC
WHERE dni = nif));
ELSE
SELECT NVL (MAX (expediente), 0)
INTO maximo_exp
FROM av_consulta
WHERE dni = nif;
END IF;
IF maximo_exp = 0
THEN
nro_expediente := 1;
ELSE
nro_expediente := maximo_exp + 1;
END IF;
s_emitido := 'No';
SELECT MAX (expediente)
INTO cont
FROM av_consulta
WHERE dni = nif;
IF cont > 0
THEN
FOR v_exp_nombre IN c_exp_nombre (maximo_exp)
LOOP
HTP.prn('
<table border="0" width="100%" cellspacing="1" summary="formulario_cabecera">
<tr>
<td width="2%"></td>
<td width="70%"></td>
<td width="28%"></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td></td>
');
HTP.prn(' <td>
<div class="subtituloContenido1">
<p>Fecha Expediente:'
|| v_expediente.fecha_solicitud
|| ' [Emitido a la AMS: '
|| s_emitido
|| ']</p>
</div>
</td>
<td></td>
</tr>
</table>
<div class="archivo">
<table border="0" width="100%" cellspacing="1" summary="formulario_expediente">
<tr>
<td width="4%"></td>
<td width="35%"></td>
<td width="20%"></td>
<td width="20%"></td>
<td width="5%"></td>
<td width="16%"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="texto"><p class="alignCenter"><strong>Documento</strong></p></td>
<td class="texto"><p class="alignCenter"><strong>Estado</strong></p></td>
<td class="texto"><p class="alignCenter"><strong>Fecha</strong></p></td>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td></td>
<td class="texto"><p><strong>'
|| literal_web (UPPER (v_exp_nombre.solicitud))
|| '</strong></p></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td class="alignRight">
<form action="redir_pre_documento" method="post" name="frmDocumento" target="_self">
<input type="hidden" name="nif" value="'
|| nif
|| '" />
<input type="hidden" name="rOpcion" value="'
|| literal_web (UPPER (v_exp_nombre.solicitud))
|| '" />
<input type="hidden" name="idexp" value="'
|| nro_expediente
|| '" />
<input type="hidden" name="dni_original" value="'
|| dni_original
|| '" />
');
SELECT COUNT (nombre)
INTO nom
FROM av_expedientes
WHERE dni = nif
AND id_exp = sid_exp
AND nombre LIKE 'PROCEDE DE IBERIA';
IF nom = 1
THEN
HTP.prn('
<div class="botoneraFuera alignRight">
<input type="submit" class="botonAplicacion" value="Gestionar" title="Gestionar Documento" disabled="disabled"/> />
</div>
');
ELSE
HTP.prn('
<div class="botoneraFuera alignRight">
<input type="submit" class="botonAplicacion" value="Gestionar" title="Gestionar Documento" />
</div>
');
END IF;
HTP.prn('
</form>
</td>
</tr>
</table>
</div>
<div class="archivo">
<table border="0" width="100%" cellspacing="1" summary="formulario_expediente">
<tr>
<td width="4%"></td>
<td width="35%"></td>
<td width="20%"></td>
<td width="20%"></td>
<td width="5%"></td>
<td width="16%"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="texto"><p><strong>'
|| literal_web (UPPER (v_exp_nombre.examen))
|| '</strong></p></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td class="alignRight">
<form action="redir_pre_documento" method="post" name="frmDocumento" target="_self">
<input type="hidden" name="nif" value="'
|| nif
|| '" />
<input type="hidden" name="rOpcion" value="'
|| literal_web (UPPER (v_exp_nombre.examen))
|| '" />
<input type="hidden" name="idexp" value="'
|| nro_expediente
|| '" />
<input type="hidden" name="dni_original" value="'
|| dni_original
|| '" />
<div class="botoneraFuera alignRight">
<input type="submit" class="botonAplicacion" value="Gestionar" title="Gestionar Documento" '
|| n_disabled
|| '/>
</div>
</form>
</td>
</tr>
</table>
</div>
<div class="archivo">
<table border="0" width="100%" cellspacing="1" summary="formulario_expediente">
<tr>
<td width="4%"></td>
<td width="35%"></td>
<td width="20%"></td>
<td width="20%"></td>
<td width="5%"></td>
<td width="16%"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="texto"><p><strong>'
|| literal_web (UPPER (v_exp_nombre.limitacion))
|| '</strong></p></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td class="alignRight">
<form action="redir_pre_documento" method="post" name="frmDocumento" target="_self">
<input type="hidden" name="nif" value="'
|| nif
|| '" />
<input type="hidden" name="rOpcion" value="'
|| literal_web (UPPER (v_exp_nombre.limitacion))
|| '" />
<input type="hidden" name="idexp" value="'
|| nro_expediente
|| '" />
<input type="hidden" name="dni_original" value="'
|| dni_original
|| '" />
<div class="botoneraFuera alignRight">
<input type="submit" class="botonAplicacion" value="Gestionar" title="Gestionar Documento" '
|| n_disabled
|| '/>
</div>
</form>
</td>
</tr>
</table>
</div>
<div class="archivo">
<table border="0" width="100%" cellspacing="1" summary="formulario_expediente">
<tr>
<td width="4%"></td>
<td width="35%"></td>
<td width="20%"></td>
<td width="20%"></td>
<td width="5%"></td>
<td width="16%"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="texto"><p><strong>'
|| literal_web (UPPER (v_exp_nombre.denegacion))
|| '</strong></p></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td class="alignRight">
<form action="redir_pre_documento" method="post" name="frmDocumento" target="_self">
<input type="hidden" name="nif" value="'
|| nif
|| '" />
<input type="hidden" name="rOpcion" value="'
|| literal_web (UPPER (v_exp_nombre.denegacion))
|| '" />
<input type="hidden" name="idexp" value="'
|| nro_expediente
|| '" />
<input type="hidden" name="dni_original" value="'
|| dni_original
|| '" />
<div class="botoneraFuera alignRight">
<input type="submit" class="botonAplicacion" value="Gestionar" title="Gestionar Documento" '
|| n_disabled
|| '/>
</div>
</form>
</td>
</tr>
</table>
</div>
<div class="archivo">
<table border="0" width="100%" cellspacing="1" summary="formulario_expediente">
<tr>
<td width="4%"></td>
<td width="35%"></td>
<td width="20%"></td>
<td width="20%"></td>
<td width="5%"></td>
<td width="16%"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="texto"><p><strong>'
|| literal_web (UPPER (v_exp_nombre.suspension))
|| '</strong></p></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td class="alignRight">
<form action="redir_pre_documento" method="post" name="frmDocumento" target="_self">
<input type="hidden" name="nif" value="'
|| nif
|| '" />
<input type="hidden" name="rOpcion" value="V" />
<input type="hidden" name="idexp" value="'
|| nro_expediente
|| '" />
<input type="hidden" name="dni_original" value="'
|| dni_original
|| '" />
<div class="botoneraFuera alignRight">
<input type="submit" class="botonAplicacion" value="Gestionar" title="Gestionar Documento" '
|| n_disabled
|| '/>
</div>
</form>
</td>
</tr>
</table>
</div>
');
htp.prn('
<div class="archivo">
<table border="0" width="100%" cellspacing="1" summary="formulario_expediente">
<tr>
<td width="4%"></td>
<td width="35%"></td>
<td width="20%"></td>
<td width="20%"></td>
<td width="5%"></td>
<td width="16%"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="texto"><p><strong>'
|| literal_web (UPPER (v_exp_nombre.otorrino))
|| '</strong></p></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td class="alignRight">
<form action="redir_pre_documento" method="post" name="frmDocumento" target="_self">
<input type="hidden" name="nif" value="'
|| nif
|| '" />
<input type="hidden" name="rOpcion" value="'
|| literal_web (UPPER (v_exp_nombre.otorrino))
|| '" />
<input type="hidden" name="idexp" value="'
|| nro_expediente
|| '" />
<input type="hidden" name="dni_original" value="'
|| dni_original
|| '" />
<div class="botoneraFuera alignRight">
<input type="submit" class="botonAplicacion" value="Gestionar" title="Gestionar Documento" '
|| n_disabled
|| '/>
</div>
</form>
</td>
</tr>
</table>
</div>
<div class="archivo">
<table border="0" width="100%" cellspacing="1" summary="formulario_expediente">
<tr>
<td width="4%"></td>
<td width="35%"></td>
<td width="20%"></td>
<td width="20%"></td>
<td width="5%"></td>
<td width="16%"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="texto"><p><strong>'
|| literal_web (UPPER (v_exp_nombre.oftalmologico))
|| '</strong></p></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td class="alignRight">
<form action="redir_pre_documento" method="post" name="frmDocumento" target="_self">
<input type="hidden" name="nif" value="'
|| nif
|| '" />
<input type="hidden" name="rOpcion" value="'
|| literal_web (UPPER (v_exp_nombre.oftalmologico))
|| '" />
<input type="hidden" name="idexp" value="'
|| nro_expediente
|| '" />
<input type="hidden" name="dni_original" value="'
|| dni_original
|| '" />
<div class="botoneraFuera alignRight">
<input type="submit" class="botonAplicacion" value="Gestionar" title="Gestionar Documento" '
|| n_disabled
|| '/>
</div>
</form>
</td>
</tr>
</table>
</div>
<div class="archivo">
<table border="0" width="100%" cellspacing="1" summary="formulario_expediente">
<tr>
<td width="4%"></td>
<td width="35%"></td>
<td width="20%"></td>
<td width="20%"></td>
<td width="5%"></td>
<td width="16%"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="texto"><p><strong>'
|| literal_web (UPPER (v_exp_nombre.cardiologia))
|| '</strong></p></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td class="alignRight">
<form action="redir_pre_documento" method="post" name="frmDocumento" target="_self">
<input type="hidden" name="nif" value="'
|| nif
|| '" />
<input type="hidden" name="rOpcion" value="'
|| literal_web (UPPER (v_exp_nombre.cardiologia))
|| '" />
<input type="hidden" name="idexp" value="'
|| nro_expediente
|| '" />
<input type="hidden" name="dni_original" value="'
|| dni_original
|| '" />
<div class="botoneraFuera alignRight">
<input type="submit" class="botonAplicacion" value="Gestionar" title="Gestionar Documento" '
|| n_disabled
|| '/>
</div>
</form>
</td>
</tr>
</table>
</div>
<div class="archivo">
<table border="0" width="100%" cellspacing="1" summary="formulario_expediente">
<tr>
<td width="4%"></td>
<td width="35%"></td>
<td width="20%"></td>
<td width="20%"></td>
<td width="5%"></td>
<td width="16%"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="texto"><p><strong>'
|| literal_web (UPPER (v_exp_nombre.radiologia))
|| '</strong></p></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td class="alignRight">
<form action="redir_pre_documento" method="post" name="frmDocumento" target="_self">
<input type="hidden" name="nif" value="'
|| nif
|| '" />
<input type="hidden" name="rOpcion" value="'
|| literal_web (UPPER (v_exp_nombre.radiologia))
|| '" />
<input type="hidden" name="idexp" value="'
|| nro_expediente
|| '" />
<input type="hidden" name="dni_original" value="'
|| dni_original
|| '" />
<div class="botoneraFuera alignRight">
<input type="submit" class="botonAplicacion" value="Gestionar" title="Gestionar Documento" '
|| n_disabled
|| '/>
</div>
</form>
</td>
</tr>
</table>
</div>
<div class="archivo">
<table border="0" width="100%" cellspacing="1" summary="formulario_expediente">
<tr>
<td width="4%"></td>
<td width="35%"></td>
<td width="20%"></td>
<td width="20%"></td>
<td width="5%"></td>
<td width="16%"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="texto"><p><strong>'
|| literal_web (UPPER (v_exp_nombre.psiquiatria))
|| '</strong></p></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td class="alignRight">
<form action="redir_pre_documento" method="post" name="frmDocumento" target="_self">
<input type="hidden" name="nif" value="'
|| nif
|| '" />
<input type="hidden" name="rOpcion" value="'
|| literal_web (UPPER (v_exp_nombre.psiquiatria))
|| '" />
<input type="hidden" name="idexp" value="'
|| nro_expediente
|| '" />
<input type="hidden" name="dni_original" value="'
|| dni_original
|| '" />
<div class="botoneraFuera alignRight">
<input type="submit" class="botonAplicacion" value="Gestionar" title="Gestionar Documento" '
|| n_disabled
|| '/>
</div>
</form>
</td>
</tr>
</table>
</div>
<div class="archivo">
<table border="0" width="100%" cellspacing="1" summary="formulario_expediente">
<tr>
<td width="4%"></td>
<td width="35%"></td>
<td width="20%"></td>
<td width="20%"></td>
<td width="5%"></td>
<td width="16%"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="texto"><p><strong>'
|| literal_web (UPPER (v_exp_nombre.psicologia))
|| '</strong></p></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td class="alignRight">
<form action="redir_pre_documento" method="post" name="frmDocumento" target="_self">
<input type="hidden" name="nif" value="'
|| nif
|| '" />
<input type="hidden" name="rOpcion" value="'
|| literal_web (UPPER (v_exp_nombre.psicologia))
|| '" />
<input type="hidden" name="idexp" value="'
|| nro_expediente
|| '" />
<input type="hidden" name="dni_original" value="'
|| dni_original
|| '" />
<div class="botoneraFuera alignRight">
<input type="submit" class="botonAplicacion" value="Gestionar" title="Gestionar Documento" '
|| n_disabled
|| '/>
</div>
</form>
</td>
</tr>
</table>
</div>
<div class="archivo">
<table border="0" width="100%" cellspacing="1" summary="formulario_expediente">
<tr>
<td width="4%"></td>
<td width="35%"></td>
<td width="20%"></td>
<td width="20%"></td>
<td width="5%"></td>
<td width="16%"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="texto"><p><strong>'
|| literal_web (UPPER (v_exp_nombre.laboratorio))
|| '</strong></p></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td class="alignRight">
<form action="redir_pre_documento" method="post" name="frmDocumento" target="_self">
<input type="hidden" name="nif" value="'
|| nif
|| '" />
<input type="hidden" name="rOpcion" value="'
|| literal_web (UPPER (v_exp_nombre.laboratorio))
|| '" />
<input type="hidden" name="idexp" value="'
|| nro_expediente
|| '" />
<input type="hidden" name="dni_original" value="'
|| dni_original
|| '" />
<div class="botoneraFuera alignRight">
<input type="submit" class="botonAplicacion" value="Gestionar" title="Gestionar Documento" '
|| n_disabled
|| '/>
</div>
</form>
</td>
</tr>
</table>
</div>
');
END LOOP;
END IF;
HTP.prn ('
<br /><br />
');
END IF;
--Aqui se hace la comparación si no tiene DNI ANTIGUO y el numero de certificado es igual al numero del informe de la solicitud, quiere decir que
-- se puede crear un nuevo expediente, en caso contrario no se abrira un expediente hasta que este cerrado correctamente.
/* LISTA LOS EXPEDIENTES QUE EXISTEN */
--no me fio de esto
BEGIN
SELECT dni_antiguo
INTO guanderlcander
FROM av_pacient_dni_asoc
WHERE dni = nif;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
guanderlcander := nif;
END;
FOR v_expediente IN c_expediente (guanderlcander)
LOOP
IF v_expediente.expediente = 0
THEN
SELECT COUNT (id_exp)
INTO id_cert
FROM AV_EXPEDIENTES
WHERE dni IN (SELECT dni
FROM av_pacient_dni_asoc
WHERE dni_antiguo = guanderlcander
UNION
SELECT guanderlcander FROM DUAL);
id_cert := id_cert + 1;
ELSE
id_cert := v_expediente.expediente;
END IF;
SELECT COUNT (nombre)
INTO nom
FROM av_expedientes
WHERE dni = guanderlcander
AND id_exp = v_expediente.expediente
AND nombre LIKE 'PROCEDE DE IBERIA';
IF nom = '0' THEN
HTP.prn('
<table border="0" width="100%" cellspacing="1" summary="formulario_cabecera">
<tr>
<td width="2%"></td>
<td width="70%"></td>
<td width="29%"></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>
<div class="subtituloContenido1">
');
IF v_expediente.emitido IS NULL OR v_expediente.emitido = 'N'
THEN
s_emitido := 'No';
ELSE
s_emitido := 'Si';
END IF;
HTP.prn('
<p>Fecha Expediente:&nbsp;'
|| v_expediente.fecha_solicitud
|| '&nbsp;&nbsp; [Emitido a la AMS: &nbsp;'
|| s_emitido
|| ']</p>
</div>
</td>
<td class="alignRight">
');
maximo_exp := 0;
sid_exp := id_cert;
SELECT MAX (expediente)
INTO maximo_exp
FROM av_consulta
WHERE dni = nif;
SELECT COUNT ( * )
INTO n_datos
FROM av_certificados
WHERE dni = nif AND id_exp = maximo_exp;
SELECT COUNT ( * )
INTO nro_denegacion
FROM av_denegacion
WHERE dni = nif AND id_exp = sid_exp; --maximo_exp;
IF nro_denegacion = 0
THEN
HTP.prn('
<form action="redir_pre_certif" method="post" name="frmTramitar">
<input type="hidden" name="nif" value="'
|| v_expediente.dni
|| '" />
<input type="hidden" name="idexp" value="'
|| sid_exp
|| '" />
<input type="hidden" name="dni_original" value="'
|| dni_original
|| '" />
<input type="hidden" name="origen" value="E" />
<div class="botoneraFuera alignRight">
<input type="submit" class="botonAplicacion" value="Certificado" title="Tramitar Certificado" />
</div>
</form>
');
END IF;
HTP.prn('
</td>
</tr>
</table>
');
HTP.prn('
<div class="archivo">
<table border="0" width="100%" cellspacing="1" summary="formulario_expediente">
<tr>
<td width="4%"></td>
<td width="35%"></td>
<td width="20%"></td>
<td width="20%"></td>
<td width="5%"></td>
<td width="16%"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="texto"><p class="alignCenter"><strong>Documento</strong></p></td>
<td class="texto"><p class="alignCenter"><strong>Estado</strong></p></td>
<td class="texto"><p class="alignCenter"><strong>Fecha</strong></p></td>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="texto"><p><strong>'
|| literal_web (UPPER (v_expediente.solicitud))
|| '</strong></p></td>
');
IF v_expediente.estado_solicitud = 'NO REALIZADO'
THEN
HTP.prn( ' <td class="texto"><p>'
|| s_realizado
|| '</p></td> ');
ELSE
HTP.prn(' <td class="texto"><p class="alignCenter">'
|| v_expediente.estado_solicitud
|| '</p></td> ');
END IF;
HTP.prn('
<td class="texto"><p class="alignCenter">'
|| TO_CHAR (v_expediente.fecha_solicitud, 'DD/MM/YYYY')
|| '</p></td>
<td>&nbsp;</td>
<td class="alignRight">
<form action="redir_pre_documento" method="post" name="frmDocumento" target="_self">
<input type="hidden" name="nif" value="'
|| v_expediente.dni
|| '" />
<input type="hidden" name="rOpcion" value="'
|| literal_web (v_expediente.solicitud)
|| '" />
<input type="hidden" name="idexp" value="'
|| sid_exp
|| '" />
<input type="hidden" name="dni_original" value="'
|| dni_original
|| '" />
');
SELECT COUNT (nombre)
INTO nom
FROM av_expedientes
WHERE dni = nif
AND id_exp = sid_exp
AND nombre LIKE 'PROCEDE DE IBERIA';
IF nom = 1
THEN
HTP.prn('
<div class="botoneraFuera alignRight">
<input type="submit" class="botonAplicacion" value="Gestionar" title="Gestionar Documento" disabled="disabled" />
</div>
</form>
</td>
</tr>
');
ELSE
HTP.prn('
<div class="botoneraFuera alignRight">
<input type="submit" class="botonAplicacion" value="Gestionar" title="Gestionar Documento" />
</div>
</form>
</td>
</tr>
');
END IF;
IF v_expediente.estado_solicitud != 'NO REALIZADO'
THEN
HTP.prn('
<tr>
<td></td>
<td colspan="3" class="texto">
<p>M&eacute;dico: '
|| v_expediente.medico_solicitud
|| '</p>
<p>Centro: '
|| v_expediente.cenmed_solicitud
|| '</p>
</td>
</tr>
');
END IF;
HTP.prn('
</table>
</div>
');
s_disabled := NULL;
IF v_expediente.estado_solicitud = 'BORRADOR'
OR v_expediente.estado_otorrino = 'BORRADOR'
OR v_expediente.estado_oftalmologico = 'BORRADOR'
OR v_expediente.estado_cardiologia = 'BORRADOR'
OR v_expediente.estado_radiologia = 'BORRADOR'
OR v_expediente.estado_psiquiatria = 'BORRADOR'
OR v_expediente.estado_psicologia = 'BORRADOR'
OR v_expediente.estado_laboratorio = 'BORRADOR'
OR v_expediente.estado_solicitud = 'NO REALIZADO'
THEN
s_disabled := 'disabled="disabled"';
END IF;
HTP.prn('
<div class="archivo">
<table border="0" width="100%" cellspacing="1" summary="formulario_expediente">
<tr>
<td width="4%"></td>
<td width="35%"></td>
<td width="20%"></td>
<td width="20%"></td>
<td width="5%"></td>
<td width="16%"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="texto"><p><strong>'
|| literal_web (UPPER (v_expediente.examen))
|| '</strong></p></td>
');
IF v_expediente.estado_examen = 'NO REALIZADO'
THEN
HTP.prn( ' <td class="texto"><p>'
|| s_realizado
|| '</p></td> ');
ELSE
HTP.prn(' <td class="texto"><p class="alignCenter">'
|| v_expediente.estado_examen
|| '</p></td> ');
END IF;
HTP.prn('
<td class="texto"><p class="alignCenter">'
|| TO_CHAR (v_expediente.fecha_examen, 'DD/MM/YYYY')
|| '</p></td>
<td>&nbsp;</td>
<td class="alignRight">
<form action="redir_pre_documento" method="post" name="frmDocumento" target="_self">
<input type="hidden" name="nif" value="'
|| v_expediente.dni
|| '" />
<input type="hidden" name="rOpcion" value="'
|| literal_web (v_expediente.examen)
|| '" />
<input type="hidden" name="idexp" value="'
|| sid_exp
|| '" />
<input type="hidden" name="dni_original" value="'
|| dni_original
|| '" />
<div class="botoneraFuera alignRight">
<input type="submit" class="botonAplicacion" value="Gestionar" title="Gestionar Documento" '
|| s_disabled
|| '/>
</div>
</form>
</td>
</tr>
');
IF v_expediente.estado_examen != 'NO REALIZADO'
THEN
HTP.prn('
<tr>
<td></td>
<td colspan="3" class="texto">
<p>M&eacute;dico: '
|| v_expediente.medico_examen
|| '</p>
<p>Centro: '
|| v_expediente.cenmed_examen
|| '</p>
</td>
</tr>
');
END IF;
HTP.prn('
</table>
</div>
');
s_disabled := NULL;
IF v_expediente.estado_solicitud = 'BORRADOR'
OR v_expediente.estado_otorrino = 'BORRADOR'
OR v_expediente.estado_oftalmologico = 'BORRADOR'
OR v_expediente.estado_cardiologia = 'BORRADOR'
OR v_expediente.estado_radiologia = 'BORRADOR'
OR v_expediente.estado_psiquiatria = 'BORRADOR'
OR v_expediente.estado_psicologia = 'BORRADOR'
OR v_expediente.estado_laboratorio = 'BORRADOR'
OR v_expediente.estado_solicitud = 'NO REALIZADO'
THEN
s_disabled := 'disabled="disabled"';
END IF;
HTP.prn('
<div class="archivo">
<table border="0" width="100%" cellspacing="1" summary="formulario_expediente">
<tr>
<td width="4%"></td>
<td width="35%"></td>
<td width="20%"></td>
<td width="20%"></td>
<td width="5%"></td>
<td width="16%"></td>
</tr>
<tr>
<td></td>
<td class="texto"><p><strong>'
|| literal_web (UPPER (v_expediente.limitacion))
|| '</strong></p></td>
');
IF v_expediente.estado_limitacion = 'NO REALIZADO'
THEN
IF (TRIM (v_expediente.estado_examen) = 'APROBADO')
THEN
s_disabled := 'disabled="disabled"';
END IF;
HTP.prn( ' <td class="texto"><p>'
|| s_realizado
|| '</p></td> ');
ELSE
HTP.prn(' <td class="texto"><p class="alignCenter">'
|| v_expediente.estado_limitacion
|| '</p></td> ');
END IF;
HTP.prn('
<td class="texto"><p class="alignCenter">'
|| TO_CHAR (v_expediente.fecha_limitacion, 'DD/MM/YYYY')
|| '</p></td>
<td>&nbsp;</td>
<td class="alignRight">
<form action="redir_pre_documento" method="post" name="frmDocumento" target="_self">
<input type="hidden" name="nif" value="'
|| v_expediente.dni
|| '" />
<input type="hidden" name="rOpcion" value="'
|| literal_web (v_expediente.limitacion)
|| '" />
<input type="hidden" name="idexp" value="'
|| sid_exp
|| '" />
<input type="hidden" name="dni_original" value="'
|| dni_original
|| '" />
<div class="botoneraFuera alignRight">
<input type="submit" class="botonAplicacion" value="Gestionar" title="Gestionar Documento" '
|| s_disabled
|| ' />
</div>
</form>
</td>
</tr>
');
IF v_expediente.estado_limitacion != 'NO REALIZADO'
THEN
HTP.prn('
<tr>
<td></td>
<td colspan="3" class="texto">
<p>M&eacute;dico: '
|| v_expediente.medico_limitacion
|| '</p><br />
<p>Centro: '
|| v_expediente.cenmed_limitacion
|| '</p>
</td>
</tr>
');
END IF;
HTP.prn('
</table>
</div>
');
s_disabled := NULL;
IF v_expediente.estado_solicitud = 'BORRADOR'
OR v_expediente.estado_otorrino = 'BORRADOR'
OR v_expediente.estado_oftalmologico = 'BORRADOR'
OR v_expediente.estado_cardiologia = 'BORRADOR'
OR v_expediente.estado_radiologia = 'BORRADOR'
OR v_expediente.estado_psiquiatria = 'BORRADOR'
OR v_expediente.estado_psicologia = 'BORRADOR'
OR v_expediente.estado_laboratorio = 'BORRADOR'
OR v_expediente.estado_solicitud = 'NO REALIZADO'
THEN
s_disabled := 'disabled="disabled"';
END IF;
HTP.prn('
<div class="archivo">
<table border="0" width="100%" cellspacing="1" summary="formulario_expediente">
<tr>
<td width="4%"></td>
<td width="35%"></td>
<td width="20%"></td>
<td width="20%"></td>
<td width="5%"></td>
<td width="16%"></td>
</tr>
<tr>
<td></td>
<td class="texto"><p><strong>'
|| literal_web (UPPER (v_expediente.denegacion))
|| '</strong></p></td>
');
IF v_expediente.estado_denegacion = 'NO REALIZADO'
THEN
IF (TRIM (v_expediente.estado_examen) = 'APROBADO')
THEN
s_disabled := 'disabled="disabled"';
END IF;
HTP.prn( ' <td class="texto"><p>'
|| s_realizado
|| '</p></td> ');
ELSE
HTP.prn(' <td class="texto"><p class="alignCenter">'
|| v_expediente.estado_denegacion
|| '</p></td> ');
END IF;
HTP.prn('
<td class="texto"><p class="alignCenter">'
|| TO_CHAR (v_expediente.fecha_denegacion, 'DD/MM/YYYY')
|| '</p></td>
<td>&nbsp;</td>
<td class="alignRight">
<form action="redir_pre_documento" method="post" name="frmDocumento" target="_self">
<input type="hidden" name="nif" value="'
|| v_expediente.dni
|| '" />
<input type="hidden" name="rOpcion" value="'
|| literal_web (v_expediente.denegacion)
|| '" />
<input type="hidden" name="idexp" value="'
|| sid_exp
|| '" />
<input type="hidden" name="dni_original" value="'
|| dni_original
|| '" />
<div class="botoneraFuera alignRight">
<input type="submit" class="botonAplicacion" value="Gestionar" title="Gestionar Documento" '
|| s_disabled
|| ' />
</div>
</form>
</td>
</tr>
');
IF v_expediente.estado_denegacion != 'NO REALIZADO'
THEN
HTP.prn('
<tr>
<td></td>
<td colspan="3" class="texto">
<p>M&eacute;dico: '
|| v_expediente.medico_denegacion
|| '</p>
<p>Centro: '
|| v_expediente.cenmed_denegacion
|| '</p>
</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
');
END IF;
HTP.prn('
</table>
</div>
');
s_disabled := NULL;
IF v_expediente.estado_solicitud = 'BORRADOR'
OR v_expediente.estado_otorrino = 'BORRADOR'
OR v_expediente.estado_oftalmologico = 'BORRADOR'
OR v_expediente.estado_cardiologia = 'BORRADOR'
OR v_expediente.estado_radiologia = 'BORRADOR'
OR v_expediente.estado_psiquiatria = 'BORRADOR'
OR v_expediente.estado_psicologia = 'BORRADOR'
OR v_expediente.estado_laboratorio = 'BORRADOR'
OR v_expediente.estado_solicitud = 'NO REALIZADO'
THEN
s_disabled := 'disabled="disabled"';
END IF;
HTP.prn('
<div class="archivo">
<table border="0" width="100%" cellspacing="1" summary="formulario_expediente">
<tr>
<td width="4%"></td>
<td width="35%"></td>
<td width="20%"></td>
<td width="20%"></td>
<td width="5%"></td>
<td width="16%"></td>
</tr>
<tr>
<td></td>
<td class="texto"><p><strong>'
|| literal_web (UPPER (v_expediente.suspension))
|| '</strong></p></td>
');
IF v_expediente.estado_suspension = 'NO REALIZADO'
THEN
IF (TRIM (v_expediente.estado_examen) = 'APROBADO')
THEN
s_disabled :=NULL;
ELSE
s_disabled := 'disabled="disabled"';
END IF;
HTP.prn( ' <td class="texto"><p>'
|| s_realizado
|| '</p></td> ');
ELSE
HTP.prn(' <td class="texto"><p class="alignCenter">'
|| v_expediente.estado_suspension
|| '</p></td> ');
END IF;
IF CONTROL_FECHAS_SUSP(nif,sid_exp)= TRUE THEN
s_disabled:=NULL;
ELSE
s_disabled:='disabled="disabled"';
END IF;
HTP.prn('
<td class="texto"><p class="alignCenter">'
|| TO_CHAR (v_expediente.fecha_suspension, 'DD/MM/YYYY')
|| '</p></td>
<td>&nbsp;</td>
<td class="alignRight">
<form action="redir_pre_suspension" method="post" name="frmDocumento" target="_self">
<input type="hidden" name="nif" value="'
|| v_expediente.dni
|| '" />
<input type="hidden" name="rOpcion" value="V" />
<input type="hidden" name="idexp" value="'
|| sid_exp
|| '" />
<input type="hidden" name="dni_original" value="'
|| dni_original
|| '" />
<div class="botoneraFuera alignRight">
<input type="submit" class="botonAplicacion" value="Gestionar" title="Gestionar Documento" '
|| s_disabled
|| ' />
</div>
</form>
</td>
</tr>
');
IF v_expediente.estado_suspension != 'NO REALIZADO'
THEN
HTP.prn('
<tr>
<td></td>
<td colspan="3" class="texto">
<p>M&eacute;dico: '
|| v_expediente.medico_suspension
|| '</p>
<p>Centro: '
|| v_expediente.cenmed_suspension
|| '</p>
</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
');
END IF;
HTP.prn('
</table>
</div>
');
/*--------------------------------------------------------*/
s_disabled := NULL;
HTP.prn('
<div class="archivo">
<table border="0" width="100%" cellspacing="1" summary="formulario_expediente">
<tr>
<td width="4%"> </td>
<td width="35%"></td>
<td width="20%"></td>
<td width="20%"></td>
<td width="5%"> </td>
<td width="16%"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="texto"><p><strong>'
|| literal_web (UPPER (v_expediente.otorrino))
|| '</strong></p></td>
');
IF v_expediente.estado_otorrino = 'NO REALIZADO'
THEN
IF (TRIM (v_expediente.estado_examen) = 'APROBADO')
OR (TRIM (v_expediente.estado_examen) = 'BORRADOR')
OR (TRIM (v_expediente.estado_solicitud) = 'NO REALIZADO')
THEN
s_disabled := 'disabled="disabled"';
END IF;
HTP.prn( ' <td class="texto"><p>'
|| s_realizado
|| '</p></td> ');
ELSE
HTP.prn(' <td class="texto"><p class="alignCenter">'
|| v_expediente.estado_otorrino
|| '</p></td> ');
END IF;
HTP.prn('
<td class="texto"><p class="alignCenter">'
|| TO_CHAR (v_expediente.fecha_otorrino, 'DD/MM/YYYY')
|| '</p></td>
<td>&nbsp;</td>
<td class="alignRight">
<form action="redir_pre_documento" method="post" name="frmDocumento" target="_self">
<input type="hidden" name="nif" value="'
|| v_expediente.dni
|| '" />
<input type="hidden" name="rOpcion" value="'
|| literal_web (v_expediente.otorrino)
|| '" />
<input type="hidden" name="idexp" value="'
|| sid_exp
|| '" />
<input type="hidden" name="dni_original" value="'
|| dni_original
|| '" />
<div class="botoneraFuera alignRight">
<input type="submit" class="botonAplicacion" value="Gestionar" title="Gestionar Documento" '
|| s_disabled
|| ' />
</div>
</form>
</td>
</tr>
');
IF v_expediente.estado_otorrino != 'NO REALIZADO'
THEN
HTP.prn('
<tr>
<td></td>
<td colspan="3" class="texto">
<p>M&eacute;dico: '
|| v_expediente.medico_otorrino
|| '</p>
<p>Centro: '
|| v_expediente.cenmed_otorrino
|| '</p>
</td>
</tr>
');
END IF;
HTP.prn('
</table>
</div>
');
s_disabled := NULL;
HTP.prn('
<div class="archivo">
<table border="0" width="100%" cellspacing="1" summary="formulario_expediente">
<tr>
<td width="4%"></td>
<td width="35%"></td>
<td width="20%"></td>
<td width="20%"></td>
<td width="5%"></td>
<td width="16%"></td>
</tr>
<tr>
<td></td>
<td class="texto"><p><strong>'
|| literal_web (UPPER (v_expediente.oftalmologico))
|| '</strong></p></td>
');
IF v_expediente.estado_oftalmologico = 'NO REALIZADO'
THEN
IF (TRIM (v_expediente.estado_examen) = 'APROBADO')
OR (TRIM (v_expediente.estado_examen) = 'BORRADOR')
OR (TRIM (v_expediente.estado_solicitud) = 'NO REALIZADO')
THEN
s_disabled := 'disabled="disabled"';
END IF;
HTP.prn( ' <td class="texto"><p>'
|| s_realizado
|| '</p></td> ');
ELSE
HTP.prn(' <td class="texto"><p class="alignCenter">'
|| v_expediente.estado_oftalmologico
|| '</p></td> ');
END IF;
HTP.prn('
<td class="texto"><p class="alignCenter">'
|| TO_CHAR (v_expediente.fecha_oftalmologico, 'DD/MM/YYYY')
|| '</p></td>
<td>&nbsp;</td>
<td class="alignRight">
<form action="redir_pre_documento" method="post" name="frmDocumento" target="_self">
<input type="hidden" name="nif" value="'
|| v_expediente.dni
|| '" />
<input type="hidden" name="rOpcion" value="'
|| literal_web (v_expediente.oftalmologico)
|| '" />
<input type="hidden" name="idexp" value="'
|| sid_exp
|| '" />
<input type="hidden" name="dni_original" value="'
|| dni_original
|| '" />
<div class="botoneraFuera alignRight">
<input type="submit" class="botonAplicacion" value="Gestionar" title="Gestionar Documento" '
|| s_disabled
|| ' />
</div>
</form>
</td>
</tr>
');
IF v_expediente.estado_oftalmologico != 'NO REALIZADO'
THEN
HTP.prn('
<tr>
<td>&nbsp;</td>
<td colspan="3" class="texto">
<p>M&eacute;dico: '
|| v_expediente.medico_oftalmologico
|| '</p>
<p>Centro: '
|| v_expediente.cenmed_oftalmologico
|| '</p>
</td>
</tr>
');
END IF;
---
HTP.prn('
</table>
</div>
');
s_disabled := NULL;
HTP.prn('
<div class="archivo">
<table border="0" width="100%" cellspacing="1" summary="formulario_expediente">
<tr>
<td width="4%"></td>
<td width="35%"></td>
<td width="20%"></td>
<td width="20%"></td>
<td width="5%"></td>
<td width="16%"></td>
</tr>
<tr>
<td></td>
<td class="texto"><p><strong>'
|| literal_web (UPPER (v_expediente.cardiologia))
|| '</strong></p></td>
');
IF v_expediente.estado_cardiologia = 'NO REALIZADO'
THEN
IF (TRIM (v_expediente.estado_examen) = 'APROBADO')
OR (TRIM (v_expediente.estado_examen) = 'BORRADOR')
OR (TRIM (v_expediente.estado_solicitud) = 'NO REALIZADO')
THEN
s_disabled := 'disabled="disabled"';
END IF;
HTP.prn( ' <td class="texto"><p>'
|| s_realizado
|| '</p></td> ');
ELSE
HTP.prn(' <td class="texto"><p class="alignCenter">'
|| v_expediente.estado_cardiologia
|| '</p></td> ');
END IF;
HTP.prn('
<td class="texto"><p class="alignCenter">'
|| TO_CHAR (v_expediente.fecha_cardiologia, 'DD/MM/YYYY')
|| '</p></td>
<td>&nbsp;</td>
<td class="alignRight">
<form action="redir_pre_documento" method="post" name="frmDocumento" target="_self">
<input type="hidden" name="nif" value="'
|| v_expediente.dni
|| '" />
<input type="hidden" name="rOpcion" value="'
|| literal_web (v_expediente.cardiologia)
|| '" />
<input type="hidden" name="idexp" value="'
|| sid_exp
|| '" />
<input type="hidden" name="dni_original" value="'
|| dni_original
|| '" />
<div class="botoneraFuera alignRight">
<input type="submit" class="botonAplicacion" value="Gestionar" title="Gestionar Documento" '
|| s_disabled
|| ' />
</div>
</form>
</td>
</tr>
');
IF v_expediente.estado_cardiologia != 'NO REALIZADO'
THEN
HTP.prn('
<tr>
<td></td>
<td colspan="3" class="texto">
<p>M&eacute;dico: '
|| v_expediente.medico_cardiologia
|| '</p>
<p>Centro: '
|| v_expediente.cenmed_cardiologia
|| '</p>
</td>
</tr>
');
END IF;
HTP.prn('
</table>
</div>
');
s_disabled := NULL;
HTP.prn('
<div class="archivo">
<table border="0" width="100%" cellspacing="1" summary="formulario_expediente">
<tr>
<td width="4%"></td>
<td width="35%"></td>
<td width="20%"></td>
<td width="20%"></td>
<td width="5%"></td>
<td width="16%"></td>
</tr>
<tr>
<td></td>
<td class="texto"><p><strong>'
|| literal_web (UPPER (v_expediente.radiologia))
|| '</strong></p></td>
');
IF v_expediente.estado_radiologia = 'NO REALIZADO'
THEN
IF (TRIM (v_expediente.estado_examen) = 'APROBADO')
OR (TRIM (v_expediente.estado_examen) = 'BORRADOR')
OR (TRIM (v_expediente.estado_solicitud) = 'NO REALIZADO')
THEN
s_disabled := 'disabled="disabled"';
END IF;
HTP.prn( ' <td class="texto"><p>'
|| s_realizado
|| '</p></td> ');
ELSE
HTP.prn(' <td class="texto"><p class="alignCenter">'
|| v_expediente.estado_radiologia
|| '</p></td> ');
END IF;
HTP.prn('
<td class="texto"><p class="alignCenter">'
|| TO_CHAR (v_expediente.fecha_radiologia, 'DD/MM/YYYY')
|| '</p></td>
<td>&nbsp;</td>
<td class="alignRight">
<form action="redir_pre_documento" method="post" name="frmDocumento" target="_self">
<input type="hidden" name="nif" value="'
|| v_expediente.dni
|| '" />
<input type="hidden" name="rOpcion" value="'
|| literal_web (v_expediente.radiologia)
|| '" />
<input type="hidden" name="idexp" value="'
|| sid_exp
|| '" />
<input type="hidden" name="dni_original" value="'
|| dni_original
|| '" />
<div class="botoneraFuera alignRight">
<input type="submit" class="botonAplicacion" value="Gestionar" title="Gestionar Documento" '
|| s_disabled
|| ' />
</div>
</form>
</td>
</tr>
');
IF v_expediente.estado_radiologia != 'NO REALIZADO'
THEN
HTP.prn('
<tr>
<td></td>
<td colspan="3" class="texto">
<p>M&eacute;dico: '
|| v_expediente.medico_radiologia
|| '</p>
<p>Centro: '
|| v_expediente.cenmed_radiologia
|| '</p>
</td>
</tr>
');
END IF;
----
HTP.prn('
</table>
</div>
');
s_disabled := NULL;
HTP.prn('
<div class="archivo">
<table border="0" width="100%" cellspacing="1" summary="formulario_expediente">
<tr>
<td width="4%"></td>
<td width="35%"></td>
<td width="20%"></td>
<td width="20%"></td>
<td width="5%"></td>
<td width="16%"></td>
</tr>
<tr>
<td></td>
<td class="texto"><p><strong>'
|| literal_web (UPPER (v_expediente.psiquiatria))
|| '</strong></p></td>
');
IF v_expediente.estado_psiquiatria = 'NO REALIZADO'
THEN
IF (TRIM (v_expediente.estado_examen) = 'APROBADO')
OR (TRIM (v_expediente.estado_examen) = 'BORRADOR')
OR (TRIM (v_expediente.estado_solicitud) = 'NO REALIZADO')
THEN
s_disabled := 'disabled="disabled"';
END IF;
HTP.prn( ' <td class="texto"><p>'
|| s_realizado
|| '</p></td> ');
ELSE
HTP.prn(' <td class="texto"><p class="alignCenter">'
|| v_expediente.estado_psiquiatria
|| '</p></td> ');
END IF;
HTP.prn('
<td class="texto"><p class="alignCenter">'
|| TO_CHAR (v_expediente.fecha_psiquiatria, 'DD/MM/YYYY')
|| '</p></td>
<td>&nbsp;</td>
<td class="alignRight">
<form action="redir_pre_documento" method="post" name="frmDocumento" target="_self">
<input type="hidden" name="nif" value="'
|| v_expediente.dni
|| '" />
<input type="hidden" name="rOpcion" value="'
|| literal_web (v_expediente.psiquiatria)
|| '" />
<input type="hidden" name="idexp" value="'
|| sid_exp
|| '" />
<input type="hidden" name="dni_original" value="'
|| dni_original
|| '" />
<div class="botoneraFuera alignRight">
<input type="submit" class="botonAplicacion" value="Gestionar" title="Gestionar Documento" '
|| s_disabled
|| ' />
</div>
</form>
</td>
</tr>
');
IF v_expediente.estado_psiquiatria != 'NO REALIZADO'
THEN
HTP.prn('
<tr>
<td></td>
<td colspan="3" class="texto">
<p>M&eacute;dico: '
|| v_expediente.medico_psiquiatria
|| '</p><br />
<p>Centro: '
|| v_expediente.cenmed_psiquiatria
|| '</p>
</td>
</tr>
');
END IF;
---
HTP.prn('
</table>
</div>
');
s_disabled := NULL;
HTP.prn('
<div class="archivo">
<table border="0" width="100%" cellspacing="1" summary="formulario_expediente">
<tr>
<td width="4%"></td>
<td width="35%"></td>
<td width="20%"></td>
<td width="20%"></td>
<td width="5%"></td>
<td width="16%"></td>
</tr>
<tr>
<td></td>
<td class="texto"><p><strong>'
|| literal_web (UPPER (v_expediente.psicologia))
|| '</strong></p></td>
');
IF v_expediente.estado_psicologia = 'NO REALIZADO'
THEN
IF (TRIM (v_expediente.estado_examen) = 'APROBADO')
OR (TRIM (v_expediente.estado_examen) = 'BORRADOR')
OR (TRIM (v_expediente.estado_solicitud) = 'NO REALIZADO')
THEN
s_disabled := 'disabled="disabled"';
END IF;
HTP.prn( ' <td class="texto"><p>'
|| s_realizado
|| '</p></td> ');
ELSE
HTP.prn(' <td class="texto"><p class="alignCenter">'
|| v_expediente.estado_psicologia
|| '</p></td> ');
END IF;
HTP.prn('
<td class="texto"><p class="alignCenter">'
|| TO_CHAR (v_expediente.fecha_psicologia, 'DD/MM/YYYY')
|| '</p></td>
<td>&nbsp;</td>
<td class="alignRight">
<form action="redir_pre_documento" method="post" name="frmDocumento" target="_self">
<input type="hidden" name="nif" value="'
|| v_expediente.dni
|| '" />
<input type="hidden" name="rOpcion" value="'
|| literal_web (v_expediente.psicologia)
|| '" />
<input type="hidden" name="idexp" value="'
|| sid_exp
|| '" />
<input type="hidden" name="dni_original" value="'
|| dni_original
|| '" />
<div class="botoneraFuera alignRight">
<input type="submit" class="botonAplicacion" value="Gestionar" title="Gestionar Documento" '
|| s_disabled
|| ' />
</div>
</form>
</td>
</tr>
');
IF v_expediente.estado_psicologia != 'NO REALIZADO'
THEN
HTP.prn('
<tr>
<td></td>
<td colspan="3" class="texto">
<p>M&eacute;dico: '
|| v_expediente.medico_psicologia
|| '</p><br />
<p>Centro: '
|| v_expediente.cenmed_psicologia
|| '</p>
</td>
</tr>
');
END IF;
----
HTP.prn('
</table>
</div>
');
s_disabled := NULL;
HTP.prn('
<div class="archivo">
<table border="0" width="100%" cellspacing="1" summary="formulario_expediente">
<tr>
<td width="4%"></td>
<td width="35%"></td>
<td width="20%"></td>
<td width="20%"></td>
<td width="5%"></td>
<td width="16%"></td>
</tr>
<tr>
<td></td>
<td class="texto"><p><strong>'
|| literal_web (UPPER (v_expediente.laboratorio))
|| '</strong></p></td>
');
IF v_expediente.estado_laboratorio = 'NO REALIZADO'
THEN
IF (TRIM (v_expediente.estado_examen) = 'APROBADO')
OR (TRIM (v_expediente.estado_examen) = 'BORRADOR')
OR (TRIM (v_expediente.estado_solicitud) = 'NO REALIZADO')
THEN
s_disabled := 'disabled="disabled"';
END IF;
HTP.prn( ' <td class="texto"><p>'
|| s_realizado
|| '</p></td> ');
ELSE
HTP.prn(' <td class="texto"><p class="alignCenter">'
|| v_expediente.estado_laboratorio
|| '</p></td> ');
END IF;
HTP.prn('
<td class="texto"><p class="alignCenter">'
|| TO_CHAR (v_expediente.fecha_laboratorio, 'DD/MM/YYYY')
|| '</p></td>
<td>&nbsp;</td>
<td class="alignRight">
<form action="redir_pre_documento" method="post" name="frmDocumento" target="_self">
<input type="hidden" name="nif" value="'
|| v_expediente.dni
|| '" />
<input type="hidden" name="rOpcion" value="'
|| literal_web (v_expediente.laboratorio)
|| '" />
<input type="hidden" name="idexp" value="'
|| sid_exp
|| '" />
<input type="hidden" name="dni_original" value="'
|| dni_original
|| '" />
<div class="botoneraFuera alignRight">
<input type="submit" class="botonAplicacion" value="Gestionar" title="Gestionar Documento" '
|| s_disabled
|| ' />
</div>
</form>
</td>
</tr>
');
IF v_expediente.estado_laboratorio != 'NO REALIZADO'
THEN
HTP.prn('
<tr>
<td></td>
<td colspan="3" class="texto">
<p>M&eacute;dico: '
|| v_expediente.medico_laboratorio
|| '</p><br />
<p>Centro: '
|| v_expediente.cenmed_laboratorio
|| '</p>
</td>
</tr>
');
END IF;
HTP.prn('
</table>
</div>
');END IF;
END LOOP;
HTP.prn( '<input type="hidden" name="dni_original" value="'
|| dni_original
|| '"/>
<br /><br />
');
END med_exp_lista;
/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment