243 lines
7.3 KiB
Plaintext
243 lines
7.3 KiB
Plaintext
{
|
|
------------------------------------------------------------------
|
|
PROGRAMA : CCPRRP011
|
|
OBJETIVO : Reporte de Descuento por Pronto Pago
|
|
Mensual Comparativo
|
|
PROGRAMADOR : Tadeo A. Ferreras F.
|
|
FECHA REALIZACION : Mayo 12,1993.
|
|
------------------------------------------------------------------
|
|
}
|
|
GLOBALS
|
|
"ccprgb000.4gl"
|
|
#### Definicion de variables para busqueda de informacion ####
|
|
|
|
DEFINE p_ano CHAR(4)
|
|
DEFINE mes RECORD
|
|
mes_in SMALLINT,
|
|
mes_fi SMALLINT
|
|
END RECORD
|
|
FUNCTION ccprrp011()
|
|
DEFINE prt_desc1 RECORD
|
|
mes_fact SMALLINT,
|
|
descrip LIKE mestable.descrip,
|
|
fecha1 DATE,
|
|
fecha2 DATE
|
|
END RECORD
|
|
|
|
OPTIONS
|
|
FORM LINE 10
|
|
WHENEVER ERROR CONTINUE
|
|
CLEAR SCREEN
|
|
OPEN FORM ccfmrp011 FROM "ccfmrp011"
|
|
CALL pantalla()
|
|
DISPLAY "ccprrp011" at 4,4 attribute(blue)
|
|
DISPLAY "Descuento por Pronto Pago Mensual Comparativo" at 6,18
|
|
DISPLAY FORM ccfmrp011
|
|
|
|
LET tipo_papel = 1
|
|
CALL msgrp000(tipo_papel)
|
|
|
|
###### Proceso para aceptar valores del rango de fecha para busqueda #####
|
|
|
|
INPUT BY NAME mes.*,p_ano
|
|
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 mes_in
|
|
IF mes.mes_in is null THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD mes_in
|
|
END IF
|
|
|
|
IF mes.mes_in > 12 THEN
|
|
LET numero_msg = 154
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD mes_in
|
|
END IF
|
|
|
|
AFTER FIELD mes_fi
|
|
IF mes.mes_fi is null THEN
|
|
LET mes.mes_fi = month(today)
|
|
DISPLAY BY NAME mes.mes_fi
|
|
END IF
|
|
|
|
IF mes.mes_fi > 12 THEN
|
|
LET numero_msg = 154
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD mes_fi
|
|
END IF
|
|
|
|
IF mes.mes_fi < mes.mes_in THEN
|
|
LET numero_msg = 86
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD mes_fi
|
|
END IF
|
|
|
|
END INPUT
|
|
|
|
###### Facilidad para cancelar proceso de impresion ###########
|
|
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = false
|
|
return
|
|
END IF
|
|
|
|
####### Selecionando informacion para imprimir #######
|
|
DECLARE buscar CURSOR FOR
|
|
SELECT a.mes,g.descrip,a.fecha_inicio,a.fecha_corte
|
|
FROM mestable g,prdtable a WHERE a.mes = g.mes AND
|
|
a.mes BETWEEN mes.mes_in AND mes.mes_fi AND a.ano = p_ano
|
|
|
|
IF status < 0 THEN
|
|
CALL integridad()
|
|
IF bANDera = 1 THEN
|
|
LET bANDera = 0
|
|
END IF
|
|
END IF
|
|
|
|
DISPLAY "<< Buscando Informacion ... Espere Por Favor. >>" at 19,14
|
|
attribute(reverse,bold)
|
|
|
|
####### Enviando informacion a la impresora de contabilidad #######
|
|
|
|
START REPORT prt_desc2 TO "C:\\archivo"
|
|
DISPLAY " " at 19,14
|
|
DISPLAY "<< Reporte Generandose ... Por Favor Espere. >>" at 19,14
|
|
ATTRIBUTE(REVERSE)
|
|
FOREACH buscar INTO prt_desc1.*
|
|
OUTPUT TO REPORT prt_desc2(prt_desc1.*,mes.mes_in,mes.mes_fi)
|
|
END FOREACH
|
|
FINISH REPORT prt_desc2
|
|
RUN "type C:\\archivo > %USPRINT%" END FUNCTION
|
|
|
|
REPORT prt_desc2(x,mes1,mes2)
|
|
|
|
####### Definiendo las variable que se imprimiran #######
|
|
|
|
DEFINE x RECORD
|
|
mes_fact SMALLINT,
|
|
descrip LIKE mestable.descrip,
|
|
fecha1 DATE,
|
|
fecha2 DATE
|
|
END RECORD,
|
|
mes1,mes2 SMALLINT,
|
|
fecha DATE,
|
|
i,c INTEGER,
|
|
valor,monto_desc,itbi,acum_itbi,acum_valor,acum_desc DECIMAL(11,2),
|
|
proporc,acum_prop DECIMAL(10,3)
|
|
|
|
DEFINE doble_on CHAR(2)
|
|
DEFINE doble_off CHAR(2)
|
|
DEFINE negrillas_on CHAR(2)
|
|
DEFINE negrillas_off CHAR(2)
|
|
DEFINE comp_on CHAR(2)
|
|
DEFINE comp_off CHAR(2)
|
|
DEFINE doce,normal CHAR(2)
|
|
DEFINE hora CHAR(5)
|
|
DEFINE l SMALLINT
|
|
DEFINE varia CHAR(10)
|
|
DEFINE mes_p CHAR(15)
|
|
|
|
|
|
####### Ordenando o sorteando informacion ########
|
|
|
|
ORDER BY x.mes_fact
|
|
|
|
######## Disenando el formato de salidad del reporte ######
|
|
FORMAT
|
|
PAGE HEADER
|
|
LET doble_on = ASCII 14
|
|
LET doble_off = ASCII 20
|
|
LET negrillas_on = ASCII 27, ASCII 98
|
|
LET negrillas_off = ASCII 27, ASCII 99
|
|
LET normal = ASCII 27, ASCII 80
|
|
LET comp_on = ASCII 15
|
|
LET comp_off = ASCII 30
|
|
LET doce = ASCII 27, ASCII 77
|
|
LET hora = time
|
|
LET fecha = today
|
|
LET hora = time
|
|
|
|
LET lj = (130 - LENGTH(p_companias.nombre CLIPPED))/2
|
|
PRINT COLUMN 1, comp_on
|
|
PRINT COLUMN 1, "ccprrp011",
|
|
COLUMN lj, p_companias.nombre CLIPPED,
|
|
COLUMN 123, "Pag. ",pageno USING "###"
|
|
PRINT COLUMN 42, " Sistema de Cuentas por Cobrar",
|
|
COLUMN 123, today USING "dd/mm/yy"
|
|
PRINT COLUMN 42, "Descuento por Pronto Pago Mensual Comparativo",
|
|
COLUMN 126, hora
|
|
skip 1 line
|
|
PRINT COLUMN 1, negrillas_on
|
|
PRINT COLUMN 1, "__________________________________________________",
|
|
"__________________________________________________",
|
|
"______________________________"
|
|
PRINT COLUMN 40, "A c t u a l",
|
|
COLUMN 92, "A c u m u l a d o"
|
|
|
|
PRINT COLUMN 27, "Monto a",
|
|
COLUMN 82, "Monto a"
|
|
|
|
PRINT COLUMN 2, "Mes",
|
|
COLUMN 27, "Cobrar",
|
|
COLUMN 42, "Desc.",
|
|
COLUMN 54, "Prop.%",
|
|
COLUMN 65, "Itbi",
|
|
COLUMN 82, "Cobrar",
|
|
COLUMN 98, "Desc.",
|
|
COLUMN 110, "Prop.%",
|
|
COLUMN 127, "Itbi"
|
|
|
|
PRINT COLUMN 1, "__________________________________________________",
|
|
"__________________________________________________",
|
|
"______________________________"
|
|
PRINT COLUMn 1, negrillas_off
|
|
|
|
SKIP 1 LINE
|
|
#ON EVERY ROW
|
|
BEFORE GROUP OF x.mes_fact
|
|
LET valor = 0
|
|
LET monto_desc = 0
|
|
|
|
AFTER GROUP OF x.mes_fact
|
|
|
|
SELECT sum(a.neto),SUM(b.monto_desc) INTO valor,monto_desc
|
|
FROM cctb00001 b,vetb00002 a
|
|
WHERE b.tipo_doc = "PG" AND b.aplica_a = a.factura AND
|
|
b.monto_desc != 0 AND b.fecha_orig BETWEEN x.fecha1 AND x.fecha2 and
|
|
a.status_t is null
|
|
|
|
IF acum_valor is null THEN LET acum_valor= 0 END IF
|
|
IF acum_desc is null THEN LET acum_desc = 0 END IF
|
|
|
|
#### Acumulando monto de la factura y monto del descuento por mes del
|
|
#### periodo en el rango de fecha
|
|
|
|
LET acum_valor= acum_valor+ valor
|
|
LET acum_desc = acum_desc + monto_desc
|
|
LET proporc = (monto_desc/valor) * 100
|
|
LET acum_itbi= acum_desc * 0.08
|
|
LET itbi = monto_desc * 0.08
|
|
LET acum_prop = (acum_desc/acum_valor) * 100
|
|
|
|
SKIP 1 LINE
|
|
PRINT COLUMN 2, x.descrip clipped,
|
|
COLUMN 22, valor USING "###,###,###.##",
|
|
COLUMN 38, monto_desc USING "###,###,###.##",
|
|
COLUMN 51, proporc USING "##&.##",
|
|
COLUMN 63, itbi USING "###,###.##",
|
|
COLUMN 77, acum_valor USING "###,###,###.##",
|
|
COLUMN 92, acum_desc USING "###,###,###.##",
|
|
COLUMN 107, acum_prop USING "##&.##",
|
|
COLUMN 119, acum_itbi USING "#,###,###.##"
|
|
ON LAST ROW
|
|
PRINT comp_off
|
|
END REPORT
|