Merge pull request #573 from janrosendahl/feature/CategoryCode

Feature/category code
This commit is contained in:
Jochen Staerk
2024-12-03 13:31:45 +01:00
committed by GitHub
3 changed files with 17 additions and 3 deletions

View File

@@ -24,7 +24,8 @@ public class DirectDebit implements IZUGFeRDTradeSettlementDebit {
* bean constructor
*/
public DirectDebit() {
this.IBAN = "";
this.mandate = "";
}
/***

View File

@@ -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() {

View File

@@ -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");