From 92b1d1e890922882ccc7abcfe386e934d373fcd7 Mon Sep 17 00:00:00 2001 From: Enrique Barcelli Date: Sat, 4 Dec 2021 21:12:16 +0800 Subject: [PATCH] Change numeric fields to text to match Facturador Sunat json format --- .../openbravo/kikobar/intfactsunat/query.sql | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/org/openbravo/kikobar/intfactsunat/query.sql b/src/org/openbravo/kikobar/intfactsunat/query.sql index c3d117e..5eeb7dd 100644 --- a/src/org/openbravo/kikobar/intfactsunat/query.sql +++ b/src/org/openbravo/kikobar/intfactsunat/query.sql @@ -70,16 +70,16 @@ select 'horEmision',dateinvoiced::time, 'codLocalEmisor','0001', 'tipDocUsuario','6', - 'numDocUsuario',ruc, - 'rznSocialUsuario',parentorg, + 'numDocUsuario',taxid, + 'rznSocialUsuario',bpname, 'tipMoneda',iso_code, - 'sumTotTributos',grandtotal-totallines, - 'sumTotValVenta',totallines, - 'sumPrecioVenta',grandtotal, + 'sumTotTributos',(grandtotal-totallines)::varchar, + 'sumTotValVenta',totallines::varchar, + 'sumPrecioVenta',grandtotal::varchar, 'sumDescTotal','0.00', 'sumOtrosCargos','0.00', 'sumTotalAnticipos','0.00', - 'sumImpVenta',grandtotal, + 'sumImpVenta',grandtotal::varchar, 'ublVersionId','2.1', 'customizationId','2.0' ) @@ -105,16 +105,16 @@ select jsonb_build_object( 'invoiceline',c_invoiceline_id, 'codUnidadMedida','BX', - 'ctdUnidadItem',qtyinvoiced, + 'ctdUnidadItem',qtyinvoiced::varchar, 'codProducto',productcode, 'codProductoSUNAT','50161813', 'desItem',productname, - 'mtoValorUnitario',priceactual, - 'sumTotTributosItem',linetaxtaxamt, + 'mtoValorUnitario',priceactual::varchar, + 'sumTotTributosItem',linetaxtaxamt::varchar, 'codTriIGV','1000', - 'mtoIgvItem',linetaxtaxamt, - 'mtoBaseIgvItem',linetaxbaseamt, + 'mtoIgvItem',linetaxtaxamt::varchar, + 'mtoBaseIgvItem',linetaxbaseamt::varchar, 'nomTributoIgvItem','IGV', 'codTipTributoIgvItem','VAT', 'tipAfeIGV','10', @@ -142,8 +142,8 @@ select 'codTipTributoIcbperItem','OTH', 'mtoTriIcbperUnidad','0.30', - 'mtoPrecioVentaUnitario',round((linenetamt+linetaxtaxamt)/qtyinvoiced,2), - 'mtoValorVentaItem',linenetamt, + 'mtoPrecioVentaUnitario',round((linenetamt+linetaxtaxamt)/qtyinvoiced,2)::varchar, + 'mtoValorVentaItem',linenetamt::varchar, 'mtoValorReferencialUnitario','0.00' ) ) @@ -159,8 +159,8 @@ select 'ideTributo','1000', 'nomTributo','IGV', 'codTipTributo','VAT', - 'mtoBaseImponible',invoicetaxbaseamt, - 'mtoTributo',invoicetaxtaxamt + 'mtoBaseImponible',invoicetaxbaseamt::varchar, + 'mtoTributo',invoicetaxtaxamt::varchar ) ) ) @@ -186,7 +186,7 @@ select 'datoPago', jsonb_agg(DISTINCT jsonb_build_object( 'formaPago','Credito', - 'mtoNetoPendientePago',grandtotal, + 'mtoNetoPendientePago',grandtotal::varchar, 'tipMonedaMtoNetoPendientePago',iso_code ) ) @@ -196,7 +196,7 @@ select 'detallePago', jsonb_agg(DISTINCT jsonb_build_object( 'cuotaid',fin_payment_schedule_id, - 'mtoCuotaPago',cuota, + 'mtoCuotaPago',cuota::varchar, 'fecCuotaPago',duedate::date, 'tipMonedaCuotaPago',iso_code ) @@ -206,7 +206,7 @@ select jsonb_build_object( 'retencion', jsonb_agg(DISTINCT jsonb_build_object( - 'impOperacion',grandtotal, + 'impOperacion',grandtotal::varchar, 'porRetencion','0.00', 'impRetencion','0.00' )