-
-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
addressing #159 gross price. removing jaxb from zf1.
- Loading branch information
Jochen Stärk
authored and
Jochen Stärk
committed
Jun 14, 2020
1 parent
5dbb3a7
commit b9efc21
Showing
6 changed files
with
191 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
library/src/main/java/org/mustangproject/ZUGFeRD/LineCalc.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package org.mustangproject.ZUGFeRD; | ||
|
||
import java.math.BigDecimal; | ||
|
||
public class LineCalc { | ||
private BigDecimal totalGross; | ||
private BigDecimal priceGross; | ||
private BigDecimal itemTotalNetAmount; | ||
private BigDecimal itemTotalVATAmount; | ||
|
||
public LineCalc(IZUGFeRDExportableItem currentItem) { | ||
BigDecimal multiplicator = currentItem.getProduct().getVATPercent().divide(new BigDecimal(100)) | ||
.add(new BigDecimal(1)); | ||
priceGross = currentItem.getPrice(); // see https://github.com/ZUGFeRD/mustangproject/issues/159 | ||
totalGross = currentItem.getQuantity().multiply(currentItem.getPrice()).divide(currentItem.getBasisQuantity()) | ||
.multiply(multiplicator); | ||
itemTotalNetAmount = currentItem.getQuantity().multiply(currentItem.getPrice()).divide(currentItem.getBasisQuantity()) | ||
.setScale(2, BigDecimal.ROUND_HALF_UP); | ||
itemTotalVATAmount = totalGross.subtract(itemTotalNetAmount); | ||
} | ||
|
||
public BigDecimal getItemTotalNetAmount() { | ||
return itemTotalNetAmount; | ||
} | ||
|
||
public BigDecimal getItemTotalVATAmount() { | ||
return itemTotalVATAmount; | ||
} | ||
|
||
public BigDecimal getItemTotalGrossAmount() { | ||
return itemTotalVATAmount; | ||
} | ||
|
||
public BigDecimal getPriceGross() { | ||
return priceGross; | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.