diff --git a/History.md b/History.md index c62ca7c2..9d9210a0 100644 --- a/History.md +++ b/History.md @@ -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 ===== diff --git a/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableProduct.java b/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableProduct.java index 091591a8..ab441e74 100644 --- a/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableProduct.java +++ b/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableProduct.java @@ -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"; + + } } diff --git a/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD2PullProvider.java b/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD2PullProvider.java index ebbe2843..0c9529e7 100644 --- a/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD2PullProvider.java +++ b/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD2PullProvider.java @@ -250,6 +250,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider, IProfileProvider { 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()); @@ -311,6 +312,10 @@ public class ZUGFeRD2PullProvider implements IXMLProvider, IProfileProvider { for (IZUGFeRDExportableItem currentItem : trans.getZFItems()) { lineID++; taxCategoryCode=currentItem.getProduct().getTaxCategoryCode(); + if (currentItem.getProduct().isIntraCommunitySupply()) { + exemptionReason="Intra-community supply"; + } + LineCalc lc = new LineCalc(currentItem); xml = xml + " \n" + //$NON-NLS-1$ " \n" //$NON-NLS-1$ @@ -353,6 +358,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider, IProfileProvider { + " \n" //$NON-NLS-1$ + " VAT\n" //$NON-NLS-1$ + " "+currentItem.getProduct().getTaxCategoryCode()+"\n" //$NON-NLS-1$ + + exemptionReason + " " //$NON-NLS-1$ + vatFormat(currentItem.getProduct().getVATPercent()) + "\n" //$NON-NLS-1$ + " \n" //$NON-NLS-1$ @@ -486,6 +492,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider, IProfileProvider { + " VAT\n" //$NON-NLS-1$ + " " + currencyFormat(amount.getBasis()) + "\n" // currencyID=\"EUR\" + " "+taxCategoryCode+"\n" //$NON-NLS-1$ + + exemptionReason + " " + vatFormat(currentTaxPercent) //$NON-NLS-1$ + "\n" + " \n"; //$NON-NLS-2$ diff --git a/src/test/java/org/mustangproject/ZUGFeRD/ZF2EdgeTest.java b/src/test/java/org/mustangproject/ZUGFeRD/ZF2EdgeTest.java index 6c1fe209..f89134f5 100644 --- a/src/test/java/org/mustangproject/ZUGFeRD/ZF2EdgeTest.java +++ b/src/test/java/org/mustangproject/ZUGFeRD/ZF2EdgeTest.java @@ -81,8 +81,8 @@ public class ZF2EdgeTest extends MustangReaderTestCase implements IZUGFeRDExport } @Override - public String getTaxCategoryCode() { - return "K"; // simulate intra community supply + public boolean isIntraCommunitySupply() { + return true; // simulate intra community supply } }