186 lines
7.4 KiB
Plaintext
186 lines
7.4 KiB
Plaintext
|
|
FUNCTION transacciones()
|
|
DEFINE pfecha DATE,
|
|
tipoInventario VARCHAR(30),criterio,selec STRING,
|
|
i,ybodega SMALLINT
|
|
DEFINE data RECORD
|
|
idtrx int,
|
|
fecha_trx date,
|
|
bodega SMALLINT ,
|
|
descrip_bodega VARCHAR(30),
|
|
cod_seccion smallint ,
|
|
cod_tramo smallint ,
|
|
cod_n smallint ,
|
|
cod_grupo smallint ,
|
|
cod_tipo smallint ,
|
|
cod_sec SMALLINT ,
|
|
descripcion VARCHAR(80),
|
|
cantidad float
|
|
END RECORD
|
|
|
|
|
|
OPEN WINDOW w1 WITH FORM "trx"
|
|
|
|
INPUT BY NAME pfecha,tipoInventario
|
|
BEFORE INPUT
|
|
LET pfecha = today
|
|
AFTER INPUT
|
|
IF int_flag THEN
|
|
LET int_flag = FALSE
|
|
CALL fgl_winmessage("INFO","OPERACION CANCELADA","INFO")
|
|
CLOSE WINDOW w1
|
|
RETURN
|
|
END IF
|
|
IF tipoInventario IS NULL THEN
|
|
CALL fgl_winmessage("INFO","TIPO INVENTARIO EN BLANCO","INFO")
|
|
NEXT FIELD tipoInventario
|
|
END IF
|
|
END INPUT
|
|
IF tipoInventario = "PRODUCTOS TERMINADOS" THEN
|
|
LET selec ="SELECT a.idtrx,a.fecha,a.bodega,b.descripcion,a.cod_seccion,
|
|
a.cod_tramo,
|
|
a.cod_n,a.cod_Grupo,a.cod_tipo,a.cod_sec,c.descrip_esp,a.cantidad
|
|
FROM iptb00012 a,bodegas b,productos c
|
|
WHERE a.codid = c.codid and a.bodega = b.cod_bodega ",
|
|
" ORDER BY a.bodega"
|
|
|
|
END IF
|
|
IF tipoInventario = "REPUESTOS" THEN
|
|
IF pfecha IS NULL THEN
|
|
LET selec ="SELECT a.idtrx,a.fecha,a.bodega,b.descripcion,a.cod_seccion,
|
|
a.cod_tramo,
|
|
a.cod_n,a.cod_Grupo,a.cod_tipo,a.cod_sec,c.descrip_esp,a.cantidad
|
|
FROM irtb00012 a,bodegas b,productos c
|
|
WHERE a.codid = c.codid and a.bodega = b.cod_bodega ",
|
|
|
|
" ORDER BY a.bodega"
|
|
ELSE
|
|
LET selec ="SELECT a.idtrx,a.fecha,a.bodega,b.descripcion,a.cod_seccion,
|
|
a.cod_tramo,
|
|
a.cod_n,a.cod_Grupo,a.cod_tipo,a.cod_sec,c.descrip_esp,a.cantidad
|
|
FROM irtb00012 a,bodegas b,productos c
|
|
WHERE a.codid = c.codid and a.bodega = b.cod_bodega and a.fecha = '",
|
|
pfecha USING "dd/mm/yyyy",
|
|
"' ",
|
|
" ORDER BY a.bodega"
|
|
|
|
END IF
|
|
END IF
|
|
IF tipoInventario = "MATERIA PRIMA" THEN
|
|
IF pfecha IS NULL THEN
|
|
LET selec ="SELECT a.idtrx,a.fecha,a.bodega,b.descripcion,a.cod_seccion,
|
|
a.cod_tramo,
|
|
a.cod_n,a.cod_Grupo,a.cod_tipo,a.cod_sec,c.descrip_esp,a.cantidad
|
|
FROM intb00012 a,bodegas b,productos c
|
|
WHERE a.codid = c.codid and a.bodega = b.cod_bodega ",
|
|
|
|
" ORDER BY a.bodega"
|
|
ELSE
|
|
LET selec ="SELECT a.idtrx,a.fecha,a.bodega,b.descripcion,a.cod_seccion,
|
|
a.cod_tramo,
|
|
a.cod_n,a.cod_Grupo,a.cod_tipo,a.cod_sec,c.descrip_esp,a.cantidad
|
|
FROM intb00012 a,bodegas b,productos c
|
|
WHERE a.codid = c.codid and a.bodega = b.cod_bodega and a.fecha = '",
|
|
pfecha USING "dd/mm/yyyy",
|
|
"' ",
|
|
" ORDER BY a.bodega"
|
|
|
|
END IF
|
|
|
|
END IF
|
|
|
|
PREPARE comando FROM selec
|
|
DECLARE busca_trx CURSOR FOR comando
|
|
OPEN busca_trx
|
|
|
|
START REPORT trx TO "archivo.html"
|
|
LET i = 1
|
|
FOREACH busca_trx INTO data.*
|
|
IF pfecha IS NOT NULL THEN
|
|
IF data.fecha_trx = pfecha THEN
|
|
LET ybodega = data.bodega
|
|
|
|
OUTPUT TO REPORT trx(pfecha,tipoInventario,ybodega,data.*)
|
|
LET i = i +1
|
|
ELSE
|
|
OUTPUT TO REPORT trx(pfecha,tipoInventario,ybodega,data.*)
|
|
LET i = i +1
|
|
END IF
|
|
END IF
|
|
END FOREACH
|
|
FINISH REPORT trx
|
|
IF i > 1 THEN
|
|
CALL ver_archivo("archivo.html")
|
|
ELSE
|
|
CALL fgl_Winmessage("INFO","NO EXISTEN REGISTROS CON ESTA CONDICION","INFO")
|
|
END IF
|
|
|
|
CLOSE WINDOW w1
|
|
END FUNCTION
|
|
REPORT trx(xfecha,xtipo,xbodega,x)
|
|
DEFINE xfecha DATE,
|
|
xtipo VARCHAR(30),
|
|
xbodega SMALLINT
|
|
|
|
DEFINE x RECORD
|
|
idtrx int,
|
|
fecha_trx DATE,
|
|
bodega SMALLINT ,
|
|
descrip_bodega VARCHAR(30),
|
|
cod_seccion smallint ,
|
|
cod_tramo smallint ,
|
|
cod_n smallint ,
|
|
cod_grupo smallint ,
|
|
cod_tipo smallint ,
|
|
cod_sec SMALLINT ,
|
|
descripcion VARCHAR(80),
|
|
cantidad float
|
|
END RECORD
|
|
|
|
|
|
ORDER BY xbodega
|
|
FORMAT
|
|
PAGE HEADER
|
|
PRINT COLUMN 1,
|
|
"<!DOCTYPE html>
|
|
<html lang='en'>
|
|
<head>
|
|
<meta charset='UTF-8'>
|
|
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
|
|
<meta http-equiv='X-UA-Compatible' content='ie=edge'>
|
|
<title>Reporte</title>
|
|
</head>
|
|
<body>
|
|
<div style='width: 307.2px; height: 364.8px; font-size: 12px; padding: 5px; font-weight: bold;'>
|
|
<p style='margin: 2px;font-size: 12px'>MARMOTECH S.A</p>
|
|
<p style='margin: 2px;'>TIPO INV:<span>",xtipo,"</span></p>
|
|
<p style='margin: 2px;'><span>",xfecha,"</span></p>
|
|
<span>**************************************************</span>
|
|
<p style='float:left; width: 60%;'>PRODUCTO</p><p>CANTIDAD</p>
|
|
<span>**************************************************</span>",
|
|
"<table>"
|
|
BEFORE GROUP OF xbodega
|
|
PRINT "<tbody><tr><td>",
|
|
"<p style = 'font-size: 10px; float:left; width: 80%;'>",x.fecha_trx,"-",x.descrip_bodega,
|
|
"</p></td><</tr>"
|
|
|
|
|
|
ON EVERY ROW
|
|
PRINT
|
|
"<tr><td><p style = 'font-size: 10px; float:left; width: 80%;'>",x.idtrx USING "<<<",
|
|
"-",x.cod_n USING "&&&","-",x.cod_grupo USING "&&&&",
|
|
"-",x.cod_tipo USING "&&&&","-",x.cod_sec USING "&&&&&&",
|
|
" ",x.descripcion,"</p>",
|
|
"<p style = 'font-size: 10px;''>",x.cantidad USING "#,###.#####","</p>",
|
|
"</td></tr>"
|
|
|
|
ON LAST ROW
|
|
PRINT "<tr><td>----------------------------</td></tr>"
|
|
PRINT "<tr><td>TOTAL REGISTROS:",COUNT(*) USING "<,<<<","</td></tr>"
|
|
PRINT "</table></tbody></div>
|
|
</body>
|
|
</html>"
|
|
|
|
END REPORT
|
|
|