88 * @see TransactionCalculator
99 */
1010public class LineCalculator {
11- private final BigDecimal price ;
12- private final BigDecimal priceGross ;
13- private final BigDecimal itemTotalNetAmount ;
14- private final BigDecimal itemTotalVATAmount ;
15- private BigDecimal allowance = BigDecimal .ZERO ;
16- private BigDecimal charge = BigDecimal .ZERO ;
17- private BigDecimal allowanceItemTotal = BigDecimal .ZERO ;
11+ protected BigDecimal price ;
12+ protected BigDecimal priceGross ;
13+ protected BigDecimal itemTotalNetAmount ;
14+ protected BigDecimal itemTotalVATAmount ;
15+ protected BigDecimal allowance = BigDecimal .ZERO ;
16+ protected BigDecimal charge = BigDecimal .ZERO ;
17+ protected BigDecimal allowanceItemTotal = BigDecimal .ZERO ;
1818
1919 public LineCalculator (IZUGFeRDExportableItem currentItem ) {
2020
@@ -63,6 +63,7 @@ public LineCalculator(IZUGFeRDExportableItem currentItem) {
6363
6464 price =currentItem .getPrice ();
6565 priceGross =price ;
66+ price =price .subtract (allowance ).add (charge );
6667// BigDecimal delta=charge.subtract(allowanceItemTotal).subtract(allowance);
6768// delta=delta.divide(currentItem.getQuantity(), 18, RoundingMode.HALF_UP);
6869// priceGross=currentItem.getPrice().add(delta);
@@ -72,7 +73,7 @@ public LineCalculator(IZUGFeRDExportableItem currentItem) {
7273 ? BigDecimal .ONE .setScale (4 )
7374 : currentItem .getBasisQuantity ();
7475 itemTotalNetAmount = quantity .multiply (price ).divide (basisQuantity , 18 , RoundingMode .HALF_UP )
75- .subtract (allowanceItemTotal ).subtract ( allowance ). add ( charge ). setScale (2 , RoundingMode .HALF_UP );
76+ .subtract (allowanceItemTotal ).setScale (2 , RoundingMode .HALF_UP );
7677 itemTotalVATAmount = itemTotalNetAmount .multiply (multiplicator );
7778 }
7879
0 commit comments