primer commit subida
This commit is contained in:
@@ -0,0 +1,168 @@
|
||||
{
|
||||
PROGRAMA: ipautorizareq
|
||||
OBJETIVO: Mostrar al usuario las requisiciones autorizadas
|
||||
FECHA : Mayo 9, 2022
|
||||
}
|
||||
|
||||
GLOBALS "ipprgb000.4gl"
|
||||
DEFINE r INT,
|
||||
arr_busqueda1 DYNAMIC ARRAY OF RECORD
|
||||
procesar VARCHAR(3),
|
||||
estado VARCHAR(20),
|
||||
num_oc INT,
|
||||
tipo_documento VARCHAR(100),
|
||||
numeroid INT,
|
||||
fecha DATE,
|
||||
nombre,observacion1,usuario VARCHAR(100),
|
||||
cod_mov1 INT,
|
||||
us_crea VARCHAR(50),
|
||||
rtipo_cliente,rsec_cliente,bodega,bodega_destino INT
|
||||
|
||||
END RECORD,
|
||||
nombreusuario,email VARCHAR(100)
|
||||
|
||||
|
||||
|
||||
FUNCTION ipautorizadas()
|
||||
DEFINE data RECORD
|
||||
rnumeroDoc,rcodMov,rtipo_cliente,num_oc,tipo_cliente,sec_cliente,bodega,bodega_destino INT,
|
||||
nombre VARCHAR(100)
|
||||
END RECORD
|
||||
|
||||
# CALL buscadataReq()
|
||||
IF r = 1 THEN
|
||||
RETURN data.*
|
||||
END IF
|
||||
OPEN WINDOW w1 WITH FORM "ipautorizareq"
|
||||
DISPLAY ARRAY arr_busqueda1 TO sbusqueda.*
|
||||
BEFORE DISPLAY
|
||||
DISPLAY 'REQUISICIONES TRANSACCIONES AUTORIZADAS' TO etiqueta
|
||||
ON ACTION imprimir ATTRIBUTE(TEXT="Imprimir", IMAGE="printer")
|
||||
CALL buscadoc(arr_busqueda1[arr_curr()].numeroid,arr_busqueda1[arr_curr()].cod_mov1)
|
||||
LET data.rnumeroDoc = arr_busqueda1[arr_curr()].numeroid
|
||||
LET data.rcodMov = arr_busqueda1[arr_curr()].cod_mov1
|
||||
LET data.rtipo_cliente = arr_busqueda1[arr_curr()].rtipo_cliente
|
||||
LET data.sec_cliente =arr_busqueda1[arr_curr()].rsec_cliente
|
||||
LET data.nombre =arr_busqueda1[arr_curr()].nombre
|
||||
LET data.num_oc =arr_busqueda1[arr_curr()].num_oc
|
||||
LET data.bodega = arr_busqueda1[arr_curr()].bodega
|
||||
LET data.bodega_destino = arr_busqueda1[arr_curr()].bodega_destino
|
||||
CALL impdocumento()
|
||||
AFTER DISPLAY
|
||||
IF int_flag THEN
|
||||
LET int_flag = FALSE
|
||||
EXIT DISPLAY
|
||||
END IF
|
||||
LET data.rnumeroDoc = arr_busqueda1[arr_curr()].numeroid
|
||||
LET data.rcodMov = arr_busqueda1[arr_curr()].cod_mov1
|
||||
LET data.rtipo_cliente = arr_busqueda1[arr_curr()].rtipo_cliente
|
||||
LET data.sec_cliente =arr_busqueda1[arr_curr()].rsec_cliente
|
||||
LET data.nombre =arr_busqueda1[arr_curr()].nombre
|
||||
LET data.num_oc =arr_busqueda1[arr_curr()].num_oc
|
||||
LET data.bodega = arr_busqueda1[arr_curr()].bodega
|
||||
LET data.bodega_destino = arr_busqueda1[arr_curr()].bodega_destino
|
||||
EXIT DISPLAY
|
||||
END DISPLAY
|
||||
CLOSE WINDOW w1
|
||||
RETURN data.*
|
||||
END FUNCTION
|
||||
{FUNCTION buscadataReq()
|
||||
DECLARE buscar CURSOR FOR
|
||||
SELECT ' ', b.estado,b.num_oc,CAST(a.cod_mov AS VARCHAR(10))||' '||a.descrip_mov,b.numero_doc,b.fecha,c.nombre,
|
||||
b.observacion,' ',b.cod_mov,b.us_crea,b.tipo_cliente,b.sec_cliente,b.bodega,b.bodega_destino
|
||||
FROM iptb00005 a,iptb00057 b LEFT OUTER JOIN vetb00004 c ON c.tipo_cliente = b.tipo_cliente AND
|
||||
c.sec_cliente = b.sec_cliente
|
||||
WHERE a.cod_mov = b.cod_mov AND
|
||||
b.estado = 'AUTORIZADA' AND
|
||||
b.numero_doc NOT IN (SELECT DISTINCT c.numero_doc FROM iptb00006 c WHERE c.cod_mov = a.cod_mov AND
|
||||
c.numero_doc = b.numero_doc AND c.status_t IS NULL) AND
|
||||
b.status_t IS NULL
|
||||
|
||||
|
||||
|
||||
LET r = 1
|
||||
FOREACH buscar INTO arr_busqueda1[r].*
|
||||
CALL usuarioSistema(arr_busqueda1[r].us_crea) RETURNING nombreUsuario,email
|
||||
LET arr_busqueda1[r].usuario = nombreUsuario
|
||||
LET r = r + 1
|
||||
END FOREACH
|
||||
|
||||
END FUNCTION}
|
||||
|
||||
FUNCTION buscadoc(numid,codmov)
|
||||
DEFINE numid,codmov INT
|
||||
|
||||
SELECT a.numero_Doc,a.cod_mov,a.fecha,a.num_oc,a.tipo_cliente,a.sec_cliente,a.nombre,a.bodega,a.bodega_destino,a.estado
|
||||
INTO p_iptb57.numero_doc,p_iptb57.cod_mov,p_iptb57.fecha,p_iptb57.num_oc,p_iptb57.tipo_cliente,p_iptb57.sec_cliente,
|
||||
p_iptb57.cliente,p_iptb57.bodega,p_iptb57.bodega_destino,p_iptb57.estado
|
||||
FROM iptb00057 a WHERE a.numero_doc = numid AND a.cod_mov = codmov
|
||||
|
||||
DECLARE buscardetalle CURSOR FOR
|
||||
SELECT a.area,a.cod_n,a.cod_grupo,a.cod_tipo,a.cod_sec,a.descripcion,a.unidad_med,
|
||||
a.cantidad_1,a.cantidad_2,b.factor_conv
|
||||
FROM iptb00058 a,iptb00001 b
|
||||
WHERE a.numero_Doc = numid AND a.cod_mov = codmov 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
|
||||
|
||||
LET idx = 1
|
||||
CALL arr_iptb58.clear()
|
||||
|
||||
FOREACH buscardetalle INTO arr_iptb58[idx].area,
|
||||
arr_iptb58[idx].cod_n,
|
||||
arr_iptb58[idx].cod_grupo,
|
||||
arr_iptb58[idx].cod_tipo,
|
||||
arr_iptb58[idx].cod_sec,
|
||||
arr_iptb58[idx].descripcion,
|
||||
arr_iptb58[idx].unidad_med,
|
||||
arr_iptb58[idx].cantidad_1,
|
||||
arr_iptb58[idx].cantidad,
|
||||
arr_iptb58[idx].factor_conv
|
||||
LET idx = idx + 1
|
||||
END FOREACH
|
||||
END FUNCTION
|
||||
FUNCTION impdocumento()
|
||||
DEFINE idx_l INT
|
||||
LET r_filename = "ipprmt020.4rp"
|
||||
iF fgl_report_loadCurrentSettings(r_filename) THEN -- load the .4rp file
|
||||
|
||||
LET r_output="PDF"
|
||||
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
|
||||
RETURN
|
||||
END IF
|
||||
START REPORT requiere TO XML HANDLER HANDLER
|
||||
FOR idx_l = 1 TO arr_iptb58.getLength()
|
||||
IF arr_iptb58[idx_l].cantidad IS NOT NULL THEN
|
||||
OUTPUT TO REPORT requiere(arr_iptb58[idx_l].*)
|
||||
END IF
|
||||
END FOR
|
||||
FINISH REPORT requiere
|
||||
END FUNCTION
|
||||
|
||||
REPORT requiere(detalle)
|
||||
DEFINE hora STRING,
|
||||
detalle RECORD
|
||||
area INT,
|
||||
cod_n,cod_grupo,cod_tipo,cod_sec INT,
|
||||
descripcion VARCHAR(100),
|
||||
unidad_med VARCHAR(4),
|
||||
cantidad_1,cantidad,cantidad_o1,cantidad1,factor_conv DEC(12,5)
|
||||
END RECORD
|
||||
|
||||
FORMAT
|
||||
PAGE HEADER
|
||||
SELECT a.nombre INTO p_companias.nombre FROM companias a
|
||||
SELECT a.descripcion INTO nombreBodega FROM intb00009 a WHERE a.cod_bodega = p_iptb57.bodega
|
||||
SELECT a.descripcion INTO nombreBodegaDestino FROM intb00009 a WHERE a.cod_bodega = p_iptb57.bodega_destino
|
||||
SELECT a.descrip_mov INTO nombreMov FROM iptb00005 a WHERE a.cod_mov = p_iptb57.cod_mov
|
||||
LET hora = CURRENT
|
||||
|
||||
|
||||
ON EVERY ROW
|
||||
PRINTX detalle.*,p_companias.nombre,hora,p_iptb57.*,nombreMov,nombreBodega,nombreBodegaDestino,nombreUsuario
|
||||
END REPORT
|
||||
Reference in New Issue
Block a user