Change numeric fields to text to match Facturador Sunat json format

This commit is contained in:
Enrique Barcelli 2021-12-04 21:12:16 +08:00
parent 81f3f6d5d8
commit 92b1d1e890

View file

@ -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'
)