Hi Martin,
thanks for your reply.
I need to send the receive transfer report file to the api, so i am dowloding the file and store somewhere and read the file and send the file to the API.
So the first step i need to download the transfer order receive report.
can you please correct my code, i done the same way to download the sales invoice report its working.
But transfer order i am not able to download the file.
Getting object null reference error in ssproxy.
can you please guide what i am doing wrong in the report.
For sales invoice download i have written this code
str ext = SRSPrintDestinationSettings::findFileNameType(SRSReportFileFormat::PDF, SRSImageFileFormat::BMP);
PrintMgmtReportFormatName printMgmtReportFormatName = PrintMgmtDocType::construct(PrintMgmtDocumentType::SalesOrderInvoice).getDefaultReportFormat();
SalesInvoiceContract salesInvoiceContract = new SalesInvoiceContract();
salesInvoiceContract.parmRecordId(_custinvoicejour.RecId);
SrsReportRunController srsReportRunController = new SrsReportRunController();
if (!WinAPI::pathExists("C:\\Temp\\Invoices\\")) WinAPI::createDirectoryPath("C:\\Temp\\Invoices\\");
filename=strfmt('C:\\Temp\\Invoices\\%1%2',_custinvoicejour.InvoiceId,".pdf");
srsReportRunController.parmReportName(printMgmtReportFormatName);
srsReportRunController.parmExecutionMode(SysOperationExecutionMode::Synchronous);
srsReportRunController.parmShowDialog(false);
srsReportRunController.parmReportContract().parmRdpContract(salesInvoiceContract);
srsReportRunController.parmLocalExportOptions();
// printerSettings.parmFileName(@'C:\Temp\'+custInvoiceJour.InvoiceId + ext);
SRSPrintDestinationSettings printerSettings = srsReportRunController.parmReportContract().parmPrintSettings();
printerSettings.printMediumType(SRSPrintMediumType::File);
printerSettings.fileFormat(SRSReportFileFormat::PDF);
printerSettings.overwriteFile(true);
printerSettings.fileName(filename);
srsReportRunController.startOperation();
//srsReportRunController.startOperation();
srsReportRunService.getReportDataContract( srsReportRunController.parmreportcontract().parmReportName());
srsReportRunService.preRunReport(srsReportRunController.parmreportcontract());
reportParametersMap= srsReportRunService.createParamMapFromContract(srsReportRunController.parmReportContract());
parameterValueArray =SrsReportRunUtil::getParameterValueArray(reportParametersMap);
srsProxy =SRSProxy::constructWithConfiguration(srsReportRunController.parmReportContract().parmReportServerConfig());
// Actual rendering to byte array
reportBytes =srsProxy.renderReportToByteArray(srsReportRunController.parmreportcontract().parmreportpath(), parameterValueArray, printerSettings.fileFormat(), printerSettings.deviceinfo());
if (reportBytes)
{
using (var stream = new System.IO.MemoryStream(reportBytes))
{
using (var fileStream = new System.IO.FileStream(filename,System.IO.FileMode::Create, System.IO.FileAccess::ReadWrite))
{
stream.CopyTo(fileStream);
//stream.Close();
//stream.Dispose();
//stream.Flush();
}
}
/// var fileStream = new System.IO.FileStream(filename,System.IO.FileMode::Create, System.IO.FileAccess::ReadWrite);
}
}
Similar way i want to download transfer order receive pdf download, but its not working, can you please guide what i done wrong.
Thanks