read basisamount
This commit is contained in:
@@ -24,6 +24,10 @@ public class Charge implements IZUGFeRDAllowanceCharge {
|
||||
* the absolute value if not percentage
|
||||
*/
|
||||
protected BigDecimal totalAmount;
|
||||
/**
|
||||
* the value the percentage is applied upon
|
||||
*/
|
||||
protected BigDecimal basisAmount;
|
||||
/**
|
||||
* 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
|
||||
public String getReasonCode() {
|
||||
return reasonCode;
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
@@ -119,7 +118,7 @@ public class Item implements IZUGFeRDExportableItem {
|
||||
});
|
||||
|
||||
itemMap.getAllNodes("DocumentReference").map(ReferencedDocument::fromNode)
|
||||
.forEach(this::addAdditionalReference);
|
||||
.forEach(this::addAdditionalReference);
|
||||
|
||||
// ubl
|
||||
|
||||
@@ -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"))
|
||||
@@ -178,24 +175,28 @@ public class Item implements IZUGFeRDExportableItem {
|
||||
.ifPresent(product::setTaxExemptionReason);
|
||||
icnm.getAllNodes("SpecifiedTradeAllowanceCharge").map(NodeMap::new).forEach(stac -> {
|
||||
stac.getAsNodeMap("ChargeIndicator").ifPresent(ci -> {
|
||||
String isChargeString=ci.getAsString("Indicator").get();
|
||||
String percentString=stac.getAsStringOrNull("CalculationPercent");
|
||||
String amountString=stac.getAsStringOrNull("ActualAmount");
|
||||
String reason=stac.getAsStringOrNull("Reason");
|
||||
Charge izac= new Charge();
|
||||
String isChargeString = ci.getAsString("Indicator").get();
|
||||
String percentString = stac.getAsStringOrNull("CalculationPercent");
|
||||
String amountString = stac.getAsStringOrNull("ActualAmount");
|
||||
String basisAmountString = stac.getAsStringOrNull("BasisAmount");
|
||||
String reason = stac.getAsStringOrNull("Reason");
|
||||
Charge izac = new Charge();
|
||||
if (isChargeString.equalsIgnoreCase("false")) {
|
||||
izac = new Allowance();
|
||||
} else {
|
||||
izac = new Charge();
|
||||
}
|
||||
if (amountString!=null) {
|
||||
if (amountString != null) {
|
||||
izac.setTotalAmount(new BigDecimal(amountString));
|
||||
}
|
||||
if(percentString!=null) {
|
||||
izac.setPercent(new BigDecimal(percentString));
|
||||
if (basisAmountString != null) {
|
||||
izac.setBasisAmount(new BigDecimal(basisAmountString));
|
||||
}
|
||||
if(reason!=null) {
|
||||
izac.setReason(reason);
|
||||
if (percentString != null) {
|
||||
izac.setPercent(new BigDecimal(percentString));
|
||||
}
|
||||
if (reason != null) {
|
||||
izac.setReason(reason);
|
||||
}
|
||||
|
||||
if (isChargeString.equalsIgnoreCase("false")) {
|
||||
@@ -275,7 +276,7 @@ public class Item implements IZUGFeRDExportableItem {
|
||||
}
|
||||
|
||||
public Item setNotesWithSubjectCode(List<IncludedNote> theList) {
|
||||
includedNotes=theList;
|
||||
includedNotes = theList;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -373,18 +374,19 @@ public class Item implements IZUGFeRDExportableItem {
|
||||
* jackson convenience method
|
||||
*/
|
||||
public void setItemAllowances(ArrayList<Allowance> theAllowances) {
|
||||
if (theAllowances!=null) {
|
||||
if (theAllowances != null) {
|
||||
Allowances.clear();
|
||||
for (Allowance theAllowance : theAllowances) {
|
||||
Allowances.add(theAllowance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
* jackson convenience method
|
||||
*/
|
||||
public void setItemCharges(ArrayList<Charge> theCharges) {
|
||||
if (theCharges!=null) {
|
||||
if (theCharges != null) {
|
||||
Charges.clear();
|
||||
for (Charge theCharge : theCharges) {
|
||||
Charges.add(theCharge);
|
||||
|
||||
@@ -38,6 +38,12 @@ public interface IZUGFeRDAllowanceCharge {
|
||||
*/
|
||||
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
|
||||
* @return the description
|
||||
|
||||
@@ -962,6 +962,7 @@ public class ZUGFeRDInvoiceImporter {
|
||||
NodeList chargeNodeChilds = chargeNodes.item(i).getChildNodes();
|
||||
boolean isCharge = true;
|
||||
String chargeAmount = null;
|
||||
String basisAmount = null;
|
||||
String reason = null;
|
||||
String reasonCode = null;
|
||||
String taxPercent = null;
|
||||
@@ -989,6 +990,8 @@ public class ZUGFeRDInvoiceImporter {
|
||||
|
||||
} else if (chargeChildName.equals("ActualAmount") || chargeChildName.equals("Amount")) {
|
||||
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")) {
|
||||
reason = XMLTools.trimOrNull(chargeNodeChilds.item(chargeChildIndex));
|
||||
} else if (chargeChildName.equals("ReasonCode") || chargeChildName.equals("AllowanceChargeReasonCode")) {
|
||||
@@ -1016,6 +1019,9 @@ public class ZUGFeRDInvoiceImporter {
|
||||
if (taxPercent != null) {
|
||||
c.setTaxPercent(new BigDecimal(taxPercent));
|
||||
}
|
||||
if (basisAmount != null) {
|
||||
c.setBasisAmount(new BigDecimal(basisAmount));
|
||||
}
|
||||
zpp.addCharge(c);
|
||||
} else {
|
||||
Allowance a = new Allowance(new BigDecimal(chargeAmount));
|
||||
@@ -1028,6 +1034,9 @@ public class ZUGFeRDInvoiceImporter {
|
||||
if (taxPercent != null) {
|
||||
a.setTaxPercent(new BigDecimal(taxPercent));
|
||||
}
|
||||
if (basisAmount != null) {
|
||||
a.setBasisAmount(new BigDecimal(basisAmount));
|
||||
}
|
||||
zpp.addAllowance(a);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user