659 lines
24 KiB
Plaintext
659 lines
24 KiB
Plaintext
{
|
|
------------------------------------------------------------------------
|
|
PROGRAMA : INPRMT003
|
|
OBJETIVO : Programa Captura, Modifica, Elimina Registros
|
|
Archivo Maestro Sustitutos Materia Prima.
|
|
PROGRAMADOR : Juan Fco. Soto (Johnny)
|
|
FECHA REALIZACION : Julio 27, 1992.
|
|
MOFICADO EN FECHA : Noviembre 13, 2018
|
|
MODIFICADO POR : Juan Soto
|
|
------------------------------------------------------------------------
|
|
}
|
|
GLOBALS
|
|
"inprgb000.4gl"
|
|
|
|
MAIN
|
|
DEFER INTERRUPT
|
|
CALL ARG_VAL(1) RETURNING usuarios
|
|
CALL ARG_VAL(2) RETURNING clave
|
|
CONNECT to "smarmotech" USER usuarios USING clave
|
|
SELECT * INTO p_companias.* FROM companias
|
|
CALL inprmt003()
|
|
END MAIN
|
|
FUNCTION inprmt003()
|
|
CLEAR SCREEN
|
|
OPTIONS
|
|
FORM LINE 8,
|
|
ERROR LINE 23,
|
|
COMMENT LINE 21
|
|
|
|
OPEN FORM infmmt003 FROM "infmmt003"
|
|
DISPLAY FORM infmmt003
|
|
|
|
MENU "OPCIONES"
|
|
COMMAND "Adicionar"
|
|
"<Esc> Adicionar Registro <Ctrl-C> Cancela Operacion"
|
|
LET INT_FLAG = FALSE
|
|
CALL inpcad003()
|
|
COMMAND "Consulta-modificar"
|
|
"<Esc> Realiza Busqueda <Ctrl-C> Cancela Operacion"
|
|
LET INT_FLAG = FALSE
|
|
CALL inpcmf003()
|
|
COMMAND "Salir" "Retorna Menu Anterior"
|
|
EXIT MENU
|
|
END MENU
|
|
END FUNCTION
|
|
|
|
### FUNCION PARA AGREGAR REGISTROS SUSTITUTOS A MAESTRA SUSTITUTOS ###
|
|
|
|
FUNCTION inpcad003()
|
|
WHENEVER ERROR CONTINUE
|
|
CLEAR FORM
|
|
|
|
INPUT BY NAME c_sustituto.*
|
|
|
|
AFTER FIELD cod_sec
|
|
SELECT descrip_esp,descrip_ing
|
|
INTO descrip1,descrip3 FROM iptb00002
|
|
WHERE cod_n = c_sustituto.cod_n and
|
|
cod_grupo = c_sustituto.cod_grupo and
|
|
cod_tipo = c_sustituto.cod_tipo and
|
|
cod_sec = c_sustituto.cod_sec and
|
|
status_t is null
|
|
## CHEQUEA QUE EL CODIGO SE ENCUENTRE EN LA TABLA DE ARTICULOS
|
|
IF status >= 0 THEN
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD COD_N
|
|
END IF
|
|
ELSE
|
|
|
|
END IF
|
|
## DESPLEGA LA DESCRIPCION EN ESPANOL(descrip1) Y EN INGLES(descrip3
|
|
DISPLAY BY NAME descrip1,descrip3 ATTRIBUTE (YELLOW)
|
|
|
|
AFTER FIELD cod_sec_s
|
|
# Cheque que un codigo tenga su equivalencia.
|
|
|
|
SELECT UNIQUE descrip_esp,descrip_ing
|
|
INTO descrip2,descrip4
|
|
FROM iptb00002
|
|
WHERE cod_n = c_sustituto.cod_n_s and
|
|
cod_grupo = c_sustituto.cod_grupo_s and
|
|
cod_tipo = c_sustituto.cod_tipo_s and
|
|
cod_sec = c_sustituto.cod_sec_s and
|
|
status_t is null
|
|
|
|
## CHEQUEA QUE EL CODIGO ESTE EN LA TABLA DE ARTICULOS GRALES.
|
|
IF status >= 0 THEN
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD COD_N_S
|
|
END IF
|
|
ELSE
|
|
CALL integridad()
|
|
|
|
IF bandera = 1 THEN
|
|
LET bandera = 0
|
|
RETURN
|
|
END IF
|
|
END IF
|
|
|
|
SELECT UNIQUE us_crea,fech_crea,us_mod,
|
|
fech_mod ,status_t
|
|
INTO c_sustituto.us_crea,
|
|
c_sustituto.fech_crea,
|
|
c_sustituto.us_mod,
|
|
c_sustituto.fech_mod ,
|
|
c_sustituto.status_t
|
|
FROM intb00003
|
|
WHERE cod_n = c_sustituto.cod_n and
|
|
cod_grupo = c_sustituto.cod_grupo and
|
|
cod_tipo = c_sustituto.cod_tipo and
|
|
cod_sec = c_sustituto.cod_sec and
|
|
cod_n_s = c_sustituto.cod_n_s and
|
|
cod_grupo_s = c_sustituto.cod_grupo_s and
|
|
cod_tipo_s = c_sustituto.cod_tipo_s and
|
|
cod_sec_s = c_sustituto.cod_sec_s
|
|
|
|
IF status != NOTFOUND THEN
|
|
IF c_sustituto.status_t = "E" THEN
|
|
LET numero_msg = 36
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_n
|
|
END IF
|
|
LET numero_msg = 9
|
|
CALL msg(numero_msg)
|
|
SELECT descrip_esp,descrip_ing
|
|
INTO descrip2,descrip4 FROM iptb00002
|
|
WHERE cod_n = c_sustituto.cod_n_s and
|
|
cod_grupo = c_sustituto.cod_grupo_s and
|
|
cod_tipo = c_sustituto.cod_tipo_s and
|
|
cod_sec = c_sustituto.cod_sec_s and
|
|
status_t is null
|
|
DISPLAY BY NAME descrip2,descrip4,c_sustituto.us_crea,
|
|
c_sustituto.fech_crea,c_sustituto.us_mod,
|
|
c_sustituto.fech_mod
|
|
NEXT FIELD cod_n
|
|
END IF
|
|
CALL integridad()
|
|
|
|
IF bandera = 1 THEN
|
|
LET bandera = 0
|
|
RETURN
|
|
END IF
|
|
# Busca Descripcion Materia Prima
|
|
|
|
IF c_sustituto.cod_n = c_sustituto.cod_n_s and
|
|
c_sustituto.cod_grupo = c_sustituto.cod_grupo_s and
|
|
c_sustituto.cod_tipo = c_sustituto.cod_tipo_s and
|
|
c_sustituto.cod_sec = c_sustituto.cod_sec_s THEN
|
|
LET numero_msg = 10
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD COD_N
|
|
END IF
|
|
### DESPLEGA LA DESCRIPCION EN ESPANOL(descrip1) Y EN INGLES(descrip4)
|
|
|
|
DISPLAY BY NAME descrip2,descrip4,c_sustituto.us_crea,
|
|
c_sustituto.fech_crea,c_sustituto.us_mod,
|
|
c_sustituto.fech_mod
|
|
AFTER FIELD cod_uso_s
|
|
IF c_sustituto.cod_uso_s != "0" AND c_sustituto.cod_uso_s != "1" THEN
|
|
LET numero_msg = 7
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_uso_s
|
|
END IF
|
|
|
|
AFTER INPUT
|
|
IF INT_FLAG THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET INT_FLAG = FALSE
|
|
RETURN
|
|
END IF
|
|
IF c_sustituto.cod_uso_s != "0" AND c_sustituto.cod_uso_s != "1" THEN
|
|
LET numero_msg = 7
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_uso_s
|
|
END IF
|
|
|
|
IF c_sustituto.cod_n = c_sustituto.cod_n_s and
|
|
c_sustituto.cod_grupo = c_sustituto.cod_grupo_s and
|
|
c_sustituto.cod_tipo = c_sustituto.cod_tipo_s and
|
|
c_sustituto.cod_sec = c_sustituto.cod_sec_s THEN
|
|
LET numero_msg = 10
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD COD_N
|
|
END IF
|
|
# Verifica que la materia prima tenga el sustituto que el usuario esta
|
|
# creando en este momento
|
|
|
|
SELECT UNIQUE us_crea,fech_crea,us_mod,
|
|
fech_mod,status_t,cod_uso_s
|
|
INTO c_sustituto.us_crea,
|
|
c_sustituto.fech_crea,
|
|
c_sustituto.us_mod,
|
|
c_sustituto.fech_mod ,
|
|
c_sustituto.status_t,
|
|
c_sustituto.cod_uso_s
|
|
FROM intb00003
|
|
WHERE cod_n = c_sustituto.cod_n and
|
|
cod_grupo = c_sustituto.cod_grupo and
|
|
cod_tipo = c_sustituto.cod_tipo and
|
|
cod_sec = c_sustituto.cod_sec and
|
|
cod_n_s = c_sustituto.cod_n_s and
|
|
cod_grupo_s = c_sustituto.cod_grupo_s and
|
|
cod_tipo_s = c_sustituto.cod_tipo_s and
|
|
cod_sec_s = c_sustituto.cod_sec_s
|
|
|
|
IF status >= 0 THEN
|
|
IF status != NOTFOUND THEN
|
|
IF c_sustituto.status_t = "E" THEN
|
|
LET numero_msg = 36
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_n
|
|
END IF
|
|
LET numero_msg = 9
|
|
CALL msg(numero_msg)
|
|
SELECT descrip_esp,descrip_ing
|
|
INTO descrip2,descrip4 FROM iptb00002
|
|
WHERE cod_n = c_sustituto.cod_n_s and
|
|
cod_grupo = c_sustituto.cod_grupo_s and
|
|
cod_tipo = c_sustituto.cod_tipo_s and
|
|
cod_sec = c_sustituto.cod_sec_s and
|
|
status_t is null
|
|
DISPLAY BY NAME descrip2,descrip4,c_sustituto.us_crea,
|
|
c_sustituto.fech_crea,c_sustituto.us_mod,
|
|
c_sustituto.fech_mod
|
|
NEXT FIELD cod_n
|
|
END IF
|
|
ELSE
|
|
DISPLAY BY NAME c_sustituto.cod_uso_s
|
|
CALL integridad()
|
|
|
|
IF bandera = 1 THEN
|
|
LET bandera = 0
|
|
RETURN
|
|
END IF
|
|
END IF
|
|
|
|
SELECT descrip_esp,descrip_ing
|
|
INTO descrip1,descrip3 FROM iptb00002
|
|
WHERE cod_n = c_sustituto.cod_n and
|
|
cod_grupo = c_sustituto.cod_grupo and
|
|
cod_tipo = c_sustituto.cod_tipo and
|
|
cod_sec = c_sustituto.cod_sec and
|
|
status_t is null
|
|
IF status >= 0 THEN
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD COD_N
|
|
END IF
|
|
ELSE
|
|
|
|
CALL integridad()
|
|
|
|
IF bandera = 1 THEN
|
|
LET bandera = 0
|
|
RETURN
|
|
END IF
|
|
END IF
|
|
## CHEQUEA QUE EL CODIGO SE ENCUENTRE EN LA TABLA DE ARTICULOS
|
|
|
|
# Busca Descripcion Materia Prima
|
|
|
|
SELECT UNIQUE descrip_esp,descrip_ing
|
|
INTO descrip2,descrip4
|
|
FROM iptb00002
|
|
WHERE cod_n = c_sustituto.cod_n_s and
|
|
cod_grupo = c_sustituto.cod_grupo_s and
|
|
cod_tipo = c_sustituto.cod_tipo_s and
|
|
cod_sec = c_sustituto.cod_sec_s and
|
|
status_t is null
|
|
|
|
## CHEQUEA QUE EL CODIGO ESTE EN LA TABLA DE ARTICULOS GRALES.
|
|
|
|
IF status >= 0 THEN
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD COD_N_S
|
|
END IF
|
|
ELSE
|
|
CALL integridad()
|
|
|
|
IF bandera = 1 THEN
|
|
LET bandera = 0
|
|
RETURN
|
|
END IF
|
|
END IF
|
|
SELECT UNIQUE us_crea,fech_crea,us_mod,fech_mod
|
|
INTO c_sustituto.us_crea,c_sustituto.fech_crea,
|
|
c_sustituto.us_mod,c_sustituto.fech_mod
|
|
FROM intb00003
|
|
WHERE cod_n = c_sustituto.cod_n_s and
|
|
cod_grupo = c_sustituto.cod_grupo_s and
|
|
cod_tipo = c_sustituto.cod_tipo_s and
|
|
cod_sec = c_sustituto.cod_sec_s and
|
|
status_t is null
|
|
CALL integridad()
|
|
|
|
IF bandera = 1 THEN
|
|
LET bandera = 0
|
|
RETURN
|
|
END IF
|
|
|
|
## DESPLEGA LA DESCRIPCION EN ESPANOL(descrip1) Y EN INGLES(descrip3
|
|
IF c_sustituto.cod_n = 0 and
|
|
c_sustituto.cod_grupo = 0 and
|
|
c_sustituto.cod_tipo = 0 and
|
|
c_sustituto.cod_sec = 0 then
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_n
|
|
END IF
|
|
IF
|
|
c_sustituto.cod_n_s = 0 and
|
|
c_sustituto.cod_grupo_s = 0 and
|
|
c_sustituto.cod_tipo_s = 0 and
|
|
c_sustituto.cod_sec_s = 0 THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_n
|
|
END IF
|
|
|
|
IF INT_FLAG THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET INT_FLAG = FALSE
|
|
RETURN
|
|
ELSE
|
|
INSERT INTO intb00003 VALUES (c_sustituto.cod_n,c_sustituto.cod_grupo,
|
|
c_sustituto.cod_tipo,c_sustituto.cod_sec,
|
|
c_sustituto.cod_n_s,
|
|
c_sustituto.cod_grupo_s,
|
|
c_sustituto.cod_tipo_s,
|
|
c_sustituto.cod_sec_s,c_sustituto.cod_uso_s,
|
|
null,usuarios,getdate(),null,null)
|
|
CALL integridad()
|
|
|
|
if bandera = 1 THEN
|
|
LET bandera = 0
|
|
RETURN
|
|
end if
|
|
LET numero_msg = 1
|
|
CALL msg(numero_msg)
|
|
SELECT UNIQUE us_crea,fech_crea,us_mod,
|
|
fech_mod
|
|
INTO c_sustituto.us_crea,
|
|
c_sustituto.fech_crea,
|
|
c_sustituto.us_mod,
|
|
c_sustituto.fech_mod
|
|
FROM intb00003
|
|
WHERE cod_n = c_sustituto.cod_n and
|
|
cod_grupo = c_sustituto.cod_grupo and
|
|
cod_tipo = c_sustituto.cod_tipo and
|
|
cod_sec = c_sustituto.cod_sec and
|
|
cod_n_s = c_sustituto.cod_n_s and
|
|
cod_grupo_s = c_sustituto.cod_grupo_s and
|
|
cod_tipo_s = c_sustituto.cod_tipo_s and
|
|
cod_sec_s = c_sustituto.cod_sec_s
|
|
END IF
|
|
NEXT FIELD cod_n
|
|
AFTER FIELD fech_mod
|
|
EXIT INPUT
|
|
END INPUT
|
|
#### CHEQUE QUE LA VARIABLE BOLEANA DE INTERRUPCION (INT_FLAG) ESTE FALSA O
|
|
#### VERDADERA, SI ESTA VERDADERA EL USUARIO PRESIONO LA TECLA (DEL)A
|
|
|
|
END FUNCTION
|
|
## FUNCION QUE BUSCA Y MODIFICA SI ES NECESARIO LAS INFORMACIONES EN PANTALLA
|
|
|
|
FUNCTION inpcmf003()
|
|
## AQUI SE PREPARA PARA LA CAPTURA DEL CRITERIO DE SELECCION
|
|
CLEAR FORM
|
|
WHENEVER ERROR CONTINUE
|
|
CONSTRUCT criterio ON intb00003.* FROM intb00003.*
|
|
IF INT_FLAG THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET INT_FLAG = FALSE
|
|
RETURN
|
|
END IF
|
|
LET SELEC = " SELECT UNIQUE * FROM intb00003 where ",
|
|
" status_t is null and ",
|
|
criterio clipped,
|
|
" ORDER BY 1,2,3,4"
|
|
PREPARE busca FROM selec
|
|
CALL integridad()
|
|
|
|
IF bandera = 1 THEN
|
|
LET bandera = 0
|
|
RETURN
|
|
END IF
|
|
DECLARE datos SCROLL CURSOR FOR BUSCA
|
|
OPEN datos
|
|
FETCH FIRST datos INTO c_sustituto.*
|
|
|
|
IF status >= 0 THEN
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
RETURN
|
|
END IF
|
|
ELSE
|
|
CALL integridad()
|
|
|
|
IF bandera = 1 THEN
|
|
LET bandera = 0
|
|
RETURN
|
|
END IF
|
|
END IF
|
|
SELECT descrip_esp,descrip_ing INTO descrip1,descrip3 FROM iptb00002
|
|
WHERE cod_n = c_sustituto.cod_n and
|
|
cod_grupo = c_sustituto.cod_grupo and
|
|
cod_tipo = c_sustituto.cod_tipo and
|
|
cod_sec = c_sustituto.cod_sec
|
|
SELECT descrip_esp,descrip_ing INTO descrip2,descrip4 FROM iptb00002
|
|
WHERE cod_n = c_sustituto.cod_n_s and
|
|
cod_grupo = c_sustituto.cod_grupo_s and
|
|
cod_tipo = c_sustituto.cod_tipo_s and
|
|
cod_sec = c_sustituto.cod_sec_s
|
|
DISPLAY BY NAME c_sustituto.*,descrip1,descrip2,descrip3,descrip4
|
|
|
|
MENU "OPCIONES"
|
|
COMMAND "Siguiente"
|
|
"Presenta en pantalla el proximo registro encontrado"
|
|
FETCH NEXT datos INTO c_sustituto.*
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 4
|
|
CALL msg(numero_msg)
|
|
FETCH LAST datos INTO c_sustituto.*
|
|
END IF
|
|
SELECT descrip_esp,descrip_ing INTO descrip1,descrip3 FROM iptb00002
|
|
WHERE cod_n = c_sustituto.cod_n and
|
|
cod_grupo = c_sustituto.cod_grupo and
|
|
cod_tipo = c_sustituto.cod_tipo and
|
|
cod_sec = c_sustituto.cod_sec
|
|
|
|
SELECT descrip_esp,descrip_ing INTO descrip2,descrip4 FROM iptb00002
|
|
WHERE cod_n = c_sustituto.cod_n_s and
|
|
cod_grupo = c_sustituto.cod_grupo_s and
|
|
cod_tipo = c_sustituto.cod_tipo_s and
|
|
cod_sec = c_sustituto.cod_sec_s
|
|
|
|
DISPLAY BY NAME c_sustituto.*,descrip1,descrip2,descrip3,descrip4
|
|
|
|
COMMAND "Anterior"
|
|
"Presenta en pantalla el registro anterior encontrado"
|
|
FETCH PREVIOUS datos INTO c_sustituto.*
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 5
|
|
CALL msg(numero_msg)
|
|
END IF
|
|
|
|
SELECT descrip_esp,descrip_ing INTO descrip1,descrip3 FROM iptb00002
|
|
WHERE cod_n = c_sustituto.cod_n and
|
|
cod_grupo = c_sustituto.cod_grupo and
|
|
cod_tipo = c_sustituto.cod_tipo and
|
|
cod_sec = c_sustituto.cod_sec
|
|
SELECT descrip_esp,descrip_ing INTO descrip2,descrip4 FROM iptb00002
|
|
WHERE cod_n = c_sustituto.cod_n_s and
|
|
cod_grupo = c_sustituto.cod_grupo_s and
|
|
cod_tipo = c_sustituto.cod_tipo_s and
|
|
cod_sec = c_sustituto.cod_sec_s
|
|
|
|
DISPLAY BY NAME c_sustituto.*,descrip1,descrip2,descrip3,descrip4
|
|
|
|
COMMAND "Primero"
|
|
"Presenta en pantalla el primer registro encontrado"
|
|
FETCH FIRST datos INTO c_sustituto.*
|
|
SELECT descrip_esp,descrip_ing INTO descrip1,descrip3 FROM iptb00002
|
|
WHERE cod_n = c_sustituto.cod_n and
|
|
cod_grupo = c_sustituto.cod_grupo and
|
|
cod_tipo = c_sustituto.cod_tipo and
|
|
cod_sec = c_sustituto.cod_sec
|
|
SELECT descrip_esp,descrip_ing INTO descrip2,descrip4 FROM iptb00002
|
|
WHERE cod_n = c_sustituto.cod_n_s and
|
|
cod_grupo = c_sustituto.cod_grupo_s and
|
|
cod_tipo = c_sustituto.cod_tipo_s and
|
|
cod_sec = c_sustituto.cod_sec_s
|
|
DISPLAY BY NAME c_sustituto.*,descrip1,descrip2,descrip3,descrip4
|
|
LET numero_msg = 5
|
|
CALL msg(numero_msg)
|
|
|
|
COMMAND "Ultimo"
|
|
"Presenta en pantalla el ultimo registro encontrado"
|
|
FETCH LAST datos INTO c_sustituto.*
|
|
SELECT descrip_esp,descrip_ing INTO descrip1,descrip3 FROM iptb00002
|
|
WHERE cod_n = c_sustituto.cod_n and
|
|
cod_grupo = c_sustituto.cod_grupo and
|
|
cod_tipo = c_sustituto.cod_tipo and
|
|
cod_sec = c_sustituto.cod_sec
|
|
SELECT descrip_esp,descrip_ing INTO descrip2,descrip4 FROM iptb00002
|
|
WHERE cod_n = c_sustituto.cod_n_s and
|
|
cod_grupo = c_sustituto.cod_grupo_s and
|
|
cod_tipo = c_sustituto.cod_tipo_s and
|
|
cod_sec = c_sustituto.cod_sec_s
|
|
DISPLAY BY NAME c_sustituto.*,descrip1,descrip2,descrip3,descrip4
|
|
Let numero_msg = 4
|
|
CALL msg(numero_msg)
|
|
|
|
COMMAND "Escoger" "<Esc> Adiciona Registro <Ctrl-C> Cancela Operacion"
|
|
IF c_sustituto.status_t = "E" THEN
|
|
LET numero_msg = 36
|
|
CALL msg(numero_msg)
|
|
RETURN
|
|
END IF
|
|
INPUT BY NAME c_sustituto.* WITHOUT DEFAULTS
|
|
BEFORE FIELD cod_n
|
|
NEXT FIELD cod_n_s
|
|
AFTER FIELD cod_sec_s
|
|
|
|
# Busca Descripcion Materia Prima
|
|
|
|
SELECT UNIQUE descrip_esp,descrip_ing,us_crea,fech_crea,
|
|
fech_mod
|
|
INTO descrip2,descrip4,c_sustituto.us_crea,
|
|
c_sustituto.fech_crea,
|
|
c_sustituto.us_mod,
|
|
c_sustituto.fech_mod
|
|
FROM iptb00002
|
|
WHERE cod_n = c_sustituto.cod_n_s and
|
|
cod_grupo = c_sustituto.cod_grupo_s and
|
|
cod_tipo = c_sustituto.cod_tipo_s and
|
|
cod_sec = c_sustituto.cod_sec_s and
|
|
status_t is null
|
|
|
|
## CHEQUEA QUE EL CODIGO ESTE EN LA TABLA DE ARTICULOS GRALES.
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD COD_N_S
|
|
END IF
|
|
IF c_sustituto.cod_n = c_sustituto.cod_n_s and
|
|
c_sustituto.cod_grupo = c_sustituto.cod_grupo_s and
|
|
c_sustituto.cod_tipo = c_sustituto.cod_tipo_s and
|
|
c_sustituto.cod_sec = c_sustituto.cod_sec_s THEN
|
|
LET numero_msg = 10
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD COD_N
|
|
END IF
|
|
|
|
### DESPLEGA LA DESCRIPCION EN ESPANOL(descrip1) Y EN INGLES(descrip4)
|
|
|
|
DISPLAY BY NAME descrip2,descrip4,c_sustituto.us_crea,
|
|
c_sustituto.fech_crea,c_sustituto.us_mod,
|
|
c_sustituto.fech_mod
|
|
AFTER INPUT
|
|
IF INT_FLAG THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET INT_FLAG = FALSE
|
|
RETURN
|
|
END IF
|
|
IF c_sustituto.cod_n = c_sustituto.cod_n_s and
|
|
c_sustituto.cod_grupo = c_sustituto.cod_grupo_s and
|
|
c_sustituto.cod_tipo = c_sustituto.cod_tipo_s and
|
|
c_sustituto.cod_sec = c_sustituto.cod_sec_s THEN
|
|
LET numero_msg = 10
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD COD_N
|
|
END IF
|
|
|
|
SELECT UNIQUE descrip_esp,descrip_ing,us_crea,fech_crea,
|
|
fech_mod
|
|
INTO descrip2,descrip4
|
|
FROM iptb00002
|
|
WHERE cod_n = c_sustituto.cod_n_s and
|
|
cod_grupo = c_sustituto.cod_grupo_s and
|
|
cod_tipo = c_sustituto.cod_tipo_s and
|
|
cod_sec = c_sustituto.cod_sec_s and
|
|
status_t is null
|
|
|
|
## CHEQUEA QUE EL CODIGO ESTE EN LA TABLA DE ARTICULOS GRALES.
|
|
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD COD_N_S
|
|
END IF
|
|
IF c_sustituto.cod_n = 0 and
|
|
c_sustituto.cod_grupo = 0 and
|
|
c_sustituto.cod_tipo = 0 and
|
|
c_sustituto.cod_sec = 0 then
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_n
|
|
END IF
|
|
IF
|
|
c_sustituto.cod_n_s = 0 and
|
|
c_sustituto.cod_grupo_s = 0 and
|
|
c_sustituto.cod_tipo_s = 0 and
|
|
c_sustituto.cod_sec_s = 0 THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_n
|
|
END IF
|
|
IF INT_FLAG THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET INT_FLAG = FALSE
|
|
RETURN
|
|
END IF
|
|
AFTER FIELD fech_mod
|
|
EXIT INPUT
|
|
END INPUT
|
|
|
|
#### CHEQUE QUE LA VARIABLE BOLEANA DE INTERRUPCION (INT_FLAG) ESTE FALSA O
|
|
#### VERDADERA, SI ESTA VERDADERA EL USUARIO PRESIONO LA TECLA (DEL)A
|
|
IF INT_FLAG THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET INT_FLAG = FALSE
|
|
RETURN
|
|
ELSE
|
|
UPDATE intb00003 SET
|
|
cod_n_s = c_sustituto.cod_n_s,
|
|
cod_grupo_s= c_sustituto.cod_grupo_s,
|
|
cod_tipo_s = c_sustituto.cod_tipo_s,
|
|
cod_sec_s = c_sustituto.cod_sec_s,
|
|
cod_uso_s = c_sustituto.cod_uso_s,
|
|
us_mod = usuarios,
|
|
fech_mod = getdate()
|
|
where cod_n = c_sustituto.cod_n and
|
|
cod_grupo = c_sustituto.cod_grupo and
|
|
cod_tipo = c_sustituto.cod_tipo and
|
|
cod_sec = c_sustituto.cod_sec and
|
|
status_t is null
|
|
CALL integridad()
|
|
|
|
IF bandera = 1 THEN
|
|
LET bandera = 0
|
|
RETURN
|
|
END IF
|
|
|
|
LET numero_msg = 13
|
|
CALL msg(numero_msg)
|
|
DISPLAY BY NAME descrip2,descrip4,c_sustituto.us_crea,
|
|
c_sustituto.fech_crea,c_sustituto.us_mod,
|
|
c_sustituto.fech_mod
|
|
END IF
|
|
COMMAND KEY ("L") "eLiminar"
|
|
UPDATE intb00003 SET status_t = "E"
|
|
where cod_n = c_sustituto.cod_n and
|
|
cod_grupo = c_sustituto.cod_grupo and
|
|
cod_tipo = c_sustituto.cod_tipo and
|
|
cod_sec = c_sustituto.cod_sec
|
|
LET numero_msg = 39
|
|
CALL msg(numero_msg)
|
|
|
|
COMMAND "Retornar"
|
|
CLEAR FORM
|
|
EXIT MENU
|
|
END MENU
|
|
END FUNCTION
|