UBL updates : delivery stuff

This commit is contained in:
Bharti
2024-11-21 18:04:09 +01:00
parent e87b78db8e
commit 2cffdc05b2
2 changed files with 14 additions and 42 deletions

View File

@@ -65,6 +65,7 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
}
protected void parseFromUBL(NodeList nodes) {
if (nodes.getLength() > 0) {
@@ -92,43 +93,7 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
SchemedID sID = new SchemedID().setScheme(deliveryLocation.item(deliveryLocationIndex).getAttributes().getNamedItem("schemeID").getTextContent());
addGlobalID(sID);
}
}
if (deliveryLocation.item(deliveryLocationIndex).getLocalName().equals("Address")) {
NodeList address = currentNode.getChildNodes();
for (int addressChildIndex = 0; addressChildIndex < address.getLength(); addressChildIndex++) {
if (address.item(addressChildIndex).getLocalName() != null) {
if (address.item(addressChildIndex).getLocalName().equals("StreetName")) {
setStreet(address.item(addressChildIndex).getTextContent());
}
if (address.item(addressChildIndex).getLocalName().equals("AdditionalStreetName")) {
setAdditionalAddress(address.item(addressChildIndex).getTextContent());
}
if (address.item(addressChildIndex).getLocalName().equals("CityName")) {
setLocation(address.item(addressChildIndex).getTextContent());
}
if (address.item(addressChildIndex).getLocalName().equals("PostalZone")) {
setZIP(address.item(addressChildIndex).getTextContent());
}
}
}
}
}
}
}
if (currentNode.getLocalName().equals("DeliveryParty")) {
NodeList deliveryParty = currentNode.getChildNodes();
for (int deliveryPartyChildIndex = 0; deliveryPartyChildIndex < deliveryParty.getLength(); deliveryPartyChildIndex++) {
if (deliveryParty.item(deliveryPartyChildIndex).getLocalName() != null) {
if (deliveryParty.item(deliveryPartyChildIndex).getLocalName().equals("PartyName")) {
NodeList partyName = deliveryParty.item(deliveryPartyChildIndex).getChildNodes();
for (int partyNameIndex = 0; partyNameIndex < partyName.getLength(); partyNameIndex++) {
if (partyName.item(partyNameIndex).getLocalName() != null) {
setName(partyName.item(partyNameIndex).getTextContent());
}
}
}
}
}
}

View File

@@ -305,16 +305,23 @@ public class ZUGFeRDInvoiceImporter {
shipEx = xpath.compile("//*[local-name()=\"DeliveryLocation\"]");
deliveryNodes = (NodeList) shipEx.evaluate(getDocument(), XPathConstants.NODESET);
if (deliveryNodes!=null) {
String street = "";
if (deliveryNodes != null) {
String street, name, additionalStreet, city, postal, countrySubentity, line, country = null;
street = extractString("//*[local-name() = \"Address\"]/*[local-name() = \"StreetName\"]");
additionalStreet = extractString("//*[local-name() = \"Address\"]/*[local-name() = \"AdditionalStreetName\"]");
city = extractString("//*[local-name() = \"Address\"]/*[local-name() = \"CityName\"]");
postal = extractString("//*[local-name() = \"Address\"]/*[local-name() = \"PostalZone\"]");
countrySubentity = extractString("//*[local-name() = \"Address\"]/*[local-name() = \"CountrySubentity\"]");
line = extractString("//*[local-name() = \"Address\"]//*[local-name() = \"AddressLine\"]/*[local-name() = \"Line\"]");
country = extractString("//*[local-name() = \"Address\"]//*[local-name() = \"Country\"]/*[local-name() = \"IdentificationCode\"]");
name = extractString("//*[local-name() = \"DeliveryParty\"]//*[local-name() = \"PartyName\"]/*[local-name() = \"Name\"]");
zpp.setDeliveryAddress(new TradeParty(deliveryNodes).setStreet(street).setAdditionalAddress(additionalStreet).setLocation(city).setZIP(postal).setAdditionalAddressExtension(line).setCountry(country).setName(name));
//street=....
}
name=ectractString("//DeliveryParty/name");
zpp.setDeliveryAddress(new TradeParty(name, street...));
}
xpr = xpath.compile("//*[local-name()=\"BuyerTradeParty\"]|//*[local-name()=\"AccountingCustomerParty\"]/*");
NodeList BuyerNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);