{ ------------------------------------------------------------------------------- PROGRAMA : COPRMT005 OBJETIVO : Capturar, Modificar, Eliminar registros de la Tabla Nomenclatura Arancelaria. PROGRAMADOR : JUAN SOTO FECHA REALIZACION : Agosto 1997 DIRECTOR PROYECTO : JOSE ALFREDO PAULINO ------------------------------------------------------------------------------- } GLOBALS "coprgb000.4gl" FUNCTION coprmt005() CLEAR SCREEN OPTIONS FORM LINE 9, ERROR LINE 23, COMMENT LINE 21 OPEN FORM cofmmt005 FROM "cofmmt005" DISPLAY FORM cofmmt005 CALL pantalla() DISPLAY "coprmt005" AT 4,3 DISPLAY "Nomenclatura Arancelaria" AT 6,28 MENU "OPCIONES" COMMAND "Adicionar" " Adiciona Registro Cancela Operacion" CLEAR FORM LET int_flag = false CALL copcad005() COMMAND "Consultar-modificar" " Realiza Busqueda Cancela Operacion" LET int_flag = false CALL copcmf005() COMMAND "Salir" "Retorna Menu Anterior" EXIT MENU END MENU END FUNCTION FUNCTION copcad005() WHENEVER ERROR CONTINUE ## Captura los datos que va a contener el registro INPUT BY NAME arancel.* ## Verifica que el codigo no exista en el catalogo de aranceles. Si existe, ## entonces despliega los datos del registro existente. AFTER FIELD cod_nab IF arancel.cod_nab = "00.00.00.00" OR arancel.cod_nab IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD cod_nab ELSE SELECT * INTO arancel.* FROM cotb00005 WHERE cod_nab = arancel.cod_nab IF STATUS != NOTFOUND THEN IF arancel.status_t = "E" THEN LET numero_msg = 36 CALL msg(numero_msg) NEXT FIELD cod_nab END IF DISPLAY BY NAME arancel.* LET numero_msg = 12 CALL msg(numero_msg) LET arancel.descrip_esp = NULL NEXT FIELD cod_nab ELSE CALL integridad() if bandera = 1 THEN LET bandera = 0 RETURN end if INITIALIZE arancel.descrip_esp,arancel.descrip_ing TO NULL DISPLAY BY NAME arancel.descrip_esp,arancel.descrip_ing END IF END IF AFTER FIELD descrip_esp IF arancel.descrip_esp IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD descrip_esp END IF AFTER INPUT IF int_flag THEN LET numero_msg = 2 CALL msg(numero_msg) LET int_flag = FALSE RETURN END IF IF arancel.descrip_esp IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD descrip_esp ELSE INSERT INTO cotb00005 VALUES (arancel.cod_nab, arancel.descrip_esp, arancel.descrip_ing, NULL,USER, CURRENT, null, null) CALL integridad() if bandera = 1 THEN LET bandera = 0 RETURN end if LET numero_msg = 1 CALL msg(numero_msg) CLEAR FORM LET arancel.cod_nab = NULL LET arancel.descrip_esp = NULL NEXT FIELD cod_nab END IF END INPUT END FUNCTION FUNCTION copcmf005() WHENEVER ERROR CONTINUE ## Aqui se prepara para la captura del criterio de seleccion CONSTRUCT criterio ON cotb00005.* FROM cotb00005.* IF int_flag THEN LET numero_msg = 2 CALL msg(numero_msg) LET numero_msg = FALSE RETURN END IF LET SELEC = "SELECT UNIQUE * FROM cotb00005 ", "WHERE status_t is null and ",criterio clipped, " ORDER BY 1" PREPARE busca FROM selec DECLARE datos SCROLL CURSOR FOR busca OPEN datos CALL integridad() if bandera = 1 THEN LET bandera = 0 RETURN end if FETCH FIRST datos INTO arancel.* IF STATUS = NOTFOUND THEN LET numero_msg = 19 CALL msg(numero_msg) RETURN END IF DISPLAY BY NAME arancel.* MENU "OPCIONES" COMMAND "Siguiente" "Presenta en pantalla el proximo registro encontrado" FETCH NEXT datos INTO arancel.* IF STATUS = NOTFOUND THEN LET numero_msg = 4 CALL msg(numero_msg) END IF DISPLAY BY NAME arancel.* COMMAND "Anterior" "Presenta en pantalla el registro anterior encontrado" FETCH PREVIOUS datos INTO arancel.* IF STATUS = NOTFOUND THEN LET numero_msg = 5 CALL msg(numero_msg) END IF DISPLAY BY NAME arancel.* COMMAND "Primero" "Presenta en pantalla el primer registro encontrado" FETCH FIRST datos INTO arancel.* DISPLAY BY NAME arancel.* LET numero_msg = 5 CALL msg(numero_msg) COMMAND "Ultimo" "Presenta en pantalla el ultimo registro encontrado" FETCH LAST datos INTO arancel.* DISPLAY BY NAME arancel.* LET numero_msg = 4 CALL msg(numero_msg) COMMAND "Escoger" " Actualiza Registro Cancela Operacion" IF arancel.status_t != "E" THEN LET numero_msg = 36 CALL msg(numero_msg) RETURN END IF INPUT BY NAME arancel.descrip_esp, arancel.descrip_ing, arancel.us_crea, arancel.fech_crea, arancel.us_mod, arancel.fech_mod WITHOUT DEFAULTS AFTER FIELD descrip_esp IF arancel.descrip_esp IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD descrip_esp END IF AFTER INPUT ## Verifica si el usuario presiono la tecla IF int_flag THEN LET numero_msg = 2 CALL msg(numero_msg) LET int_flag = FALSE RETURN END IF UPDATE cotb00005 SET descrip_esp = arancel.descrip_esp, descrip_ing = arancel.descrip_ing, us_mod = USER, fech_mod = CURRENT WHERE cod_nab = arancel.cod_nab LET numero_msg = 13 CALL msg(numero_msg) EXIT INPUT END INPUT COMMAND KEY ("L") "eLiminar" UPDATE cotb00005 SET status_t = "E" WHERE cod_nab = arancel.cod_nab LET numero_msg = 39 CALL msg(numero_msg) COMMAND "Retornar" "Retorna al menu anterior" CLEAR FORM EXIT MENU END MENU END FUNCTION