207 lines
7.6 KiB
Plaintext
207 lines
7.6 KiB
Plaintext
SCHEMA smarmotech
|
|
GLOBALS
|
|
DEFINE xbusca_parcial DYNAMIC ARRAY OF RECORD
|
|
secuencia INT,
|
|
cod_n SMALLINT,
|
|
cod_grupo SMALLINT,
|
|
cod_tipo SMALLINT,
|
|
cod_sec SMALLINT,
|
|
cantidad DEC(12,5),
|
|
fech_emb DATE,
|
|
fech_ent DATE
|
|
END RECORD
|
|
|
|
|
|
END GLOBALS
|
|
FUNCTION orden(xflete1,xarr_ordenes,xordenes,x,x1,xship_to,xmoneda,r_output,knota,zdesc1,zdesc2,zdesc3,zdesc4,zdesc5,
|
|
kdetalle_orden, uso)
|
|
DEFINE zdesc1,zdesc2,zdesc3,zdesc4,zdesc5 CHAR(20),
|
|
codigo_prod VARCHAR(30),
|
|
xorden,xtipo_cliente,xsec_cliente INT,xnombre_cliente VARCHAR(100)
|
|
DEFINE idx SMALLINT,
|
|
xmoneda,kdetalle_orden STRING,
|
|
knota VARCHAR(100)
|
|
DEFINE xflete1 RECORD
|
|
total_b DECIMAL(12,2),
|
|
valor DECIMAL(12,2),
|
|
ot_valor DECIMAL(12,2),
|
|
total_1 DECIMAL(12,2),
|
|
descu_valor DECIMAL(12,2)
|
|
END RECORD
|
|
DEFINE handler om.SaxDocumentHandler, -- return value from fgl_report_commitCurrentSettings()
|
|
r_filename STRING, -- filename of Report Design Document including .4rp extension
|
|
r_output VARCHAR(10), -- output format option
|
|
preview INTEGER,
|
|
xvalor DEC(12,2),
|
|
x RECORD
|
|
nom_sp LIKE cotb00001.nom_sp,
|
|
dir_sp LIKE cotb00001.dir_sp,
|
|
ciu_sp LIKE cotb00001.ciu_sp
|
|
END RECORD,
|
|
x1 RECORD LIKE cotb00018.*,
|
|
xship_to STRING
|
|
|
|
|
|
DEFINE xordenes RECORD
|
|
num_oc INTEGER,
|
|
tipo LIKE cotb00014.tipo,
|
|
fech_oc LIKE cotb00014.fech_oc,
|
|
num_pr LIKE cotb00014.num_pr,
|
|
cod_sp LIKE cotb00014.cod_sp,
|
|
cod_sp_sec LIKE cotb00014.cod_sp_sec,
|
|
term_sp LIKE cotb00014.term_sp,
|
|
via LIKE cotb00014.via,
|
|
enviada LIKE cotb00014.enviada,
|
|
fech_enviada LIKE cotb00014.fech_enviada,
|
|
pago LIKE cotb00014.pago,
|
|
fech_pago LIKE cotb00014.fech_pago,
|
|
cierre LIKE cotb00014.cierre,
|
|
cod_pt CHAR(4),
|
|
bodega INT
|
|
END RECORD
|
|
|
|
DEFINE xarr_ordenes DYNAMIC ARRAY OF RECORD
|
|
num_orden INT,
|
|
num_req LIKE cotb00006.num_req,
|
|
cod_n SMALLINT,
|
|
cod_grupo SMALLINT,
|
|
cod_tipo SMALLINT,
|
|
cod_sec SMALLINT,
|
|
descripcion CHAR(180),
|
|
unidad CHAR(4),
|
|
cantidad DECIMAL(12,3),
|
|
tipo_costo CHAR(10),
|
|
precio DECIMAL(18,5),
|
|
porc_desc DEC(12,2),
|
|
monto_desc DEC(12,2),
|
|
valor DECIMAL(12,2)
|
|
END RECORD, uso STRING
|
|
|
|
IF xarr_ordenes.getLength() > 0 THEN
|
|
LET r_filename ='coprmt009.4rp'
|
|
#LET r_output='SVG'
|
|
LET preview = 1
|
|
|
|
IF fgl_report_loadCurrentSettings(r_filename) THEN -- load the .4rp file
|
|
|
|
CALL fgl_report_selectDevice(r_output) -- changing default
|
|
CALL fgl_report_selectPreview(preview) -- changing default
|
|
# CALL fgl_winmessage("veprrp049",r_output,"stop")
|
|
# CALL fgl_winmessage("veprrp049",preview,"stop")
|
|
|
|
|
|
LET handler = fgl_report_commitCurrentSettings() -- commit changes
|
|
END IF
|
|
--run the report
|
|
IF handler IS NOT NULL THEN -- report engine was configured ok
|
|
|
|
START REPORT r_orden TO XML HANDLER HANDLER
|
|
|
|
FOR idx = 1 TO xarr_ordenes.getLength()
|
|
IF xarr_ordenes[idx].cod_n IS NOT NULL THEN
|
|
LET codigo_prod = xarr_ordenes[idx].cod_n USING "&&&&"+"-"+xarr_ordenes[idx].cod_grupo USING "&&&&"+"-"+
|
|
xarr_ordenes[idx].cod_tipo USING "&&&&"+"-"+xarr_ordenes[idx].cod_sec USING "&&&&"
|
|
OUTPUT TO REPORT r_orden(xflete1.*,xarr_ordenes[idx].*,xordenes.*,x.*,x1.*,xship_to,xmoneda,knota,
|
|
zdesc1,zdesc2,zdesc3,zdesc4,zdesc5,kdetalle_orden,codigo_prod, uso)
|
|
END IF
|
|
END FOR
|
|
|
|
FINISH REPORT r_orden
|
|
END IF
|
|
END IF
|
|
|
|
END FUNCTION
|
|
|
|
|
|
REPORT r_orden(zflete1,karr_ordenes,kordenes,k,k1,kship_to,kmoneda,znota,xdesc1,xdesc2,xdesc3,xdesc4,xdesc5,
|
|
xdetalle_orden,xcodigo_prod, xusos)
|
|
DEFINE xdesc1,xdesc2,xdesc3,xdesc4, xdesc5 CHAR(20),
|
|
xcodigo_prod VARCHAR(30),
|
|
xdetalle_orden VARCHAR(200),
|
|
xusos VARCHAR(200)
|
|
DEFINE kordenes RECORD
|
|
num_oc INTEGER,
|
|
tipo LIKE cotb00014.tipo,
|
|
fech_oc LIKE cotb00014.fech_oc,
|
|
num_pr LIKE cotb00014.num_pr,
|
|
cod_sp LIKE cotb00014.cod_sp,
|
|
cod_sp_sec LIKE cotb00014.cod_sp_sec,
|
|
term_sp LIKE cotb00014.term_sp,
|
|
via LIKE cotb00014.via,
|
|
enviada LIKE cotb00014.enviada,
|
|
fech_enviada LIKE cotb00014.fech_enviada,
|
|
pago LIKE cotb00014.pago,
|
|
fech_pago LIKE cotb00014.fech_pago,
|
|
cierre LIKE cotb00014.cierre,
|
|
cod_pt CHAR(4),
|
|
bodega INT
|
|
END RECORD,
|
|
|
|
kship_to VARCHAR(80),
|
|
i INT,
|
|
k RECORD
|
|
nom_sp LIKE cotb00001.nom_sp,
|
|
dir_sp LIKE cotb00001.dir_sp,
|
|
ciu_sp LIKE cotb00001.ciu_sp
|
|
END RECORD,
|
|
|
|
k1 RECORD LIKE cotb00018.*,
|
|
kmoneda CHAR(30),
|
|
znota VARCHAR(100)
|
|
|
|
DEFINE zflete1 RECORD
|
|
total_b DECIMAL(12,2),
|
|
valor DECIMAL(12,2),
|
|
ot_valor DECIMAL(12,2),
|
|
total_1 DECIMAL(12,2),
|
|
descu_valor DECIMAL(12,2)
|
|
END RECORD,
|
|
tiene_parcial BOOLEAN
|
|
|
|
DEFINE karr_ordenes RECORD
|
|
num_orden INT,
|
|
num_req LIKE cotb00006.num_req,
|
|
cod_n SMALLINT,
|
|
cod_grupo SMALLINT,
|
|
cod_tipo SMALLINT,
|
|
cod_sec SMALLINT,
|
|
descripcion CHAR(180),
|
|
unidad CHAR(4),
|
|
cantidad DECIMAL(12,3),
|
|
tipo_costo CHAR(10),
|
|
precio DECIMAL(18,5),
|
|
porc_desc DEC(12,2),
|
|
monto_desc DEC(12,2),
|
|
valor DECIMAL(12,2)
|
|
END RECORD,
|
|
total_neto,total_bruto,total_itbis DEC(12,2)
|
|
ORDER BY kordenes.num_oc,xcodigo_prod
|
|
|
|
FORMAT
|
|
BEFORE GROUP OF kordenes.num_oc
|
|
LET total_neto=0
|
|
LET total_bruto=0
|
|
LET total_itbis = 0
|
|
|
|
ON EVERY ROW
|
|
#LET total_bruto = total_bruto + (karr_ordenes.cantidad*karr_ordenes.precio)
|
|
#LET total_itbis =zflete1.valor
|
|
#LET total_neto= total_neto + total_bruto+total_itbis
|
|
LET karr_ordenes.valor = karr_ordenes.cantidad * karr_ordenes.precio
|
|
|
|
IF karr_ordenes.monto_desc IS NOT NULL THEN
|
|
LET karr_ordenes.valor = karr_ordenes.valor - karr_ordenes.monto_desc
|
|
END IF
|
|
|
|
PRINTX kordenes.*,karr_ordenes.*,k.*,k1.*,kship_to,kmoneda,zflete1.*,znota,xdesc1,xdesc2,xdesc3,xdesc4,xdesc5,
|
|
xdetalle_orden, xusos
|
|
AFTER GROUP OF xcodigo_prod
|
|
CALL entregas_parciales(kordenes.num_oc,karr_ordenes.num_req,karr_ordenes.cod_n,karr_ordenes.cod_grupo,karr_ordenes.cod_tipo,
|
|
karr_ordenes.cod_sec) RETURNING xbusca_parcial
|
|
|
|
LET tiene_parcial = FALSE
|
|
FOR i=1 TO xbusca_parcial.getLength()
|
|
LET tiene_parcial = TRUE
|
|
PRINTX xcodigo_prod,xbusca_parcial[i].cantidad,xbusca_parcial[i].fech_emb,xbusca_parcial[i].fech_ent
|
|
END FOR
|
|
END REPORT |