88 lines
3.5 KiB
Plaintext
88 lines
3.5 KiB
Plaintext
{-------------------------------------------------------------------------------
|
|
PROGRAMA : VEPRRP056
|
|
OBJETIVO : Analisis Despachos Ordenes
|
|
PROGRAMADOR : Ing. Juan Soto
|
|
FECHA REALIZACION : Septiembre 08,2021
|
|
-------------------------------------------------------------------------------}
|
|
|
|
SCHEMA "smarmotech"
|
|
GLOBALS "veprgb000.4gl"
|
|
DEFINE pano INT,
|
|
pordenes RECORD LIKE vwvaloresordenes.*
|
|
MAIN
|
|
DEFER INTERRUPT
|
|
CALL ARG_VAL(1) RETURNING usuarios
|
|
CALL ARG_VAL(2) RETURNING clave
|
|
CONNECT TO "smarmotech" USER usuarios USING clave
|
|
|
|
SELECT * INTO p_companias.* FROM companias
|
|
CALL AnalisisOrdenes()
|
|
END MAIN
|
|
|
|
FUNCTION analisisordenes()
|
|
|
|
OPEN WINDOW HOME_FRM WITH FORM 'vefmrp056'
|
|
INPUT BY NAME pano
|
|
AFTER INPUT
|
|
IF int_flag THEN
|
|
LET int_flag = FALSE
|
|
EXIT PROGRAM
|
|
END IF
|
|
END INPUT
|
|
|
|
LET selec = "SELECT * FROM vwvaloresordenes where ano = ? ORDER BY numeromes,operacion "
|
|
PREPARE comando FROM selec
|
|
DECLARE busca CURSOR FOR comando
|
|
|
|
|
|
LET r_filename ="veprrp056.4rp"
|
|
LET idx = 1
|
|
FOREACH busca INTO pordenes.*
|
|
|
|
IF idx = 1 THEN
|
|
IF fgl_report_loadCurrentSettings(r_filename) THEN
|
|
|
|
LET preview=1
|
|
CALL seleccionarsalida() RETURNING r_output -- load the .4rp file
|
|
CALL fgl_report_selectDevice(r_output) -- changing default
|
|
CALL fgl_report_selectPreview(preview) -- changing default
|
|
LET handler = fgl_report_commitCurrentSettings() -- commit changes
|
|
END IF
|
|
LET idx = 2
|
|
|
|
START REPORT ordenes TO XML HANDLER HANDLER
|
|
|
|
END IF
|
|
|
|
OUTPUT TO REPORT ordenes(pordenes.*)
|
|
|
|
END FOREACH
|
|
|
|
IF idx > 1 THEN
|
|
FINISH REPORT ordenes
|
|
ELSE
|
|
CALL fgl_winmessage("INFO","NO EXISTEN REGISTROS","INFO")
|
|
END IF
|
|
|
|
CLOSE WINDOW HOME_FRM
|
|
END FUNCTION
|
|
|
|
REPORT ordenes(x)
|
|
|
|
DEFINE x RECORD LIKE vwvaloresordenes.*,
|
|
autorizadas,ordenescolocadas,Auordenesabiertas,Auordenescerradas,despachadas,cerradas,abiertas DEC(12,2)
|
|
ORDER BY x.operacion,x.mes
|
|
FORMAT
|
|
AFTER GROUP OF x.mes
|
|
LET ordenescolocadas = GROUP SUM(x.valor) WHERE x.operacion = 'COLOCADAS'
|
|
LET abiertas = GROUP SUM(x.valor) WHERE x.operacion = 'ABIERTAS'
|
|
LET cerradas = GROUP SUM(x.valor) WHERE x.operacion = 'CERRADAS'
|
|
LET Auordenesabiertas = GROUP SUM(x.valor) WHERE x.operacion = 'AUTORIZADAS ABIERTAS'
|
|
LET Auordenescerradas = GROUP SUM(x.valor) WHERE x.operacion = 'AUTORIZADAS CERRADAS'
|
|
LET autorizadas =GROUP SUM(x.valor) WHERE x.operacion = 'AUTORIZADAS'
|
|
PRINTX x.operacion,x.mes,x.ano,autorizadas,ordenescolocadas,Auordenesabiertas,
|
|
Auordenescerradas,despachadas,cerradas,abiertas,p_companias.nombre
|
|
|
|
END REPORT
|
|
|