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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user