From 5b386b6af153d24689c584dd3090c3c67d449175 Mon Sep 17 00:00:00 2001 From: Adrian-Devries Date: Thu, 19 Dec 2024 15:40:55 +0100 Subject: [PATCH 01/13] fix logback config fix logback config (cf. https://logback.qos.ch/codes.html#nested_if_element) --- library/src/main/resources/logback.xml | 70 ++++++++++++++------------ 1 file changed, 37 insertions(+), 33 deletions(-) diff --git a/library/src/main/resources/logback.xml b/library/src/main/resources/logback.xml index 011cab8b..7c5e39d4 100644 --- a/library/src/main/resources/logback.xml +++ b/library/src/main/resources/logback.xml @@ -1,33 +1,37 @@ - - - - System.err - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - - log/ZUV-%d{yyyy-MM}.log - - - 60 - - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - - - - + + + System.err + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + log/ZUV-%d{yyyy-MM}.log + + 60 + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + + + + + + + + + + \ No newline at end of file From 1e57af5a6f6d79e40414b36d54fc07199370df0c Mon Sep 17 00:00:00 2001 From: Adrian-Devries Date: Thu, 19 Dec 2024 15:41:49 +0100 Subject: [PATCH 02/13] fix logback config fix logback config (cf. https://logback.qos.ch/codes.html#nested_if_element) --- validator/src/main/resources/logback.xml | 55 +++++++++++------------- 1 file changed, 25 insertions(+), 30 deletions(-) diff --git a/validator/src/main/resources/logback.xml b/validator/src/main/resources/logback.xml index aed3e946..f48d8621 100644 --- a/validator/src/main/resources/logback.xml +++ b/validator/src/main/resources/logback.xml @@ -1,30 +1,25 @@ - - - - System.err - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - log/ZUV-%d{yyyy-MM}.log - - - 60 - - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - - + + + System.err + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + log/ZUV-%d{yyyy-MM}.log + + 60 + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + From 1ccfa39daed10c05e94466f1b56f79404f8f26fd Mon Sep 17 00:00:00 2001 From: Adrian-Devries Date: Thu, 19 Dec 2024 15:42:54 +0100 Subject: [PATCH 03/13] fix logback config fix logback config (cf. https://logback.qos.ch/codes.html#nested_if_element) --- Mustang-CLI/src/main/resources/logback.xml | 74 +++++++++++----------- 1 file changed, 36 insertions(+), 38 deletions(-) diff --git a/Mustang-CLI/src/main/resources/logback.xml b/Mustang-CLI/src/main/resources/logback.xml index d8c56d7e..9efdfd4c 100644 --- a/Mustang-CLI/src/main/resources/logback.xml +++ b/Mustang-CLI/src/main/resources/logback.xml @@ -1,38 +1,36 @@ - - - - System.err - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - - - log/ZUV-%d{yyyy-MM}.log - - - 60 - - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - - - - - - - - + + + System.err + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + log/ZUV-%d{yyyy-MM}.log + + 60 + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + + + + + + + + + From afd08fe57a6b1c202aa754a9ce629f41e6c52e84 Mon Sep 17 00:00:00 2001 From: Adrian-Devries Date: Mon, 6 Jan 2025 11:43:42 +0100 Subject: [PATCH 04/13] Add files via upload --- .../main/resources/stylesheets/result-pdf.xsl | 284 ++++++++++++------ 1 file changed, 184 insertions(+), 100 deletions(-) diff --git a/library/src/main/resources/stylesheets/result-pdf.xsl b/library/src/main/resources/stylesheets/result-pdf.xsl index 9ffe8e1e..0dfa7c95 100644 --- a/library/src/main/resources/stylesheets/result-pdf.xsl +++ b/library/src/main/resources/stylesheets/result-pdf.xsl @@ -9,11 +9,11 @@ - Es wird empfohlen, das Dokument anzunehmen und weiterzuverarbeiten. + Es wird empfohlen, das Dokument anzunehmen und es weiterzuverarbeiten. Es wird empfohlen, das Dokument zurückzuweisen. @@ -71,47 +71,59 @@ + select="'Angaben zum geprüften Dokument'"/> + select="'black'"/> - - - - - - - - Referenz: - - - - - - - - - - Zeitpunkt der Prüfung: - - - - - - - - - - Erkannter Dokumenttyp: - - - + + + + + + + Referenz: + + + + + + + + + + Zeitpunkt der Prüfung: + + + + + + + + + + Erkannter Dokumenttyp: + + + + + + + + + + + + + @@ -125,35 +137,44 @@ - + + font-weight="bold" + border-style="solid"> - Type + Type - Code + Code - Schwere + Schwere - Text + Text - + - - + + - + - Es gibt weder Hinweise noch Fehler. + Es gibt keine Hinweise, Warnungen oder Fehler. @@ -164,62 +185,113 @@ - - - - - - - - - - - - - - - - - - - red - Fehler - - - Hinweis - - + + + + + red + + + orange + + + black + + + + + + + Fehler + + + Warnung + + + Hinweis + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - red - - + + - - - - - red - - + + + + + + + + + + + + + + + + + + + + + + + select="'black'"/> @@ -234,10 +306,22 @@ - - - - + + + + + + + + + + + + + + + + + From 54c55e68be8fcacc0e356ddb1a1b10b555edbf62 Mon Sep 17 00:00:00 2001 From: Thomas Christlieb Date: Wed, 8 Jan 2025 12:58:16 +0100 Subject: [PATCH 05/13] remove wrong test methods --- .../java/org/mustangproject/ZUGFeRD/ZF2EdgeTest.java | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2EdgeTest.java b/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2EdgeTest.java index baac90df..4708b09a 100644 --- a/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2EdgeTest.java +++ b/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2EdgeTest.java @@ -274,16 +274,6 @@ public class ZF2EdgeTest extends MustangReaderTestCase { return "123"; } - @Override - public String getPaymentMeansCode() { - return "42"; - } - - @Override - public String getPaymentMeansInformation() { - return "Überweisung"; - } - /** * Create the test case * From c162f058fb443a356639139bede81cc043ebc6b9 Mon Sep 17 00:00:00 2001 From: jstaerk Date: Thu, 9 Jan 2025 07:20:02 +0100 Subject: [PATCH 06/13] working on first functionality --- .../main/java/org/mustangproject/Item.java | 16 ++++++++++++ .../ZUGFeRD/ZF2ZInvoiceImporterTest.java | 26 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/library/src/main/java/org/mustangproject/Item.java b/library/src/main/java/org/mustangproject/Item.java index 4641a0e3..3f302d63 100644 --- a/library/src/main/java/org/mustangproject/Item.java +++ b/library/src/main/java/org/mustangproject/Item.java @@ -172,6 +172,22 @@ 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 reason=stac.getAsStringOrNull("Reason"); + Allowance izac=null; + if (isChargeString.equalsIgnoreCase("false")) { + izac = new Allowance(); + } + + izac.setPercent(new BigDecimal(percentString)); + izac.setReason(reason); + addAllowance(izac); + }); + + }); if (recalcPrice && !BigDecimal.ZERO.equals(quantity)) { icnm.getAsNodeMap("SpecifiedTradeSettlementLineMonetarySummation") diff --git a/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java b/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java index 75aa5324..17c1e15b 100644 --- a/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java +++ b/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java @@ -103,6 +103,32 @@ 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() { From b4aa73317084b2d6accfe5bf90694c26e7a3f276 Mon Sep 17 00:00:00 2001 From: jstaerk Date: Fri, 10 Jan 2025 08:06:54 +0100 Subject: [PATCH 07/13] use calculated price after allowances/charges and do focus on document level allowances/charges for document level allowance/charge processing only --- .../main/java/org/mustangproject/ZUGFeRD/LineCalculator.java | 2 +- .../java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/LineCalculator.java b/library/src/main/java/org/mustangproject/ZUGFeRD/LineCalculator.java index e319ec73..d17ccfec 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/LineCalculator.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/LineCalculator.java @@ -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); } diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java index 0417990d..de66b35d 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java @@ -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(); From 6f63c85b149b0a6c130ea3e37193744030387a1e Mon Sep 17 00:00:00 2001 From: jstaerk Date: Fri, 10 Jan 2025 10:39:12 +0100 Subject: [PATCH 08/13] also allow item allowances --- History.md | 4 ++- .../main/java/org/mustangproject/Item.java | 16 +++++++++--- .../ZUGFeRD/ZF2ZInvoiceImporterTest.java | 26 ------------------- 3 files changed, 16 insertions(+), 30 deletions(-) diff --git a/History.md b/History.md index a829860d..98dfa6da 100644 --- a/History.md +++ b/History.md @@ -8,7 +8,9 @@ allow to add includedNotes with type - 631 multiple invoice referenced documents - 629 - 630 #296 #565 -- +- 648 +- 651 +- 652 2.15.2 ======= diff --git a/library/src/main/java/org/mustangproject/Item.java b/library/src/main/java/org/mustangproject/Item.java index 3f302d63..8fefa87f 100644 --- a/library/src/main/java/org/mustangproject/Item.java +++ b/library/src/main/java/org/mustangproject/Item.java @@ -176,15 +176,25 @@ public class Item implements IZUGFeRDExportableItem { 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"); - Allowance izac=null; + 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); - addAllowance(izac); + + if (isChargeString.equalsIgnoreCase("false")) { + addAllowance(izac); + } else { + addCharge(izac); + } }); }); diff --git a/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java b/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java index 17c1e15b..49c5ce78 100644 --- a/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java +++ b/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java @@ -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; @@ -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() { From a99de9645dc777ad83384ee304e89d796a4d51f7 Mon Sep 17 00:00:00 2001 From: jstaerk Date: Fri, 10 Jan 2025 11:18:15 +0100 Subject: [PATCH 09/13] updated history --- History.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/History.md b/History.md index 33911ec4..4a695a1a 100644 --- a/History.md +++ b/History.md @@ -13,6 +13,9 @@ allow to add includedNotes with type - 648 - 651 - 652 +- -620 +- 653 +- 654 2.15.2 ======= From 3268dc2767393607bb7e654d3bbcc1dd8ece990e Mon Sep 17 00:00:00 2001 From: jstaerk Date: Fri, 10 Jan 2025 11:28:25 +0100 Subject: [PATCH 10/13] remove old logback --- Mustang-CLI/pom.xml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Mustang-CLI/pom.xml b/Mustang-CLI/pom.xml index 5780bd71..38fc18f8 100644 --- a/Mustang-CLI/pom.xml +++ b/Mustang-CLI/pom.xml @@ -37,11 +37,6 @@ - - ch.qos.logback - logback-classic - 1.2.13 - ch.qos.logback logback-core From 4670255e65028e257208cc5c65f666a60614e9b0 Mon Sep 17 00:00:00 2001 From: jstaerk Date: Fri, 10 Jan 2025 16:43:19 +0100 Subject: [PATCH 11/13] updated logback --- Mustang-CLI/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mustang-CLI/pom.xml b/Mustang-CLI/pom.xml index 38fc18f8..9b5e3bc9 100644 --- a/Mustang-CLI/pom.xml +++ b/Mustang-CLI/pom.xml @@ -40,7 +40,7 @@ ch.qos.logback logback-core - 1.5.13 + 1.5.16 From cc09a5825812bb62401af27778101e5bf415c971 Mon Sep 17 00:00:00 2001 From: jstaerk Date: Fri, 10 Jan 2025 16:54:03 +0100 Subject: [PATCH 12/13] added reason codes --- .../src/test/java/org/mustangproject/ZUGFeRD/ZF2PushTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2PushTest.java b/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2PushTest.java index 03c495c8..56a64b16 100644 --- a/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2PushTest.java +++ b/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2PushTest.java @@ -478,8 +478,8 @@ public class ZF2PushTest extends TestCase { .addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0))) .addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0))) .addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0))) - .addCharge(new Charge(new BigDecimal(0.5)).setTaxPercent(new BigDecimal(19))) - .addAllowance(new Allowance(new BigDecimal(0.2)).setTaxPercent(new BigDecimal(19))) + .addCharge(new Charge(new BigDecimal(0.5)).setTaxPercent(new BigDecimal(19)).setReasonCode("ABK")) + .addAllowance(new Allowance(new BigDecimal(0.2)).setTaxPercent(new BigDecimal(19)).setReasonCode("ABK")) ); String theXML = new String(ze.getProvider().getXML()); assertTrue(theXML.contains(" Date: Fri, 10 Jan 2025 17:33:21 +0100 Subject: [PATCH 13/13] updated history --- History.md | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/History.md b/History.md index 4a695a1a..701106d8 100644 --- a/History.md +++ b/History.md @@ -1,21 +1,25 @@ -- 639 -- 633 --626, --622, --356 -allow to add includedNotes with type -- - 645 -- 631 multiple invoice referenced documents -- 629 -- 630 #296 #565 -- 657 -- 658 -- 648 -- 651 -- 652 -- -620 -- 653 -- 654 + +2.16.0 +======= +2025-01-10 +- #657 allow allowancechargereasoncodes on document level +- allow to add includedNotes with type +- #356 print version of xml report +- #645 Fix visualization of validation logs +- #639 Fix invoice calculation if rounding amount is present +- #633 Bump ch.qos.logback:logback-core from 1.2.13 to 1.5.13 +- #626 Fix minor java issues +- #622 Fix FOP config +- #631 multiple invoice referenced documents +- #629 Visualizing xml +- #630 Fix issue #296 (Validation-Error: Ungültiger Content wurde beginnend mit Element 'ram:DueDateDateTime' ) (duplicate of #565) +- #658 prevent nullpointerexception +- #648 Fix log visualization +- #651 ZUGFeRDInvoiceImporter: Item-Allowances not imported +- #652 Discount VAT is not subtracted from duepayable +- #620 Fix logback config +- #653 ZF2EdgeTest: methods 'getPaymentMeansCode()' & 'getPaymentMeansInformation()' does not override super methods +- #654 remove wrong test methods 2.15.2 =======