BigDecimal specific refactoring

Use BigDecimal.stripTrailingZeros() as key for getVATPercentMap and in consequence use compareTo... == 0 instead of equals
Use BigDecimal.ZERO instead of new BigDecimal(0)
These changes result in improvements in enumeration of the <ram:SpecifiedTradeAllowanceCharge> tags and the calculation of tag <ram:SpecifiedTradeSettlementHeaderMonetarySummation>.
This commit is contained in:
Sebastian Sieber
2020-11-16 13:16:35 +01:00
parent 71379627c6
commit 1387d09044
8 changed files with 26 additions and 26 deletions

View File

@@ -514,7 +514,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
if ((trans.getZFCharges() != null) && (trans.getZFCharges().length > 0)) {
for (BigDecimal currentTaxPercent : VATPercentAmountMap.keySet()) {
if (!calc.getChargesForPercent(currentTaxPercent).equals(new BigDecimal(0))) {
if (calc.getChargesForPercent(currentTaxPercent).compareTo(BigDecimal.ZERO)!=0) {
xml = xml + " <ram:SpecifiedTradeAllowanceCharge>\n" +
@@ -537,7 +537,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
if ((trans.getZFAllowances() != null) && (trans.getZFAllowances().length > 0)) {
for (BigDecimal currentTaxPercent : VATPercentAmountMap.keySet()) {
if (!calc.getAllowancesForPercent(currentTaxPercent).equals(new BigDecimal(0))) {
if (calc.getAllowancesForPercent(currentTaxPercent).compareTo(BigDecimal.ZERO)!= 0) {
xml = xml + " <ram:SpecifiedTradeAllowanceCharge>\n" +
" <ram:ChargeIndicator>\n" +
" <udt:Indicator>false</udt:Indicator>\n" +