What Assemblies are Needed for Reports

I am in the Mass Issue to Mfg screen and am trying to create a Button Click event to auto print the Job Traveler. I manually added the references (Erp.Contracts.Rpt.JobTrav and Erp.UIRpt.JobTrav) using the Assembly Reference Manager and I keep on getting this compile error. Not sure what I am missing.

Error: CS0246 - line 58 (240) - The type or namespace name ‘JobTravAdapter’ could not be found (are you missing a using directive or an assembly reference?)

// **************************************************
// Custom code for MassIssueForm
// Created: 4/2/2021 7:04:03 AM
// **************************************************
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.Adapters;
using Erp.UI;
using Ice.Lib;
using Ice.Adapters;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;

public class Script
{
	// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
	// Begin Wizard Added Module Level Variables **

	// End Wizard Added Module Level Variables **

	// Add Custom Module Level Variables Here **

	public void InitializeCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
		// Begin Wizard Added Variable Initialization

		// End Wizard Added Variable Initialization

		// Begin Wizard Added Custom Method Calls

		this.epiBttn_PrintTrav.Click += new System.EventHandler(this.epiBttn_PrintTrav_Click);
		// End Wizard Added Custom Method Calls
	}

	public void DestroyCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
		// Begin Wizard Added Object Disposal

		this.epiBttn_PrintTrav.Click -= new System.EventHandler(this.epiBttn_PrintTrav_Click);
		// End Wizard Added Object Disposal

		// Begin Custom Code Disposal

		// End Custom Code Disposal
	}

	private void epiBttn_PrintTrav_Click(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
		JobTravAdapter jt = new JobTravAdapter(oTrans);
	}
}

You need the using statement, or fully qualify the method.

Not an answer to your question (sorry!), but you might consider using Context Menu Maintenance to add the Job Traveler print screen to the list of menus available when right-clicking → Open With:

The Job Traveler print screen would load with your job already filtered.

It’s a few more clicks than what it sounds like you might be going for, but if you can sell it as a workable solution it will make your life much much easier… I have been down the road of trying to launch a report from customizations and it has never gone well for me. Also, with Kinetic on the horizon we should try to shy away from creating new customizations like this when possible…

A BPM handling auto print could be another option too - maybe it is triggered when the user issues material.

1 Like

Taking a second look at this, I don’t even think you need to reference any Job Traveler assemblies. The one time I added a custom button to launch another form, I used the ProcessCaller.LaunchForm method. The code on Mass Issue should look, more or less, like this.

ProcessCaller.LaunchForm(oTrans, "MenuIDofJobTraveler", oTrans.JobNum)

Then, on the receiving form, I’ve got a block of code attached to the form load event.

private void GetJob()
	{
	string JobNum;
	try
		{ JobNum = Form.LaunchFormOptions.ValueIn.ToString(); }
	catch (Exception)
		{ return; }

	SearchOptions Opts = new SearchOptions(SearchMode.AutoSearch);
	Opts.NamedSearch.WhereClauses.Add("JobNum", JobNum);
	oTrans.InvokeSearch(Opts);
	}

This was, however, a button to launch a UD form from a stock form. To @TomAlexander 's point, I’m not sure I’d go that route for something like this. I might look at a BPM. Then again, after looking at Kinetic, I’m staying away from it for the next year so I might go the form button route again.

@jtownsend you are right, there was nothing else needed. I don’t know if it is a bug or something, but it is working fine today. Friday it would not compile and the odd thing was that the references were completely in lower case. Today it compiles fine and is in the correct case. Might be one of those things where you need to completely close out and go back into.

1 Like