Merge pull request #573 from janrosendahl/feature/CategoryCode
Feature/category code
This commit is contained in:
@@ -24,7 +24,8 @@ public class DirectDebit implements IZUGFeRDTradeSettlementDebit {
|
||||
* bean constructor
|
||||
*/
|
||||
public DirectDebit() {
|
||||
|
||||
this.IBAN = "";
|
||||
this.mandate = "";
|
||||
}
|
||||
|
||||
/***
|
||||
|
||||
@@ -44,10 +44,14 @@ public class LineCalculator {
|
||||
BigDecimal multiplicator = vatPercent.divide(BigDecimal.valueOf(100));
|
||||
priceGross = currentItem.getPrice(); // see https://github.com/ZUGFeRD/mustangproject/issues/159
|
||||
price = priceGross.subtract(allowance).add(charge);
|
||||
itemTotalNetAmount = currentItem.getQuantity().multiply(getPrice()).divide(currentItem.getBasisQuantity(), 18, RoundingMode.HALF_UP)
|
||||
// Division/Zero occurred here.
|
||||
// Used the setScale only because that's also done in getBasisQuantity
|
||||
BigDecimal basisQuantity = currentItem.getBasisQuantity().compareTo(BigDecimal.ZERO) == 0
|
||||
? BigDecimal.ONE.setScale(4)
|
||||
: currentItem.getBasisQuantity();
|
||||
itemTotalNetAmount = currentItem.getQuantity().multiply(getPrice()).divide(basisQuantity, 18, RoundingMode.HALF_UP)
|
||||
.subtract(allowanceItemTotal).setScale(2, RoundingMode.HALF_UP);
|
||||
itemTotalVATAmount = itemTotalNetAmount.multiply(multiplicator);
|
||||
|
||||
}
|
||||
|
||||
public BigDecimal getPrice() {
|
||||
|
||||
@@ -743,6 +743,15 @@ public class ZUGFeRDImporter extends ZUGFeRDInvoiceImporter {
|
||||
node = getNodeByName(node.getChildNodes(), "CalculatedAmount");
|
||||
lineItem.setTax(XMLTools.tryBigDecimal(node));
|
||||
}
|
||||
|
||||
node = getNodeByName(nn.getChildNodes(), "ApplicableTradeTax");
|
||||
if (node != null) {
|
||||
node = getNodeByName(node.getChildNodes(), "CategoryCode");
|
||||
if(node != null){
|
||||
lineItem.getProduct().setTaxCategoryCode(XMLTools.getNodeValue(node));
|
||||
}
|
||||
}
|
||||
|
||||
node = getNodeByName(nn.getChildNodes(), "BillingSpecifiedPeriod");
|
||||
if (node != null) {
|
||||
final Node start = getNodeByName(node.getChildNodes(), "StartDateTime");
|
||||
|
||||
Reference in New Issue
Block a user