fc_logo

Procurement System using Domino and DominoPDF – Case Study from First Choice Airways

First Choice IT department developed a Procurement application to manage the entire cycle of operation.

Jeff Harris of First Choice writes about his experience in building a centralized procurement system with PDF capability using Domino and DominoPDF.

Jeff Harris
Lead Domino Developer
First Choice Airways
www.firstchoice.co.uk

First Choice is a leading international leisure travel company. It operates from 16 countries and employs nearly 14,000 employees across the brands. The group operates in four sectors each offering a particular type of leisure travel experience.

First Choice had been using different types of procurement systems in different group companies. Some of them had paper based systems, some of them with Excel, some with Access databases etc.

There were a number of problems owing to these disparate systems. There was no visibility for the business to ascertain the total procurement at a given time, also there was no way to trace approval process or status of procurement. Other than these issues, the company was using different procurement teams across organizations which was a cost overhead.

First Choice IT department developed a web based Procurement application catering to the specific needs of the business. They used IBM Domino based technology to implement the system.

The Procurement System has a simple to use workflow system for approvals, a simple method to track each order, its status etc. It enables users to easily create Purchase Orders and manage the entire cycle of operation.

One of the major components of the Procurement System was the creation of an electronic Purchase Order in PDF format.

First Choice used PDF as a medium to send out documents, but most of the time they used PDF Printer Drivers. However PDF Printer Drivers posed the issue of setting up each individual machine and other configuration issues such as creating a standard.

We were looking for a simple and flexible server side PDF creation product and finally selected DominoPDF to do the job”.

We have added some tips for developers who may come across similar needs along with this article.

Technical Tips for Developers

The First Choice Centralized Procurement System has been designed as a web accessed only Domino database.

Typically documents are viewed in a frameset and PDF conversion links are calculated in a column at the view level.

The view column formula displays a link for converting PO documents to PDF when clicked in a browser.

ReplaceSubstring(@Subset(@DbName;-1); “\\” : ” “; “/” : “+”) + “/wCreatePDF?openagent&id=” + @Text(@DocumentUniqueID) + ”>PDF”

The link calculates the DocumentID of the appropriate document and passes it to a Domino agent (wCreatePDF) where the PDF conversion takes place.

The Domino agent parses the query string paramaters and locates the document in the database. The document URL is then calculated and passed to DominoPDF for conversion to PDF.

Once the PDF has been converted the PDF is simply displayed to the user in their browser.

An example of the Domino agent (wCreatePDF) code is provided below.

(Declarations)
Declare Function DoPDF Lib “DOMINOPDF.DLL” (Byval szURL As String, Byval szPDF As String, Byval szOptions As String) As Long

(Initialize)
Sub Initialize
‘Declararations…
Dim session As New NotesSession
Dim oDB As NotesDatabase
Dim oDoc As NotesDocument
Dim sDirectory As String, sFile As String, sDBPath As String, s As String, sHost As String, sID As String
Dim vFilename As Variant
Dim iRet As Integer

‘Set values…
Set oDB = session.CurrentDatabase
Set oDoc = session.DocumentContext

‘Error handler…
On Error Goto Error_Handler

‘Get document ID
sID = oDoc.QUERY_STRING(0)
sID = ReplaceSubString(sID, “openagent&ID=”, “”)

‘Create files in domino HTML directory…
sDirectory = session.GetEnvironmentString(“Directory”,True)
sDirectory = sDirectory & “\domino\html\”

‘Create output file name…
vFilename = Evaluate(|@Right(@Unique;”-“)|, oDoc)
sFile = “PO” + vFilename(0) + “.PDF”
sFilePath = sDirectory & sFile

sDBPath = GetDBPath(oDB)

‘Construct URL
sHost = oDoc.SERVER_NAME(0) & “:” & oDoc.SERVER_PORT(0)
If Right$(sHost, 1) <> “/” Then sHost = sHost & “/”
s = “http://” & sHost & sDBPath & “/All/” & sID & “?OpenDocument”

‘Convert to PDF…
Call DoPDF(s, sFilePath, “”)

‘Point browser to PDF…
Print |window.location=’/| & sFile & |’;|

The_End:
Exit Sub

Error_Handler:
Print |Error in DominoPDF Interface: | & Error$
Resume The_End

End Sub

About the Author

Jeff Harris is a Lead Domino Developer at First Choice Group.

His expertise is in creating web based applications in Domino.

Comments are closed.