read position accountingReference

To new field ReceivableSpecifiedTradeAccountingAccount
This commit is contained in:
ean
2025-02-12 08:30:47 +01:00
parent 9e9e0cf444
commit 51ebbd8fb1
3 changed files with 24 additions and 0 deletions

View File

@@ -42,6 +42,7 @@ public class Item implements IZUGFeRDExportableItem {
protected ArrayList<IZUGFeRDAllowanceCharge> Allowances = new ArrayList<>();
protected ArrayList<IZUGFeRDAllowanceCharge> Charges = new ArrayList<>();
protected List<IncludedNote> includedNotes = null;
protected String accountingReference;
//protected HashMap<String, String> attributes = new HashMap<>();
/***
@@ -214,6 +215,8 @@ public class Item implements IZUGFeRDExportableItem {
icnm.getAllNodes("AdditionalReferencedDocument").map(ReferencedDocument::fromNode).forEach(this::addAdditionalReference);
icnm.getAsString("ReceivableSpecifiedTradeAccountingAccount").ifPresent(s -> this.accountingReference = s == null ? null : s.trim());
icnm.getAsNodeMap("BillingSpecifiedPeriod").ifPresent(periodNode -> {
Date start = periodNode.getAsNodeMap("StartDateTime").flatMap(dateTimeNode -> dateTimeNode.getNode("DateTimeString")).map(dts -> XMLTools.tryDate(dts)).orElse(null);
Date end = periodNode.getAsNodeMap("EndDateTime").flatMap(dateTimeNode -> dateTimeNode.getNode("DateTimeString")).map(dts -> XMLTools.tryDate(dts)).orElse(null);
@@ -538,4 +541,9 @@ public class Item implements IZUGFeRDExportableItem {
public List<IncludedNote> getNotesWithSubjectCode() {
return includedNotes;
}
@Override
public String getAccountingReference() {
return accountingReference;
}
}

View File

@@ -172,4 +172,8 @@ public interface IZUGFeRDExportableItem extends IAbsoluteValueProvider{
default List<IncludedNote> getNotesWithSubjectCode() {
return null;
}
default String getAccountingReference() {
return null;
}
}

View File

@@ -585,4 +585,16 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
assertEquals("0", zii.importedInvoice.getDuePayable().toPlainString());
}
@Test
public void test() throws FileNotFoundException, XPathExpressionException, ParseException {
File inputFile = getResourceAsFile("ORDER-X_EX01_ORDER_FULL_DATA-COMFORTorder-x.xml");
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter();
zii.doIgnoreCalculationErrors();
zii.setInputStream(new FileInputStream(inputFile));
Invoice invoice = zii.extractInvoice();
assertEquals(3, invoice.getZFItems().length);
assertEquals("BUYER_ACCOUNTING_REF", invoice.getZFItems()[0].getAccountingReference());
}
}