from 7 to 6 errors

This commit is contained in:
jstaerk
2025-05-22 07:01:55 +02:00
parent dea5372688
commit 220eaaff7a

View File

@@ -12,8 +12,10 @@ public class LineCalculator {
protected BigDecimal priceGross; protected BigDecimal priceGross;
protected BigDecimal itemTotalNetAmount; protected BigDecimal itemTotalNetAmount;
protected BigDecimal itemTotalVATAmount; protected BigDecimal itemTotalVATAmount;
protected BigDecimal allowance = BigDecimal.ZERO; protected BigDecimal lineAllowance = BigDecimal.ZERO;
protected BigDecimal charge = BigDecimal.ZERO; protected BigDecimal lineCharge = BigDecimal.ZERO;
protected BigDecimal itemAllowance = BigDecimal.ZERO;
protected BigDecimal itemCharge = BigDecimal.ZERO;
protected BigDecimal allowanceItemTotal = BigDecimal.ZERO; protected BigDecimal allowanceItemTotal = BigDecimal.ZERO;
public LineCalculator(IZUGFeRDExportableItem currentItem) { public LineCalculator(IZUGFeRDExportableItem currentItem) {
@@ -22,11 +24,12 @@ public class LineCalculator {
for (IZUGFeRDAllowanceCharge allowance : currentItem.getItemAllowances()) { for (IZUGFeRDAllowanceCharge allowance : currentItem.getItemAllowances()) {
BigDecimal factor=BigDecimal.ONE; BigDecimal factor=BigDecimal.ONE;
BigDecimal singleAllowance=allowance.getTotalAmount(currentItem); BigDecimal singleAllowance=allowance.getTotalAmount(currentItem);
addItemAllowance(singleAllowance);
if ((allowance.getPercent()!=null)&&(allowance.getPercent().compareTo(BigDecimal.ZERO)!=0)) { if ((allowance.getPercent()!=null)&&(allowance.getPercent().compareTo(BigDecimal.ZERO)!=0)) {
factor=currentItem.getQuantity(); factor=currentItem.getQuantity();
} }
addAllowance(singleAllowance.multiply(factor)); addLineAllowance(singleAllowance.multiply(factor));
} }
} }
@@ -34,10 +37,11 @@ public class LineCalculator {
for (IZUGFeRDAllowanceCharge charge : currentItem.getItemCharges()) { for (IZUGFeRDAllowanceCharge charge : currentItem.getItemCharges()) {
BigDecimal factor=BigDecimal.ONE; BigDecimal factor=BigDecimal.ONE;
BigDecimal singleCharge=charge.getTotalAmount(currentItem); BigDecimal singleCharge=charge.getTotalAmount(currentItem);
addItemCharge(singleCharge);
if ((charge.getPercent()!=null)&&(charge.getPercent().compareTo(BigDecimal.ZERO)!=0)) { if ((charge.getPercent()!=null)&&(charge.getPercent().compareTo(BigDecimal.ZERO)!=0)) {
factor=currentItem.getQuantity(); factor=currentItem.getQuantity();
} }
addCharge(singleCharge.multiply(factor)); addLineCharge(singleCharge.multiply(factor));
} }
} }
@@ -63,7 +67,7 @@ public class LineCalculator {
price=currentItem.getPrice(); price=currentItem.getPrice();
priceGross=price; priceGross=price;
price=price.subtract(allowance).add(charge); price=price.subtract(itemAllowance).add(itemCharge);
// BigDecimal delta=charge.subtract(allowanceItemTotal).subtract(allowance); // BigDecimal delta=charge.subtract(allowanceItemTotal).subtract(allowance);
// delta=delta.divide(currentItem.getQuantity(), 18, RoundingMode.HALF_UP); // delta=delta.divide(currentItem.getQuantity(), 18, RoundingMode.HALF_UP);
// priceGross=currentItem.getPrice().add(delta); // priceGross=currentItem.getPrice().add(delta);
@@ -97,12 +101,20 @@ public class LineCalculator {
return priceGross; return priceGross;
} }
public void addAllowance(BigDecimal b) { public void addLineAllowance(BigDecimal b) {
allowance = allowance.add(b); lineAllowance = lineAllowance.add(b);
} }
public void addCharge(BigDecimal b) { public void addLineCharge(BigDecimal b) {
charge = charge.add(b); lineCharge = lineCharge.add(b);
}
public void addItemAllowance(BigDecimal b) {
itemAllowance = itemAllowance.add(b);
}
public void addItemCharge(BigDecimal b) {
itemCharge = itemCharge.add(b);
} }
public void addAllowanceItemTotal(BigDecimal b) { public void addAllowanceItemTotal(BigDecimal b) {