Using scanners with Axapta Document Management



Similar documents
EMC Documentum Application Connectors Software Development Kit

14 Configuring and Setting Up Document Management

Faye Business Systems Group. Enhancement for Sage MAS 90 and MAS 200. Accounts Payable Document Integration

Creating Form Rendering ASP.NET Applications

ClientAce WPF Project Example

Share Point Document Management For Sage 100 ERP

Developer Guide. Android Printing Framework. ISB Vietnam Co., Ltd. (IVC) Page i

Document Management System 5.6A User Guide

How to Configure Microsoft System Operation Manager to Monitor Active Directory, Group Policy and Exchange Changes Using NetWrix Active Directory

ID TECH UniMag Android SDK User Manual

Export Server Object Extension and Export Task Install guide. (V1.1) Author: Domenico Ciavarella ( )

MICR Check Printing with Digital Signatures

A Step by Step Guide for Building an Ozeki VoIP SIP Softphone

Braindumps.C questions

Hands-On Lab. Client Workflow. Lab version: Last updated: 2/23/2011


AP Vouchers with Credit Card Payments For Sage 500 ERP

MS Active Sync: Sync with External Memory Files

Creating Database Tables in Microsoft SQL Server

Python for Series 60 Platform

Ohio University Computer Services Center August, 2002 Crystal Reports Introduction Quick Reference Guide


Visual Basic. murach's TRAINING & REFERENCE

Practice Fusion API Client Installation Guide for Windows

