Add cabecera settings

This commit is contained in:
Enrique Barcelli 2021-12-03 15:57:59 +08:00
parent 578ac2d0ec
commit fa21d1f17a

View file

@ -8,7 +8,8 @@ ventas as (
select division.name as organisation,parent.name as parentorg,ad_orginfo.taxid as ruc,
ad_client.name,documentno,c_invoice.description,dateinvoiced,totallines,grandtotal,qtyinvoiced,priceactual,
linenetamt,c_invoiceline.taxbaseamt,m_product.value,m_product.name,iso_code,
c_bpartner.name,c_bpartner.taxid,c_uom.name as uom,c_doctype.name,c_paymentterm.name as paymentterm,c_paymentterm.netdays,
c_bpartner.name,c_bpartner.taxid,c_uom.name as uom,c_doctype.name,
c_paymentterm.name as paymentterm,c_paymentterm.netdays,
c_invoice.isactive,c_invoice.issotrx,
c_invoicetax.taxbaseamt,c_invoicetax.taxamt,
taxinvoice.name,
@ -50,6 +51,30 @@ ad_client.name ='BLB'
select
jsonb_build_object(
'cabecera', json_agg(DISTINCT
jsonb_build_object(
'tipoOperacion','0101',
'fecEmision',date(dateinvoiced),
'horEmision',dateinvoiced::time,
'codLocalEmisor','0001',
'tipDocUsuario','6',
'numDocUsuario',ruc,
'rznSocialUsuario',parentorg,
'tipMoneda',iso_code,
'sumTotTributos','18.00',
'sumTotValVenta','100.00',
'sumPrecioVenta','118.00',
'sumDescTotal','0.00',
'sumOtrosCargos','0.00',
'sumTotalAnticipos','0.00',
'sumImpVenta','118.00',
'ublVersionId','2.1',
'customizationId','2.0'
)
)
)
||
jsonb_build_object(
'encabezado', jsonb_agg(
jsonb_build_object(