Commit inicial: fuentes MBS ERP (Genero 6) + .gitignore + docs/SETUP_PC_MBS.md
This commit is contained in:
@@ -0,0 +1,181 @@
|
||||
|
||||
DEFINE r_output STRING -- output format option
|
||||
|
||||
|
||||
FUNCTION cgprrp008r(fecha1,fecha2)
|
||||
DEFINE handler om.SaxDocumentHandler, -- return value from fgl_report_commitCurrentSettings()
|
||||
r_filename STRING, -- filename of Report Design Document including .4rp extension
|
||||
preview INTEGER -- TRUE/FALSE, to set preview option
|
||||
DEFINE cgtb16 RECORD
|
||||
ano SMALLINT
|
||||
,mes SMALLINT
|
||||
,cuenta_no VARCHAR(14)
|
||||
,estado_a VARCHAR(10)
|
||||
,estado_m VARCHAR(10)
|
||||
,descripcion VARCHAR(50)
|
||||
,debito DEC(12,2)
|
||||
,credito DEC(12,2)
|
||||
,balance_ant DEC(12,2)
|
||||
,actividad DEC(12,2)
|
||||
,balance_act DEC(12,2)
|
||||
,primern VARCHAR(10)
|
||||
|
||||
END RECORD,
|
||||
knivel SMALLINT,
|
||||
fecha1,fecha2 DATE
|
||||
|
||||
|
||||
CALL seleccionarSalida() RETURNING r_output
|
||||
LET r_filename = "cgprrpanalitico.4rp"
|
||||
#LET r_output = "SVG"
|
||||
LET preview = TRUE
|
||||
|
||||
-- configure report engine; the functions prefixed fgl that are called here are part of the GRW API
|
||||
IF fgl_report_loadCurrentSettings(r_filename) THEN -- load the .4rp file
|
||||
CALL fgl_report_selectDevice(r_output) -- changing default
|
||||
CALL fgl_report_selectPreview(preview) -- changing default
|
||||
CALL fgl_report_configurexlsxdevice(null,null,null,false,false,null,1)
|
||||
LET handler = fgl_report_commitCurrentSettings() -- commit changes
|
||||
|
||||
ELSE
|
||||
EXIT PROGRAM
|
||||
END IF
|
||||
|
||||
IF handler IS NOT NULL THEN
|
||||
|
||||
START REPORT analitico TO XML HANDLER HANDLER
|
||||
|
||||
DECLARE busca CURSOR FOR
|
||||
SELECT a.cuenta_no,b.descripcion,a.balance_ant,
|
||||
a.debito,a.credito,a.actividad,
|
||||
a.balance_act, b.nivel , b.nivel FROM cgtb00016 a,cgtb00001 b
|
||||
WHERE a.cuenta_no = b.cuenta_no AND a.ano = YEAR(fecha1) AND a.mes = MONTH(fecha1)
|
||||
|
||||
|
||||
FOREACH busca INTO cgtb16.cuenta_no,cgtb16.descripcion,cgtb16.balance_ant,
|
||||
cgtb16.debito,cgtb16.credito,cgtb16.actividad,
|
||||
cgtb16.balance_act,knivel
|
||||
|
||||
IF cgtb16.balance_ant <> 0 OR cgtb16.balance_act <> 0 THEN
|
||||
OUTPUT TO REPORT analitico(cgtb16.*,fecha1,fecha2,knivel)
|
||||
END IF
|
||||
END FOREACH
|
||||
FINISH REPORT analitico
|
||||
|
||||
LET r_filename = "cgprrpanalitico_2.4rp"
|
||||
#LET r_output = "SVG"
|
||||
LET preview = TRUE
|
||||
|
||||
-- configure report engine; the functions prefixed fgl that are called here are part of the GRW API
|
||||
IF fgl_report_loadCurrentSettings(r_filename) THEN -- load the .4rp file
|
||||
CALL fgl_report_selectDevice(r_output) -- changing default
|
||||
CALL fgl_report_selectPreview(preview) -- changing default
|
||||
LET handler = fgl_report_commitCurrentSettings() -- commit changes
|
||||
|
||||
ELSE
|
||||
EXIT PROGRAM
|
||||
END IF
|
||||
|
||||
START REPORT analitico TO XML HANDLER HANDLER
|
||||
|
||||
DECLARE busca_resumen CURSOR FOR
|
||||
SELECT a.cuenta_no,b.descripcion,a.balance_ant,
|
||||
a.debito,a.credito,a.actividad,
|
||||
a.balance_act, b.nivel
|
||||
FROM cgtb00016 a,cgtb00001 b
|
||||
WHERE a.cuenta_no = b.cuenta_no AND b.nivel = 1 AND a.ano = YEAR(fecha1) AND a.mes = MONTH(fecha1)
|
||||
ORDER BY a.cuenta_no
|
||||
|
||||
INITIALIZE cgtb16.* TO NULL
|
||||
FOREACH busca_resumen INTO cgtb16.cuenta_no,cgtb16.descripcion,cgtb16.balance_ant,
|
||||
cgtb16.debito,cgtb16.credito,cgtb16.actividad,
|
||||
cgtb16.balance_act,knivel
|
||||
|
||||
|
||||
OUTPUT TO REPORT analitico(cgtb16.*,fecha1,fecha2,knivel)
|
||||
END FOREACH
|
||||
FINISH REPORT analitico
|
||||
|
||||
LET r_filename = "cgprrpanalitico_3.4rp"
|
||||
#LET r_output = "SVG"
|
||||
LET preview = TRUE
|
||||
|
||||
-- configure report engine; the functions prefixed fgl that are called here are part of the GRW API
|
||||
IF fgl_report_loadCurrentSettings(r_filename) THEN -- load the .4rp file
|
||||
CALL fgl_report_selectDevice(r_output) -- changing default
|
||||
CALL fgl_report_selectPreview(preview) -- changing default
|
||||
LET handler = fgl_report_commitCurrentSettings() -- commit changes
|
||||
ELSE
|
||||
EXIT PROGRAM
|
||||
END IF
|
||||
|
||||
START REPORT analitico TO XML HANDLER HANDLER
|
||||
|
||||
DECLARE busca_resumen_estado CURSOR FOR
|
||||
SELECT a.cuenta_no,b.descripcion,a.balance_ant,
|
||||
a.debito,a.credito,a.actividad,
|
||||
a.balance_act, b.nivel
|
||||
FROM cgtb00016 a,cgtb00001 b
|
||||
WHERE a.cuenta_no = b.cuenta_no AND b.cuenta_resultado = "S" AND a.ano = YEAR(fecha1) AND a.mes = MONTH(fecha1)
|
||||
ORDER BY a.cuenta_no
|
||||
|
||||
INITIALIZE cgtb16.* TO NULL
|
||||
FOREACH busca_resumen_estado INTO cgtb16.cuenta_no,cgtb16.descripcion,cgtb16.balance_ant,
|
||||
cgtb16.debito,cgtb16.credito,cgtb16.actividad,
|
||||
cgtb16.balance_act,knivel
|
||||
|
||||
|
||||
OUTPUT TO REPORT analitico(cgtb16.*,fecha1,fecha2,knivel)
|
||||
END FOREACH
|
||||
FINISH REPORT analitico
|
||||
|
||||
END IF
|
||||
END FUNCTION
|
||||
REPORT analitico(x,xfecha1,xfecha2,xnivel)
|
||||
DEFINE x RECORD ano SMALLINT
|
||||
,mes SMALLINT
|
||||
,cuenta_no VARCHAR(14)
|
||||
,estado_a VARCHAR(10)
|
||||
,estado_m VARCHAR(10)
|
||||
,descripcion VARCHAR(50)
|
||||
,debito DEC(12,2)
|
||||
,credito DEC(12,2)
|
||||
,balance_ant DEC(12,2)
|
||||
,actividad DEC(12,2)
|
||||
,balance_act DEC(12,2)
|
||||
,primern VARCHAR(10)
|
||||
END RECORD,
|
||||
z VARCHAR(100),
|
||||
xfecha1,xfecha2 DATE,
|
||||
tbalan_ant,tdebito,tcredito,tactividad,tbalanc_Act DEC(12,2),
|
||||
xnivel SMALLINT,
|
||||
encabezado CHAR(2)
|
||||
|
||||
ORDER BY x.cuenta_no
|
||||
FORMAT
|
||||
FIRST PAGE HEADER
|
||||
LET tbalan_ant = 0
|
||||
LET tdebito = 0
|
||||
LET tcredito = 0
|
||||
LET tactividad = 0
|
||||
LET tbalanc_act = 0
|
||||
SELECT a.nombre INTO z FROM companias a
|
||||
LET encabezado = "SI"
|
||||
PRINTX encabezado
|
||||
ON EVERY ROW
|
||||
IF r_output = 'XLSX' THEN
|
||||
LET encabezado = "NO"
|
||||
END IF
|
||||
LET tbalan_ant = tbalan_ant + x.balance_ant
|
||||
LET tdebito = tdebito + x.debito
|
||||
LET tcredito = tcredito + x.credito
|
||||
LET tactividad = tactividad + x.actividad
|
||||
|
||||
LET x.balance_act = x.balance_ant + x.actividad
|
||||
LET tbalanc_act = tbalanc_act + x.balance_act
|
||||
|
||||
PRINTX x.*,z,xfecha1,xfecha2,tbalan_ant,tdebito,tcredito,tactividad,tbalanc_Act,
|
||||
xnivel
|
||||
|
||||
|
||||
END REPORT
|
||||
Reference in New Issue
Block a user