Add rest of json structure

This commit is contained in:
Enrique Barcelli 2021-12-03 19:19:07 +08:00
parent c825f52bcb
commit 9759d2e9bd

View file

@ -139,30 +139,63 @@ select
)
)
)
||
jsonb_build_object(
'encabezado', jsonb_agg(
'adicionalDetalle',''
)
||
jsonb_build_object(
'tributos', jsonb_agg(DISTINCT
jsonb_build_object(
'factura',ventas.documentno,
'terminopago',ventas.paymentterm,
'organizacion',ventas.organisation,
'parent',ventas.parentorg
'invoiceid',c_invoice_id,
'ideTributo','1000',
'nomTributo','IGV',
'codTipTributo','VAT',
'mtoBaseImponible','100.00',
'mtoTributo','18.00'
)
)
)
||
jsonb_build_object(
'lineas', jsonb_agg(
'leyendas', jsonb_build_object(
'codLeyenda','1000',
'desLeyenda','CIENTO DIECIOCHO SOLES'
)
)
||
jsonb_build_object(
'relacionados',''
)
||
jsonb_build_object(
'variablesGlobales',''
)
||
jsonb_build_object(
'datoPago', jsonb_build_object(
'formaPago','Credito',
'mtoNetoPendientePago','118.00',
'tipMonedaMtoNetoPendientePago','PEN'
)
)
||
jsonb_build_object(
'detallePago', jsonb_agg(DISTINCT
jsonb_build_object(
'dias',ventas.netdays,
'unidad',ventas.uom
'mtoCuotaPago','100.00',
'fecCuotaPago','2021-11-30',
'tipMonedaCuotaPago','PEN'
)
)
)
||
jsonb_build_object(
'manual','creado a mano'
'retencion', jsonb_build_object(
'impOperacion','118.00',
'porRetencion','0.00',
'impRetencion','0.00'
)
)
from ventas;