Merge branch 'issues/651'
# Conflicts: # History.md
This commit is contained in:
@@ -10,6 +10,9 @@ allow to add includedNotes with type
|
||||
- 630 #296 #565
|
||||
- 657
|
||||
- 658
|
||||
- 648
|
||||
- 651
|
||||
- 652
|
||||
|
||||
2.15.2
|
||||
=======
|
||||
|
||||
@@ -172,6 +172,32 @@ public class Item implements IZUGFeRDExportableItem {
|
||||
icnm.getAsNodeMap("ApplicableTradeTax")
|
||||
.flatMap(cnm -> cnm.getAsBigDecimal("RateApplicablePercent", "ApplicablePercent"))
|
||||
.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)) {
|
||||
icnm.getAsNodeMap("SpecifiedTradeSettlementLineMonetarySummation")
|
||||
|
||||
@@ -55,7 +55,7 @@ public class LineCalculator {
|
||||
BigDecimal basisQuantity = currentItem.getBasisQuantity().compareTo(BigDecimal.ZERO) == 0
|
||||
? BigDecimal.ONE.setScale(4)
|
||||
: 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);
|
||||
itemTotalVATAmount = itemTotalNetAmount.multiply(multiplicator);
|
||||
}
|
||||
|
||||
@@ -897,7 +897,7 @@ public class ZUGFeRDInvoiceImporter {
|
||||
// be read,
|
||||
// so the invoice remains arithmetically correct
|
||||
// -> 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);
|
||||
for (int i = 0; i < chargeNodes.getLength(); i++) {
|
||||
NodeList chargeNodeChilds = chargeNodes.item(i).getChildNodes();
|
||||
|
||||
@@ -40,7 +40,6 @@ import java.nio.file.Paths;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -103,6 +102,7 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void testInvoiceImportUBL() {
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user