UBL updates : line charge / allowance

This commit is contained in:
Bharti
2024-11-25 14:52:38 +01:00
parent 295d9ce276
commit 5bd04e0bbc
2 changed files with 49 additions and 8 deletions

View File

@@ -171,7 +171,7 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
NodeList taxSchemechilds = partyTaxScheme.item(partyTaxSchemeIndex).getChildNodes();
for (int taxSchemechildsIndex = 0; taxSchemechildsIndex < taxSchemechilds.getLength(); taxSchemechildsIndex++) {
if (taxSchemechilds.item(taxSchemechildsIndex).getLocalName() != null){
if (taxSchemechilds.item(taxSchemechildsIndex).getTextContent().equals("FC")) {
if (taxSchemechilds.item(taxSchemechildsIndex).getTextContent().equals("FC") ||(taxSchemechilds.item(taxSchemechildsIndex).getTextContent().equals("NOVAT"))) {
setTaxID(CompanyId);
}
else{
@@ -252,8 +252,6 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
}
}
}
if (postal.item(postalChildIndex).getLocalName().equals("Name")) {
setName(postal.item(postalChildIndex).getTextContent());
@@ -284,6 +282,41 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
NodeList contact = nodes.item(nodeIndex).getChildNodes();
setContact(new Contact(contact));
}
if(currentUBLChild.equals("PayeeParty")){
NodeList payeeParty = nodes.item(nodeIndex).getChildNodes();
for (int payeePartyIndex = 0; payeePartyIndex < payeeParty.getLength(); payeePartyIndex++) {
if (payeeParty.item(payeePartyIndex).getLocalName() != null) {
if (payeeParty.item(payeePartyIndex).getLocalName().equals("PartyIdentification")) {
NodeList partyID = payeeParty.item(payeePartyIndex).getChildNodes();
for (int partyIDIndex = 0; partyIDIndex < partyID.getLength(); partyIDIndex++) {
if (partyID.item(partyIDIndex).getLocalName() != null) {
if (partyID.item(partyIDIndex).getLocalName().equals("ID")) {
Node currentNode = partyID.item(partyIDIndex);
if ((currentNode.getAttributes() != null &&
(currentNode.getAttributes().getNamedItem("schemeID") != null))
) {
//SchemedID gid = new SchemedID().setScheme(nodes.item(nodeIndex).getAttributes().getNamedItem("schemeID").getNodeValue()).setId(nodes.item(nodeIndex).getTextContent());
// addGlobalID(gid);
SchemedID sID = new SchemedID(currentNode.getAttributes().getNamedItem("schemeID").getTextContent(), currentNode.getTextContent());
addGlobalID(sID);
//&& ((currentNode.getAttributes().getNamedItem("schemeID").getNodeValue().equals("0110") && currentNode.getAttributes().getNamedItem("schemeID").getNodeValue().equals("0100"))
}
else{
setID(currentNode.getTextContent());
}
}
}
}
}
}
}
}
}
}
}

View File

@@ -302,8 +302,8 @@ public class ZUGFeRDInvoiceImporter {
}
//UBL...
shipEx = xpath.compile("//*[local-name()=\"DeliveryLocation\"]");
deliveryNodes = (NodeList) shipEx.evaluate(getDocument(), XPathConstants.NODESET);
XPathExpression shipExUBL = xpath.compile("//*[local-name()=\"DeliveryLocation\"]");
deliveryNodes = (NodeList) shipExUBL.evaluate(getDocument(), XPathConstants.NODESET);
if (deliveryNodes != null) {
String street, name, additionalStreet, city, postal, countrySubentity, line, country = null;
street = extractString("//*[local-name() = \"Address\"]/*[local-name() = \"StreetName\"]");
@@ -315,7 +315,15 @@ public class ZUGFeRDInvoiceImporter {
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));
zpp.setDeliveryAddress(new TradeParty(deliveryNodes)
.setStreet(street)
.setAdditionalAddress(additionalStreet)
.setLocation(city)
.setZIP(postal)
.setAdditionalAddressExtension(line)
.setCountry(country)
.setName(name)
);
}
@@ -613,7 +621,7 @@ public class ZUGFeRDInvoiceImporter {
zpp.setDespatchAdviceReferencedDocumentID(extractString("//*[local-name()=\"DespatchDocumentReference\"]/*[local-name()=\"ID\"]"));
}
//zpp.setOwnOrganisationName(extractString("//*[local-name()=\"SellerTradeParty\"]/*[local-name()=\"Name\"]|//*[local-name()=\"AccountingSupplierParty\"]/*[local-name()=\"Party\"]/*[local-name()=\"PartyName\"]").trim());
zpp.setOwnOrganisationName(extractString("//*[local-name()=\"SellerTradeParty\"]/*[local-name()=\"Name\"]|//*[local-name()=\"AccountingSupplierParty\"]/*[local-name()=\"Party\"]/*[local-name()=\"PartyName\"]").trim());
xpr = xpath.compile("//*[local-name()=\"BuyerReference\"]");
String buyerReference = null;
@@ -651,7 +659,7 @@ public class ZUGFeRDInvoiceImporter {
// be read,
// so the invoice remains arithmetically correct
// -> parse document level charges+allowances
xpr = xpath.compile("//*[local-name()=\"SpecifiedTradeAllowanceCharge\"]|/*[local-name()=\"Invoice\"]/*[local-name()=\"AllowanceCharge\"]");//CII and UBL
xpr = xpath.compile("//*[local-name()=\"SpecifiedTradeAllowanceCharge\"]|//*[local-name()=\"AllowanceCharge\"]");//CII and UBL
NodeList chargeNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
for (int i = 0; i < chargeNodes.getLength(); i++) {
NodeList chargeNodeChilds = chargeNodes.item(i).getChildNodes();