prevent arithmetricexception
This commit is contained in:
@@ -7,6 +7,7 @@ import org.mustangproject.ZUGFeRD.IAbsoluteValueProvider;
|
|||||||
import org.mustangproject.ZUGFeRD.IZUGFeRDAllowanceCharge;
|
import org.mustangproject.ZUGFeRD.IZUGFeRDAllowanceCharge;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* Absolute and relative charges for document and item level
|
* Absolute and relative charges for document and item level
|
||||||
@@ -124,7 +125,7 @@ public class Charge implements IZUGFeRDAllowanceCharge {
|
|||||||
if(totalAmount != null) {
|
if(totalAmount != null) {
|
||||||
return totalAmount;
|
return totalAmount;
|
||||||
} else if (percent!=null) {
|
} else if (percent!=null) {
|
||||||
BigDecimal singlePrice=currentItem.getValue().divide(BigDecimal.ONE.add(getPercent().divide(new BigDecimal(100))));
|
BigDecimal singlePrice=currentItem.getValue().divide(BigDecimal.ONE.add(getPercent().divide(new BigDecimal(100))), 18, RoundingMode.HALF_UP);
|
||||||
BigDecimal singlePriceDiff=currentItem.getValue().subtract(singlePrice);
|
BigDecimal singlePriceDiff=currentItem.getValue().subtract(singlePrice);
|
||||||
return singlePriceDiff;
|
return singlePriceDiff;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user