Correct tax category code

Use TaxCategoryCode instead of DocumentCode by creating
VATPercentAmountMap.
This commit is contained in:
Sebastian Sieber
2020-11-09 15:34:43 +01:00
parent 71379627c6
commit 337ed2e99e
3 changed files with 3 additions and 7 deletions

View File

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

View File

@@ -107,7 +107,6 @@ public class ZUGFeRD1PullProvider extends ZUGFeRD2PullProvider implements IXMLPr
this.calc=new TransactionCalculator(trans);
boolean hasDueDate=false;
String taxCategoryCode="";
SimpleDateFormat germanDateFormat = new SimpleDateFormat("dd.MM.yyyy");
String exemptionReason="";
@@ -261,7 +260,7 @@ public class ZUGFeRD1PullProvider extends ZUGFeRD2PullProvider implements IXMLPr
+ " <ram:TypeCode>VAT</ram:TypeCode>\n"
+ exemptionReason
+ " <ram:BasisAmount currencyID=\"" + trans.getCurrency() + "\">" + currencyFormat(amount.getBasis()) + "</ram:BasisAmount>\n" // currencyID=\"EUR\"
+ " <ram:CategoryCode>"+taxCategoryCode+"</ram:CategoryCode>\n"
+ " <ram:CategoryCode>"+amount.getCategoryCode()+"</ram:CategoryCode>\n"
+ " <ram:ApplicablePercent>" + vatFormat(currentTaxPercent)
+ "</ram:ApplicablePercent>\n" + " </ram:ApplicableTradeTax>\n"; //$NON-NLS-2$
@@ -318,7 +317,6 @@ public class ZUGFeRD1PullProvider extends ZUGFeRD2PullProvider implements IXMLPr
int lineID = 0;
for (IZUGFeRDExportableItem currentItem : trans.getZFItems()) {
lineID++;
taxCategoryCode=currentItem.getProduct().getTaxCategoryCode();
if (currentItem.getProduct().getTaxExemptionReason() != null) {
exemptionReason="<ram:ExemptionReason>" + XMLTools.encodeXML(currentItem.getProduct().getTaxExemptionReason()) + "</ram:ExemptionReason>";
}

View File

@@ -218,7 +218,6 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
this.calc = new TransactionCalculator(trans);
boolean hasDueDate = false;
String taxCategoryCode = "";
SimpleDateFormat germanDateFormat = new SimpleDateFormat("dd.MM.yyyy");
String exemptionReason = "";
@@ -298,7 +297,6 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
int lineID = 0;
for (IZUGFeRDExportableItem currentItem : trans.getZFItems()) {
lineID++;
taxCategoryCode = currentItem.getProduct().getTaxCategoryCode();
if (currentItem.getProduct().getTaxExemptionReason() != null) {
exemptionReason = "<ram:ExemptionReason>" + XMLTools.encodeXML(currentItem.getProduct().getTaxExemptionReason()) + "</ram:ExemptionReason>";
}
@@ -492,7 +490,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
+ " <ram:TypeCode>VAT</ram:TypeCode>\n"
+ exemptionReason
+ " <ram:BasisAmount>" + currencyFormat(amount.getBasis()) + "</ram:BasisAmount>\n" // currencyID=\"EUR\"
+ " <ram:CategoryCode>" + taxCategoryCode + "</ram:CategoryCode>\n"
+ " <ram:CategoryCode>" + amount.getCategoryCode() + "</ram:CategoryCode>\n"
+ " <ram:RateApplicablePercent>" + vatFormat(currentTaxPercent)
+ "</ram:RateApplicablePercent>\n" + " </ram:ApplicableTradeTax>\n"; //$NON-NLS-2$