Skip to content

Commit

Permalink
- include exemption reason if doing intra community supply
Browse files Browse the repository at this point in the history
  • Loading branch information
Jochen Stärk authored and Jochen Stärk committed Dec 7, 2019
1 parent 7ee6d91 commit 02ae6fb
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
1 change: 1 addition & 0 deletions History.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

- support different ship to address
- allow for diffent namespace prefixes #140
- include exemption reason if doing intra community supply

1.7.5
=====
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,17 @@ public interface IZUGFeRDExportableProduct {
*/
BigDecimal getVATPercent();

default String getTaxCategoryCode() {
return "S";
default boolean isIntraCommunitySupply() {
return false;
}

default String getTaxCategoryCode() {
if (isIntraCommunitySupply()) {
return "K";
} else {
return "S";

}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ public void generateXML(IZUGFeRDExportableTransaction trans) {
String taxCategoryCode="";
SimpleDateFormat germanDateFormat = new SimpleDateFormat("dd.MM.yyyy"); //$NON-NLS-1$
SimpleDateFormat zugferdDateFormat = new SimpleDateFormat("yyyyMMdd"); //$NON-NLS-1$
String exemptionReason="";

if (paymentTermsDescription==null) {
paymentTermsDescription= "Zahlbar ohne Abzug bis " + germanDateFormat.format(trans.getDueDate());
Expand Down Expand Up @@ -311,6 +312,10 @@ public void generateXML(IZUGFeRDExportableTransaction trans) {
for (IZUGFeRDExportableItem currentItem : trans.getZFItems()) {
lineID++;
taxCategoryCode=currentItem.getProduct().getTaxCategoryCode();
if (currentItem.getProduct().isIntraCommunitySupply()) {
exemptionReason="<ram:ExemptionReason>Intra-community supply</ram:ExemptionReason>";
}

LineCalc lc = new LineCalc(currentItem);
xml = xml + " <ram:IncludedSupplyChainTradeLineItem>\n" + //$NON-NLS-1$
" <ram:AssociatedDocumentLineDocument>\n" //$NON-NLS-1$
Expand Down Expand Up @@ -353,6 +358,7 @@ public void generateXML(IZUGFeRDExportableTransaction trans) {
+ " <ram:ApplicableTradeTax>\n" //$NON-NLS-1$
+ " <ram:TypeCode>VAT</ram:TypeCode>\n" //$NON-NLS-1$
+ " <ram:CategoryCode>"+currentItem.getProduct().getTaxCategoryCode()+"</ram:CategoryCode>\n" //$NON-NLS-1$
+ exemptionReason
+ " <ram:RateApplicablePercent>" //$NON-NLS-1$
+ vatFormat(currentItem.getProduct().getVATPercent()) + "</ram:RateApplicablePercent>\n" //$NON-NLS-1$
+ " </ram:ApplicableTradeTax>\n" //$NON-NLS-1$
Expand Down Expand Up @@ -486,6 +492,7 @@ public void generateXML(IZUGFeRDExportableTransaction trans) {
+ " <ram:TypeCode>VAT</ram:TypeCode>\n" //$NON-NLS-1$
+ " <ram:BasisAmount>" + currencyFormat(amount.getBasis()) + "</ram:BasisAmount>\n" // currencyID=\"EUR\"
+ " <ram:CategoryCode>"+taxCategoryCode+"</ram:CategoryCode>\n" //$NON-NLS-1$
+ exemptionReason
+ " <ram:RateApplicablePercent>" + vatFormat(currentTaxPercent) //$NON-NLS-1$
+ "</ram:RateApplicablePercent>\n" + " </ram:ApplicableTradeTax>\n"; //$NON-NLS-2$

Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/mustangproject/ZUGFeRD/ZF2EdgeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ public BigDecimal getVATPercent() {
}

@Override
public String getTaxCategoryCode() {
return "K"; // simulate intra community supply
public boolean isIntraCommunitySupply() {
return true; // simulate intra community supply
}
}

Expand Down

0 comments on commit 02ae6fb

Please sign in to comment.