also allow item allowances
This commit is contained in:
@@ -8,7 +8,9 @@ allow to add includedNotes with type
|
|||||||
- 631 multiple invoice referenced documents
|
- 631 multiple invoice referenced documents
|
||||||
- 629
|
- 629
|
||||||
- 630 #296 #565
|
- 630 #296 #565
|
||||||
-
|
- 648
|
||||||
|
- 651
|
||||||
|
- 652
|
||||||
|
|
||||||
2.15.2
|
2.15.2
|
||||||
=======
|
=======
|
||||||
|
|||||||
@@ -176,15 +176,25 @@ public class Item implements IZUGFeRDExportableItem {
|
|||||||
stac.getAsNodeMap("ChargeIndicator").ifPresent(ci -> {
|
stac.getAsNodeMap("ChargeIndicator").ifPresent(ci -> {
|
||||||
String isChargeString=ci.getAsString("Indicator").get();
|
String isChargeString=ci.getAsString("Indicator").get();
|
||||||
String percentString=stac.getAsStringOrNull("CalculationPercent");
|
String percentString=stac.getAsStringOrNull("CalculationPercent");
|
||||||
|
String amountString=stac.getAsStringOrNull("ActualAmount");
|
||||||
String reason=stac.getAsStringOrNull("Reason");
|
String reason=stac.getAsStringOrNull("Reason");
|
||||||
Allowance izac=null;
|
Charge izac= new Charge();
|
||||||
if (isChargeString.equalsIgnoreCase("false")) {
|
if (isChargeString.equalsIgnoreCase("false")) {
|
||||||
izac = new Allowance();
|
izac = new Allowance();
|
||||||
|
} else {
|
||||||
|
izac = new Charge();
|
||||||
|
}
|
||||||
|
if (amountString!=null) {
|
||||||
|
izac.setTotalAmount(new BigDecimal(amountString));
|
||||||
}
|
}
|
||||||
|
|
||||||
izac.setPercent(new BigDecimal(percentString));
|
izac.setPercent(new BigDecimal(percentString));
|
||||||
izac.setReason(reason);
|
izac.setReason(reason);
|
||||||
|
|
||||||
|
if (isChargeString.equalsIgnoreCase("false")) {
|
||||||
addAllowance(izac);
|
addAllowance(izac);
|
||||||
|
} else {
|
||||||
|
addCharge(izac);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -104,31 +103,6 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void testTheInvoiceImport() {
|
|
||||||
|
|
||||||
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter("C:\\Users\\jstaerk\\workspace\\XMLExamples\\zfdiverses\\20250108_\\xmlDieWirLesenSollten.xml");
|
|
||||||
|
|
||||||
boolean hasExceptions = false;
|
|
||||||
Invoice invoice = null;
|
|
||||||
try {
|
|
||||||
invoice = zii.extractInvoice();
|
|
||||||
} catch (XPathExpressionException | ParseException e) {
|
|
||||||
hasExceptions = true;
|
|
||||||
}
|
|
||||||
assertFalse(hasExceptions);
|
|
||||||
// Reading ZUGFeRD
|
|
||||||
|
|
||||||
TransactionCalculator tc = new TransactionCalculator(invoice);
|
|
||||||
assertEquals(new BigDecimal("0.00"), tc.getDuePayable());
|
|
||||||
assertEquals(new BigDecimal("0.00"), tc.getGrandTotal());
|
|
||||||
|
|
||||||
|
|
||||||
// name street location zip country, contact name phone email, total amount
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void testInvoiceImportUBL() {
|
public void testInvoiceImportUBL() {
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user