Files
MBS/PROYECTO/lqdir/lqprrp005.4gl
T

302 lines
10 KiB
Plaintext

{
==============================================================================
PROGRAMA : LQPRRP005
SISTEMA : Sistema de Liquidacion Materiales
Objetivo : Reportar los costos y los datos de los meses que se han
cerrado contablemente. Este programa lee de la tabla:
cttb00032 (Liquidacion Mensual).
PROGRAMADOR : Juan F. Soto
FECHA : Diciembre 9, 1994.
==============================================================================
}
GLOBALS
"lqprgb000.4gl"
###### Variables para busqueda de rango de fecha
DEFINE elije,imp,afecta CHAR(1)
DEFINE m_mes,mes SMALLINT
DEFINE chequea_ent,p_ano CHAR(4)
DEFINE detalla CHAR(30)
DEFINE no_entrada CHAR(14)
DEFINE p_fecha,fecha1, fecha2 DATE
DEFINE entra CHAR(14)
DEFINE entra1 CHAR(5)
DEFINE t_costst,p_fob,valor,mano_obra,sueldo_ind,monto_banco,
interes,val_64 DECIMAL(12,2)
DEFINE orden CHAR(10)
DEFINE t_variacion DECIMAL(12,2)
###### Variables que la almacenan la informacion enviada al reporte
DEFINE diario1 RECORD
cuenta_no SMALLINT,
debito DECIMAL(10,2)
END RECORD
DEFINE i SMALLINT
DEFINE fecha_inicial,fecha_final DATE
DEFINE tasa DECIMAL(8,2)
DEFINE primera,imp_entrada CHAR(1)
FUNCTION lqprrp005()
DEFINE busca_datos RECORD LIKE cttb00032.*
LET int_flag = FALSE
OPTIONS
FORM LINE 8
OPEN FORM lqfmrp005 FROM "lqfmrp005"
DISPLAY FORM lqfmrp005
DISPLAY "lqprrp005" AT 4,3
DISPLAY "Liquidacion Mensual" AT 6,28
LET tipo_papel = 2
CALL msgrp000(tipo_papel)
INPUT BY NAME p_ano,m_mes,elije,imp_entrada,imp
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 m_mes
IF m_mes is null THEN
LET numero_msg = 16
CALL msg(numero_msg)
NEXT FIELD m_mes
END IF
SELECT a.fecha_inicio,a.fecha_corte INTO fecha_inicial,fecha_final
FROM prdtable a
WHERE a.mes = m_mes and a.ano = p_ano
DISPLAY BY NAME fecha_inicial,fecha_final ATTRIBUTE(BOLD)
END INPUT
IF int_flag THEN
LET numero_msg = 2
CALL msg(numero_msg)
LET int_flag = FALSE
RETURN
END IF
LET primera = "S"
START REPORT cierre TO "C:\\archivo"
DISPLAY "<<<Reporte Generandose... Espere por Favor>>>" AT 19,14
ATTRIBUTE(YELLOW)
DECLARE busca CURSOR FOR
SELECT * FROM cttb00032
WHERE @tipo_lq = elije and
@mes = m_mes and
@ano = p_ano
FOREACH busca INTO busca_datos.*
IF int_flag THEN
LET numero_msg = 2
CALL msg(numero_msg)
LET int_flag = FALSE
RETURN
END IF
OUTPUT TO REPORT cierre(busca_datos.*)
END FOREACH
FINISH REPORT cierre
CLEAR SCREEN
RUN "type C:\\archivo > %USPRINT%" END FUNCTION
REPORT cierre(x)
DEFINE x RECORD LIKE cttb00032.*
DEFINE valor DECIMAL(12,2)
DEFINE n_reg SMALLINT
DEFINE fecha1,fecha2 DATE
DEFINE variacion,precio_std,fob,c_f,seguro,cost_pl,
t_fob,t_flete,t_seguro,t_cf,t_impcol,t_impaduana,t_dollar,
t_costopl,t_recibida,t_precio,o_variacion,total_cf,o_impaduana,
o_impcolect,o_dollar,o_cf
DECIMAL(12,2)
DEFINE t_costo, costo_unit DECIMAL(12,4)
DEFINE balan_act DECIMAL(12,2)
DEFINE descrip1 CHAR(30)
DEFINE p_cuenta CHAR(8)
DEFINE unidad CHAR(4)
DEFINE otras_cta CHAR(8)
## DEFINICION DE LAS VARIABLES DE IMPRESION
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 CHAR(2)
DEFINE normal CHAR(2)
DEFINE hora CHAR(5)
OUTPUT
## DEFINICION DE LOS MARGENES DE IMPRESION
TOP MARGIN 0
LEFT MARGIN 0
BOTTOM MARGIN 3
FORMAT
PAGE HEADER
LET doble_on = ASCII 001
LET doble_off = ASCII 002
LET negrillas_on = ASCII 027, ASCII 098
LET negrillas_off = ASCII 027, ASCII 099
LET comp_on = ASCII 31
LET comp_off = ASCII 29
LET doce = ASCII 30
LET normal = ASCII 029
LET hora = time
## AQUI SE INDICA LA IMPRESION DE LOS ENCABEZADOS
PRINT COLUMN 1, comp_on,
COLUMN 2, "lqprrp005",
COLUMN 14, negrillas_on,
COLUMN 15, doble_on,
COLUMN 48, "R A Y . O . V A C D O M I N I C A N A, S. A.",
negrillas_off,
doble_off,
COLUMN 140, "Pag. ",pageno using "###"
PRINT COLUMN 95, "Sistema de Contabilidad de Costo",
COLUMN 210, today using "dd/mm/yy"
PRINT COLUMN 93, "Liquidacion Mercancia Materia Prima",
COLUMN 210, hora
PRINT COLUMN 98, "Del ",fecha_inicial USING "dd/mm/yy"," Al ",
fecha_final USING "dd/mm/yy"
PRINT negrillas_on
PRINT COLUMN 1, "---------------------------------------------------",
"---------------------------------------------------",
"-------------------------------",
"-------------------------------",
"-------------------------------",
"-------------------------------"
PRINT COLUMN 128,"GASTO"
PRINT COLUMN 50, "Reporte",
COLUMN 61, "Ordenes",
COLUMN 96, "COSTO &",
COLUMN 115, "IMPUESTO",
COLUMN 128, "ADUANAL",
COLUMN 141, "PRIMA ",
COLUMN 153, "COSTO EN",
COLUMN 166, "UNIDADES",
COLUMN 183, "COSTO",
COLUMN 194, "PRECIO",
COLUMN 206, "COSTO"
PRINT COLUMN 1, "Materiales",
COLUMN 50, "Entrada ",
COLUMN 61, "Compras",
COLUMN 76, "FOB",
COLUMN 83, "FLETE",
COLUMN 96, "FLETE",
COLUMN 104, "SEGURO",
COLUMN 115, "COLECTOR",
COLUMN 128, "Y OTROS",
COLUMN 141, "DOLLAR",
COLUMN 153, "PLANTA",
COLUMN 166, "RECIBIDA",
COLUMN 183, "UNIT.",
COLUMN 195, "STD",
COLUMN 206, "STD",
COLUMN 218, "VARIACION"
PRINT COLUMN 1, "----------------------------------------------------",
"----------------------------------------------------" ,
"-----------------------------",
"-------------------------------",
"-------------------------------",
"-------------------------------"
PRINT negrillas_off
BEFORE GROUP OF x.tipo_lq
LET t_fob = 0
LET t_flete = 0
LET t_cf = 0
LET t_seguro = 0
LET t_impcol = 0
LET t_impaduana = 0
LET t_dollar = 0
LET t_costopl = 0
LET t_costo = 0
LET t_precio = 0
LET t_costst = 0
LET t_variacion = 0
ON EVERY ROW
SELECT descrip_esp,unidad_med INTO descrip1,unidad
FROM intb00001
WHERE cod_n = x.cod_n and
cod_grupo = x.cod_grupo and
cod_tipo = x.cod_tipo and
cod_sec = x.cod_sec
LET variacion = x.cost_planta - x.cost_std
PRINT COLUMN 1, x.cod_n using "&","-",x.cod_grupo using "&","-",
x.cod_tipo using "&&","-",x.cod_sec using "&&&",
COLUMN 12,descrip1,
COLUMN 34,unidad,
COLUMN 38, x.cod_sp using "&&","-",x.cod_sp_sec using "&&&&",
COLUMN 47, x.reporte_ent using "&&&&&&",
COLUMN 60, x.num_oc using "&&&&&","-",x.tipo,
COLUMN 69, x.fob using "###,###.##",
COLUMN 81, x.flete using "#,###.##",
COLUMN 91, x.cost_flete using "###,###.##",
COLUMN 103, x.seguro using "##,###.##",
COLUMN 113, x.impuesto_c using "#,###,###.##",
COLUMN 125, x.gasto_ad using "###,###.##",
COLUMN 137, x.prima_d using "####,###.##",
COLUMN 149, x.cost_planta using "####,###.##",
COLUMN 161, x.unid_rec using "##,###,###.##",
COLUMN 176, x.cost_uni using "##,###.####",
COLUMN 189, x.precio_std using "##,###.####",
COLUMN 202, x.cost_std using "#####,###.##",
COLUMN 214, variacion using "--,---,---.##"
LET t_fob = t_fob + x.fob
LET t_flete = t_flete + x.flete
LET t_cf = t_cf + x.cost_flete
LET t_seguro = t_seguro + x.seguro
LET t_impcol = t_impcol + x.impuesto_c
LET t_impaduana = t_impaduana + x.gasto_ad
LET t_dollar = t_dollar + x.prima_d
LET t_costopl = t_costopl + x.cost_planta
LET t_costo = t_costo + x.cost_uni
LET t_precio = t_precio + x.precio_std
LET t_costst = t_costst + x.cost_std
LET t_variacion = t_variacion + variacion
ON LAST ROW
PRINT COLUMN 1,"------------------------------------------------------",
"------------------------------------------------------",
"------------------------------------------------------",
"------------------------------------------------------",
"----------"
PRINT COLUMN 1, "Totales ----> ",
COLUMN 67,t_fob using "#,###,###.##",
COLUMN 80, t_flete using "##,###.##",
COLUMN 91, t_cf using "###,###.##",
COLUMN 102, t_seguro using "##,###.##",
COLUMN 113, t_impcol using "####,###.##",
COLUMN 124, t_impaduana using "####,###.##",
COLUMN 134, t_dollar using "##,###,###.##",
COLUMN 148, t_costopl using "##,###,###.##",
COLUMN 177, t_costo using "##,###.###",
COLUMN 187, t_precio using "##,###.####",
COLUMN 199, t_costst using "##,###,###.####",
COLUMN 213, t_variacion using "--,---,---.##"
END REPORT