Sending Invoices to the National System of e-Invoices
Polish Localization for Business Central offers a functionality for sending structured invoices directly to the National System of e-Invoices. Document sending and invoice posting are asynchronous processes. When posting an invoice or credit memo to be sent to the National System of e-Invoices in a standard way, a document is created in the form of an xml file. The structured invoice is a file compliant with the schema provided by the Ministry of Finance.
To open a list of all documents sent to the National System of e-Invoices:
Choose the
icon, enter NSeI Outgoing Documents, and then select a related link.The NSeI Outgoing Document page lists all outgoing documents sorted by the Document Date field value by default. The page contains all the necessary information about the document that was sent:
- Source Document Type - Specifies the type of a source document. The following options are available:
- Sales Invoice,
- Sales Credit Memo,
- Prepayment Sales Invoice,
- Prepayment Sales Credit Memo,
- Service Invoice,
- Service Credit Memo.
- Source Document No. - Specifies the number of the document posted in the Business Central.
- Document Date - Specifies the date of the document posted within the system.
- Status - Specifies the processing status of the document. A document sent to the NSeI can have the following statuses:
- New - the document has been posted in the system, but not sent to the NSeI,
- Sending In Process - the document has been sent to KSeF, but the session is in progress.
- Sent - the document has been sent to the NSeI.
- NSeI Document No. Received - the document number that has been assigned in the National System of e-Invoices has been sent as a response and received. This means that the invoice has been received and registered in the National System of e-Invoices. Presently, this status is not supported. The NSeI document number is copied from the Official Receipt Certificate.
- Official Receipt Certificate Received - Specifies that the Official Receipt Certificate has been downloaded for the document. This means that the invoice has been accepted and registered in the National System of e-Invoices and the Official Receipt Certificate has been generated.
- NSeI Info Updated - Specifies that document data has been updated in Business Central based on the Official Receipt Certificate. This means that the NSeI document number and the date when the document was issued have been updated in linked entries and on the posted document.
- Skipped - The document was skipped when sending to NSeI and the related sales/service document was marked as Skip on Sending to NSeI.
- Error - The document was successfully sent to the NSeI, but it was not processed correctly by NSeI. The details are described in the NSeI Status Code and NSeI Status Description fields.
- NSeI Status Code - Specifies the status downloaded from the National e-Invoicing System in the form of a numeric code.
- NSeI Status Description - Specifies the status description downloaded from the National e-Invoicing System in the form of a text description.
Warning
Status descriptions are sent only in the Polish language.
Session Reference No. - Specifies the unique reference number that was received from the National System of e-Invoices that identifies the online session that was run to send the document.
NSeI Document No. - Specifies the NSeI document number that is unique and identifies the invoice in the National System of e-Invoices. It consists of the following elements: Buy-from VAT Reg. No. -invoice date in YYYYMMDD date format-6-character technical element-6-character technical element-2-character control sum.
Invoice Reference No. - Specifies the invoice reference number received from the NSeI. It is a technical number that identifies a document in an online session.
Invoicing Mode - Specifies the mode of sending the invoice to the NSeI. Depending on the date the document was sent to the NSeI, the following modes can be used:
- Online - the invoice was sent to the NSeI on the date specified in field P_1, i.e the date when the structured invoice was issued.
- Offline - the invoice was sent to the NSeI on the date specified in field P_1, i.e the date after the structured invoice was issued.
Doc. Sent to NSeI Date - Specifies the date when the document was sent to the National System of e-Invoices from Business Central.
Doc. Sent to NSeI Time - Specifies the time when the document was sent to the National System of e-Invoices from Business Central.
Doc. Received by NSeI Date - Specifies the date when the document was received in the NSeI.
Doc. Received by NSeI Time - Specifies the time when the document was received in the NSeI.
NSeI No. Assignment Date - Specifies the date when the NSeI number was assigned.
NSeI No. Assignment Time - Specifies the time when the NSeI number was assigned.
XML File Size (bytes) - Specifies the size of the XML file in bytes.
NSeI Outgoing Batch No. - Specifies the number of the NSeI batch in which the given invoice was sent.
Sending a Selected Document to the National System of e-Invoices via an Online Session
To send a structured invoice to the National System of e-Invoices and process the document:
Choose the
icon, enter NSeI Outgoing Documents, and then select a related link.On the NSeI Outgoing Documents list page, select the document you want to send to the National System of e-Invoices.
Choose the Send Selected Document to NSeI action. If the document is processed without errors, the document should have the NSeI Info Updated status.
Note
If the sending process fails in step one, e.g. due to temporary unavailability of NSeI, you should download the ORC for the session.
Sending Multiple Documents to the National System of e-Invoices via an Online Session
To send a structured invoice to the National System of e-Invoices and process the document:
Choose the
icon, enter NSeI Outgoing Documents, and then select a related link.Choose the Job Queue 1 - Send to NSeI with Online Session action. As a result, an online session will be initiated and all documents with the New status will be sent to the National System of e-Invoices. The status of the affected documents will be updated to Sending in Progress, and Sent. If the document is sent successfully, the National System of e-Invoices sends back a session reference number and element reference number for each outgoing document.
Choose the Job Queue 2 - Process Session Online Sessions action to end active sessions. In the National System of e-Invoices, Official Receipt Certificates can only be obtained only for completed online sessions.
Choose the Job Queue 3 - Process NSeI ORC action. As a result, an interactive session will be initiated and Business Central will attempt the Official Receipt Certificate (ORC) for completed online sessions, for which an ORC has not been downloaded yet. The time for generating the ORC is not specified and the process can take a longer time. If the Official Receipt Certificate is ready for downloading from the NSeI, it is saved as an .xml file in the Business Central database. Each ORC contains information about all invoices sent within an online session. The document status will be updated for each document for which the ORC has already been downloaded to Official Receipt Certificate Received, and the NSeI Document No and NSeI Document Receipt Date field values will be updated.
Choose the Job Queue 4 - NSeI Ledgers Update action to update the data stored in [!INCLUDE Business_Central_md] for invoices processed in the National System of e-Invoices. For all documents that have the Official Receipt Certificate Received status, the information downloaded from the National System of e-Invoices will be updated in related entries and posted documents, including: NSeI Document No and NSeI Document Receipt Date. If the update is successful, the NSeI Info Updated status is set for all processed documents.
Note
All actions related to the processing of documents to be sent to the National System of e-Invoices can be configured by using a standard job queue.
Job Queue 1 - Send to NSeI - codeunit *ITI Send Document To NSeI,
Job Queue 2 - Process Session Online Sessions - codeunit ITI Process NSeI Sessions,
Job Queue 3 - Process NSeI ORC - codeunit ITI Process NSeI ORC,
Job Queue 4 - NSeI Ledgers Update - codeunit ITI NSeI Ledgers Update.
Sending Multiple Documents to the National System of e-Invoices via an Online Session
Batch sending is intended for sending multiple invoices to the NSeI. You can send multiple invoices in a single ZIP file, instead of sending each invoice separately.
Warning
To send invoices in batches, use Azure Functions. For more details, see the article Configuring Additional Components on Azure Resources.
Set up a Document Sending Profile
To create a profile that will be used to send a batch of invoices to the NSeI:
Choose
icon, enter NSeI Sending Profiles, and then select a related link.On the NSeI Sending Profiles page, select New.
On the NSeI Outgoing Profile page, complete the following fields:
No. - Specifies the number of the profile that will be used to send documents to the NSeI.
Description - Specifies the description of the profile that will be used to send documents to the NSeI.
Session Type - Specifies the NSeI session type that will be used to send invoices. You can choose one of two session types:
- Online - invoices will be sent in an interactive session,
- Batch - invoices will be sent in a batch session.
Max. Number of Documents per Batch - Specifies the maximum number of documents in a batch (default value: 100 documents). If the number of invoices ready to be sent that is shown on the NSeI Incoming Documents page is greater than the specified maximum number of documents in a batch, the system will automatically create multiple batches.
Max. Number of Documents per Online Session - Specifies the maximum number of documents sent during one online session: the default value is 30 documents). If the number of invoices ready to be sent that is shown on the NSeI Outgoing Documents page is greater than the specified maximum number of documents in an online session, the system will automatically create multiple online sessions.
Sending Batches to the National System of e-Invoices
To send a batch of structured invoices to the National System of e-Invoices and perform all steps to process the document:
Choose the
icon, enter NSeI Outgoing Documents, and then select a related link.Choose the Job Queue Batch Process, Create NSeI Outgoing Batch actions to create a batch as set for the default sending profile that was defined on the NSeI Setup page. After the batch is created, the number of the batch that included a given outgoing invoice will be saved in the NSeI Outgoing Batch No. field.
Important
The system creates batches that contain all invoices with the New status that have not been sent yet and have not been assigned to any other invoice batch.
Note
You can view batches on the NSeI Outgoing Batches page.
Choose the Job Queue Batch Process, Send Batch to NSeI to send the batch to the NSeI.
If the documents are processed without errors, the batches should be assigned the Official Receipt Certificate Received status.
Choose the Update NSeI Information action to update the data stored for invoices processed in the National System of e-Invoices. For all documents that have the Official Receipt Certificate Received status, the information downloaded from the National System of e-Invoices will be updated in related entries and posted documents, including: NSeI Document No and NSeI Document Receipt Date. If the update is successful, the NSeI Info Updated status is set for all processed documents.
Note
All actions related to the processing of documents to be sent to the National System of e-Invoices can be configured by using a standard job queue.
Job Queue 1 - Create Outgoing Batch - codeunit ITI NSeI Outgoing Batch Impl,
Job Queue 2 - Send Batch to NSeI - *codeunit ITI NSeI Batch Session Impl,
Job Queue 4 - NSeI Ledgers Update - codeunit ITI NSeI Ledgers Update.
NSeI Outgoing Batches
To check the list of batches and their statuses:
Choose the
icon, enter NSeI Outgoing Batches, and then select a related link.The NSeI Outgoing Batches page lists all invoice batches that have been created. Each column provides detailed information:
- No. - Specifies the entry number.
- Session Reference No. - Specifies the number assigned in the NSeI system.
- Batch Status - Specifies the status of the batch, which can take the following values:
- New - a new batch,
- Created - the batch was created but not sent to the NSeI,
- Sending - the batch has been sent to the NSeI,
- Receiving - the batch was received in the NSeI,
- Failed - the batch contains errors,
- Completed - the batch was processed.
- Created At - Specifies the date and time when the batch was created.
- Last Modified At - Specifies the date and time when the batch was modified last time.
- Number of Documents - Specifies the number of documents in the batch.
- NSeI Sending Profile - Specifies the profile that was used to send the package to KSeF.
Skipping a Document when Sending to the NSeI
If you do not want to send a posted document to the NSeI, you can mark such a document as Skip on Sending to NSeI.
To skip a document when sending to the NSeI:
- Choose the
icon, enter NSeI Outgoing Documents, and then select a related link. - In the list, select the document you want to mark as Skip on Sending to NSeI.
- In the action bar, choose Actions, Skip on Sending to NSeI, and then confirm the change.
- The Skip on Sending to NSeI action marks the posted document as Skip on Sending to NSeI, and as Skipped on the NSeI Outgoing Documents.
Warning
Once the document status has been changed to Skipped, it is not possible to restore the New status and re-send the document to the NSeI. To cancel this invoice, post a credit memo or post entries that reverse the original document. The credit memo should also be marked as Skip on Sending to NSeI. Both documents should be marked as Skip in VAT Register.
Get ORC for a Session
If the documents have not been processed correctly when sending invoices to the NSeI and do not have a NSeI number, you should download the Official Receipt Confirmation for the indicated session. To download the Official Receipt Certificate:
Choose the
icon, enter NSeI Sessions, and then select a related link.In the list, select the session for which you want to download the ORC.
On the action bar, select Close Session, and then Get ORC for Session.
After all documents sent during the session are processed successfully, their status should change into Official Receipt Certificate Received so that you can update entries and posted documents.
On the NSeI Sessions page, choose the Open NSeI ORCs for Session action to view session details on the NSeI ORC Register page.
Important
Before closing the session, we recommend checking the invoice status for a given session by using: the Update Status from NSeI action on the NSeI Outgoing Documents page. The ORC can only be downloaded for a document with a status code of 200.
Note
If the session did not end with the download of the ORC, you can retrieve the current session status on the NSeI Sessions page by choosing the Get Session Status action.
Structured Invoice Preview
There are different ways to view, save and send a preview of a structured invoice, which is:
- a preview of the schema, which displays the created lines of the outgoing NSeI document or download the .xml file with the invoice;
- invoice visualization, which is a graphical preview of the document.
- sending a preview of an invoice from the NSeI to a PDF file as an attachment in a document header in the system or saved on a disk;
- creating an e-mail message with the NSeI invoice preview saved to a PDF file as an attachment.
Schema Preview
To preview the structured invoice in tabular layout:
Choose the
icon, enter NSeI Outgoing Documents, and then select a related link.On the NSeI Outgoing Documents page, select the document, and then select the Show NSeI Outgoing Document Lines action .
On the NSeI Invoice page, you can view the whole document that contains elements and element values in as a simplified view of the .xml file that is sent to the National System of e-Invoices.
To preview the structured invoice in .xml file format:
Choose the
icon, enter NSeI Outgoing Documents, and then select a related link.On the NSeI Outgoing Documents page, select a document, and then run the Show NSeI Outgoing Document XML File action.
The .xml file representing the structured invoice will be displayed in the browser. Save the file.
Document Visualization
To view a structured invoice visualization:
Choose the
icon, enter NSeI Outgoing Documents, and then select a related link.On the NSeI Outgoing Documents page, select the document, and then choose the Preview NSeI Invoice action .
A visualization of the document will be displayed on the screen.
Sending a Preview of an Invoice from the NSeI to a PDF File
To send a preview of an invoice from the NSeI to a PDF file:
Choose the
, enter Posted Sales Invoices, and then select a related link.On the Posted Sales Invoices page, select the invoice for which you want to send a preview of the invoice from the NSeI to a PDF file.
On the Posted Sales Invoice page, choose the action, and then run the Send NSeI Preview to PDF File action to preview the NSeI invoice.
When closing the page, decide what you want to do by selecting one of the available options:
- Do not save - the invoice preview is not to be saved.
- Save as PDF - the NSeI invoice preview will be saved to a PDF file and saved.
- Attach as PDF - the NSeI invoice preview will be saved to a PDF file and saved.
[!NOTE]
You can save a NSeI invoice preview to a PDF file from posted sales/service invoices and sales/service credit memos, as well as posted and unposted purchase invoices and purchase credit memos and the NSeI Incoming Documents list page.
Sending an E-mail Message with the NSeI Invoice Preview as a PDF File Attachment
To send the NSeI invoice preview saved into a PDF file as an email attachment:
Choose the
icon, enter Posted Sales Invoices, and then select a related link.On the Posted Sales Invoices page, select the invoice for which you want to send a NSeI invoice preview to a PDF file as an email attachment.
On the Posted Sales Invoice page, select the action, then run the Send Document by E-mail action to display and save the NSeI invoice preview as a .pdf attachment and open the e-mail message window.
In the e-mail message window, the To field (recipient) will be filled with the e-mail address from the customer card, and the subject will include the document type, document number, and NSeI document number. The name of the attached .pdf file includes the number and NSeI document number. If there is no NSeI number, it will be replaced with the note OFFLINE.
Note
Sending the NSeI invoice visualization saved as a PDF file as an email attachment is available from the posted invoices and sales credit memos, as well as from the NSeI Incoming Documents and NSeI Outgoing Documents list pages. On the NSeI Incoming Documents list page, you can use a new Send Manually Document by E-mail action to send the document to the specified address.
NSeI Official Receipt Certificate
The NSeI Official Receipt Certificate formally confirms that the documents sent electronically to the National System of e-Invoices have been received and processed. As part of the integration with the National System of e-Invoices, Polish Localization for Business Central also enables you to download the ORC for the documents that have been sent to the National System of e-Invoices.
To view the list of downloaded ORCs:
Choose
icon, enter NSeI ORC Register, and then select a related link.The NSeI ORC Register page contains all Official Receipt Certificates downloaded from the National System of e-Invoices.
- Reference No. - Specifies the number assigned in the NSeI system for the associated session.
- Status - Specifies the status of processing the Official Receipt Certificate in Business Central. The processing status can have the following values:
- New - the Official Receipt Certificate has been downloaded from the National System of e-Invoices, but has not been processed.
- Processed - the Official Receipt Certificate has been received and its data has been updated for the documents within an online session. The processing of the Official Receipt Certificate results in the update of the NSeI Document No. and NSeI Document Receipt Date fields on the NSeI Outgoing Documents page for all invoices sent within the related online session.
- Session Reference No. - Specifies the number assigned in the NSeI system for the associated session.
- To download the .xml file for the Official Receipt Certificate, choose the Get ORC in XML action.
Note
If the OCR has not been processed, choose the Process ORC action on the NSeI ORC Register page to download the OCR from the NSeI.
NSeI Sessions
Sessions are used to send documents to the National e-Invoicing System. There are two types of sessions:
- Online - used to send single documents,
- Batch - used to send document batches.
To check the list of sessions and their statuses:
Choose the
icon, enter NSeI Sessions, and then select a related link.The NSeI Sessions page lists all sessions that have been established so far from [!INCLUDE Business_Central_md]. Each column provides detailed information:
- Initialization Date - Specifies the date and time when the session was initiated.
- Last Activity Date - Specifies the last date and time when the session was used.
- Session Type - Specifies the type of the session that is initiated. Possible types are:
- Online - used to send single documents,
- Batch - used to send document batches.
- Reference No. - Specifies the number assigned in the NSeI system.
- Status - Specifies the session status.
- NSeI Status Code - Specifies the status code retrieved from the NSeI.
- NSeI Status Description - Specifies the status desciption retrieved from the NSeI.
- Number of Documents in Session - Specifies the number of sales documents uploaded during a session.
Note
To view the list of sessions, select the session number in the Session Reference Number field on the NSeI Outgoing Documents page.
QR Code Generation for Offline Mode
If it is required that invoices should contain a QR code to verify the identity of the issuer (OFFLINE type), you need to set up Offline Certificate and manually generate the QR code for each invoice.
- Choose the
icon, enter NSeI Outgoing Documents, and then select a related link. - In the list, select the document for which you want to generate an Offline QR code.
- In the action bar, choose Actions, Offline, Create Offline QR Code and then confirm the change.
- As a result of the Create Offline QR Code action, an Offline QR Code is created for the posted document.
Printing the Transaction Confirmation
For domestic invoices, if it is not possible to send the document to the National e-Invoicing System, it is possible to print a transaction confirmation containing two QR codes:
- Verification QR Code - used to verify the invoice after it has been sent to the KSeF.
- Certificate QR Code - used to confirm the authenticity of the issuer on the basis of the NSeI certificate. This code should be generated before printing the transaction confirmation, in the manner described above.
To print the transaction confirmation:
- Choose the
icon, enter NSeI Outgoing Documents, and then select a related link.
Note
Printing is also possible from the level of the posted document.
- On the NSeI Outgoing Documents page, select the document, and then select the Print Confirmation action .
NSeI Document Number in Entries
To facilitate the verification of entries related to documents sent to or received from the NSeI, the NSeI Document No. field has been added to the following ledgers as part of Polish Localization:
- VAT Entry
- Detailed VAT Entry
- Customer Ledger Entry
- Vendor Ledger Entry
- General Ledger Entry
The NSeI Document No. field was added to the general ledger entries at a later date; therefore, it may be necessary to update historical entries. To do so:
Choose the
icon, enter General Ledger Entries, and then select a related link.On the General Ledger Entries page, select Functions - Update NSeI No. on G/L Entries from the action bar.
Enter the date from which the records should be updated, and choose OK.
See Also
Setting up Integration with the National System of e-Invoices
Issuing and Posting a Structured Invoice
Invoicing Modes and NSeI Unavailability Log
Downloading Purchase Invoices from the National System of e-Invoices
Processing Purchase Invoices Downloaded from the NSeI
Entering an NSeI Number or a Designation for a Missing NSeI Numberr