{ ========================================================================== PROGRAMA : INPRMT098 OBJETIVO : Des - Cierre Anual del Inventario de Materias Primas REALIZADO POR : Abner Montalvo FECHA : Octubre 8, 1997. ========================================================================== } GLOBALS "inprgb000.4gl" DEFINE trn RECORD cod_n LIKE intb00006.cod_n, cod_grupo LIKE intb00006.cod_grupo, cod_tipo LIKE intb00006.cod_tipo, cod_sec LIKE intb00006.cod_sec, cantidad_2 LIKE intb00006.cantidad_2 END RECORD DEFINE productos RECORD LIKE intb00002.* DEFINE status_orden CHAR(1) DEFINE secuencia INTEGER DEFINE fecha_cierre DATE DEFINE intb6_ascii CHAR(100) DEFINE intb2_ascii CHAR(100) DEFINE intb6_dbsch CHAR(100) DEFINE intb2_dbsch CHAR(100) DEFINE intb24 CHAR(100) DEFINE intb24_dat CHAR(100) DEFINE intb24_idx CHAR(100) DEFINE forma_ld CHAR(100) DEFINE err_val INTEGER FUNCTION inprmt098() OPTIONS PROMPT LINE 20, FORM LINE 8, ERROR LINE 24 OPEN FORM infmmt098 FROM "infmmt098" DISPLAY FORM infmmt098 CALL pantalla() DISPLAY "inprmt098" AT 4,3 DISPLAY " Des - Cierre Anual " AT 6,30 LET fecha_cierre = NULL SELECT UNIQUE MAX(fecha) INTO fecha_cierre FROM intb00006 WHERE cod_mov = 1 AND status_t IS NULL IF fecha_cierre IS NULL THEN LET numero_msg = 379 CALL msg(numero_msg) LET int_flag = FALSE SLEEP 2 RETURN END IF #LET fecha_cierre = "31/12/95" DISPLAY BY NAME fecha_cierre LET secuencia = fecha_cierre USING "DDMMYY" LET intb6_ascii = fgl_getenv("DBPATH") CLIPPED,"/rayovac.dbs/", "intb00006_ascii.", fecha_cierre USING "DDMMYY" LET intb2_ascii = fgl_getenv("DBPATH") CLIPPED,"/rayovac.dbs/", "intb00002_ascii.", fecha_cierre USING "DDMMYY" LET intb6_dbsch = "dbschema -d rayovac -t intb00006 ", fgl_getenv("DBPATH") CLIPPED,"/rayovac.dbs/", "intb00006_dbsch.", fecha_cierre USING "DDMMYY" LET intb2_dbsch = "dbschema -d rayovac -t intb00002 ", fgl_getenv("DBPATH") CLIPPED,"/rayovac.dbs/", "intb00002_dbsch.", fecha_cierre USING "DDMMYY" SELECT dirpath INTO intb24 FROM systables WHERE tabname = "intb00024" LET intb24 = fgl_getenv("DBPATH") CLIPPED,"/rayovac.dbs/",intb24 LET intb24_dat = "cp ", intb24 CLIPPED, ".dat.", fecha_cierre USING "DDMMYY", " ", intb24 CLIPPED, ".dat" LET intb24_idx = "cp ", intb24 CLIPPED, ".idx.", fecha_cierre USING "DDMMYY", " ", intb24 CLIPPED, ".idx" #DISPLAY intb6_ascii AT 6,2 #DISPLAY intb2_ascii AT 7,2 #DISPLAY intb6_dbsch AT 8,2 #DISPLAY intb2_dbsch AT 9,2 #DISPLAY intb24 AT 10,2 #DISPLAY intb24_dat AT 11,2 #DISPLAY intb24_idx AT 12,2 LABEL volver: PROMPT " Estas Seguro de Proceder (S/N)? " FOR decide LET decide = UPSHIFT(decide) IF decide != "S" AND decide != "N" THEN GOTO volver END IF IF decide != "S" THEN RETURN END IF IF int_flag THEN LET numero_msg = 2 CALL msg(numero_msg) LET int_flag = FALSE RETURN END IF DISPLAY " " AT 20,10 DISPLAY " Cargando los Registros en la tabla de Transacciones " AT 20,10 LOAD FROM intb6_ascii INSERT INTO intb00006 DISPLAY " Eliminando Balances Finales del Cierre " AT 20,10 DELETE FROM intb00006 WHERE cod_mov = 1 AND fecha = fecha_cierre { DISPLAY " Eliminando del Historico de Materias Primas " AT 20,10 DELETE FROM intb00025 WHERE fecha = fecha_cierre DISPLAY " Restaurando el Historico de Transacciones " AT 20,10 } RUN intb24_dat RUN intb24_idx LET forma_ld = "rm ", fgl_getenv("DBPATH") CLIPPED, "/rayovac.dbs/*.", fecha_cierre USING "DDMMYY" RUN forma_ld END FUNCTION