Quantcast
Channel: Dynamics User Group
Viewing all articles
Browse latest Browse all 15740

ssrs report dont show print preview

$
0
0

I have the following code which prints out the sales packing slip however its  printing to  both screen and to the file. Just wondering is there any way to prevent showing the report on screen

 static void SR_SaveReportToPDFFromController(Args _args)
{
    SalesPackingSlipController SalesPackingSlipController;
    SalesPackingSlipContract SalesPackingSlipContract;
    salesTable salesTable;
    Args                    args = new Args();
    SrsReportRunImpl        srsReportRun;
    CustPackingSlipJour       CustPackingSlipJour;
    ReportName              reportName = "SalesPackingSlip.Report";   
    str invoiceFileName;


    ;

 select firstOnly CustPackingSlipJour
            where CustPackingSlipJour.SalesId == 'SO011043';
            
    salesTable = SalesTable::find(CustPackingSlipJour.SalesId);
    args.record(CustPackingSlipJour);
    SalesPackingSlipController = new SalesPackingSlipController();
    SalesPackingSlipController.parmReportName(reportName);
    infolog.setInfoLogLevel(SysInfoLogLevel::None);
    SalesPackingSlipContract = SalesPackingSlipController.parmReportContract().parmRdpContract();
    SalesPackingSlipContract.parmRecordId(CustPackingSlipJour.RecId); // Record id must be passed otherwise the report will be empty
    SalesPackingSlipController.parmArgs(args);
    srsReportRun = SalesPackingSlipController.parmReportRun() as SrsReportRunImpl;
    SalesPackingSlipController.run();
    SalesPackingSlipController.parmReportRun(srsReportRun);
    SalesPackingSlipController.parmReportContract().parmPrintSettings().printMediumType(SRSPrintMediumType::File);
    SalesPackingSlipController.parmReportContract().parmPrintSettings().overwriteFile(true);
    SalesPackingSlipController.parmReportContract().parmPrintSettings().fileFormat(SRSReportFileFormat::PDF);
    invoiceFileName = "AX_" + CustPackingSlipJour.SalesId + ".pdf";       
    SalesPackingSlipController.parmReportContract().parmPrintSettings().fileName('c:\\lori\\' + invoiceFileName);
     SalesPackingSlipController.runReport();
    infolog.setInfoLogLevel(SysInfoLogLevel::All);    

}


Viewing all articles
Browse latest Browse all 15740

Trending Articles