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