Creating a print button on the work orders screen that allows selection of the printer in a pop-up window

  • Updated

You need to get a pop-up screen for selecting the printer (among the locally installed on the client machine) where to print your work order CR layout document. 

 

1) Get the report workorder2.rpt attached to this article and copy it into your project folder. Open it in crystal reports designer and refresh the connection to your database. Save the report.  
 
2) Open the Work order structure screen. Call up the customization window by pressing the combination of keys CTRL + N + U. This will bring up the customization screen 
 
2) Paste the code below into the customization screen: 
 
global function form_loaded 
create=button=text=Print,name=printlocation 
end global 
 // ******* Event dw_master_item_button_printlocation_click ******** 
 // Created 2020/10/01 by lls@boyum-it.com 
 global function dw_master_item_button_printlocation_click 
 tools=auswahl=location,Choose item=S= =<location> 
printobject=openreport=workorder2.rpt 
printobject=connectioninfo 
// set quantity of copies (output) 
printobject=setvar=druckcopy=1 
//crystal report parameters 
printobject=setvar=docentry=<belnr_id,#0> 

 printobject=setvar=position_from=<belpos_id> 
printobject=setvar=position_to=<belpos_id> 
//fixed commands for beas for the CR engine -- DO NOT TOUCH the next 2 lines 
printobject=parameter 
printobject=parameter_set 
// set printer (this is coming from the selection you have done on the pop-up screen) 
 tools=printer=getdriversport=<aa:location> 
 printobject=crreport=selectprinter=<value_printerdriver>=<value_printername>=<value_printerport> 
printobject=crreport=printout 
 end global 
 

Close the customization screen by saving. 
 
3) Close the work orders screen. Open it again. you will now have the new Print button on the bottom of the screen. Press it, the new Pop-up screen will open. With the Pop-Up screen in focus on the screen, press AGAIN the CTRL + N + U keys to show the customization screen for the pop-up window. Paste the code below: 
 
// ******* Event dw_1_load ******** 
//// Created 2020/01/10 by lls@boyum-it.com 
global function form_loaded 
tools=printer=getdriverstodropdown 
setvar=dropdown:inhaltc=<value> 
end global 
// ******* Event dw_1_item_p_auswahl_click ******** 
// Created 2020/09/23 by Patrik 
global function dw_1_item_p_auswahl_click 
dropdown=inhaltc 
end global

blobid0.png

Close the customization window for the Pop-Up by saving.  

4) Close the work orders main screen. Open it AGAIN and select a work order. Open its structure and position your mouse cursor on a position of the work order. For example like this:

blobid1.png

Now, when pressing the Print button, you first will have to choose the printer in the new pop-up window and then this will print to the selected printer the details of the work order by passing to the CR report the following parameters: Work Order number, starting position, ending position. 

 

Was this article helpful?

2 out of 2 found this helpful

Comments

0 comments

Please sign in to leave a comment.