946 lines
31 KiB
Plaintext
946 lines
31 KiB
Plaintext
{
|
|
--------------------------------------------------------------------------
|
|
PROGRAMA : VEPRMT301
|
|
OBJETIVO : Mantenimiento de Presupuesto de Ventas
|
|
REALIZADO POR : Ing. Betania Guerrero Perez
|
|
FECHA : Enero 08, 1993
|
|
--------------------------------------------------------------------------
|
|
}
|
|
GLOBALS
|
|
"veprgb000.4gl"
|
|
|
|
DEFINE descri_p CHAR(30)
|
|
DEFINE descrip_mes CHAR(11)
|
|
DEFINE parte_mes,ano2,mes4 CHAR(4)
|
|
DEFINE particion CHAR(2)
|
|
#DEFINE nombre CHAR(30)
|
|
|
|
FUNCTION veprmt301()
|
|
|
|
OPTIONS
|
|
FORM LINE 8,
|
|
ERROR LINE 24,
|
|
COMMENT LINE 23
|
|
|
|
CALL pantalla()
|
|
OPEN FORM vefmmt301 FROM "vefmmt301"
|
|
DISPLAY FORM vefmmt301
|
|
DISPLAY "veprmt301" AT 4,3
|
|
DISPLAY " " AT 6,20
|
|
DISPLAY "Presupuesto General" AT 6,30
|
|
|
|
MENU "OPCION"
|
|
COMMAND "Adicionar"
|
|
"<Esc> Adiciona Registro <Delete> Cancela Operacion"
|
|
CALL vepcad301()
|
|
COMMAND "Consultar-modificar"
|
|
"<Esc> Realiza Busqueda <Delete> Cancela Operacion"
|
|
CALL vepcmf301()
|
|
COMMAND "Salir"
|
|
EXIT MENU
|
|
END MENU
|
|
END FUNCTION
|
|
|
|
FUNCTION vepcad301()
|
|
|
|
#WHENEVER ERROR CONTINUE
|
|
|
|
LABEL vuelve:
|
|
|
|
LET ano2 = year(today)
|
|
|
|
INPUT BY NAME ano2 WITHOUT DEFAULTS
|
|
|
|
AFTER FIELD ano2
|
|
SELECT UNIQUE ano FROM vetb00017 WHERE @ano = ano2
|
|
|
|
IF status < 0 THEN
|
|
CALL integridad()
|
|
IF bandera = 1 THEN
|
|
LET bandera = 0
|
|
RETURN
|
|
END IF
|
|
|
|
ELSE
|
|
IF status != notfound THEN
|
|
LET numero_msg = 12
|
|
CALL msg(numero_msg)
|
|
GOTO vuelve
|
|
END IF
|
|
END IF
|
|
|
|
IF presupuesto.ano is null THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD ano
|
|
END IF
|
|
|
|
|
|
AFTER INPUT
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = false
|
|
CLEAR FORM
|
|
RETURN
|
|
END IF
|
|
EXIT INPUT
|
|
END INPUT
|
|
|
|
FOR idx = 1 to 7
|
|
LET pres_venta[idx].ventas = null
|
|
LET pres_venta[idx].cod_n = null
|
|
LET pres_venta[idx].cod_grupo = null
|
|
LET pres_venta[idx].cod_tipo = null
|
|
LET pres_venta[idx].cod_sec = null
|
|
LET pres_venta[idx].mes = null
|
|
LET pres_venta[idx].descrip_mes = null
|
|
LET pres_venta[idx].cantidad = null
|
|
LET pres_venta[idx].valor = null
|
|
|
|
DISPLAY pres_venta[idx].ventas to scr_pres[idx].ventas
|
|
DISPLAY pres_venta[idx].cod_n to scr_pres[idx].cod_n
|
|
DISPLAY pres_venta[idx].cod_grupo to scr_pres[idx].cod_grupo
|
|
DISPLAY pres_venta[idx].cod_tipo to scr_pres[idx].cod_tipo
|
|
DISPLAY pres_venta[idx].cod_sec to scr_pres[idx].cod_sec
|
|
DISPLAY pres_venta[idx].mes to scr_pres[idx].mes
|
|
DISPLAY pres_venta[idx].descrip_mes to scr_pres[idx].descrip_mes
|
|
DISPLAY pres_venta[idx].cantidad to scr_pres[idx].cantidad
|
|
DISPLAY pres_venta[idx].valor to scr_pres[idx].valor
|
|
END FOR
|
|
|
|
INPUT ARRAY pres_venta FROM scr_pres.*
|
|
|
|
ON KEY (CONTROL-W)
|
|
LET curr = arr_curr()
|
|
LET scr_l = scr_line()
|
|
CASE
|
|
WHEN INFIELD (cod_n)
|
|
CALL busca_pt()
|
|
LET pres_venta[curr].cod_n = pterminado.cod_n
|
|
LET pres_venta[curr].cod_grupo = pterminado.cod_grupo
|
|
LET pres_venta[curr].cod_tipo = pterminado.cod_tipo
|
|
LET pres_venta[curr].cod_sec = pterminado.cod_sec
|
|
|
|
SELECT descrip_esp INTO descri_p FROM iptb00002
|
|
WHERE cod_n = pres_venta[curr].cod_n and
|
|
cod_grupo = pres_venta[curr].cod_grupo and
|
|
cod_tipo = pres_venta[curr].cod_tipo and
|
|
cod_sec = pres_venta[curr].cod_sec
|
|
|
|
IF status = notfound THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_n
|
|
END IF
|
|
|
|
DISPLAY pres_venta[curr].cod_n TO scr_pres[scr_l].cod_n
|
|
DISPLAY pres_venta[curr].cod_grupo TO scr_pres[scr_l].cod_grupo
|
|
DISPLAY pres_venta[curr].cod_tipo TO scr_pres[scr_l].cod_tipo
|
|
DISPLAY pres_venta[curr].cod_sec TO scr_pres[scr_l].cod_sec
|
|
DISPLAY BY NAME descri_p ATTRIBUTE (BOLD)
|
|
NEXT FIELD mes
|
|
WHEN INFIELD (cod_grupo)
|
|
CALL busca_pt()
|
|
LET pres_venta[curr].cod_n = pterminado.cod_n
|
|
LET pres_venta[curr].cod_grupo = pterminado.cod_grupo
|
|
LET pres_venta[curr].cod_tipo = pterminado.cod_tipo
|
|
LET pres_venta[curr].cod_sec = pterminado.cod_sec
|
|
|
|
SELECT descrip_esp INTO descri_p FROM iptb00002
|
|
WHERE cod_n = pres_venta[curr].cod_n and
|
|
cod_grupo = pres_venta[curr].cod_grupo and
|
|
cod_tipo = pres_venta[curr].cod_tipo and
|
|
cod_sec = pres_venta[curr].cod_sec
|
|
|
|
IF status = notfound THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_n
|
|
END IF
|
|
|
|
DISPLAY pres_venta[curr].cod_n TO scr_pres[scr_l].cod_n
|
|
DISPLAY pres_venta[curr].cod_grupo TO scr_pres[scr_l].cod_grupo
|
|
DISPLAY pres_venta[curr].cod_tipo TO scr_pres[scr_l].cod_tipo
|
|
DISPLAY pres_venta[curr].cod_sec TO scr_pres[scr_l].cod_sec
|
|
DISPLAY BY NAME descri_p ATTRIBUTE (BOLD)
|
|
NEXT FIELD mes
|
|
WHEN INFIELD (cod_tipo)
|
|
CALL busca_pt()
|
|
LET pres_venta[curr].cod_n = pterminado.cod_n
|
|
LET pres_venta[curr].cod_grupo = pterminado.cod_grupo
|
|
LET pres_venta[curr].cod_tipo = pterminado.cod_tipo
|
|
LET pres_venta[curr].cod_sec = pterminado.cod_sec
|
|
|
|
SELECT descrip_esp INTO descri_p FROM iptb00002
|
|
WHERE cod_n = pres_venta[curr].cod_n and
|
|
cod_grupo = pres_venta[curr].cod_grupo and
|
|
cod_tipo = pres_venta[curr].cod_tipo and
|
|
cod_sec = pres_venta[curr].cod_sec
|
|
|
|
IF status = notfound THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_n
|
|
END IF
|
|
|
|
DISPLAY pres_venta[curr].cod_n TO scr_pres[scr_l].cod_n
|
|
DISPLAY pres_venta[curr].cod_grupo TO scr_pres[scr_l].cod_grupo
|
|
DISPLAY pres_venta[curr].cod_tipo TO scr_pres[scr_l].cod_tipo
|
|
DISPLAY pres_venta[curr].cod_sec TO scr_pres[scr_l].cod_sec
|
|
DISPLAY BY NAME descri_p ATTRIBUTE (BOLD)
|
|
NEXT FIELD mes
|
|
WHEN INFIELD (cod_sec)
|
|
CALL busca_pt()
|
|
LET pres_venta[curr].cod_n = pterminado.cod_n
|
|
LET pres_venta[curr].cod_grupo = pterminado.cod_grupo
|
|
LET pres_venta[curr].cod_tipo = pterminado.cod_tipo
|
|
LET pres_venta[curr].cod_sec = pterminado.cod_sec
|
|
|
|
SELECT descrip_esp INTO descri_p FROM iptb00002
|
|
WHERE cod_n = pres_venta[curr].cod_n and
|
|
cod_grupo = pres_venta[curr].cod_grupo and
|
|
cod_tipo = pres_venta[curr].cod_tipo and
|
|
cod_sec = pres_venta[curr].cod_sec
|
|
|
|
IF status = notfound THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_n
|
|
END IF
|
|
|
|
DISPLAY pres_venta[curr].cod_n TO scr_pres[scr_l].cod_n
|
|
DISPLAY pres_venta[curr].cod_grupo TO scr_pres[scr_l].cod_grupo
|
|
DISPLAY pres_venta[curr].cod_tipo TO scr_pres[scr_l].cod_tipo
|
|
DISPLAY pres_venta[curr].cod_sec TO scr_pres[scr_l].cod_sec
|
|
DISPLAY BY NAME descri_p ATTRIBUTE (BOLD)
|
|
NEXT FIELD mes
|
|
END CASE
|
|
|
|
AFTER FIELD ventas
|
|
LET curr = arr_curr()
|
|
LET scr_l = scr_line()
|
|
|
|
IF pres_venta[curr].ventas IS NOT NULL THEN
|
|
|
|
IF pres_venta[curr].ventas = "1" THEN
|
|
LET pres_venta[curr].descrip1 = "L O C A L "
|
|
|
|
DISPLAY pres_venta[curr].descrip1 to scr_pres[scr_l].descrip1
|
|
ATTRIBUTE (BOLD)
|
|
ELSE
|
|
LET pres_venta[curr].descrip1 = "EXPORTACION"
|
|
DISPLAY pres_venta[curr].descrip1 to scr_pres[scr_l].descrip1
|
|
ATTRIBUTE (BOLD)
|
|
END IF
|
|
END IF
|
|
|
|
{AFTER FIELD cod_n
|
|
IF pres_venta[curr].cod_n != 3 THEN
|
|
LET numero_msg = 60
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_n
|
|
END IF}
|
|
|
|
AFTER FIELD cod_sec
|
|
IF pres_venta[curr].cod_n is not null and
|
|
pres_venta[curr].cod_grupo is not null and
|
|
pres_venta[curr].cod_tipo is not null and
|
|
pres_venta[curr].cod_sec is not null THEN
|
|
|
|
LET verdad = "N"
|
|
CALL repetir()
|
|
IF verdad = "S" THEN
|
|
NEXT FIELD mes
|
|
END IF
|
|
|
|
SELECT descrip_esp INTO descri_p FROM iptb00002
|
|
WHERE cod_n = pres_venta[curr].cod_n and
|
|
cod_grupo = pres_venta[curr].cod_grupo and
|
|
cod_tipo = pres_venta[curr].cod_tipo and
|
|
cod_sec = pres_venta[curr].cod_sec
|
|
|
|
IF status = notfound THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_n
|
|
END IF
|
|
|
|
DISPLAY BY NAME descri_p ATTRIBUTE (BOLD)
|
|
ELSE
|
|
LET pres_venta[curr].cod_n = null
|
|
LET pres_venta[curr].cod_grupo = null
|
|
LET pres_venta[curr].cod_tipo = null
|
|
LET pres_venta[curr].cod_sec = null
|
|
|
|
DISPLAY pres_venta[curr].cod_n to scr_pres[scr_l].cod_n
|
|
DISPLAY pres_venta[curr].cod_grupo to scr_pres[scr_l].cod_grupo
|
|
DISPLAY pres_venta[curr].cod_tipo to scr_pres[scr_l].cod_tipo
|
|
DISPLAY pres_venta[curr].cod_sec to scr_pres[scr_l].cod_sec
|
|
NEXT FIELD cod_n
|
|
END IF
|
|
|
|
AFTER FIELD mes
|
|
IF pres_venta[curr].mes is not null THEN
|
|
LET verdad = "N"
|
|
CALL repetir()
|
|
IF verdad = "S" THEN
|
|
NEXT FIELD ventas
|
|
END IF
|
|
SELECT descrip INTO descrip_mes FROM mestable
|
|
WHERE mes = pres_venta[curr].mes
|
|
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD mes
|
|
END IF
|
|
LET pres_venta[curr].descrip_mes = descrip_mes
|
|
DISPLAY pres_venta[curr].descrip_mes to scr_pres[scr_l].descrip_mes
|
|
|
|
ELSE
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD mes
|
|
END IF
|
|
|
|
AFTER FIELD cantidad
|
|
IF pres_venta[curr].cod_n is not null and
|
|
pres_venta[curr].cod_grupo is not null and
|
|
pres_venta[curr].cod_tipo is not null and
|
|
pres_venta[curr].cod_sec is not null THEN
|
|
|
|
IF pres_venta[curr].cantidad is null THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cantidad
|
|
END IF
|
|
END IF
|
|
|
|
AFTER FIELD valor
|
|
|
|
IF pres_venta[curr].cod_n is not null and
|
|
pres_venta[curr].cod_grupo is not null and
|
|
pres_venta[curr].cod_tipo is not null and
|
|
pres_venta[curr].cod_sec is not null THEN
|
|
|
|
IF pres_venta[curr].valor is null THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cantidad
|
|
END IF
|
|
END IF
|
|
|
|
AFTER INPUT
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = false
|
|
CLEAR FORM
|
|
RETURN
|
|
END IF
|
|
EXIT INPUT
|
|
END INPUT
|
|
|
|
FOR idx = 1 to arr_count()
|
|
IF pres_venta[idx].ventas is not null and
|
|
pres_venta[idx].cod_n is not null and
|
|
pres_venta[idx].cod_grupo is not null and
|
|
pres_venta[idx].cod_tipo is not null and
|
|
pres_venta[idx].cod_sec is not null THEN
|
|
|
|
LET mes4 = pres_venta[idx].mes using "####"
|
|
INSERT INTO vetb00017
|
|
VALUES (ano2,pres_venta[idx].ventas,pres_venta[idx].cod_n,
|
|
pres_venta[idx].cod_grupo,pres_venta[idx].cod_tipo,
|
|
pres_venta[idx].cod_sec,mes4,pres_venta[idx].cantidad,
|
|
pres_venta[idx].valor,null,user,current,null,null)
|
|
END IF
|
|
END FOR
|
|
|
|
CALL integridad()
|
|
IF bandera = 1 THEN
|
|
LET bandera = 0
|
|
RETURN
|
|
END IF
|
|
|
|
LET numero_msg = 1
|
|
CALL msg(numero_msg)
|
|
CLEAR FORM
|
|
|
|
FOR idx = 1 to 7
|
|
LET pres_venta[idx].ventas = null
|
|
LET pres_venta[idx].cod_n = null
|
|
LET pres_venta[idx].cod_grupo = null
|
|
LET pres_venta[idx].cod_tipo = null
|
|
LET pres_venta[idx].cod_sec = null
|
|
LET pres_venta[idx].mes = null
|
|
LET pres_venta[idx].descrip_mes = null
|
|
LET pres_venta[idx].cantidad = null
|
|
LET pres_venta[idx].valor = null
|
|
|
|
DISPLAY pres_venta[idx].ventas to scr_pres[idx].ventas
|
|
DISPLAY pres_venta[idx].cod_n to scr_pres[idx].cod_n
|
|
DISPLAY pres_venta[idx].cod_grupo to scr_pres[idx].cod_grupo
|
|
DISPLAY pres_venta[idx].cod_tipo to scr_pres[idx].cod_tipo
|
|
DISPLAY pres_venta[idx].cod_sec to scr_pres[idx].cod_sec
|
|
DISPLAY pres_venta[idx].mes to scr_pres[idx].mes
|
|
DISPLAY pres_venta[idx].descrip_mes to scr_pres[idx].descrip_mes
|
|
DISPLAY pres_venta[idx].cantidad to scr_pres[idx].cantidad
|
|
DISPLAY pres_venta[idx].valor to scr_pres[idx].valor
|
|
END FOR
|
|
|
|
GOTO vuelve
|
|
END FUNCTION
|
|
|
|
FUNCTION vepcmf301()
|
|
|
|
DEFINE usuario RECORD
|
|
us_crea CHAR(9),
|
|
fech_crea LIKE vetb00017.fech_crea
|
|
END RECORD
|
|
|
|
WHENEVER ERROR CONTINUE
|
|
|
|
CONSTRUCT criterio ON ano FROM ano2
|
|
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = false
|
|
RETURN
|
|
END IF
|
|
|
|
LET selec = "SELECT unique ano FROM vetb00017 ",
|
|
"WHERE ",criterio clipped," and status_t is null ",
|
|
" ORDER BY 1 "
|
|
|
|
PREPARE busca FROM selec
|
|
DECLARE datos SCROLL CURSOR FOR busca
|
|
OPEN datos
|
|
|
|
FETCH FIRST datos INTO ano2
|
|
IF status = notfound THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
RETURN
|
|
END IF
|
|
|
|
DISPLAY BY NAME ano2
|
|
|
|
MENU "OPCION"
|
|
COMMAND "Siguiente"
|
|
"Presenta en pantalla el proximo registro encontrado"
|
|
FETCH NEXT datos INTO ano2
|
|
IF status = notfound THEN
|
|
LET numero_msg = 4
|
|
CALL msg(numero_msg)
|
|
END IF
|
|
|
|
DISPLAY BY NAME ano2
|
|
|
|
COMMAND "Anterior"
|
|
"Presenta en pantalla el registro anterior encontrado"
|
|
FETCH PREVIOUS datos INTO ano2
|
|
IF status = notfound THEN
|
|
LET numero_msg = 5
|
|
CALL msg(numero_msg)
|
|
END IF
|
|
|
|
DISPLAY BY NAME ano2
|
|
|
|
COMMAND "Primero"
|
|
"Presenta en pantalla el primer registro encontrado"
|
|
FETCH FIRST datos INTO ano2
|
|
IF status = notfound THEN
|
|
LET numero_msg = 5
|
|
CALL msg(numero_msg)
|
|
END IF
|
|
|
|
DISPLAY BY NAME ano2
|
|
|
|
COMMAND "Ultimo"
|
|
"Presenta en pantalla el ultimo registro encontrado"
|
|
FETCH LAST datos INTO ano2
|
|
IF status = notfound THEN
|
|
LET numero_msg = 4
|
|
CALL msg(numero_msg)
|
|
END IF
|
|
|
|
DISPLAY BY NAME ano2
|
|
|
|
COMMAND "Escoger"
|
|
"<Esc> Actualiza Registro <Delete> Cancela Operacion"
|
|
|
|
FOR idx = 1 to 7
|
|
LET pres_venta[idx].ventas = null
|
|
LET pres_venta[idx].cod_n = null
|
|
LET pres_venta[idx].cod_grupo = null
|
|
LET pres_venta[idx].cod_tipo = null
|
|
LET pres_venta[idx].cod_sec = null
|
|
LET pres_venta[idx].mes = null
|
|
LET pres_venta[idx].descrip_mes = null
|
|
LET pres_venta[idx].cantidad = null
|
|
LET pres_venta[idx].valor = null
|
|
|
|
DISPLAY pres_venta[idx].ventas to scr_pres[idx].ventas
|
|
DISPLAY pres_venta[idx].cod_n to scr_pres[idx].cod_n
|
|
DISPLAY pres_venta[idx].cod_grupo to scr_pres[idx].cod_grupo
|
|
DISPLAY pres_venta[idx].cod_tipo to scr_pres[idx].cod_tipo
|
|
DISPLAY pres_venta[idx].cod_sec to scr_pres[idx].cod_sec
|
|
DISPLAY pres_venta[idx].mes to scr_pres[idx].mes
|
|
DISPLAY pres_venta[idx].descrip_mes to scr_pres[idx].descrip_mes
|
|
DISPLAY pres_venta[idx].cantidad to scr_pres[idx].cantidad
|
|
DISPLAY pres_venta[idx].valor to scr_pres[idx].valor
|
|
END FOR
|
|
|
|
DECLARE buscate1 CURSOR FOR
|
|
SELECT a.ventas,a.ventas,a.cod_n,a.cod_grupo,a.cod_tipo,a.cod_sec,
|
|
a.mes,a.valor,a.cantidad,a.valor,a.us_crea,a.fech_crea
|
|
FROM vetb00017 a,iptb00002 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.ano = ano2
|
|
ORDER BY 1,2,3,4,5,6,7
|
|
|
|
LET idx = 1
|
|
|
|
FOREACH buscate1 INTO pres_venta[idx].*,usuario.us_crea,usuario.fech_crea
|
|
|
|
LET parte_mes = pres_venta[idx].mes using "&&&&"
|
|
LET particion = parte_mes[3,4]
|
|
|
|
SELECT descrip INTO descrip_mes FROM mestable WHERE mes = particion
|
|
|
|
LET pres_venta[idx].descrip_mes = descrip_mes
|
|
|
|
IF pres_venta[idx].ventas IS NOT NULL THEN
|
|
|
|
IF pres_venta[idx].ventas = "1" THEN
|
|
LET pres_venta[idx].descrip1 = "L O C A L "
|
|
|
|
ELSE
|
|
LET pres_venta[idx].descrip1 = "EXPORTACION"
|
|
END IF
|
|
END IF
|
|
LET idx = idx + 1
|
|
END FOREACH
|
|
|
|
CALL set_count(idx - 1)
|
|
|
|
INPUT ARRAY pres_venta WITHOUT DEFAULTS FROM scr_pres.*
|
|
|
|
ON KEY (CONTROL-W)
|
|
LET curr = arr_curr()
|
|
LET scr_l = scr_line()
|
|
CASE
|
|
WHEN INFIELD (cod_n)
|
|
CALL busca_pt()
|
|
LET pres_venta[curr].cod_n = pterminado.cod_n
|
|
LET pres_venta[curr].cod_grupo = pterminado.cod_grupo
|
|
LET pres_venta[curr].cod_tipo = pterminado.cod_tipo
|
|
LET pres_venta[curr].cod_sec = pterminado.cod_sec
|
|
|
|
SELECT descrip_esp INTO descri_p FROM iptb00002
|
|
WHERE cod_n = pres_venta[curr].cod_n and
|
|
cod_grupo = pres_venta[curr].cod_grupo and
|
|
cod_tipo = pres_venta[curr].cod_tipo and
|
|
cod_sec = pres_venta[curr].cod_sec
|
|
|
|
IF status = notfound THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_n
|
|
END IF
|
|
DISPLAY pres_venta[curr].cod_n TO scr_pres[scr_l].cod_n
|
|
DISPLAY pres_venta[curr].cod_grupo TO scr_pres[scr_l].cod_grupo
|
|
DISPLAY pres_venta[curr].cod_tipo TO scr_pres[scr_l].cod_tipo
|
|
DISPLAY pres_venta[curr].cod_sec TO scr_pres[scr_l].cod_sec
|
|
DISPLAY BY NAME descri_p ATTRIBUTE (BOLD)
|
|
NEXT FIELD mes
|
|
WHEN INFIELD (cod_grupo)
|
|
CALL busca_pt()
|
|
LET pres_venta[curr].cod_n = pterminado.cod_n
|
|
LET pres_venta[curr].cod_grupo = pterminado.cod_grupo
|
|
LET pres_venta[curr].cod_tipo = pterminado.cod_tipo
|
|
LET pres_venta[curr].cod_sec = pterminado.cod_sec
|
|
|
|
SELECT descrip_esp INTO descri_p FROM iptb00002
|
|
WHERE cod_n = pres_venta[curr].cod_n and
|
|
cod_grupo = pres_venta[curr].cod_grupo and
|
|
cod_tipo = pres_venta[curr].cod_tipo and
|
|
cod_sec = pres_venta[curr].cod_sec
|
|
|
|
IF status = notfound THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_n
|
|
END IF
|
|
DISPLAY pres_venta[curr].cod_n TO scr_pres[scr_l].cod_n
|
|
DISPLAY pres_venta[curr].cod_grupo TO scr_pres[scr_l].cod_grupo
|
|
DISPLAY pres_venta[curr].cod_tipo TO scr_pres[scr_l].cod_tipo
|
|
DISPLAY pres_venta[curr].cod_sec TO scr_pres[scr_l].cod_sec
|
|
DISPLAY BY NAME descri_p ATTRIBUTE (BOLD)
|
|
NEXT FIELD mes
|
|
WHEN INFIELD (cod_tipo)
|
|
CALL busca_pt()
|
|
LET pres_venta[curr].cod_n = pterminado.cod_n
|
|
LET pres_venta[curr].cod_grupo = pterminado.cod_grupo
|
|
LET pres_venta[curr].cod_tipo = pterminado.cod_tipo
|
|
LET pres_venta[curr].cod_sec = pterminado.cod_sec
|
|
|
|
SELECT descrip_esp INTO descri_p FROM iptb00002
|
|
WHERE cod_n = pres_venta[curr].cod_n and
|
|
cod_grupo = pres_venta[curr].cod_grupo and
|
|
cod_tipo = pres_venta[curr].cod_tipo and
|
|
cod_sec = pres_venta[curr].cod_sec
|
|
|
|
IF status = notfound THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_n
|
|
END IF
|
|
DISPLAY pres_venta[curr].cod_n TO scr_pres[scr_l].cod_n
|
|
DISPLAY pres_venta[curr].cod_grupo TO scr_pres[scr_l].cod_grupo
|
|
DISPLAY pres_venta[curr].cod_tipo TO scr_pres[scr_l].cod_tipo
|
|
DISPLAY pres_venta[curr].cod_sec TO scr_pres[scr_l].cod_sec
|
|
DISPLAY BY NAME descri_p ATTRIBUTE (BOLD)
|
|
NEXT FIELD mes
|
|
WHEN INFIELD (cod_sec)
|
|
CALL busca_pt()
|
|
LET pres_venta[curr].cod_n = pterminado.cod_n
|
|
LET pres_venta[curr].cod_grupo = pterminado.cod_grupo
|
|
LET pres_venta[curr].cod_tipo = pterminado.cod_tipo
|
|
LET pres_venta[curr].cod_sec = pterminado.cod_sec
|
|
|
|
SELECT descrip_esp INTO descri_p FROM iptb00002
|
|
WHERE cod_n = pres_venta[curr].cod_n and
|
|
cod_grupo = pres_venta[curr].cod_grupo and
|
|
cod_tipo = pres_venta[curr].cod_tipo and
|
|
cod_sec = pres_venta[curr].cod_sec
|
|
|
|
IF status = notfound THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_n
|
|
END IF
|
|
DISPLAY pres_venta[curr].cod_n TO scr_pres[scr_l].cod_n
|
|
DISPLAY pres_venta[curr].cod_grupo TO scr_pres[scr_l].cod_grupo
|
|
DISPLAY pres_venta[curr].cod_tipo TO scr_pres[scr_l].cod_tipo
|
|
DISPLAY pres_venta[curr].cod_sec TO scr_pres[scr_l].cod_sec
|
|
DISPLAY BY NAME descri_p ATTRIBUTE (BOLD)
|
|
NEXT FIELD mes
|
|
END CASE
|
|
|
|
AFTER FIELD ventas
|
|
LET curr = arr_curr()
|
|
LET scr_l = scr_line()
|
|
|
|
IF pres_venta[curr].ventas IS NOT NULL THEN
|
|
|
|
IF pres_venta[curr].ventas = "1" THEN
|
|
LET pres_venta[curr].descrip1 = "L O C A L "
|
|
|
|
DISPLAY pres_venta[curr].descrip1 to scr_pres[scr_l].descrip1
|
|
ATTRIBUTE (BOLD)
|
|
ELSE
|
|
LET pres_venta[curr].descrip1 = "EXPORTACION"
|
|
DISPLAY pres_venta[curr].descrip1 to scr_pres[scr_l].descrip1
|
|
END IF
|
|
END IF
|
|
{AFTER FIELD cod_n
|
|
IF pres_venta[curr].cod_n != 3 THEN
|
|
LET numero_msg = 60
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_n
|
|
END IF}
|
|
|
|
AFTER FIELD cod_sec
|
|
IF pres_venta[curr].cod_n is not null and
|
|
pres_venta[curr].cod_grupo is not null and
|
|
pres_venta[curr].cod_tipo is not null and
|
|
pres_venta[curr].cod_sec is not null THEN
|
|
|
|
LET verdad = "N"
|
|
CALL repetir()
|
|
IF verdad = "S" THEN
|
|
NEXT FIELD mes
|
|
END IF
|
|
|
|
SELECT descrip_esp INTO descri_p FROM iptb00002
|
|
WHERE cod_n = pres_venta[curr].cod_n and
|
|
cod_grupo = pres_venta[curr].cod_grupo and
|
|
cod_tipo = pres_venta[curr].cod_tipo and
|
|
cod_sec = pres_venta[curr].cod_sec
|
|
|
|
IF status = notfound THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_n
|
|
END IF
|
|
|
|
DISPLAY BY NAME descri_p ATTRIBUTE (BOLD)
|
|
ELSE
|
|
LET pres_venta[curr].cod_n = null
|
|
LET pres_venta[curr].cod_grupo = null
|
|
LET pres_venta[curr].cod_tipo = null
|
|
LET pres_venta[curr].cod_sec = null
|
|
|
|
DISPLAY pres_venta[curr].cod_n to scr_pres[scr_l].cod_n
|
|
DISPLAY pres_venta[curr].cod_grupo to scr_pres[scr_l].cod_grupo
|
|
DISPLAY pres_venta[curr].cod_tipo to scr_pres[scr_l].cod_tipo
|
|
DISPLAY pres_venta[curr].cod_sec to scr_pres[scr_l].cod_sec
|
|
NEXT FIELD cod_n
|
|
END IF
|
|
|
|
AFTER FIELD mes
|
|
IF pres_venta[curr].mes is not null THEN
|
|
LET verdad = "N"
|
|
CALL repetir()
|
|
IF verdad = "S" THEN
|
|
NEXT FIELD ventas
|
|
END IF
|
|
SELECT descrip INTO descrip_mes FROM mestable
|
|
WHERE mes = pres_venta[curr].mes
|
|
|
|
IF status = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD mes
|
|
END IF
|
|
LET pres_venta[curr].descrip_mes = descrip_mes
|
|
DISPLAY pres_venta[curr].descrip_mes to scr_pres[scr_l].descrip_mes
|
|
|
|
ELSE
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD mes
|
|
END IF
|
|
|
|
AFTER FIELD cantidad
|
|
IF pres_venta[curr].cod_n is not null and
|
|
pres_venta[curr].cod_grupo is not null and
|
|
pres_venta[curr].cod_tipo is not null and
|
|
pres_venta[curr].cod_sec is not null THEN
|
|
|
|
IF pres_venta[curr].cantidad is null THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cantidad
|
|
END IF
|
|
END IF
|
|
|
|
AFTER FIELD valor
|
|
IF pres_venta[curr].cod_n is not null and
|
|
pres_venta[curr].cod_grupo is not null and
|
|
pres_venta[curr].cod_tipo is not null and
|
|
pres_venta[curr].cod_sec is not null THEN
|
|
|
|
IF pres_venta[curr].valor is null THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD valor
|
|
END IF
|
|
END IF
|
|
|
|
AFTER INPUT
|
|
LET verdad = "N"
|
|
CALL repetir()
|
|
IF verdad = "S" THEN
|
|
NEXT FIELD ventas
|
|
END IF
|
|
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = false
|
|
CLEAR FORM
|
|
RETURN
|
|
END IF
|
|
EXIT INPUT
|
|
END INPUT
|
|
|
|
DELETE FROM vetb00017 WHERE ano = ano2
|
|
|
|
FOR idx = 1 to arr_count()
|
|
IF pres_venta[idx].ventas is not null and
|
|
pres_venta[idx].cod_n is not null and
|
|
pres_venta[idx].cod_grupo is not null and
|
|
pres_venta[idx].cod_tipo is not null and
|
|
pres_venta[idx].cod_sec is not null THEN
|
|
|
|
LET mes4 = pres_venta[idx].mes using "####"
|
|
INSERT INTO vetb00017
|
|
VALUES (ano2,pres_venta[idx].ventas,pres_venta[idx].cod_n,
|
|
pres_venta[idx].cod_grupo,pres_venta[idx].cod_tipo,
|
|
pres_venta[idx].cod_sec,mes4,pres_venta[idx].cantidad,
|
|
pres_venta[idx].valor,null,usuario.us_crea,
|
|
usuario.fech_crea,user,current)
|
|
END IF
|
|
END FOR
|
|
|
|
LET numero_msg = 13
|
|
CALL msg(numero_msg)
|
|
|
|
COMMAND KEY ("L") "eLiminar"
|
|
DELETE FROM vetb00017
|
|
WHERE ano = ano2
|
|
|
|
LET numero_msg = 39
|
|
CALL msg(numero_msg)
|
|
|
|
COMMAND "Retornar"
|
|
CLEAR FORM
|
|
|
|
FOR idx = 1 to 7
|
|
LET pres_venta[idx].ventas = null
|
|
LET pres_venta[idx].cod_n = null
|
|
LET pres_venta[idx].cod_grupo = null
|
|
LET pres_venta[idx].cod_tipo = null
|
|
LET pres_venta[idx].cod_sec = null
|
|
LET pres_venta[idx].mes = null
|
|
LET pres_venta[idx].descrip_mes = null
|
|
LET pres_venta[idx].cantidad = null
|
|
LET pres_venta[idx].valor = null
|
|
|
|
DISPLAY pres_venta[idx].ventas to scr_pres[idx].ventas
|
|
DISPLAY pres_venta[idx].cod_n to scr_pres[idx].cod_n
|
|
DISPLAY pres_venta[idx].cod_grupo to scr_pres[idx].cod_grupo
|
|
DISPLAY pres_venta[idx].cod_tipo to scr_pres[idx].cod_tipo
|
|
DISPLAY pres_venta[idx].cod_sec to scr_pres[idx].cod_sec
|
|
DISPLAY pres_venta[idx].mes to scr_pres[idx].mes
|
|
DISPLAY pres_venta[idx].descrip_mes to scr_pres[idx].descrip_mes
|
|
DISPLAY pres_venta[idx].cantidad to scr_pres[idx].cantidad
|
|
DISPLAY pres_venta[idx].valor to scr_pres[idx].valor
|
|
END FOR
|
|
|
|
EXIT MENU
|
|
END MENU
|
|
END FUNCTION
|
|
|
|
FUNCTION repetir()
|
|
|
|
DEFINE ant_art RECORD
|
|
ventas CHAR(1),
|
|
cod_n SMALLINT,
|
|
cod_grupo SMALLINT,
|
|
cod_tipo SMALLINT,
|
|
cod_sec SMALLINT,
|
|
mes SMALLINT
|
|
END RECORD
|
|
|
|
LET ant_art.ventas = pres_venta[curr].ventas
|
|
LET ant_art.cod_n = pres_venta[curr].cod_n
|
|
LET ant_art.cod_grupo = pres_venta[curr].cod_grupo
|
|
LET ant_art.cod_tipo = pres_venta[curr].cod_tipo
|
|
LET ant_art.cod_sec = pres_venta[curr].cod_sec
|
|
LET ant_art.mes = pres_venta[curr].mes
|
|
|
|
FOR idx = 1 TO arr_count()
|
|
IF idx != curr THEN
|
|
IF pres_venta[idx].ventas IS NOT NULL AND
|
|
pres_venta[idx].cod_n IS NOT NULL AND
|
|
pres_venta[idx].cod_grupo IS NOT NULL AND
|
|
pres_venta[idx].cod_tipo IS NOT NULL AND
|
|
pres_venta[idx].cod_sec IS NOT NULL AND
|
|
pres_venta[idx].mes IS NOT NULL THEN
|
|
|
|
IF pres_venta[idx].ventas = ant_art.ventas AND
|
|
pres_venta[idx].cod_n = ant_art.cod_n AND
|
|
pres_venta[idx].cod_grupo = ant_art.cod_grupo AND
|
|
pres_venta[idx].cod_tipo = ant_art.cod_tipo AND
|
|
pres_venta[idx].cod_sec = ant_art.cod_sec AND
|
|
pres_venta[idx].mes = ant_art.mes THEN
|
|
LET numero_msg = 21
|
|
CALL msg(numero_msg)
|
|
LET verdad = "S"
|
|
ELSE
|
|
IF verdad != "S" THEN
|
|
LET verdad = "N"
|
|
END IF
|
|
END IF
|
|
END IF
|
|
END IF
|
|
END FOR
|
|
END FUNCTION
|
|
|
|
|
|
FUNCTION busca_zona1()
|
|
OPEN WINDOW busqueda AT 10,10 WITH FORM "vefmwd301"
|
|
ATTRIBUTE (BORDER,FORM LINE FIRST + 1, comment line last)
|
|
|
|
CONSTRUCT criterio ON vetb00008.cod_zona,vetb00008.descrip
|
|
FROM vetb00008.cod_zona,vetb00008.descrip
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = false
|
|
RETURN
|
|
END IF
|
|
|
|
LET selec = "SELECT cod_zona,descrip FROM vetb00008 ",
|
|
"WHERE status_t is null AND ",criterio clipped,
|
|
" ORDER BY 1 "
|
|
|
|
PREPARE localiza FROM selec
|
|
DECLARE pagar CURSOR FOR localiza
|
|
|
|
LET idx = 1
|
|
FOREACH pagar INTO zona1_wd[idx].*
|
|
IF status = NOTFOUND THEN
|
|
LET existe = "N"
|
|
EXIT FOREACH
|
|
END IF
|
|
|
|
LET idx = idx + 1
|
|
END FOREACH
|
|
|
|
CALL set_count(idx-1)
|
|
DISPLAY ARRAY zona1_wd TO consart.*
|
|
LET curr1 = arr_curr()
|
|
|
|
LET fact_gral.zona = zona1_wd[curr1].cod_zona using "&&&"
|
|
LET nombre = zona1_wd[curr1].descrip
|
|
LET descrip1 = nombre
|
|
CLOSE WINDOW busqueda
|
|
END FUNCTION
|
|
|
|
FUNCTION busca_pais()
|
|
OPEN WINDOW busqueda1 AT 10,10 WITH FORM "vefmwd311"
|
|
ATTRIBUTE (BORDER,FORM LINE FIRST + 1, comment line last)
|
|
|
|
CONSTRUCT criterio ON cotb00018.cod_pais,cotb00018.nom_pais
|
|
FROM cotb00018.cod_pais,cotb00018.nom_pais
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = false
|
|
RETURN
|
|
END IF
|
|
|
|
LET selec = "SELECT cod_pais,nom_pais FROM cotb00018 ",
|
|
"WHERE status_t is null AND ",criterio clipped,
|
|
"ORDER BY 1 "
|
|
|
|
PREPARE localiza1 FROM selec
|
|
DECLARE country CURSOR FOR localiza1
|
|
|
|
LET idx = 1
|
|
FOREACH country INTO pais_wd[idx].*
|
|
IF status = NOTFOUND THEN
|
|
LET existe = "N"
|
|
EXIT FOREACH
|
|
END IF
|
|
|
|
LET idx = idx + 1
|
|
END FOREACH
|
|
|
|
CALL set_count(idx-1)
|
|
DISPLAY ARRAY pais_wd TO consart.*
|
|
LET curr1 = arr_curr()
|
|
|
|
LET fact_gral.zona = pais_wd[curr1].cod_pais
|
|
LET nombre = pais_wd[curr1].nom_pais
|
|
LET descrip1 = nombre
|
|
CLOSE WINDOW busqueda1
|
|
END FUNCTION
|