Core functionality

This article describes in short, the core functionality of Continia e-Documents Import. The description contains information about how the different objects interact.

Setup

The setup is done from the e-Documents Import Setup page. The setup contains fields that specify default values that is used when creating a CEDO partner.

There are also fields to specify the credentials and VANS-provider if using direct communication.

The CEDO Partner table contains a reference to the Dynamics NAV or Microsoft Dynamics 365 Business Central on premises vendor. Furthermore, the CEDO partner table specifies how documents are to be handled and validated.

From the e-Documents Import Setup page the Stylesheets action can be invoked triggering the CEDO Stylesheet Setup table to appear. Here the stylesheets can be setup.

Another crucial part of the setup is the import of the XML version. The import is an XMLPort CEDO XML version Imp/Exp that imports a file containing (XML-layout.txt) file in the CEDO XML version table.

The import of the file is triggered from by choosing the Søg efter side eller rapport icon, enter Import XML version.., and then choose the related link.

The content of the CEDO XML Version table can be viewed by choosing the Søg efter side eller rapport icon, enter XML version, and then choose the related link. This will open the CEDO XML version page.

Importing XML files

The CEDO Receive page contains the Load action that triggers the import of the XML files. From here the CEDO Document Journal page can be accessed. From the document journal a lot of the tables and pages with supplementary data can be accessed. This includes the following tables:

  • CEDO Partner
  • CEDO Attached Document List
  • CEDO Receive Advice
  • CEDO Received Document Header
  • CEDO Received Doc. Lines
  • CEDO Received Comment
  • CEDO Change Log
  • CEDO Accepted Differences
  • CEDO Error Log

The CEDO Receive Functions codeunit contains the top level functions to process an XML file. It identifies the UBL-format of the XML file. It then calls a format specific function in the Receive Document codeunit that does the processing.

From the CEDO Receive Functions codeunit the CEDO Communication is called to download files. The CEDO communication codeunit uses Continias own DLL files to communicate via SFTP (Continia.Communication.SFTP.dll and Continia.Communication.Pagero.dll) to download documents.

After the documents are downloaded the files are placed in the CEDO File Archive table in a blob field. If the files are imported from a file folder this is handled by CEDO Functions codeunit in the function Inbound files. This function uses .Net variable System.IO.Directory to access the system directory and get the files from the folder specified in the CEDO Setup table.

The CEDO Functions codeunit is a codeunit library with functions used in different places in the product. In the Receive Document codeunit the XML version table is used to iterate through the xml file and place the values in the CEDO Received Document Header and CEDO Received Document Lines tables. The codeunit also contains several predefined (hardcoded) UBL-format specific tags that are processed in a special manner because they cannot be mapped into a field one to one.

The above mentioned codeunits uses .Net interoperability objects relating to System.XML.

Viewing the document in the document journal

The CEDO Document Journal page is used to display the data of the imported document. The page also contains a control of type part that uses the CEDO Capture Client Addin page.

The CEDO Capture Client Addin page uses a client add-in developed by Continia to show the XML file with a stylesheet applied from the CEDO Stylesheet Setup table. This XML file is then shown like an image. The source table of the page is the CEDO Received Document Header table. The client add-in used in the CEDO Capture Client addin page is the Akeyto.DocumentCapture.Dynamics.Nav.UI.dll from the client folder.

When opening the document journal the OnAfterGetRecord() trigger is invoked. Here the function GetStyledXMLFile (Function from CEDO Functions codeunit) is called from the with the page record. The function does the following:

  1. Gets the content of the Archive File field of the CEDO Received Document Header table (the source XML file).
  2. Identifies the UBL-format and document type.
  3. Gets the destination to the appropriate stylesheet identified in step 2.
  4. Copies the stylesheet files to the server temp folder if the files are located server clientside
  5. A call to the DLL Continia.XlstConverter is made to style the XML document.
  6. Saves the HTML file in the server temp folder
  7. Downloads it to the client file temp folder
  8. The function returns the file path to the XML file from step 7
  9. The file path from step 7 is sent to the client add-in and the image of the styled XML is then shown to the user.

In this process several other functions located in the CEDO Functions codeunit is used.

Registering a document

When the document is imported, and any errors is resolved the document is ready for register. The registration is done from the CEDO Document Journal page choosing the Register action.

When doing so the CEDO Approve Functions codeunit is run. This codeunit handles the creation of a purchase document from the CEDO Received Document Header and CEDO Received Document Lines tables. In this process several validations are done on the supplementary tables. If any data is missing the user is prompted and the errors are inserted into the Error Log table. Otherwise a standard Dynamics NAV or Microsoft Dynamics 365 Business Central on premises purchase document is created.

Description of the usage of .NET Framework interoperability

All the codeunits handling the import of received document uses .Net variables related to the System.xml library.

In the CEDO Communication codeunit .Net variables is used. The .Net variables is used to handle XML documents when downloading documents. The codeunit uses two .net variables developed by Continia (Continia.Communication.SFTP.dll and Continia.Communication.Pagero.dll). They are used to communicate with the VANS-providers. This is done in the function DownloadDocuments.

When styling an XML document to get an embedded visualization this is done by Continia DLL Continia.XlstConverter. This takes an XML document and an stylesheet file and returns an HTML document.

Also some file directory access are used when exporting documents to a folder and importing receipts from a folder. The functions are placed in the CEDO RTC Tools codeunit.