web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Sales invoice report - download multiple sales invoice on a single button click

(0) ShareShare
ReportReport
Posted on by 133

Hi experts

I am working on Sales invoice report and the requirement is that -

We select multiple invoices and add one button. On the button click selected invoices download into archive folder.

I tried all ways but no luck.

I am looking your help. Kindly suggest some solution

many thanks in advance.

Below things I have done:

1. created new controller class and wrote below code but got the currency exchange related error that is the reason wrote exchange rate related ocde but

    still I am getting the same exchange rate related error

public class XXXSalesInvoiceController extends SrsReportRunController

{

public static void main(Args _args)

{
XXXSalesInvoiceController controller = new XXXSalesInvoiceController();
SalesInvoiceContract rdpContract = new SalesInvoiceContract();
ExchangeRateHelper exchangeRateHelper = ExchangeRateHelper::construct();
exchangeRateHelper.parmFromCurrency("USD");

controller.parmArgs(_args);
controller.parmReportName(ssrsReportStr(XXX_SalesInvoice, Report));
controller.parmShowDialog(false);
controller.parmReportContract().parmRdpContract(rdpContract);

str ext = SRSPrintDestinationSettings::findFileNameType(SRSReportFileFormat::PDF, SRSImageFileFormat::BMP);
SRSPrintDestinationSettings printerSettings = controller.parmReportContract().parmPrintSettings();
printerSettings.printMediumType(SRSPrintMediumType::File);
printerSettings.fileFormat(SRSReportFileFormat::PDF);
printerSettings.parmFileName('custInvoiceJour.InvoiceId' + ext);
printerSettings.overwriteFile(true);

controller.startOperation();
}

2. My second attempt is:

ExtensionOf(classStr(PrintMgmtReportRun))]
final class XXX_PrintMgmtReportRun_Class_Extension

{

public void loadSettingDetail(PrintMgmtPrintSettingDetail _settingDetail, str _documentKeyValue)
{
SalesInvoiceController invController;
CustInvoiceJour custInvoiceJour;

if (this.parmDocType() == PrintMgmtDocumentType::SalesOrderInvoice)
{
if (ssrsReportStr(XXX_SalesInvoice, Report) == this.parmReportRunController().parmReportName())
{
invController = this.currentController;
custInvoiceJour = invController.parmArgs().record() as CustInvoiceJour;

_settingDetail.parmReportFormatName(ssrsReportStr(SalesInvoice, Report));


str ext = SRSPrintDestinationSettings::findFileNameType(SRSReportFileFormat::PDF, SRSImageFileFormat::BMP);
SRSPrintDestinationSettings printerSettings = invController.parmReportContract().parmPrintSettings();
printerSettings.printMediumType(SRSPrintMediumType::File);
printerSettings.fileFormat(SRSReportFileFormat::PDF);
printerSettings.parmFileName(custInvoiceJour.InvoiceId + ext);
printerSettings.overwriteFile(true);

}
}

next loadSettingDetail(_settingDetail, _documentKeyValue);
}

3. Third attempt:

[ExtensionOf(classStr(SalesInvoiceController))]
final public class XXX_SalesInvoiceController_Class_Extension
{

protected void runPrintMgmt()
{

  str ext = SRSPrintDestinationSettings::findFileNameType(SRSReportFileFormat::PDF, SRSImageFileFormat::BMP);
 SRSPrintDestinationSettings printerSettings;// = formLetterReport.parmReportContract().parmPrintSettings();  // unable to get control instance
 printerSettings.printMediumType(SRSPrintMediumType::File);
 printerSettings.fileFormat(SRSReportFileFormat::PDF);
 printerSettings.parmFileName('custInvoiceJour.InvoiceId' + ext);
 printerSettings.overwriteFile(true);

next runPrintMgmt();
}

protected void prePromptModifyContract()
{
next prePromptModifyContract();

SalesInvoiceContract contract = this.parmReportContract().parmRdpContract() as SalesInvoiceContract;
if(this.parmArgs().dataset() == tableNum(CustInvoiceJour))
{
CustInvoiceJour custInvoiceJour = this.parmArgs().record() as CustInvoiceJour;
contract.parmRecordId(CustInvoiceJour.RecId);

str ext = SRSPrintDestinationSettings::findFileNameType(SRSReportFileFormat::PDF, SRSImageFileFormat::BMP);
SRSPrintDestinationSettings printerSettings = this.parmReportContract().parmPrintSettings();
printerSettings.printMediumType(SRSPrintMediumType::File);
printerSettings.fileFormat(SRSReportFileFormat::PDF);
printerSettings.parmFileName(custInvoiceJour.InvoiceId + ext);
printerSettings.overwriteFile(true);
}
}

I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 544 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 450 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans