522 lines
18 KiB
Plaintext
522 lines
18 KiB
Plaintext
{
|
|
------------------------------------------------------------------------
|
|
PROGRAMA : ADPRMT014
|
|
OBJETIVO : Capturar, Modificar, Eliminar registros de la
|
|
Tabla de Los Estudios del Solicitante
|
|
PROGRAMADOR : Ing. Betania Guerrero Perez
|
|
FECHA REALIZACION : Junio 04, 1993
|
|
------------------------------------------------------------------------
|
|
}
|
|
GLOBALS "adprgb000.4gl"
|
|
|
|
MAIN
|
|
DEFER INTERRUPT
|
|
CALL ARG_VAL(1) RETURNING usuarios
|
|
CALL ARG_VAL(2) RETURNING clave
|
|
CALL ARG_VAL(3) RETURNING impresor
|
|
let usuarios = "kpolanco"
|
|
let clave = "RevolutionX3"
|
|
CONNECT to "smarmotech" USER usuarios USING clave
|
|
SELECT a.* INTO p_companias.* FROM companias a
|
|
CALL adprmt014()
|
|
END MAIN
|
|
|
|
FUNCTION adprmt014()
|
|
|
|
CLEAR SCREEN
|
|
OPTIONS
|
|
FORM LINE 8,
|
|
ERROR LINE 24,
|
|
COMMENT LINE 23
|
|
|
|
OPEN FORM adfmmt014 FROM "adfmmt014"
|
|
DISPLAY FORM adfmmt014
|
|
|
|
DISPLAY "adprmt014" AT 4,3 ATTRIBUTE(RED)
|
|
# DISPLAY "Educacion" AT 6,38 ATTRIBUTE(BLACK)
|
|
|
|
DISPLAY "Education" AT 6,38 ATTRIBUTE(BLACK)
|
|
MENU
|
|
ON ACTION nuevo
|
|
|
|
let int_flag = false
|
|
INITIALIZE emplea.* TO NULL
|
|
CALL adpcad014()
|
|
ON ACTION buscar
|
|
let int_flag = false
|
|
CALL adpcmf002()
|
|
ON ACTION Salir
|
|
EXIT MENU
|
|
END MENU
|
|
END FUNCTION
|
|
|
|
FUNCTION adpcad014()
|
|
# WHENEVER ERROR CONTINUE
|
|
## CAPTURA LOS DATOS QUE VA A CONTENER EL REGISTRO
|
|
|
|
LABEL vuelve:
|
|
INPUT BY NAME educacion.cod_sol
|
|
|
|
## VERIFICA QUE EL REGISTRO NO ESTE DUPLICADO Y ADEMAS QUE EL SOLICITANTE
|
|
## EXISTA EN LA TABLA DE DATOS BASICOS
|
|
|
|
AFTER FIELD cod_sol
|
|
IF educacion.cod_sol IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_sol
|
|
ELSE
|
|
SELECT UNIQUE cod_sol INTO educacion.cod_sol FROM adtb00015
|
|
WHERE cod_sol = educacion.cod_sol
|
|
|
|
IF status >= 0 THEN
|
|
IF status != NOTFOUND THEN
|
|
IF educacion.status_t = "E" THEN
|
|
LET numero_msg = 36
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_sol
|
|
END IF
|
|
|
|
DISPLAY BY NAME educacion.cod_sol
|
|
LET numero_msg = 12
|
|
CALL msg(numero_msg)
|
|
LET educacion.cod_sol = NULL
|
|
CLEAR FORM
|
|
NEXT FIELD cod_sol
|
|
END IF
|
|
ELSE
|
|
|
|
IF bandera = 1 THEN
|
|
CLEAR SCREEN
|
|
RETURN
|
|
END IF
|
|
END IF
|
|
|
|
SELECT UNIQUE cod_sol INTO basico.cod_sol FROM adtb00012
|
|
WHERE cod_sol = educacion.cod_sol and
|
|
status_t is null
|
|
|
|
IF STATUS = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_sol
|
|
END IF
|
|
|
|
SELECT nom1_sol,nom2_sol,apell1_sol,apell2_sol
|
|
INTO nombre1,nombre2,apellido1,apellido2
|
|
FROM adtb00012
|
|
WHERE cod_sol = educacion.cod_sol and
|
|
status_t is null
|
|
|
|
LET nombre =
|
|
nombre1 clipped," ",nombre2 clipped," ",apellido1 clipped," ",apellido2 clipped
|
|
DISPLAY BY NAME nombre
|
|
END IF
|
|
|
|
AFTER INPUT
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
RETURN
|
|
END IF
|
|
END INPUT
|
|
|
|
## INTRODUCE LA INFORMACION REFERENTE A LOS ESTUDIOS REALIZADOS
|
|
FOR idx = 1 to 3
|
|
LET arr_educa[idx].nom_inst = NULL
|
|
LET arr_educa[idx].calle = NULL
|
|
LET arr_educa[idx].casa_num = NULL
|
|
LET arr_educa[idx].barrio = NULL
|
|
LET arr_educa[idx].urbanizacion = NULL
|
|
LET arr_educa[idx].cod_educa = NULL
|
|
LET arr_educa[idx].nom_educa = NULL
|
|
LET arr_educa[idx].anos = NULL
|
|
LET arr_educa[idx].ano_term = NULL
|
|
|
|
DISPLAY arr_educa[idx].nom_inst to consart[idx].nom_inst
|
|
DISPLAY arr_educa[idx].calle to consart[idx].calle
|
|
DISPLAY arr_educa[idx].casa_num to consart[idx].casa_num
|
|
DISPLAY arr_educa[idx].barrio to consart[idx].barrio
|
|
DISPLAY arr_educa[idx].urbanizacion to consart[idx].urbanizacion
|
|
DISPLAY arr_educa[idx].cod_educa to consart[idx].cod_educa
|
|
DISPLAY arr_educa[idx].nom_educa to consart[idx].nom_educa
|
|
DISPLAY arr_educa[idx].anos to consart[idx].anos
|
|
DISPLAY arr_educa[idx].ano_term to consart[idx].ano_term
|
|
END FOR
|
|
|
|
INPUT ARRAY arr_educa FROM consart.*
|
|
|
|
## VENTANA QUE BUSCA EL NIVEL DE ESTUDIOS.
|
|
ON KEY (CONTROL-W)
|
|
LET curr1 = arr_curr()
|
|
LET scr_l = scr_line()
|
|
CASE
|
|
WHEN INFIELD (cod_educa)
|
|
CALL busca_educacion()
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
NEXT FIELD cod_educa
|
|
END IF
|
|
IF STATUS = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_educa
|
|
END IF
|
|
SELECT nom_educa INTO nivel.nom_educa FROM adtb00005
|
|
WHERE cod_educa = educacion.cod_educa and
|
|
status_t is null
|
|
|
|
LET arr_educa[curr1].nom_educa = nivel.nom_educa
|
|
LET arr_educa[curr1].cod_educa = req_per.cod_educa
|
|
DISPLAY arr_educa[curr1].cod_educa to consart[scr_l].cod_educa
|
|
DISPLAY arr_educa[curr1].nom_educa to consart[scr_l].nom_educa
|
|
END CASE
|
|
|
|
BEFORE ROW
|
|
LET curr1= arr_curr()
|
|
LET scr_l = scr_line()
|
|
|
|
## VERIFICA QUE EL NIVEL DE EDUCACION EXISTA EN EL CATALOGO DE EDUCACION
|
|
AFTER FIELD cod_educa
|
|
IF arr_educa[curr1].cod_educa IS NOT NULL THEN
|
|
SELECT @nom_educa INTO nivel.nom_educa FROM adtb00005
|
|
WHERE @cod_educa = arr_educa[curr1].cod_educa
|
|
|
|
IF STATUS = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_educa
|
|
END IF
|
|
|
|
LET arr_educa[curr1].nom_educa = nivel.nom_educa
|
|
DISPLAY arr_educa[curr1].nom_educa to consart[scr_l].nom_educa
|
|
END IF
|
|
|
|
AFTER INPUT
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
CLEAR FORM
|
|
RETURN
|
|
END IF
|
|
EXIT INPUT
|
|
END INPUT
|
|
|
|
## SI NO OCURRE NINGUN ERROR DURANTE EL PROCESO SE PROCEDE A ADICIONAR
|
|
## EL REGISTRO
|
|
FOR idx = 1 to arr_count()
|
|
IF arr_educa[idx].nom_inst is not null or
|
|
arr_educa[idx].nom_inst is null THEN
|
|
|
|
INSERT INTO adtb00015 VALUES (educacion.cod_sol,arr_educa[idx].nom_inst,
|
|
arr_educa[idx].calle,arr_educa[idx].casa_num,
|
|
arr_educa[idx].barrio,arr_educa[idx].urbanizacion,
|
|
arr_educa[idx].cod_educa,arr_educa[idx].anos,
|
|
arr_educa[idx].ano_term,null,SUSER_SNAME (),GETDATE (),null,null)
|
|
END IF
|
|
END FOR
|
|
|
|
LET numero_msg = 1
|
|
CALL msg(numero_msg)
|
|
CLEAR FORM
|
|
|
|
IF status < 0 THEN
|
|
|
|
CLEAR FORM
|
|
END IF
|
|
GOTO vuelve
|
|
|
|
END FUNCTION
|
|
|
|
FUNCTION adpcmf014()
|
|
## AQUI SE PREPARA PARA LA CAPTURA DEL CRITERIO DE SELECCION PARA LA
|
|
## MODIFICACION DE REGISTROS
|
|
|
|
DEFINE usuarios RECORD
|
|
us_crea CHAR(9),
|
|
fech_crea LIKE adtb00015.fech_crea
|
|
END RECORD
|
|
|
|
# WHENEVER ERROR CONTINUE
|
|
CONSTRUCT criterio ON cod_sol FROM cod_sol
|
|
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
RETURN
|
|
END IF
|
|
|
|
LET SELEC = " SELECT UNIQUE cod_sol FROM adtb00015 where ",
|
|
" status_t is null and ",
|
|
criterio clipped,
|
|
" ORDER BY 1"
|
|
|
|
PREPARE busca FROM selec
|
|
DECLARE datos SCROLL CURSOR FOR busca
|
|
OPEN datos
|
|
|
|
FETCH FIRST datos INTO educacion.*
|
|
|
|
IF status >= 0 THEN
|
|
IF STATUS = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
RETURN
|
|
END IF
|
|
END IF
|
|
|
|
SELECT nom1_sol,nom2_sol,apell1_sol,apell2_sol
|
|
INTO nombre1,nombre2,apellido1,apellido2
|
|
FROM adtb00012
|
|
WHERE cod_sol = educacion.cod_sol
|
|
LET nombre =
|
|
nombre1 clipped," ",nombre2 clipped," ",apellido1 clipped," ",apellido2 clipped
|
|
|
|
DISPLAY BY NAME educacion.cod_sol,nombre
|
|
|
|
MENU "OPCION"
|
|
COMMAND "Siguiente"
|
|
"Presenta en pantalla el proximo registro encontrado"
|
|
FETCH NEXT datos INTO educacion.*
|
|
IF STATUS = NOTFOUND THEN
|
|
LET numero_msg = 4
|
|
CALL msg(numero_msg)
|
|
END IF
|
|
|
|
SELECT nom1_sol,nom2_sol,apell1_sol,apell2_sol
|
|
INTO nombre1,nombre2,apellido1,apellido2
|
|
FROM adtb00012
|
|
WHERE cod_sol = educacion.cod_sol
|
|
LET nombre =
|
|
nombre1 clipped," ",nombre2 clipped," ",apellido1 clipped," ",apellido2 clipped
|
|
|
|
DISPLAY BY NAME educacion.cod_sol,nombre
|
|
|
|
COMMAND "Anterior"
|
|
"Presenta en pantalla el registro anterior encontrado"
|
|
FETCH PREVIOUS datos INTO educacion.*
|
|
IF STATUS = NOTFOUND THEN
|
|
LET numero_msg = 5
|
|
CALL msg(numero_msg)
|
|
END IF
|
|
|
|
SELECT nom1_sol,nom2_sol,apell1_sol,apell2_sol
|
|
INTO nombre1,nombre2,apellido1,apellido2
|
|
FROM adtb00012
|
|
WHERE cod_sol = educacion.cod_sol
|
|
LET nombre =
|
|
nombre1 clipped," ",nombre2 clipped," ",apellido1 clipped," ",apellido2 clipped
|
|
|
|
DISPLAY BY NAME educacion.cod_sol,nombre
|
|
|
|
COMMAND "Primero"
|
|
"Presenta en pantalla el primer registro encontrado"
|
|
FETCH FIRST datos INTO educacion.*
|
|
SELECT nom1_sol,nom2_sol,apell1_sol,apell2_sol
|
|
INTO nombre1,nombre2,apellido1,apellido2
|
|
FROM adtb00012
|
|
WHERE cod_sol = educacion.cod_sol
|
|
LET nombre =
|
|
nombre1 clipped," ",nombre2 clipped," ",apellido1 clipped," ",apellido2 clipped
|
|
|
|
DISPLAY BY NAME educacion.cod_sol,nombre
|
|
|
|
LET numero_msg = 5
|
|
CALL msg(numero_msg)
|
|
|
|
COMMAND "Ultimo"
|
|
"Presenta en pantalla el ultimo registro encontrado"
|
|
FETCH LAST datos INTO educacion.*
|
|
SELECT nom1_sol,nom2_sol,apell1_sol,apell2_sol
|
|
INTO nombre1,nombre2,apellido1,apellido2
|
|
FROM adtb00012
|
|
WHERE cod_sol = educacion.cod_sol
|
|
LET nombre =
|
|
nombre1 clipped," ",nombre2 clipped," ",apellido1 clipped," ",apellido2 clipped
|
|
|
|
DISPLAY BY NAME educacion.cod_sol,nombre
|
|
|
|
LET numero_msg = 4
|
|
CALL msg(numero_msg)
|
|
|
|
COMMAND "Escoger"
|
|
"<Esc> Actualiza Registro <Ctrl-C> Cancela Operacion"
|
|
|
|
## AQUI SE MODIFICAN LOS CAMPOS DEL ARREGLO
|
|
FOR idx = 1 to 3
|
|
LET arr_educa[idx].nom_inst = NULL
|
|
LET arr_educa[idx].calle = NULL
|
|
LET arr_educa[idx].casa_num = NULL
|
|
LET arr_educa[idx].barrio = NULL
|
|
LET arr_educa[idx].urbanizacion = NULL
|
|
LET arr_educa[idx].cod_educa = NULL
|
|
LET arr_educa[idx].nom_educa = NULL
|
|
LET arr_educa[idx].anos = NULL
|
|
LET arr_educa[idx].ano_term = NULL
|
|
|
|
DISPLAY arr_educa[idx].nom_inst to consart[idx].nom_inst
|
|
DISPLAY arr_educa[idx].calle to consart[idx].calle
|
|
DISPLAY arr_educa[idx].barrio to consart[idx].barrio
|
|
DISPLAY arr_educa[idx].urbanizacion to consart[idx].urbanizacion
|
|
DISPLAY arr_educa[idx].cod_educa to consart[idx].cod_educa
|
|
DISPLAY arr_educa[idx].nom_educa to consart[idx].nom_educa
|
|
DISPLAY arr_educa[idx].anos to consart[idx].anos
|
|
DISPLAY arr_educa[idx].ano_term to consart[idx].ano_term
|
|
END FOR
|
|
|
|
## SE SELECCIONAN LOS CAMPOS DEL ARREGLO
|
|
DECLARE buscando CURSOR FOR
|
|
SELECT a.nom_inst,a.calle,a.casa_num,a.barrio,
|
|
a.urbanizacion,a.cod_educa,c.nom_educa,a.anos,a.ano_term
|
|
FROM adtb00015 a,adtb00012 b,adtb00005 c
|
|
WHERE a.cod_sol = b.cod_sol and
|
|
a.cod_sol = educacion.cod_sol and
|
|
a.cod_educa = c.cod_educa and
|
|
a.status_t is null
|
|
LET idx = 1
|
|
|
|
FOREACH buscando INTO arr_educa[idx].*
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
EXIT FOREACH
|
|
END IF
|
|
LET idx = idx + 1
|
|
END FOREACH
|
|
CALL set_count(idx - 1)
|
|
|
|
INPUT ARRAY arr_educa WITHOUT DEFAULTS FROM consart.*
|
|
|
|
## VENTANA QUE BUSCA EL NIVEL DE ESTUDIOS.
|
|
ON KEY (CONTROL-W)
|
|
LET curr1 = arr_curr()
|
|
LET scr_l = scr_line()
|
|
CASE
|
|
WHEN INFIELD (cod_educa)
|
|
CALL busca_educacion()
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
NEXT FIELD cod_educa
|
|
END IF
|
|
IF STATUS = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_educa
|
|
END IF
|
|
SELECT nom_educa INTO nivel.nom_educa FROM adtb00005
|
|
WHERE cod_educa = educacion.cod_educa and
|
|
status_t is null
|
|
|
|
LET arr_educa[curr1].nom_educa = nivel.nom_educa
|
|
LET arr_educa[curr1].cod_educa = req_per.cod_educa
|
|
DISPLAY arr_educa[curr1].cod_educa to consart[scr_l].cod_educa
|
|
DISPLAY arr_educa[curr1].nom_educa to consart[scr_l].nom_educa
|
|
END CASE
|
|
|
|
BEFORE ROW
|
|
LET curr1 = arr_curr()
|
|
LET scr_l = scr_line()
|
|
|
|
## VERIFICA QUE EL NIVEL DE EDUCACION EXISTA EN EL CATALOGO DE EDUCACION
|
|
AFTER FIELD cod_educa
|
|
IF arr_educa[curr1].cod_educa IS NOT NULL THEN
|
|
SELECT @nom_educa INTO nivel.nom_educa FROM adtb00005
|
|
WHERE @cod_educa = arr_educa[curr1].cod_educa
|
|
|
|
IF STATUS = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_educa
|
|
END IF
|
|
|
|
LET arr_educa[curr1].nom_educa = nivel.nom_educa
|
|
DISPLAY arr_educa[curr1].nom_educa to consart[scr_l].nom_educa
|
|
END IF
|
|
|
|
AFTER INPUT
|
|
IF status < 0 THEN
|
|
|
|
IF bandera = 1 THEN
|
|
LET bandera = 0
|
|
RETURN
|
|
END IF
|
|
END IF
|
|
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
CLEAR FORM
|
|
RETURN
|
|
END IF
|
|
EXIT INPUT
|
|
END INPUT
|
|
|
|
## AQUI SE ACTUALIZAN LOS REGISTROS
|
|
DELETE FROM adtb00015
|
|
WHERE cod_sol = educacion.cod_sol
|
|
|
|
FOR idx = 1 to arr_count()
|
|
IF arr_educa[idx].nom_inst is not null or
|
|
arr_educa[idx].nom_inst is null THEN
|
|
|
|
INSERT INTO adtb00015 VALUES (educacion.cod_sol,arr_educa[idx].nom_inst,
|
|
arr_educa[idx].calle,arr_educa[idx].casa_num,
|
|
arr_educa[idx].barrio,arr_educa[idx].urbanizacion,
|
|
arr_educa[idx].cod_educa,arr_educa[idx].anos,
|
|
arr_educa[idx].ano_term,null,SUSER_SNAME (),GETDATE (),null,null)
|
|
END IF
|
|
END FOR
|
|
|
|
LET numero_msg = 13
|
|
CALL msg(numero_msg)
|
|
|
|
IF status < 0 THEN
|
|
|
|
END IF
|
|
|
|
## AQUI SE ELIMINAN LOS REGISTROS
|
|
COMMAND KEY ("L") "eLiminar"
|
|
UPDATE adtb00015 SET status_t = "E"
|
|
WHERE cod_sol = educacion.cod_sol
|
|
|
|
LET numero_msg = 39
|
|
CALL msg(numero_msg)
|
|
|
|
COMMAND "Retornar"
|
|
"Retorna al menu anterior"
|
|
CLEAR FORM
|
|
|
|
FOR idx = 1 to 3
|
|
LET arr_educa[idx].nom_inst = NULL
|
|
LET arr_educa[idx].calle = NULL
|
|
LET arr_educa[idx].casa_num = NULL
|
|
LET arr_educa[idx].barrio = NULL
|
|
LET arr_educa[idx].urbanizacion = NULL
|
|
LET arr_educa[idx].cod_educa = NULL
|
|
LET arr_educa[idx].nom_educa = NULL
|
|
LET arr_educa[idx].anos = NULL
|
|
LET arr_educa[idx].ano_term = NULL
|
|
|
|
DISPLAY arr_educa[idx].nom_inst to consart[idx].nom_inst
|
|
DISPLAY arr_educa[idx].calle to consart[idx].calle
|
|
DISPLAY arr_educa[idx].casa_num to consart[idx].casa_num
|
|
DISPLAY arr_educa[idx].barrio to consart[idx].barrio
|
|
DISPLAY arr_educa[idx].urbanizacion to consart[idx].urbanizacion
|
|
DISPLAY arr_educa[idx].cod_educa to consart[idx].cod_educa
|
|
DISPLAY arr_educa[idx].nom_educa to consart[idx].nom_educa
|
|
DISPLAY arr_educa[idx].anos to consart[idx].anos
|
|
DISPLAY arr_educa[idx].ano_term to consart[idx].ano_term
|
|
END FOR
|
|
|
|
EXIT MENU
|
|
END MENU
|
|
END FUNCTION
|