885 lines
30 KiB
Plaintext
885 lines
30 KiB
Plaintext
{
|
|
--------------------------------------------------------------------------
|
|
PROGRAMA : VEPRMT029
|
|
OBJETIVO : Mantenimiento de Ventas ano anterior
|
|
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)
|
|
|
|
FUNCTION veprmt029()
|
|
|
|
OPTIONS
|
|
FORM LINE 8,
|
|
ERROR LINE 24,
|
|
COMMENT LINE 23
|
|
|
|
CALL pantalla()
|
|
OPEN FORM vefmmt029 FROM "vefmmt029"
|
|
DISPLAY FORM vefmmt029
|
|
DISPLAY "veprmt029" AT 4,3
|
|
DISPLAY "Presupuesto de Ventas" AT 6,29
|
|
|
|
MENU "OPCION"
|
|
COMMAND "Adicionar"
|
|
"<Esc> Adiciona Registro <Supr> Cancela Operacion"
|
|
CALL vepcad029()
|
|
COMMAND "Consultar-modificar"
|
|
"<Esc> Realiza Busqueda <Supr> Cancela Operacion"
|
|
CALL vepcmf029()
|
|
COMMAND "Salir"
|
|
EXIT MENU
|
|
END MENU
|
|
END FUNCTION
|
|
|
|
FUNCTION vepcad029()
|
|
|
|
WHENEVER ERROR CONTINUE
|
|
|
|
LABEL vuelve:
|
|
|
|
LET ano2 = year(today)
|
|
|
|
INPUT BY NAME ano2 WITHOUT DEFAULTS
|
|
|
|
AFTER FIELD ano2
|
|
SELECT UNIQUE ano FROM vetb00029 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
|
|
ELSE
|
|
SELECT UNIQUE fecha_in,fecha_fi INTO
|
|
controles.fecha_in,controles.fecha_fi FROM vetb00018
|
|
WHERE anos = ano2 and
|
|
status_t is null
|
|
|
|
IF status = notfound THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
GOTO vuelve
|
|
END IF
|
|
END IF
|
|
|
|
DISPLAY BY NAME controles.fecha_in,controles.fecha_fi
|
|
|
|
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
|
|
IF pres_venta[curr].mes >= controles.fecha_in AND
|
|
pres_venta[curr].mes <= controles.fecha_fi THEN
|
|
LET parte_mes = pres_venta[curr].mes using "&&&&"
|
|
LET particion = parte_mes[3,4]
|
|
SELECT descrip INTO descrip_mes FROM mestable
|
|
WHERE mes = particion
|
|
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 = 75
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD mes
|
|
END IF
|
|
|
|
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 vetb00029 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 vepcmf029()
|
|
DEFINE cod_ant ARRAY[300] OF RECORD
|
|
cod_n SMALLINT,
|
|
cod_grupo SMALLINT,
|
|
cod_tipo SMALLINT,
|
|
cod_sec SMALLINT
|
|
END RECORD
|
|
|
|
DEFINE usuario RECORD
|
|
us_crea CHAR(9),
|
|
fech_crea LIKE vetb00029.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 vetb00029 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
|
|
|
|
SELECT UNIQUE fecha_in,fecha_fi INTO controles.fecha_in,
|
|
controles.fecha_fi FROM vetb00018
|
|
WHERE anos = ano2
|
|
|
|
DISPLAY BY NAME ano2,controles.fecha_in,controles.fecha_fi
|
|
|
|
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
|
|
|
|
SELECT UNIQUE fecha_in,fecha_fi INTO controles.fecha_in,
|
|
controles.fecha_fi FROM vetb00018
|
|
WHERE anos = ano2
|
|
|
|
DISPLAY BY NAME ano2,controles.fecha_in,controles.fecha_fi
|
|
|
|
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
|
|
|
|
SELECT UNIQUE fecha_in,fecha_fi INTO controles.fecha_in,
|
|
controles.fecha_fi FROM vetb00018
|
|
WHERE anos = ano2
|
|
|
|
DISPLAY BY NAME ano2,controles.fecha_in,controles.fecha_fi
|
|
|
|
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
|
|
|
|
SELECT UNIQUE fecha_in,fecha_fi INTO controles.fecha_in,
|
|
controles.fecha_fi FROM vetb00018
|
|
WHERE anos = ano2
|
|
|
|
DISPLAY BY NAME ano2,controles.fecha_in,controles.fecha_fi
|
|
|
|
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
|
|
|
|
SELECT UNIQUE fecha_in,fecha_fi INTO controles.fecha_in,
|
|
controles.fecha_fi FROM vetb00018
|
|
WHERE anos = ano2
|
|
|
|
DISPLAY BY NAME ano2,controles.fecha_in,controles.fecha_fi
|
|
|
|
COMMAND "Escoger"
|
|
"<Esc> Actualiza Registro <Supr> 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 vetb00029 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
|
|
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
|
|
BEFORE ROW
|
|
LET curr = arr_curr()
|
|
LET scr_l = scr_line()
|
|
|
|
AFTER FIELD ventas
|
|
LET curr = arr_curr()
|
|
LET scr_l = scr_line()
|
|
|
|
IF pres_venta[curr].cod_n is null THEN
|
|
LET pres_venta[curr].cod_n = pres_venta[curr-1].cod_n
|
|
LET pres_venta[curr].cod_grupo = pres_venta[curr-1].cod_grupo
|
|
LET pres_venta[curr].cod_tipo = pres_venta[curr-1].cod_tipo
|
|
LET pres_venta[curr].cod_sec = pres_venta[curr-1].cod_sec
|
|
|
|
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
|
|
END IF
|
|
|
|
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
|
|
IF pres_venta[curr].mes >= controles.fecha_in AND
|
|
pres_venta[curr].mes <= controles.fecha_fi THEN
|
|
LET parte_mes = pres_venta[curr].mes using "&&&&"
|
|
LET particion = parte_mes[3,4]
|
|
SELECT descrip INTO descrip_mes FROM mestable
|
|
WHERE mes = particion
|
|
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 = 75
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD mes
|
|
END IF
|
|
|
|
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 vetb00029 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 vetb00029 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 vetb00029
|
|
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
|