Import UnitCode of basisQuantity to product.

I don't know which node is the better one to read the unitCode: grossPriceProductTradePrice or netPriceProductTradePrice. I have chosen the last one.
This commit is contained in:
Sebastian Sieber
2020-11-24 09:46:12 +01:00
parent cda1cd1c24
commit 9af73473b7

View File

@@ -788,8 +788,7 @@ public class ZUGFeRDImporter {
List<Node> nodeList = getLineItemNodes();
List<Item> lineItemList = new ArrayList<>();
for (Node n: nodeList
) {
for (Node n: nodeList) {
Item lineItem = new Item(null, null, null);
lineItem.setProduct(new Product(null,null,null,null));
@@ -803,13 +802,21 @@ public class ZUGFeRDImporter {
node = getNodeByName(nn.getChildNodes(), "ram:NetPriceProductTradePrice");
if (node != null) {
node = getNodeByName(node.getChildNodes(), "ram:ChargeAmount");
lineItem.setPrice(tryBigDecimal(getNodeValue(node)));
NodeList tradeAgreementChildren = node.getChildNodes();
node = getNodeByName(tradeAgreementChildren, "ram:ChargeAmount");
lineItem.setPrice(tryBigDecimal(getNodeValue(node)));
node = getNodeByName(tradeAgreementChildren, "ram:BasisQuantity");
if(node.getAttributes()!=null) {
Node unitCodeAttribute = node.getAttributes().getNamedItem("unitCode");
if(unitCodeAttribute != null) {
lineItem.getProduct().setUnit(unitCodeAttribute.getNodeValue());
}
}
}
node = getNodeByName(nn.getChildNodes(), "ram:GrossPriceProductTradePrice");
if (node != null) {
node = getNodeByName(node.getChildNodes(), "ram:ChargeAmount");
node = getNodeByName(node.getChildNodes(), "ram:ChargeAmount");
lineItem.setGrossPrice(tryBigDecimal(getNodeValue(node)));
}
break;