Invoice Reports using Crystal Reports Report Templates

A Crystal Report template is a report template (.rpt file) that defines the report using the report file format made by Crystal Reports.

RPT files are created to be used with Microsoft Visual Basics. An RPT file is composed of:

  • The layout of fields in the physical report
  • The report data source for those fields—whilst Crystal Reports supports many types of data sources, in CCLAS, the report data sources are the default DTOs exposed from the application that launches the report.

A report template uploaded to CCLAS for Crystal Reports can contain either:

  • A single Crystal Report RPT file, or
  • A ZIP file which contains:
    • A single Crystal Report RPT file, along with the associated XSD file used to create the RPT file, which is not used to generate the report but is used in report template construction, so is included here for reference only and for further re-design of the RPT file, and
    • An optional RFD file to limit the fields in the default result sets
    • An optional DSC file to add additional result sets
    • Optional graphics or document files that are to be included in the Crystal Report.

The DTO (Data Transfer Object) structure is required to author the report template. For Crystal Report report templates, the DTO is defined and built by the XSD file accompanying it in the Crystal Report report template, and then used by the Crystal Report authoring tool to place fields into the report template.

When designing Crystal Report report templates with CCLAS data, in order to exclude certain attributes from the reporting XSD files, they should be added to the dtoSpecificIgnoredFields list in AbstractReportModelTransformer.groovy (cclasCore → plugin project).

With Crystal Report and Chunk Text reports that use a DSC, there is no fixed structure of the result sets, as it depends on the SQL query that is supplied in the DSC. As such, a custom XSD or TTX file (Crystal Reports Tab Separated Text file) that matches the columns of the DSC's SQL query needs to be created in order to construct the Crystal Report template.

Note: There are some discussions online that indicate TTX is old technology, and that XML is its replacement. Being aware of TTX would be prudent, however, as there are existing templates using this format.

The following parameters are available in a Crystal Report template for an invoice report:

  • invoiceNo
  • laboratoryCode
  • organisationCode
  • generationId
  • invoiceStatus
  • invoiceType

Note: These variables can be references from within the DSC also.