Files
MBS/PROYECTO/tedirbk/teprrp012.4gl
T

420 lines
13 KiB
Plaintext

{
==============================================================================
PROGRAMA : TEPRRP012
SISTEMA : Sistema de Tesoreria
Objetivo : Panoramico de Cash Flow Estimado
PROGRAMADOR : Tadeo A. Ferreras
FECHA : Diciembre 08, 1995
==============================================================================
}
GLOBALS
"teprgb000.4gl"
DEFINE datos_12 RECORD
codigo INTEGER,
descripcion CHAR(30),
tipo CHAR(2),
mes INTEGER,
fecha1 DATE,
fecha2 DATE,
monto DECIMAL(12,4)
END RECORD
DEFINE fecha_inicial,fecha_final DATE
DEFINE d,i,c,ano,mes_1,mes_2 INTEGER
DEFINE tasa DECIMAL(12,4)
DEFINE balance,balance1 INTEGER
DEFINE total_ig ARRAY[12] OF DECIMAL(12,4)
DEFINE total_ig1 ARRAY[12] OF DECIMAL(12,4)
DEFINE total_di ARRAY[12] OF DECIMAL(12,4)
DEFINE total_di1 ARRAY[12] OF DECIMAL(12,4)
DEFINE total_dl ARRAY[12] OF DECIMAL(12,4)
DEFINE total_dl1 ARRAY[12] OF DECIMAL(12,4)
DEFINE balan ARRAY[12] OF DECIMAL(12,4)
DEFINE balan1 ARRAY[12] OF DECIMAL(12,4)
FUNCTION teprrp012()
LET int_flag = FALSE
OPTIONS
FORM LINE 8
OPEN FORM tefmrp012 FROM "tefmrp012"
DISPLAY FORM tefmrp012
DISPLAY "teprrp012" AT 4,3 ATTRIBUTE(RED)
DISPLAY "Panoramico de Cash Flow Estimado" AT 6,24 ATTRIBUTE(BLACK)
LET tipo_papel = 2
CALL msgrp000(tipo_papel)
CALL defecto(impresor) RETURNING imprime,letras.*,archivo
LET mes_1 = 1
INPUT BY NAME ano,mes_2,tasa
ON KEY(CONTROL-P)
CALL busca_printer() RETURNING imprime,letras.*,archivo
AFTER FIELD ano
IF ano IS NULL THEN
LET numero_msg = 16
CALL msg(numero_msg)
NEXT FIELD ano
END IF
AFTER FIELD mes_2
IF mes_2 IS NULL THEN
LET numero_msg = 16
CALL msg(numero_msg)
NEXT FIELD mes_2
END IF
IF mes_1 > mes_2 THEN
LET numero_msg = 51
CALL msg(numero_msg)
NEXT FIELD mes_1
END IF
IF mes_2 - mes_1 > 11 THEN
LET numero_msg = 75
CALL msg(numero_msg)
NEXT FIELD mes_2
END IF
AFTER FIELD tasa
IF tasa IS NULL THEN
LET numero_msg = 16
CALL msg(numero_msg)
NEXT FIELD tasa
END IF
END INPUT
LET parametro = "D"
CALL elijeimpresion(parametro) RETURNING orden,destino,letras.*
IF int_flag THEN
LET numero_msg = 2
CALL msg(numero_msg)
LET int_flag = FALSE
RETURN
END IF
SELECT a.valor1/1000,a.valor/1000 INTO balance,balance1 FROM tetb00007 a
WHERE a.ano = ano - 1
IF balance IS NULL THEN
LET balance = 0
END IF
IF balance1 IS NULL THEN
LET balance1 = 0
END IF
FOR idx = 1 TO 12
LET total_ig[idx] = 0
LET total_di[idx] = 0
LET total_dl[idx] = 0
END FOR
LET selec =
"SELECT UNIQUE a.codigo,a.descripcion,a.tipo,c.mes,b.fecha_inicio, ",
" b.fecha_corte,c.valor/1000 ",
"FROM tetb00003 a,prdtable b,tetb00004 c ",
"WHERE a.codigo = c.codigo AND ",
" b.ano = c.ano AND ",
" b.mes = c.mes AND ",
" a.status_t IS NULL AND ",
" b.ano = ? ",
"ORDER BY 1,2"
DISPLAY "<<<Buscando Informacion... Espere por Favor>>>" AT 19,14
ATTRIBUTE(BLUE)
PREPARE comando FROM selec
DECLARE busco CURSOR FOR comando
OPEN busco USING ano
START REPORT reporte_12 TO archivo
DISPLAY "<<<Reporte Generandose... Espere por Favor>>>" AT 19,14
ATTRIBUTE(YELLOW)
WHILE status != NOTFOUND
FETCH busco INTO datos_12.*
IF STATUS = NOTFOUND THEN
EXIT WHILE
END IF
IF int_flag THEN
LET numero_msg = 2
CALL msg(numero_msg)
LET int_flag = FALSE
RETURN
END IF
DISPLAY datos_12.tipo AT 21,30
IF datos_12.monto IS NULL THEN
LET datos_12.monto = 0
END IF
IF datos_12.tipo = "DI" THEN
LET datos_12.monto = datos_12.monto * tasa
END IF
DISPLAY datos_12.monto AT 21,35
OUTPUT TO REPORT reporte_12(datos_12.*)
END WHILE
FINISH REPORT reporte_12
#RUN imprime
CALL fdestino(destino,archivo,imprime)
CLEAR SCREEN
END FUNCTION
REPORT reporte_12(x)
DEFINE x RECORD
codigo INTEGER,
descripcion CHAR(30),
tipo CHAR(2),
mes INTEGER,
fecha1 DATE,
fecha2 DATE,
monto DECIMAL(12,4)
END RECORD
## DEFINICION DE LAS VARIABLES DE IMPRESION
DEFINE numero_ch CHAR(9),
descripcion CHAR(30),
detalle1,detalle2 CHAR(40)
DEFINE hora CHAR(5)
DEFINE nombre1 ARRAY[12] OF CHAR(10)
OUTPUT
## DEFINICION DE LOS MARGENES DE IMPRESION
TOP MARGIN 0
LEFT MARGIN 0
BOTTOM MARGIN 3
FORMAT
PAGE HEADER
LET hora = time
LET nombre1[1] = " ENERO "
LET nombre1[2] = " FEBRERO "
LET nombre1[3] = " MARZO "
LET nombre1[4] = " ABRIL "
LET nombre1[5] = " MAYO "
LET nombre1[6] = " JUNIO "
LET nombre1[7] = " JULIO "
LET nombre1[8] = " AGOSTO "
LET nombre1[9] = "SEPTIEMBRE"
LET nombre1[10] = " OCTUBRE "
LET nombre1[11] = "NOVIEMBRE "
LET nombre1[12] = "DICIEMBRE "
## AQUI SE INDICA LA IMPRESION DE LOS ENCABEZADOS
LET c = 39
FOR i = mes_1 TO mes_2
LET c = c + 10
END FOR
LET d = (c-46)/2
PRINT COLUMN 1, letras.negrillas_on,letras.comp_on
PRINT COLUMN 1, "teprrp012",
COLUMN d, "R A Y . O . V A C D O M I N I C A N A, S. A.",
COLUMN c-7, "Pag. ",pageno using "###"
PRINT COLUMN d, " Sistema de Tesoreria",
COLUMN c-7, today using "dd/mm/yyyy"
PRINT COLUMN d, " Panoramico de Cash Flow Estimado",
COLUMN c-4, hora
PRINT COLUMN d, " Expresados Em Miles (1000) "
SKIP 1 LINE
PRINT COLUMN 1, "FECHA: De ",nombre1[mes_1]," A ",nombre1[mes_2],
" Del ", ano USING "&&&&"
PRINT COLUMN 1, "--------------------------------------";
LET c = 39
FOR i = mes_1 TO mes_2
PRINT COLUMN c, "----------";
LET c = c + 10
END FOR
PRINT COLUMN c," "
PRINT COLUMN 1, "Partida";
LET c = 39
FOR i = mes_1 TO mes_2
PRINT COLUMN c, nombre1[i];
LET c = c + 10
END FOR
PRINT COLUMN c," "
PRINT COLUMN 1, "--------------------------------------";
LET c = 39
FOR i = mes_1 TO mes_2
PRINT COLUMN c, "----------";
LET c = c + 10
END FOR
PRINT COLUMN c," "
PRINT letras.negrillas_off
BEFORE GROUP OF x.codigo
IF x.codigo = 1 THEN
PRINT COLUMN 1,letras.negrillas_on,"INGRESOS",letras.negrillas_off
PRINT COLUMN 1,letras.negrillas_on,"========",letras.negrillas_off
SKIP 1 LINE
END IF
IF x.codigo = 5 THEN
PRINT COLUMN 1,letras.negrillas_on,"DESEMBOLSOS",letras.negrillas_off
PRINT COLUMN 1,letras.negrillas_on,"===========",letras.negrillas_off
PRINT COLUMN 1,letras.negrillas_on,"DESEMBOLSOS INTERNACIONALES (",
"TASA UTILIZADA RD$",tasa USING "<<<,<<<.<<",")",
letras.negrillas_off
SKIP 1 LINE
END IF
IF x.codigo = 14 THEN
PRINT COLUMN 1,letras.negrillas_on,"DESEMBOLSOS LOCALES",
letras.negrillas_off
SKIP 1 LINE
END IF
PRINT COLUMN 1, x.codigo USING "###"," ",x.descripcion CLIPPED;
LET c = 39
## AQUI SE INDICA LA IMPRESION DEL DETALLE
ON EVERY ROW
LET idx = x.mes
IF x.mes >= mes_1 AND x.mes <= mes_2 THEN
PRINT COLUMN c, x.monto USING "#,###,###","|";
LET c = c + 10
END IF
IF x.tipo = "IG" THEN
LET total_ig[idx] = total_ig[idx] + x.monto
END IF
IF x.tipo = "DI" THEN
LET total_di[idx] = total_di[idx] + x.monto
END IF
IF x.tipo = "DL" THEN
LET total_dl[idx] = total_dl[idx] + x.monto
END IF
AFTER GROUP OF x.codigo
PRINT " "
IF x.codigo = 4 THEN
LET c = 39
FOR i = mes_1 TO mes_2
PRINT COLUMN c, "---------","|";
LET c = c + 10
END FOR
PRINT COLUMN c," "
PRINT COLUMN 5, "TOTAL INGRESOS";
LET c = 39
FOR i = mes_1 TO mes_2
PRINT COLUMN c, total_ig[i] USING "#,###,###","|";
LET c = c + 10
END FOR
PRINT COLUMN c," "
END IF
IF x.codigo = 13 THEN
LET c = 39
FOR i = mes_1 TO mes_2
PRINT COLUMN c, "---------"," ";
LET c = c + 10
END FOR
PRINT COLUMN c," "
PRINT COLUMN 5, "TOTAL DESEMBOLSOS INTERN.";
LET c = 39
FOR i = mes_1 TO mes_2
PRINT COLUMN c, total_di[i] USING "#,###,###","|";
LET c = c + 10
END FOR
PRINT COLUMN c," "
END IF
IF x.codigo = 25 THEN
LET c = 39
FOR i = mes_1 TO mes_2
PRINT COLUMN c, "---------","|";
LET c = c + 10
END FOR
PRINT COLUMN c," "
PRINT COLUMN 5, "TOTAL DESEMBOLSOS LOCALES";
LET c = 39
FOR i = mes_1 TO mes_2
PRINT COLUMN c, total_dl[i] USING "#,###,###","|";
LET c = c + 10
END FOR
PRINT COLUMN c," "
LET c = 39
FOR i = mes_1 TO mes_2
PRINT COLUMN c, "---------","|";
LET c = c + 10
END FOR
PRINT COLUMN c," "
PRINT COLUMN 5, "TOTAL DESEMBOLSOS ";
LET c = 39
FOR i = mes_1 TO mes_2
PRINT COLUMN c, total_di[i]+total_dl[i]
USING "#,###,###","|";
LET c = c + 10
END FOR
PRINT COLUMN c," "
LET c = 39
FOR i = mes_1 TO mes_2
PRINT COLUMN c, "---------","|";
LET c = c + 10
END FOR
PRINT COLUMN c," "
PRINT COLUMN 5, "FLUJO OPERATIVO";
LET c = 39
FOR i = 1 TO mes_2
IF i >= mes_1 and I <= mes_2 THEN
PRINT COLUMN c, total_ig[i] + total_di[i]+ total_dl[i]
USING "-,---,---","|";
LET c = c + 10
END IF
IF i = 1 THEN
LET balan[i] = balance
ELSE
LET balan[i] =total_ig[i-1]+total_di[i-1]+total_dl[i-1]+
balan[i-1]
END IF
IF balan[i] IS NULL THEN
LET balan[i] = 0
END IF
END FOR
PRINT COLUMN c," "
PRINT COLUMN 5, "BALANCE INICIAL";
LET c = 39
FOR i = mes_1 TO mes_2
PRINT COLUMN c, balan[i] USING "-,---,---","|";
LET c = c + 10
END FOR
PRINT COLUMN c," "
LET c = 39
FOR i = mes_1 TO mes_2
PRINT COLUMN c, "---------","|";
LET c = c + 10
END FOR
PRINT COLUMN c," "
PRINT COLUMN 5, "BALANCE FINAL";
LET c = 39
FOR i = mes_1 TO mes_2
PRINT COLUMN c, total_ig[i] + total_di[i]+ total_dl[i]+
balan[i] USING "-,---,---","|";
END FOR
PRINT COLUMN c," "
END IF
ON LAST ROW
LET c = 39
PRINT letras.negrillas_off
PRINT letras.comp_off,letras.negrillas_off
END REPORT