read basisamount
This commit is contained in:
@@ -24,6 +24,10 @@ public class Charge implements IZUGFeRDAllowanceCharge {
|
|||||||
* the absolute value if not percentage
|
* the absolute value if not percentage
|
||||||
*/
|
*/
|
||||||
protected BigDecimal totalAmount;
|
protected BigDecimal totalAmount;
|
||||||
|
/**
|
||||||
|
* the value the percentage is applied upon
|
||||||
|
*/
|
||||||
|
protected BigDecimal basisAmount;
|
||||||
/**
|
/**
|
||||||
* the tax rate the charge belongs to
|
* the tax rate the charge belongs to
|
||||||
*/
|
*/
|
||||||
@@ -104,6 +108,22 @@ public class Charge implements IZUGFeRDAllowanceCharge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BigDecimal getBasisAmount() {
|
||||||
|
return basisAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* sets a potential basis for the potential percentage
|
||||||
|
* @param basis the basis amount
|
||||||
|
* @return fluid setter
|
||||||
|
*/
|
||||||
|
public Charge setBasisAmount(BigDecimal basis) {
|
||||||
|
this.basisAmount = basis;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getReasonCode() {
|
public String getReasonCode() {
|
||||||
return reasonCode;
|
return reasonCode;
|
||||||
|
|||||||
@@ -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"))
|
||||||
@@ -178,24 +175,28 @@ public class Item implements IZUGFeRDExportableItem {
|
|||||||
.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 -> {
|
||||||
String isChargeString=ci.getAsString("Indicator").get();
|
String isChargeString = ci.getAsString("Indicator").get();
|
||||||
String percentString=stac.getAsStringOrNull("CalculationPercent");
|
String percentString = stac.getAsStringOrNull("CalculationPercent");
|
||||||
String amountString=stac.getAsStringOrNull("ActualAmount");
|
String amountString = stac.getAsStringOrNull("ActualAmount");
|
||||||
String reason=stac.getAsStringOrNull("Reason");
|
String basisAmountString = stac.getAsStringOrNull("BasisAmount");
|
||||||
Charge izac= new Charge();
|
String reason = stac.getAsStringOrNull("Reason");
|
||||||
|
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 (basisAmountString != null) {
|
||||||
izac.setPercent(new BigDecimal(percentString));
|
izac.setBasisAmount(new BigDecimal(basisAmountString));
|
||||||
}
|
}
|
||||||
if(reason!=null) {
|
if (percentString != null) {
|
||||||
izac.setReason(reason);
|
izac.setPercent(new BigDecimal(percentString));
|
||||||
|
}
|
||||||
|
if (reason != null) {
|
||||||
|
izac.setReason(reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isChargeString.equalsIgnoreCase("false")) {
|
if (isChargeString.equalsIgnoreCase("false")) {
|
||||||
@@ -275,7 +276,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 +374,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);
|
||||||
|
|||||||
@@ -38,6 +38,12 @@ public interface IZUGFeRDAllowanceCharge {
|
|||||||
*/
|
*/
|
||||||
default BigDecimal getPercent() {return null;}
|
default BigDecimal getPercent() {return null;}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* returns a basis the precentage is calculated from
|
||||||
|
* @return null or the basis
|
||||||
|
*/
|
||||||
|
default BigDecimal getBasisAmount() {return null;}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* get a description for the allowance/charge
|
* get a description for the allowance/charge
|
||||||
* @return the description
|
* @return the description
|
||||||
|
|||||||
@@ -962,6 +962,7 @@ public class ZUGFeRDInvoiceImporter {
|
|||||||
NodeList chargeNodeChilds = chargeNodes.item(i).getChildNodes();
|
NodeList chargeNodeChilds = chargeNodes.item(i).getChildNodes();
|
||||||
boolean isCharge = true;
|
boolean isCharge = true;
|
||||||
String chargeAmount = null;
|
String chargeAmount = null;
|
||||||
|
String basisAmount = null;
|
||||||
String reason = null;
|
String reason = null;
|
||||||
String reasonCode = null;
|
String reasonCode = null;
|
||||||
String taxPercent = null;
|
String taxPercent = null;
|
||||||
@@ -989,6 +990,8 @@ public class ZUGFeRDInvoiceImporter {
|
|||||||
|
|
||||||
} else if (chargeChildName.equals("ActualAmount") || chargeChildName.equals("Amount")) {
|
} else if (chargeChildName.equals("ActualAmount") || chargeChildName.equals("Amount")) {
|
||||||
chargeAmount = XMLTools.trimOrNull(chargeNodeChilds.item(chargeChildIndex));
|
chargeAmount = XMLTools.trimOrNull(chargeNodeChilds.item(chargeChildIndex));
|
||||||
|
} else if (chargeChildName.equals("BasisAmount")) {
|
||||||
|
basisAmount = XMLTools.trimOrNull(chargeNodeChilds.item(chargeChildIndex));
|
||||||
} else if (chargeChildName.equals("Reason") || chargeChildName.equals("AllowanceChargeReason")) {
|
} else if (chargeChildName.equals("Reason") || chargeChildName.equals("AllowanceChargeReason")) {
|
||||||
reason = XMLTools.trimOrNull(chargeNodeChilds.item(chargeChildIndex));
|
reason = XMLTools.trimOrNull(chargeNodeChilds.item(chargeChildIndex));
|
||||||
} else if (chargeChildName.equals("ReasonCode") || chargeChildName.equals("AllowanceChargeReasonCode")) {
|
} else if (chargeChildName.equals("ReasonCode") || chargeChildName.equals("AllowanceChargeReasonCode")) {
|
||||||
@@ -1016,6 +1019,9 @@ public class ZUGFeRDInvoiceImporter {
|
|||||||
if (taxPercent != null) {
|
if (taxPercent != null) {
|
||||||
c.setTaxPercent(new BigDecimal(taxPercent));
|
c.setTaxPercent(new BigDecimal(taxPercent));
|
||||||
}
|
}
|
||||||
|
if (basisAmount != null) {
|
||||||
|
c.setBasisAmount(new BigDecimal(basisAmount));
|
||||||
|
}
|
||||||
zpp.addCharge(c);
|
zpp.addCharge(c);
|
||||||
} else {
|
} else {
|
||||||
Allowance a = new Allowance(new BigDecimal(chargeAmount));
|
Allowance a = new Allowance(new BigDecimal(chargeAmount));
|
||||||
@@ -1028,6 +1034,9 @@ public class ZUGFeRDInvoiceImporter {
|
|||||||
if (taxPercent != null) {
|
if (taxPercent != null) {
|
||||||
a.setTaxPercent(new BigDecimal(taxPercent));
|
a.setTaxPercent(new BigDecimal(taxPercent));
|
||||||
}
|
}
|
||||||
|
if (basisAmount != null) {
|
||||||
|
a.setBasisAmount(new BigDecimal(basisAmount));
|
||||||
|
}
|
||||||
zpp.addAllowance(a);
|
zpp.addAllowance(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user