241 lines
6.5 KiB
Plaintext
241 lines
6.5 KiB
Plaintext
{
|
|
=======================================================================
|
|
Programa : GEPRRP021
|
|
Sistema : Sistema de Informacion Gerencia
|
|
Proceso : Clientes con Ventas Mayores a X Cantidad X Tipo de Negocio
|
|
Autor : Ing. Juan Francisco Soto
|
|
Fecha : Abril 28, 2003
|
|
=======================================================================
|
|
}
|
|
GLOBALS
|
|
"geprgb000.4gl"
|
|
|
|
DEFINE ger_comp10 RECORD LIKE ranking.*,
|
|
cod1 SMALLINT,
|
|
ventas_dev1,ventas_dev2,ventas_totales1,ventas_totales2 DECIMAL(12,2),
|
|
archivo,filename,sysos CHAR(120),
|
|
cels CHAR(20),
|
|
cnt,n,dep_ant,n_row,ppresenta SMALLINT
|
|
|
|
|
|
DEFINE selec9 CHAR(1000)
|
|
DEFINE salir,salir9,compa CHAR(1)
|
|
DEFINE idx9,idx1,j,m,p,s,s1 INTEGER
|
|
DEFINE ano19 CHAR(4)
|
|
DEFINE ano1,mes1 SMALLINT
|
|
DEFINE nom_mes CHAR(15)
|
|
|
|
DEFINE fecha_in,fecha_fi,fecha_in9,fecha_fi9 DATE,
|
|
cod_cli SMALLINT,
|
|
total2,cantidad1,cantidad2,cantidad3,cantidad4,cantidad5,cantidad6,
|
|
cantidad7,cantidad8,cantida9 DECIMAL(12,2)
|
|
|
|
FUNCTION geprrp021()
|
|
DEFINE pceldas RECORD LIKE celdas.*
|
|
|
|
DEFINE anos RECORD
|
|
|
|
ano LIKE ranking.ano,
|
|
negocio LIKE ventas_pilas.negocio,
|
|
nombre LIKE ventas_pilas.nombre_cliente,
|
|
tamano LIKE ventas_pilas.tamano,
|
|
unidades LIKE ventas_pilas.unidades,
|
|
celda LIKE ventas_pilas.celda
|
|
END RECORD
|
|
|
|
LET int_flag = FALSE
|
|
OPTIONS
|
|
FORM LINE 8
|
|
|
|
OPEN FORM gefmrp009 FROM "gefmrp009"
|
|
DISPLAY FORM gefmrp009
|
|
CALL pantalla()
|
|
DISPLAY "geprrp010" AT 4,3 ATTRIBUTE(RED)
|
|
|
|
DISPLAY "Ranking de Clientes por Tipo de Negocios" AT 6,20
|
|
ATTRIBUTE(BLACK)
|
|
|
|
LET tipo_papel = 1
|
|
CALL msgrp000(tipo_papel)
|
|
INPUT BY NAME ano1,mes1,cantidad1
|
|
AFTER FIELD ano1
|
|
IF ano1 IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD ano1
|
|
END IF
|
|
|
|
SELECT MIN(fecha_inicio) INTO fecha_in9 FROM prdtable
|
|
WHERE ano = ano1 - 1
|
|
|
|
LET ano19 = ano1 - 1 USING "&&&&"
|
|
|
|
BEFORE FIELD mes1
|
|
LET mes1 = MONTH(today) USING "&&"
|
|
DISPLAY BY NAME mes1
|
|
|
|
AFTER FIELD mes1
|
|
IF mes1 IS NULL THEN
|
|
LET mes1 = MONTH(today) USING "&&"
|
|
END IF
|
|
DISPLAY BY NAME mes1
|
|
|
|
SELECT MIN(fecha_inicio) INTO fecha_in FROM prdtable
|
|
WHERE ano = ano1 #and mes = mes1
|
|
|
|
SELECT fecha_corte INTO fecha_fi FROM prdtable
|
|
WHERE ano = ano1 AND mes = mes1
|
|
|
|
SELECT fecha_corte INTO fecha_fi9 FROM prdtable
|
|
WHERE ano = ano1 - 1 AND mes = mes1
|
|
|
|
SELECT descrip INTO nom_mes FROM mestable
|
|
WHERE mes = mes1
|
|
|
|
|
|
AFTER FIELD cantidad1
|
|
IF cantidad1 IS NULL OR cantidad1 < 0 THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cantidad1
|
|
END IF
|
|
END INPUT
|
|
|
|
IF int_flag tHEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
RETURN
|
|
END IF
|
|
|
|
CONSTRUCT BY NAME criterio ON a.tipo_cliente,a.sec_cliente
|
|
IF int_flag tHEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
RETURN
|
|
END IF
|
|
|
|
DECLARE buscar CURSOR FOR
|
|
{ SELECT a.* FROM ranking a
|
|
WHERE a.tipo_cliente =12
|
|
ORDER BY a.ano,a.negocio,a.sec_cliente,a.mes,a.ano }
|
|
|
|
select a.ano,a.negocio,a.nombre_cliente,a.tamano,a.unidades,a.celda
|
|
FROM ventas_pilas a
|
|
ORDER BY 2,3,4,1
|
|
|
|
DISPLAY "Buscando Informacion Ano Actual... Espere por Favor" AT 17,14
|
|
ATTRIBUTE(BOLD)
|
|
|
|
|
|
--# CALL fgl_init4js()
|
|
|
|
START REPORT gerencia21 TO "c:\\archivo"
|
|
|
|
DISPLAY "Impresion en Proceso..... Espere por Favor " AT 17,14
|
|
--# CALL fgl_init4js()
|
|
|
|
--# LET archivo = NULL
|
|
--# LET filename = NULL
|
|
--# LET filename = FGL_GETENV("USPROGRAM")
|
|
|
|
--# LET archivo = "h:\\\\Formularios\\\\geprrp021b.XLS"
|
|
--# LET filename = filename CLIPPED," h:\\\\Formularios\\\\geprrp021b.XLS"
|
|
|
|
--# IF winexec(filename) THEN
|
|
|
|
--# IF DDEconnect("EXCEL",archivo) THEN
|
|
|
|
LET idx = 7
|
|
|
|
FOREACH buscar INTO anos.*
|
|
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
RETURN
|
|
END IF
|
|
OUTPUT TO REPORT gerencia21(anos.*)
|
|
END FOREACH
|
|
|
|
FINISH REPORT gerencia21
|
|
END IF
|
|
END IF
|
|
# RUN imprime
|
|
END FUNCTION
|
|
|
|
REPORT gerencia21(x)
|
|
|
|
# DEFINE x RECORD LIKE ranking.*
|
|
DEFINE x RECORD
|
|
ano LIKE ranking.ano,
|
|
negocio LIKE ventas_pilas.negocio,
|
|
nombre LIKE ventas_pilas.nombre_cliente,
|
|
tamano LIKE ventas_pilas.tamano,
|
|
unidades LIKE ventas_pilas.unidades,
|
|
celda LIKE ventas_pilas.celda
|
|
END RECORD
|
|
|
|
DEFINE mes11,cuenta SMALLINT
|
|
DEFINE nom_mes1 CHAR(15)
|
|
DEFINE descrip,descrip1 CHAR(30)
|
|
DEFINE nombre_sal CHAR(20),
|
|
limite LIKE vetb00004.limite_credito,
|
|
hora CHAR(5),
|
|
J RECORD LIKE celdas.*
|
|
|
|
OUTPUT
|
|
LEFT MARGIN 2
|
|
TOP MARGIN 1
|
|
|
|
FORMAT
|
|
|
|
BEFORE GROUP OF x.negocio
|
|
LET idx = idx + 1
|
|
LET cels = "R",idx USING "<<<<","C1"
|
|
--# IF DDEpoke("EXCEL",archivo,cels,x.negocio) THEN
|
|
--# ELSE
|
|
--# LET numero_msg =391
|
|
--# CALL msg(numero_msg)
|
|
--# END IF
|
|
LET idx = idx + 2
|
|
|
|
BEFORE GROUP OF x.nombre
|
|
LET cels = "R",idx USING "<<<<","C1"
|
|
--# IF DDEpoke("EXCEL",archivo,cels,x.nombre) THEN
|
|
--# ELSE
|
|
--# LET numero_msg =391
|
|
--# CALL msg(numero_msg)
|
|
--# END IF
|
|
|
|
ON EVERY ROW
|
|
|
|
LET cels = "R",idx USING "<<<<","C3"
|
|
|
|
--# IF DDEpoke("EXCEL",archivo,cels,x.tamano) THEN
|
|
--# ELSE
|
|
--# LET numero_msg =391
|
|
--# CALL msg(numero_msg)
|
|
--# END IF
|
|
|
|
LET cels = "R",idx USING "<<<<","C",x.celda USING "<<"
|
|
|
|
|
|
--# IF DDEpoke("EXCEL",archivo,cels,x.unidades) THEN
|
|
--# ELSE
|
|
--# LET numero_msg =391
|
|
--# CALL msg(numero_msg)
|
|
--# END IF
|
|
|
|
AFTER GROUP OF x.tamano
|
|
LET idx = idx + 1
|
|
|
|
|
|
AFTER GROUP OF x.nombre
|
|
LET idx = idx + 1
|
|
|
|
|
|
END REPORT
|