Sum the individual tax amounts to the total tax amount to avoid following error:

[BR-CO-14]-Invoice total VAT amount (BT-110) = ? VAT category tax amount (BT-117)
This commit is contained in:
Sebastian Sieber
2020-12-08 14:36:06 +01:00
parent dcf7f82b01
commit d97007d60f

View File

@@ -24,6 +24,7 @@ import java.io.IOException;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
@@ -612,7 +613,10 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
// //
// currencyID=\"EUR\"
+ " <ram:TaxTotalAmount currencyID=\"" + trans.getCurrency() + "\">"
+ currencyFormat(calc.getGrandTotal().subtract(calc.getTaxBasis())) + "</ram:TaxTotalAmount>\n"
+ currencyFormat(VATPercentAmountMap.values().stream()
.map(VATAmount::getCalculated)
.map(p -> p.setScale(2, RoundingMode.HALF_UP))
.reduce(BigDecimal.ZERO, BigDecimal::add)) + "</ram:TaxTotalAmount>\n"
+ " <ram:GrandTotalAmount>" + currencyFormat(calc.getGrandTotal()) + "</ram:GrandTotalAmount>\n" //$NON-NLS-2$
// //
// currencyID=\"EUR\"