1326 lines
48 KiB
Plaintext
1326 lines
48 KiB
Plaintext
{
|
|
------------------------------------------------------------------
|
|
PROGRAMA : ADPRMT010
|
|
OBJETIVO : Capturar, Modificar, Eliminar registros de la
|
|
Tabla de Requisicion de Personal
|
|
PROGRAMADOR : Ing. Betania Guerrero Perez
|
|
FECHA REALIZACION : Mayo 25, 1993
|
|
------------------------------------------------------------------
|
|
}
|
|
GLOBALS "adprgb000.4gl"
|
|
|
|
DEFINE ultimo_doc INTEGER
|
|
|
|
MAIN
|
|
DEFER INTERRUPT
|
|
CALL ARG_VAL(1) RETURNING usuarios
|
|
CALL ARG_VAL(2) RETURNING clave
|
|
CALL ARG_VAL(3) RETURNING impresor
|
|
CONNECT to "smarmotech" USER usuarios USING clave
|
|
SELECT a.* INTO p_companias.* FROM companias a
|
|
CALL adprmt010()
|
|
END MAIN
|
|
|
|
FUNCTION adprmt010()
|
|
|
|
DEFINE fecha1 CHAR(10)
|
|
DEFINE hora1 CHAR(5)
|
|
LET fecha1 = today using "dd/mm/yyyy"
|
|
LET hora1 = time
|
|
|
|
CLEAR SCREEN
|
|
OPTIONS
|
|
FORM LINE 6,
|
|
ERROR LINE 24,
|
|
COMMENT LINE 23
|
|
|
|
DISPLAY "adprmt010" AT 3,3 ATTRIBUTE (RED)
|
|
DISPLAY "R A Y . O . V A C D O M I N I C A N A, S. A." AT 3,19
|
|
ATTRIBUTE (REVERSE,BLUE)
|
|
DISPLAY fecha1 AT 3,68 ATTRIBUTE (RED)
|
|
DISPLAY "Requisicion de Personal" AT 4,31 ATTRIBUTE (BLACK)
|
|
DISPLAY hora1 AT 4,73 ATTRIBUTE (RED)
|
|
OPEN FORM adfmmt010 FROM "adfmmt010"
|
|
DISPLAY FORM adfmmt010
|
|
|
|
MENU
|
|
ON ACTION nuevo
|
|
|
|
let int_flag = false
|
|
INITIALIZE emplea.* TO NULL
|
|
CALL adpcad010()
|
|
ON ACTION buscar
|
|
let int_flag = FALSE
|
|
|
|
CALL adpcmf010()
|
|
ON ACTION Salir
|
|
EXIT MENU
|
|
END MENU
|
|
|
|
END FUNCTION
|
|
|
|
FUNCTION adpcad010()
|
|
# WHENEVER ERROR CONTINUE
|
|
|
|
LABEL vuelve:
|
|
INPUT BY NAME req_per.fecha,req_per.fech_req,req_per.depart,
|
|
req_per.tipo_req,req_per.razon_vac,req_per.cod_puesto_r,
|
|
req_per.edad_min,req_per.salario_sem,req_per.salario_men,
|
|
req_per.experiencia,req_per.cod_educa
|
|
|
|
## VENTANAS PARA BUSCAR LOS DEPARTAMENTOS, LOS PUESTOS Y LA EDUCACION
|
|
ON ACTION departamento
|
|
CALL busca_depto() RETURNING req_per.depart,depto.nom_dpto
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
NEXT FIELD depart
|
|
END IF
|
|
DISPLAY BY NAME req_per.depart,depto.nom_dpto
|
|
NEXT FIELD razon_vac
|
|
|
|
ON ACTION puesto
|
|
CALL busca_puesto() RETURNING req_per.cod_puesto_r,puesto.funciones
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
NEXT FIELD cod_puesto_r
|
|
END IF
|
|
DISPLAY BY NAME puesto.funciones
|
|
NEXT FIELD edad_min
|
|
|
|
ON ACTION educacion
|
|
CALL busca_educacion() RETURNING req_per.cod_educa,nivel.nom_educa
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
NEXT FIELD cod_educa
|
|
END IF
|
|
|
|
## CAPTURA LOS DATOS QUE VA A CONTENER EL REGISTRO.
|
|
AFTER FIELD num_doc
|
|
IF req_per.num_doc IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD num_doc
|
|
END IF
|
|
|
|
BEFORE FIELD fecha
|
|
LET req_per.fecha = today using "dd/mm/yyyy"
|
|
DISPLAY BY NAME req_per.fecha
|
|
|
|
AFTER FIELD fech_req
|
|
IF req_per.fech_req IS NOT NULL THEN
|
|
IF req_per.fecha > req_per.fech_req THEN
|
|
LET numero_msg = 51
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD fech_req
|
|
END IF
|
|
END IF
|
|
|
|
## VERIFICA QUE EL REGISTRO NO EXISTA EN EL CATALOGO DE REQUISICION DE
|
|
## PERSONAL. SI EXISTE DESPLEGA LOS DATOS DEL REGISTRO EXISTENTE.
|
|
|
|
AFTER FIELD depart
|
|
IF req_per.depart IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD depart
|
|
ELSE
|
|
SELECT UNIQUE num_doc,fecha,fech_req,depart,status_t
|
|
INTO req_per.num_doc,req_per.fecha,req_per.fech_req,
|
|
req_per.depart,p_status FROM adtb00011
|
|
WHERE num_doc = req_per.num_doc and depart = req_per.depart
|
|
|
|
IF status >= 0 THEN
|
|
IF status != NOTFOUND THEN
|
|
IF p_status = "E" THEN
|
|
LET numero_msg = 36
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD num_doc
|
|
END IF
|
|
|
|
DISPLAY BY NAME req_per.*
|
|
LET numero_msg = 12
|
|
CALL msg(numero_msg)
|
|
INITIALIZE req_per.* TO NULL
|
|
CLEAR FORM
|
|
NEXT FIELD num_doc
|
|
END IF
|
|
ELSE
|
|
|
|
IF bandera = 1 THEN
|
|
CLEAR SCREEN
|
|
RETURN
|
|
END IF
|
|
END IF
|
|
|
|
SELECT nom_dpto INTO depto.nom_dpto FROM adtb00001
|
|
WHERE departamento = req_per.depart and status_t is null
|
|
|
|
DISPLAY BY NAME depto.nom_dpto
|
|
END IF
|
|
|
|
AFTER FIELD tipo_req
|
|
IF req_per.tipo_req IS NOT NULL THEN
|
|
IF req_per.tipo_req = 1 THEN
|
|
LET descr = "ADICION"
|
|
END IF
|
|
IF req_per.tipo_req = 2 THEN
|
|
LET descr = "REEMPLAZO"
|
|
END IF
|
|
ELSE
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD tipo_req
|
|
END IF
|
|
DISPLAY BY NAME descr
|
|
|
|
## VERIFICA QUE EL PUESTO Y LAS FUNCIONES DEL PUESTO EXISTAN EN EL
|
|
## CATALOGO DE PUESTOS
|
|
|
|
AFTER FIELD cod_puesto_r
|
|
IF req_per.cod_puesto_r IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_puesto_r
|
|
ELSE
|
|
SELECT @nom_puesto,funciones,funcion1 INTO puesto.nom_puesto,
|
|
puesto.funciones,puesto.funcion1 FROM adtb00004
|
|
WHERE @cod_puesto = req_per.cod_puesto_r and status_t is null
|
|
|
|
IF status >= 0 THEN
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_puesto_r
|
|
END IF
|
|
ELSE
|
|
|
|
IF bandera = 1 THEN
|
|
CLEAR SCREEN
|
|
RETURN
|
|
END IF
|
|
END IF
|
|
DISPLAY BY NAME puesto.nom_puesto,puesto.funciones,
|
|
puesto.funcion1
|
|
END IF
|
|
|
|
AFTER FIELD edad_min
|
|
IF req_per.edad_min IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD edad_min
|
|
END IF
|
|
|
|
AFTER FIELD salario_sem
|
|
IF req_per.salario_sem IS NOT NULL THEN
|
|
NEXT FIELD experiencia
|
|
ELSE
|
|
NEXT FIELD salario_men
|
|
END IF
|
|
|
|
AFTER FIELD experiencia
|
|
IF req_per.experiencia IS NOT NULL THEN
|
|
IF req_per.experiencia = 1 THEN
|
|
LET descrip = "NECESARIA"
|
|
END IF
|
|
IF req_per.experiencia = 2 THEN
|
|
LET descrip = "DESEABLE"
|
|
END IF
|
|
IF req_per.experiencia = 3 THEN
|
|
LET descrip = "NO NECESARIA"
|
|
END IF
|
|
ELSE
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD experiencia
|
|
END IF
|
|
DISPLAY BY NAME descrip
|
|
|
|
## VERIFICA QUE EL NIVEL EDUCATIVO EXISTA EN EL CATALOGO DE NIVELES.
|
|
|
|
AFTER FIELD cod_educa
|
|
IF req_per.cod_educa IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_educa
|
|
ELSE
|
|
SELECT nom_educa INTO nivel.nom_educa FROM adtb00005
|
|
WHERE cod_educa = req_per.cod_educa and status_t is null
|
|
|
|
IF status >= 0 THEN
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_educa
|
|
END IF
|
|
ELSE
|
|
|
|
IF bandera = 1 THEN
|
|
CLEAR SCREEN
|
|
RETURN
|
|
END IF
|
|
END IF
|
|
DISPLAY BY NAME nivel.nom_educa
|
|
END IF
|
|
|
|
AFTER INPUT
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
RETURN
|
|
END IF
|
|
EXIT INPUT
|
|
END INPUT
|
|
|
|
## ESPECIFICA LAS PERICIAS DEL PUESTO Y CHEQUEA QUE LAS PERICIAS EXISTAN
|
|
## EN EL CATALOGO DE PERICIAS.
|
|
|
|
FOR idx = 1 TO arr_per.getLength()
|
|
LET arr_per[idx].cod_pericia = NULL
|
|
LET arr_per[idx].nom_pericia = NULL
|
|
LET arr_per[idx].status_per = NULL
|
|
|
|
END FOR
|
|
|
|
INPUT ARRAY arr_per FROM consart.*
|
|
|
|
## VENTANA QUE BUSCA LAS PERICIAS
|
|
ON KEY (CONTROL-W)
|
|
LET curr1 = arr_curr()
|
|
LET scr_l = scr_line()
|
|
CASE
|
|
WHEN INFIELD (cod_pericia)
|
|
CALL busca_pericia()
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
NEXT FIELD cod_pericia
|
|
END IF
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_pericia
|
|
END IF
|
|
SELECT nom_pericia INTO pericia.nom_pericia FROM adtb00006
|
|
WHERE cod_pericia = arr_per[curr1].cod_pericia and
|
|
status_t is null
|
|
|
|
LET arr_per[curr1].nom_pericia = pericia.nom_pericia
|
|
DISPLAY arr_per[curr1].cod_pericia to consart[scr_l].cod_pericia
|
|
DISPLAY arr_per[curr1].nom_pericia to consart[scr_l].nom_pericia
|
|
LET control = "N"
|
|
CALL repite()
|
|
IF control = "S" THEN
|
|
NEXT FIELD cod_pericia
|
|
END IF
|
|
NEXT FIELD status_per
|
|
END CASE
|
|
|
|
AFTER FIELD cod_pericia
|
|
LET curr1 = arr_curr()
|
|
LET scr_l = scr_line()
|
|
|
|
IF arr_per[curr1].cod_pericia IS NOT NULL THEN
|
|
LET control = "N"
|
|
CALL repite()
|
|
IF control = "S" THEN
|
|
NEXT FIELD cod_pericia
|
|
END IF
|
|
|
|
SELECT nom_pericia INTO pericia.nom_pericia
|
|
FROM adtb00006
|
|
WHERE cod_pericia = arr_per[curr1].cod_pericia and
|
|
status_t is null
|
|
|
|
IF STATUS = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_pericia
|
|
END IF
|
|
LET arr_per[curr1].nom_pericia = pericia.nom_pericia
|
|
DISPLAY arr_per[curr1].nom_pericia to consart[scr_l].nom_pericia
|
|
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
|
|
|
|
## SE INTRODUCEN LOS EMPLEADOS QUE SOLICITAN Y APRUEBAN EL REQUERIMIENTO
|
|
## DEL PERSONAL
|
|
INPUT BY NAME req_per.num_emp,req_per.departamento,req_per.nivel_emp,
|
|
req_per.cod_puesto,req_per.num1_emp,req_per.departamento1,
|
|
req_per.nivel1_emp,req_per.cod1_puesto,req_per.num2_emp,
|
|
req_per.departamento2,req_per.nivel2_emp,req_per.cod2_puesto
|
|
|
|
## VENTANA QUE BUSCA LOS EMPLEADOS
|
|
ON KEY (CONTROL-W)
|
|
CASE
|
|
WHEN INFIELD (num_emp)
|
|
CALL busca_empleado()
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
NEXT FIELD num_emp
|
|
END IF
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD num_emp
|
|
END IF
|
|
|
|
LET empleado = nombre
|
|
LET req_per.num_emp = despl_emp[curr1].num_emp
|
|
LET req_per.departamento = despl_emp[curr1].departamento
|
|
LET req_per.nivel_emp = despl_emp[curr1].nivel_emp
|
|
LET req_per.cod_puesto = despl_emp[curr1].cod_puesto
|
|
|
|
DISPLAY BY NAME req_per.num_emp,req_per.departamento,
|
|
req_per.nivel_emp,req_per.cod_puesto,empleado
|
|
NEXT FIELD num1_emp
|
|
|
|
WHEN INFIELD (num1_emp)
|
|
CALL busca_empleado()
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
NEXT FIELD num1_emp
|
|
END IF
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD num1_emp
|
|
END IF
|
|
|
|
LET empleado1 = nombre
|
|
LET req_per.num1_emp = despl_emp[curr1].num_emp
|
|
LET req_per.departamento1 = despl_emp[curr1].departamento
|
|
LET req_per.nivel1_emp = despl_emp[curr1].nivel_emp
|
|
LET req_per.cod1_puesto = despl_emp[curr1].cod_puesto
|
|
|
|
DISPLAY BY NAME req_per.num1_emp,req_per.departamento1,
|
|
req_per.nivel1_emp,req_per.cod1_puesto,
|
|
empleado1
|
|
NEXT FIELD num2_emp
|
|
|
|
WHEN INFIELD (num2_emp)
|
|
CALL busca_empleado()
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
NEXT FIELD num2_emp
|
|
END IF
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD num2_emp
|
|
END IF
|
|
|
|
LET empleado2 = nombre
|
|
LET req_per.num2_emp = despl_emp[curr1].num_emp
|
|
LET req_per.departamento2 = despl_emp[curr1].departamento
|
|
LET req_per.nivel2_emp = despl_emp[curr1].nivel_emp
|
|
LET req_per.cod2_puesto = despl_emp[curr1].cod_puesto
|
|
|
|
DISPLAY BY NAME req_per.num2_emp,req_per.departamento2,
|
|
req_per.nivel2_emp,req_per.cod2_puesto,
|
|
empleado2
|
|
END CASE
|
|
|
|
## CHEQUEA QUE EL EMPLEADO EXISTA EN LA TABLA DE EMPLEADOS.
|
|
AFTER FIELD num_emp
|
|
IF req_per.num_emp IS NOT NULL THEN
|
|
SELECT departamento,nivel_emp,cod_puesto,nom1_emp,nom2_emp,
|
|
apell1_emp,apell2_emp INTO req_per.departamento,
|
|
req_per.nivel_emp,req_per.cod_puesto,nombre1,nombre2,
|
|
apellido1,apellido2 FROM adtb00003
|
|
WHERE num_emp = req_per.num_emp and status_t is null
|
|
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD num_emp
|
|
END IF
|
|
ELSE
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD num_emp
|
|
END IF
|
|
LET empleado =
|
|
nombre1 clipped," ",nombre2 clipped," ",apellido1 clipped," ",apellido2 clipped
|
|
DISPLAY BY NAME req_per.departamento,req_per.nivel_emp,req_per.cod_puesto,
|
|
empleado
|
|
NEXT FIELD num1_emp
|
|
|
|
## CHEQUEA QUE EL EMPLEADO EXISTA EN LA TABLA DE EMPLEADOS.
|
|
AFTER FIELD num1_emp
|
|
IF req_per.num1_emp IS NOT NULL THEN
|
|
SELECT departamento,nivel_emp,cod_puesto,nom1_emp,nom2_emp,
|
|
apell1_emp,apell2_emp INTO req_per.departamento1,
|
|
req_per.nivel1_emp,req_per.cod1_puesto,nombre3,nombre4,
|
|
apellido3,apellido4 FROM adtb00003
|
|
WHERE num_emp = req_per.num1_emp and status_t is null
|
|
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD num1_emp
|
|
END IF
|
|
ELSE
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD num1_emp
|
|
END IF
|
|
LET empleado1 =
|
|
nombre3 clipped," ",nombre4 clipped," ",apellido3 clipped," ",apellido4 clipped
|
|
DISPLAY BY NAME req_per.departamento1,req_per.nivel1_emp,req_per.cod1_puesto,
|
|
empleado1
|
|
NEXT FIELD num2_emp
|
|
|
|
## CHEQUEA QUE EL EMPLEADO EXISTA EN LA TABLA DE EMPLEADOS.
|
|
AFTER FIELD num2_emp
|
|
IF req_per.num2_emp IS NOT NULL THEN
|
|
SELECT departamento,nivel_emp,cod_puesto,nom1_emp,nom2_emp,
|
|
apell1_emp,apell2_emp INTO req_per.departamento2,
|
|
req_per.nivel2_emp,req_per.cod2_puesto,nombre5,nombre6,
|
|
apellido5,apellido6 FROM adtb00003
|
|
WHERE num_emp = req_per.num2_emp and status_t is null
|
|
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD num2_emp
|
|
END IF
|
|
ELSE
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD num2_emp
|
|
END IF
|
|
LET empleado2 =
|
|
nombre5 clipped," ",nombre6 clipped," ",apellido5 clipped," ",apellido6 clipped
|
|
DISPLAY BY NAME req_per.departamento2,req_per.nivel2_emp,req_per.cod2_puesto,
|
|
empleado2
|
|
EXIT INPUT
|
|
|
|
AFTER INPUT
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
RETURN
|
|
END IF
|
|
END INPUT
|
|
|
|
## SI NO EXISTE NINGUN PROBLEMA EN LA ENTRADA DE INFORMACION SE PROCEDE
|
|
## A INSERTAR EL REGISTRO
|
|
SELECT MAX(a.num_doc) INTO ultimo_doc FROM adtb00011 a
|
|
IF ultimo_doc IS NULL THEN
|
|
LET ultimo_doc = 0
|
|
END IF
|
|
LET req_per.num_doc= ultimo_doc + 1
|
|
|
|
INSERT INTO adtb00011 VALUES (req_per.num_doc,req_per.fecha,
|
|
req_per.fech_req,req_per.depart,req_per.tipo_req,
|
|
req_per.razon_vac,req_per.cod_puesto_r,req_per.edad_min,
|
|
req_per.salario_sem,req_per.salario_men,req_per.experiencia,
|
|
req_per.cod_educa,req_per.num_emp,req_per.departamento,
|
|
req_per.nivel_emp,req_per.cod_puesto,req_per.num1_emp,
|
|
req_per.departamento1,req_per.nivel1_emp,req_per.cod1_puesto,
|
|
req_per.num2_emp,req_per.departamento2,req_per.nivel2_emp,
|
|
req_per.cod2_puesto,null,usuarios,GETDATE(),null,null)
|
|
|
|
FOR idx = 1 to arr_per.getLength()
|
|
IF arr_per[idx].cod_pericia IS NOT NULL THEN
|
|
INSERT INTO adtb00031 VALUES (req_per.num_doc,arr_per[idx].cod_pericia,
|
|
arr_per[idx].status_per)
|
|
END IF
|
|
END FOR
|
|
|
|
LET numero_msg = 1
|
|
CALL msg(numero_msg)
|
|
CLEAR FORM
|
|
|
|
IF status < 0 THEN
|
|
|
|
CLEAR FORM
|
|
END IF
|
|
|
|
|
|
END FUNCTION
|
|
|
|
FUNCTION adpcmf010()
|
|
## 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 adtb00011.fech_crea
|
|
END RECORD
|
|
|
|
# WHENEVER ERROR CONTINUE
|
|
CONSTRUCT criterio ON num_doc FROM adtb00011.num_doc
|
|
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
RETURN
|
|
END IF
|
|
|
|
LET SELEC = " SELECT UNIQUE num_doc,fecha,fech_req,depart, ",
|
|
"tipo_req,razon_vac,cod_puesto_r,edad_min, ",
|
|
"salario_sem,salario_men,experiencia,cod_educa, ",
|
|
"num_emp,departamento,nivel_emp,cod_puesto, ",
|
|
"num1_emp,departamento1,nivel1_emp,cod1_puesto, ",
|
|
"num2_emp,departamento2,nivel2_emp,cod2_puesto ",
|
|
" FROM adtb00011 where ",
|
|
" status_t is null and ",
|
|
criterio clipped,
|
|
" ORDER BY 1,4"
|
|
|
|
PREPARE busca FROM selec
|
|
DECLARE datos SCROLL CURSOR FOR busca
|
|
OPEN datos
|
|
|
|
FETCH FIRST datos INTO req_per.*
|
|
|
|
IF status >= 0 THEN
|
|
IF STATUS = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
RETURN
|
|
END IF
|
|
END IF
|
|
CALL selecciona()
|
|
|
|
MENU "OPCION"
|
|
COMMAND "Siguiente"
|
|
"Presenta en pantalla el proximo registro encontrado"
|
|
FETCH NEXT datos INTO req_per.*
|
|
IF STATUS = NOTFOUND THEN
|
|
LET numero_msg = 4
|
|
CALL msg(numero_msg)
|
|
END IF
|
|
|
|
CALL selecciona()
|
|
|
|
COMMAND "Anterior"
|
|
"Presenta en pantalla el registro anterior encontrado"
|
|
FETCH PREVIOUS datos INTO req_per.*
|
|
IF STATUS = NOTFOUND THEN
|
|
LET numero_msg = 5
|
|
CALL msg(numero_msg)
|
|
END IF
|
|
|
|
CALL selecciona()
|
|
|
|
COMMAND "Primero"
|
|
"Presenta en pantalla el primer registro encontrado"
|
|
FETCH FIRST datos INTO req_per.*
|
|
CALL selecciona()
|
|
|
|
LET numero_msg = 5
|
|
CALL msg(numero_msg)
|
|
|
|
COMMAND "Ultimo"
|
|
"Presenta en pantalla el ultimo registro encontrado"
|
|
FETCH LAST datos INTO req_per.*
|
|
CALL selecciona()
|
|
|
|
LET numero_msg = 4
|
|
CALL msg(numero_msg)
|
|
|
|
COMMAND "Escoger" "<Esc> Actualiza Registro <Ctrl-C> Cancela Operacion"
|
|
IF p_status = "E" THEN
|
|
LET numero_msg = 39
|
|
CALL msg(numero_msg)
|
|
RETURN
|
|
END IF
|
|
|
|
## SELECCIONA LOS CAMPOS DISPONIBLES PARA MODIFICACION
|
|
INPUT BY NAME req_per.fecha,req_per.fech_req,req_per.depart,
|
|
req_per.tipo_req,req_per.razon_vac,req_per.cod_puesto_r,
|
|
req_per.edad_min,req_per.salario_sem,
|
|
req_per.salario_men,req_per.experiencia,
|
|
req_per.cod_educa WITHOUT DEFAULTS
|
|
|
|
## VENTANA QUE BUSCA LOS DEPARTAMENTOS, LOS PUESTOS Y LA EDUCACION
|
|
ON KEY (CONTROL-W)
|
|
CASE
|
|
WHEN INFIELD (depart)
|
|
CALL busca_depto() RETURNING req_per.depart,depto.nom_dpto
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
NEXT FIELD depart
|
|
END IF
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD depart
|
|
END IF
|
|
DISPLAY BY NAME req_per.depart,depto.nom_dpto
|
|
NEXT FIELD tipo_req
|
|
|
|
WHEN INFIELD (cod_puesto_r)
|
|
CALL busca_puesto() RETURNING req_per.cod_puesto_r,puesto.funciones
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
NEXT FIELD cod_puesto_r
|
|
END IF
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_puesto_r
|
|
END IF
|
|
SELECT funciones INTO puesto.funciones FROM adtb00004
|
|
WHERE cod_puesto = req_per.cod_puesto_r
|
|
DISPLAY BY NAME req_per.cod_puesto_r,puesto.nom_puesto,
|
|
puesto.funciones
|
|
NEXT FIELD edad_min
|
|
|
|
WHEN INFIELD (cod_educa)
|
|
CALL busca_educacion() RETURNING req_per.cod_educa,nivel.nom_educa
|
|
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 = req_per.cod_educa
|
|
DISPLAY BY NAME req_per.cod_educa,nivel.nom_educa
|
|
EXIT INPUT
|
|
END CASE
|
|
|
|
## CHEQUE QUE LOS CAMPOS MODIFICABLES NO ESTEN EN BLANCO
|
|
AFTER FIELD fecha
|
|
IF req_per.fecha IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD fecha
|
|
END IF
|
|
|
|
AFTER FIELD fech_req
|
|
IF req_per.fech_req IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD fech_req
|
|
END IF
|
|
|
|
AFTER FIELD depart
|
|
IF req_per.depart IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD depart
|
|
END IF
|
|
|
|
AFTER FIELD tipo_req
|
|
IF req_per.tipo_req IS NOT NULL THEN
|
|
IF req_per.tipo_req = 1 THEN
|
|
LET descr = "ADICION"
|
|
END IF
|
|
IF req_per.tipo_req = 2 THEN
|
|
LET descr = "REEMPLAZO"
|
|
END IF
|
|
ELSE
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD tipo_req
|
|
END IF
|
|
DISPLAY BY NAME descr
|
|
|
|
## VERIFICA QUE EL PUESTO Y LAS FUNCIONES EXISTAN EN EL CATALOGO DE PUESTOS
|
|
AFTER FIELD cod_puesto_r
|
|
IF req_per.cod_puesto_r IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_puesto_r
|
|
ELSE
|
|
SELECT @nom_puesto,funciones,funcion1 INTO puesto.nom_puesto,
|
|
puesto.funciones,puesto.funcion1 FROM adtb00004
|
|
WHERE @cod_puesto = req_per.cod_puesto_r and status_t is null
|
|
|
|
IF status >= 0 THEN
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_puesto_r
|
|
END IF
|
|
ELSE
|
|
|
|
IF bandera = 1 THEN
|
|
CLEAR SCREEN
|
|
RETURN
|
|
END IF
|
|
END IF
|
|
DISPLAY BY NAME puesto.nom_puesto,puesto.funciones,
|
|
puesto.funcion1
|
|
END IF
|
|
|
|
AFTER FIELD edad_min
|
|
IF req_per.edad_min IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD edad_min
|
|
END IF
|
|
|
|
AFTER FIELD salario_sem
|
|
IF req_per.salario_sem IS NOT NULL THEN
|
|
NEXT FIELD experiencia
|
|
ELSE
|
|
NEXT FIELD salario_men
|
|
END IF
|
|
|
|
AFTER FIELD experiencia
|
|
IF req_per.experiencia IS NOT NULL THEN
|
|
IF req_per.experiencia = 1 THEN
|
|
LET descrip = "NECESARIA"
|
|
END IF
|
|
IF req_per.experiencia = 2 THEN
|
|
LET descrip = "DESEABLE"
|
|
END IF
|
|
IF req_per.experiencia = 3 THEN
|
|
LET descrip = "NO NECESARIA"
|
|
END IF
|
|
ELSE
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD experiencia
|
|
END IF
|
|
DISPLAY BY NAME descrip
|
|
|
|
## VERIFICA QUE EL NIVEL EDUCATIVO EXISTA EN EL CATALOGO DE NIVELES
|
|
AFTER FIELD cod_educa
|
|
IF req_per.cod_educa IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_educa
|
|
ELSE
|
|
SELECT nom_educa INTO nivel.nom_educa FROM adtb00005
|
|
WHERE cod_educa = req_per.cod_educa and status_t is null
|
|
|
|
IF status >= 0 THEN
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_educa
|
|
END IF
|
|
ELSE
|
|
|
|
IF bandera = 1 THEN
|
|
CLEAR SCREEN
|
|
RETURN
|
|
END IF
|
|
END IF
|
|
DISPLAY BY NAME nivel.nom_educa
|
|
END IF
|
|
|
|
#### Verifica si el usuario presiono la tecla <Ctrl-C>
|
|
|
|
AFTER INPUT
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
CLEAR FORM
|
|
RETURN
|
|
END IF
|
|
END INPUT
|
|
|
|
## AQUI SE MODIFICAN LAS PERICIAS
|
|
FOR idx = 1 to 3
|
|
LET arr_per[idx].cod_pericia = NULL
|
|
LET arr_per[idx].nom_pericia = NULL
|
|
LET arr_per[idx].status_per = NULL
|
|
|
|
DISPLAY arr_per[idx].cod_pericia to consart[idx].cod_pericia
|
|
DISPLAY arr_per[idx].nom_pericia to consart[idx].nom_pericia
|
|
DISPLAY arr_per[idx].status_per to consart[idx].status_per
|
|
END FOR
|
|
|
|
## SELECCIONA LOS CAMPOS DEL ARREGLO
|
|
DECLARE buscando CURSOR FOR
|
|
SELECT a.cod_pericia,b.nom_pericia,a.status_per
|
|
FROM adtb00011 a,adtb00006 b
|
|
WHERE a.cod_pericia = b.cod_pericia and a.num_doc = req_per.num_doc and
|
|
a.depart = req_per.depart and a.status_t is null
|
|
ORDER BY 1
|
|
|
|
LET idx = 1
|
|
FOREACH buscando INTO arr_per[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_per WITHOUT DEFAULTS FROM consart.*
|
|
|
|
## VENTANA QUE BUSCA LAS PERICIAS
|
|
ON KEY (CONTROL-W)
|
|
LET curr1 = arr_curr()
|
|
LET scr_l = scr_line()
|
|
CASE
|
|
WHEN INFIELD (cod_pericia)
|
|
CALL busca_pericia()
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
NEXT FIELD cod_pericia
|
|
END IF
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_pericia
|
|
END IF
|
|
SELECT nom_pericia INTO pericia.nom_pericia FROM adtb00006
|
|
WHERE cod_pericia = arr_per[curr1].cod_pericia and
|
|
status_t is null
|
|
|
|
LET arr_per[curr1].nom_pericia = pericia.nom_pericia
|
|
DISPLAY arr_per[curr1].cod_pericia to consart[scr_l].cod_pericia
|
|
DISPLAY arr_per[curr1].nom_pericia to consart[scr_l].nom_pericia
|
|
LET control = "N"
|
|
CALL repite()
|
|
IF control = "S" THEN
|
|
NEXT FIELD cod_pericia
|
|
END IF
|
|
NEXT FIELD status_per
|
|
END CASE
|
|
|
|
AFTER FIELD cod_pericia
|
|
LET curr1 = arr_curr()
|
|
LET scr_l = scr_line()
|
|
|
|
IF arr_per[curr1].cod_pericia IS NOT NULL THEN
|
|
LET control = "N"
|
|
CALL repite()
|
|
IF control = "S" THEN
|
|
NEXT FIELD cod_pericia
|
|
END IF
|
|
SELECT nom_pericia INTO pericia.nom_pericia
|
|
FROM adtb00006
|
|
WHERE cod_pericia = arr_per[curr1].cod_pericia and
|
|
status_t is null
|
|
|
|
IF STATUS = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_pericia
|
|
END IF
|
|
LET arr_per[curr1].nom_pericia = pericia.nom_pericia
|
|
DISPLAY arr_per[curr1].nom_pericia to consart[scr_l].nom_pericia
|
|
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 MODIFICAN LAS FIRMAS DEL DOCUMENTO
|
|
INPUT BY NAME req_per.num_emp,req_per.departamento,req_per.nivel_emp,
|
|
req_per.cod_puesto,req_per.num1_emp,req_per.departamento1,
|
|
req_per.nivel1_emp,req_per.cod1_puesto,req_per.num2_emp,
|
|
req_per.departamento2,req_per.nivel2_emp,req_per.cod2_puesto
|
|
WITHOUT DEFAULTS
|
|
|
|
## VENTANA QUE BUSCA LOS EMPLEADOS
|
|
ON KEY (CONTROL-W)
|
|
CASE
|
|
WHEN INFIELD (num_emp)
|
|
CALL busca_empleado()
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
NEXT FIELD num_emp
|
|
END IF
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD num_emp
|
|
END IF
|
|
|
|
LET empleado = nombre
|
|
LET req_per.num_emp = despl_emp[curr1].num_emp
|
|
LET req_per.departamento = despl_emp[curr1].departamento
|
|
LET req_per.nivel_emp = despl_emp[curr1].nivel_emp
|
|
LET req_per.cod_puesto = despl_emp[curr1].cod_puesto
|
|
|
|
DISPLAY BY NAME req_per.num_emp,req_per.departamento,
|
|
req_per.nivel_emp,req_per.cod_puesto,empleado
|
|
NEXT FIELD num1_emp
|
|
|
|
WHEN INFIELD (num1_emp)
|
|
CALL busca_empleado()
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
NEXT FIELD num1_emp
|
|
END IF
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD num1_emp
|
|
END IF
|
|
|
|
LET empleado1 = nombre
|
|
LET req_per.num1_emp = despl_emp[curr1].num_emp
|
|
LET req_per.departamento1 = despl_emp[curr1].departamento
|
|
LET req_per.nivel1_emp = despl_emp[curr1].nivel_emp
|
|
LET req_per.cod1_puesto = despl_emp[curr1].cod_puesto
|
|
|
|
DISPLAY BY NAME req_per.num1_emp,req_per.departamento1,
|
|
req_per.nivel1_emp,req_per.cod1_puesto,
|
|
empleado1
|
|
NEXT FIELD num2_emp
|
|
|
|
WHEN INFIELD (num2_emp)
|
|
CALL busca_empleado()
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
NEXT FIELD num2_emp
|
|
END IF
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD num2_emp
|
|
END IF
|
|
|
|
LET empleado2 = nombre
|
|
LET req_per.num2_emp = despl_emp[curr1].num_emp
|
|
LET req_per.departamento2 = despl_emp[curr1].departamento
|
|
LET req_per.nivel2_emp = despl_emp[curr1].nivel_emp
|
|
LET req_per.cod2_puesto = despl_emp[curr1].cod_puesto
|
|
|
|
DISPLAY BY NAME req_per.num2_emp,req_per.departamento2,
|
|
req_per.nivel2_emp,req_per.cod2_puesto,
|
|
empleado2
|
|
END CASE
|
|
|
|
## CHEQUEA QUE EL EMPLEADO EXISTA EN LA TABLA DE EMPLEADOS.
|
|
AFTER FIELD num_emp
|
|
IF req_per.num_emp IS NOT NULL THEN
|
|
SELECT departamento,nivel_emp,cod_puesto,nom1_emp,nom2_emp,
|
|
apell1_emp,apell2_emp INTO req_per.departamento,
|
|
req_per.nivel_emp,req_per.cod_puesto,nombre1,nombre2,
|
|
apellido1,apellido2 FROM adtb00003
|
|
WHERE num_emp = req_per.num_emp and
|
|
status_t is null
|
|
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD num_emp
|
|
END IF
|
|
ELSE
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD num_emp
|
|
END IF
|
|
LET empleado =
|
|
nombre1 clipped," ",nombre2 clipped," ",apellido1 clipped," ",apellido2 clipped
|
|
DISPLAY BY NAME req_per.departamento,req_per.nivel_emp,req_per.cod_puesto,
|
|
empleado
|
|
NEXT FIELD num1_emp
|
|
|
|
## CHEQUEA QUE EL EMPLEADO EXISTA EN LA TABLA DE EMPLEADOS.
|
|
AFTER FIELD num1_emp
|
|
IF req_per.num1_emp IS NOT NULL THEN
|
|
SELECT departamento,nivel_emp,cod_puesto,nom1_emp,nom2_emp,
|
|
apell1_emp,apell2_emp INTO req_per.departamento1,
|
|
req_per.nivel1_emp,req_per.cod1_puesto,nombre3,nombre4,
|
|
apellido3,apellido4 FROM adtb00003
|
|
WHERE num_emp = req_per.num1_emp and
|
|
status_t is null
|
|
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD num1_emp
|
|
END IF
|
|
ELSE
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD num1_emp
|
|
END IF
|
|
LET empleado1 =
|
|
nombre3 clipped," ",nombre4 clipped," ",apellido3 clipped," ",apellido4 clipped
|
|
DISPLAY BY NAME req_per.departamento1,req_per.nivel1_emp,req_per.cod1_puesto,
|
|
empleado1
|
|
NEXT FIELD num2_emp
|
|
|
|
## CHEQUEA QUE EL EMPLEADO EXISTA EN LA TABLA DE EMPLEADOS.
|
|
AFTER FIELD num2_emp
|
|
IF req_per.num2_emp IS NOT NULL THEN
|
|
SELECT departamento,nivel_emp,cod_puesto,nom1_emp,nom2_emp,
|
|
apell1_emp,apell2_emp INTO req_per.departamento2,
|
|
req_per.nivel2_emp,req_per.cod2_puesto,nombre5,nombre6,
|
|
apellido5,apellido6 FROM adtb00003
|
|
WHERE num_emp = req_per.num2_emp and
|
|
status_t is null
|
|
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD num2_emp
|
|
END IF
|
|
ELSE
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD num2_emp
|
|
END IF
|
|
LET empleado2 =
|
|
nombre5 clipped," ",nombre6 clipped," ",apellido5 clipped," ",apellido6 clipped
|
|
DISPLAY BY NAME req_per.departamento2,req_per.nivel2_emp,req_per.cod2_puesto,
|
|
empleado2
|
|
EXIT INPUT
|
|
|
|
AFTER INPUT
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
RETURN
|
|
END IF
|
|
EXIT INPUT
|
|
END INPUT
|
|
|
|
## AQUI SE REALIZA LA ACTUALIZACION DEL REGISTRO
|
|
DELETE FROM adtb00011
|
|
WHERE num_doc = req_per.num_doc and depart = req_per.depart
|
|
|
|
LET contar = arr_count()
|
|
IF contar > 0 THEN
|
|
FOR idx = 1 to arr_count()
|
|
INSERT INTO adtb00011 VALUES (req_per.num_doc,req_per.fecha,
|
|
req_per.fech_req,req_per.depart,req_per.tipo_req,
|
|
req_per.razon_vac,req_per.cod_puesto_r,req_per.edad_min,
|
|
req_per.salario_sem,req_per.salario_men,req_per.experiencia,
|
|
req_per.cod_educa,arr_per[idx].cod_pericia,
|
|
arr_per[idx].status_per,req_per.num_emp,req_per.departamento,
|
|
req_per.nivel_emp,req_per.cod_puesto,req_per.num1_emp,
|
|
req_per.departamento1,req_per.nivel1_emp,req_per.cod1_puesto,
|
|
req_per.num2_emp,req_per.departamento2,req_per.nivel2_emp,
|
|
req_per.cod2_puesto,null,USER,CURRENT,null,null)
|
|
END FOR
|
|
ELSE
|
|
INSERT INTO adtb00011 VALUES (req_per.num_doc,req_per.fecha,
|
|
req_per.fech_req,req_per.depart,req_per.tipo_req,
|
|
req_per.razon_vac,req_per.cod_puesto_r,req_per.edad_min,
|
|
req_per.salario_sem,req_per.salario_men,req_per.experiencia,
|
|
req_per.cod_educa,null,null,
|
|
req_per.num_emp,req_per.departamento,
|
|
req_per.nivel_emp,req_per.cod_puesto,req_per.num1_emp,
|
|
req_per.departamento1,req_per.nivel1_emp,req_per.cod1_puesto,
|
|
req_per.num2_emp,req_per.departamento2,req_per.nivel2_emp,
|
|
req_per.cod2_puesto,null,USER,CURRENT,null,null)
|
|
END IF
|
|
|
|
LET numero_msg = 13
|
|
CALL msg(numero_msg)
|
|
|
|
IF status < 0 THEN
|
|
|
|
END IF
|
|
|
|
COMMAND KEY ("L") "eLiminar"
|
|
UPDATE adtb00011 SET status_t = "E"
|
|
WHERE num_doc = req_per.num_doc and
|
|
depart = req_per.depart
|
|
|
|
LET numero_msg = 39
|
|
CALL msg(numero_msg)
|
|
|
|
COMMAND "Retornar"
|
|
"Retorna al menu anterior"
|
|
CLEAR FORM
|
|
|
|
FOR idx = 1 to 3
|
|
LET arr_per[idx].cod_pericia = NULL
|
|
LET arr_per[idx].nom_pericia = NULL
|
|
LET arr_per[idx].status_per = NULL
|
|
|
|
DISPLAY arr_per[idx].cod_pericia to consart[idx].cod_pericia
|
|
DISPLAY arr_per[idx].nom_pericia to consart[idx].nom_pericia
|
|
DISPLAY arr_per[idx].status_per to consart[idx].status_per
|
|
END FOR
|
|
|
|
EXIT MENU
|
|
END MENU
|
|
END FUNCTION
|
|
|
|
## VENTANA PARA DESPLEGAR LOS PUESTOS DE LA EMPRESA
|
|
|
|
|
|
## VENTANA PARA DESPLEGAR LAS PERICIAS
|
|
FUNCTION busca_pericia()
|
|
OPEN WINDOW busqueda3 AT 10,10 WITH FORM "adfmwd012"
|
|
ATTRIBUTE (BORDER,FORM LINE FIRST + 2, comment line last)
|
|
CONSTRUCT criterio ON adtb00006.nom_pericia FROM adtb00006.nom_pericia
|
|
|
|
LET selec3 = "SELECT cod_pericia,nom_pericia FROM adtb00006 ",
|
|
" WHERE ",
|
|
" status_t is null AND ",
|
|
criterio clipped,
|
|
"ORDER BY 1 "
|
|
|
|
PREPARE busca3 FROM selec3
|
|
DECLARE local3 CURSOR FOR busca3
|
|
|
|
LET idx = 1
|
|
FOREACH local3 INTO buscar_pericia[idx].*
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
EXIT FOREACH
|
|
END IF
|
|
|
|
LET despl_pericia[idx].cod_pericia = buscar_pericia[idx].cod_pericia
|
|
LET despl_pericia[idx].nom_pericia = buscar_pericia[idx].nom_pericia clipped
|
|
|
|
LET idx = idx + 1
|
|
END FOREACH
|
|
|
|
CALL set_count(idx-1)
|
|
DISPLAY ARRAY despl_pericia TO s_pericia.*
|
|
LET curr = arr_curr()
|
|
LET arr_per[curr1].cod_pericia = despl_pericia[curr].cod_pericia
|
|
LET pericia.nom_pericia = despl_pericia[curr].nom_pericia
|
|
|
|
CLOSE WINDOW busqueda3
|
|
END FUNCTION
|
|
|
|
## VERIFICA QUE NO SE REPITA LA PERICIA DEL PUESTO
|
|
FUNCTION repite()
|
|
DEFINE per_ant RECORD
|
|
cod_pericia SMALLINT
|
|
END RECORD
|
|
|
|
LET per_ant.cod_pericia = arr_per[curr].cod_pericia
|
|
|
|
FOR idx = 1 to arr_count()
|
|
IF idx != curr THEN
|
|
IF arr_per[idx].cod_pericia IS NOT NULL THEN
|
|
IF arr_per[idx].cod_pericia = per_ant.cod_pericia THEN
|
|
LET numero_msg = 135
|
|
CALL msg(numero_msg)
|
|
LET control = "S"
|
|
ELSE
|
|
IF control != "S" THEN
|
|
LET control = "N"
|
|
END IF
|
|
END IF
|
|
END IF
|
|
END IF
|
|
END FOR
|
|
END FUNCTION
|
|
|
|
## SELECCIONA Y DESPLIEGA LOS DATOS DEL REGISTRO ESCOGIDO
|
|
FUNCTION selecciona()
|
|
SELECT nom_dpto INTO depto.nom_dpto FROM adtb00001
|
|
WHERE departamento = req_per.depart
|
|
|
|
SELECT @nom_puesto,funciones,funcion1
|
|
INTO puesto.nom_puesto,puesto.funciones,puesto.funcion1
|
|
FROM adtb00004
|
|
WHERE @cod_puesto = req_per.cod_puesto_r
|
|
|
|
SELECT nom_educa INTO nivel.nom_educa FROM adtb00005
|
|
WHERE cod_educa = req_per.cod_educa
|
|
|
|
SELECT nom1_emp,nom2_emp,apell1_emp,apell2_emp
|
|
INTO nombre1,nombre2,apellido1,apellido2 FROM adtb00003
|
|
WHERE num_emp = req_per.num_emp and
|
|
departamento = req_per.departamento and
|
|
nivel_emp = req_per.nivel_emp and
|
|
cod_puesto = req_per.cod_puesto
|
|
LET empleado =
|
|
nombre1 clipped," ",nombre2 clipped," ",apellido1 clipped," ",apellido2 clipped
|
|
|
|
SELECT nom1_emp,nom2_emp,apell1_emp,apell2_emp
|
|
INTO nombre3,nombre4,apellido3,apellido4 FROM adtb00003
|
|
WHERE num_emp = req_per.num1_emp and
|
|
departamento = req_per.departamento1 and
|
|
nivel_emp = req_per.nivel1_emp and
|
|
cod_puesto = req_per.cod1_puesto
|
|
LET empleado1 =
|
|
nombre3 clipped, " ",nombre4 clipped," ",apellido3 clipped," ",apellido4 clipped
|
|
|
|
SELECT nom1_emp,nom2_emp,apell1_emp,apell2_emp
|
|
INTO nombre5,nombre6,apellido5,apellido6 FROM adtb00003
|
|
WHERE num_emp = req_per.num2_emp and
|
|
departamento = req_per.departamento2 and
|
|
nivel_emp = req_per.nivel2_emp and
|
|
cod_puesto = req_per.cod2_puesto
|
|
LET empleado2 =
|
|
nombre5 clipped," ",nombre6 clipped," ",apellido5 clipped," ",apellido6 clipped
|
|
|
|
IF req_per.tipo_req = 1 THEN
|
|
LET descr = "ADICION"
|
|
END IF
|
|
IF req_per.tipo_req = 2 THEN
|
|
LET descr = "REEMPLAZO"
|
|
END IF
|
|
|
|
IF req_per.experiencia = 1 THEN
|
|
LET descrip = "NECESARIA"
|
|
END IF
|
|
IF req_per.experiencia = 2 THEN
|
|
LET descrip = "DESEABLE"
|
|
END IF
|
|
IF req_per.experiencia = 3 THEN
|
|
LET descrip = "NO NECESARIA"
|
|
END IF
|
|
DISPLAY BY NAME req_per.*,depto.nom_dpto,descr,puesto.nom_puesto,
|
|
puesto.funciones,puesto.funcion1,descrip,nivel.nom_educa,
|
|
empleado,empleado1,empleado2
|
|
|
|
END FUNCTION
|