Commit inicial: fuentes MBS ERP (Genero 6) + .gitignore + docs/SETUP_PC_MBS.md
This commit is contained in:
@@ -0,0 +1,278 @@
|
||||
{
|
||||
-------------------------------------------------------------------------------
|
||||
PROGRAMA : IPPRRP002
|
||||
OBJETIVO : CATALOGO DE PRODUCTOS TERMINADOS
|
||||
PROGRAMADOR : JUAN SOTO
|
||||
FECHA REALIZACION : Febrero 1997
|
||||
DIRECTOR PROYECTO : JOSE ALFREDO PAULINO ALEJO
|
||||
-------------------------------------------------------------------------------
|
||||
}
|
||||
GLOBALS "ipprgb000.4gl"
|
||||
|
||||
DEFINE pano SMALLINT,
|
||||
tipo_info CHAR(30),
|
||||
formato VARCHAR(3)
|
||||
|
||||
|
||||
MAIN
|
||||
DEFER INTERRUPT
|
||||
CALL ARG_VAL(1) RETURNING usuarios
|
||||
CALL ARG_VAL(2) RETURNING clave
|
||||
CALL ARG_VAL(3) RETURNING impresor
|
||||
CONNECT to "smarmotech" USER usuarios USING clave
|
||||
SELECT * INTO p_companias.* FROM companias
|
||||
CALL ipprrp002()
|
||||
END MAIN
|
||||
|
||||
FUNCTION ipprrp002()
|
||||
|
||||
DEFINE producto RECORD
|
||||
cod_cia SMALLINT,
|
||||
cod_n LIKE iptb00002.cod_n,
|
||||
cod_grupo LIKE iptb00002.cod_grupo,
|
||||
cod_tipo LIKE iptb00002.cod_tipo,
|
||||
cod_sec LIKE iptb00002.cod_sec,
|
||||
descrip_esp LIKE iptb00002.descrip_esp,
|
||||
unidad_med LIKE iptb00002.unidad_med,
|
||||
existencia,factor,precio,costo,cantidad_o DEC(12,4)
|
||||
END RECORD,
|
||||
codigo CHAR(4),
|
||||
codigo_n smallint,
|
||||
nombre_imp CHAR(11),
|
||||
cantidad_ordenes,pcantidadConduce,transito,pexistencia,reservado DEC(12,4)
|
||||
|
||||
|
||||
OPTIONS
|
||||
FORM LINE 8,
|
||||
ERROR LINE 23,
|
||||
COMMENT LINE 21
|
||||
|
||||
CLEAR SCREEN
|
||||
|
||||
OPEN FORM ipfmrp002 FROM "ipfmrp002_1"
|
||||
DISPLAY FORM ipfmrp002
|
||||
DISPLAY "ipprrp002" AT 4,3
|
||||
DISPLAY "Catalogo Productos " AT 6,33
|
||||
|
||||
|
||||
INPUT BY NAME pano,tipo_info,formato
|
||||
BEFORE INPUT
|
||||
CALL cano()
|
||||
LET pano = YEAR(TODAY)
|
||||
DISPLAY BY NAME pano
|
||||
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
|
||||
LET nombre_ant = "E"
|
||||
CONSTRUCT criterio ON a.cod_cia,a.cod_n,a.cod_grupo,a.cod_tipo,a.cod_sec
|
||||
FROM cod_cia, cod_n,cod_grupo,cod_tipo,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_cia,a.cod_n,a.cod_grupo,a.cod_tipo,a.cod_sec,a.descrip_esp, ",
|
||||
" a.unidad_med,SUM(b.cantidad_2),c.factor_conv,d.precio FROM iptb00002 a
|
||||
LEFT OUTER JOIN vetb00025 d ON a.cod_n = d.cod_n AND a.cod_grupo = d.cod_grupo AND a.cod_tipo = d.cod_tipo AND a.cod_sec = d.cod_sec
|
||||
AND d.cod_lista in (1) AND d.ventas = '1'
|
||||
|
||||
,iptb00006 b,iptb00001 c ",
|
||||
"WHERE a.status_t is NULL AND ",
|
||||
" 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 ",criterio CLIPPED,
|
||||
" 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 b.status_t is null ",
|
||||
" GROUP BY a.cod_cia,a.cod_n,a.cod_grupo,a.cod_tipo,a.cod_sec,a.descrip_esp,a.unidad_med,c.factor_conv,d.precio ",
|
||||
" ORDER BY a.cod_cia,a.cod_n,a.cod_grupo,a.cod_tipo,a.cod_sec,a.descrip_esp"
|
||||
|
||||
|
||||
--run the report
|
||||
-- configure report engine; the functions prefixed fgl that are called here are part of the GRW API
|
||||
LET r_filename = "ipprrp002_1.4rp"
|
||||
iF fgl_report_loadCurrentSettings(r_filename) THEN -- load the .4rp file
|
||||
LET r_output=formato
|
||||
LET preview=1
|
||||
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
|
||||
|
||||
#LET handler= fgl_report_createProcessLevelDataFile("datos.xml")
|
||||
|
||||
--run the report
|
||||
IF handler IS NOT NULL THEN -- report engine was configured ok
|
||||
|
||||
START REPORT catalogo TO XML HANDLER handler
|
||||
|
||||
PREPARE busca FROM selec
|
||||
|
||||
CALL integridad()
|
||||
IF bandera = 1 THEN
|
||||
LET bandera = 0
|
||||
RETURN
|
||||
END IF
|
||||
|
||||
IF int_flag THEN
|
||||
LET numero_msg = 2
|
||||
CALL msg(numero_msg)
|
||||
LET int_flag = FALSE
|
||||
RETURN
|
||||
END IF
|
||||
|
||||
DECLARE accion CURSOR FOR busca
|
||||
LET progreso = 20
|
||||
DISPLAY Progreso TO progreso
|
||||
CALL ui.interface.refresh()
|
||||
FOREACH accion INTO producto.*
|
||||
#BUSCA CANTIDAD ORDEN PEDIDOS
|
||||
LET producto.cantidad_o =0
|
||||
IF tipo_info = "CON EXISTENCIA" AND producto.existencia <=0 THEN
|
||||
CONTINUE FOREACH
|
||||
END IF
|
||||
|
||||
CALL disponibles(producto.cod_n,producto.cod_grupo,producto.cod_tipo,producto.cod_sec,today) RETURNING
|
||||
cantidad_ordenes,pcantidadConduce,transito,pexistencia,reservado,valorOrden
|
||||
|
||||
|
||||
LET producto.cantidad_o = cantidad_ordenes - pcantidadConduce
|
||||
OUTPUT TO REPORT catalogo(producto.*)
|
||||
|
||||
LET progreso = progreso + 10
|
||||
IF progreso > 90 THEN LET progreso = 90
|
||||
DISPLAY Progreso TO progreso
|
||||
CALL ui.interface.refresh()
|
||||
ELSE
|
||||
DISPLAY Progreso TO progreso
|
||||
CALL ui.interface.refresh()
|
||||
END IF
|
||||
|
||||
END FOREACH
|
||||
LET progreso = 100
|
||||
DISPLAY Progreso TO progreso
|
||||
CALL ui.interface.refresh()
|
||||
FINISH REPORT catalogo
|
||||
END IF
|
||||
|
||||
END FUNCTION
|
||||
|
||||
REPORT catalogo(x)
|
||||
DEFINE x RECORD
|
||||
cod_cia SMALLINT,
|
||||
cod_n LIKE iptb00002.cod_n,
|
||||
cod_grupo LIKE iptb00002.cod_grupo,
|
||||
cod_tipo LIKE iptb00002.cod_tipo,
|
||||
cod_sec LIKE iptb00002.cod_sec,
|
||||
descrip_esp LIKE iptb00002.descrip_esp,
|
||||
unidad_med LIKE iptb00002.unidad_med,
|
||||
existencia,factor,precio,costo,cantidad_o DEC(12,4)
|
||||
|
||||
END RECORD,
|
||||
fecha_venta CHAR(10),
|
||||
ttipo DEC(12,3),
|
||||
material,labor,gastos,pvalor dec(12,5)
|
||||
|
||||
DEFINE pgrupo,pproducto CHAR(30),
|
||||
hora CHAR(5),
|
||||
prec_rd,prec_local_usd,prec_exp_usd,prec_euro DECIMAL(12,2),
|
||||
cuenta_grupo SMALLINT,
|
||||
cuenta_total INT,
|
||||
pcodigo CHAR(25),
|
||||
fecha DATE
|
||||
|
||||
ORDER BY x.cod_n,x.cod_grupo,x.cod_tipo
|
||||
|
||||
FORMAT
|
||||
FIRST PAGE HEADER
|
||||
LET hora = time
|
||||
LET cuenta_grupo = 0
|
||||
LET cuenta_total = 0
|
||||
LET fecha = today
|
||||
LET ttipo = 0
|
||||
|
||||
|
||||
BEFORE GROUP OF x.cod_n
|
||||
INITIALIZE p_iptb20.* TO NULL
|
||||
SELECT a.* INTO p_iptb20.* FROM iptb00020 a
|
||||
WHERE a.cod_n = x.cod_n
|
||||
|
||||
IF p_iptb20.producto IS NULL THEN
|
||||
LET p_iptb20.producto = "SIN DESCRIPCION"
|
||||
END IF
|
||||
|
||||
BEFORE GROUP OF x.cod_tipo
|
||||
LET ttipo = 0
|
||||
|
||||
ON EVERY ROW
|
||||
LET ttipo = ttipo + x.existencia
|
||||
|
||||
LET prec_rd = 0
|
||||
LET prec_local_usd = 0
|
||||
LET prec_exp_usd =0
|
||||
LET prec_euro = 0
|
||||
LET material = 0
|
||||
LET labor = 0
|
||||
LET gastos = 0
|
||||
|
||||
SELECT a.material+a.labor+a.gastos
|
||||
INTO x.costo FROM iptb00004 a
|
||||
WHERE a.cod_n = x.cod_n AND
|
||||
a.cod_grupo = x.cod_grupo AND
|
||||
a.cod_tipo = x.cod_tipo AND
|
||||
a.cod_sec = x.cod_Sec AND
|
||||
a.ano = pano AND a.mes_fin = '12'
|
||||
|
||||
LET pcodigo = x.cod_n USING "&&&&","-",
|
||||
x.cod_grupo USING "&&&&","-",
|
||||
x.cod_tipo USING "&&&&","-",
|
||||
x.cod_sec USING "&&&&&&"
|
||||
LET pproducto = 'NO TIENE'
|
||||
|
||||
SELECT a.descripcion INTO pproducto FROM iptb00024 a
|
||||
WHERE a.cod_tipo = x.cod_tipo
|
||||
|
||||
LET pgrupo = 'NO TIENE'
|
||||
SELECT a.descripcion INTO pgrupo FROM iptb00029 a
|
||||
WHERE a.cod_grupo = x.cod_grupo
|
||||
|
||||
LET cuenta_grupo = cuenta_grupo +1
|
||||
LET cuenta_total = cuenta_total + 1
|
||||
LET pvalor = (material + labor + gastos) * x.existencia
|
||||
PRINTX x.*,p_companias.*,p_iptb20.producto,hora,
|
||||
prec_rd,prec_local_usd,prec_exp_usd,prec_euro,
|
||||
cuenta_total,cuenta_grupo,pcodigo,pproducto,
|
||||
fecha,tipo_info,pgrupo,fecha_venta,ttipo,
|
||||
material,labor,gastos,pvalor,pano
|
||||
END REPORT
|
||||
|
||||
FUNCTION cano()
|
||||
|
||||
DEFINE ketiquetas SMALLINT, detiquetas CHAR(30),
|
||||
cbcategoria ui.ComboBox,
|
||||
cb2 CHAR(2)
|
||||
|
||||
LET cbcategoria = ui.combobox.forname("formonly.pano")
|
||||
DECLARE bcategoria CURSOR FOR
|
||||
SELECT DISTINCT a.ano,a.ano FROM iptb00004 a
|
||||
WHERE a.status_t IS NULL
|
||||
ORDER BY a.ano DESC
|
||||
CALL cbcategoria.clear()
|
||||
|
||||
FOREACH bcategoria INTO ketiquetas,detiquetas
|
||||
CALL cbcategoria.additem(ketiquetas,detiquetas)
|
||||
END FOREACH
|
||||
|
||||
END FUNCTION
|
||||
Reference in New Issue
Block a user