primer commit subida
This commit is contained in:
@@ -0,0 +1,223 @@
|
||||
{
|
||||
=============================================================================
|
||||
PROGRAMA : IRPRRP019
|
||||
OBJETIVO : IMPRIMIR EL CONSUMO DE UN REPUESTO EN FORMA PANORAMICA
|
||||
EN UN ANO DETALLANDO TODOS LOS MESES ACUMULADO.
|
||||
PROGRAMADOR : JUAN F. SOTO
|
||||
FECHA : FEBRERO 17, 1994
|
||||
=============================================================================
|
||||
}
|
||||
GLOBALS
|
||||
"irprgb000.4gl"
|
||||
DEFINE fecha1,fecha2,fecha3 DATE
|
||||
DEFINE j,mes_ini,mes_fin SMALLINT
|
||||
DEFINE p_ano CHAR(4)
|
||||
|
||||
MAIN
|
||||
DEFER INTERRUPT
|
||||
SELECT * INTO p_companias.* FROM companias
|
||||
CALL irprrp019()
|
||||
END MAIN
|
||||
|
||||
FUNCTION irprrp019()
|
||||
DEFINE imp_datos RECORD
|
||||
cod_n LIKE intb00001.cod_n,
|
||||
cod_grupo LIKE intb00001.cod_n,
|
||||
cod_tipo LIKE intb00001.cod_n,
|
||||
cod_sec LIKE intb00001.cod_n,
|
||||
descrip LIKE intb00001.descrip_esp,
|
||||
unidad LIKE intb00001.unidad_med,
|
||||
costo LIKE irtb00002.exist_min,
|
||||
existencia LIKE irtb00006.cantidad_2,
|
||||
mes SMALLINT,
|
||||
consumo LIKE irtb00006.cantidad_2,
|
||||
clave CHAR(10)
|
||||
END RECORD
|
||||
OPTIONS
|
||||
ERROR LINE 24,
|
||||
FORM LINE 8
|
||||
OPEN FORM irfmrp019 FROM "irfmrp019"
|
||||
DISPLAY FORM irfmrp019
|
||||
DISPLAY "irprrp019" AT 4,3
|
||||
DISPLAY "Panoramico Consumo" AT 6,30
|
||||
|
||||
CALL pantalla()
|
||||
LET tipo_papel = 2
|
||||
CALL msgrp000(tipo_papel)
|
||||
|
||||
INPUT BY NAME p_ano,mes_ini,mes_fin,fecha3
|
||||
|
||||
BEFORE FIELD fecha3
|
||||
LET fecha3 = today
|
||||
AFTER INPUT
|
||||
IF int_flag THEN
|
||||
LET numero_msg = 2
|
||||
CALL msg(numero_msg)
|
||||
LET int_flag = false
|
||||
RETURN
|
||||
END IF
|
||||
EXIT INPUT
|
||||
END INPUT
|
||||
|
||||
CONSTRUCT BY NAME criterio ON a.cod_n,a.cod_grupo,a.cod_tipo,a.cod_sec
|
||||
|
||||
IF int_flag THEN
|
||||
LET numero_msg = 2
|
||||
CALL msg(numero_msg)
|
||||
LET int_flag = false
|
||||
RETURN
|
||||
END IF
|
||||
|
||||
LET selec =
|
||||
"SELECT a.cod_n,a.cod_grupo,a.cod_tipo,a.cod_sec,b.descrip_esp,",
|
||||
" b.unidad_med,MAX(c.costo_st) ",
|
||||
"FROM intb00001 b,irtb00002 a,OUTER irtb00013 c ",
|
||||
"WHERE (a.cod_n = b.cod_n and a.cod_grupo = b.cod_grupo and ",
|
||||
" a.cod_tipo = b.cod_tipo and a.cod_sec = b.cod_sec) and ",
|
||||
" (a.cod_n = c.cod_n and a.cod_grupo = c.cod_grupo and ",
|
||||
" a.cod_tipo = c.cod_tipo and a.cod_sec = c.cod_sec) and ",
|
||||
criterio clipped," and a.status_t is null AND c.ano = ? AND ",
|
||||
" c.mes_ini <= ? AND c.mes_fin >= ? ",
|
||||
"GROUP BY 1,2,3,4,5,6 ORDER BY 1,2,3,4 "
|
||||
|
||||
PREPARE comando FROM selec
|
||||
DECLARE busca CURSOR FOR comando
|
||||
OPEN busca USING p_ano,mes_fin,mes_fin
|
||||
|
||||
START REPORT irpr19 TO "C:\\archivo"
|
||||
|
||||
WHILE STATUS != NOTFOUND
|
||||
FETCH busca INTO imp_datos.*
|
||||
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
|
||||
|
||||
IF imp_datos.costo IS NULL THEN
|
||||
LET imp_datos.costo = 0
|
||||
END IF
|
||||
|
||||
# Busca Existencia repuestos
|
||||
SELECT SUM(cantidad_2) INTO imp_datos.existencia
|
||||
FROM irtb00006
|
||||
WHERE (cod_n = imp_datos.cod_n and cod_grupo = imp_datos.cod_grupo and
|
||||
cod_tipo = imp_datos.cod_tipo and cod_sec = imp_datos.cod_sec and
|
||||
fecha <= fecha3) and status_t is null
|
||||
|
||||
IF imp_datos.existencia is null THEN
|
||||
LET imp_datos.existencia = 0
|
||||
END IF
|
||||
|
||||
FOR idx = 1 TO mes_fin
|
||||
SELECT fecha_inicio,fecha_corte INTO fecha1,fecha2
|
||||
FROM prdtable WHERE mes = idx and ano = p_ano
|
||||
|
||||
LET imp_datos.consumo = 0
|
||||
SELECT SUM(cantidad_2) INTO imp_datos.consumo
|
||||
FROM irtb00006
|
||||
WHERE (cod_n = imp_datos.cod_n and cod_grupo = imp_datos.cod_grupo and
|
||||
cod_tipo = imp_datos.cod_tipo and cod_sec = imp_datos.cod_sec and
|
||||
fecha between fecha1 and fecha2) and cantidad_2 < 0 and
|
||||
cod_mov IN (21,22,23,24,26,27,40) AND status_t is null
|
||||
|
||||
IF imp_datos.consumo is null THEN
|
||||
LET imp_datos.consumo = 0
|
||||
END IF
|
||||
LET imp_datos.mes = idx
|
||||
LET imp_datos.clave = imp_datos.cod_n using "&","-",
|
||||
imp_datos.cod_grupo using "&","-",
|
||||
imp_datos.cod_tipo using "&&","-",
|
||||
imp_datos.cod_sec using "&&&"
|
||||
|
||||
OUTPUT TO REPORT irpr19(imp_datos.*)
|
||||
END FOR
|
||||
END WHILE
|
||||
FINISH REPORT irpr19
|
||||
RUN "type C:\\archivo > %USPRINT%" END FUNCTION
|
||||
|
||||
REPORT irpr19(x)
|
||||
|
||||
DEFINE x RECORD
|
||||
cod_n LIKE intb00001.cod_n,
|
||||
cod_grupo LIKE intb00001.cod_n,
|
||||
cod_tipo LIKE intb00001.cod_n,
|
||||
cod_sec LIKE intb00001.cod_n,
|
||||
descrip LIKE intb00001.descrip_esp,
|
||||
unidad LIKE intb00001.unidad_med,
|
||||
costo LIKE irtb00002.exist_min,
|
||||
existencia LIKE irtb00006.cantidad_2,
|
||||
mes SMALLINT,
|
||||
consumo LIKE irtb00006.cantidad_2,
|
||||
clave CHAR(10)
|
||||
END RECORD,
|
||||
nomb1,nomb2 CHAR(12),
|
||||
comp_on,comp_of CHAR(3)
|
||||
|
||||
OUTPUT
|
||||
LEFT MARGIN 0
|
||||
|
||||
FORMAT
|
||||
PAGE HEADER
|
||||
LET comp_on = ASCII 031
|
||||
PRINT comp_on
|
||||
PRINT COLUMN 1,"irprrp019",
|
||||
COLUMN 80, "R A Y .O. V A C D O M I N I C A N A, S. A.",
|
||||
COLUMN 207, "PAG. ",pageno using "###"
|
||||
PRINT COLUMN 88, "SISTEMA DE REPUESTOS",
|
||||
COLUMN 207, TODAY USING "DD/MM/yyyy"
|
||||
PRINT COLUMN 87, "PANORAMICO DE CONSUMOS",
|
||||
COLUMN 207, TIME
|
||||
SKIP 1 LINE
|
||||
|
||||
SELECT descrip INTO nomb1 FROM mestable WHERE mes = mes_ini
|
||||
|
||||
SELECT descrip INTO nomb2 FROM mestable WHERE mes = mes_fin
|
||||
|
||||
PRINT "PERIODO: ",nomb1 clipped," - ",nomb2 clipped," DE ",p_ano
|
||||
PRINT "======================================================================",
|
||||
"======================================================================",
|
||||
"======================================================================",
|
||||
"======="
|
||||
|
||||
PRINT COLUMN 57, "EXISTENCIA"
|
||||
|
||||
PRINT COLUMN 1, "REPUESTOS",
|
||||
COLUMN 45, " COSTO",
|
||||
COLUMN 57, fecha3 using "dd/mm/yyyy",
|
||||
COLUMN 71, "ENERO",
|
||||
COLUMN 81, "FEBRERO",
|
||||
COLUMN 96, "MARZO",
|
||||
COLUMN 108, "ABRIL",
|
||||
COLUMN 121, "MAYO",
|
||||
COLUMN 132, "JUNIO",
|
||||
COLUMN 144, "JULIO",
|
||||
COLUMN 155, "AGOSTO",
|
||||
COLUMN 165, "SEPTIEMB.",
|
||||
COLUMN 178, "OCTUBRE",
|
||||
COLUMN 190, "NOVIEMB",
|
||||
COLUMN 201, "DICIEMBRE",
|
||||
COLUMN 213, "TOTAL"
|
||||
|
||||
|
||||
PRINT "======================================================================",
|
||||
"======================================================================",
|
||||
"======================================================================",
|
||||
"======="
|
||||
BEFORE GROUP OF x.clave
|
||||
PRINT COLUMN 1,x.clave," ",x.descrip," ",x.unidad,
|
||||
COLUMN 45, x.costo using "#,###,###.##",
|
||||
COLUMN 58, x.existencia using "##,###.##";
|
||||
LET j = 69
|
||||
|
||||
ON EVERY ROW
|
||||
PRINT COLUMN j, x.consumo using "#,###.##";
|
||||
LET j = j + 12
|
||||
AFTER GROUP OF x.clave
|
||||
PRINT COLUMN 210, GROUP SUM(x.consumo) using "#,###.##"
|
||||
END REPORT
|
||||
|
||||
Reference in New Issue
Block a user