Skip to content

Commit

Permalink
chore: Qute - refactor multiply function (#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosthe19916 authored Apr 16, 2023
1 parent 39a1f14 commit 15c8e45
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,9 @@ public class EngineProducer {
)
.addValueResolver(ValueResolver.builder()
.applyToBaseClass(BigDecimal.class)
.applyToName("multiply")
.applyToName("multiplyByInt")
.resolveSync(ctx -> ((BigDecimal) ctx.getBase())
.multiply(new BigDecimal((Integer) ctx.getParams().get(0).getLiteral()))
.setScale(2, RoundingMode.HALF_EVEN)
)
.build()
)
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/templates/Renderer/invoice.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<cac:PaymentTerms>
<cbc:ID>Detraccion</cbc:ID>
<cbc:PaymentMeansID>{detraccion.tipoBienDetraido}</cbc:PaymentMeansID>
<cbc:PaymentPercent>{detraccion.porcentaje.multiply(100).scale(2)}</cbc:PaymentPercent>
<cbc:PaymentPercent>{detraccion.porcentaje.multiplyByInt(100).scale(2)}</cbc:PaymentPercent>
<cbc:Amount currencyID="{moneda}">{detraccion.monto.scale(2)}</cbc:Amount>
</cac:PaymentTerms>
{/if}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<cbc:TaxableAmount currencyID="{moneda}">{item.iscBaseImponible.scale(2)}</cbc:TaxableAmount>
<cbc:TaxAmount currencyID="{moneda}">{item.isc.scale(2)}</cbc:TaxAmount>
<cac:TaxCategory>
<cbc:Percent>{item.tasaIsc.multiply(100).scale(2)}</cbc:Percent>
<cbc:Percent>{item.tasaIsc.multiplyByInt(100).scale(2)}</cbc:Percent>
<cbc:TierRange>{item.iscTipo}</cbc:TierRange>
<cac:TaxScheme>
<cbc:ID>2000</cbc:ID>
Expand All @@ -31,7 +31,7 @@
<cbc:TaxAmount currencyID="{moneda}">{item.igv.scale(2)}</cbc:TaxAmount>
<cac:TaxCategory>
<cbc:ID schemeAgencyName="United Nations Economic Commission for Europe" schemeID="UN/ECE 5305" schemeName="Tax Category Identifier">{item.igvTipo.toCatalog7.taxCategory.categoria}</cbc:ID>
<cbc:Percent>{item.tasaIgv.multiply(100)}</cbc:Percent>
<cbc:Percent>{item.tasaIgv.multiplyByInt(100).scale(2)}</cbc:Percent>
<cbc:TaxExemptionReasonCode listAgencyName="PE:SUNAT" listName="Afectacion del IGV" listURI="urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo07">{item.igvTipo.toCatalog7.code}</cbc:TaxExemptionReasonCode>
<cac:TaxScheme>
<cbc:ID schemeAgencyName="PE:SUNAT" schemeID="UN/ECE 5153" schemeName="Codigo de tributos">{item.igvTipo.toCatalog7.taxCategory.code}</cbc:ID>
Expand Down

0 comments on commit 15c8e45

Please sign in to comment.