Equisys technical notes

Technical guidance, explanations and fixes for our products

HOWTO: Manually modify NAV Reports to work with Zetadocs Client Delivery using the Visual Studio Report Designer

Print

ZTN4448

ID: ZTN4448

This Zetadocs technical note applies to:

  • Zetadocs for Microsoft Dynamics NAV using Client-side delivery (32-bit)
  • Zetadocs Express

Summary

This technote details the steps required to manually modify NAV Reports to work with Zetadocs Client Delivery. These steps are normally used when the modification tools provided by Equisys are not suitable due to existing modifications of these NAV objects.

More information

This technote contains the steps to manually configure NAV Reports to work with Zetadocs using the Visual Studio Report Designer. Instructions to modify reports using the SQL Server Report Builder can be found in technote ZTN4556.

Role Tailored Client layout modifications

If you are using the Role Tailored Client with NAV 2009 or later then you need to perform these additional steps to ensure the Zetadocs reference is added to the report. There are two different methods to do this depending on how it has been designed and the version of NAV in question. Most can use the header and body section modifications detailed below but some reports like the remittance advice journal require the body only modifications.

NAV 2009/2013 modifying the Header and Body section

The Order confirmation report is an example where the page header section is used to display header information on each page for the record.   When this is the case, follow the instructions below to add the Zetadocs reference.

  • Locate the report and click View > Layout to open the report designer.
  • Add a new text box in the top left of the body section, ensuring it does not overlap any existing controls.
  • Existing text boxes have a parent listbox called list1. If this is the case then ensure that this new textbox has the same.
  • Adjust the properties as follows:
    • Name: Zetadocs_Reference_tb.
    • Value: =Fields!Zetadocs_Reference.Value.
    • Visibility Hidden: TRUE.
    • Color: Red.
  • Open the Document Outline - Report window (Visual Studio   >   View   >   Other Windows   >   Document Outline).
  • Locate and cut the Zetadocs_Reference_tb texbox.
  • Right click on the list1_Contents node from the document outline Report and select paste then click the Bring to front button.
  • Next, add a new text box to the top left of the page header section of the report ensuring the textbox does not overlap any existing controls and that the whole 15 digit ZD Reference will fit in the text box on one line.
  • Adjust the properties as follows:
    • Font size: 6 (4 being the minimum)
    • Color: White
    • Value: =ReportItems!Zetadocs_Reference_tb.Value.
  • Close and save the report.

Version Code

Once you have saved the report add EQ8.0 to the Version List column in the Object Designer.

NAV 2009 modifying the Body section only

The remittance advice journal report is an example of a report that does not have a page header section. When this is the case, follow the instructions below to add the Zetadocs reference.

  • Click View > Layout to open the report designer for Role Tailored Client reports.
  • Add a new text box into the top left of the header section ensuring the textbox does not overlap any existing controls.
  • Usually existing text boxes have a parent listbox called list1. If this is the case then ensure that this new textbox has the same.
  • Adjust the properties as follows:
    • Font size: 6 (4 being the minimum)
    • Color: White
    • Value: =Fields!Zetadocs_Reference.Value.
  • Close and save the report.

Version Code

Once you have saved the report add EQ8.0 to the Version List column in the Object Designer.

Using the Zetadocs Sample Reports

Sample Reports are provided for NAV 2009 R2 W1 and later.

  • Log into Microsoft NAV as a user with SUPER user permission rights to allow you to import new objects into the NAV database.
  • Open the object designer (Shift + F12) and import the sample reports file relevant to your NAV version from the \Zetadocs NAV Server Components\Sample Reports\ folder of your product download. E.g. for NAV 2013 choose the Zetadocs for NAV Sample Reports - NAV7.00W1.fob.
  • Next assign these reports in NAV so they run in place of the existing reports. Otherwise use the steps below to configure any remaining reports which you require.

Sample Reports provided:

Report ID

Report Name

9009960

ZD-Blanket Purchase Order

9009961

ZD-Blanket Sales Order

9009962

ZD-Order Confirmation

9009963

ZD-Order

9009964

ZD-Purchase - Credit

9009965

ZD-Purchase - Quote

9009966

ZD-Purchase - Invoice

9009967

ZD-Sales - Credit Memo

9009968

ZD-Sales - Invoice

9009969

ZD-Sales - Quote

9009970

ZD-Statement    

9009973

ZD-Return Order Confirmation    

9009974

ZD-Return Order                

Manually Modifying your Existing Reports

There are two goals of the Zetadocs for NAV report modifications.

1. To determine the page numbers where one report ends and the next begins.

2. To determine the record to which we want to link the document once archived.

1.    Determining the page breaks

Zetadocs for NAV writes a short code at the top of the report page print output to identify which pages belong to which record. This can be once per page or only on the first page depending on how the report is written. This is why we modify the report section / layout. The Zetadocs Ref number also is capable of dealing with copy loops so that only one copy of the document is sent to a recipient.

