{ ------------------------------------------------------------------ PROGRAMA : INPRMT014 OBJETIVO : Capturar, Modificar, Eliminar registros de la Tabla de la maestra de FIANZAS. PROGRAMADOR : Tadeo A. Ferreras FECHA REALIZACION : Julio 22, 1993. ------------------------------------------------------------------ } GLOBALS "inprgb000.4gl" DEFINE fianza RECORD num_fianza INTEGER, num_res INTEGER, fecha DATE, nom_buque CHAR(20), fecha_ent DATE, cod_sp SMALLINT, cod_sp_sec SMALLINT, cod_pais CHAR(3), cant_bulto CHAR(20), num_oc INTEGER, num_emb SMALLINT, valor_merc DECIMAL(12,2), cod_ca CHAR(4), poliza CHAR(10), prima DECIMAL(12,2), porc_prima DECIMAL(5,2), valor_desm DECIMAL(5,2), valor_gar DECIMAL(12,2) END RECORD DEFINE fianza3 ARRAY[200] OF RECORD cod_n SMALLINT, cod_grupo SMALLINT, cod_tipo SMALLINT, cod_sec SMALLINT, unidad CHAR(3), descrip CHAR(30), cantidad DECIMAL(12,2), cantidad_c DECIMAL(12,2) END RECORD DEFINE datos_comp ARRAY[200] OF RECORD cod_ca CHAR(4), nom_ca CHAR(30) END RECORD DEFINE datos_pais ARRAY[200] OF RECORD cod_pais CHAR(3), nom_pais CHAR(30) END RECORD DEFINE datos_sp ARRAY[200] OF RECORD cod_sp SMALLINT, cod_sp_sec SMALLINT, nom_sp CHAR(30) END RECORD DEFINE curr INTEGER DEFINE nombre,nombre1,nombre3 CHAR(30) DEFINE cantidad1,cantidad3,total_prima,cantidad4 DECIMAL(13,3) DEFINE tasa DECIMAL(7,2) FUNCTION inprmt014() CLEAR SCREEN OPTIONS FORM LINE 9, ERROR LINE 23, COMMENT LINE 21 OPEN FORM infmmt014 FROM "infmmt014" DISPLAY FORM infmmt014 CALL pantalla() DISPLAY "inprmt014" AT 4,3 DISPLAY "Fianzas" AT 6,36 MENU "OPCIONES" COMMAND "Adicionar" " Adiciona Registro Cancela Operacion" CLEAR FORM CALL inmtad020() COMMAND "Consultar-modificar" " Realiza Busqueda Cancela Operacion" CLEAR FORM CALL inmtmd020() COMMAND "Salir" "Retorna Menu Anterior" EXIT MENU END MENU END FUNCTION FUNCTION inmtad020() # WHENEVER ERROR CONTINUE # Captura los datos que va a contener el registro INPUT BY NAME fianza.* ON KEY (control-W) CASE WHEN INFIELD(cod_ca) CALL busca_compania() LET fianza.cod_ca = datos_comp[idx].cod_ca LET nombre3 = datos_comp[idx].nom_ca DISPLAY BY NAME fianza.cod_ca,nombre3 WHEN INFIELD(cod_pais) CALL busca_pais() LET fianza.cod_pais = datos_pais[idx].cod_pais LET nombre1 = datos_pais[idx].nom_pais DISPLAY BY NAME fianza.cod_pais,nombre1 WHEN INFIELD(cod_sp) CALL busca_suplidor() LET fianza.cod_sp = datos_sp[idx].cod_sp LET fianza.cod_sp_sec= datos_sp[idx].cod_sp_sec LET nombre = datos_sp[idx].nom_sp DISPLAY BY NAME fianza.cod_sp,fianza.cod_sp_sec,nombre END CASE AFTER FIELD num_fianza IF fianza.num_fianza = 0 OR fianza.num_fianza IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD num_fianza END IF AFTER FIELD num_res IF fianza.num_res = 0 OR fianza.num_res IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD num_res END IF ##### Controla que el numero de resolucion exista en la maestra de la misma SELECT UNIQUE a.num_res FROM intb00019 a WHERE a.num_res = fianza.num_res IF status = NOTFOUND THEN LET numero_msg = 3 CALL msg(numero_msg) NEXT FIELD num_res END IF ########## Chequea que el numero de fianza no exista en la tabla SELECT UNIQUE a.num_fianza FROM intb00020 a WHERE a.num_fianza = fianza.num_fianza AND a.tipo_doc = "F" AND a.num_res = fianza.num_res IF status != NOTFOUND THEN LET numero_msg = 12 CALL msg(numero_msg) NEXT FIELD num_fianza END IF BEFORE FIELD fecha LET fianza.fecha = today DISPLAY BY NAME fianza.fecha AFTER FIELD fecha IF fianza.fecha IS NULL THEN LET fianza.fecha = today END IF AFTER FIELD cod_sp_sec IF fianza.cod_sp_sec IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD cod_sp_sec END IF ##### Busca el nombre del suplidor SELECT a.nom_sp INTO nombre FROM cotb00001 a WHERE a.cod_sp = fianza.cod_sp AND a.cod_sp_sec = fianza.cod_sp_sec AND a.status_t IS NULL IF STATUS = NOTFOUND THEN LET numero_msg = 3 CALL msg(numero_msg) NEXT FIELD cod_sp END IF DISPLAY BY NAME nombre AFTER FIELD fecha_ent IF fianza.fecha_ent IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD fecha_ent END IF AFTER FIELD cod_pais IF fianza.cod_pais IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD cod_pais END IF ####### Busca en nombre del pais SELECT a.nom_pais INTO nombre1 FROM cotb00018 a WHERE a.cod_pais = fianza.cod_pais IF STATUS = NOTFOUND THEN LET numero_msg = 3 CALL msg(numero_msg) NEXT FIELD cod_pais END IF DISPLAY BY NAME nombre1 AFTER FIELD poliza IF fianza.poliza IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD poliza END IF AFTER FIELD cod_ca IF fianza.cod_ca IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD cod_ca END IF ####### Busca el nombre de la compania aseguradora para el viaje de la ####### mercancia. SELECT a.nom_ca INTO nombre3 FROM cotb00022 a WHERE a.cod_ca = fianza.cod_ca IF STATUS = NOTFOUND THEN LET numero_msg = 3 CALL msg(numero_msg) NEXT FIELD cod_ca END IF DISPLAY BY NAME nombre3 AFTER FIELD prima IF fianza.prima IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD prima END IF AFTER FIELD porc_prima IF fianza.porc_prima IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD porc_prima END IF LET total_prima = fianza.prima * (1 + (fianza.porc_prima/100)) DISPLAY BY NAME total_prima AFTER FIELD num_oc IF fianza.num_oc IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD num_oc END IF AFTER FIELD valor_merc IF fianza.valor_merc IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD valor_merc END IF AFTER FIELD valor_desm IF fianza.valor_desm IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD valor_desm END IF SELECT UNIQUE prima INTO tasa FROM vetb00019 WHERE disponible = "S" LET fianza.valor_gar =((fianza.valor_merc * tasa) * (fianza.valor_desm/100)) + 100 DISPLAY BY NAME fianza.valor_gar END INPUT IF int_flag THEN LET numero_msg = 2 CALL msg(numero_msg) LET int_flag = FALSE RETURN END IF INPUT ARRAY fianza3 FROM fianza2.* BEFORE ROW LET curr = ARR_CURR() LET fila = SCR_LINE() ON KEY (control-W) CASE WHEN INFIELD(cod_n) LET curr = ARR_CURR() CALL busca_material() LET fianza3[curr].cod_n = datos_mt[idx].cod_n LET fianza3[curr].cod_grupo = datos_mt[idx].cod_grupo LET fianza3[curr].cod_tipo = datos_mt[idx].cod_tipo LET fianza3[curr].cod_sec = datos_mt[idx].cod_sec LET fianza3[curr].descrip = datos_mt[idx].descrip_esp LET fianza3[curr].unidad = datos_mt[idx].unidad_med DISPLAY fianza3[curr].cod_n,fianza3[curr].cod_grupo,fianza3[curr].cod_tipo, fianza3[curr].cod_sec,fianza3[curr].descrip,fianza3[curr].unidad TO fianza2[fila].cod_n,fianza2[fila].cod_grupo,fianza2[fila].cod_tipo, fianza2[fila].cod_sec,fianza2[fila].descrip,fianza2[fila].unidad NEXT FIELD cod_sec END CASE AFTER FIELD cod_sec IF fianza3[curr].cod_sec IS NOT NULL THEN IF fianza3[curr].cod_n IS NULL OR fianza3[curr].cod_n > 1 OR fianza3[curr].cod_grupo IS NULL OR fianza3[curr].cod_tipo IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD cod_n END IF ##### Buscando la descripcion del material SELECT a.descrip_esp,a.unidad_med INTO fianza3[curr].descrip,fianza3[curr].unidad FROM intb00022 a WHERE a.cod_n = fianza3[curr].cod_n AND a.cod_grupo = fianza3[curr].cod_grupo AND a.cod_tipo = fianza3[curr].cod_tipo AND a.cod_sec = fianza3[curr].cod_sec IF STATUS = NOTFOUND THEN LET numero_msg = 3 CALL msg(numero_msg) NEXT FIELD cod_n END IF DISPLAY fianza3[curr].descrip,fianza3[curr].unidad TO fianza2[fila].descrip,fianza2[fila].unidad END IF BEFORE FIELD cantidad ###### Seleciona cantidad de material pedido para ese tipo de pila y ese ###### Numero de resolucion. SELECT sum(b.cantidad) INTO cantidad1 FROM intb00020 b WHERE b.cod_n = fianza3[curr].cod_n AND b.cod_grupo = fianza3[curr].cod_grupo AND b.cod_tipo = fianza3[curr].cod_tipo AND b.cod_sec = fianza3[curr].cod_sec AND b.num_res = fianza.num_res IF cantidad1 IS NULL THEN LET cantidad1 = 0 END IF ###### Seleciona cantidad de material pedido para ese tipo de pila y ese ###### Numero de resolucion. SELECT a.cantidad INTO cantidad3 FROM intb00019 a WHERE a.cod_n = fianza3[curr].cod_n AND a.cod_grupo = fianza3[curr].cod_grupo AND a.cod_tipo = fianza3[curr].cod_tipo AND a.cod_sec = fianza3[curr].cod_sec AND a.num_res = fianza.num_res IF STATUS = NOTFOUND THEN LET numero_msg = 3 CALL msg(numero_msg) NEXT FIELD cod_n END IF ####### Resta de la cantidad pedida la cantidad llegada para ese material LET cantidad4 = cantidad3 - cantidad1 LET fianza3[curr].cantidad = cantidad4 AFTER FIELD cantidad IF fianza3[curr].cantidad IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD cantidad END IF #### Impide que la cantidad a digitar sea mayor que el balance para esa #### Produccion y ese numero de resolucion IF fianza3[curr].cantidad > cantidad4 THEN LET numero_msg = 152 CALL msg(numero_msg) NEXT FIELD cantidad END IF BEFORE FIELD cantidad_c LET fianza3[curr].cantidad_c = fianza3[curr].cantidad DISPLAY fianza3[curr].cantidad_c TO fianza2[fila].cantidad_c AFTER FIELD cantidad_c IF fianza3[curr].cantidad_c IS NULL THEN LET fianza3[curr].cantidad_c = fianza3[curr].cantidad END IF IF fianza3[curr].cantidad_c > fianza3[curr].cantidad THEN LET numero_msg = 153 CALL msg(numero_msg) NEXT FIELD cantidad_c END IF DISPLAY fianza3[curr].cantidad_c TO fianza2[fila].cantidad_c END INPUT IF int_flag THEN LET numero_msg = 2 CALL msg(numero_msg) LET int_flag = FALSE RETURN END IF ###### Proceso para insertar valores en la tabla o maestra de solicitud ##### FOR idx = 1 TO ARR_COUNT() IF fianza3[idx].cod_n IS NOT NULL AND fianza3[idx].cod_grupo IS NOT NULL OR fianza3[idx].cod_tipo IS NOT NULL OR fianza3[idx].cod_sec IS NOT NULL THEN INSERT INTO intb00020 VALUES ("F",fianza.*,fianza3[idx].cod_n,fianza3[idx].cod_grupo,fianza3[idx].cod_tipo, fianza3[idx].cod_sec,fianza3[idx].cantidad,fianza3[idx].cantidad_c, NULL,USER,CURRENT,NULL,NULL) END IF END FOR LET numero_msg = 1 CALL msg(numero_msg) CLEAR FORM END FUNCTION ######## Funcion para modificar una fianza ####### FUNCTION inmtmd020() # Aqui se prepara para la captura del criterio de seleccion CONSTRUCT criterio ON a.num_fianza,a.num_res,a.fecha FROM num_fianza,num_res,fecha IF int_flag THEN LET numero_msg = 2 CALL msg(numero_msg) LET int_flag = false RETURN END IF ######## Selecionando datos a modificar ######## LET selec = "SELECT UNIQUE a.num_fianza,a.num_res,a.fecha,a.nom_buque, ", "a.fecha_ent,a.cod_sp, a.cod_sp_sec,a.cod_pais,a.cant_bulto, ", "a.num_oc,a.num_emb,a.valor_merc,a.cod_ca,a.poliza,a.prima, ", "a.porc_prima,a.valor_desm,a.valor_gar,a.cod_n,a.cod_grupo, ", "a.cod_tipo,a.cod_sec,a.cantidad,a.cantidad_c,b.descrip_esp, ", "b.unidad_med,a.status_t,a.us_crea,a.fech_crea,a.us_mod,a.fech_mod ", "FROM intb00020 a,intb00022 b WHERE a.status_t is null AND ", "a.cod_n = b.cod_n AND a.cod_grupo = b.cod_grupo AND ", "a.cod_tipo = b.cod_tipo AND a.cod_sec = b.cod_sec AND ", "a.tipo_doc = 'F' AND ", criterio clipped, "ORDER BY 1,2" 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 fianza.* IF status >= 0 THEN IF status = NOTFOUND THEN LET numero_msg = 3 CALL msg(numero_msg) RETURN END IF CALL integridad() IF bandera = 1 THEN LET bandera = 0 RETURN END IF END IF SELECT a.nom_sp INTO nombre FROM cotb00001 a WHERE a.cod_sp = fianza.cod_sp AND a.cod_sp_sec = fianza.cod_sp_sec AND a.status_t IS NULL SELECT a.nom_pais INTO nombre1 FROM cotb00018 a WHERE a.cod_pais = fianza.cod_pais SELECT a.nom_ca INTO nombre3 FROM cotb00022 a WHERE a.cod_ca = fianza.cod_ca DISPLAY BY NAME fianza.*,nombre,nombre1,nombre3 MENU "OPCIONES " COMMAND "Siguiente" "Presenta en pantalla el proximo registro encontrado" FETCH NEXT datos INTO fianza.* IF status = NOTFOUND THEN LET numero_msg = 4 CALL msg(numero_msg) END IF SELECT a.nom_sp INTO nombre FROM cotb00001 a WHERE a.cod_sp = fianza.cod_sp AND a.cod_sp_sec = fianza.cod_sp_sec AND a.status_t IS NULL SELECT a.nom_pais INTO nombre1 FROM cotb00018 a WHERE a.cod_pais = fianza.cod_pais SELECT a.nom_ca INTO nombre3 FROM cotb00022 a WHERE a.cod_ca = fianza.cod_ca DISPLAY BY NAME fianza.*,nombre,nombre1,nombre3 COMMAND "Anterior" "Presenta en pantalla el registro anterior encontrado" FETCH PREVIOUS datos INTO fianza.* IF status = NOTFOUND THEN LET numero_msg = 5 CALL msg(numero_msg) END IF SELECT a.nom_sp INTO nombre FROM cotb00001 a WHERE a.cod_sp = fianza.cod_sp AND a.cod_sp_sec = fianza.cod_sp_sec AND a.status_t IS NULL SELECT a.nom_pais INTO nombre1 FROM cotb00018 a WHERE a.cod_pais = fianza.cod_pais SELECT a.nom_ca INTO nombre3 FROM cotb00022 a WHERE a.cod_ca = fianza.cod_ca DISPLAY BY NAME fianza.*,nombre,nombre1,nombre3 COMMAND "Primero" "Presenta en pantalla el primer registro encontrado" FETCH FIRST datos INTO fianza.* SELECT a.nom_sp INTO nombre FROM cotb00001 a WHERE a.cod_sp = fianza.cod_sp AND a.cod_sp_sec = fianza.cod_sp_sec AND a.status_t IS NULL SELECT a.nom_pais INTO nombre1 FROM cotb00018 a WHERE a.cod_pais = fianza.cod_pais SELECT a.nom_ca INTO nombre3 FROM cotb00022 a WHERE a.cod_ca = fianza.cod_ca DISPLAY BY NAME fianza.*,nombre,nombre1,nombre3 LET numero_msg = 5 CALL msg(numero_msg) COMMAND "Ultimo" "Presenta en pantalla el ultimo registro encontrado" FETCH LAST datos INTO fianza.* SELECT a.nom_sp INTO nombre FROM cotb00001 a WHERE a.cod_sp = fianza.cod_sp AND a.cod_sp_sec = fianza.cod_sp_sec AND a.status_t IS NULL SELECT a.nom_pais INTO nombre1 FROM cotb00018 a WHERE a.cod_pais = fianza.cod_pais SELECT a.nom_ca INTO nombre3 FROM cotb00022 a WHERE a.cod_ca = fianza.cod_ca DISPLAY BY NAME fianza.*,nombre,nombre1,nombre3 LET numero_msg = 4 CALL msg(numero_msg) COMMAND "Escoger" " Actualiza Registro Cancela Operacion" INPUT BY NAME fianza.num_res THRU fianza.valor_gar WITHOUT DEFAULTS ON KEY (control-W) CASE WHEN INFIELD(cod_ca) CALL busca_compania() LET fianza.cod_ca = datos_comp[idx].cod_ca LET nombre3 = datos_comp[idx].nom_ca DISPLAY BY NAME fianza.cod_ca,nombre3 WHEN INFIELD(cod_pais) CALL busca_pais() LET fianza.cod_pais = datos_pais[idx].cod_pais LET nombre1 = datos_pais[idx].nom_pais DISPLAY BY NAME fianza.cod_pais,nombre1 WHEN INFIELD(cod_sp) CALL busca_suplidor() LET fianza.cod_sp = datos_sp[idx].cod_sp LET fianza.cod_sp_sec= datos_sp[idx].cod_sp_sec LET nombre = datos_sp[idx].nom_sp DISPLAY BY NAME fianza.cod_sp,fianza.cod_sp_sec,nombre END CASE AFTER FIELD num_res IF fianza.num_res = 0 OR fianza.num_res IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD num_res END IF SELECT UNIQUE a.num_res FROM intb00019 a WHERE a.num_res = fianza.num_res IF status = NOTFOUND THEN LET numero_msg = 3 CALL msg(numero_msg) NEXT FIELD num_res END IF ########## Chequea que el numero de solicitud no exista en alguna fianza AFTER FIELD fecha IF fianza.fecha IS NULL THEN LET fianza.fecha = today END IF AFTER FIELD cod_sp_sec IF fianza.cod_sp_sec IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD cod_sp_sec END IF SELECT a.nom_sp INTO nombre FROM cotb00001 a WHERE a.cod_sp = fianza.cod_sp AND a.cod_sp_sec = fianza.cod_sp_sec AND a.status_t IS NULL IF STATUS = NOTFOUND THEN LET numero_msg = 3 CALL msg(numero_msg) NEXT FIELD cod_sp END IF DISPLAY BY NAME nombre AFTER FIELD fecha_ent IF fianza.fecha_ent IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD fecha_ent END IF AFTER FIELD cod_pais IF fianza.cod_pais IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD cod_pais END IF SELECT a.nom_pais INTO nombre1 FROM cotb00018 a WHERE a.cod_pais = fianza.cod_pais IF STATUS = NOTFOUND THEN LET numero_msg = 3 CALL msg(numero_msg) NEXT FIELD cod_pais END IF DISPLAY BY NAME nombre1 AFTER FIELD cod_ca IF fianza.cod_ca IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD cod_ca END IF SELECT a.nom_ca INTO nombre3 FROM cotb00022 a WHERE a.cod_ca = fianza.cod_ca SELECT prima INTO tasa FROM vetb00019 WHERE disponible = "S" DISPLAY BY NAME nombre3 AFTER FIELD prima IF fianza.prima IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD prima END IF AFTER FIELD valor_desm IF fianza.valor_desm IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD valor_desm END IF AFTER FIELD porc_prima IF fianza.porc_prima IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD porc_prima END IF LET total_prima = fianza.prima * (1 + (fianza.porc_prima/100)) DISPLAY BY NAME total_prima SELECT prima INTO tasa FROM vetb00019 WHERE disponible = "S" AFTER FIELD valor_merc IF fianza.valor_merc IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD valor_merc END IF AFTER FIELD valor_desm IF fianza.valor_desm IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD valor_desm END IF LET fianza.valor_gar = ((fianza.valor_merc * tasa) * (fianza.valor_desm/100)) + 100 DISPLAY BY NAME fianza.valor_gar END INPUT IF int_flag THEN LET numero_msg = 2 CALL msg(numero_msg) LET int_flag = FALSE RETURN END IF DECLARE buscar CURSOR FOR SELECT a.cod_n,a.cod_grupo,a.cod_tipo,a.cod_sec,b.unidad_med,b.descrip_esp, a.cantidad,a.cantidad_c FROM intb00020 a,intb00022 b WHERE a.cod_n=b.cod_n AND a.cod_grupo=b.cod_grupo AND a.cod_tipo=b.cod_tipo AND a.cod_sec = b.cod_sec AND a.num_fianza = fianza.num_fianza AND a.tipo_doc= "F" AND a.num_res = fianza.num_res LET idx = 1 FOREACH buscar INTO fianza3[idx].* LET idx = idx + 1 END FOREACH CALL SET_COUNT(idx - 1) INPUT ARRAY fianza3 WITHOUT DEFAULTS FROM fianza2.* BEFORE ROW LET curr = ARR_CURR() LET fila = SCR_LINE() ON KEY (control-W) CASE WHEN INFIELD(cod_n) CALL busca_material() LET fianza3[curr].cod_n = datos_mt[idx].cod_n LET fianza3[curr].cod_grupo = datos_mt[idx].cod_grupo LET fianza3[curr].cod_tipo = datos_mt[idx].cod_tipo LET fianza3[curr].cod_sec = datos_mt[idx].cod_sec LET fianza3[curr].descrip = datos_mt[idx].descrip_esp LET fianza3[curr].unidad = datos_mt[idx].unidad_med DISPLAY fianza3[curr].cod_n,fianza3[curr].cod_grupo,fianza3[curr].cod_tipo, fianza3[curr].cod_sec,fianza3[curr].descrip,fianza3[curr].unidad TO fianza2[fila].cod_n,fianza2[fila].cod_grupo,fianza2[fila].cod_tipo, fianza2[fila].cod_sec,fianza2[fila].descrip,fianza2[fila].unidad NEXT FIELD cod_sec END CASE AFTER FIELD cod_sec IF fianza3[curr].cod_sec IS NOT NULL THEN IF fianza3[curr].cod_n IS NULL OR fianza3[curr].cod_n > 1 OR fianza3[curr].cod_grupo IS NULL OR fianza3[curr].cod_tipo IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD cod_n END IF ##### Buscando la descripcion del material SELECT a.descrip_esp,a.unidad_med INTO fianza3[curr].descrip,fianza3[curr].unidad FROM intb00022 a WHERE a.cod_n = fianza3[curr].cod_n AND a.cod_grupo = fianza3[curr].cod_grupo AND a.cod_tipo = fianza3[curr].cod_tipo AND a.cod_sec = fianza3[curr].cod_sec IF STATUS = NOTFOUND THEN LET numero_msg = 3 CALL msg(numero_msg) NEXT FIELD cod_n END IF DISPLAY fianza3[curr].descrip,fianza3[curr].unidad TO fianza2[fila].descrip,fianza2[fila].unidad END IF AFTER FIELD cantidad IF fianza3[curr].cantidad IS NULL THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD cantidad END IF BEFORE FIELD cantidad_c LET fianza3[curr].cantidad_c = fianza3[curr].cantidad DISPLAY fianza3[curr].cantidad_c TO fianza2[fila].cantidad_c AFTER FIELD cantidad_c IF fianza3[curr].cantidad_c IS NULL THEN LET fianza3[curr].cantidad_c = fianza3[curr].cantidad END IF IF fianza3[curr].cantidad_c > fianza3[curr].cantidad THEN LET numero_msg = 153 CALL msg(numero_msg) NEXT FIELD cantidad_c END IF DISPLAY fianza3[curr].cantidad_c TO fianza2[fila].cantidad_c END INPUT IF int_flag THEN LET numero_msg = 2 CALL msg(numero_msg) LET int_flag = FALSE RETURN END IF ###### Proceso para insertar valores en la tabla o maestra de solicitud ##### DELETE FROM intb00020 WHERE @num_fianza = fianza.num_fianza AND @tipo_doc="F" AND @num_res = fianza.num_res FOR idx = 1 TO ARR_COUNT() IF fianza3[idx].cod_n IS NOT NULL AND fianza3[idx].cod_grupo IS NOT NULL OR fianza3[idx].cod_tipo IS NOT NULL OR fianza3[idx].cod_sec IS NOT NULL THEN INSERT INTO intb00020 VALUES ("F",fianza.*,fianza3[idx].cod_n,fianza3[idx].cod_grupo,fianza3[idx].cod_tipo, fianza3[idx].cod_sec,fianza3[idx].cantidad,fianza3[idx].cantidad_c, NULL,USER,CURRENT,NULL,NULL) END IF END FOR LET numero_msg = 13 CALL msg(numero_msg) ##### Proceso para eliminar una fianzaion ####### COMMAND KEY ("L") "eLiminar" UPDATE intb00020 set (status_t,us_mod,fech_mod) = ("E",USER,CURRENT) WHERE @num_fianza = fianza.num_fianza AND @num_res = fianza.num_res AND @tipo_doc = "F" LET numero_msg = 39 CALL msg(numero_msg) COMMAND "Retornar" "Retorna al menu anterior" CLEAR FORM EXIT MENU END MENU END FUNCTION FUNCTION busca_compania() LET int_flag = FALSE OPEN WINDOW compania1 AT 10,9 WITH FORM "infmwd001" ATTRIBUTE(BORDER,FORM LINE FIRST + 2) CONSTRUCT criterio ON a.cod_ca,a.nom_ca FROM cod_ca,nom_ca LET selec = "SELECT a.cod_ca,a.nom_ca FROM cotb00022 a ", "WHERE a.status_t IS NULL AND ",criterio CLIPPED, "ORDER BY 1" PREPARE comando1 FROM selec DECLARE comp1 CURSOR FOR comando1 LET idx = 1 FOREACH comp1 INTO datos_comp[idx].* LET idx = idx + 1 END FOREACH CALL SET_COUNT(idx - 1) DISPLAY ARRAY datos_comp TO datos_comp1.* LET idx = ARR_CURR() CLOSE WINDOW compania1 END FUNCTION FUNCTION busca_suplidor() LET int_flag = FALSE OPEN WINDOW suplidor1 AT 10,9 WITH FORM "infmwd003" ATTRIBUTE(BORDER,FORM LINE FIRST + 2) CONSTRUCT criterio ON a.cod_sp,a.cod_sp_sec,a.nom_sp FROM cod_sp,cod_sp_sec,nom_sp LET selec = "SELECT a.cod_sp,a.cod_sp_sec,a.nom_sp FROM cotb00001 a ", "WHERE a.status_t IS NULL AND ",criterio CLIPPED, "ORDER BY 1,2" PREPARE comando3 FROM selec DECLARE comp3 CURSOR FOR comando3 LET idx = 1 FOREACH comp3 INTO datos_sp[idx].* LET idx = idx + 1 END FOREACH CALL SET_COUNT(idx - 1) DISPLAY ARRAY datos_sp TO datos_sp1.* LET idx = ARR_CURR() CLOSE WINDOW suplidor1 END FUNCTION FUNCTION busca_pais() LET int_flag = FALSE OPEN WINDOW pais1 AT 10,9 WITH FORM "infmwd002" ATTRIBUTE(BORDER,FORM LINE FIRST + 2) CONSTRUCT criterio ON a.cod_pais,a.nom_pais FROM cod_pais,nom_pais LET selec = "SELECT a.cod_pais,a.nom_pais FROM cotb00018 a ", "WHERE a.status_t IS NULL AND ",criterio CLIPPED, "ORDER BY 1" PREPARE comando2 FROM selec DECLARE comp2 CURSOR FOR comando2 LET idx = 1 FOREACH comp2 INTO datos_pais[idx].* LET idx = idx + 1 END FOREACH CALL SET_COUNT(idx - 1) DISPLAY ARRAY datos_pais TO datos_pais1.* LET idx = ARR_CURR() CLOSE WINDOW pais1 END FUNCTION FUNCTION busca_material() LET int_flag = FALSE OPEN WINDOW material1 AT 10,9 WITH FORM "infmwd004" ATTRIBUTE(BORDER,FORM LINE FIRST + 2) CONSTRUCT criterio ON a.cod_n,a.cod_grupo,a.cod_tipo,a.cod_sec,a.descrip_esp, a.unidad_med FROM cod_n,cod_grupo,cod_tipo,cod_sec,descrip_esp, unidad_med LET selec = "SELECT a.cod_n,a.cod_grupo,a.cod_tipo,a.cod_sec,a.descrip_esp, ", "a.unidad_med FROM intb00001 a ", "WHERE a.status_t IS NULL AND ",criterio CLIPPED, "ORDER BY 1,2,3,4" PREPARE comando4 FROM selec DECLARE comp4 CURSOR FOR comando4 LET idx = 1 FOREACH comp4 INTO datos_mt[idx].* LET idx = idx + 1 END FOREACH CALL SET_COUNT(idx - 1) IF idx = 1 THEN LET numero_msg = 3 CALL msg(numero_msg) GOTO salir END IF DISPLAY ARRAY datos_mt TO datos_mt1.* LET idx = ARR_CURR() LABEL salir: CLOSE WINDOW material1 END FUNCTION