Reading BT17 based on typecode
This commit is contained in:
@@ -686,6 +686,8 @@ public class ZUGFeRDInvoiceImporter {
|
||||
String sellerOrderIssuerAssignedID = null;
|
||||
String additionalReferencedDocument = null;
|
||||
Date additionalReferencedDocumentDate = null;
|
||||
int typeC = 0;
|
||||
|
||||
for (int i = 0; i < headerTradeAgreementNodes.getLength(); i++) {
|
||||
// XMLTools.trimOrNull(nodes.item(i)))) {
|
||||
Node headerTradeAgreementNode = headerTradeAgreementNodes.item(i);
|
||||
@@ -712,33 +714,41 @@ public class ZUGFeRDInvoiceImporter {
|
||||
}
|
||||
}
|
||||
//Reading BT-17
|
||||
if(headerTradeAgreementChilds.item(agreementChildIndex).getLocalName().equals("AdditionalReferencedDocument")) {
|
||||
if (headerTradeAgreementChilds.item(agreementChildIndex).getLocalName().equals("AdditionalReferencedDocument")) {
|
||||
NodeList additionalChilds = headerTradeAgreementChilds.item(agreementChildIndex).getChildNodes();
|
||||
for (int additionalChildIndex = 0; additionalChildIndex < additionalChilds.getLength(); additionalChildIndex++){
|
||||
if((additionalChilds.item(additionalChildIndex).getLocalName() != null)
|
||||
&& (additionalChilds.item(additionalChildIndex).getLocalName().equals("IssuerAssignedID"))) {
|
||||
additionalReferencedDocument = XMLTools.trimOrNull(additionalChilds.item(additionalChildIndex));
|
||||
for (int additionalChildIndex = 0; additionalChildIndex < additionalChilds.getLength(); additionalChildIndex++) {
|
||||
|
||||
if ((additionalChilds.item(additionalChildIndex).getLocalName() != null)
|
||||
&& additionalChilds.item(additionalChildIndex).getLocalName().equals("TypeCode")) {
|
||||
typeC = Integer.parseInt(XMLTools.trimOrNull(additionalChilds.item(additionalChildIndex)));
|
||||
}
|
||||
if((additionalChilds.item(additionalChildIndex).getLocalName() != null)
|
||||
&& (additionalChilds.item(additionalChildIndex).getLocalName().equals("FormattedIssueDateTime"))) {
|
||||
if (typeC == 50) {
|
||||
if ((additionalChilds.item(additionalChildIndex).getLocalName() != null)
|
||||
&& (additionalChilds.item(additionalChildIndex).getLocalName().equals("IssuerAssignedID"))) {
|
||||
additionalReferencedDocument = XMLTools.trimOrNull(additionalChilds.item(additionalChildIndex));
|
||||
}
|
||||
if ((additionalChilds.item(additionalChildIndex).getLocalName() != null)
|
||||
&& (additionalChilds.item(additionalChildIndex).getLocalName().equals("FormattedIssueDateTime"))) {
|
||||
|
||||
NodeList FormattedIssueDateTimeChilds = additionalChilds.item(additionalChildIndex).getChildNodes();
|
||||
for (int dateChildIndex = 0; dateChildIndex < FormattedIssueDateTimeChilds.getLength(); dateChildIndex++) {
|
||||
if ((FormattedIssueDateTimeChilds.item(dateChildIndex).getLocalName() != null)
|
||||
&& (FormattedIssueDateTimeChilds.item(dateChildIndex).getLocalName().equals("DateTimeString"))) {
|
||||
additionalReferencedDocumentDate = XMLTools.tryDate(FormattedIssueDateTimeChilds.item(dateChildIndex));
|
||||
}
|
||||
|
||||
NodeList FormattedIssueDateTimeChilds = additionalChilds.item(additionalChildIndex).getChildNodes();
|
||||
for (int dateChildIndex = 0; dateChildIndex < FormattedIssueDateTimeChilds.getLength(); dateChildIndex++){
|
||||
if((FormattedIssueDateTimeChilds.item(dateChildIndex).getLocalName() != null)
|
||||
&& (FormattedIssueDateTimeChilds.item(dateChildIndex).getLocalName().equals("DateTimeString"))) {
|
||||
additionalReferencedDocumentDate = XMLTools.tryDate(FormattedIssueDateTimeChilds.item(dateChildIndex));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
String currency = extractString("//*[local-name()=\"ApplicableHeaderTradeSettlement\"]/*[local-name()=\"InvoiceCurrencyCode\"]|//*[local-name()=\"DocumentCurrencyCode\"]");
|
||||
zpp.setCurrency(currency);
|
||||
|
||||
@@ -973,6 +983,7 @@ public class ZUGFeRDInvoiceImporter {
|
||||
zpp.setDespatchAdviceReferencedDocumentID(s);
|
||||
}
|
||||
}
|
||||
|
||||
if (additionalReferencedDocument != null){
|
||||
if (additionalReferencedDocumentDate!=null) {
|
||||
zpp.setTenderReferencedDocument(new DatedReference(additionalReferencedDocument, additionalReferencedDocumentDate));
|
||||
|
||||
Reference in New Issue
Block a user