2.    Determining the record to link to

If I send a Sales Order Confirmation I will want to link that document to the Sales Header record for the report. To achieve this Zetadocs requires that you call AddRecord passing the RECORDID of that record. You can see in the image below how the Sales Header constitutes the main loop of that report.

http://www.equisys.com/technotes/ZTN4275_files/4275_6.png

This is not always the case for all reports and so you must determine the record you want to link to and the dataitem that constitutes the main print output loop of your report before adding the Zetadocs Integer dataitem and associated code. Often a report which is based on line records filtered by another record type will have different records to link to and as the main output loop.

Report modification best practices

  • Only call AddRecord with records that will print output. This is why the Zetadocs dataitem comes at the end of the report loop. That way if there is any reason to skip a record or there is no report output for that record, AddRecord will not get called.
  • Only call AddRecord with actual Record RECORDIDs.
  • Do not get the RECORDID of a temporary table and call AddRecord passing that value as this can lead to errors.

Report modification steps NAV 2013 or later

The following instructions need to be followed to modify an existing report to work with Zetadocs, simply repeat these steps for each report you wish to configure.

ZdSend.Initialize(CurrReport.OBJECTID(FALSE), CurrReport.PREVIEW);

ZdSend.ProcessRecords;

  • Open the report designer for the report that you want to modify.
  • Now add the following global variables:

Name

Data Type

Sub Type

ZdSend

CodeUnit

Zetadocs-Send

ZdRecRef

RecordRef

  • Under the DataItem CopyLoop add a new entry (Right click on the row right underneath it and click New).
  • Give it the following values:
    • Data Type:Column
    • Data Source:ZdSend.GetZdReference(CopyLoop.Number)
    • Name:Zetadocs_Reference
  • Scroll to the empty row at the bottom and create a new Integer data item called Zetadocs.
    • Indent this data item once.
    • Change the DataItemTableView property to SORTING(Number).
    • Change the MaxIteration property to 1.
    • Add the following code to the OnPostDataItem trigger for the Zetadocs data item:

  ZdRecRef.GETTABLE(< Main Data Item> );

  ZdSend.AddRecord(ZdRecRef.RECORDID);

Note: The Main Data Item is the table upon which the report is based e.g. Sales Reports would usually use the Sales Header table. This information can be found in the report properties.

  • Select an empty row on the report and press F9 to view the report code.
  • Enter the following code after any existing code in the OnPreReport trigger:

ZdSend.Initialize(CurrReport.OBJECTID(FALSE), CurrReport.PREVIEW);

  • Enter the following code after any existing code in the OnPostReport trigger:

ZdSend.ProcessRecords;
CLEAR(ZdSend);

Report modification steps NAV 6

The following instructions need to be followed to modify an existing report to work with Zetadocs, simply repeat these steps for each report you wish to configure.

Name

Data Type

Sub Type

ZdSend

CodeUnit

Zetadocs-Send

ZdRecRef

RecordRef

ZdRecRef.GETTABLE(< Main Data Item> );

ZdSend.AddRecord(ZdRecRef.RECORDID);

ZdSend.Initialize(CurrReport.OBJECTID(FALSE), CurrReport.PREVIEW);

ZdSend.ProcessRecords;

  • Open the report designer for the report that you want to modify.
  • Scroll to the empty row at the bottom and create a new Integer data item called Zetadocs.
  • Indent this data item once.
  • Change the DataItemTableView property to SORTING(Number).
  • Change the MaxIteration property to 1.
  • Now add the following global variables:
  • Add the following code to the OnPostDataItem trigger for the Zetadocs data item:
  • Select an empty row on the report and press F9 to view the report code.
  • Enter the following code after any existing code in the OnPreReport trigger:
  • Enter the following code after any existing code in the OnPostReport trigger:

Classic Client specific layout modifications

Below are the instructions for modifying the classic report layout to include the Zetadocs reference, which is required to add addressing information to the report once it has been printed.

         (< COPYNUMBER> is CopyLoop.Number if you have a copy loop or 1 if not.)

  • Click View > Sections to show the classic client report designer.
  • Click Design > View layout. The SQL Server Report Builder will open.
  • Open the toolbox and add a text box that it will appear at the top of the report.
  • Change the SourceExpr property to ZdSend.GetZdReference(< COPYNUMBER> ).
  • Change the FontSize property to 4.
  • Change the DataSetFieldName property to Zetadocs_Reference, Note: This field is only available in NAV 6.0 and later and should be ignored on earlier versions of NAV.
  • Close the sections window.

References

HOWTO: Manually modify a NAV report - Zetadocs client side installation using the Microsoft SQL Server Report Builder

Last updated: 23rd June 2021 (EG)

Keywords: NAV Reports, Zetadocs Delivery

Equisys Logo, Document Management and Expense Management for Business Central
 

Replaced by script