Unify the values of taxes
Concerning ApplicableHeaderTradeSettlement: The amount in ApplicableTradeTax.CalculatedAmount is different from SpecifiedTradeSettlementHeaderMonetarySummation.TaxTotalAmount. To avoid this I removed the rounding from totalAmount.
This commit is contained in:
@@ -31,7 +31,7 @@ public class TransactionCalculator implements IAbsoluteValueProvider {
|
||||
VATAmount amount = VATPercentAmountMap.get(currentTaxPercent);
|
||||
res = res.add(amount.getCalculated());
|
||||
}
|
||||
return res.setScale(2, RoundingMode.HALF_UP);
|
||||
return res;
|
||||
}
|
||||
|
||||
/***
|
||||
|
||||
@@ -6,6 +6,7 @@ import org.w3c.dom.NodeList;
|
||||
|
||||
import javax.xml.xpath.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
@@ -259,7 +260,7 @@ public class ZUGFeRDInvoiceImporter extends ZUGFeRDImporter {
|
||||
}
|
||||
|
||||
TransactionCalculator tc = new TransactionCalculator(zpp);
|
||||
String expectedStringTotalGross = tc.getTotalGross().toPlainString();
|
||||
String expectedStringTotalGross = tc.getTotalGross().setScale(2, RoundingMode.HALF_UP).toPlainString();
|
||||
if (!expectedStringTotalGross.equals(XMLTools.nDigitFormat(expectedGrandTotal, 2))) {
|
||||
throw new ParseException("Could not reproduce the invoice, this could mean that it could not be read properly", 0);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
package org.mustangproject.ZUGFeRD;
|
||||
|
||||
import org.mustangproject.Invoice;
|
||||
import org.mustangproject.XMLTools;
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.runners.MethodSorters;
|
||||
|
||||
@@ -81,7 +82,7 @@ public class ZF2ZInvoiceImporterTest extends TestCase {
|
||||
assertEquals("Stadthausen", invoice.getSender().getLocation());
|
||||
|
||||
TransactionCalculator tc=new TransactionCalculator(invoice);
|
||||
assertEquals(new BigDecimal("571.04"),tc.getTotalGross());
|
||||
assertEquals("571.04", XMLTools.nDigitFormat(tc.getTotalGross(),2));
|
||||
|
||||
|
||||
// name street location zip country, contact name phone email, total amount
|
||||
@@ -102,7 +103,7 @@ public class ZF2ZInvoiceImporterTest extends TestCase {
|
||||
}
|
||||
assertFalse(hasExceptions);
|
||||
TransactionCalculator tc=new TransactionCalculator(invoice);
|
||||
assertEquals(new BigDecimal("18.33"),tc.getTotalGross());
|
||||
assertEquals("18.33", XMLTools.nDigitFormat(tc.getTotalGross(),2));
|
||||
}
|
||||
|
||||
public void testAllowancesChargesImport() {
|
||||
@@ -118,7 +119,7 @@ public class ZF2ZInvoiceImporterTest extends TestCase {
|
||||
}
|
||||
assertFalse(hasExceptions);
|
||||
TransactionCalculator tc=new TransactionCalculator(invoice);
|
||||
assertEquals(new BigDecimal("11.07"),tc.getTotalGross());
|
||||
assertEquals("11.07", XMLTools.nDigitFormat(tc.getTotalGross(),2));
|
||||
|
||||
|
||||
// name street location zip country, contact name phone email, total amount
|
||||
|
||||
Reference in New Issue
Block a user