294 lines
8.9 KiB
Plaintext
294 lines
8.9 KiB
Plaintext
{
|
|
------------------------------------------------------------------
|
|
PROGRAMA : CTPRMT027
|
|
OBJETIVO : Capturar, Modificar, Eliminar registros de la
|
|
Tabla cttb00038
|
|
PROGRAMADOR : Ing. Maria F. Gomez
|
|
FECHA REALIZACION : Agosto 15, 1996.
|
|
------------------------------------------------------------------
|
|
}
|
|
GLOBALS "ctprgb000.4gl"
|
|
|
|
FUNCTION ctprmt027()
|
|
# WHENEVER ERROR CONTINUE
|
|
CLEAR SCREEN
|
|
OPTIONS
|
|
FORM LINE 9,
|
|
ERROR LINE 23,
|
|
COMMENT LINE 21
|
|
|
|
OPEN FORM ctfmmt027 FROM "ctfmmt027"
|
|
DISPLAY FORM ctfmmt027
|
|
CALL pantalla()
|
|
DISPLAY "ctprmt027" AT 4,3
|
|
DISPLAY "Mantenimiento Costo/Standard/Reporte" AT 6,22
|
|
|
|
MENU "OPCIONES"
|
|
COMMAND "Adicionar"
|
|
"<Esc> Adiciona Registro <Supr> Cancela Operacion"
|
|
LET int_flag = FALSE
|
|
CLEAR FORM
|
|
CALL ctpcoa001()
|
|
COMMAND "Consultar-modificar"
|
|
"<Esc> Realiza Busqueda <Supr> Cancela Operacion"
|
|
LET INT_FLAG = FALSE
|
|
CALL ctpcom001()
|
|
COMMAND "Salir" "Retorna Menu Anterior"
|
|
EXIT MENU
|
|
END MENU
|
|
END FUNCTION
|
|
|
|
FUNCTION ctpcoa001()
|
|
#WHENEVER ERROR CONTINUE
|
|
## Captura los datos que va a contener el registro
|
|
|
|
LET int_flag = false
|
|
|
|
LABEL vuelve:
|
|
INPUT BY NAME costo_stand.*
|
|
|
|
AFTER FIELD ventas
|
|
IF costo_stand.ventas IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD ventas
|
|
END IF
|
|
AFTER FIELD nomenclatura
|
|
IF costo_stand.nomenclatura is null THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD ventas
|
|
END IF
|
|
|
|
SELECT * INTO costo_stand.* FROM cttb00038
|
|
WHERE nomenclatura = costo_stand.nomenclatura and
|
|
ventas = costo_stand.ventas
|
|
|
|
IF status != notfound THEN
|
|
IF costo_stand.status_t = "E" THEN
|
|
LET numero_msg = 36
|
|
CALL msg(numero_msg)
|
|
DISPLAY BY NAME costo_stand.*
|
|
NEXT FIELD ventas
|
|
END IF
|
|
|
|
LET numero_msg = 12
|
|
CALL msg(numero_msg)
|
|
DISPLAY BY NAME costo_stand.*
|
|
NEXT FIELD ventas
|
|
END IF
|
|
LET costo_stand.ano = null
|
|
LET costo_stand.mes = null
|
|
LET costo_stand.costo_st = null
|
|
LET costo_stand.us_crea = null
|
|
LET costo_stand.fech_crea = null
|
|
LET costo_stand.us_mod = null
|
|
LET costo_stand.fech_mod = null
|
|
|
|
DISPLAY BY NAME costo_stand.*
|
|
CALL integridad()
|
|
|
|
IF bandera = 1 THEN
|
|
LET bandera = 0
|
|
RETURN
|
|
END IF
|
|
|
|
AFTER FIELD ano
|
|
IF costo_stand.ano IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD ano
|
|
END IF
|
|
|
|
AFTER FIELD mes
|
|
IF costo_stand.mes IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD mes
|
|
END IF
|
|
|
|
AFTER FIELD costo_st
|
|
IF costo_stand.costo_st IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD costo_st
|
|
END IF
|
|
|
|
AFTER INPUT
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
RETURN
|
|
END IF
|
|
EXIT INPUT
|
|
END INPUT
|
|
|
|
INSERT INTO cttb00038 VALUES
|
|
(costo_stand.ventas,costo_stand.nomenclatura,costo_stand.ano,
|
|
costo_stand.mes,costo_stand.costo_st, 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)
|
|
GOTO vuelve
|
|
END FUNCTION
|
|
#-------------------------------------------------------------------------
|
|
FUNCTION ctpcom001()
|
|
WHENEVER ERROR CONTINUE
|
|
LET int_flag = false
|
|
## Aqui se prepara para la captura del criterio de seleccion
|
|
|
|
CONSTRUCT criterio ON cttb00038.* FROM cttb00038.*
|
|
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
RETURN
|
|
END IF
|
|
|
|
LET SELEC = " SELECT UNIQUE * FROM cttb00038 ",
|
|
" WHERE status_t is null and ",
|
|
criterio clipped," ORDER BY 2,3"
|
|
|
|
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 costo_stand.*
|
|
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
|
|
LET bandera = 0
|
|
RETURN
|
|
END IF
|
|
END IF
|
|
DISPLAY BY NAME costo_stand.*
|
|
|
|
MENU "OPCIONES "
|
|
COMMAND "Siguiente"
|
|
"Presenta en pantalla el proximo registro encontrado"
|
|
FETCH NEXT datos INTO costo_stand.*
|
|
IF STATUS = NOTFOUND THEN
|
|
LET numero_msg = 4
|
|
CALL msg(numero_msg)
|
|
END IF
|
|
DISPLAY BY NAME costo_stand.*
|
|
|
|
COMMAND "Anterior"
|
|
"Presenta en pantalla el registro anterior encontrado"
|
|
FETCH PREVIOUS datos INTO costo_stand.*
|
|
IF STATUS = NOTFOUND THEN
|
|
LET numero_msg = 5
|
|
CALL msg(numero_msg)
|
|
END IF
|
|
DISPLAY BY NAME costo_stand.*
|
|
|
|
COMMAND "Primero"
|
|
"Presenta en pantalla el primer registro encontrado"
|
|
FETCH FIRST datos INTO costo_stand.*
|
|
DISPLAY BY NAME costo_stand.*
|
|
LET numero_msg = 5
|
|
CALL msg(numero_msg)
|
|
COMMAND "Ultimo"
|
|
"Presenta en pantalla el ultimo registro encontrado"
|
|
FETCH LAST datos INTO costo_stand.*
|
|
DISPLAY BY NAME costo_stand.*
|
|
LET numero_msg = 4
|
|
CALL msg(numero_msg)
|
|
COMMAND "Escoger"
|
|
"<Esc> Actualiza Registro <Supr> Cancela Operacion"
|
|
IF costo_stand.status_t="E" THEN
|
|
LET numero_msg= 36
|
|
CALL msg(numero_msg)
|
|
RETURN
|
|
END IF
|
|
INPUT BY NAME costo_stand.ano,costo_stand.mes,
|
|
costo_stand.costo_st WITHOUT DEFAULTS
|
|
AFTER FIELD ano
|
|
IF costo_stand.ano is null THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD ano
|
|
END IF
|
|
AFTER FIELD mes
|
|
IF costo_stand.mes is null THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD mes
|
|
END IF
|
|
|
|
AFTER FIELD costo_st
|
|
IF costo_stand.costo_st IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD costo_st
|
|
END IF
|
|
|
|
AFTER INPUT
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
RETURN
|
|
END IF
|
|
EXIT INPUT
|
|
END INPUT
|
|
|
|
#### Verifica si el usuario presiono la tecla <Supr>
|
|
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
RETURN
|
|
END IF
|
|
|
|
UPDATE cttb00038 SET ventas = costo_stand.ventas,
|
|
ano = costo_stand.ano,
|
|
mes = costo_stand.mes,
|
|
costo_st = costo_stand.costo_st,
|
|
us_mod = USER,
|
|
fech_mod = CURRENT
|
|
WHERE nomenclatura = costo_stand.nomenclatura AND
|
|
ventas = costo_stand.ventas
|
|
|
|
LET numero_msg = 13
|
|
CALL msg(numero_msg)
|
|
|
|
COMMAND KEY ("L") "eLiminar"
|
|
|
|
UPDATE cttb00038 SET status_t ="E" ,
|
|
us_mod = user,
|
|
fech_mod = current
|
|
where nomenclatura = costo_stand.nomenclatura AND
|
|
ventas = costo_stand.ventas
|
|
LET numero_msg = 39
|
|
CALL msg(numero_msg)
|
|
COMMAND "Retornar"
|
|
"Retorna al menu anterior"
|
|
EXIT MENU
|
|
END MENU
|
|
END FUNCTION
|
|
|