Printing SalesOrderAcknowledgement via ButtonClick

I’ve not printed a report from code before, so seeing this thread I gave it a go myself using code supplied above with a bit of tweaking:

private void btnPrintSOA_Click(object sender, System.EventArgs args)
{
	//Invoke the BO
	salesOrderAckAdapter soa = new salesOrderAckAdapter(oTrans);
	soa.BOConnect();

	//Get Paramters
	soa.GetNewParameters();
	
	//Set Parameters
	soa.ReportData.SalesOrderAckParam[0].OrderNum = 123770;
	soa.ReportData.SalesOrderAckParam[0].AutoAction = "PREVIEW";
	soa.ReportData.SalesOrderAckParam[0].AgentID = "SystemTaskAgent";
	soa.ReportData.SalesOrderAckParam[0].ReportStyleNum = 1003;
	soa.ReportData.SalesOrderAckParam[0].WorkstationID = Ice.Lib.Report.EpiReportFunctions.GetWorkStationID((Ice.Core.Session)oTrans.Session);
	soa.ReportData.SalesOrderAckParam[0].ArchiveCode = 7;

	//Submit to Agent
	soa.SubmitToAgent("SystemTaskAgent",0,0);
	MessageBox.Show("Print Job Has been submitted.");

	
}

Works a charm - only needed to add reference for the Erp.UIRpt.SalesOrderAck.

2 Likes