fix item calc in case allowance and charges are null

This commit is contained in:
AlexanderSchmidt
2015-11-20 11:40:04 +01:00
parent 82f9abb26c
commit 08bae5f01b

View File

@@ -87,12 +87,16 @@ public class ZUGFeRDExporter {
BigDecimal totalAllowance = BigDecimal.ZERO;
BigDecimal totalCharge = BigDecimal.ZERO;
for(IZUGFeRDAllowanceCharge itemAllowance : currentItem.getItemAllowances()){
totalAllowance = itemAllowance.getTotalAmount().add(totalAllowance);
if(currentItem.getItemAllowances() != null){
for(IZUGFeRDAllowanceCharge itemAllowance : currentItem.getItemAllowances()){
totalAllowance = itemAllowance.getTotalAmount().add(totalAllowance);
}
}
for(IZUGFeRDAllowanceCharge itemCharge : currentItem.getItemCharges()){
totalCharge = itemCharge.getTotalAmount().add(totalCharge);
if(currentItem.getItemCharges() != null){
for(IZUGFeRDAllowanceCharge itemCharge : currentItem.getItemCharges()){
totalCharge = itemCharge.getTotalAmount().add(totalCharge);
}
}
BigDecimal multiplicator = currentItem.getProduct().getVATPercent().divide(new BigDecimal(100), 4, BigDecimal.ROUND_HALF_UP).add(BigDecimal.ONE);