How To Write A File Station In Android.Com (For Free) On A Microsoft Macbook Or Ipad (For A Limited Time) On An Ubuntu 8.1 (For Ubuntu) On Your Computer Or Ipa (For

FAQ CE 5.0 and WM 5.0 Application Development

Scanning Options and Techniques for Client Profiles for Windows

JAVA DEVELOPER S GUIDE TO ASPRISE SCANNING & IMAGE CAPTURE SDK

Demo: Controlling.NET Windows Forms from a Java Application. Version 7.3

Contents 1 Overview 2 Steps to run an Excel Add-In Setup: 3 Add-Ins 4 LOGIN 5 SEND SMS 5.1 Send Text or Flash Sms 5.2 Select Range 5.

MEDILINK ESI (R2) How To: Use the Medilink Document Management System. Casey Pittman Developer - APS Medilink 2011/08/12

Knocker main application User manual

CRM Setup Factory Installer V 3.0 Developers Guide

BarTender s ActiveX Automation Interface. The World's Leading Software for Label, Barcode, RFID & Card Printing

User Manual. 3-Heights PDF Producer API. Version 4.6

Getting Started with STATISTICA Enterprise Programming

Informatica Cloud Connector for SharePoint 2010/2013 User Guide

PCI Compliance. Network Scanning. Getting Started Guide

ScriptLogic File System Auditor User Guide

Table Of Contents. iii

Chain of Responsibility

Team Foundation Server 2012 Installation Guide

CSE 308. Coding Conventions. Reference

Web Services API Developer Guide

UW- Green Bay QuickBooks Accounts Receivable User Manual

Creating a Java application using Perfect Developer and the Java Develo...

Microsoft Dynamics NAV Connector. User Guide

How To Use Blackberry Web Services On A Blackberry Device

Third-party software is copyrighted and licensed from Kofax s suppliers. This product is protected by U.S. Patent No. 5,159,667.

How to develop your own app

TSScan - Usage Guide. Usage Guide. TerminalWorks TSScan 2.5 Usage Guide. support@terminalworks.com

PACK'N DEPLOY GUIDE. Version 2.58

SmartConnect Users Guide

Connections to External File Sources

DEPLOYING A VISUAL BASIC.NET APPLICATION

Using Microsoft Dynamics AX 2012

Configuring the SST DeviceNet OPC Server

Security Classification: EIDA ID Card Toolkit v2.7. Developer s Guide

E-invoice manual Instruction for a client implementation of the B2B web service

The full setup includes the server itself, the server control panel, Firebird Database Server, and three sample applications with source code.

Installing Crystal Reports XI R2. Installing Crystal Reports XI R2

SQL Server Database Web Applications

DocuSign for SharePoint

Installing Crystal Reports XI. Installing Crystal Reports XI

WEARIT DEVELOPER DOCUMENTATION 0.2 preliminary release July 20 th, 2013

Office of History. Using Code ZH Document Management System

Spring Design ScreenShare Service SDK Instructions

Android Security Lab WS 2014/15 Lab 1: Android Application Programming

Programming Project 1: Lexical Analyzer (Scanner)

3 C i t y C e n t e r D r i v e S u i t e S t. L o u i s, MO w w w. k n o w l e d g e l a k e. c o m P a g e 3

TRANSFORM YOUR MEDE8ER TV WALL FROM THIS: TO THIS: LIBRARY VIEW SHOW VIEW SEASON VIEW FULL SYNOPSIS AND INFO

Administrator s Guide to deploying Engagement across multiple computers in a network using Microsoft Active Directory

Settings 1 September 2015

Outlook 2010 Essentials

Appointment Scheduler

Studio Designer 80 Guide

Set up My Sites (SharePoint Server

Creating a Distribution List from an Excel Spreadsheet

AXIS 70U - Using Scan-to-File

Outlook . User Guide IS TRAINING CENTER. 833 Chestnut St, Suite 600. Philadelphia, PA

Comparing the Effectiveness of Penetration Testing and Static Code Analysis

QUICK START GUIDE. Draft twice the documents in half the time starting now.

SonicWALL CDP 5.0 Microsoft Exchange InfoStore Backup and Restore

Dynamics AX. Microsoft Dynamics AX 4.0. Microsoft Dynamics ISV Software Solution Test Guidelines

Librarian. Integrating Secure Workflow and Revision Control into Your Production Environment WHITE PAPER

1. PREREQUISITES 2. NETWORK ADMINISTRATORS INFO

Generating Automated Test Scripts for AltioLive using QF Test

MAS 90 MAS 200 Tips, Tricks and Frequently Asked Questions (FAQ s) Prepared by: The Fitzgerald Group August 11, 2004

Witango Application Server 6. Installation Guide for Windows

Pcounter Web Report 3.x Installation Guide - v Pcounter Web Report Installation Guide Version 3.4

Developing Task Model Applications

AccuPOS to MAS90/200 Integration Guide

Customer Tips. Xerox Network Scanning TWAIN Configuration for the WorkCentre 7328/7335/7345. for the user. Purpose. Background

How to set up Simple Network Management Protocol (SNMP) for Netop Remote Control

idelpi Software Quick Install and Basic Configuration Guide

LAB 6: Code Generation with Visual Paradigm for UML and JDBC Integration

Bitrix Site Manager ASP.NET. Installation Guide

Choosing a Development Tool

Transcription:

Using scanners with Axapta Document Management pedro.rodriguez@lorca.es

Using scanners with Axapta Document Management 2 Foreword I was seeking a way to make more agile the work of introducing documents in Axapta and in the last days I have found a very suitable solution that is both simple and powerful so I am writing this document to share this idea to the rest of the suffered Axapta community that like me are all day struggling with the good ERP but not so good in the documentation side Introduction So, in what consist this project? This project is done using three tools. First I use the Document Management tables of Axapta, second I use COM Interop in Axapta and third I have developed a.net class library that use a.net SDK that let you to use easily any TWAIN compliant scanner. I will first show how it works and later I will give all the details needed to do something similar and surely better! Example of use Here are the basic steps needed to scan documents directly to the Document Management module of Axapta. 1. We have to configure the Document Management Parameters if we have not done it yet. 1.1. We have to go to Basic, Setup, Document Management, Parameters. 1.2. We have to introduce the PATH where our documents will be stored in the Archive Directory field. 1.3. We have to activate the Use Active Document Tables if we want to store documents for only some tables like CustTable, VendTable and so on.

Using scanners with Axapta Document Management 3 1.4. We also have to create a Number Sequence for the Document Management in the Number Sequences tab. 1.5. We have to go to Basic, Setup, Document Management, Active Document Tables. Here we configure what tables are Document Management enabled. In this example I will need at less the Vendor Invoice Journal Table. 1.6. We have to go to Basic, Setup, Document Management, Document Types. Here we create the type of documents that we are going to associate to our tables in the Document Management. For this example I need a type called VENDINV_SC, with Job Description Attach file and Group File. 1.7. I have created an own table & form on Basic, Setup, Document Management, Scanners.

Using scanners with Axapta Document Management 4 I use this table to get the name of the scanner connected to the computer where the Axapta client is executing so the users don t have to be indicating the name of the scanner every scan they do. 2. Finally we have to scan a document. For example a Vendor Invoice and associate it with a record of the VendInvoiceJournal Table. 2.1. We can go to the Vendor Invoice Journals form where I have put a sample button to scan vendor invoices. (Purchase Ledger, Inquiries, Journals, Invoice). 2.2. We select a vendor invoice and press the Scan Invoice button. In this moment appears the.net application developed to scan the documents. 2.3. We press the Scan Document button and the application starts scanning the document using the scanner connected to the computer. The application knows the name of the scanner to use because we indicated it in the step 1.7. If the name of the scanner is not found we will show a dialog where we will have to select one of the TWAIN devices that are connected in our computer.

Using scanners with Axapta Document Management 5 2.4. After the scanning process we will see the result in the preview screen. 2.5. If the scan is OK we press the Accept button and the scanned invoice will be stored in the Document Management. 2.6. Now that the invoice is store in the Document Management we will can see it selecting the Invoice Journal record and later pressing in the Document Handling in the Tool Bar. 2.7. We also can open the document pressing in the Open Button. And this all what is needed to scan, store and associate documents with records in our Axapta system. Simple, isn t? In the following pages I will describe how is all done.

Using scanners with Axapta Document Management 6.NET SDKs FOR TWAIN SCANNERS The first thing needed to do a project like this is to identify a suitable.net SDK which will let us to control our TWAIN scanner in a easy way through a DLL Class library that we will use from Axapta. During this project I have evaluated 2 SDK: AtalaSoft DotTwain 5.0 This SDK cost about $399 and has a good documentation and support forum site. This seem the most professional and can be purchased like part of a more big Imaging SDK pack. VintaSoft VintaSoftTwain.NET library This SDK cost about 59$ and has the right functionality needed to make a project. I have tried both and I have chose VintaSoft SDK because it has the functionality I just need and is by far the cheaper one. THE.NET CLASS LIBRARY DEVELOPED Using VintaSoftTwain.NET library I have created a new Class library project in Visual Studio 2005 with a Class named scannertwain.scannertwain in it. This class has the following method: public int scandocument(string documentname, String scannername, int resolution, String filename) this.documentname = documentname; this.scannername = scannername; this.resolution = resolution; this.filename = filename; formmain.text = String.Format("Scanning document 0", this.documentname); formmain.scannertwain = this; formmain.showdialog(); return returnvalue;

Using scanners with Axapta Document Management 7 As we can see I pass by parameters the identify name of the document, the name of the scanner to use, the resolution to use and the final filename where I want my scanned document stored. In this method I simple show the main form and I wait for the form to be closed. When we press in the Scan Document button the form call thestartscan method of the class scannertwain.scannertwain. public void startscan() vstwain = new VSTwain(); vstwain.postscan += new VintaSoft.Twain.VSTwain.PostScanEventHandler(this.VSTwain_PostScan); vstwain.startdevice(); //selecting the Twain device Boolean sourcefinded = false; for (int i = 0; i < vstwain.sourcescount; i++) if (scannername.equals(vstwain.getsourceproductname(i))) vstwain.sourceindex = i; sourcefinded = true; break; if (!sourcefinded) vstwain.selectsource(); vstwain.showui = false; vstwain.disableafteracquire = true; vstwain.opendatasource(); vstwain.unitofmeasure = VintaSoft.Twain.UnitOfMeasure.Inches; vstwain.pixeltype = VintaSoft.Twain.PixelType.GRAY; vstwain.resolution = this.resolution; vstwain.brightness = 400; vstwain.contrast = 0; vstwain.pagesize = VintaSoft.Twain.PageSize.A4; vstwain.acquire();

Using scanners with Axapta Document Management 8 In this method we can see the functionality provided by the.net TWAIN library chose. We soon realise how easy is to control a TWAIN scanner with one of these libraries. In this method I just initialize the TWAIN handler class vstwain, I add my event handler for the PostScanEvent (it will be the method VSTwain_PostScan), I select the Twain device or I let it to show me the TWAIN devices available, and I initialise several parameters for the scanning process like the resolution, the page size and so on. Finally I call theacquire method and the scanner will scan my document. When the scan process is completed the PostScanEvent is raised and my method VSTwain_PostScan will be called. private void VSTwain_PostScan(object sender, VintaSoft.Twain.PostScanEventArgs e) if (!e.flag) if (vstwain.errorcode!= 0) MessageBox.Show(vsTwain.errorString); else formmain.setimage(vstwain.getcurrentimage()); vstwain.showui = false; Here I only put the scanned image in a PictureBox control on the form. public void setimage(image image) if (this.picturebox.image!= null) picturebox.image.dispose(); picturebox.image = null; this.picturebox.image = image;

Using scanners with Axapta Document Management 9 If all is correct we press in the Accept button and the Image will be saved like a JPG image with the filename and path indicated in the parameters. private void buttonaceptar_click(object sender, EventArgs e) if ((this.scannertwain!= null)) if (this.picturebox.image == null) MessageBox.Show("No hay ninguna imagen que guardar!","error"); else if (this.scannertwain.saveimage(this.picturebox.image)) this.scannertwain.scanfinished(true); public Boolean saveimage(system.drawing.image image) Boolean result = true; System.Drawing.Imaging.ImageFormat savefiletype; savefiletype = System.Drawing.Imaging.ImageFormat.Jpeg; try image.save(this.filename, savefiletype); catch (Exception ex) MessageBox.Show("Error al guardar la imagen. " + ex.message); return false; return result; Finally the scanfinished method closes the form and makes the method scandocument to return a value of 1 (Correct scanning and storing of image).

Using scanners with Axapta Document Management 10 REGISTERING OF THE CLASS LIBRARY DLL In order to be able to use our new DLL Class library from Axapta we have to register it for COM Interop. 1. In the Assembly info of our Class library project we have to modify the COM Visible property to true. // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(true)] 2. In the Visual Studio 2005 project properties we have to indicate that we want to sign our DLL with a strong name key file in the Signing section. 3. Finally in the Build section of the project properties we activate the Register for COM Interop. If we move our generated DLL to another computer and we want to use it with the Axapta client we have to use this command to Register the DLL like COM Interop: Regasm myassembly.dll /codebase /tlb

Using scanners with Axapta Document Management 11 THE AXAPTA PROJECT Once our DLL Class library is build and registered in the system we are ready to use it from our Axapta client. As we have seen in the example, the scanning process starts when the user press on the Scan Invoice button added on the VendInvoiceJournal form. When the user press in the button the method scanvendinvoicejour is called on the JJ_EscaneadoDocumentos class created for this project: /* scanvendinvoicejour Params: VendInvoiceJour VendInvoiceJour Scan a vendor invoice, store the scanned file on the Document Management path and creates the needed records in the Document Management tables so the scanned document will be associated with the VendInvoiceJournal record. */ public void scanvendinvoicejour(vendinvoicejour VendInvoiceJour) //file name Str filename; //absolute path of the file Str filepath; //result of the scan process int resultscan; //COM object used to scan COM myobject = new COM("scannerTwain.ScannerTwain"); //record of an own table that contains a relations of computers and scanners JJ_DocuScanners JJ_DocuScanners = JJ_DocuScanners::find(Winapi::getcomputername()); ; if (!vendinvoicejour) throw error('you need to pass a VendInvoiceJour record like parameter.'); //File name //Número de factura - Id de Usuario actual - Fecha Actual.JPG filename = strfmt("%1-%2-%3.jpg", vendinvoicejour.internalinvoiceid, CurUserId(), date2str(systemdateget(), 123, 2, 3, 2, 3, 4)); //Absolute file path //Document Management path + filename filepath = this.archivepath( filename);

Using scanners with Axapta Document Management 12 //we call the scandocument method of the.net Class library resultscan = myobject.scandocument(strfmt('%1 %2', VendInvoiceJour.OrderAccount, VendInvoiceJour.InternalInvoiceId), //descripción JJ_DocuScanners.ScannerName, //Escaner a utilizar 100, //Resolución filepath);//ruta del fichero if (resultscan) //if the document si scanned and stored correctly we store it in the //Document Management tables this.writedocuvalue( int2str(vendinvoicejour.recid), 'VendInvoiceJour', 'VENDINV_SC', "JPG", "FACTURA", filepath); In this method first I initialize the COM object so I can call the.net Class library methods: COM myobject = new COM("scannerTwain.ScannerTwain"); The filename will be Internal Invoice Id + Current User id + Current Date. I use the filepath method to concatenate the filename with the Document Management Path in order to get the absolute path where the file will be stored: /* archivepath Gets the absolute path of the file in the Document Management module. Returns Document Management path + file name */ private str archivepath(string filename) str filepath = DocuParameters::find().archivePath; ; if (! filepath) throw error("@sys62843", '', SysInfoAction_formRun::newFormname(formstr(docuParameters), identifierstr(archive_archivepath),"@sys4157")); filepath = Docu::fileCheckPath(filePath); if (! winapi::pathexists(filepath)) throw error("@sys62844", '', SysInfoAction_formRun::newFormname(formstr(docuParameters), identifierstr(archive_archivepath),"@sys4157")); filepath = filepath + filename; return filepath;

Using scanners with Axapta Document Management 13 I use the COM object in order to call the scandocument method created in the.net Class Library. //we call the scandocument method of the.net Class library resultscan = myobject.scandocument(strfmt('%1 %2', VendInvoiceJour.OrderAccount, VendInvoiceJour.InternalInvoiceId), //description JJ_DocuScanners.ScannerName, //Twain scanner to use 100, //Resolution filepath);//absolute file path If resultscan has the value 1 (correct scanning and storing of file) I call the method WriteDocuValue in order to create the records in the Document Management tables and associate the VendInvoice current record with the document. /* writedocuvalue Create the DocuValue and DocuRef records needed to store the scanned document in the Document Management and associate it with the VendInvoiceJournal record. PARAMS -refrecid RecId of the VendInvoiceJournal record. -tablename Name of the VendInvoiceJournal table. -_typeid Type of document we are going to generate in the Document Management.. (Table DocuType, Field TypeId) -filetype File extension of the file we want to link with the Document Management records. (JPG, PDF, etc.) -name Description of the Document Management record. -filepath Absolute path of the file we want to store in the Document Management. */ private void writedocuvalue( str refrecid, TableName tablename, str _typeid, str filetype, str name, str filepath) DocuValue docuvalue; DocuRef docuref; Dictionary dict; ; dict = new Dictionary(); ttsbegin; docuvalue.clear(); [docuvalue.filename, docuvalue.filetype, docuvalue.path] = Docu::splitFilename(filePath); docuvalue.name = name; docuvalue.insert(); docuref.clear(); docuref.name = name; docuref.typeid = _typeid; docuref.valuerecid = docuvalue.recid; docuref.reftableid = dict.tablename2id(tablename); docuref.refrecid = str2int(refrecid); docuref.insert(); ttscommit;

Using scanners with Axapta Document Management 14 And that is all! We have scanned a document and associated it with a record or the VendInvoiceJournal Table so we can see the document easily in the Document Management module of Axapta. SCANNERS TESTED At first the every TWAIN SDK should work will most scanners without major problems because the TWAIN interfaces seen to be well defined. For this project I have tested the SDKs with a Canon Scan LiDE 60 and a HP Photosmart C380 and they work fine. Pedro Rodriguez is the chief engineer of the Spanish cattle company Juan Jimenez García, S.A. and is working with Axapta 3.0 since 2 years. He is also interested in.net and Java development especially in mobile projects with J2ME. pedro.rodriguez@lorca.es