closes #835
This commit is contained in:
@@ -97,7 +97,6 @@ public class Item implements IZUGFeRDExportableItem {
|
|||||||
//icnm.getNode("AdditionalItemProperty").flatMap(n ->n.getAttributes()).ifPresent(product::setAttributes);
|
//icnm.getNode("AdditionalItemProperty").flatMap(n ->n.getAttributes()).ifPresent(product::setAttributes);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
icnm.getAsNodeMap("ClassifiedTaxCategory").flatMap(m -> m.getAsBigDecimal("Percent"))
|
icnm.getAsNodeMap("ClassifiedTaxCategory").flatMap(m -> m.getAsBigDecimal("Percent"))
|
||||||
.ifPresent(product::setVATPercent);
|
.ifPresent(product::setVATPercent);
|
||||||
});
|
});
|
||||||
@@ -119,7 +118,7 @@ public class Item implements IZUGFeRDExportableItem {
|
|||||||
});
|
});
|
||||||
|
|
||||||
itemMap.getAllNodes("DocumentReference").map(ReferencedDocument::fromNode)
|
itemMap.getAllNodes("DocumentReference").map(ReferencedDocument::fromNode)
|
||||||
.forEach(this::addAdditionalReference);
|
.forEach(this::addAdditionalReference);
|
||||||
|
|
||||||
// ubl
|
// ubl
|
||||||
|
|
||||||
@@ -136,8 +135,6 @@ public class Item implements IZUGFeRDExportableItem {
|
|||||||
.ifPresent(this::addNote);
|
.ifPresent(this::addNote);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
itemMap.getAsNodeMap("SpecifiedLineTradeAgreement", "SpecifiedSupplyChainTradeAgreement").ifPresent(icnm -> {
|
itemMap.getAsNodeMap("SpecifiedLineTradeAgreement", "SpecifiedSupplyChainTradeAgreement").ifPresent(icnm -> {
|
||||||
icnm.getAsNodeMap("BuyerOrderReferencedDocument")
|
icnm.getAsNodeMap("BuyerOrderReferencedDocument")
|
||||||
.flatMap(bordNodes -> bordNodes.getAsString("LineID"))
|
.flatMap(bordNodes -> bordNodes.getAsString("LineID"))
|
||||||
@@ -176,26 +173,27 @@ public class Item implements IZUGFeRDExportableItem {
|
|||||||
icnm.getAsNodeMap("ApplicableTradeTax")
|
icnm.getAsNodeMap("ApplicableTradeTax")
|
||||||
.flatMap(cnm -> cnm.getAsString("ExemptionReason"))
|
.flatMap(cnm -> cnm.getAsString("ExemptionReason"))
|
||||||
.ifPresent(product::setTaxExemptionReason);
|
.ifPresent(product::setTaxExemptionReason);
|
||||||
|
|
||||||
icnm.getAllNodes("SpecifiedTradeAllowanceCharge").map(NodeMap::new).forEach(stac -> {
|
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 isChargeString = ci.getAsString("Indicator").get();
|
||||||
String percentString=stac.getAsStringOrNull("CalculationPercent");
|
String percentString = stac.getAsStringOrNull("CalculationPercent");//MultiplierFactorNumeric
|
||||||
String amountString=stac.getAsStringOrNull("ActualAmount");
|
String amountString = stac.getAsStringOrNull("ActualAmount");//Amount
|
||||||
String reason=stac.getAsStringOrNull("Reason");
|
String reason = stac.getAsStringOrNull("Reason");//AllowanceChargeReason
|
||||||
Charge izac= new Charge();
|
Charge izac = new Charge();
|
||||||
if (isChargeString.equalsIgnoreCase("false")) {
|
if (isChargeString.equalsIgnoreCase("false")) {
|
||||||
izac = new Allowance();
|
izac = new Allowance();
|
||||||
} else {
|
} else {
|
||||||
izac = new Charge();
|
izac = new Charge();
|
||||||
}
|
}
|
||||||
if (amountString!=null) {
|
if (amountString != null) {
|
||||||
izac.setTotalAmount(new BigDecimal(amountString));
|
izac.setTotalAmount(new BigDecimal(amountString));
|
||||||
}
|
}
|
||||||
if(percentString!=null) {
|
if (percentString != null) {
|
||||||
izac.setPercent(new BigDecimal(percentString));
|
izac.setPercent(new BigDecimal(percentString));
|
||||||
}
|
}
|
||||||
if(reason!=null) {
|
if (reason != null) {
|
||||||
izac.setReason(reason);
|
izac.setReason(reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isChargeString.equalsIgnoreCase("false")) {
|
if (isChargeString.equalsIgnoreCase("false")) {
|
||||||
@@ -206,7 +204,6 @@ public class Item implements IZUGFeRDExportableItem {
|
|||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (recalcPrice && !BigDecimal.ZERO.equals(quantity)) {
|
if (recalcPrice && !BigDecimal.ZERO.equals(quantity)) {
|
||||||
icnm.getAsNodeMap("SpecifiedTradeSettlementLineMonetarySummation")
|
icnm.getAsNodeMap("SpecifiedTradeSettlementLineMonetarySummation")
|
||||||
.flatMap(cnm -> cnm.getAsBigDecimal("LineTotalAmount"))
|
.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 -> {
|
itemMap.getAsNodeMap("AssociatedDocumentLineDocument").ifPresent(adld -> {
|
||||||
List<IncludedNote> includedNotes = new ArrayList<>();
|
List<IncludedNote> includedNotes = new ArrayList<>();
|
||||||
adld.getAllNodes("IncludedNote").forEach(item -> {
|
adld.getAllNodes("IncludedNote").forEach(item -> {
|
||||||
@@ -275,7 +302,7 @@ public class Item implements IZUGFeRDExportableItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Item setNotesWithSubjectCode(List<IncludedNote> theList) {
|
public Item setNotesWithSubjectCode(List<IncludedNote> theList) {
|
||||||
includedNotes=theList;
|
includedNotes = theList;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -373,18 +400,19 @@ public class Item implements IZUGFeRDExportableItem {
|
|||||||
* jackson convenience method
|
* jackson convenience method
|
||||||
*/
|
*/
|
||||||
public void setItemAllowances(ArrayList<Allowance> theAllowances) {
|
public void setItemAllowances(ArrayList<Allowance> theAllowances) {
|
||||||
if (theAllowances!=null) {
|
if (theAllowances != null) {
|
||||||
Allowances.clear();
|
Allowances.clear();
|
||||||
for (Allowance theAllowance : theAllowances) {
|
for (Allowance theAllowance : theAllowances) {
|
||||||
Allowances.add(theAllowance);
|
Allowances.add(theAllowance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* jackson convenience method
|
* jackson convenience method
|
||||||
*/
|
*/
|
||||||
public void setItemCharges(ArrayList<Charge> theCharges) {
|
public void setItemCharges(ArrayList<Charge> theCharges) {
|
||||||
if (theCharges!=null) {
|
if (theCharges != null) {
|
||||||
Charges.clear();
|
Charges.clear();
|
||||||
for (Charge theCharge : theCharges) {
|
for (Charge theCharge : theCharges) {
|
||||||
Charges.add(theCharge);
|
Charges.add(theCharge);
|
||||||
|
|||||||
Reference in New Issue
Block a user