321 lines
9.9 KiB
Plaintext
321 lines
9.9 KiB
Plaintext
{
|
|
------------------------------------------------------------------
|
|
PROGRAMA : IPPRMT003
|
|
OBJETIVO : Capturar, Modificar, Eliminar registros de la
|
|
Tabla Tipos de Movimientos.
|
|
PROGRAMADOR : Ing. Juan Soto.
|
|
FECHA REALIZACION : Enero 1997
|
|
DIRECTOR PROYECTO : JOSE ALFREDO PAULINO ALEJO
|
|
------------------------------------------------------------------
|
|
}
|
|
GLOBALS "ipprgb000.4gl"
|
|
|
|
MAIN
|
|
DEFER INTERRUPT
|
|
DEFER INTERRUPT
|
|
CALL ARG_VAL(1) RETURNING usuarios
|
|
CALL ARG_VAL(2) RETURNING clave
|
|
CONNECT to "decomarmol" USER usuarios USING clave
|
|
SELECT * INTO p_companias.* FROM companias
|
|
CALL ipprmt003()
|
|
END MAIN
|
|
|
|
FUNCTION ipprmt003()
|
|
CLEAR SCREEN
|
|
OPTIONS
|
|
FORM LINE 9,
|
|
ERROR LINE 23,
|
|
COMMENT LINE 21
|
|
|
|
OPEN FORM ipfmmt003 FROM "ipfmmt003"
|
|
DISPLAY FORM ipfmmt003
|
|
DISPLAY "ipprmt003" AT 4,3
|
|
DISPLAY "Tipos de Movimientos" AT 6,32
|
|
|
|
MENU "OPCIONES"
|
|
COMMAND "Adicionar"
|
|
"<Esc> Adiciona Registro <Delete> Cancela Operacion"
|
|
let int_flag = false
|
|
CLEAR FORM
|
|
let int_flag = false
|
|
CALL ippcad003()
|
|
COMMAND "Consultar-modificar"
|
|
"<Esc> Realiza Busqueda <Delete> Cancela Operacion"
|
|
CALL ippcmf003()
|
|
COMMAND "Salir" "Retorna Menu Anterior"
|
|
EXIT MENU
|
|
END MENU
|
|
END FUNCTION
|
|
|
|
FUNCTION ippcad003()
|
|
## Captura los datos que va a contener el registro
|
|
#WHENEVER ERROR CONTINUE
|
|
INPUT BY NAME transacc.*
|
|
|
|
## Verifica que el codigo no exista en el catalogo de transacciones. Si existe,
|
|
## entonces despliega los datos del registro existente.
|
|
|
|
AFTER FIELD cod_mov
|
|
IF transacc.cod_mov = 0 OR
|
|
transacc.cod_mov IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_mov
|
|
ELSE
|
|
SELECT * INTO transacc.* FROM iptb00005
|
|
WHERE cod_mov = transacc.cod_mov
|
|
|
|
IF status >= 0 THEN
|
|
IF STATUS != NOTFOUND THEN
|
|
IF transacc.status_t = "E" THEN
|
|
LET numero_msg = 36
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_mov
|
|
END IF
|
|
|
|
DISPLAY BY NAME transacc.*
|
|
LET numero_msg = 12
|
|
CALL msg(numero_msg)
|
|
LET transacc.descrip_mov = NULL
|
|
LET transacc.status_mov = NULL
|
|
LET transacc.cuenta_1 = NULL
|
|
LET transacc.cuenta_2 = NULL
|
|
LET transacc.cuenta_3 = NULL
|
|
|
|
NEXT FIELD cod_mov
|
|
END IF
|
|
ELSE
|
|
CALL integridad()
|
|
|
|
if bandera = 1 THEN
|
|
LET bandera = 0
|
|
RETURN
|
|
end if
|
|
END IF
|
|
END IF
|
|
AFTER FIELD descrip_mov
|
|
IF transacc.descrip_mov IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD descrip_mov
|
|
END IF
|
|
|
|
|
|
AFTER INPUT
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
RETURN
|
|
END IF
|
|
|
|
IF transacc.descrip_mov IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD descrip_mov
|
|
ELSE
|
|
INSERT INTO iptb00005 VALUES (transacc.cod_mov,
|
|
transacc.descrip_mov, transacc.status_mov,
|
|
transacc.cuenta_1, transacc.cuenta_2,
|
|
transacc.cuenta_3, null,SUSER_SNAME(), GETDATE(), null,null,
|
|
transacc.control_clientes, transacc.control_despacho,
|
|
transacc.control_devolucion,transacc.control_transferencia,transacc.control_departamento)
|
|
CALL integridad()
|
|
|
|
if bandera = 1 THEN
|
|
LET bandera = 0
|
|
RETURN
|
|
end if
|
|
LET numero_msg = 1
|
|
CALL msg(numero_msg)
|
|
CLEAR FORM
|
|
LET transacc.cod_mov = NULL
|
|
LET transacc.descrip_mov = NULL
|
|
LET transacc.status_mov = NULL
|
|
LET transacc.cuenta_1 = NULL
|
|
LET transacc.cuenta_2 = NULL
|
|
LET transacc.cuenta_3 = NULL
|
|
NEXT FIELD cod_mov
|
|
|
|
END IF
|
|
|
|
AFTER FIELD fech_mod
|
|
EXIT INPUT
|
|
END INPUT
|
|
|
|
END FUNCTION
|
|
|
|
FUNCTION ippcmf003()
|
|
## Aqui se prepara para la captura del criterio de seleccion
|
|
#WHENEVER ERROR CONTINUE
|
|
CONSTRUCT criterio ON iptb00005.cod_mov,iptb00005.descrip_mov
|
|
FROM cod_mov,descrip_mov
|
|
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
RETURN
|
|
END IF
|
|
|
|
LET SELEC = " SELECT UNIQUE * FROM iptb00005 where ",
|
|
" status_t is null and ",
|
|
criterio clipped,
|
|
" ORDER BY cod_mov"
|
|
|
|
PREPARE busca FROM selec
|
|
CALL integridad()
|
|
|
|
if bandera = 1 THEN
|
|
LET bandera = 0
|
|
RETURN
|
|
end if
|
|
DECLARE datos SCROLL CURSOR WITH HOLD FOR busca
|
|
OPEN datos
|
|
|
|
FETCH FIRST datos INTO transacc.*
|
|
|
|
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
|
|
DISPLAY BY NAME transacc.*
|
|
|
|
MENU "OPCIONES "
|
|
COMMAND "Siguiente"
|
|
"Presenta en pantalla el proximo registro encontrado"
|
|
FETCH NEXT datos INTO transacc.*
|
|
IF STATUS = NOTFOUND THEN
|
|
LET numero_msg = 4
|
|
CALL msg(numero_msg)
|
|
END IF
|
|
CALL integridad()
|
|
|
|
if bandera = 1 THEN
|
|
LET bandera = 0
|
|
RETURN
|
|
end if
|
|
DISPLAY BY NAME transacc.*
|
|
|
|
COMMAND "Anterior"
|
|
"Presenta en pantalla el registro anterior encontrado"
|
|
FETCH PREVIOUS datos INTO transacc.*
|
|
IF STATUS = NOTFOUND THEN
|
|
LET numero_msg = 5
|
|
CALL msg(numero_msg)
|
|
END IF
|
|
CALL integridad()
|
|
|
|
if bandera = 1 THEN
|
|
LET bandera = 0
|
|
RETURN
|
|
end if
|
|
DISPLAY BY NAME transacc.*
|
|
|
|
COMMAND "Primero"
|
|
"Presenta en pantalla el primer registro encontrado"
|
|
FETCH FIRST datos INTO transacc.*
|
|
DISPLAY BY NAME transacc.*
|
|
LET numero_msg = 5
|
|
CALL msg(numero_msg)
|
|
|
|
COMMAND "Ultimo"
|
|
"Presenta en pantalla el ultimo registro encontrado"
|
|
FETCH LAST datos INTO transacc.*
|
|
DISPLAY BY NAME transacc.*
|
|
LET numero_msg = 4
|
|
CALL msg(numero_msg)
|
|
|
|
COMMAND "Escoger"
|
|
"<Esc> Actualiza Registro <Delete> Cancela Operacion"
|
|
# Verifica que el movimiento sea del usuario creador
|
|
SELECT *FROM iptb00005 where cod_mov = transacc.cod_mov and
|
|
us_crea = SUSER_SNAME()
|
|
IF status = notfound THEN
|
|
LET numero_msg = 139
|
|
CALL msg(numero_msg)
|
|
#RETURN
|
|
END IF
|
|
INPUT BY NAME transacc.descrip_mov,
|
|
transacc.status_mov,
|
|
transacc.cuenta_1,
|
|
transacc.cuenta_2,
|
|
transacc.cuenta_3,
|
|
transacc.control_clientes,
|
|
transacc.control_despacho,
|
|
transacc.control_devolucion,
|
|
transacc.control_transferencia,
|
|
transacc.control_departamento,
|
|
transacc.us_crea,
|
|
transacc.fech_crea,
|
|
transacc.us_mod,
|
|
transacc.fech_mod WITHOUT DEFAULTS
|
|
|
|
AFTER FIELD descrip_mov
|
|
IF transacc.descrip_mov IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD descrip_mov
|
|
END IF
|
|
|
|
|
|
AFTER INPUT
|
|
|
|
#### Verifica si el usuario presiono la tecla <Delete>
|
|
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
RETURN
|
|
END IF
|
|
|
|
UPDATE iptb00005 SET descrip_mov = transacc.descrip_mov,
|
|
status_mov = transacc.status_mov,
|
|
cuenta_1 = transacc.cuenta_1,
|
|
cuenta_2 = transacc.cuenta_2,
|
|
cuenta_3 = transacc.cuenta_3,
|
|
us_mod = usuarios,
|
|
fech_mod = GETDATE(),
|
|
control_clientes = transacc.control_clientes,
|
|
control_despacho = transacc.control_despacho,
|
|
control_devolucion = transacc.control_devolucion,
|
|
control_transferencia = transacc.control_transferencia,
|
|
control_departamento = transacc.control_departamento
|
|
WHERE cod_mov = transacc.cod_mov
|
|
|
|
CALL integridad()
|
|
|
|
if bandera = 1 THEN
|
|
LET bandera = 0
|
|
RETURN
|
|
end if
|
|
LET numero_msg = 13
|
|
CALL msg(numero_msg)
|
|
|
|
EXIT INPUT
|
|
END INPUT
|
|
COMMAND KEY ("L") "eLiminar"
|
|
|
|
UPDATE iptb00005 SET status_t = "E"
|
|
WHERE cod_mov = transacc.cod_mov
|
|
|
|
LET numero_msg = 39
|
|
CALL msg(numero_msg)
|
|
COMMAND "Retornar"
|
|
"Retorna al menu anterior"
|
|
CLEAR FORM
|
|
EXIT MENU
|
|
END MENU
|
|
END FUNCTION
|