From fa21d1f17ac9d4931afca51d60ad83a3c57552bf Mon Sep 17 00:00:00 2001 From: Enrique Barcelli Date: Fri, 3 Dec 2021 15:57:59 +0800 Subject: [PATCH] Add cabecera settings --- .../openbravo/kikobar/intfactsunat/query.sql | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/org/openbravo/kikobar/intfactsunat/query.sql b/src/org/openbravo/kikobar/intfactsunat/query.sql index 8d1dcd8..eec0ce8 100644 --- a/src/org/openbravo/kikobar/intfactsunat/query.sql +++ b/src/org/openbravo/kikobar/intfactsunat/query.sql @@ -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(