SrsReportRunController
controller = new SrsReportRunController();
SalesInvoiceContract
rdpContract = new SalesInvoiceContract();
SRSPrintDestinationSettings settings;
System.Byte[]
reportBytes = new System.Byte[0]();
SRSProxy
srsProxy;
SRSReportRunService
srsReportRunService = new SrsReportRunService();
Microsoft.Dynamics.AX.Framework.Reporting.Shared.ReportingService.ParameterValue[]
parameterValueArray;
Map
reportParametersMap;
SRSReportExecutionInfo
executionInfo = new SRSReportExecutionInfo();
;
CustInvoiceJour custInvoiceJour = CustInvoiceJour::findFromSalesId_IN("SO081204");
if(custInvoiceJour)
{
if (!WinAPI::pathExists("C:\\Temp\\Invoices\\"))
WinAPI::createDirectoryPath("C:\\Temp\\Invoices\\");
Filename filename =strfmt("C:\\Temp\\Invoices\\%1%2",custInvoiceJour.InvoiceId,".pdf");
controller.parmReportName(ssrsReportStr(SalesInvoice, Report));
controller.parmShowDialog(false);// Explicitly provide all required parameters
rdpContract.parmRecordId(custInvoiceJour.RecId);
controller.parmReportContract().parmRdpContract(rdpContract);// Change print
settings as needed
settings = controller.parmReportContract().parmPrintSettings();
settings.printMediumType(SRSPrintMediumType::File);
settings.fileFormat(SRSReportFileFormat::PDF);
settings.overwriteFile(true);
settings.fileName(filename);
controller.parmReportContract().parmReportServerConfig(SRSConfiguration::getDefaultServerConfiguration());
controller.parmReportContract().parmReportExecutionInfo(executionInfo);
srsReportRunService.getReportDataContract(controller.parmreportcontract().parmReportName());
srsReportRunService.preRunReport(controller.parmreportcontract());
reportParametersMap =
srsReportRunService.createParamMapFromContract(controller.parmReportContract());
parameterValueArray = SrsReportRunUtil::getParameterValueArray(reportParametersMap);
srsProxy = SRSProxy::constructWithConfiguration(controller.parmReportContract().parmReportServerConfig());
//
Actual rendering to byte array
reportBytes =
srsproxy.renderReportToByteArray(controller.parmreportcontract().parmreportpath(),
parameterValueArray,
settings.fileFormat(),
settings.deviceinfo());
if (reportBytes)
{
System.IO.Stream
stream = new System.IO.MemoryStream(reportBytes);
var fileStream = new System.IO.FileStream(filename, System.IO.FileMode::Create, System.IO.FileAccess::ReadWrite);
stream.CopyTo(fileStream);
}
}
==========================================================================
http://www.dnetsoft.com/en-us/d365-generate-a-report-through-x-and-save-in-a-local-folder/
I will recommend anyone looking for Business loan to Le_Meridian they helped me with Four Million USD loan to startup my Quilting business and it's was fast When obtaining a loan from them it was surprising at how easy they were to work with. They can finance up to the amount of $500,000.000.00 (Five Hundred Million Dollars) in any region of the world as long as there 1.9% ROI can be guaranteed on the projects.The process was fast and secure. It was definitely a positive experience.Avoid scammers on here and contact Le_Meridian Funding Service On. lfdsloans@lemeridianfds.com / lfdsloans@outlook.com. WhatsApp...+ 19893943740. if you looking for business loan.
ReplyDeleteDo you need Finance? Are you looking for Finance? Are you looking for finance to enlarge your business? We help individuals and companies to obtain finance for business expanding and to setup a new business ranging any amount. Get finance at affordable interest rate of 3%, Do you need this finance for business and to clear your bills? Then send us an email now for more information contact us now via (financialserviceoffer876@gmail.com) whats-App +918929509036 Dr James Eric Finance Pvt Ltd Thanks
ReplyDelete100% working. thanks
ReplyDelete