I have a Print Preview working successfully from a single button press in a Quote Entry customization. Only problem is that the System Monitor never goes to Priority Mode so the PDF takes up to 30 seconds to appear, while it takes 3 or 6 seconds when run from Action>Print Form>Print Preview.
My Code
private void QuickPrintPreview()
{
// Set status (but this gets reset to Ready very quickly at the end of this event)
this.oTrans.PushStatusText("Submitting Quote for Print Preview...",true);
Erp.Proxy.Rpt.QuotFormImpl QFForm = WCFServiceSupport.CreateImpl<Erp.Proxy.Rpt.QuotFormImpl>((Ice.Core.Session)oTrans.Session,
Erp.Proxy.Rpt.QuotFormImpl.UriPath);
Erp.Rpt.QuotFormDataSet QFds = QFForm.GetNewParameters();
QFds.QuoteFormParam[0].QuoteNum = Convert.ToInt32(this.QuoteHed_Row.dataView[this.QuoteHed_Row.Row]["QuoteNum"]);
QFds.QuoteFormParam[0].AutoAction = "SSRSPREVIEW";
QFds.QuoteFormParam[0].PrinterName = "";
QFds.QuoteFormParam[0].AgentSchedNum = 0;
QFds.QuoteFormParam[0].AgentID = "SystemTaskAgent";
QFds.QuoteFormParam[0].AgentTaskNum = 0;
QFds.QuoteFormParam[0].RecurringTask = false;
QFds.QuoteFormParam[0].RptPageSettings = "";
QFds.QuoteFormParam[0].RptPrinterSettings = "";
QFds.QuoteFormParam[0].ReportStyleNum = 1004;
QFds.QuoteFormParam[0].WorkstationID = Ice.Lib.Report.EpiReportFunctions.GetWorkStationID((Ice.Core.Session)oTrans.Session);
QFds.QuoteFormParam[0].DateFormat = "d/m/yyyy";
QFds.QuoteFormParam[0].NumericFormat = ",.";
QFds.QuoteFormParam[0].ProcessTaskNum = 0;
QFds.QuoteFormParam[0].ReportCultureCode = "en-US";
QFds.QuoteFormParam[0].ReportCurrencyCode = "USD";
QFds.QuoteFormParam[0].ArchiveCode = 0;
QFds.QuoteFormParam[0].DecimalsGeneral = 0;
QFds.QuoteFormParam[0].DecimalsCost = 0;
QFds.QuoteFormParam[0].DecimalsPrice = 0;
QFds.QuoteFormParam[0].GlbDecimalsGeneral = 0;
QFds.QuoteFormParam[0].GlbDecimalsCost = 0;
QFds.QuoteFormParam[0].GlbDecimalsPrice = 0;
QFds.QuoteFormParam[0].FaxSubject = "";
QFds.QuoteFormParam[0].FaxTo = "";
QFds.QuoteFormParam[0].SSRSRenderFormat = "PDF";
QFForm.SubmitToAgent(QFds, "SystemTaskAgent", 0, 0, "Erp.UIRpt.QuotForm");
// Reset status to Ready
this.oTrans.PopStatus();
}
This topic contains the same issue with a solution: BAQ Report slow - #5 by ckrusen
But, when I add these lines of code suggested in that topic,
using System.Reflection;
var mi = oTrans.GetType().BaseType.GetMethod("NotifySystemMonitor", BindingFlags.NonPublic | BindingFlags.Instance);
mi.Invoke(oTrans, null);
I get the error “Object reference not set to an instance of an object.”
10.2.200