Merge branch 'issues/651'

# Conflicts:
#	History.md
This commit is contained in:
jstaerk
2025-01-10 11:00:31 +01:00
5 changed files with 32 additions and 3 deletions

View File

@@ -10,6 +10,9 @@ allow to add includedNotes with type
- 630 #296 #565 - 630 #296 #565
- 657 - 657
- 658 - 658
- 648
- 651
- 652
2.15.2 2.15.2
======= =======

View File

@@ -172,6 +172,32 @@ public class Item implements IZUGFeRDExportableItem {
icnm.getAsNodeMap("ApplicableTradeTax") icnm.getAsNodeMap("ApplicableTradeTax")
.flatMap(cnm -> cnm.getAsBigDecimal("RateApplicablePercent", "ApplicablePercent")) .flatMap(cnm -> cnm.getAsBigDecimal("RateApplicablePercent", "ApplicablePercent"))
.ifPresent(product::setVATPercent); .ifPresent(product::setVATPercent);
icnm.getAsNodeMap("SpecifiedTradeAllowanceCharge").ifPresent(stac -> {
stac.getAsNodeMap("ChargeIndicator").ifPresent(ci -> {
String isChargeString=ci.getAsString("Indicator").get();
String percentString=stac.getAsStringOrNull("CalculationPercent");
String amountString=stac.getAsStringOrNull("ActualAmount");
String reason=stac.getAsStringOrNull("Reason");
Charge izac= new Charge();
if (isChargeString.equalsIgnoreCase("false")) {
izac = new Allowance();
} else {
izac = new Charge();
}
if (amountString!=null) {
izac.setTotalAmount(new BigDecimal(amountString));
}
izac.setPercent(new BigDecimal(percentString));
izac.setReason(reason);
if (isChargeString.equalsIgnoreCase("false")) {
addAllowance(izac);
} else {
addCharge(izac);
}
});
});
if (recalcPrice && !BigDecimal.ZERO.equals(quantity)) { if (recalcPrice && !BigDecimal.ZERO.equals(quantity)) {
icnm.getAsNodeMap("SpecifiedTradeSettlementLineMonetarySummation") icnm.getAsNodeMap("SpecifiedTradeSettlementLineMonetarySummation")

View File

@@ -55,7 +55,7 @@ public class LineCalculator {
BigDecimal basisQuantity = currentItem.getBasisQuantity().compareTo(BigDecimal.ZERO) == 0 BigDecimal basisQuantity = currentItem.getBasisQuantity().compareTo(BigDecimal.ZERO) == 0
? BigDecimal.ONE.setScale(4) ? BigDecimal.ONE.setScale(4)
: currentItem.getBasisQuantity(); : currentItem.getBasisQuantity();
itemTotalNetAmount = quantity.multiply(getPrice()).divide(basisQuantity, 18, RoundingMode.HALF_UP) itemTotalNetAmount = quantity.multiply(price).divide(basisQuantity, 18, RoundingMode.HALF_UP)
.subtract(allowanceItemTotal).setScale(2, RoundingMode.HALF_UP); .subtract(allowanceItemTotal).setScale(2, RoundingMode.HALF_UP);
itemTotalVATAmount = itemTotalNetAmount.multiply(multiplicator); itemTotalVATAmount = itemTotalNetAmount.multiply(multiplicator);
} }

View File

@@ -897,7 +897,7 @@ public class ZUGFeRDInvoiceImporter {
// be read, // be read,
// so the invoice remains arithmetically correct // so the invoice remains arithmetically correct
// -> parse document level charges+allowances // -> parse document level charges+allowances
xpr = xpath.compile("//*[local-name()=\"SpecifiedTradeAllowanceCharge\"]|//*[local-name()=\"AllowanceCharge\"]");//CII and UBL xpr = xpath.compile("//*[local-name()=\"ApplicableHeaderTradeSettlement\"]/*[local-name()=\"SpecifiedTradeAllowanceCharge\"]|/*[local-name()=\"AllowanceCharge\"]");//CII and UBL
NodeList chargeNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET); NodeList chargeNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
for (int i = 0; i < chargeNodes.getLength(); i++) { for (int i = 0; i < chargeNodes.getLength(); i++) {
NodeList chargeNodeChilds = chargeNodes.item(i).getChildNodes(); NodeList chargeNodeChilds = chargeNodes.item(i).getChildNodes();

View File

@@ -40,7 +40,6 @@ import java.nio.file.Paths;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date;
import java.util.List; import java.util.List;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
@@ -103,6 +102,7 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
} }
public void testInvoiceImportUBL() { public void testInvoiceImportUBL() {