Instruccion de Johnny: todos los directorios de fuentes de inventario deben migrarse de la carpeta temporal PROYECTOS a la carpeta real PROYECTO, ya que PROYECTOS sera eliminada. Se elimino tambien un archivo suelto sin relacion llamado "ipdir" que existia en PROYECTO (del commit inicial) y bloqueaba el nombre de la carpeta. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
416 lines
13 KiB
Plaintext
416 lines
13 KiB
Plaintext
{
|
|
------------------------------------------------------------------
|
|
PROGRAMA : IPPRMT018
|
|
OBJETIVO : Capturar, Modificar, Eliminar registros de la
|
|
Tabla de Factor de Conversion
|
|
PROGRAMADOR : TADEO FERRERAS
|
|
FECHA REALIZACION : Enero 22, 1998
|
|
|
|
------------------------------------------------------------------
|
|
}
|
|
GLOBALS "ipprgb000.4gl"
|
|
|
|
MAIN
|
|
DEFER INTERRUPT
|
|
CALL ARG_VAL(1) RETURNING usuarios
|
|
CALL ARG_VAL(2) RETURNING clave
|
|
CALL ARG_VAL(3) RETURNING impresor
|
|
|
|
CONNECT TO "exterior" AS "IFMX"
|
|
CONNECT to "smarmotech" AS "MSSQL" USER usuarios USING clave
|
|
|
|
SELECT * INTO p_companias.* FROM companias
|
|
CALL ipprmt018()
|
|
END MAIN
|
|
|
|
FUNCTION ipprmt018()
|
|
# WHENEVER ERROR CONTINUE
|
|
CLEAR SCREEN
|
|
OPTIONS
|
|
FORM LINE 9,
|
|
ERROR LINE 23,
|
|
HELP FILE "ippray000.exe",
|
|
HELP KEY CONTROL-W,
|
|
COMMENT LINE 21
|
|
|
|
OPEN FORM ipfmmt018 FROM "ipfmmt018"
|
|
DISPLAY FORM ipfmmt018
|
|
#CALL pantalla()
|
|
DISPLAY "ipprmt018" AT 4,3
|
|
DISPLAY "Factor de Conversion" AT 6,30
|
|
|
|
MENU "OPCIONES"
|
|
COMMAND "Adicionar"
|
|
"<Esc> Adiciona Registro <Delete> Cancela Operacion"
|
|
HELP 5
|
|
LET int_flag = FALSE
|
|
CLEAR FORM
|
|
SET CONNECTION "MSSQL"
|
|
CALL ippcad018()
|
|
COMMAND "Consultar-modificar"
|
|
"<Esc> Realiza Busqueda <Delete> Cancela Operacion"
|
|
HELP 6
|
|
LET int_flag = FALSE
|
|
CLEAR FORM
|
|
SET CONNECTION "MSSQL"
|
|
CALL ippcmf018()
|
|
COMMAND "Salir" "Retorna Menu Anterior"
|
|
EXIT MENU
|
|
END MENU
|
|
END FUNCTION
|
|
|
|
FUNCTION ippcad018()
|
|
## Captura los datos que va a contener el registro
|
|
|
|
# WHENEVER ERROR CONTINUE
|
|
|
|
LET int_flag = false
|
|
INPUT BY NAME p_iptb01.*
|
|
|
|
AFTER FIELD cod_n
|
|
IF p_iptb01.cod_n IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_n
|
|
END IF
|
|
|
|
AFTER FIELD cod_grupo
|
|
IF p_iptb01.cod_grupo IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_grupo
|
|
END IF
|
|
|
|
AFTER FIELD cod_tipo
|
|
IF p_iptb01.cod_tipo IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_tipo
|
|
END IF
|
|
|
|
AFTER FIELD cod_sec
|
|
IF (p_iptb01.cod_n is NULL OR p_iptb01.cod_grupo is NULL OR
|
|
p_iptb01.cod_tipo is NULL OR p_iptb01.cod_sec IS NULL) THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_n
|
|
END IF
|
|
|
|
## Verifica que el factor para una pila no exista en el catalogo de factor.
|
|
## Si existe, entonces despliega los datos del registro existente.
|
|
|
|
SELECT a.descrip_esp, a.unidad_med
|
|
INTO p_iptb02.descrip_esp,p_iptb02.unidad_med FROM iptb00002 a
|
|
WHERE a.cod_n = p_iptb01.cod_n and a.cod_grupo=p_iptb01.cod_grupo and
|
|
a.cod_tipo=p_iptb01.cod_tipo and a.cod_sec=p_iptb01.cod_sec AND
|
|
a.status_t is NULL
|
|
|
|
IF status = notfound THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_n
|
|
END IF
|
|
|
|
DISPLAY BY NAME p_iptb02.descrip_esp,p_iptb02.unidad_med
|
|
|
|
SELECT UNIQUE a.cod_sec FROM iptb00001 a
|
|
WHERE a.cod_n = p_iptb01.cod_n and a.cod_grupo=p_iptb01.cod_grupo and
|
|
a.cod_tipo=p_iptb01.cod_tipo and a.cod_sec=p_iptb01.cod_sec
|
|
|
|
IF STATUS != NOTFOUND THEN
|
|
LET numero_msg = 12
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_n
|
|
END IF
|
|
|
|
AFTER FIELD unidad
|
|
IF p_iptb01.unidad IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD unidad
|
|
END IF
|
|
|
|
AFTER FIELD factor_conv
|
|
IF p_iptb01.factor_conv IS NULL OR p_iptb01.factor_conv <= 0 THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD factor_conv
|
|
END IF
|
|
|
|
AFTER INPUT
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
RETURN
|
|
END IF
|
|
|
|
IF p_iptb01.cod_n IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_n
|
|
END IF
|
|
|
|
IF p_iptb01.cod_grupo IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_grupo
|
|
END IF
|
|
|
|
IF p_iptb01.cod_tipo IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_tipo
|
|
END IF
|
|
|
|
IF (p_iptb01.cod_n is NULL OR p_iptb01.cod_grupo is NULL OR
|
|
p_iptb01.cod_tipo is NULL OR p_iptb01.cod_sec IS NULL) THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_n
|
|
END IF
|
|
|
|
IF p_iptb01.unidad IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD unidad
|
|
END IF
|
|
|
|
IF p_iptb01.factor_conv IS NULL OR p_iptb01.factor_conv <= 0 THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD factor_conv
|
|
END IF
|
|
END INPUT
|
|
|
|
INSERT INTO iptb00001
|
|
VALUES (p_iptb01.cod_n,p_iptb01.cod_grupo,p_iptb01.cod_tipo,
|
|
p_iptb01.cod_sec,p_iptb01.unidad,p_iptb01.factor_conv,
|
|
NULL,SUSER_SNAME(),GETDATE(),NULL,NULL,p_iptb01.factor_ad)
|
|
|
|
# Verifica el Status que retorna luego de insertar el registro en la tabla.
|
|
# Si el Status es diferente de cero quiere decir que hubo problemas durante
|
|
# la creacion del registro, entonces despliega un mensaje .
|
|
|
|
CALL integridad()
|
|
IF bandera = 1 THEN
|
|
LET bandera = 0
|
|
RETURN
|
|
END IF
|
|
SET CONNECTION "IFMX"
|
|
|
|
|
|
INSERT INTO iptb00001
|
|
VALUES (p_iptb01.cod_n,p_iptb01.cod_grupo,p_iptb01.cod_tipo,
|
|
p_iptb01.cod_sec,p_iptb01.unidad,p_iptb01.factor_conv,
|
|
NULL,usuarios,current,NULL,NULL,p_iptb01.factor_ad)
|
|
|
|
LET numero_msg = 1
|
|
CALL msg(numero_msg)
|
|
CLEAR FORM
|
|
INITIALIZE p_iptb01.* TO NULL
|
|
END FUNCTION
|
|
|
|
FUNCTION ippcmf018()
|
|
# WHENEVER ERROR CONTINUE
|
|
MESSAGE ""
|
|
LET int_flag = false
|
|
## Aqui se prepara para la captura del criterio de seleccion
|
|
|
|
CONSTRUCT criterio ON a.cod_n,a.cod_grupo,a.cod_tipo,a.cod_sec
|
|
FROM cod_n,cod_grupo,cod_tipo,cod_Sec
|
|
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
CLEAR FORM
|
|
RETURN
|
|
END IF
|
|
|
|
LET SELEC = "SELECT UNIQUE a.* FROM iptb00001 a ",
|
|
"WHERE a.status_t IS NULL AND ",criterio clipped,
|
|
" ORDER BY 1,2"
|
|
|
|
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 p_iptb01.*
|
|
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,unidad_med
|
|
INTO p_iptb02.descrip_esp,p_iptb02.unidad_med
|
|
FROM iptb00002
|
|
WHERE cod_n = p_iptb01.cod_n and cod_grupo = p_iptb01.cod_grupo and
|
|
cod_tipo = p_iptb01.cod_tipo and cod_sec= p_iptb01.cod_sec
|
|
|
|
DISPLAY BY NAME p_iptb01.*,p_iptb02.descrip_esp,
|
|
p_iptb02.unidad_med
|
|
|
|
MENU "OPCIONES "
|
|
COMMAND "Siguiente"
|
|
"Presenta en pantalla el proximo registro encontrado"
|
|
FETCH NEXT datos INTO p_iptb01.*
|
|
IF STATUS = NOTFOUND THEN
|
|
LET numero_msg = 4
|
|
CALL msg(numero_msg)
|
|
END IF
|
|
SELECT descrip_esp,unidad_med
|
|
INTO p_iptb02.descrip_esp,p_iptb02.unidad_med
|
|
FROM iptb00002
|
|
WHERE cod_n = p_iptb01.cod_n and cod_grupo = p_iptb01.cod_grupo and
|
|
cod_tipo = p_iptb01.cod_tipo and cod_sec = p_iptb01.cod_sec
|
|
|
|
DISPLAY BY NAME p_iptb01.*,p_iptb02.descrip_esp,p_iptb02.unidad_med
|
|
|
|
COMMAND "Anterior"
|
|
"Presenta en pantalla el registro anterior encontrado"
|
|
FETCH PREVIOUS datos INTO p_iptb01.*
|
|
IF STATUS = NOTFOUND THEN
|
|
LET numero_msg = 5
|
|
CALL msg(numero_msg)
|
|
END IF
|
|
SELECT descrip_esp,unidad_med
|
|
INTO p_iptb02.descrip_esp,p_iptb02.unidad_med
|
|
FROM iptb00002
|
|
WHERE cod_n = p_iptb01.cod_n and cod_grupo = p_iptb01.cod_grupo and
|
|
cod_tipo = p_iptb01.cod_tipo and cod_sec= p_iptb01.cod_sec
|
|
|
|
DISPLAY BY NAME p_iptb01.*,p_iptb02.descrip_esp,p_iptb02.unidad_med
|
|
|
|
COMMAND "Primero"
|
|
"Presenta en pantalla el primer registro encontrado"
|
|
FETCH FIRST datos INTO p_iptb01.*
|
|
SELECT descrip_esp,unidad_med
|
|
INTO p_iptb02.descrip_esp,p_iptb02.unidad_med
|
|
FROM iptb00002
|
|
WHERE cod_n = p_iptb01.cod_n and cod_grupo = p_iptb01.cod_grupo and
|
|
cod_tipo = p_iptb01.cod_tipo and cod_sec = p_iptb01.cod_sec
|
|
|
|
DISPLAY BY NAME p_iptb01.*,p_iptb02.descrip_esp,p_iptb02.unidad_med
|
|
|
|
COMMAND "Ultimo"
|
|
"Presenta en pantalla el ultimo registro encontrado"
|
|
FETCH LAST datos INTO p_iptb01.*
|
|
SELECT descrip_esp,unidad_med
|
|
INTO p_iptb02.descrip_esp,p_iptb02.unidad_med
|
|
FROM iptb00002
|
|
WHERE cod_n = p_iptb01.cod_n and cod_grupo = p_iptb01.cod_grupo and
|
|
cod_tipo = p_iptb01.cod_tipo and cod_sec = p_iptb01.cod_sec
|
|
|
|
DISPLAY BY NAME p_iptb01.*,p_iptb02.descrip_esp,p_iptb02.unidad_med
|
|
|
|
COMMAND "Escoger"
|
|
"<Esc> Actualiza Registro <Delete> Cancela Operacion"
|
|
IF p_iptb01.status_t= "E" THEN
|
|
LET numero_msg= 36
|
|
CALL msg(numero_msg)
|
|
RETURN
|
|
END IF
|
|
|
|
INPUT BY NAME p_iptb01.unidad,p_iptb01.factor_conv,p_iptb01.factor_ad WITHOUT DEFAULTS
|
|
|
|
AFTER FIELD unidad
|
|
IF p_iptb01.unidad IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD unidad
|
|
END IF
|
|
|
|
AFTER FIELD factor_conv
|
|
IF p_iptb01.factor_conv IS NULL OR p_iptb01.factor_conv <= 0 THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD factor_conv
|
|
END IF
|
|
|
|
AFTER INPUT
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
RETURN
|
|
END IF
|
|
|
|
IF p_iptb01.unidad IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD unidad
|
|
END IF
|
|
|
|
IF p_iptb01.factor_conv IS NULL OR p_iptb01.factor_conv <= 0 THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD factor_conv
|
|
END IF
|
|
END INPUT
|
|
|
|
UPDATE iptb00001 SET unidad = p_iptb01.unidad,
|
|
factor_conv = p_iptb01.factor_conv,
|
|
factor_ad = p_iptb01.factor_ad,
|
|
us_mod = SUSER_SNAME(),
|
|
fech_mod = GETDATE()
|
|
WHERE @cod_n = p_iptb01.cod_n and @cod_grupo=p_iptb01.cod_grupo and
|
|
@cod_tipo = p_iptb01.cod_tipo and @cod_sec =p_iptb01.cod_sec
|
|
SET CONNECTION "IFMX"
|
|
|
|
SELECT a.cod_n FROM iptb00001 a
|
|
WHERE a.cod_n = p_iptb01.cod_n AND
|
|
a.cod_Grupo = p_iptb01.cod_grupo AND
|
|
a.cod_tipo = p_iptb01.cod_tipo AND
|
|
a.cod_Sec = p_iptb01.cod_sec
|
|
|
|
IF STATUS <> NOTFOUND THEN
|
|
UPDATE iptb00001 SET unidad = p_iptb01.unidad,
|
|
factor_conv = p_iptb01.factor_conv,
|
|
factor_ad = p_iptb01.factor_ad,
|
|
us_mod = usuarios,
|
|
fech_mod = current
|
|
WHERE @cod_n = p_iptb01.cod_n and @cod_grupo=p_iptb01.cod_grupo and
|
|
@cod_tipo = p_iptb01.cod_tipo and @cod_sec =p_iptb01.cod_sec
|
|
ELSE
|
|
|
|
INSERT INTO iptb00001
|
|
VALUES (p_iptb01.cod_n,p_iptb01.cod_grupo,p_iptb01.cod_tipo,
|
|
p_iptb01.cod_sec,p_iptb01.unidad,p_iptb01.factor_conv,
|
|
NULL,usuarios,current,NULL,NULL,p_iptb01.factor_ad)
|
|
|
|
END IF
|
|
LET numero_msg = 13
|
|
CALL msg(numero_msg)
|
|
|
|
COMMAND KEY ("L") "eLiminar" "Elimina registro que esta en la pantalla"
|
|
UPDATE iptb00001 SET status_t ="E",
|
|
us_mod = usuarios,
|
|
fech_mod = GETDATE()
|
|
WHERE cod_n = p_iptb01.cod_n and cod_grupo =p_iptb01.cod_grupo and
|
|
cod_tipo = p_iptb01.cod_tipo and cod_sec=p_iptb01.cod_sec
|
|
|
|
LET numero_msg = 39
|
|
CALL msg(numero_msg)
|
|
|
|
COMMAND "Retornar" "Retorna al menu anterior"
|
|
CLEAR FORM
|
|
EXIT MENU
|
|
END MENU
|
|
END FUNCTION
|