When running Dynamics NAV as a Remote Application or in Remote Desktop you are missing connection to your locally connected scanner. I have created a solution that uses a standalone application running on the client computer. That application uses the TwainControlX from Ciansoft and connects to a Microsoft SQL database. The database needs to be on a computer that both the client computer and the remote desktop computer have access to.
On that database server a database is created with only one table. That table can be truncated every night in a maintenance job. This is the table creation script.
CREATE TABLE [dbo].[ScanRequests](
[ComputerName] [varchar](20) NOT NULL,
[ClientName] [varchar](20) NOT NULL,
[SelectedDeviceID] [varchar](250) NULL,
[Image] [image] NULL,
[RequestDateTime] [datetime] NULL,
[FormatID] [varchar](50) NULL,
[AnswerDateTime] [datetime] NULL,
[Answered] [int] NOT NULL,
[AnswerText] [varchar](250) NULL,
[PageNo] [int] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
The program on the client then connects to the database and to the scanner.
A code in Dynamics NAV creates the request for a scan by inserting a entry into the ScanRequest table and the application on the client computer automatically scans the images and updates that scan request entry. The updated entry then containes the image file that is imported into Dynamics NAV or attached as a link.
The following ZIP files are encrypted. View the Product page for more information.
Twain Scanner (ISL)
NAV Myndlestur (TwainOCX) Source Code (ISL)
Just finished my registration to NAV TechDays 2011. Looking forward to the conference.
In the localized version of Dynamics NAV 2009 R2 the report layout for Role Tailored Client is missing. I have created the layout and applied a few fixes to the reports.
||Sales – Quote
||Sala – Tilboð
||Sales – Invoice
||Sala – Reikningur
||Sales – Credit Memo
||Sala – Kreditreikningur
||Blanket Sales Order
||Purchase – Invoice
||Innkaup – Reikningur
||Purchase – Credit Memo
||Innkaup – Kreditreikningur
||Upplýs. vegna skattstofu
||Trial Balance – IRS Number
||Prófjöfnuður – Skattst.númer
||VAT Balancing A
||VAT Balancing Report
The following ZIP file is encrypted.
NAV IS2009R2 Reports
My earlier post on File Download used the responsestream property of WinHTTP. On my latest project I needed to use Windows Authentication on my website and found out that I needed to create the WinHTTP automation on client level to login with the current user. This also means that I cannot use built in streaming functions to download the file. Instead I used ADOStream function to download the file and in the example that follows I am saving the file to the temporary directory for the current user.
[code htmlscript=”false”]DownloadFile(URL : Text) FileName : Text
IF ISCLEAR(WinHTTP) THEN
IF WinHTTP.status <> 200 THEN
FileName := WinHTTP.getResponseHeader(‘Content-Disposition’);
IF STRPOS(FileName,’filename=’) = 0 THEN
FileName := ”
FileName := COPYSTR(FileName,STRPOS(FileName,’filename=’) + 10);
IF ISCLEAR(ADOStream) THEN
IF ADOStream.State = 1 THEN
ADOStream.Type := 1; // adVarBinary
IF ISCLEAR(FileSystem) THEN
FileFolder := FileSystem.GetSpecialFolder(2);
FilePath := FileFolder.Path;
ADOStream.SaveToFile(FilePath + ‘\’ + FileName,2);
FileName := FilePath + ‘\’ + FileName;
Where my variables are
FileSystem – Automation – ‘Windows Script Host Object Model’.FileSystemObject
FileFolder – Automation – ‘Windows Script Host Object Model’.Folder
WinHTTP – Automation – ‘Microsoft XML, v6.0’.XMLHTTP
ADOStream – Automation – ‘Microsoft ActiveX Data Objects 2.8 Library’.Stream
FilePath – Text
The standard Record Links table in Dynamics NAV has the ability to store a URL and link it to any record in the Dynamics NAV database. However, in order to fully use this each user must have access to the give URL.
As a part of the Purchase Invoice signing solution I built a process to select or scan a file, upload it to a SQL database and create a URL to that file in the Record Link table. I create a SQL link table that stores the file and a permission table that holds information on users permission by table id.
I used TwainControlX to scan and create files to import and link. Then I add a “Link File” button to the Purchase Order.
When Link File is selected the following dialogue appears.
After selecting or scanning a file a new link is created and the file is uploaded to the SQL server.
The file is now available to all users that have the required permission through the following link.
The can be downloaded directly with the Open button or NAV can download and open the file with code. I created a .ASP web page to download files from the Link database.