dollar_sign Crystal Reports Availability Checking Plugin
Previous  Top  Next

Many of Crystal's in-built functions are supplied in DLL files and the technology allows for third parties to supply their own DLLs containing their own functions. The CRUFL_EclipseAvail.dll is such a file that contains functions that allow your report's to display the availability of your inventory for user specified periods. To get you going we have supplied 2 sample reports that you can download from here. You can run them directly in Crystal Reports or you can install them in Eclipse. To install you just need supply a Menu Caption, a Filename, and a FORM in the Configuration Book It is up to you which Eclipse Book/Form you install into. You may find that these reports, with some minor modifications, do all you need so the technical details below might not need understanding thoroughly. However, for those users who want a complete comprehension of the process, read on.

The CRUFL_EclipseAvail.dll file that is installed when you purchase the Crystal Report Eclipse Availability Checker contains two functions which will appear in your Crystal Reports Formula Editors function list, under "Additional Functions". Choosing them will add them to the formula editor like this:

EclipseAvailabilityConfirmed (, , , , , ) or EclipseAvailabilityProvisional (, , , , , )  

You will see that the expect you to pass them parameters so they can process the availability. The parameters are:
EclipseAvailabilityConfirmed ([Site number],[Start Date] ,[Start Time] ,[End Date] ,[End Time] , [Equipment Type Number])

Example 1

Let look at example report, Types_Availability.rpt
In this report the user is prompted to supply the date so there are two datetime parameter fields for this purpose. We have added these fields to the report title so that we can see the range we are reporting on. These parameters cannot be passed directly to the availability functions because they need splitting in to separate time and date values first. So the formula
{@ConAvail} reads like this:

Datevar startDate := DateTimeToDate ({?StartDate});  
Datevar EndDate := DateTimeToDate ({?endDate});  
NumberVar StartTime := DateTimeToSeconds ({?StartDate});  
NumberVar EndTime := DateTimeToSeconds ({?EndDate});  
 
EclipseAvailabilityConfirmed (1,startDate , StartTime,EndDate ,EndTime ,{Hetype.Type} )  
 
 
Lets quickly analyse this:
The first 4 lines use inbuilt CR functions to convert the parameters that prompt the user for Dates and Times into separate Date and Time variables. These variables are then passed to the main function. You will see the the first parameter for the SITE number is 1. This is because most Eclipse users have a single site implementation. If you were Multi-Site then you may pass the number of the site you wish to work with, or maybe a parameter value that was returned from a user prompt. The last parameter passed is the field {Hetype.Type}. If the formula field is placed in the details of the report then of course this is refreshed for each record retrieved, which is what you want.

Example 2

Let look at example report, Types_Availability.rpt
In this report we do not prompts the user but have the report display availability for the next week. This is an ideal report to use along side the Report Master programme because you could have it run automatically once a day and upload an HTML output to your web site.
First we need 2 formulas to set the date range we are interested in:

{@Today}

DateTime(CurrentDate,Time(00,00,00))  
 
This just makes a DateTime field which will be passed to the main formulas and will be also displayed in the report's title

{@EndDate}

{@Today}+ 7  
 
This adds 7 days to the start date for the reporting period.

Now the {@ConAvail} formula:

Datevar startDate := DateTimeToDate ({@Today});  
Datevar EndDate := DateTimeToDate ({@End Date});  
NumberVar StartTime := DateTimeToSeconds ({@Today});  
NumberVar EndTime := DateTimeToSeconds ({@End Date});  
 
EclipseAvailabilityConfirmed (1,startDate , StartTime,EndDate ,EndTime ,{Hetype.Type} )  
 
Additional Information

1. You should NOT pass a time value to the availability functions which will change as the report itself runs, for example by using the Crystal's NOW function: doing so will force the availability checking to recalculated for every equipment Type that is read in by the report.
2. The availability checking is done against the active company / database set for Eclipse in the Multi-Company utility
3. The Crystal Report Eclipse Availability Checker will only work on PCs that have Eclipse or Report Master
(full BDE download) installed