{
HallmarkingIssRcvTable hallMarkingRecord;
SrsReportRunController reportController = new SrsReportRunController();
IssueforHallmarkingVoucherContract reportDataContract = new IssueforHallmarkingVoucherContract();
SRSPrintDestinationSettings printSettings;
FileName filename;
HallmarkingNo hallMarkingNo = '10Dckl000059955';
str directoryPath = @"C:\Temp\Reports\"; // Ensure this path is valid and accessible
hallMarkingRecord = HallmarkingIssRcvTable::find(hallMarkingNo);
{
// Ensure the directory exists
if (!WinAPI::pathExists(directoryPath))
{
WinAPI::createDirectoryPath(directoryPath);
}
filename = strFmt('%1%2%3', directoryPath, hallMarkingNo, ".pdf");
reportController.parmReportName(ssrsReportStr(IssueForHallmarkingVoucherReport, Report));
reportController.parmShowDialog(false);
reportDataContract.parmHallmarkingNo(hallMarkingNo);
reportController.parmReportContract().parmRdpContract(reportDataContract);
printSettings = reportController.parmReportContract().parmPrintSettings();
printSettings.printMediumType(SRSPrintMediumType::File);
printSettings.fileFormat(SRSReportFileFormat::PDF);
printSettings.overwriteFile(true);
printSettings.fileName(filename);
reportController.parmReportContract().parmPrintSettings(printSettings);
{
// Start the report operation
reportController.startOperation();
info("Report generation initiated.");
if (System.IO.File::Exists(filename))
{
info("Report file successfully created: " + filename);
}
else
{
error("Report file was not created.");
}
}
catch (Exception::Error)
{
error("An error occurred while generating the report.");
}
}
else
{
error("Hallmarking record not found for the given number.");
}
}

Report
All responses (
Answers (