671 lines
22 KiB
Plaintext
671 lines
22 KiB
Plaintext
{
|
|
=======================================================================
|
|
Programa : GEPRRP016
|
|
Sistema : Sistema de Informacion Gerencia
|
|
Proceso : Ranking de Ventas por Vendedor, Compania y Producto Acumulado
|
|
Autor : Juan F. Soto
|
|
Fecha : Mayo 22, 1996.
|
|
=======================================================================
|
|
}
|
|
GLOBALS
|
|
"geprgb000.4gl"
|
|
|
|
DEFINE ger_comp131 RECORD
|
|
sec_vend INTEGER,
|
|
compania SMALLINT,
|
|
cod_n SMALLINT,
|
|
cod_grupo SMALLINT,
|
|
cod_tipo SMALLINT,
|
|
cod_sec SMALLINT,
|
|
cantidad DECIMAL(14,2),
|
|
cantidad_ant DECIMAL(14,2),
|
|
cantidad_ant1 DECIMAL(14,2),
|
|
codigo CHAR(7),
|
|
descrip_esp LIKE intb00001.descrip_esp,
|
|
unidad_med LIKE intb00001.unidad_med
|
|
END RECORD,
|
|
desc_mes CHAR(12),
|
|
regi1,regi2,regi3 INTEGER
|
|
|
|
DEFINE ger_comp132 RECORD
|
|
sec_vend INTEGER,
|
|
compania SMALLINT,
|
|
cod_n SMALLINT,
|
|
cod_grupo SMALLINT,
|
|
cod_tipo SMALLINT,
|
|
cod_sec SMALLINT,
|
|
cantidad DECIMAL(14,2)
|
|
END RECORD
|
|
|
|
DEFINE ger_comp133 RECORD
|
|
sec_vend INTEGER,
|
|
compania SMALLINT,
|
|
cod_n SMALLINT,
|
|
cod_grupo SMALLINT,
|
|
cod_tipo SMALLINT,
|
|
cod_sec SMALLINT,
|
|
cantidad DECIMAL(14,2)
|
|
END RECORD
|
|
DEFINE nomb,apell CHAR(15),
|
|
nombre CHAR(30),
|
|
p_ano_ant1,p_mes,p_ano,p_ano_ant,mov1 SMALLINT,
|
|
esta CHAR(1),
|
|
idx1,idx2 INTEGER,
|
|
devol1,devol2 DECIMAL(12,4)
|
|
DEFINE salir,salir1 CHAR(1)
|
|
DEFINE fecha5,fecha6,fecha1,fecha2,fecha_inicial,fecha_final DATE
|
|
|
|
FUNCTION geprrp016()
|
|
DEFINE p_param CHAR(1)
|
|
LET int_flag = FALSE
|
|
OPTIONS
|
|
FORM LINE 8
|
|
CALL pantalla()
|
|
|
|
OPEN FORM gefmrp016 FROM "gefmrp016"
|
|
DISPLAY "geprrp016" AT 4,3 ATTRIBUTE(RED)
|
|
DISPLAY FORM gefmrp016
|
|
DISPLAY "Ranking de Ventas Por Vendedor, Compania y Producto Acumulado"
|
|
AT 6,10
|
|
ATTRIBUTE(BLACK)
|
|
|
|
LET tipo_papel = 1
|
|
CALL msgrp000(tipo_papel)
|
|
CALL defecto(impresor) RETURNING imprime, letras.*, archivo
|
|
|
|
INPUT BY NAME p_ano,p_mes
|
|
ON KEY(CONTROL-P)
|
|
CALL busca_printer() RETURNING imprime,letras.*, archivo
|
|
|
|
|
|
AFTER FIELD p_ano
|
|
IF p_ano is null THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD p_ano
|
|
END IF
|
|
AFTER FIELD p_mes
|
|
IF p_ano is null THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD p_ano
|
|
END IF
|
|
LET p_ano_ant = p_ano - 1
|
|
LET p_ano_ant1 = p_ano_ant - 1
|
|
|
|
SELECT fecha_inicio INTO fecha_inicial
|
|
FROM prdtable
|
|
WHERE mes = 10 and
|
|
ano = p_ano
|
|
|
|
SELECT fecha_corte INTO fecha_final
|
|
FROM prdtable
|
|
WHERE mes = p_mes and
|
|
ano = p_ano
|
|
|
|
SELECT fecha_inicio INTO fecha1
|
|
FROM prdtable
|
|
WHERE mes = 10 and
|
|
ano = p_ano_ant
|
|
|
|
SELECT fecha_corte INTO fecha2
|
|
FROM prdtable
|
|
WHERE mes = p_mes and
|
|
ano = p_ano_ant
|
|
|
|
SELECT fecha_inicio INTO fecha5
|
|
FROM prdtable
|
|
WHERE mes = 10 and
|
|
ano = p_ano_ant1
|
|
|
|
SELECT fecha_corte INTO fecha6
|
|
FROM prdtable
|
|
WHERE mes = p_mes and
|
|
ano = p_ano_ant1
|
|
SELECT descrip INTO desc_mes
|
|
FROM mestable
|
|
WHERE mes = p_mes
|
|
|
|
EXIT INPUT
|
|
END INPUT
|
|
IF int_flag tHEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
RETURN
|
|
END IF
|
|
|
|
CONSTRUCT criterio ON d.sec_vend,b.cod_n,b.cod_grupo,b.cod_tipo,b.cod_sec
|
|
FROM sec_vend,cod_n,cod_grupo,cod_tipo,cod_sec
|
|
|
|
ON KEY(CONTROL-P)
|
|
CALL busca_printer() RETURNING imprime,letras.*, archivo
|
|
AFTER CONSTRUCT
|
|
EXIT CONSTRUCT
|
|
END CONSTRUCT
|
|
|
|
IF int_flag tHEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
RETURN
|
|
END IF
|
|
{
|
|
LET selec1 =
|
|
"SELECT COUNT(*) ",
|
|
"FROM vetb00028 a,vetb00002 d ",
|
|
"WHERE ",
|
|
" (a.sec_vend = d.sec_vend AND ",
|
|
" a.tipo_cliente = d.tipo_cliente AND ",
|
|
" a.sec_cliente = d.sec_cliente) AND (",criterio clipped,
|
|
") AND (d.fecha_factura between ? and ?) ",
|
|
" AND (d.ventas = '1') ",
|
|
" AND d.status_t is null "
|
|
|
|
PREPARE comando11 FROM selec1
|
|
DECLARE buscar11 CURSOR FOR comando11
|
|
OPEN buscar11 USING fecha_inicial,fecha_final
|
|
FETCH buscar11 INTO regi1
|
|
}
|
|
LET selec1 =
|
|
"SELECT d.sec_vend,b.cod_cia,b.cod_n,b.cod_grupo,",
|
|
"b.cod_tipo,b.cod_sec, ",
|
|
" SUM(b.cantidad*b.precio) ",
|
|
"FROM vetb00028 a,vetb00003 b,vetb00002 d ",
|
|
"WHERE (b.factura = d.factura) AND ",
|
|
" (a.sec_vend = d.sec_vend AND ",
|
|
" a.tipo_cliente = d.tipo_cliente AND ",
|
|
" a.sec_cliente = d.sec_cliente) AND (",criterio clipped,
|
|
") AND (d.fecha_factura between ? and ?) ",
|
|
" AND (d.ventas = '1') ",
|
|
" AND d.status_t is null ",
|
|
" GROUP BY 1,2,3,4,5,6 ORDER BY 1,2,3,4,5,6 "
|
|
|
|
DISPLAY "Buscando Informacion... Espere por Favor" AT 17,14
|
|
ATTRIBUTE(BOLD)
|
|
|
|
PREPARE comando1 FROM selec1
|
|
DECLARE buscar1 SCROLL CURSOR FOR comando1
|
|
OPEN buscar1 USING fecha_inicial,fecha_final
|
|
{
|
|
LET selec2 =
|
|
"SELECT COUNT(*) ",
|
|
"FROM vetb00028 a,vetb00002 d ",
|
|
"WHERE ",
|
|
" (a.sec_vend = d.sec_vend AND ",
|
|
" a.tipo_cliente = d.tipo_cliente AND ",
|
|
" a.sec_cliente = d.sec_cliente) AND (",criterio clipped,
|
|
") AND (d.fecha_factura between ? and ?) ",
|
|
" AND (d.ventas = '1') ",
|
|
" AND d.status_t is null "
|
|
|
|
PREPARE comando21 FROM selec2
|
|
DECLARE buscar21 SCROLL CURSOR FOR comando21
|
|
OPEN buscar21 USING fecha1,fecha2
|
|
FETCH buscar21 INTO regi2
|
|
}
|
|
LET selec2 =
|
|
"SELECT d.sec_vend,b.cod_cia,b.cod_n,b.cod_grupo,",
|
|
"b.cod_tipo,b.cod_sec, ",
|
|
" SUM(b.cantidad*b.precio) ",
|
|
"FROM vetb00028 a,vetb00003 b,vetb00002 d ",
|
|
"WHERE (b.factura = d.factura) AND ",
|
|
" (a.sec_vend = d.sec_vend AND ",
|
|
" a.tipo_cliente = d.tipo_cliente AND ",
|
|
" a.sec_cliente = d.sec_cliente) AND (",criterio clipped,
|
|
") AND (d.fecha_factura between ? and ?) ",
|
|
" AND (d.ventas = '1') ",
|
|
" AND d.status_t is null ",
|
|
" GROUP BY 1,2,3,4,5,6 ORDER BY 1,2,3,4,5,6 "
|
|
|
|
DISPLAY "Buscando Informacion Ano Anterior... Espere por Favor" AT 17,14
|
|
ATTRIBUTE(BOLD)
|
|
|
|
PREPARE comando2 FROM selec2
|
|
DECLARE buscar2 SCROLL CURSOR FOR comando2
|
|
OPEN buscar2 USING fecha1,fecha2
|
|
{
|
|
LET selec2 =
|
|
"SELECT COUNT(*) ",
|
|
"FROM vetb00028 a,vetb00002 d ",
|
|
"WHERE ",
|
|
" (a.sec_vend = d.sec_vend AND ",
|
|
" a.tipo_cliente = d.tipo_cliente AND ",
|
|
" a.sec_cliente = d.sec_cliente) AND (",criterio clipped,
|
|
") AND (d.fecha_factura between ? and ?) ",
|
|
" AND (d.ventas = '1') ",
|
|
" AND d.status_t is null "
|
|
|
|
PREPARE comando31 FROM selec2
|
|
DECLARE buscar31 SCROLL CURSOR FOR comando31
|
|
OPEN buscar31 USING fecha5,fecha6
|
|
FETCH buscar31 INTO regi3
|
|
}
|
|
LET selec2 =
|
|
"SELECT d.sec_vend,b.cod_cia,b.cod_n,b.cod_grupo,",
|
|
"b.cod_tipo,b.cod_sec, ",
|
|
" SUM(b.cantidad*b.precio) ",
|
|
"FROM vetb00028 a,vetb00003 b,vetb00002 d ",
|
|
"WHERE (b.factura = d.factura) AND ",
|
|
" (a.sec_vend = d.sec_vend AND ",
|
|
" a.tipo_cliente = d.tipo_cliente AND ",
|
|
" a.sec_cliente = d.sec_cliente) AND (",criterio clipped,
|
|
") AND (d.fecha_factura between ? and ?) ",
|
|
" AND (d.ventas = '1') ",
|
|
" AND d.status_t is null ",
|
|
" GROUP BY 1,2,3,4,5,6 ORDER BY 1,2,3,4,5,6 "
|
|
|
|
DISPLAY "Buscando Informacion Ano Anterior Anterior... Espere por Favor"
|
|
AT 17,14 ATTRIBUTE(BOLD)
|
|
|
|
PREPARE comando3 FROM selec2
|
|
DECLARE buscar3 SCROLL CURSOR FOR comando3
|
|
OPEN buscar3 USING fecha5,fecha6
|
|
|
|
START REPORT repor_16 TO archivo
|
|
|
|
DISPLAY "Reporte Generandose ... Espere por Favor" AT 17,14
|
|
ATTRIBUTE(BOLD)
|
|
|
|
# Busqueda de los registros que estan en el ano actual y estan en el
|
|
# Ano anterior
|
|
#LET regi = regi1 + regi2 + regi3
|
|
LET idx1 = 0
|
|
LET salir1 = "N"
|
|
LET p_param = "S"
|
|
WHILE salir1 != "S"
|
|
FETCH buscar1 INTO ger_comp131.*
|
|
IF STATUS = NOTFOUND THEN
|
|
LET salir1 = "S"
|
|
LET idx1 = 1
|
|
EXIT WHILE
|
|
END IF
|
|
{
|
|
CALL termometro(regi,p_param)
|
|
LET p_param = "N"
|
|
}
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
RETURN
|
|
END IF
|
|
|
|
LET idx1 = idx1 + 1
|
|
IF ger_comp131.cantidad IS NULL THEN
|
|
LET ger_comp131.cantidad = 0
|
|
END IF
|
|
LET ger_comp131.codigo = ger_comp131.cod_n using "&",
|
|
ger_comp131.cod_grupo using "&",
|
|
ger_comp131.cod_tipo using "&&",
|
|
ger_comp131.cod_sec using "&&&"
|
|
|
|
# Busqueda de las informaciones del ano anetrior
|
|
LET ger_comp131.cantidad_ant = 0
|
|
LET salir = "N"
|
|
LET idx = 1
|
|
WHILE salir != "S"
|
|
FETCH ABSOLUTE idx buscar2 INTO ger_comp132.*
|
|
IF STATUS = NOTFOUND THEN
|
|
LET salir = "S"
|
|
EXIT WHILE
|
|
END IF
|
|
LET idx = idx + 1
|
|
IF ger_comp131.cod_n = ger_comp132.cod_n and
|
|
ger_comp131.cod_grupo = ger_comp132.cod_grupo and
|
|
ger_comp131.cod_tipo = ger_comp132.cod_tipo and
|
|
ger_comp131.cod_sec = ger_comp132.cod_sec and
|
|
ger_comp131.compania = ger_comp132.compania and
|
|
ger_comp131.sec_vend = ger_comp132.sec_vend THEN
|
|
|
|
LET ger_comp131.cantidad_ant = ger_comp132.cantidad
|
|
EXIT WHILE
|
|
END IF
|
|
END WHILE
|
|
|
|
# Busqueda de las informaciones del ano anetrior anterior
|
|
LET ger_comp131.cantidad_ant1 = 0
|
|
LET salir = "N"
|
|
LET idx = 1
|
|
WHILE salir != "S"
|
|
FETCH ABSOLUTE idx buscar3 INTO ger_comp133.*
|
|
IF STATUS = NOTFOUND THEN
|
|
LET salir = "S"
|
|
EXIT WHILE
|
|
END IF
|
|
LET idx = idx + 1
|
|
IF ger_comp131.cod_n = ger_comp133.cod_n and
|
|
ger_comp131.cod_grupo = ger_comp133.cod_grupo and
|
|
ger_comp131.cod_tipo = ger_comp133.cod_tipo and
|
|
ger_comp131.cod_sec = ger_comp133.cod_sec and
|
|
ger_comp131.compania = ger_comp133.compania and
|
|
ger_comp131.sec_vend = ger_comp133.sec_vend THEN
|
|
|
|
LET ger_comp131.cantidad_ant1 = ger_comp133.cantidad
|
|
EXIT WHILE
|
|
END IF
|
|
END WHILE
|
|
|
|
IF ger_comp131.codigo != "0000000" THEN
|
|
OUTPUT TO REPORT repor_16(ger_comp131.*)
|
|
END IF
|
|
END WHILE
|
|
#----------------------------------------------------------------------------
|
|
|
|
# Busqueda de los registros que estan en el ano anterior y no estan en el
|
|
# ano Actual
|
|
LET idx = 1
|
|
LET idx1 = 1
|
|
LET salir1 = "N"
|
|
WHILE salir1 != "S"
|
|
FETCH ABSOLUTE idx1 buscar2 INTO ger_comp131.*
|
|
IF STATUS = NOTFOUND THEN
|
|
LET salir1 = "S"
|
|
LET idx1 = 1
|
|
EXIT WHILE
|
|
END IF
|
|
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
RETURN
|
|
END IF
|
|
|
|
IF ger_comp131.cantidad IS NULL THEN
|
|
LET ger_comp131.cantidad = 0
|
|
END IF
|
|
LET esta = "N"
|
|
LET idx1 = idx1 + 1
|
|
LET idx = 1
|
|
|
|
# Busqueda de las informaciones del ano actual
|
|
LET salir = "N"
|
|
WHILE salir != "S"
|
|
FETCH ABSOLUTE idx buscar1 INTO ger_comp132.*
|
|
IF STATUS = NOTFOUND THEN
|
|
LET salir = "S"
|
|
EXIT WHILE
|
|
END IF
|
|
LET idx = idx + 1
|
|
|
|
IF ger_comp131.cod_n = ger_comp132.cod_n and
|
|
ger_comp131.cod_grupo = ger_comp132.cod_grupo and
|
|
ger_comp131.cod_tipo = ger_comp132.cod_tipo and
|
|
ger_comp131.cod_sec = ger_comp132.cod_sec and
|
|
ger_comp131.compania = ger_comp132.compania and
|
|
ger_comp131.sec_vend = ger_comp132.sec_vend THEN
|
|
|
|
LET esta = "S"
|
|
EXIT WHILE
|
|
END IF
|
|
END WHILE
|
|
|
|
IF esta = "N" THEN
|
|
# Busqueda de las informaciones del ano anterior anterior
|
|
LET salir = "N"
|
|
WHILE salir != "S"
|
|
FETCH ABSOLUTE idx buscar3 INTO ger_comp132.*
|
|
IF STATUS = NOTFOUND THEN
|
|
LET salir = "S"
|
|
EXIT WHILE
|
|
END IF
|
|
LET idx = idx + 1
|
|
|
|
IF ger_comp131.cod_n = ger_comp132.cod_n and
|
|
ger_comp131.cod_grupo = ger_comp132.cod_grupo and
|
|
ger_comp131.cod_tipo = ger_comp132.cod_tipo and
|
|
ger_comp131.cod_sec = ger_comp132.cod_sec and
|
|
ger_comp131.compania = ger_comp132.compania and
|
|
ger_comp131.sec_vend = ger_comp132.sec_vend THEN
|
|
|
|
LET ger_comp131.cantidad_ant1 = ger_comp132.cantidad
|
|
EXIT WHILE
|
|
END IF
|
|
END WHILE
|
|
LET ger_comp131.codigo = ger_comp131.cod_n using "&",
|
|
ger_comp131.cod_grupo using "&",
|
|
ger_comp131.cod_tipo using "&&",
|
|
ger_comp131.cod_sec using "&&&"
|
|
LET ger_comp131.cantidad = 0
|
|
IF ger_comp131.codigo != "0000000" THEN
|
|
OUTPUT TO REPORT repor_16(ger_comp131.*)
|
|
END IF
|
|
END IF
|
|
END WHILE
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Busqueda de los registros que estan en el ano anterior anterior y
|
|
# no estan en el ano Anterior
|
|
LET idx = 1
|
|
LET idx1 = 1
|
|
LET salir1 = "N"
|
|
WHILE salir1 != "S"
|
|
FETCH ABSOLUTE idx1 buscar3 INTO ger_comp131.*
|
|
IF STATUS = NOTFOUND THEN
|
|
LET salir1 = "S"
|
|
LET idx1 = 1
|
|
EXIT WHILE
|
|
END IF
|
|
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
RETURN
|
|
END IF
|
|
|
|
IF ger_comp131.cantidad IS NULL THEN
|
|
LET ger_comp131.cantidad = 0
|
|
END IF
|
|
|
|
LET esta = "N"
|
|
LET idx1 = idx1 + 1
|
|
LET idx = 1
|
|
|
|
# Busqueda de las informaciones del ano Anterior
|
|
LET salir = "N"
|
|
WHILE salir != "S"
|
|
FETCH ABSOLUTE idx buscar2 INTO ger_comp132.*
|
|
IF STATUS = NOTFOUND THEN
|
|
LET salir = "S"
|
|
EXIT WHILE
|
|
END IF
|
|
LET idx = idx + 1
|
|
|
|
IF ger_comp131.cod_n = ger_comp132.cod_n and
|
|
ger_comp131.cod_grupo = ger_comp132.cod_grupo and
|
|
ger_comp131.cod_tipo = ger_comp132.cod_tipo and
|
|
ger_comp131.cod_sec = ger_comp132.cod_sec and
|
|
ger_comp131.compania = ger_comp132.compania and
|
|
ger_comp131.sec_vend = ger_comp132.sec_vend THEN
|
|
|
|
LET esta = "S"
|
|
EXIT WHILE
|
|
END IF
|
|
END WHILE
|
|
|
|
# Busqueda de las informaciones del ano actual
|
|
LET idx = 1
|
|
LET salir = "N"
|
|
WHILE salir != "S"
|
|
FETCH ABSOLUTE idx buscar1 INTO ger_comp132.*
|
|
IF STATUS = NOTFOUND THEN
|
|
LET salir = "S"
|
|
EXIT WHILE
|
|
END IF
|
|
LET idx = idx + 1
|
|
|
|
IF ger_comp131.cod_n = ger_comp132.cod_n and
|
|
ger_comp131.cod_grupo = ger_comp132.cod_grupo and
|
|
ger_comp131.cod_tipo = ger_comp132.cod_tipo and
|
|
ger_comp131.cod_sec = ger_comp132.cod_sec and
|
|
ger_comp131.compania = ger_comp132.compania and
|
|
ger_comp131.sec_vend = ger_comp132.sec_vend THEN
|
|
|
|
LET esta = "S"
|
|
EXIT WHILE
|
|
END IF
|
|
END WHILE
|
|
|
|
IF esta = "N" THEN
|
|
LET ger_comp131.codigo = ger_comp131.cod_n using "&",
|
|
ger_comp131.cod_grupo using "&",
|
|
ger_comp131.cod_tipo using "&&",
|
|
ger_comp131.cod_sec using "&&&"
|
|
LET ger_comp131.cantidad_ant1 = ger_comp131.cantidad
|
|
LET ger_comp131.cantidad_ant = 0
|
|
LET ger_comp131.cantidad = 0
|
|
IF ger_comp131.codigo != "0000000" THEN
|
|
OUTPUT TO REPORT repor_16(ger_comp131.*)
|
|
END IF
|
|
END IF
|
|
END WHILE
|
|
FINISH REPORT repor_16
|
|
RUN imprime
|
|
END FUNCTION
|
|
|
|
REPORT repor_16(x)
|
|
|
|
DEFINE x RECORD
|
|
sec_vend INTEGER,
|
|
compania SMALLINT,
|
|
cod_n SMALLINT,
|
|
cod_grupo SMALLINT,
|
|
cod_tipo SMALLINT,
|
|
cod_sec SMALLINT,
|
|
cantidad DECIMAL(14,2),
|
|
cantidad_ant DECIMAL(14,2),
|
|
cantidad_ant1 DECIMAL(14,2),
|
|
codigo CHAR(7),
|
|
descrip_esp LIKE intb00001.descrip_esp,
|
|
unidad_med LIKE intb00001.unidad_med
|
|
END RECORD
|
|
|
|
DEFINE hora CHAR(5)
|
|
|
|
OUTPUT
|
|
LEFT MARGIN 2
|
|
TOP MARGIN 1
|
|
ORDER BY x.sec_vend,x.compania,x.cantidad
|
|
DESC, x.codigo
|
|
|
|
FORMAT
|
|
PAGE HEADER
|
|
|
|
LET hora = time
|
|
PRINT COLUMN 1, letras.doce,letras.negrillas_on
|
|
PRINT COLUMN 1, "geprrp016",
|
|
COLUMN 25, " R A Y . O . V A C D O M I N I C A N A, S. A.",
|
|
COLUMN 91, "Pag. ", pageno using "###"
|
|
PRINT COLUMN 38, "SISTEMA DE INFORMACION GERENCIAL",
|
|
COLUMN 91, today using "dd/mm/yyyy"
|
|
PRINT COLUMN 25, "Ranking de Ventas Por Vendedor, Compania y Producto",
|
|
COLUMN 94, hora
|
|
SKIP 1 LINES
|
|
PRINT COLUMN 25, " ACUMULADO"
|
|
PRINT COLUMN 1, "MES DE ",desc_mes
|
|
PRINT COLUMN 1, "-------------------------------------------------",
|
|
"-------------------------------------------------"
|
|
|
|
PRINT COLUMN 57, "Ventas",
|
|
COLUMN 75, "Ventas",
|
|
COLUMN 93, "Ventas"
|
|
|
|
PRINT COLUMN 1, "Posicion y Producto",
|
|
COLUMN 58, p_ano using "####",
|
|
COLUMN 76, p_ano_ant using "####",
|
|
COLUMN 94, p_ano_ant1 using "####"
|
|
|
|
PRINT COLUMN 1, "-------------------------------------------------",
|
|
"-------------------------------------------------"
|
|
PRINT COLUMN 1, letras.negrillas_off
|
|
|
|
BEFORE GROUP OF x.sec_vend
|
|
SKIP TO TOP OF PAGE
|
|
SELECT UNIQUE a.nom1_emp,a.apell1_emp INTO nomb,apell FROM adtb00003 a
|
|
WHERE a.num_emp = x.sec_vend
|
|
|
|
LET nombre = nomb CLIPPED," ",apell CLIPPED
|
|
|
|
PRINT COLUMN 1, letras.negrillas_on
|
|
PRINT COLUMN 1, "Vendedor: ",x.sec_vend USING "&&&&"," ",nombre,
|
|
letras.negrillas_off
|
|
|
|
BEFORE GROUP OF x.compania
|
|
PRINT COLUMN 1, letras.negrillas_on
|
|
IF x.compania = 1 THEN
|
|
PRINT COLUMN 1, "Productos Locales", letras.negrillas_off
|
|
ELSE
|
|
PRINT COLUMN 1, "Productos Importados", letras.negrillas_off
|
|
END IF
|
|
LET idx2 = 0
|
|
|
|
AFTER GROUP OF x.codigo
|
|
LET idx2 = idx2 + 1
|
|
|
|
SELECT UNIQUE a.descrip_esp,a.unidad_med INTO x.descrip_esp,x.unidad_med
|
|
FROM intb00001 a
|
|
WHERE a.cod_n = x.cod_n AND a.cod_grupo = x.cod_grupo AND
|
|
a.cod_tipo = x.cod_tipo AND a.cod_sec = x.cod_sec
|
|
|
|
PRINT COLUMN 1, idx2 USING "&&&"," ",
|
|
x.cod_n USING "&","-",x.cod_grupo USING "&","-",
|
|
x.cod_tipo USING "&&","-",x.cod_sec USING "&&&",
|
|
" ", x.descrip_esp," ",x.unidad_med CLIPPED,
|
|
COLUMN 48, GROUP SUM(x.cantidad)
|
|
WHERE x.sec_vend = x.sec_vend
|
|
USING "-,---,---,---.##",
|
|
COLUMN 65, GROUP SUM(x.cantidad_ant)
|
|
WHERE x.sec_vend = x.sec_vend
|
|
USING "-,---,---,---.##" ,
|
|
COLUMN 82, GROUP SUM(x.cantidad_ant1)
|
|
WHERE x.sec_vend = x.sec_vend
|
|
USING "-,---,---,---.##"
|
|
|
|
AFTER GROUP OF x.compania
|
|
PRINT COLUMN 1, letras.negrillas_on
|
|
PRINT COLUMN 50, "----------------",
|
|
COLUMN 66, "----------------" ,
|
|
COLUMN 82, "----------------"
|
|
PRINT COLUMN 1, "Total Compania ---> ",
|
|
COLUMN 48, GROUP SUM(x.cantidad)
|
|
WHERE x.sec_vend = x.sec_vend
|
|
USING "-,---,---,---.##",
|
|
COLUMN 65, GROUP SUM(x.cantidad_ant)
|
|
WHERE x.sec_vend = x.sec_vend
|
|
USING "-,---,---,---.##" ,
|
|
COLUMN 82, GROUP SUM(x.cantidad_ant1)
|
|
WHERE x.sec_vend = x.sec_vend
|
|
USING "-,---,---,---.##"
|
|
PRINT COLUMN 1, letras.negrillas_off
|
|
|
|
AFTER GROUP OF x.sec_vend
|
|
PRINT COLUMN 1, letras.negrillas_on
|
|
PRINT COLUMN 48, "----------------",
|
|
COLUMN 65, "----------------",
|
|
COLUMN 82, "----------------"
|
|
PRINT COLUMN 1, "Total Vendedor ---> ",
|
|
COLUMN 48, GROUP SUM(x.cantidad)
|
|
USING "-,---,---,---.##",
|
|
COLUMN 65, GROUP SUM(x.cantidad_ant)
|
|
USING "-,---,---,---.##" ,
|
|
COLUMN 82, GROUP SUM(x.cantidad_ant1)
|
|
USING "-,---,---,---.##"
|
|
PRINT COLUMN 1, letras.negrillas_off
|
|
|
|
ON LAST ROW
|
|
PRINT COLUMN 1, letras.negrillas_on
|
|
PRINT COLUMN 48, "================",
|
|
COLUMN 65, "================" ,
|
|
COLUMN 82, "================"
|
|
PRINT COLUMN 1, "Total General ---> ",
|
|
COLUMN 48, SUM(x.cantidad)
|
|
USING "-,---,---,---.##",
|
|
COLUMN 65, SUM(x.cantidad_ant)
|
|
USING "-,---,---,---.##" ,
|
|
COLUMN 82, SUM(x.cantidad_ant)
|
|
USING "-,---,---,---.##"
|
|
PRINT COLUMN 1, letras.normal,letras.negrillas_off
|
|
END REPORT
|