static void printCollecionLetterPDF(Args _args)
{
Args args = new Args();
SRSPrintDestinationSettings printJobSettings = new SRSPrintDestinationSettings();
CustCollectionJourController custCollectionJourController;
CustCollectionJourContract custCollectionJourContract;
SrsReportRunImpl srsReportRun;
SrsPrintMgmtExecutionInfo executionInfo = new SrsPrintMgmtExecutionInfo();
FileIOPermission fileIOPermission;
CustCollectionLetterJour custCollectionLetterJour;
Filename fileName = @'C:\temp\custCollectionLetter.pdf';
;
select firstOnly custCollectionLetterJour;
args.record(custCollectionLetterJour);
CustCollectionJourController = new CustCollectionJourController();
CustCollectionJourController.parmReportName(ssrsReportStr(CustCollectionJour, Report));
CustCollectionJourContract = CustCollectionJourController.parmReportContract().parmRdpContract();
CustCollectionJourContract.parmRecordId(custCollectionLetterJour.RecId);
CustCollectionJourController.parmArgs(args);
srsReportRun = CustCollectionJourController.parmReportRun() as SrsReportRunImpl;
CustCollectionJourController.parmReportRun(srsReportRun);
CustCollectionJourController.parmReportContract().parmPrintSettings().printMediumType(SRSPrintMediumType::File);
CustCollectionJourController.parmReportContract().parmPrintSettings().overwriteFile(true);
CustCollectionJourController.parmReportContract().parmPrintSettings().fileFormat(SRSReportFileFormat::PDF);
fileIOPermission = new FileIOPermission(fileName, 'rw');
fileIOPermission.assert();
CustCollectionJourController.parmReportContract().parmPrintSettings().fileName(fileName);
//la riga di codice sottostante salva il report nei file temporanei dell'utente, non ho ben capito a cosa serve
//ma sembra sia obbligatorio altrimenti la stampa solleva un errore
executionInfo.parmOriginalDestinationFileName(WinApi::getTempPath()+conPeek(Global::fileNameSplit(fileName),2)+".pdf");
CustCollectionJourController.parmReportContract().parmReportExecutionInfo(executionInfo);
CustCollectionJourController.runReport();
CodeAccessPermission::revertAssert();
}
martedì 12 novembre 2013
AX 2012 - stampa report su PDF
Questo job stampa il report lettere di sollecito (CustCollectionJour) SSRS su file pdf. Il job è preso da quì apportando qualche piccola modifica.
Iscriviti a:
Commenti sul post (Atom)
Nessun commento:
Posta un commento