Table of Contents

Downloading Purchase Invoices from the National System of e-Invoices

Polish Localization for Business Central provides a set of features for downloading structured purchase invoices from the National System of e-Invoice. The downloading process consists of two steps. In the first step, a list of purchase invoices available in the National System of e-Invoices for a business unit is downloaded. In the second step, using the NSeI document number, you can search for and download an .xml file that contains a specific structured invoice to the database.

Viewing the List of Downloaded Invoices and Downloadable Invoices

To view the list of invoices downloaded from the National System of e-Invoices:

1.Choose the Lightbulb that opens the Tell Me feature icon, enter NSeI Incoming Documents, and then select a related link.

  1. The NSeI Incoming Documents page contains all documents downloaded from the National System of e-Invoices, sorted based on the Doc. Processed by NSeI Date field by default. The page contains all the necessary information about the imported document:
  • Doc. Processed by NSeI Date - Specifies the date when the document was processed in the NSeI.
  • Doc. Processed by NSeI Time - Specifies the time was the document was processed by the NSeI.
  • NSeI Document No. - Specifies the number of the NSeI document. This is a unique number that identifies the invoice in the National System of e-Invoices.
  • Subject by - Specifies the VAT registration number of the entity that issued the purchase invoice.
  • Subject by Name - Specifies the name of an entity that issued the purchase invoice.
  • Source Document Type - Specifies the type of a source document. The following options are available:
    • Sales Invoice,
    • Sales Credit Memo.
    • Prepayment Sales Invoice,
    • Sales Prepayment Credit Memo.
  • Source Document No. - Specifies the invoice number assigned by the invoice issuer.
  • Status - Specifies the status of document processing:
    • To Download - metadata has been downloaded, but the file has not yet been downloaded from the NSeI,
    • Assigned to Download By Batch - the document has been assigned to a batch of NSeI incoming documents,
    • Downloaded - the XML file has been downloaded from the NSeI and saved in the Business Central database, but it has not been processed yet.
    • Forwarded - the PDF file has been forwarded to the e-mail address indicated on the NSeI Setup page,
    • E-document Created - an e-document has been created,
    • Purchase Document Created - a purchase document has been created,
    • Purchase Document Posted - the purchase document has been posted.
  • E-Document No. - Specifies the e-document number that is linked to the NSeI incoming document.
  • Purchase Document No. - Specifies the purchase document number that is linked to the NSeI incoming document.
  • File Size - Specifies the size of the .xml invoice file downloaded from the NSeI. The value in this field is displayed only after downloading the file from the National System of e-Invoices.
  • System Code - Specifies the system code of the .xml file.
  1. To check whether any new purchase invoices are available for downloading in the National System of e-Invoices, choose the Send Request for Documents to Download action. The query to the National System of e-Invoices is always sent for a date range. As a response, Business Central receives a list of purchase invoices available in the National System of e-Invoices that are downloadable for the company with the specified VAT Registration No. The received data is saved on the NSeI Incoming Documents page.
Note

If the incoming document list is empty, a query is created for the default date range that is: three months before the today’s date (-3M) to the today's date. If there are already incoming documents in the list, a request for new invoices is created for the date range, based on the latest invoice date specified in the NSeI Receipt Date field minus 1 day to the today’s date field.

Downloading Documents from the NSeI

You can download .xml files as NSeI incoming documents if they have Status set as To Download. Incoming documents can be downloaded individually or in batches.

Note

The download of incoming documents from the NSeI can also be configured using the standard job queue. There are a few ways to do this:

  1. Get metadata for purchase invoices: codeunit ITINSeIGetIncomingDocMetaData.
  2. Download metadata of purchase invoices and automatic download of invoice XML files based on downloaded metadata (download in interactive mode - one query per invoice): codeunit "ITI NSeI Online Incoming Doc.*
  3. Importing XML files of multiple purchase invoices as batches - you need to configure dedicated Azure Functions: Job Queue - Process NSeI Incoming Document Batches - codeunit ITI NSeI Incoming Batch.

Downloading a Single Document from the NSeI

To download the .xml file for a specific document from the NSeI:

  1. Choose the Lightbulb that opens the Tell Me feature icon, enter NSeI Incoming Documents, and then select a related link.

  2. On the NSeI Incoming Documents page, select the document for which the .xml file has not been downloaded yet (Status: To Download), choose the Download NSeI Incoming Document action. As a result, the .xml document is downloaded from the National System of e-Invoices and saved into your database. The Status field is also updated and set to Downloaded.

