closes #172, fixes zero rated products, added some lines to the test of the XRechnung, have the XRechnung test actually wriote to file and have the XR test file validated automatically

This commit is contained in:
jstaerk
2020-11-17 11:49:20 +01:00
parent 8d48e992f8
commit 48dc209f94
7 changed files with 52 additions and 18 deletions

View File

@@ -26,8 +26,6 @@ package org.mustangproject.ZUGFeRD;
* @author jstaerk
* */
import org.mustangproject.ZUGFeRD.model.TaxCategoryCodeTypeConstants;
import java.math.BigDecimal;
public interface IZUGFeRDExportableItem extends IAbsoluteValueProvider{
@@ -74,10 +72,6 @@ public interface IZUGFeRDExportableItem extends IAbsoluteValueProvider{
return BigDecimal.ONE.setScale(4);
}
default String getCategoryCode() {
return TaxCategoryCodeTypeConstants.STANDARDRATE;
}
/***
* the ID of an additionally referenced document for this item
* @return the id as string

View File

@@ -106,11 +106,12 @@ public interface IZUGFeRDExportableProduct {
}
default String getTaxCategoryCode() {
if (isIntraCommunitySupply()) {
if (getVATPercent().equals(new BigDecimal(0))) {
return "Z"; // zero rated goods
} else if (isIntraCommunitySupply()) {
return "K";
} else {
return "S";
return "S"; // one of the "standard" rates (not neccessarily a default rate, even a deducted VAT is standard calculation)
}
}

View File

@@ -147,7 +147,7 @@ public class TransactionCalculator implements IAbsoluteValueProvider {
BigDecimal percent = currentItem.getProduct().getVATPercent();
LineCalculator lc = new LineCalculator(currentItem);
VATAmount itemVATAmount = new VATAmount(lc.getItemTotalNetAmount(), lc.getItemTotalVATAmount(),
currentItem.getCategoryCode());
currentItem.getProduct().getTaxCategoryCode());
VATAmount current = hm.get(percent);
if (current == null) {
hm.put(percent, itemVATAmount);