PRINT FROM ACTIONS MENU:
This was the original request of the post. I was able to piece this together using another post on this forum as well. Here is my first example with the Case Report but added to the Actions Menu:
First, I created an event using the Form Event Wizard on Form Load.
Make sure to change the caption to whatever you want the menu to say.
Make sure to add this using statement at the top of the customization code:
using Infragistics.Win.UltraWinToolbars;
Then, this can go at the bottom:
private void HelpDeskForm_Load(object sender, EventArgs args)
{
//create a new button tool for UltraWinToolbars
Infragistics.Win.UltraWinToolbars.ButtonTool NewTool = new Infragistics.Win.UltraWinToolbars.ButtonTool("Print Case");
// set the Properties of the new menu
NewTool.SharedProps.Caption = "Print Case";
NewTool.SharedProps.Enabled = true;
NewTool.SharedProps.Visible = true;
// NewTool.SharedProps.AppearancesSmall.Appearance.Image = System.Drawing.Bitmap.FromHicon(SystemIcons.Application.Handle);
baseToolbarsManager.Tools.Add(NewTool);
// add the new created button tool to Action Menu
((Infragistics.Win.UltraWinToolbars.PopupMenuTool)baseToolbarsManager.Tools["ActionsMenu"]).Tools.Add(NewTool);
// create the Tool clik method of your created tool
NewTool.ToolClick += new Infragistics.Win.UltraWinToolbars.ToolClickEventHandler(NewTool_ToolClick);
}
private void NewTool_ToolClick(object sender,Infragistics.Win.UltraWinToolbars.ToolClickEventArgs args)
{
// Establish your reference to the BAQ Report UI
Ice.UI.Rpt.BAQReport.Transaction trans = new Ice.UI.Rpt.BAQReport.Transaction(oTrans);
// Load the specific BAQ Report by ID you are interested in
trans.LoadBAQReportData("CaseReport");
// Get the current Case Number
var myEDView = oTrans.Factory("HDCase");
var currentRow = myEDView.dataView[myEDView.Row];
int caseNum = Convert.ToInt32(currentRow["HDCaseNum"]);
// Fill in the parameters to run the report. You can find these
// by using field help on the BAQ Report dialog.
EpiDataView edvData = (EpiDataView)trans.EpiDataViews["ReportParam"];
edvData.dataView[edvData.Row]["field1"] = caseNum;
// Submit to system agent. You can do either a preview or print here
trans.RunDirect("Preview");
// Clean up the objects
edvData.Dispose();
trans.Dispose();
}
Keep in mind this was for a BAQ Report. For an SSRS Report, it would be slightly different.
EDIT:
I tried to apply my own work instruction as I added a menu item to do a BAQ Report at a different screen (Serial Number Tracker). It failed with the error:
The type or namespace name ‘Rpt’ does not exist in the namespace ‘Ice.UI’ (are you missing an assembly reference?)
I had to go to Tools > Assembly Reference Manager and add a reference to Ice.UIRpt.BAQReport.dll. See screenshot. I could not “find” this by searching, but if I just started typing it in to the filename box, it showed up.