diff --git a/doc/KSeF/TEST.md b/doc/KSeF/TEST.md
new file mode 100644
index 0000000..03745e6
--- /dev/null
+++ b/doc/KSeF/TEST.md
@@ -0,0 +1,8 @@
+# Test Cases
+
+Invoice
+
+| No | currency | Tax % | Netto | Brutto | Status |
+| ---- | -------- | ----- | -------- | ------- | ------ |
+| 6562 | EUR | 0 | 964,16 | 964,16 | OK |
+| 6555 | PLN | 23 | 31820,10 | 40894,7 | OK |
diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/einvoice/KSeFAdapter.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/einvoice/KSeFAdapter.java
index 9f09872..a35ba0a 100644
--- a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/einvoice/KSeFAdapter.java
+++ b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/einvoice/KSeFAdapter.java
@@ -163,6 +163,7 @@ public class KSeFAdapter implements SignalAdapter {
// set Tax Type based on vatID
((EInvoiceModelKSeF) model).setTaxType(workitem.getItemValueString("partner.vat"));
+ workitem.setItemValue("invoice.tax.type", ((EInvoiceModelKSeF) model).getTaxType());
// Update Invoice Type (RodzajFaktury) -> VAT | KOR
Element elementFa = model.findOrCreateChildNode(model.getRoot(), EInvoiceNS.KSEF, "Fa");
@@ -205,13 +206,6 @@ public class KSeFAdapter implements SignalAdapter {
((EInvoiceModelKSeF) model).setRodzajFaktury("VAT");
logger.info("│ ├── invoice type=VAT");
}
- // Update Rechnungssummen...
- if (workitem.getItemValueDouble("invoice.total.tax") > 0) {
- // wir haben eine Steuer!
- model.setTaxTotalAmount(InvoiceUtil.round(workitem.getItemValueDouble("invoice.total")
- - workitem.getItemValueDouble("invoice.total.net")));
- model.setTaxRate(workitem.getItemValueDouble("invoice.total.tax"));
- }
// set currency
model.updateElementValue(elementFa, EInvoiceNS.KSEF, "KodWaluty",
@@ -226,8 +220,19 @@ public class KSeFAdapter implements SignalAdapter {
lineTotalAmount = lineTotalAmount + tradeLineItem.getTotal();
}
- // // Summenbildung
- model.setNetTotalAmount(workitem.getItemValueDouble("invoice.total"));
+ // Summenbildung
+
+ // Netto
+ model.setNetTotalAmount(workitem.getItemValueDouble("invoice.total.net"));
+
+ // Tax
+ if (workitem.getItemValueDouble("invoice.total.tax") > 0) {
+ // wir haben eine Steuer!
+ model.setTaxTotalAmount(InvoiceUtil.round(workitem.getItemValueDouble("invoice.total")
+ - workitem.getItemValueDouble("invoice.total.net")));
+ model.setTaxRate(workitem.getItemValueDouble("invoice.total.tax"));
+ }
+ // Brutto
model.setGrandTotalAmount(workitem.getItemValueDouble("invoice.total"));
// finally update the template file
diff --git a/office-alexander-logistics-app/src/test/resources/ksef/invoice-6555-ksef.xml b/office-alexander-logistics-app/src/test/resources/ksef/invoice-6555-ksef.xml
new file mode 100644
index 0000000..82a0fb2
--- /dev/null
+++ b/office-alexander-logistics-app/src/test/resources/ksef/invoice-6555-ksef.xml
@@ -0,0 +1,118 @@
+
+
+
+ FA
+ 3
+ 2025-12-09T14:27:11.388806362Z
+ Imixs eInvoice
+
+
+
+
+ 9552521552
+ Alexander Global Logistics
+
+
+ PL
+ Gdanska 36
+ 70-660 Szczecin
+
+
+ MBudas@alexander-logistics.com
+
+
+
+
+
+
+
+ 5252150859
+ Sofidel Poland Sp. z o.o.
+
+
+ PL
+ ul. Mleczarska 31
+ Ciechanow
+
+
+ D20847
+ 2
+
+ 2
+
+
+
+
+ PLN
+ 2025-12-05
+
+ 6555
+
+ 2026-02-03
+
+
+
+ 34944.60
+
+
+ 2
+
+ 2
+
+ 2
+
+ 2
+
+
+ 1
+
+
+
+ 1
+
+
+ 2
+
+
+ 1
+
+
+
+ VAT
+
+ 5950.10
+ 40894.70
+
+ 1
+ 62672612-f764-40b7-8536-7d7d94ff24a6
+ IM-POL-2512-015
+ szt.
+ 1
+ 25870.00
+ 25870.00
+
+
+ 2
+ 16424544-9307-4eca-83f6-fe906e3385fe
+ IM-POL-2512-015
+ szt.
+ 1
+ 9074.60
+ 9074.60
+
+
+
\ No newline at end of file
diff --git a/office-alexander-logistics-app/src/test/resources/ksef/invoice-6562-ksef.xml b/office-alexander-logistics-app/src/test/resources/ksef/invoice-6562-ksef.xml
new file mode 100644
index 0000000..fc32f5d
--- /dev/null
+++ b/office-alexander-logistics-app/src/test/resources/ksef/invoice-6562-ksef.xml
@@ -0,0 +1,117 @@
+
+
+
+ FA
+ 3
+ 2025-12-09T13:53:01.130950520Z
+ Imixs eInvoice
+
+
+
+
+ 9552521552
+ Alexander Global Logistics
+
+
+ PL
+ Gdanska 36
+ 70-660 Szczecin
+
+
+ MBudas@alexander-logistics.com
+
+
+
+
+
+
+
+ NL823019044B01
+ ARAUCO EUROPE COOPERATIEF U.A.
+
+
+ NL
+ SCHIPHOLWEG 9C
+ 2316 Leiden
+
+
+ D21478
+ 2
+
+ 2
+
+
+
+
+ EUR
+ 2025-12-05
+
+ 6562
+
+ 2026-01-04
+
+
+ 964.16
+ 0.00
+
+ 0.00
+
+ 964.16
+
+
+
+ 2
+
+ 2
+
+ 2
+
+ 2
+
+
+ 1
+
+
+
+ 1
+
+
+ 2
+
+
+ 1
+
+
+
+ VAT
+
+
+ 1
+ ee4a78ca-5c55-4a55-8459-ce1ba354b386
+ IM-POL-2512-009
+ szt.
+ 1
+ 798.81
+ 798.81
+
+
+ 2
+ 61adeef4-2a6e-4fc6-9580-038746614cf5
+ IM-POL-2512-009
+ szt.
+ 1
+ 165.35
+ 165.35
+
+
+
diff --git a/workflow/pl/e-invoice/templates/ksef.xml b/workflow/pl/e-invoice/templates/ksef.xml
index 8becdae..76e0401 100644
--- a/workflow/pl/e-invoice/templates/ksef.xml
+++ b/workflow/pl/e-invoice/templates/ksef.xml
@@ -60,10 +60,12 @@
-
- 0.00
- 0.00
- 0.00
+
+