diff --git a/mustang/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporter.java b/mustang/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporter.java index 8d11859d..882e65d1 100644 --- a/mustang/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporter.java +++ b/mustang/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporter.java @@ -12,6 +12,7 @@ package org.mustangproject.ZUGFeRD; import java.io.ByteArrayInputStream; import java.io.IOException; import java.math.BigDecimal; +import java.math.MathContext; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.text.SimpleDateFormat; @@ -343,7 +344,7 @@ public class ZUGFeRDExporter { xml += " \n" //$NON-NLS-1$ + " "+currencyFormat(amount.getCalculated())+"\n" //$NON-NLS-1$ //$NON-NLS-2$ + " VAT\n" //$NON-NLS-1$ - + " "+currencyFormat(amount.getCalculated())+"\n" + + " "+currencyFormat(amount.getBasis())+"\n" + " S\n" //$NON-NLS-1$ + " "+vatFormat(currentTaxPercent)+"\n" //$NON-NLS-1$ + " \n"; //$NON-NLS-1$ @@ -481,8 +482,8 @@ public class ZUGFeRDExporter { for (IZUGFeRDExportableItem currentItem : trans.getZFItems()) { BigDecimal percent=currentItem.getProduct().getVATPercent(); - BigDecimal currentBasis=currentItem.getPriceGross().subtract(currentItem.getPrice()); - VATAmount itemVATAmount=new VATAmount(currentBasis, currentBasis.multiply(percent)) ; + BigDecimal currentBasis=currentItem.getQuantity().multiply(currentItem.getPrice()).setScale(2,BigDecimal.ROUND_HALF_UP );// item total net amount + VATAmount itemVATAmount=new VATAmount(currentBasis, currentItem.getTotalGross().subtract(currentBasis)) ; VATAmount current=hm.get(percent); if (current==null) { hm.put(percent, itemVATAmount);