add DeliveryNoteReferencedDocument per Item Line ID
This commit is contained in:
@@ -48,6 +48,7 @@ public class Item implements IZUGFeRDExportableItem {
|
|||||||
protected TradeParty lineSeller;
|
protected TradeParty lineSeller;
|
||||||
protected String deliveryNoteReferencedDocumentID = null;
|
protected String deliveryNoteReferencedDocumentID = null;
|
||||||
protected Date deliveryNoteReferencedDocumentDate = null;
|
protected Date deliveryNoteReferencedDocumentDate = null;
|
||||||
|
protected String deliveryNoteReferencedDocumentLineID = null;
|
||||||
//protected HashMap<String, String> attributes = new HashMap<>();
|
//protected HashMap<String, String> attributes = new HashMap<>();
|
||||||
|
|
||||||
/***
|
/***
|
||||||
@@ -194,6 +195,9 @@ public class Item implements IZUGFeRDExportableItem {
|
|||||||
dn.getAsString("IssuerAssignedID")
|
dn.getAsString("IssuerAssignedID")
|
||||||
.ifPresent(this::setDeliveryNoteReferencedDocumentID);
|
.ifPresent(this::setDeliveryNoteReferencedDocumentID);
|
||||||
|
|
||||||
|
dn.getAsString("LineID")
|
||||||
|
.ifPresent(this::setDeliveryNoteReferencedDocumentLineID);
|
||||||
|
|
||||||
dn.getAsNodeMap("FormattedIssueDateTime")
|
dn.getAsNodeMap("FormattedIssueDateTime")
|
||||||
.flatMap(fdt -> fdt.getNode("DateTimeString"))
|
.flatMap(fdt -> fdt.getNode("DateTimeString"))
|
||||||
.map(XMLTools::getNodeValue)
|
.map(XMLTools::getNodeValue)
|
||||||
@@ -734,4 +738,15 @@ public class Item implements IZUGFeRDExportableItem {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDeliveryNoteReferencedDocumentLineID() {
|
||||||
|
return deliveryNoteReferencedDocumentLineID;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Item setDeliveryNoteReferencedDocumentLineID(String deliveryNoteReferencedDocumentLineID) {
|
||||||
|
this.deliveryNoteReferencedDocumentLineID = deliveryNoteReferencedDocumentLineID;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -267,4 +267,14 @@ public interface IZUGFeRDExportableItem extends IAbsoluteValueProvider{
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get delivery note document LineID (per Item - ZUGFeRD EXTENDED)
|
||||||
|
* rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeDelivery/ram:DeliveryNoteReferencedDocument/LineID
|
||||||
|
*
|
||||||
|
* @return the LineID of the delivery note document item
|
||||||
|
*/
|
||||||
|
default String getDeliveryNoteReferencedDocumentLineID() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -539,6 +539,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
if (currentItem.getDeliveryNoteReferencedDocumentID() != null && !currentItem.getDeliveryNoteReferencedDocumentID().trim().isEmpty()) {
|
if (currentItem.getDeliveryNoteReferencedDocumentID() != null && !currentItem.getDeliveryNoteReferencedDocumentID().trim().isEmpty()) {
|
||||||
xml += "<ram:DeliveryNoteReferencedDocument>";
|
xml += "<ram:DeliveryNoteReferencedDocument>";
|
||||||
xml += "<ram:IssuerAssignedID>" + XMLTools.encodeXML(currentItem.getDeliveryNoteReferencedDocumentID()) + "</ram:IssuerAssignedID>";
|
xml += "<ram:IssuerAssignedID>" + XMLTools.encodeXML(currentItem.getDeliveryNoteReferencedDocumentID()) + "</ram:IssuerAssignedID>";
|
||||||
|
xml += "<ram:LineID>" + XMLTools.encodeXML(currentItem.getDeliveryNoteReferencedDocumentLineID()) + "</ram:LineID>";
|
||||||
if (currentItem.getDeliveryNoteReferencedDocumentDate() != null) {
|
if (currentItem.getDeliveryNoteReferencedDocumentDate() != null) {
|
||||||
final SimpleDateFormat dateFormat102 = new SimpleDateFormat("yyyyMMdd");
|
final SimpleDateFormat dateFormat102 = new SimpleDateFormat("yyyyMMdd");
|
||||||
xml += "<ram:FormattedIssueDateTime><qdt:DateTimeString format=\"102\">"+XMLTools.encodeXML(dateFormat102.format(currentItem.getDeliveryNoteReferencedDocumentDate()))+"</qdt:DateTimeString></ram:FormattedIssueDateTime>";
|
xml += "<ram:FormattedIssueDateTime><qdt:DateTimeString format=\"102\">"+XMLTools.encodeXML(dateFormat102.format(currentItem.getDeliveryNoteReferencedDocumentDate()))+"</qdt:DateTimeString></ram:FormattedIssueDateTime>";
|
||||||
|
|||||||
@@ -746,6 +746,10 @@ public class ZUGFeRDImporter extends ZUGFeRDInvoiceImporter {
|
|||||||
if (subnode != null) {
|
if (subnode != null) {
|
||||||
lineItem.setDeliveryNoteReferencedDocumentID(XMLTools.getNodeValue(subnode));
|
lineItem.setDeliveryNoteReferencedDocumentID(XMLTools.getNodeValue(subnode));
|
||||||
}
|
}
|
||||||
|
subnode = getNodeByName(node.getChildNodes(), "LineID");
|
||||||
|
if (subnode != null) {
|
||||||
|
lineItem.setDeliveryNoteReferencedDocumentLineID(XMLTools.getNodeValue(subnode));
|
||||||
|
}
|
||||||
node = getNodeByName(node.getChildNodes(), "FormattedIssueDateTime");
|
node = getNodeByName(node.getChildNodes(), "FormattedIssueDateTime");
|
||||||
if (node != null) {
|
if (node != null) {
|
||||||
NodeList FormattedIssueDateTimeChilds = node.getChildNodes();
|
NodeList FormattedIssueDateTimeChilds = node.getChildNodes();
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
|
|||||||
"<ram:BilledQuantity unitCode=\"HUR\">1.0000</ram:BilledQuantity>\n" +
|
"<ram:BilledQuantity unitCode=\"HUR\">1.0000</ram:BilledQuantity>\n" +
|
||||||
"<ram:DeliveryNoteReferencedDocument>\n" +
|
"<ram:DeliveryNoteReferencedDocument>\n" +
|
||||||
"<ram:IssuerAssignedID>deliverynote123</ram:IssuerAssignedID>\n" +
|
"<ram:IssuerAssignedID>deliverynote123</ram:IssuerAssignedID>\n" +
|
||||||
|
"<ram:LineID>deliverypos456</ram:LineID>\n" +
|
||||||
"<ram:FormattedIssueDateTime>\n" +
|
"<ram:FormattedIssueDateTime>\n" +
|
||||||
"<udt:DateTimeString format=\"102\">20260114</udt:DateTimeString>\n" +
|
"<udt:DateTimeString format=\"102\">20260114</udt:DateTimeString>\n" +
|
||||||
"</ram:FormattedIssueDateTime>\n" +
|
"</ram:FormattedIssueDateTime>\n" +
|
||||||
@@ -288,6 +289,7 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
|
|||||||
assertEquals(zi.getHolder(), "Bei Spiel GmbH");
|
assertEquals(zi.getHolder(), "Bei Spiel GmbH");
|
||||||
assertEquals(zi.getForeignReference(), "RE-20171118/506");
|
assertEquals(zi.getForeignReference(), "RE-20171118/506");
|
||||||
assertEquals(zi.getLineItemList().get(0).getDeliveryNoteReferencedDocumentID(), "deliverynote123");
|
assertEquals(zi.getLineItemList().get(0).getDeliveryNoteReferencedDocumentID(), "deliverynote123");
|
||||||
|
assertEquals(zi.getLineItemList().get(0).getDeliveryNoteReferencedDocumentLineID(), "deliverypos456");
|
||||||
try {
|
try {
|
||||||
assertEquals(zi.getLineItemList().get(0).getDeliveryNoteReferencedDocumentDate(), new SimpleDateFormat("dd.MM.yyyy").parse("14.01.2026"));
|
assertEquals(zi.getLineItemList().get(0).getDeliveryNoteReferencedDocumentDate(), new SimpleDateFormat("dd.MM.yyyy").parse("14.01.2026"));
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
|
|||||||
@@ -614,6 +614,7 @@ public class ZF2PushTest extends TestCase {
|
|||||||
addAdditionalReference(dr2).addBuyerOrderReferencedDocumentID("orderId").addBuyerOrderReferencedDocumentLineID("xxx").addReferencedLineID("xxx")
|
addAdditionalReference(dr2).addBuyerOrderReferencedDocumentID("orderId").addBuyerOrderReferencedDocumentLineID("xxx").addReferencedLineID("xxx")
|
||||||
.addNote("item level 1/1").addAllowance(new Allowance(new BigDecimal(0.02)).setReason("item discount").setTaxPercent(new BigDecimal(16))).setDetailedDeliveryPeriod(sdf.parse("2020-01-13"), sdf.parse("2020-01-15"))
|
.addNote("item level 1/1").addAllowance(new Allowance(new BigDecimal(0.02)).setReason("item discount").setTaxPercent(new BigDecimal(16))).setDetailedDeliveryPeriod(sdf.parse("2020-01-13"), sdf.parse("2020-01-15"))
|
||||||
.setDeliveryNoteReferencedDocumentID("deliverynote123")
|
.setDeliveryNoteReferencedDocumentID("deliverynote123")
|
||||||
|
.setDeliveryNoteReferencedDocumentLineID("deliverypos456")
|
||||||
.setDeliveryNoteReferencedDocumentDate(new SimpleDateFormat("dd.MM.yyyy").parse("14.01.2026"))
|
.setDeliveryNoteReferencedDocumentDate(new SimpleDateFormat("dd.MM.yyyy").parse("14.01.2026"))
|
||||||
)
|
)
|
||||||
.addCharge(new Charge(new BigDecimal(0.5)).setReason("quick delivery charge").setTaxPercent(new BigDecimal(16)))
|
.addCharge(new Charge(new BigDecimal(0.5)).setReason("quick delivery charge").setTaxPercent(new BigDecimal(16)))
|
||||||
@@ -652,6 +653,7 @@ public class ZF2PushTest extends TestCase {
|
|||||||
assertTrue(zi.getUTF8().contains(contractID));
|
assertTrue(zi.getUTF8().contains(contractID));
|
||||||
assertEquals(zi.importedInvoice.getZFItems()[0].getId(), "a123");
|
assertEquals(zi.importedInvoice.getZFItems()[0].getId(), "a123");
|
||||||
assertEquals(zi.importedInvoice.getZFItems()[0].getDeliveryNoteReferencedDocumentID(), "deliverynote123");
|
assertEquals(zi.importedInvoice.getZFItems()[0].getDeliveryNoteReferencedDocumentID(), "deliverynote123");
|
||||||
|
assertEquals(zi.importedInvoice.getZFItems()[0].getDeliveryNoteReferencedDocumentLineID(), "deliverypos456");
|
||||||
try {
|
try {
|
||||||
assertEquals(zi.importedInvoice.getZFItems()[0].getDeliveryNoteReferencedDocumentDate(), new SimpleDateFormat("dd.MM.yyyy").parse("14.01.2026"));
|
assertEquals(zi.importedInvoice.getZFItems()[0].getDeliveryNoteReferencedDocumentDate(), new SimpleDateFormat("dd.MM.yyyy").parse("14.01.2026"));
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user