Previous Topic

Next Topic

Inhoudsopgave

Book Index

Printing Reports

Description

In Isah you can display data by printing predefined reports, i.e. standard Isah reports or customized reports. The SelectedPrinter property allows you to print reports in a variety of formats:

As explained below, there is a different set of properties you can use for each format.

Print Preview

The Print preview option shows the user on screen how the report will appear when printed. It enables the user to check the layout and content of the report before printing, saving or sending it. It is possible to print the report from the print preview window.

The following code creates a print preview:

Dim oReport As IERPLink.IISERPReport

Set oReport = oERPLink.CreateReport()

oReport.ReportCode = "R0146"

oReport.Silent = True

oReport.SelectedPrinter = 0

oReport.PrintReport()

Printing

Printing a report is very similar to displaying a print preview. Apart from the required properties, you can fill in additional properties, such as the number of copies to print and the printer to be selected. The printer number is system dependent, but it is always 3 or higher. It is recommended that you determine the printer order dynamically instead of using fixed numbers. If you use Silent = False you leave it up to the user to select a printer.

The following code prints a report:

Dim oReport As IERPLink.IISERPReport

Set oReport = oERPLink.CreateReport()

oReport.ReportCode = "R0146"

oReport.Copies = 2

oReport.Silent = True

oReport.SelectedPrinter = 3 '' Of hoger.

oReport.PrintReport()

Printing to file

You have to enter the value SelectedPrinter = 2 to indicate that the report should be printed to file. For printing to file a variety of file formats is available, such as pdf and xlsx, if you fill in the values for the ExportFormat and the ExportFilename property. Because all available file formats are standard Isah formats, no additional software is required.

The following code prints the report to file:

Dim oReport As IERPLink.IISERPReport

Set oReport = oERPLink.CreateReport()

oReport.ReportCode = "R0146"

oReport.Silent = True

oReport.SelectedPrinter = 2

oReport.ExportFilename = "C:\Reports\Customer.pdf"

oReport.ExportFormat = 0 '' PDF

oReport.PrintReport()

Printing to email

If a user prints to email the report is added as an attachment to an email. The email will not automatically be sent, but will be placed in the outbox (in Outlook). In order to also save the report in a file, fill in the ExportFileName and MailCopyAttachment = True. You can enter properties such as receiver and subject. If you enter several email addresses, use the vbCrLf character as separator.

The following code prints a report to email:

Dim oReport As IERPLink.IISERPReport

Set oReport = oERPLink.CreateReport()

oReport.ReportCode = "R0146"

oReport.Silent = True

oReport.SelectedPrinter = 1

oReport.MailTo = info@isah.com & vbCrLf & “myemail@gmail.com”

oReport.MailBody = "Sample of printing to email"

oReport.MailSubject = "Print to email"

oReport.MailAttachmentName = "CustomerInIsah.pdf"

oReport.MailCopyAttachment = True

oReport.ExportFilename = "C:\Reports\Customer.pdf"

oReport.PrintReport()