fixes ksef
This commit is contained in:
parent
7d426a0dab
commit
0e86783324
4 changed files with 43 additions and 47 deletions
|
|
@ -246,6 +246,12 @@ public class KSeFAdapter implements SignalAdapter {
|
||||||
// Due date - written at the end of the XML tree
|
// Due date - written at the end of the XML tree
|
||||||
model.setDueDateTime(workitem.getItemValueLocalDate("invoice.duedate"));
|
model.setDueDateTime(workitem.getItemValueLocalDate("invoice.duedate"));
|
||||||
|
|
||||||
|
// Strip all XML comments from the document. The template comments
|
||||||
|
// are useful for template maintainers but should not appear in
|
||||||
|
// the final invoice that is submitted to KSeF or reviewed by
|
||||||
|
// tax advisors.
|
||||||
|
stripComments(model.getRoot().getOwnerDocument());
|
||||||
|
|
||||||
// Persist the modified template
|
// Persist the modified template
|
||||||
fileDataXMLTemplate.setContent(model.getContent());
|
fileDataXMLTemplate.setContent(model.getContent());
|
||||||
|
|
||||||
|
|
@ -537,4 +543,38 @@ public class KSeFAdapter implements SignalAdapter {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes all XML comment nodes from the given document.
|
||||||
|
* <p>
|
||||||
|
* The KSeF template carries comments to help template maintainers
|
||||||
|
* (field explanations, fixed-value markers, business rules). These
|
||||||
|
* comments must not appear in the final invoice that is submitted
|
||||||
|
* to KSeF or reviewed by the tax advisor - they only add noise.
|
||||||
|
*/
|
||||||
|
private void stripComments(Document doc) {
|
||||||
|
if (doc == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
removeCommentsRecursive(doc);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursively walks a node and removes every direct child that is an
|
||||||
|
* XML comment. Iterates from the last child backwards so that
|
||||||
|
* removing a node does not affect the index of the still-to-visit
|
||||||
|
* children.
|
||||||
|
*/
|
||||||
|
private void removeCommentsRecursive(Node node) {
|
||||||
|
Node child = node.getLastChild();
|
||||||
|
while (child != null) {
|
||||||
|
Node previous = child.getPreviousSibling();
|
||||||
|
if (child.getNodeType() == Node.COMMENT_NODE) {
|
||||||
|
node.removeChild(child);
|
||||||
|
} else if (child.hasChildNodes()) {
|
||||||
|
removeCommentsRecursive(child);
|
||||||
|
}
|
||||||
|
child = previous;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
<AdresL2></AdresL2>
|
<AdresL2></AdresL2>
|
||||||
</Adres>
|
</Adres>
|
||||||
|
|
||||||
<!---
|
<!--
|
||||||
Contact information from buyer can be left
|
Contact information from buyer can be left
|
||||||
<DaneKontaktowe>
|
<DaneKontaktowe>
|
||||||
<Email></Email>
|
<Email></Email>
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,9 @@
|
||||||
<Naglowek>
|
<Naglowek>
|
||||||
<KodFormularza kodSystemowy="FA (3)" wersjaSchemy="1-0E">FA</KodFormularza>
|
<KodFormularza kodSystemowy="FA (3)" wersjaSchemy="1-0E">FA</KodFormularza>
|
||||||
<WariantFormularza>3</WariantFormularza>
|
<WariantFormularza>3</WariantFormularza>
|
||||||
<DataWytworzeniaFa>2026-04-28T18:45:18.527334Z</DataWytworzeniaFa>
|
<DataWytworzeniaFa>2026-04-28T19:34:07.576916Z</DataWytworzeniaFa>
|
||||||
<SystemInfo>Imixs eInvoice</SystemInfo>
|
<SystemInfo>Imixs eInvoice</SystemInfo>
|
||||||
</Naglowek>
|
</Naglowek>
|
||||||
<!-- Seller (Your Polish Company - Pre-filled) -->
|
|
||||||
<Podmiot1>
|
<Podmiot1>
|
||||||
<PrefiksPodatnika>PL</PrefiksPodatnika>
|
<PrefiksPodatnika>PL</PrefiksPodatnika>
|
||||||
<DaneIdentyfikacyjne>
|
<DaneIdentyfikacyjne>
|
||||||
|
|
@ -24,12 +23,8 @@
|
||||||
<Email>MBudas@alexander-logistics.com</Email>
|
<Email>MBudas@alexander-logistics.com</Email>
|
||||||
</DaneKontaktowe>
|
</DaneKontaktowe>
|
||||||
</Podmiot1>
|
</Podmiot1>
|
||||||
<!-- Buyer (Customer - Empty, to be filled) -->
|
|
||||||
<Podmiot2>
|
<Podmiot2>
|
||||||
<DaneIdentyfikacyjne>
|
<DaneIdentyfikacyjne>
|
||||||
<!-- NIP falls eine PL Ust Vorliegt
|
|
||||||
ansonsten NrID - geht immer -->
|
|
||||||
<!-- <Nazwa>#Customer Name#</Nazwa> -->
|
|
||||||
<NIP>1234567890</NIP>
|
<NIP>1234567890</NIP>
|
||||||
<Nazwa>Test Sp. z o.o.</Nazwa>
|
<Nazwa>Test Sp. z o.o.</Nazwa>
|
||||||
</DaneIdentyfikacyjne>
|
</DaneIdentyfikacyjne>
|
||||||
|
|
@ -38,64 +33,36 @@
|
||||||
<AdresL1>ul. Testowa 1</AdresL1>
|
<AdresL1>ul. Testowa 1</AdresL1>
|
||||||
<AdresL2>00-001 Warszawa</AdresL2>
|
<AdresL2>00-001 Warszawa</AdresL2>
|
||||||
</Adres>
|
</Adres>
|
||||||
<!---
|
|
||||||
Contact information from buyer can be left
|
|
||||||
<DaneKontaktowe>
|
|
||||||
<Email></Email>
|
|
||||||
<Telefon></Telefon>
|
|
||||||
</DaneKontaktowe>
|
|
||||||
-->
|
|
||||||
<NrKlienta>D-12345</NrKlienta>
|
<NrKlienta>D-12345</NrKlienta>
|
||||||
<JST>2</JST>
|
<JST>2</JST>
|
||||||
<!-- fixed -->
|
|
||||||
<GV>2</GV>
|
<GV>2</GV>
|
||||||
<!-- fixed -->
|
|
||||||
</Podmiot2>
|
</Podmiot2>
|
||||||
<!-- Invoice Data -->
|
|
||||||
<Fa>
|
<Fa>
|
||||||
<KodWaluty>PLN</KodWaluty>
|
<KodWaluty>PLN</KodWaluty>
|
||||||
<P_1>2025-02-10</P_1>
|
<P_1>2025-02-10</P_1>
|
||||||
<!-- Invoice Date -->
|
|
||||||
<P_1M>Szczecin</P_1M>
|
<P_1M>Szczecin</P_1M>
|
||||||
<P_2>FV/2025/001</P_2>
|
<P_2>FV/2025/001</P_2>
|
||||||
<!-- Invoice Number -->
|
|
||||||
<P_6>2026-04-28</P_6>
|
<P_6>2026-04-28</P_6>
|
||||||
<!-- Due Date -->
|
|
||||||
<!-- ============================================================
|
|
||||||
VAT summary fields - filled by KSeFInvoiceLineBuilder.
|
|
||||||
Empty placeholders ensure correct XSD sequence. Unused
|
|
||||||
placeholders are removed by the builder before serialization.
|
|
||||||
============================================================ -->
|
|
||||||
<P_13_1>10000.00</P_13_1>
|
<P_13_1>10000.00</P_13_1>
|
||||||
<P_14_1>2300.00</P_14_1>
|
<P_14_1>2300.00</P_14_1>
|
||||||
<P_15>12300.00</P_15>
|
<P_15>12300.00</P_15>
|
||||||
<Adnotacje>
|
<Adnotacje>
|
||||||
<!-- 1 yes - 2 no -->
|
|
||||||
<P_16>2</P_16>
|
<P_16>2</P_16>
|
||||||
<!-- Keine Selbstfakturierung -->
|
|
||||||
<P_17>2</P_17>
|
<P_17>2</P_17>
|
||||||
<!-- Kein Reverse Charge -->
|
|
||||||
<P_18>2</P_18>
|
<P_18>2</P_18>
|
||||||
<!-- Kein Split Payment (Rechnung unter 15.000 PLN/EUR) -->
|
|
||||||
<P_18A>2</P_18A>
|
<P_18A>2</P_18A>
|
||||||
<!-- Keine Steuerbefreiung -->
|
|
||||||
<Zwolnienie>
|
<Zwolnienie>
|
||||||
<P_19N>1</P_19N>
|
<P_19N>1</P_19N>
|
||||||
</Zwolnienie>
|
</Zwolnienie>
|
||||||
<!-- Keine neuen Verkehrsmittel -->
|
|
||||||
<NoweSrodkiTransportu>
|
<NoweSrodkiTransportu>
|
||||||
<P_22N>1</P_22N>
|
<P_22N>1</P_22N>
|
||||||
</NoweSrodkiTransportu>
|
</NoweSrodkiTransportu>
|
||||||
<!-- Kein vereinfachtes Verfahren nach Art. 135 -->
|
|
||||||
<P_23>2</P_23>
|
<P_23>2</P_23>
|
||||||
<!-- Keine Margenregelung -->
|
|
||||||
<PMarzy>
|
<PMarzy>
|
||||||
<P_PMarzyN>1</P_PMarzyN>
|
<P_PMarzyN>1</P_PMarzyN>
|
||||||
</PMarzy>
|
</PMarzy>
|
||||||
</Adnotacje>
|
</Adnotacje>
|
||||||
<!-- Invoice Type (VAT) -->
|
|
||||||
<RodzajFaktury>VAT</RodzajFaktury>
|
<RodzajFaktury>VAT</RodzajFaktury>
|
||||||
<!-- Invoice Positions: FaWiersz -->
|
|
||||||
<FaWiersz>
|
<FaWiersz>
|
||||||
<NrWierszaFa>1</NrWierszaFa>
|
<NrWierszaFa>1</NrWierszaFa>
|
||||||
<P_7>Transport Berlin - Warsaw</P_7>
|
<P_7>Transport Berlin - Warsaw</P_7>
|
||||||
|
|
@ -119,21 +86,10 @@
|
||||||
<P_12>23</P_12>
|
<P_12>23</P_12>
|
||||||
</FaWiersz>
|
</FaWiersz>
|
||||||
<Platnosc>
|
<Platnosc>
|
||||||
|
|
||||||
<!-- Setzen der Zahlungsart (immer 6)
|
|
||||||
* 1 – Barzahlung
|
|
||||||
* 2 – Karte
|
|
||||||
* 3 – Gutschein
|
|
||||||
* 4 – Scheck
|
|
||||||
* 5 – Kredit
|
|
||||||
* 6 – Überweisung
|
|
||||||
* 7 – Mobilzahlung
|
|
||||||
-->
|
|
||||||
<TerminPlatnosci>
|
<TerminPlatnosci>
|
||||||
<Termin>2025-03-10</Termin>
|
<Termin>2025-03-10</Termin>
|
||||||
</TerminPlatnosci>
|
</TerminPlatnosci>
|
||||||
<FormaPlatnosci>6</FormaPlatnosci>
|
<FormaPlatnosci>6</FormaPlatnosci>
|
||||||
<!-- BANKEN-->
|
|
||||||
<RachunekBankowy>
|
<RachunekBankowy>
|
||||||
<NrRB>PL79116022020000000654306674</NrRB>
|
<NrRB>PL79116022020000000654306674</NrRB>
|
||||||
<SWIFT>BIGBPLPWXXX</SWIFT>
|
<SWIFT>BIGBPLPWXXX</SWIFT>
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
<AdresL2></AdresL2>
|
<AdresL2></AdresL2>
|
||||||
</Adres>
|
</Adres>
|
||||||
|
|
||||||
<!---
|
<!--
|
||||||
Contact information from buyer can be left
|
Contact information from buyer can be left
|
||||||
<DaneKontaktowe>
|
<DaneKontaktowe>
|
||||||
<Email></Email>
|
<Email></Email>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue