support reverse charge

This commit is contained in:
jstaerk
2020-11-25 18:34:48 +01:00
parent 02e6f2f9a6
commit e7e2141c04
4 changed files with 151 additions and 3 deletions

View File

@@ -10,6 +10,8 @@ import java.math.BigDecimal;
public class Product implements IZUGFeRDExportableProduct {
protected String unit, name, description, sellerAssignedID, buyerAssignedID;
protected BigDecimal VATPercent;
protected boolean isReverseCharge=false;
protected boolean isIntraCommunitySupply=false;
/***
* default constructor
@@ -54,6 +56,37 @@ public class Product implements IZUGFeRDExportableProduct {
return this;
}
@Override
public boolean isReverseCharge() {
return isReverseCharge;
}
@Override
public boolean isIntraCommunitySupply() {
return isIntraCommunitySupply;
}
/***
* sets reverse charge(=delivery to outside EU)
* @return fluent setter
*/
public Product setReverseCharge() {
isReverseCharge=true;
setVATPercent(BigDecimal.ZERO);
return this;
}
/***
* sets intra community supply(=delivery outside the country inside the EU)
* @return fluent setter
*/
public Product setIntraCommunitySupply() {
isIntraCommunitySupply=true;
setVATPercent(BigDecimal.ZERO);
return this;
}
@Override
public String getUnit() {
return unit;

View File

@@ -108,10 +108,16 @@ public interface IZUGFeRDExportableProduct {
return false;
}
default boolean isReverseCharge() {
return false;
}
default String getTaxCategoryCode() {
if (isIntraCommunitySupply()) {
return "K";
} else if (getVATPercent().equals(new BigDecimal(0))) {
return "K"; // within europe
} else if (isReverseCharge()) {
return "AE"; // to out of europe...
} else if (getVATPercent().equals(BigDecimal.ZERO)) {
return "Z"; // zero rated goods
} else {
return "S"; // one of the "standard" rates (not neccessarily a default rate, even a deducted VAT is standard calculation)
@@ -119,8 +125,11 @@ public interface IZUGFeRDExportableProduct {
}
default String getTaxExemptionReason() {
if (isIntraCommunitySupply())
if (isIntraCommunitySupply()) {
return "Intra-community supply";
} else if (isReverseCharge()) {
return "Reverse Charge";
}
return null;
}
}