简体   繁体   中英

How can I set a report parameter based on the print medium type?

I need to toggle some presentation in my SSRS Report based on the print medium the report will be generated on.

I have to do this for a bunch of reports (SalesInvoice, SalesConfirm, SalesQuotation).

The problem is I can't find an access point where I have access to both things:

  • In the SalesInvoiceJournalPost class I have access to the printmedium but not the SalesInvoiceContract
  • In the SalesInvoiceController class I have access to the SalesInvoiceContract but the printsettings are giving me false values

In SalesInvoiceJournalPost.init I try:

printSettings = SysOperationHelper::base64Decode(chainFormletterContract.parmPrintersettingsFormletter());
printDestinationSettings = new SRSPrintDestinationSettings(printSettings);

if (printDestinationSettings.printMediumType() == SRSPrintMediumType::Email)
{
    // Can't access Report Parameter from here
}

In SalesInvoiceController.main I try:

printDestination = formLetterController.parmReportContract().parmPrintSettings();
salesInvoiceContract = formLetterController.parmReportContract().parmRdpContract() as SalesInvoiceContract;
salesInvoiceContract.paramMyValue(
    // this is always false because printMedium is always Screen
    printDestination.printMediumType() == SRSPrintMediumType::Email
);

Turns out you can get the SRSPrintDestinationSettings from the controller after all with a few degrees of separation. This is SalesInvoiceController.outputReport :

PrintMgmtPrintSettingDetail printSettingDetail;
SRSPrintDestinationSettings printDestinationSettings;

printSettingDetail = formLetterReport.getCurrentPrintSetting();
printDestinationSettings = printSettingDetail.parmPrintJobSettings();
salesInvoiceContract.paramMyValue(
    printDestinationSettings.printMediumType() == SRSPrintMediumType::Email
);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM