Equisys technical notes

Technical guidance, explanations and fixes for our products

HOWTO: Automatically capture documents like supplier invoices using barcodes with Zetadocs Capture Plus

Print

ZTN4131

ID: ZTN4131

This Zetadocs technical note applies to:

  • Version 4.2 to 7.0 of Zetadocs for NAV Capture Plus with the following addon modules:
    • OCR and Barcode processor option
    • Document Imaging Automated filing option

Summary

Supplier invoices arrive in most companies in a range of formats. This document details how to automatically link paper invoices to the corresponding invoice in Microsoft Dynamics NAV and upload that document to SharePoint.

There are four main steps to follow within NAV. If you intend to scan batches of your barcoded supplier invoices, you will need some process to split the batch back into its individual parts. This process is described in detail in section 14 of the Zetadocs for NAV Installation Guide.

Main Steps:

  1. Creating a report that prints a barcode.
  2. Adding a button to the Purchase Invoice form, that enables a user to print a barcode displaying the Purchase Invoice record number.
  3. Adding the code that is required to enable the auto linking of barcoded documents.
  4. Creating the Document Queue to run the code. Note: The steps discussed in this document are made using the NAV Classic client.

Creating a report that prints a barcode

Note: A barcode font needs to be installed on the client machine for the barcode report to be output correctly.  There is detailed advice in the Zetadocs for NAV Installation Guide on which barcodes to use. This document uses the Free 3 of 9 Extended font that can be downloaded from http://www.barcodesinc.com/free-barcode-font/.

  1. Create a blank report with a single DataItem - Integer
  2. In the Report Designer select View - Sections.
  3. Go to toolbox View – Toolbox and add a text box.
  4. Right click on the text box and select properties.
  5. Set the text box FontName to the barcode font name e.g. FontName = Free 3 of 9 Extended
  6. Edit the FontSize, 32 is the recommended minimum font size.
  7. Set the text box SourceExpr property to the value to be used for the barcode e.g. (BarcodeValue). Do the same for the DataSetFieldName property.
  8. Add another text box below the barcode to display the BarcodeValue in a standard font.  
  9. Go to View – C/AL Globals.
  10. Add BarcodeValue as a variable, with DataType as Text.
  11. Add SetBarcodeValue as a Function.
  12. View C/AL Code and the following code BarcodeValue := Value;
  13. ·Save the changes to the report.

Adding a button that prints the barcode

  1. In the Classic client, select the Purchase Invoice form from the Object Designer and click Design.
  2. Go to View - Toolbox and add a command button to the form.
  3. Right click on the command button and select properties.
    • Add a caption for the button (“Print Barcode”)
    • Adjust settings for font, size etc as required.
  4. Close the window.
  5. Right click on the command button and select C/AL Code.

    In the OnPush section:
    • Add the following lines of code:

      BarcodeReport.SetBarcodeValue(FORMAT('*' + " No." + '*'));
      BarcodeReport.RUNMODAL;

    • Add a local variable (Go toView – C/AL locals) as shown below.

  6. Save & compile.

Adding AutoLink code that will be run from the Document Queue.

Zetadocs for NAV version 5.0 or later

  1. From the Object Designer, open Zetadocs-Capture Customize Codeunit
  2. Scroll to the GetAutoLink trigger.
  3. Uncomment the block comment in the function.
  4. Save and Compile the Codeunit.

Zetadocs for NAV version 4.2 or earlier

Please follow these steps if you are using version 4.2 or earlier of Zetadocs for NAV:

  1. In the Classic client, select the Zetadocs Capture Customize code unit from the Object Designer and click Design.
  2. In the GetAutoLink section, add the code shown below.

    // Autolink with Purchase Invoice documents

      // Use the barcodes that are passed in to find the record to link to.

      // Call reset to clear any filters that may be on the barcodes temporary table

      ZdDocQueueBarcodes.RESET;

      IF NOT ZdDocQueueBarcodes.FIND('-') THEN

      BEGIN

        // There are no barcodes so don't modify the record.

        // Processing will fall back to calling the Link function for the manual method.

        ZdUtilities.Log(0, 'C9009964 - GetAutoLink - No Barcode found');

        EXIT;

      END;

      barcodeVal := ZdDocQueueBarcodes.Value;

      // If the barcode starts with PINN it means it is a Purchase Invoice.

      // The barcode will be in the format PINN*****, where 000000 is the Purchase Invoice record number

      IF (STRLEN(barcodeVal) > 4) AND (COPYSTR(barcodeVal, 1, 4) = 'PINN') THEN

      BEGIN

        PurchaseRec.RESET;

        //PurchaseRec." No." := COPYSTR(barcodeVal, 5);

        PurchaseRec." No." := COPYSTR(barcodeVal, 1);

        PurchaseRec." Document Type" := PurchaseRec." Document Type" ::Invoice;

        // If we can find the record that the barcode refers to

        IF PurchaseRec.FIND THEN

        BEGIN

          // if the user selected a record use a RecordRef to get the RecordID for the record

          // and modify the ZdLinkResult record to include it

          RecRef.GETTABLE(PurchaseRec);

          ZdLinkResult." Record ID" := RecRef.RECORDID;

          ZdLinkResult.MODIFY;                      

        END;

      END;

  3. Ensure local variables as shown below are specified (View – C/AL Locals).
  4. Save & compile.

Creating a Document Queue to run the GetAutolink code

Before creating a document queue in NAV, note the following:

  1. A shared network folder needs to be created where the purchase invoices will be scanned into, all users of the document queue will need full access to this location. It is also necessary to configure the Zetadocs server accordingly, see section 15.3 of the Zetadocs for NAV Installation Guide.
  2. Archiving to SharePoint should be enabled by navigating to Application Setup - Zetadocs Setup - Advanced Settings – Zetadocs System Settings, before setting up the document queue.
  3. An action needs to be added to the Zetadocs Doc. Queue Actions Table, as shown below.

To configure a document queue in the NAV Classic client:

  1. Open NAV and select the Administration option from the Navigation Pane.
  2. Navigate to Application Setup - Zetadocs Setup - Advanced Settings - Zetadocs Document Queue Setup.  
  3. The above shows an example of a Zetadocs Document Queue Card. See section 15.4 of Zetadocs for NAV Installation Guide for an explanation on each of the fields on the Zetadocs Document Queue card.

Adding the Document Queue to the NAV menu suite (in Classic client)

  1. Open the Object Designer and select the Menusuite option.
  2. Highlight the object with ID 1055 called Dept – Zetadocs for NAV and select Design.
  3. Navigate to the location where you want to add the queue in the navigation pane, right click and select Create Item.
  4. Input properties like those shown below.

  5. Save the changes to complete your setup.

Last updated: 28th October 2014 (DC/MW/JV)

Equisys Logo, Document Management and Expense Management for Business Central
 

Recent news

We’ve previously spoken about how businesses can benefit from moving their expenses to the cloud (including enhanced security and reduced operating costs). In our new three-part blog post ...

Action Fraud, the UK’s national reporting centre for fraud and cyber-crime, claims that nearly one in five businesses have been defrauded by an employee at some point. Claiming false travel and ...