do not expect dueDate for corrected invoices

This commit is contained in:
jstaerk
2020-11-19 12:12:27 +01:00
parent d028d453c5
commit dff6334185
3 changed files with 8 additions and 3 deletions

View File

@@ -9,6 +9,7 @@
- xmp errors may not show correctly in log - xmp errors may not show correctly in log
### 2.0.1 done ### 2.0.1 done
- do not expect dueDate for corrected invoices
- XR test now includes guideline ID #172 - XR test now includes guideline ID #172
- BigDecimal specific refactoring PR #192 Thanks to weclapp-dev - BigDecimal specific refactoring PR #192 Thanks to weclapp-dev
- Preserving metadata PR #193 Thanks to mr-stephan - Preserving metadata PR #193 Thanks to mr-stephan

View File

@@ -38,6 +38,7 @@ import org.dom4j.io.OutputFormat;
import org.dom4j.io.XMLWriter; import org.dom4j.io.XMLWriter;
import org.mustangproject.FileAttachment; import org.mustangproject.FileAttachment;
import org.mustangproject.XMLTools; import org.mustangproject.XMLTools;
import org.mustangproject.ZUGFeRD.model.DocumentCodeTypeConstants;
public class ZUGFeRD2PullProvider implements IXMLProvider { public class ZUGFeRD2PullProvider implements IXMLProvider {
@@ -226,7 +227,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
paymentTermsDescription = trans.getPaymentTermDescription(); paymentTermsDescription = trans.getPaymentTermDescription();
} }
if (paymentTermsDescription == null) { if ((paymentTermsDescription == null)&&(trans.getDocumentCode()!= org.mustangproject.ZUGFeRD.model.DocumentCodeTypeConstants.CORRECTEDINVOICE)) {
paymentTermsDescription = "Zahlbar ohne Abzug bis " + germanDateFormat.format(trans.getDueDate()); paymentTermsDescription = "Zahlbar ohne Abzug bis " + germanDateFormat.format(trans.getDueDate());
} }
@@ -479,6 +480,9 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
} }
} }
} }
if (trans.getDocumentCode()== DocumentCodeTypeConstants.CORRECTEDINVOICE) {
hasDueDate=false;
}
HashMap<BigDecimal, VATAmount> VATPercentAmountMap = calc.getVATPercentAmountMap(); HashMap<BigDecimal, VATAmount> VATPercentAmountMap = calc.getVATPercentAmountMap();
for (BigDecimal currentTaxPercent : VATPercentAmountMap.keySet()) { for (BigDecimal currentTaxPercent : VATPercentAmountMap.keySet()) {

View File

@@ -389,8 +389,8 @@ public class ZF2PushTest extends TestCase {
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1().setProducer("My Application") ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1().setProducer("My Application")
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors() .setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
.load(SOURCE_PDF)) { .load(SOURCE_PDF)) {
// no due date, since we are not expecting money
Invoice i = new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDetailedDeliveryPeriod(new Date(), new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE").addTaxID("4711").addVATID("DE0815")).setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE").addVATID("DE0815")).setNumber(number) Invoice i = new Invoice().setIssueDate(new Date()).setDetailedDeliveryPeriod(new Date(), new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE").addTaxID("4711").addVATID("DE0815")).setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE").addVATID("DE0815")).setNumber(number)
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), price, qty)) .addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), price, qty))
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), price, qty)) .addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), price, qty))
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), price, qty)).setCorrection("0815"); .addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), price, qty)).setCorrection("0815");