Merge pull request #1005 from burak-inan/zugferd-importer-ubl-creditnote-fix-998
fix: Add UBL CreditNote support in ZUGFeRDInvoiceImporter
This commit is contained in:
@@ -110,7 +110,7 @@ public class Item implements IZUGFeRDExportableItem {
|
|||||||
icnm.getAsBigDecimal("BaseQuantity").ifPresent(this::setBasisQuantity);
|
icnm.getAsBigDecimal("BaseQuantity").ifPresent(this::setBasisQuantity);
|
||||||
});
|
});
|
||||||
|
|
||||||
itemMap.getNode("InvoicedQuantity").ifPresent(icn -> {
|
itemMap.getNode(new String[]{"InvoicedQuantity", "CreditedQuantity"}).ifPresent(icn -> {
|
||||||
// ubl
|
// ubl
|
||||||
setQuantity(new BigDecimal(icn.getTextContent().trim()));
|
setQuantity(new BigDecimal(icn.getTextContent().trim()));
|
||||||
product.setUnit(icn.getAttributes().getNamedItem("unitCode").getNodeValue());
|
product.setUnit(icn.getAttributes().getNamedItem("unitCode").getNodeValue());
|
||||||
|
|||||||
@@ -762,10 +762,6 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (trans.getDocumentCode() != null
|
|
||||||
&& Arrays.asList(DocumentCodeTypeConstants.CORRECTEDINVOICE, DocumentCodeTypeConstants.CREDITNOTE).contains(trans.getDocumentCode())) {
|
|
||||||
hasDueDate = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final List<VATAmount> vatAmounts = calc.getVATAmountList();
|
final List<VATAmount> vatAmounts = calc.getVATAmountList();
|
||||||
for (final VATAmount amount : vatAmounts) {
|
for (final VATAmount amount : vatAmounts) {
|
||||||
@@ -1068,7 +1064,10 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"if paymentTerms.dueDate is specified, paymentTerms.discountTerms.baseDate has not to be specified");
|
"if paymentTerms.dueDate is specified, paymentTerms.discountTerms.baseDate has not to be specified");
|
||||||
}
|
}
|
||||||
paymentTermsXml += "<ram:Description>" + pt.getDescription() + "</ram:Description>";
|
|
||||||
|
if(pt.getDescription() != null) {
|
||||||
|
paymentTermsXml += "<ram:Description>" + pt.getDescription() + "</ram:Description>";
|
||||||
|
}
|
||||||
|
|
||||||
if (dueDate != null)
|
if (dueDate != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -616,7 +616,7 @@ public class ZUGFeRDInvoiceImporter {
|
|||||||
// //*[local-name()="Invoice" or local-name()="CreditNote"]
|
// //*[local-name()="Invoice" or local-name()="CreditNote"]
|
||||||
number = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"ID\"]").trim();
|
number = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"ID\"]").trim();
|
||||||
potentialCashDiscountTerms = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"PaymentTerms\"]/*[local-name()=\"Note\"]").trim();
|
potentialCashDiscountTerms = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"PaymentTerms\"]/*[local-name()=\"Note\"]").trim();
|
||||||
typeCode = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"InvoiceTypeCode\"]").trim();
|
typeCode = extractString("/*[local-name()=\"Invoice\"]/*[local-name()=\"InvoiceTypeCode\"] | /*[local-name()=\"CreditNote\"]/*[local-name()=\"CreditNoteTypeCode\"]").trim();
|
||||||
String issueDateStr = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"IssueDate\"]").trim();
|
String issueDateStr = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"IssueDate\"]").trim();
|
||||||
if (!issueDateStr.isEmpty()) {
|
if (!issueDateStr.isEmpty()) {
|
||||||
issueDate = parseDate(issueDateStr, "yyyy-MM-dd");
|
issueDate = parseDate(issueDateStr, "yyyy-MM-dd");
|
||||||
@@ -633,7 +633,7 @@ public class ZUGFeRDInvoiceImporter {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String dueDt = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"DueDate\"]").trim();
|
String dueDt = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"DueDate\"] | /*[local-name()=\"CreditNote\"]/*[local-name()=\"PaymentMeans\"]/*[local-name()=\"PaymentDueDate\"]").trim();
|
||||||
if (!dueDt.isEmpty()) {
|
if (!dueDt.isEmpty()) {
|
||||||
dueDate = parseDate(dueDt, "yyyy-MM-dd");
|
dueDate = parseDate(dueDt, "yyyy-MM-dd");
|
||||||
}
|
}
|
||||||
@@ -1097,7 +1097,7 @@ public class ZUGFeRDInvoiceImporter {
|
|||||||
zpp.setReferenceNumber(buyerReference);
|
zpp.setReferenceNumber(buyerReference);
|
||||||
}
|
}
|
||||||
|
|
||||||
xpr = xpath.compile("//*[local-name()=\"IncludedSupplyChainTradeLineItem\"]|//*[local-name()=\"InvoiceLine\"]");
|
xpr = xpath.compile("//*[local-name()=\"IncludedSupplyChainTradeLineItem\"]|//*[local-name()=\"InvoiceLine\"]|//*[local-name()=\"CreditNoteLine\"]");
|
||||||
nodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
|
nodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
|
||||||
|
|
||||||
if (nodes.getLength() != 0) {
|
if (nodes.getLength() != 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user