update ksef

This commit is contained in:
Ralph Soika 2025-12-11 16:44:15 +01:00
parent 5f4de3e432
commit 851519dbbd
5 changed files with 263 additions and 13 deletions

8
doc/KSeF/TEST.md Normal file
View file

@ -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 |

View file

@ -163,6 +163,7 @@ public class KSeFAdapter implements SignalAdapter {
// set Tax Type based on vatID // set Tax Type based on vatID
((EInvoiceModelKSeF) model).setTaxType(workitem.getItemValueString("partner.vat")); ((EInvoiceModelKSeF) model).setTaxType(workitem.getItemValueString("partner.vat"));
workitem.setItemValue("invoice.tax.type", ((EInvoiceModelKSeF) model).getTaxType());
// Update Invoice Type (RodzajFaktury) -> VAT | KOR // Update Invoice Type (RodzajFaktury) -> VAT | KOR
Element elementFa = model.findOrCreateChildNode(model.getRoot(), EInvoiceNS.KSEF, "Fa"); Element elementFa = model.findOrCreateChildNode(model.getRoot(), EInvoiceNS.KSEF, "Fa");
@ -205,13 +206,6 @@ public class KSeFAdapter implements SignalAdapter {
((EInvoiceModelKSeF) model).setRodzajFaktury("VAT"); ((EInvoiceModelKSeF) model).setRodzajFaktury("VAT");
logger.info("│ ├── invoice type=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 // set currency
model.updateElementValue(elementFa, EInvoiceNS.KSEF, "KodWaluty", model.updateElementValue(elementFa, EInvoiceNS.KSEF, "KodWaluty",
@ -226,8 +220,19 @@ public class KSeFAdapter implements SignalAdapter {
lineTotalAmount = lineTotalAmount + tradeLineItem.getTotal(); lineTotalAmount = lineTotalAmount + tradeLineItem.getTotal();
} }
// // Summenbildung // Summenbildung
model.setNetTotalAmount(workitem.getItemValueDouble("invoice.total"));
// 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")); model.setGrandTotalAmount(workitem.getItemValueDouble("invoice.total"));
// finally update the template file // finally update the template file

View file

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8"?>
<Faktura xmlns="http://crd.gov.pl/wzor/2025/06/25/13775/"
xmlns:etd="http://crd.gov.pl/xml/schematy/dziedzinowe/mf/2022/01/05/eD/DefinicjeTypy/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Naglowek>
<KodFormularza kodSystemowy="FA (3)" wersjaSchemy="1-0E">FA</KodFormularza>
<WariantFormularza>3</WariantFormularza>
<DataWytworzeniaFa>2025-12-09T14:27:11.388806362Z</DataWytworzeniaFa>
<SystemInfo>Imixs eInvoice</SystemInfo>
</Naglowek>
<!-- Seller (Your Polish Company - Pre-filled) -->
<Podmiot1>
<DaneIdentyfikacyjne>
<NIP>9552521552</NIP>
<Nazwa>Alexander Global Logistics</Nazwa>
</DaneIdentyfikacyjne>
<Adres>
<KodKraju>PL</KodKraju>
<AdresL1>Gdanska 36</AdresL1>
<AdresL2>70-660 Szczecin</AdresL2>
</Adres>
<DaneKontaktowe>
<Email>MBudas@alexander-logistics.com</Email>
</DaneKontaktowe>
</Podmiot1>
<!-- Buyer (Customer - Empty, to be filled) -->
<Podmiot2>
<DaneIdentyfikacyjne>
<!-- NIP falls eine PL Ust Vorliegt
ansonsten NrID - geht immer -->
<!-- <Nazwa>#Customer Name#</Nazwa> -->
<NIP>5252150859</NIP>
<Nazwa>Sofidel Poland Sp. z o.o.</Nazwa>
</DaneIdentyfikacyjne>
<Adres>
<KodKraju>PL</KodKraju>
<AdresL1>ul. Mleczarska 31</AdresL1>
<AdresL2> Ciechanow</AdresL2>
</Adres>
<!---
Contact information from buyer can be left
<DaneKontaktowe>
<Email></Email>
<Telefon></Telefon>
</DaneKontaktowe>
-->
<NrKlienta>D20847</NrKlienta>
<JST>2</JST>
<!-- fixed -->
<GV>2</GV>
<!-- fixed -->
</Podmiot2>
<!-- Invoice Data -->
<Fa>
<KodWaluty>PLN</KodWaluty>
<P_1>2025-12-05</P_1>
<!-- Invoice Date -->
<P_2>6555</P_2>
<!-- Invoice Number -->
<P_6>2026-02-03</P_6>
<!-- Due Date -->
<!-- Totals will only be computed by the EInvoiceModelKSeF Class-->
<!--
<P_13_1>0.00</P_13_1>
<P_14_1>0.00</P_14_1>
<P_15>0.00</P_15>
-->
<P_13_1>34944.60</P_13_1>
<Adnotacje>
<!-- 1 yes - 2 no -->
<P_16>2</P_16>
<!-- Keine Selbstfakturierung -->
<P_17>2</P_17>
<!-- Kein Reverse Charge -->
<P_18>2</P_18>
<!-- Kein Split Payment (Rechnung unter 15.000 PLN/EUR) -->
<P_18A>2</P_18A>
<!-- Keine Steuerbefreiung -->
<Zwolnienie>
<P_19N>1</P_19N>
</Zwolnienie>
<!-- Keine neuen Verkehrsmittel -->
<NoweSrodkiTransportu>
<P_22N>1</P_22N>
</NoweSrodkiTransportu>
<!-- Kein vereinfachtes Verfahren nach Art. 135 -->
<P_23>2</P_23>
<!-- Keine Margenregelung -->
<PMarzy>
<P_PMarzyN>1</P_PMarzyN>
</PMarzy>
</Adnotacje>
<!-- Invoice Type (VAT) -->
<RodzajFaktury>VAT</RodzajFaktury>
<!-- Invoice Positions: FaWiersz -->
<P_14_1>5950.10</P_14_1>
<P_15>40894.70</P_15>
<FaWiersz>
<NrWierszaFa>1</NrWierszaFa>
<UU_ID>62672612-f764-40b7-8536-7d7d94ff24a6</UU_ID>
<P_7>IM-POL-2512-015</P_7>
<P_8A>szt.</P_8A>
<P_8B>1</P_8B>
<P_9A>25870.00</P_9A>
<P_11>25870.00</P_11>
</FaWiersz>
<FaWiersz>
<NrWierszaFa>2</NrWierszaFa>
<UU_ID>16424544-9307-4eca-83f6-fe906e3385fe</UU_ID>
<P_7>IM-POL-2512-015</P_7>
<P_8A>szt.</P_8A>
<P_8B>1</P_8B>
<P_9A>9074.60</P_9A>
<P_11>9074.60</P_11>
</FaWiersz>
</Fa>
</Faktura>

View file

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?>
<Faktura xmlns="http://crd.gov.pl/wzor/2025/06/25/13775/"
xmlns:etd="http://crd.gov.pl/xml/schematy/dziedzinowe/mf/2022/01/05/eD/DefinicjeTypy/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Naglowek>
<KodFormularza kodSystemowy="FA (3)" wersjaSchemy="1-0E">FA</KodFormularza>
<WariantFormularza>3</WariantFormularza>
<DataWytworzeniaFa>2025-12-09T13:53:01.130950520Z</DataWytworzeniaFa>
<SystemInfo>Imixs eInvoice</SystemInfo>
</Naglowek>
<!-- Seller (Your Polish Company - Pre-filled) -->
<Podmiot1>
<DaneIdentyfikacyjne>
<NIP>9552521552</NIP>
<Nazwa>Alexander Global Logistics</Nazwa>
</DaneIdentyfikacyjne>
<Adres>
<KodKraju>PL</KodKraju>
<AdresL1>Gdanska 36</AdresL1>
<AdresL2>70-660 Szczecin</AdresL2>
</Adres>
<DaneKontaktowe>
<Email>MBudas@alexander-logistics.com</Email>
</DaneKontaktowe>
</Podmiot1>
<!-- Buyer (Customer - Empty, to be filled) -->
<Podmiot2>
<DaneIdentyfikacyjne>
<!-- NIP falls eine PL Ust Vorliegt
ansonsten NrID - geht immer -->
<!-- <Nazwa>#Customer Name#</Nazwa> -->
<NrID>NL823019044B01</NrID>
<Nazwa>ARAUCO EUROPE COOPERATIEF U.A.</Nazwa>
</DaneIdentyfikacyjne>
<Adres>
<KodKraju>NL</KodKraju>
<AdresL1>SCHIPHOLWEG 9C</AdresL1>
<AdresL2>2316 Leiden</AdresL2>
</Adres>
<!---
Contact information from buyer can be left
<DaneKontaktowe>
<Email></Email>
<Telefon></Telefon>
</DaneKontaktowe>
-->
<NrKlienta>D21478</NrKlienta>
<JST>2</JST>
<!-- fixed -->
<GV>2</GV>
<!-- fixed -->
</Podmiot2>
<!-- Invoice Data -->
<Fa>
<KodWaluty>EUR</KodWaluty>
<P_1>2025-12-05</P_1>
<!-- Invoice Date -->
<P_2>6562</P_2>
<!-- Invoice Number -->
<P_6>2026-01-04</P_6>
<!-- Due Date -->
<!-- Totals -->
<P_13_6_2>964.16</P_13_6_2>
<P_13_1>0.00</P_13_1>
<!-- Total Net -->
<P_14_1>0.00</P_14_1>
<!-- Total VAT -->
<P_15>964.16</P_15>
<!-- Total Gross -->
<Adnotacje>
<!-- 1 yes - 2 no -->
<P_16>2</P_16>
<!-- Keine Selbstfakturierung -->
<P_17>2</P_17>
<!-- Kein Reverse Charge -->
<P_18>2</P_18>
<!-- Kein Split Payment (Rechnung unter 15.000 PLN/EUR) -->
<P_18A>2</P_18A>
<!-- Keine Steuerbefreiung -->
<Zwolnienie>
<P_19N>1</P_19N>
</Zwolnienie>
<!-- Keine neuen Verkehrsmittel -->
<NoweSrodkiTransportu>
<P_22N>1</P_22N>
</NoweSrodkiTransportu>
<!-- Kein vereinfachtes Verfahren nach Art. 135 -->
<P_23>2</P_23>
<!-- Keine Margenregelung -->
<PMarzy>
<P_PMarzyN>1</P_PMarzyN>
</PMarzy>
</Adnotacje>
<!-- Invoice Type (VAT) -->
<RodzajFaktury>VAT</RodzajFaktury>
<!-- Invoice Positions: FaWiersz -->
<FaWiersz>
<NrWierszaFa>1</NrWierszaFa>
<UU_ID>ee4a78ca-5c55-4a55-8459-ce1ba354b386</UU_ID>
<P_7>IM-POL-2512-009</P_7>
<P_8A>szt.</P_8A>
<P_8B>1</P_8B>
<P_9A>798.81</P_9A>
<P_11>798.81</P_11>
</FaWiersz>
<FaWiersz>
<NrWierszaFa>2</NrWierszaFa>
<UU_ID>61adeef4-2a6e-4fc6-9580-038746614cf5</UU_ID>
<P_7>IM-POL-2512-009</P_7>
<P_8A>szt.</P_8A>
<P_8B>1</P_8B>
<P_9A>165.35</P_9A>
<P_11>165.35</P_11>
</FaWiersz>
</Fa>
</Faktura>

View file

@ -60,10 +60,12 @@
<P_2></P_2> <!-- Invoice Number --> <P_2></P_2> <!-- Invoice Number -->
<P_6></P_6> <!-- Due Date --> <P_6></P_6> <!-- Due Date -->
<!-- Totals --> <!-- Totals will only be computed by the EInvoiceModelKSeF Class-->
<P_13_1>0.00</P_13_1> <!-- Total Net --> <!--
<P_14_1>0.00</P_14_1> <!-- Total VAT --> <P_13_1>0.00</P_13_1>
<P_15>0.00</P_15> <!-- Total Gross --> <P_14_1>0.00</P_14_1>
<P_15>0.00</P_15>
-->
<Adnotacje> <Adnotacje>
<!-- 1 yes - 2 no --> <!-- 1 yes - 2 no -->