This commit is contained in:
jstaerk
2025-05-17 09:34:14 +02:00
parent 075a531693
commit 8b6e53ead4

View File

@@ -97,7 +97,6 @@ public class Item implements IZUGFeRDExportableItem {
//icnm.getNode("AdditionalItemProperty").flatMap(n ->n.getAttributes()).ifPresent(product::setAttributes);
icnm.getAsNodeMap("ClassifiedTaxCategory").flatMap(m -> m.getAsBigDecimal("Percent"))
.ifPresent(product::setVATPercent);
});
@@ -136,8 +135,6 @@ public class Item implements IZUGFeRDExportableItem {
.ifPresent(this::addNote);
itemMap.getAsNodeMap("SpecifiedLineTradeAgreement", "SpecifiedSupplyChainTradeAgreement").ifPresent(icnm -> {
icnm.getAsNodeMap("BuyerOrderReferencedDocument")
.flatMap(bordNodes -> bordNodes.getAsString("LineID"))
@@ -176,12 +173,13 @@ public class Item implements IZUGFeRDExportableItem {
icnm.getAsNodeMap("ApplicableTradeTax")
.flatMap(cnm -> cnm.getAsString("ExemptionReason"))
.ifPresent(product::setTaxExemptionReason);
icnm.getAllNodes("SpecifiedTradeAllowanceCharge").map(NodeMap::new).forEach(stac -> {
stac.getAsNodeMap("ChargeIndicator").ifPresent(ci -> {
stac.getAsNodeMap("ChargeIndicator").ifPresent(ci -> { //CII
String isChargeString = ci.getAsString("Indicator").get();
String percentString=stac.getAsStringOrNull("CalculationPercent");
String amountString=stac.getAsStringOrNull("ActualAmount");
String reason=stac.getAsStringOrNull("Reason");
String percentString = stac.getAsStringOrNull("CalculationPercent");//MultiplierFactorNumeric
String amountString = stac.getAsStringOrNull("ActualAmount");//Amount
String reason = stac.getAsStringOrNull("Reason");//AllowanceChargeReason
Charge izac = new Charge();
if (isChargeString.equalsIgnoreCase("false")) {
izac = new Allowance();
@@ -206,7 +204,6 @@ public class Item implements IZUGFeRDExportableItem {
});
});
if (recalcPrice && !BigDecimal.ZERO.equals(quantity)) {
icnm.getAsNodeMap("SpecifiedTradeSettlementLineMonetarySummation")
.flatMap(cnm -> cnm.getAsBigDecimal("LineTotalAmount"))
@@ -224,6 +221,36 @@ public class Item implements IZUGFeRDExportableItem {
});
});
itemMap.getAllNodes("AllowanceCharge").map(NodeMap::new).forEach(stac -> { //UBL
String isChargeString = stac.getAsString("ChargeIndicator").get();
String percentString = stac.getAsStringOrNull("MultiplierFactorNumeric");
String amountString = stac.getAsStringOrNull("Amount");
String reason = stac.getAsStringOrNull("AllowanceChargeReason");
Charge izac = new Charge();
if (isChargeString.equalsIgnoreCase("false")) {
izac = new Allowance();
} else {
izac = new Charge();
}
if (amountString != null) {
izac.setTotalAmount(new BigDecimal(amountString));
}
if (percentString != null) {
izac.setPercent(new BigDecimal(percentString));
}
if (reason != null) {
izac.setReason(reason);
}
if (isChargeString.equalsIgnoreCase("false")) {
addAllowance(izac);
} else {
addCharge(izac);
}
});
itemMap.getAsNodeMap("AssociatedDocumentLineDocument").ifPresent(adld -> {
List<IncludedNote> includedNotes = new ArrayList<>();
adld.getAllNodes("IncludedNote").forEach(item -> {
@@ -380,6 +407,7 @@ public class Item implements IZUGFeRDExportableItem {
}
}
}
/***
* jackson convenience method
*/