Commit inicial: fuentes MBS ERP (Genero 6) + .gitignore + docs/SETUP_PC_MBS.md
This commit is contained in:
@@ -0,0 +1,308 @@
|
||||
{
|
||||
------------------------------------------------------------------
|
||||
PROGRAMA : TEPRMT005
|
||||
OBJETIVO : Capturar, Modificar, Eliminar registros de la
|
||||
Tabla de Presupuestos de Partidas del Cash Flow
|
||||
PROGRAMADOR : Tadeo A. Ferreras
|
||||
FECHA REALIZACION : Diciembre 06, 1995.
|
||||
------------------------------------------------------------------
|
||||
}
|
||||
GLOBALS "teprgb000.4gl"
|
||||
|
||||
FUNCTION teprmt005()
|
||||
CLEAR SCREEN
|
||||
OPTIONS
|
||||
FORM LINE 8,
|
||||
ERROR LINE 23,
|
||||
MESSAGE LINE 24,
|
||||
COMMENT LINE 21
|
||||
|
||||
OPEN FORM tefmmt005 FROM "tefmmt005"
|
||||
DISPLAY FORM tefmmt005
|
||||
CALL pantalla()
|
||||
# CALL ayuda()
|
||||
DISPLAY "teprmt005" AT 4,3 ATTRIBUTE(RED)
|
||||
DISPLAY "Estimados de Partidas Del Cash-Flow" at 6,23 ATTRIBUTE(BLACK)
|
||||
|
||||
MENU "OPCIONES"
|
||||
COMMAND "Adicionar"
|
||||
"<Esc> Adiciona Registro <Supr> Cancela Operacion"
|
||||
LET INT_FLAG = FALSE
|
||||
CLEAR FORM
|
||||
CALL tepcad005()
|
||||
COMMAND "Consultar-modificar"
|
||||
"<Esc> Realiza Busqueda <Supr> Cancela Operacion"
|
||||
LET int_flag = FALSE
|
||||
CALL tepcmf005()
|
||||
COMMAND "Salir" "Retorna Menu Anterior"
|
||||
EXIT MENU
|
||||
END MENU
|
||||
END FUNCTION
|
||||
|
||||
FUNCTION tepcad005()
|
||||
# WHENEVER ERROR CONTINUE
|
||||
## Captura los datos que va a contener el registro
|
||||
|
||||
INPUT BY NAME p_tetb04.codigo,p_tetb04.ano
|
||||
|
||||
AFTER FIELD codigo
|
||||
|
||||
IF p_tetb04.codigo is null THEN
|
||||
LET numero_msg = 16
|
||||
CALL msg(numero_msg)
|
||||
NEXT FIELD codigo
|
||||
END IF
|
||||
|
||||
SELECT UNIQUE descripcion INTO p_tetb03.descripcion
|
||||
FROM tetb00003 WHERE @codigo = p_tetb04.codigo
|
||||
|
||||
IF STATUS = NOTFOUND THEN
|
||||
LET numero_msg = 3
|
||||
CALL msg(numero_msg)
|
||||
NEXT FIELD codigo
|
||||
END IF
|
||||
|
||||
DISPLAY BY NAME p_tetb03.descripcion
|
||||
|
||||
AFTER FIELD ano
|
||||
IF p_tetb04.ano IS NULL THEN
|
||||
LET numero_msg = 16
|
||||
CALL msg(numero_msg)
|
||||
NEXT FIELD ano
|
||||
END IF
|
||||
|
||||
SELECT UNIQUE a.ano FROM tetb00004 a
|
||||
WHERE a.codigo = p_tetb04.codigo AND a.ano = p_tetb04.ano
|
||||
|
||||
IF STATUS != NOTFOUND THEN
|
||||
LET numero_msg = 12
|
||||
CALL msg(numero_msg)
|
||||
NEXT FIELD codigo
|
||||
END IF
|
||||
END INPUT
|
||||
|
||||
IF int_flag THEN
|
||||
LET numero_msg = 2
|
||||
CALL msg(numero_msg)
|
||||
LET numero_msg = FALSE
|
||||
RETURN
|
||||
END IF
|
||||
|
||||
FOR idx = 1 TO 12
|
||||
LET arr_tetb04[idx].mes = idx
|
||||
SELECT UNIQUE a.descrip INTO arr_tetb04[idx].descrip FROM mestable a
|
||||
WHERE a.mes = arr_tetb04[idx].mes
|
||||
LET arr_tetb04[idx].valor = 0
|
||||
END FOR
|
||||
CALL SET_COUNT(idx)
|
||||
|
||||
INPUT ARRAY arr_tetb04 WITHOUT DEFAULTS FROM scr_tetb04.*
|
||||
BEFORE ROW
|
||||
LET curr = ARR_CURR()
|
||||
LET fila = SCR_LINE()
|
||||
|
||||
AFTER FIELD mes
|
||||
IF arr_tetb04[curr].mes IS NOT NULL THEN
|
||||
SELECT UNIQUE a.descrip INTO arr_tetb04[curr].descrip FROM mestable a
|
||||
WHERE a.mes = arr_tetb04[curr].mes
|
||||
|
||||
IF STATUS = NOTFOUND THEN
|
||||
LET numero_msg = 3
|
||||
CALL msg(numero_msg)
|
||||
NEXT FIELD mes
|
||||
END IF
|
||||
|
||||
DISPLAY arr_tetb04[curr].descrip TO scr_tetb04[fila].descrip
|
||||
END IF
|
||||
|
||||
AFTER FIELD valor
|
||||
IF arr_tetb04[curr].valor IS NOT NULL THEN
|
||||
IF arr_tetb04[curr].valor IS NULL THEN
|
||||
LET numero_msg = 16
|
||||
CALL msg(numero_msg)
|
||||
NEXT FIELD valor
|
||||
END IF
|
||||
|
||||
END IF
|
||||
END INPUT
|
||||
IF INT_FLAG THEN
|
||||
LET numero_msg = 2
|
||||
CALL msg(numero_msg)
|
||||
LET INT_FLAG = FALSE
|
||||
RETURN
|
||||
END IF
|
||||
|
||||
FOR idx = 1 TO 12
|
||||
IF arr_tetb04[idx].valor IS NULL THEN
|
||||
LET arr_tetb04[idx].valor = 0
|
||||
END IF
|
||||
|
||||
INSERT INTO tetb00004 VALUES (p_tetb04.codigo,p_tetb04.ano,
|
||||
idx,arr_tetb04[idx].valor,
|
||||
NULL,USER,CURRENT,NULL,NULL)
|
||||
END FOR
|
||||
LET numero_msg = 1
|
||||
CALL msg(numero_msg)
|
||||
END FUNCTION
|
||||
|
||||
FUNCTION tepcmf005()
|
||||
LET int_flag = FALSE
|
||||
## Aqui se prepara para la captura del criterio de seleccion
|
||||
MESSAGE ""
|
||||
CLEAR FORM
|
||||
CONSTRUCT criterio ON a.codigo,a.ano FROM codigo,ano
|
||||
|
||||
IF int_flag THEN
|
||||
LET numero_msg = 2
|
||||
CALL msg(numero_msg)
|
||||
LET int_flag = FALSE
|
||||
RETURN
|
||||
END IF
|
||||
|
||||
LET SELEC =
|
||||
"SELECT UNIQUE a.codigo,a.ano,b.descripcion ",
|
||||
"FROM tetb00004 a,tetb00003 b ",
|
||||
"WHERE (a.codigo = b.codigo) AND a.status_t IS NULL AND ",
|
||||
criterio clipped," ORDER BY a.codigo,a.ano "
|
||||
|
||||
PREPARE busca FROM selec
|
||||
|
||||
CALL integridad()
|
||||
IF bandera = 1 THEN
|
||||
LET bandera = 0
|
||||
RETURN
|
||||
END IF
|
||||
|
||||
DECLARE datos SCROLL CURSOR FOR busca
|
||||
OPEN datos
|
||||
|
||||
FETCH FIRST datos INTO p_tetb04.codigo,p_tetb04.ano,p_tetb03.descripcion
|
||||
IF STATUS = NOTFOUND THEN
|
||||
LET numero_msg = 3
|
||||
CALL msg(numero_msg)
|
||||
RETURN
|
||||
END IF
|
||||
|
||||
DISPLAY BY NAME p_tetb04.codigo,p_tetb04.ano,p_tetb03.descripcion
|
||||
|
||||
MENU "OPCIONES "
|
||||
COMMAND "Siguiente" "Presenta en pantalla el proximo registro encontrado"
|
||||
FETCH NEXT datos INTO p_tetb04.codigo,p_tetb04.ano,p_tetb03.descripcion
|
||||
IF STATUS = NOTFOUND THEN
|
||||
LET numero_msg = 4
|
||||
CALL msg(numero_msg)
|
||||
END IF
|
||||
|
||||
DISPLAY BY NAME p_tetb04.codigo,p_tetb04.ano,p_tetb03.descripcion
|
||||
|
||||
COMMAND "Anterior" "Presenta en pantalla el registro anterior encontrado"
|
||||
FETCH PREVIOUS datos INTO p_tetb04.codigo,p_tetb04.ano,
|
||||
p_tetb03.descripcion
|
||||
IF STATUS = NOTFOUND THEN
|
||||
LET numero_msg = 5
|
||||
CALL msg(numero_msg)
|
||||
END IF
|
||||
|
||||
DISPLAY BY NAME p_tetb04.codigo,p_tetb04.ano,p_tetb03.descripcion
|
||||
|
||||
COMMAND "Primero" "Presenta en pantalla el primer registro encontrado"
|
||||
FETCH FIRST datos INTO p_tetb04.codigo,p_tetb04.ano,p_tetb03.descripcion
|
||||
|
||||
DISPLAY BY NAME p_tetb04.codigo,p_tetb04.ano,p_tetb03.descripcion
|
||||
|
||||
LET numero_msg = 5
|
||||
CALL msg(numero_msg)
|
||||
|
||||
COMMAND "Ultimo" "Presenta en pantalla el ultimo registro encontrado"
|
||||
FETCH LAST datos INTO p_tetb04.codigo,p_tetb04.ano,p_tetb03.descripcion
|
||||
|
||||
DISPLAY BY NAME p_tetb04.codigo,p_tetb04.ano,p_tetb03.descripcion
|
||||
|
||||
LET numero_msg = 4
|
||||
CALL msg(numero_msg)
|
||||
|
||||
COMMAND "Escoger" "<Esc> Actualiza Registro <Supr> Cancela Operacion"
|
||||
|
||||
IF int_flag THEN
|
||||
LET numero_msg = 2
|
||||
CALL msg(numero_msg)
|
||||
LET numero_msg = FALSE
|
||||
RETURN
|
||||
END IF
|
||||
|
||||
DECLARE buscar CURSOR FOR
|
||||
SELECT a.mes,b.descrip,a.valor FROM tetb00004 a, mestable b
|
||||
WHERE (a.mes = b.mes) AND (a.codigo = p_tetb04.codigo) AND
|
||||
(a.ano = p_tetb04.ano) AND (a.status_t IS NULL) ORDER BY 1
|
||||
|
||||
LET idx = 1
|
||||
FOREACH buscar INTO arr_tetb04[idx].*
|
||||
LET idx = idx + 1
|
||||
END FOREACH
|
||||
CALL SET_COUNT(idx-1)
|
||||
|
||||
INPUT ARRAY arr_tetb04 WITHOUT DEFAULTS FROM scr_tetb04.*
|
||||
BEFORE ROW
|
||||
LET curr = ARR_CURR()
|
||||
LET fila = SCR_LINE()
|
||||
|
||||
AFTER FIELD mes
|
||||
IF arr_tetb04[curr].mes IS NOT NULL THEN
|
||||
SELECT UNIQUE a.descrip INTO arr_tetb04[curr].descrip FROM mestable a
|
||||
WHERE a.mes = arr_tetb04[curr].mes
|
||||
|
||||
IF STATUS = NOTFOUND THEN
|
||||
LET numero_msg = 3
|
||||
CALL msg(numero_msg)
|
||||
NEXT FIELD mes
|
||||
END IF
|
||||
|
||||
DISPLAY arr_tetb04[curr].descrip TO scr_tetb04[fila].descrip
|
||||
END IF
|
||||
|
||||
AFTER FIELD valor
|
||||
IF arr_tetb04[curr].valor IS NOT NULL THEN
|
||||
IF arr_tetb04[curr].valor IS NULL THEN
|
||||
LET numero_msg = 16
|
||||
CALL msg(numero_msg)
|
||||
NEXT FIELD valor
|
||||
END IF
|
||||
|
||||
END IF
|
||||
END INPUT
|
||||
IF INT_FLAG THEN
|
||||
LET numero_msg = 2
|
||||
CALL msg(numero_msg)
|
||||
LET INT_FLAG = FALSE
|
||||
RETURN
|
||||
END IF
|
||||
|
||||
DELETE FROM tetb00004 WHERE @codigo = p_tetb04.codigo AND
|
||||
@ano = p_tetb04.ano
|
||||
|
||||
FOR idx = 1 TO 12
|
||||
IF arr_tetb04[idx].valor IS NULL THEN
|
||||
LET arr_tetb04[idx].valor = 0
|
||||
END IF
|
||||
|
||||
INSERT INTO tetb00004 VALUES (p_tetb04.codigo,p_tetb04.ano,
|
||||
idx,arr_tetb04[idx].valor,
|
||||
NULL,USER,CURRENT,NULL,NULL)
|
||||
END FOR
|
||||
LET numero_msg = 13
|
||||
CALL msg(numero_msg)
|
||||
|
||||
COMMAND KEY ("L") "eLiminar" "Elimina registro que esta en la pantalla"
|
||||
|
||||
UPDATE tetb00004 SET (status_t,us_mod,fech_mod)
|
||||
= ("E",USER,CURRENT)
|
||||
WHERE @codigo = p_tetb04.codigo AND @ano=p_tetb04.ano
|
||||
|
||||
LET numero_msg = 39
|
||||
CALL msg(numero_msg)
|
||||
|
||||
COMMAND "Retornar" "Retorna al menu anterior"
|
||||
CLEAR FORM
|
||||
EXIT MENU
|
||||
END MENU
|
||||
END FUNCTION
|
||||
Reference in New Issue
Block a user