Downloading Multiple Documents from the NSeI Using a Batch Session

Warning

In order to download invoices in batches, use the Azure Functions service. For this purpose, you can define Business Central settings on the NSeI Setup page by choosing the Azure Function Setup action.

To download .xml files from the NSeI for selected documents:

  1. Choose the Lightbulb that opens the Tell Me feature icon, enter NSeI Incoming Documents, and then select a related link.

  2. On the NSeI Incoming Documents page, select the document for which the .xml file has not yet been downloaded (Status: To Download), and then select the Batch action, Create NSeI Incoming Document Batch. The action creates a batch of incoming documents, and changes the status of invoices into Assigned to Download By Batch.

Note

The NSeI incoming document batch will include a maximum number of invoices as indicated in the Max No. of Documents per Incoming Batch field on the NSeI Setup page.

  1. Choose the Open Related NSeI Incoming Batches action to go to the NSeI Incoming Batches page. The NSeI Incoming Batches page contains all information about incoming batches:

    • Status - Specifies the status of the incoming document batch. The following values can be selected in this field:
      • New - incoming documents have been assigned to a batch;
      • Created - the batch export process has been initiated in the NSeI;
      • Failure - an error occurred while sending or receiving the batch from the NSeI;
      • Completed - the download of documents from the NSeI has been completed.
    • NSeI Status Code - Specifies the code of the status of exporting a batch from the NSeI to the Business Central system.
    • NSeI Status Description - Specifies the description of the status of exporting a batch from the NSeI to the Business Central system.
    • Created At - Specifies the date and time when the batch was created.
    • Reference No. - Specifies the number assigned in the NSeI system.
  2. On the NSeI Incoming Batch page, select the Actions action, Initialize Batch Download to initiate the download of documents.

  3. Choose the Actions action, Download Documents to download .xml document files from the National e-Invoice System and save the files to the database. The Status field is also updated and set to Downloaded.

Note

The status of exporting documents from the NSeI to the Business Central system can be checked using the Actions, Status action on the NSeI Incoming Batch page.

Exporting an Incoming Document

To export the .xml file (and save it to a disk drive) for the incoming document:

  1. Choose the Lightbulb that opens the Tell Me feature icon, enter NSeI Incoming Documents, and then select a related link.

  2. On the NSeI Incoming Documents page, select the document for which you want to export the .xml file and save it to disk.

  3. Choose the Export NSeI Incoming Document to XML File page. You can run an action only for documents that have the Downloaded status.

Sending an Incoming Document by E-mail

To send an incoming document by e-mail:

  1. Choose the Lightbulb that opens the Tell Me feature icon, enter NSeI Incoming Documents, and then select a related link.

  2. On the NSeI Incoming Documents page, select the documents you want to send by e-mail.

  3. Choose the Send Documents by E-mail page. You can run an action only for documents that have the Downloaded status.

NSeI Document Number on Purchase Documents

The NSeI Document No. field has been added to purchase documents. During the posting process, it is copied to the posted document and to VAT entries. Whether the NSeI Document No. field is mandatory depends on how you set up the Disable NSeI for Purchase field on purchase documents and Enable NSeF for Purchase Documents fields on the NSeI Setup page.

The NSeI No. Validation Type field specifies whether the system checks for an existing NSeI incoming document or a posted purchase document with the same NSeI number when a value is entered in the NSeI Document No. field on purchase documents and in journals. The following options are available:

  • Error - the NSeI number will be validated, and if there is no incoming NSeI document or a posted purchase document with the same number, an error message will appear and the document cannot be posted; - Warning - the NSeI number will be validated, and if there is no incoming NSeI document or a posted purchase document with the same NSeI number, and a warning will appear and you will requested to decide whether the document should be posted; - None - no validation of the NSeI number is performed in the system (the string entered must match the format of the NSeI number).

See Also

Setting up Integration with the National System of e-Invoices

Issuing and Posting a Structured Invoice

Sending Invoices to the National System of e-Invoices

Invoicing Modes and the NSeI Unavailability Log

Processing Purchase Invoices Downloaded from the NSeI

Entering an NSeI Number or Designation for a Missing NSeI Number