{ ------------------------------------------------------------------ PROGRAMA : IRPRMT011 OBJETIVO : Capturar, Modificar, Eliminar registros de la Motores Electricos. PROGRAMADOR : Ing. Juan Fco. Soto. FECHA REALIZACION : Marzo 3, 1993. ------------------------------------------------------------------ } GLOBALS "irprgb000.4gl" MAIN DEFER INTERRUPT SELECT * INTO p_companias.* FROM companias CALL irprmt011() END MAIN FUNCTION irprmt011() CLEAR SCREEN OPTIONS FORM LINE 9, ERROR LINE 23, COMMENT LINE 21 OPEN FORM irfmmt011 FROM "irfmmt011" DISPLAY FORM irfmmt011 CALL pantalla() DISPLAY "irprmt011" AT 4,3 DISPLAY "Motores Electricos" AT 6,31 MENU "OPCIONES" COMMAND "Adicionar" " Adiciona Registro Cancela Operacion" let int_flag = false CLEAR FORM CALL irpcad011() COMMAND "Consultar-modificar" " Realiza Busqueda Cancela Operacion" let int_flag = false CALL irpcmf011() COMMAND "Salir" "Retorna Menu Anterior" EXIT MENU END MENU END FUNCTION FUNCTION irpcad011() # WHENEVER ERROR CONTINUE ## Captura los datos que va a contener el registro INPUT BY NAME motor_e.* ## Verifica que el codigo_m no exista en el catalogo de maquinas. Si existe, ## entonces despliega los datos del registro existente. AFTER FIELD codigo_m IF motor_e.codigo_m is null THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD codigo_m ELSE SELECT * INTO motor_e.* FROM irtb00007 WHERE codigo_m = motor_e.codigo_m IF status >= 0 THEN IF motor_e.status_t = "E" THEN LET numero_msg = 36 CALL msg(numero_msg) DISPLAY BY NAME motor_e.* NEXT FIELD codigo_m END IF IF status != NOTFOUND THEN DISPLAY BY NAME motor_e.* LET numero_msg = 12 CALL msg(numero_msg) NEXT FIELD codigo_m END IF ELSE CALL integridad() IF bandera = 1 THEN CLEAR SCREEN RETURN END IF END IF END IF AFTER FIELD marca IF motor_e.marca IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD marca END IF AFTER FIELD modelo IF motor_e.modelo IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD modelo END IF AFTER FIELD tipo IF motor_e.tipo IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD tipo END IF AFTER FIELD ciclo IF motor_e.ciclo IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD ciclo END IF AFTER FIELD amperaje IF motor_e.amperaje IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD amperaje END IF AFTER FIELD voltaje IF motor_e.voltaje IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD voltaje END IF AFTER FIELD rpm_m IF motor_e.rpm_m IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD rpm_m END IF AFTER FIELD fase_m IF motor_e.fase_m IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD fase END IF AFTER FIELD frame IF motor_e.frame IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD frame END IF AFTER INPUT IF int_flag THEN LET numero_msg = 2 CALL msg(numero_msg) LET int_flag = FALSE RETURN END IF INSERT INTO irtb00007 VALUES (motor_e.codigo_m,motor_e.frame,motor_e.numero, motor_e.fase_m,motor_e.serie, motor_e.rpm_m,motor_e.hp_m,motor_e.voltaje,motor_e.amperaje, motor_e.ciclo,motor_e.tipo,motor_e.modelo, motor_e.marca, null, USER, CURRENT, null, null) LET numero_msg = 1 CALL msg(numero_msg) CLEAR FORM LET motor_e.codigo_m = NULL NEXT FIELD codigo_m AFTER FIELD fech_mod EXIT INPUT END INPUT END FUNCTION FUNCTION irpcmf011() ## Aqui se prepara para la captura del criterio de seleccion # WHENEVER ERROR CONTINUE CONSTRUCT criterio ON irtb00007.codigo_m FROM irtb00007.codigo_m IF int_flag THEN LET numero_msg = 2 CALL msg(numero_msg) LET int_flag = FALSE RETURN END IF LET SELEC = " SELECT UNIQUE * FROM irtb00007 where ", " status_t is null and ", criterio clipped, " ORDER BY 1" PREPARE busca FROM selec CALL integridad() if bandera = 1 THEN CLEAR SCREEN RETURN end if DECLARE datos SCROLL CURSOR FOR busca OPEN datos FETCH FIRST datos INTO motor_e.* 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 CLEAR SCREEN RETURN end if end if DISPLAY BY NAME motor_e.* MENU "OPCIONES " COMMAND "Siguiente" "Presenta en pantalla el proximo registro encontrado" FETCH NEXT datos INTO motor_e.* IF STATUS = NOTFOUND THEN LET numero_msg = 4 CALL msg(numero_msg) END IF DISPLAY BY NAME motor_e.* COMMAND "Anterior" "Presenta en pantalla el registro anterior encontrado" FETCH PREVIOUS datos INTO motor_e.* IF STATUS = NOTFOUND THEN LET numero_msg = 5 CALL msg(numero_msg) END IF DISPLAY BY NAME motor_e.* COMMAND "Primero" "Presenta en pantalla el primer registro encontrado" FETCH FIRST datos INTO motor_e.* DISPLAY BY NAME motor_e.* LET numero_msg = 5 CALL msg(numero_msg) COMMAND "Ultimo" "Presenta en pantalla el ultimo registro encontrado" FETCH LAST datos INTO motor_e.* DISPLAY BY NAME motor_e.* LET numero_msg = 4 CALL msg(numero_msg) COMMAND "Escoger" " Actualiza Registro Cancela Operacion" IF motor_e.status_t = "E" THEN LET numero_msg = 39 CALL msg(numero_msg) RETURN END IF INPUT BY NAME motor_e.frame THRU motor_e.fech_mod WITHOUT DEFAULTS AFTER FIELD marca IF motor_e.marca IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD marca END IF AFTER FIELD modelo IF motor_e.modelo IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD modelo END IF AFTER FIELD tipo IF motor_e.tipo IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD tipo END IF AFTER FIELD ciclo IF motor_e.ciclo IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD ciclo END IF AFTER FIELD amperaje IF motor_e.amperaje IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD amperaje END IF AFTER FIELD voltaje IF motor_e.voltaje IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD voltaje END IF AFTER FIELD rpm_m IF motor_e.rpm_m IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD rpm_m END IF AFTER FIELD fase_m IF motor_e.fase_m IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD fase END IF AFTER FIELD frame IF motor_e.frame IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD frame END IF AFTER INPUT IF int_flag THEN LET numero_msg = 2 CALL msg(numero_msg) LET int_flag = FALSE RETURN END IF UPDATE irtb00007 SET frame = motor_e.frame, numero = motor_e.numero, serie = motor_e.serie, fase_m = motor_e.fase_m, rpm_m = motor_e.rpm_m, hp_m = motor_e.hp_m, voltaje = motor_e.voltaje, amperaje = motor_e.amperaje, ciclo = motor_e.ciclo, tipo = motor_e.tipo, modelo = motor_e.modelo, marca = motor_e.marca, us_mod = USER, fech_mod = CURRENT WHERE codigo_m = motor_e.codigo_m LET numero_msg = 13 CALL msg(numero_msg) EXIT INPUT END INPUT COMMAND KEY ("L") "eLiminar" UPDATE irtb00007 SET status_t = "E", us_mod = user, fech_mod = current WHERE codigo_m = motor_e.codigo_m LET numero_msg = 39 CALL msg(numero_msg) COMMAND "Retornar" "Retorna al menu anterior" CLEAR FORM EXIT MENU END MENU END FUNCTION