Files
MBS/WEBSERVICES/cotizaciones_display.4gl

156 lines
4.9 KiB
Plaintext

IMPORT util
FUNCTION cotizaciones_display()
DEFINE i INT
DEFINE o RECORD
cotizacion_master RECORD
cod_cia INT ,
ventas SMALLINT ,
cotizacion_no INT ,
tipo_cliente INT ,
sec_cliente INT ,
nombre_cliente char(60) ,
rnc char(11) ,
nombre_proyecto char(60) ,
direccion_cliente char(80) ,
cod_provincia SMALLINT ,
direccion_proyecto varchar(170) ,
telefono_r char(20) ,
telefono_o char(20) ,
email char(100) ,
tipo_precio INT ,
beeper char(20) ,
celular char(20) ,
prima DEC(12, 2) ,
fax1 char(20) ,
celular1 char(20) ,
fax char(20) ,
fecha DATE ,
fecha_entrega DATE ,
plazo_entrega char(60) ,
comentario char(60) ,
contacto char(60) ,
cond_pago SMALLINT ,
sec_vend SMALLINT ,
porc_itbi DEC(8, 2) ,
total_bruto DEC(12, 2) ,
sub_total DEC(12, 2) ,
monto_desc DEC(12, 2) ,
monto_itbi DEC(12, 2) ,
total_neto DEC(12, 2) ,
monto_dolar DEC(12, 2)
END RECORD,
cotizacion_detalle DYNAMIC ARRAY OF RECORD
cod_cia INT ,
ventas char(1) ,
cotizacion_no int,
area smallint ,
cod_n smallint,
cod_grupo smallint ,
cod_tipo smallint ,
cod_sec smallint ,
descripcion varchar(80) ,
cantidad_1 decimal(12, 5) ,
cantidad decimal(12, 5) ,
precio decimal(12, 4) ,
porc_desc decimal(8, 2) ,
nombre_file char(50) ,
foto_producto varchar(200) ,
descripcion_area varchar(50) ,
id_kit INT ,
cantidad_reservada decimal(18, 2) ,
fecha_vence_reserva date
END RECORD
END RECORD
DEFINE cotizacion_master RECORD
cod_cia INT ,
ventas SMALLINT ,
cotizacion_no INT ,
tipo_cliente INT ,
sec_cliente INT ,
nombre_cliente char(60) ,
rnc char(11) ,
nombre_proyecto char(60) ,
direccion_cliente char(80) ,
cod_provincia SMALLINT ,
direccion_proyecto varchar(170) ,
telefono_r char(20) ,
telefono_o char(20) ,
email char(100) ,
tipo_precio INT ,
beeper char(20) ,
celular char(20) ,
prima DEC(12, 2) ,
fax1 char(20) ,
celular1 char(20) ,
fax char(20) ,
fecha DATE ,
fecha_entrega DATE ,
plazo_entrega char(60) ,
comentario char(60) ,
contacto char(60) ,
cond_pago SMALLINT ,
sec_vend SMALLINT ,
porc_itbi DEC(8, 2) ,
total_bruto DEC(12, 2) ,
sub_total DEC(12, 2) ,
monto_desc DEC(12, 2) ,
monto_itbi DEC(12, 2) ,
total_neto DEC(12, 2) ,
monto_dolar DEC(12, 2)
END RECORD,
cotizacion_detalle RECORD
cod_cia INT ,
ventas char(1) ,
cotizacion_no int,
area smallint ,
cod_n smallint,
cod_grupo smallint ,
cod_tipo smallint ,
cod_sec smallint ,
descripcion varchar(80) ,
cantidad_1 decimal(12, 5) ,
cantidad decimal(12, 5) ,
precio decimal(12, 4) ,
porc_desc decimal(8, 2) ,
nombre_file char(50) ,
foto_producto varchar(200) ,
descripcion_area varchar(50) ,
id_kit INT ,
cantidad_reservada decimal(18, 2) ,
fecha_vence_reserva date
END RECORD
BEGIN WORK
DECLARE u27 CURSOR FOR
SELECT a.cod_cia,a.ventas,a.cotizacion_no,a.tipo_cliente,a.sec_cliente ,a.nombre_cliente,a.rnc,
a.nombre_proyecto,a.direccion_cliente,a.cod_provincia,a.direccion_proyecto,
a.telefono_r,a.telefono_o,a.email,a.tipo_precio,a.beeper,a.celular,a.prima,
a.fax1,a.celular1,a.fax,a.fecha,a.fecha_entrega,a.plazo_entrega,a.comentario,a.contacto,
a.cond_pago,a.sec_vend,a.porc_itbi,a.total_bruto,a.sub_total,a.monto_desc,a.monto_itbi,
a.total_neto,a.monto_dolar,
b.cod_cia,b.ventas,b.cotizacion_no,b.area,b.cod_n,b.cod_grupo,b.cod_tipo ,b.cod_sec,
b.descripcion ,b.cantidad_1,b.cantidad ,b.precio ,b.porc_desc ,b.nombre_file ,
b.foto_producto,b.descripcion_area ,b.id_kit ,b.cantidad_reservada ,b.fecha_vence_reserva
INTO cotizacion_master.*,cotizacion_detalle.*
FROM vetb00050 a ,vetb00051 b
WHERE a.cotizacion_no = b.cotizacion_no AND a.fecha > '01/01/2015' AND a.status_t IS NULL
LET i=0
FOREACH u27
LET i=i+1
LET o.cotizacion_master.*=cotizacion_master.*
LET o.cotizacion_detalle[i].*=cotizacion_detalle.*
END FOREACH
FREE u27
COMMIT WORK
RETURN util.JSON.stringify(o)
END FUNCTION