{
PurchPackingSlipController ssrsController = new SrsReportRunController();
TradeDocumentReportContract purchPackingSlipContract = new TradeDocumentReportContract();
SRSPrintDestinationSettings printerSettings;
VendPackingSlipJour VendPackingSlipJour;
Args args;
//select the latest record based on create date
while select VendPackingSlipJour
order by VendPackingSlipJour.createdDateTime DESC
where VendPackingSlipJour.PackingSlipId == 'LJ-01'
{
//tell the controller the report to run (filename, design name)
ssrsController.parmReportName(ssrsReportStr(PurchpackingSlip, Report));
//define how we want to execute the report (right now or batch style)
ssrsController.parmExecutionMode(SysOperationExecutionMode::Synchronous);
//hide the report dialog
ssrsController.parmShowDialog(false);
//ssrsController.parmLoadFromSysLastValue(true);
//we need to populate the required parms for the current sales order controller
purchPackingSlipContract.parmRecordId(VendPackingSlipJour.RecId);
purchPackingSlipContract.parmDocumentTitle("Goods Received Note");
//link the contract to the controller so we know how to run the dp
ssrsController.parmReportContract().parmRdpContract(purchPackingSlipContract);
//link the printer settings to the controller
printerSettings = ssrsController.parmReportContract().parmPrintSettings();
//print to pdf and always overwrite if the file exists
//if(purchPrintScreen == NoYes::Yes)
{
printerSettings.printMediumType(SRSPrintMediumType::File);
printerSettings.fileFormat(SRSReportFileFormat::PDF);
printerSettings.overwriteFile(true);
printerSettings.fileName(@"c:\\test.pdf");
}
//else
{
// printerSettings.printMediumType(SRSPrintMediumType::Screen);
}
//run & save the report
ssrsController.startOperation();
}
}
Comments
Post a Comment