How to print two print jobs of a report at the click of the Print Direct menu option

I’ve been working with the developers of the third party report designer that is used with AyaNova to determine a way to automatically have a report template always print out two print jobs.

This could be very useful if you always want a report to print two copies - without having to select to print twice.

And you can also use this same script to be able to automatically print one copy to one tray, and another copy to another tray - all by selecting the Print Direct menu option once.

This could be very useful if you always want a report to print two copies, with one copy from the default tray and the other copy from another tray on the same printer that has different colored paper.

To see how this is down, download the following sample report template

[b]Two Print Jobs - Sample Detailed Service Workorder with Grand Total[/b]

-Extract and import into AyaNova.
-Open the Service navigation pane, and the Service Workorders grid.
-Select a workorder to open a workorder entry screen.
-Select Print, and select the report template Two Print Jobs - Sample Detailed Service Workorder with Grand Total
-In the Print Preview window, select the Print Direct menu option - this takes the default printer you have set up in Windows.
-This will now print two copies of this workorder report template to your default printer.

To see how this was done, open this sample report template in the designer and follow along.
-Hold down the SHIFT key and select the Two Print Jobs - Sample Detailed Service Workorder with Grand Total to open it in the report designer.
-As soon as the report template opens, by default it will show the properties on the left for xtraReport1

-select to open the ScriptReferences property

-Three specific strings have been entered in there

-Close the String Editor Collector
-Expand the Scripts property

-You will see that the OnAfterPrint script has been edited - open it up

I won’t go into specific details on every line of code in here - suffice it to say is that this adds a second print job to piggy back on to the print job when you select the Print Direct menu option

In this code, I have the second print job going to tray 1 as identified by the line that refers to PaperSource[0]

The way it works internally is the printer identifies the first default tray as PaperSource[0], the second tray as PaperSource[1], a third paper tray as PaperSource[2] and so on.

So if you want the second print job to print to a different tray other than the default first tray, you would change the number from [0] to [1]

I would like it if any user that uses this posts their results. Thank you.

NOTE: AyaNova 6.x and above users will want to download and import this report template - otherwise will get the error as outlined in forum topic Report-error-issue-for-some-AyaNova-6-users

AyaNova 6.x Two Print Jobs - Sample Detailed Service Workorder with Grand Total