Commit inicial: fuentes MBS ERP (Genero 6) + .gitignore + docs/SETUP_PC_MBS.md
This commit is contained in:
@@ -0,0 +1,257 @@
|
||||
{
|
||||
------------------------------------------------------------------
|
||||
PROGRAMA : CCPRRP012
|
||||
OBJETIVO : Reporte de Antiguedad del descuento por pronto pago
|
||||
por mes
|
||||
PROGRAMADOR : Tadeo A. Ferreras F.
|
||||
FECHA REALIZACION : Mayo 12,1993.
|
||||
------------------------------------------------------------------
|
||||
}
|
||||
GLOBALS
|
||||
"ccprgb000.4gl"
|
||||
|
||||
########## Definiendo las variables del proceso de busqueda de informacion ####
|
||||
define p_ano char(4)
|
||||
define l smallint
|
||||
|
||||
define mes record
|
||||
ano CHAR(4),
|
||||
mes_in smallint,
|
||||
mes_fi smallint
|
||||
end record
|
||||
|
||||
FUNCTION ccprrp012()
|
||||
|
||||
define prt_desc4 record
|
||||
mes_fact smallint,
|
||||
descrip like mestable.descrip,
|
||||
valor Like cctb00001.valor,
|
||||
monto_desc like cctb00001.monto_desc
|
||||
end record
|
||||
define fecha_in,fecha_fi date
|
||||
|
||||
OPTIONS
|
||||
FORM LINE 10
|
||||
WHENEVER ERROR CONTINUE
|
||||
clear screen
|
||||
OPEN FORM ccfmrp012 FROM "ccfmrp012"
|
||||
CALL pantalla()
|
||||
display "ccprrp012" at 4,4 attribute(blue)
|
||||
display "Antiguedades de Desc. por Pronto Pago Y por Mes" at 6,16
|
||||
display form ccfmrp012
|
||||
|
||||
let tipo_papel = 1
|
||||
call msgrp000(tipo_papel)
|
||||
|
||||
let p_ano = year(today)
|
||||
|
||||
####### Aceptando los valores del rango ########
|
||||
input by name mes.*
|
||||
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
|
||||
select fecha_inicio into fecha_in from prdtable
|
||||
where mes = mes.mes_in and ano = p_ano
|
||||
|
||||
if mes.mes_in > 12 then
|
||||
let mes.mes_in = mes.mes_in - 12
|
||||
end if
|
||||
|
||||
after field mes_fi
|
||||
if mes.mes_in is null then
|
||||
let mes.mes_fi = month(today)
|
||||
display by name mes.mes_fi
|
||||
end if
|
||||
display mes.mes_fi at 24,1
|
||||
select fecha_corte into fecha_fi from prdtable
|
||||
where @mes = mes.mes_fi and ano = p_ano
|
||||
|
||||
if mes.mes_fi > 12 then
|
||||
let mes.mes_fi = mes.mes_in - 12
|
||||
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
|
||||
|
||||
####### En caso de que que presiones DELETE se cancelara la busqueda ####
|
||||
if int_flag then
|
||||
let numero_msg = 2
|
||||
call msg(numero_msg)
|
||||
let int_flag = false
|
||||
return
|
||||
end if
|
||||
|
||||
######## Selecionando informacion a imprimir #########
|
||||
|
||||
declare buscar cursor for select unique c.mes,g.descrip,
|
||||
sum(a.neto),
|
||||
sum(b.monto_desc)
|
||||
from cctb00001 b,mestable g,vetb00002 a,
|
||||
prdtable c
|
||||
where b.tipo_doc = "PG" and
|
||||
b.aplica_a = a.factura and
|
||||
c.mes = g.mes and
|
||||
c.ano = mes.ano and
|
||||
b.monto_desc != 0 and
|
||||
b.fecha_orig between c.fecha_inicio and
|
||||
c.fecha_corte
|
||||
group by 1,2
|
||||
|
||||
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 al printer de contabilidad #####
|
||||
|
||||
start report prt_desc3 to pipe "$DBPRINT"
|
||||
display " >>" at 19,14
|
||||
display "<< Reporte Generandose ... Por Favor Espere. >>" at 19,14
|
||||
attribute(reverse)
|
||||
|
||||
foreach buscar into prt_desc4.*
|
||||
output to report prt_desc3(prt_desc4.*,mes.mes_in,mes.mes_fi)
|
||||
end foreach
|
||||
finish report prt_desc3
|
||||
end function
|
||||
|
||||
report prt_desc3(x,mes1,mes2)
|
||||
|
||||
####### Definiendo variables de impresion #######
|
||||
define x record
|
||||
mes_fact smallint,
|
||||
descrip like mestable.descrip,
|
||||
valor like cctb00001.valor,
|
||||
monto_desc like cctb00001.monto_desc
|
||||
end record,
|
||||
mes1,mes2 smallint,
|
||||
fecha,fecha_i,fecha_c date,
|
||||
i,c integer,
|
||||
itbi,acum_itbi,acum_valor,acum_desc DECIMAL(11,2),
|
||||
proporc,acum_prop DECIMAL(10,3)
|
||||
define total1,total2,total3 decimal(11,2),
|
||||
porc1,porc2,porc3 decimal(6,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)
|
||||
|
||||
|
||||
order by x.mes_fact
|
||||
|
||||
######### Formateando la salidad de impresion ######
|
||||
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 lj = (94 - LENGTH(p_companias.nombre CLIPPED))/2
|
||||
print column 1,comp_off,
|
||||
column 2,"ccprrp012",
|
||||
column lj,p_companias.nombre CLIPPED,
|
||||
column 87,"Pag. ",pageno using "###"
|
||||
print column 29, "Sistema de Cuentas por Cobrar",
|
||||
column 85,today using "dd/mm/yyyy"
|
||||
let fecha = today
|
||||
let hora = time
|
||||
print column 23,"Antiguedades de Desc. por Pronto Pagos y por Mes",
|
||||
column 88,hora
|
||||
skip 1 line
|
||||
print column 1,comp_on,negrillas_on
|
||||
print column 2,
|
||||
"______________________________________________________________________________________________________________________________________"
|
||||
print column 1,comp_on
|
||||
print column 80, "D e s c u e n t o s"
|
||||
|
||||
print column 25,"Monto a",
|
||||
column 42,"Total",
|
||||
column 68,"1-30",
|
||||
column 92,"31-60",
|
||||
column 112,"Mas de 60 Dias"
|
||||
|
||||
print column 2,"Mes",
|
||||
column 25,"Cobrar",
|
||||
column 42,"Descuento",
|
||||
column 61,"Cantidad %",
|
||||
column 85,"Cantidad %",
|
||||
column 112,"Cantidad %"
|
||||
|
||||
print column 2,
|
||||
"______________________________________________________________________________________________________________________________________",
|
||||
negrillas_off,comp_off
|
||||
skip 1 line
|
||||
on every row
|
||||
|
||||
select fecha_inicio,fecha_corte into fecha_i,fecha_c from
|
||||
prdtable where @mes = x.mes_fact and ano = year(today)
|
||||
|
||||
select sum(@b.monto_desc)
|
||||
into total1
|
||||
from vetb00002 a,cctb00001 b
|
||||
where b.tipo_doc = "PG" and
|
||||
a.factura = b.aplica_a and b.monto_desc != 0 and
|
||||
(b.fecha_orig - a.fecha_factura) <= 30
|
||||
and fecha_orig between fecha_i and fecha_c
|
||||
|
||||
select sum(@b.monto_desc)
|
||||
into total2
|
||||
from vetb00002 a,cctb00001 b
|
||||
where b.tipo_doc = "PG" and
|
||||
a.factura = b.aplica_a and b.monto_desc != 0 and
|
||||
(b.fecha_orig - a.fecha_factura) between 31 and 60
|
||||
and fecha_orig between fecha_i and fecha_c
|
||||
|
||||
select sum(@b.monto_desc)
|
||||
into total3
|
||||
from vetb00002 a,cctb00001 b
|
||||
where b.tipo_doc = "PG" and
|
||||
a.factura = b.aplica_a and b.monto_desc != 0 and
|
||||
(b.fecha_orig - a.fecha_factura) >= 61
|
||||
and fecha_orig between fecha_i and fecha_c
|
||||
|
||||
let porc1 = (total1/x.monto_desc) * 100
|
||||
let porc2 = (total2/x.monto_desc) * 100
|
||||
let porc3 = (total3/x.monto_desc) * 100
|
||||
|
||||
|
||||
|
||||
print column 1,comp_on
|
||||
print column 2,x.descrip clipped,
|
||||
column 18,x.valor using "###,###,###.##",
|
||||
column 38,x.monto_desc using "###,###,###.##",
|
||||
column 55,total1 using "###,###,##&.##",
|
||||
column 71,porc1 using "##&.##",
|
||||
column 80,total2 using "###,###,##&.##",
|
||||
column 96,porc2 using "##&.##",
|
||||
column 106,total3 using "###,###,##&.##",
|
||||
column 122,porc3 using "##&.##",comp_off
|
||||
|
||||
|
||||
end report
|
||||
Reference in New Issue
Block a user