HOWTO: Automatically capture documents like supplier invoices using barcodes with Zetadocs Capture Plus
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:
- Creating a report that prints a barcode.
- Adding a button to the Purchase Invoice form, that enables a user to print a barcode displaying the Purchase Invoice record number.
- Adding the code that is required to enable the auto linking of barcoded documents.
- 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/.
- Create a blank report with a single DataItem - Integer
- In the Report Designer select View - Sections.
- Go to toolbox View – Toolbox and add a text box.
- Right click on the text box and select properties.
- Set the text box FontName to the barcode font name e.g. FontName = Free 3 of 9 Extended
- Edit the FontSize, 32 is the recommended minimum font size.
- 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.
- Add another text box below the barcode to display the BarcodeValue in a standard font.
- Go to View – C/AL Globals.
- Add BarcodeValue as a variable, with DataType as Text.
- Add SetBarcodeValue as a Function.
- View C/AL Code and the following code BarcodeValue := Value;
- ·Save the changes to the report.
Adding a button that prints the barcode
- In the Classic client, select the Purchase Invoice form from the Object Designer and click Design.
- Go to View - Toolbox and add a command button to the form.
- 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.
- Close the window.
- 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.
- Add the following lines of code:
- Save & compile.
Adding AutoLink code that will be run from the Document Queue.
Zetadocs for NAV version 5.0 or later
- From the Object Designer, open Zetadocs-Capture Customize Codeunit
- Scroll to the GetAutoLink trigger.
- Uncomment the block comment in the function.
- 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:
- In the Classic client, select the Zetadocs Capture Customize code unit from the Object Designer and click Design.
- 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;
- Ensure local variables as shown below are specified (View – C/AL Locals).
- Save & compile.
Creating a Document Queue to run the GetAutolink code
Before creating a document queue in NAV, note the following:
- 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.
- Archiving to SharePoint should be enabled by navigating to Application Setup - Zetadocs Setup - Advanced Settings – Zetadocs System Settings, before setting up the document queue.
- 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:
- Open NAV and select the Administration option from the Navigation Pane.
- Navigate to Application Setup - Zetadocs Setup - Advanced Settings - Zetadocs Document Queue Setup.
- 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)
- Open the Object Designer and select the Menusuite option.
- Highlight the object with ID 1055 called Dept – Zetadocs for NAV and select Design.
- Navigate to the location where you want to add the queue in the navigation pane, right click and select Create Item.
- Input properties like those shown below.
- Save the changes to complete your setup.
Last updated: 28th October 2014 (DC/MW/JV)