24 November 2020

Contract class example for SSRS report in D365FO

 Controller class example


/// TRG_AgedReceivables

/// <summary>

/// Controller class for Aged receivables report

/// </summary>

class TRG_SalesSummaryController extends SrsReportRunController

{

   


    public static TRG_SalesSummaryController construct()

    {

        return new TRG_SalesSummaryController();

    }


    public static void main(Args arg)

    {

        TRG_SalesSummaryController controller = TRG_SalesSummaryController::construct();

        

        controller.parmReportName(ssrsReportStr(TRG_SalesSummaryCurrencyReport, PrecisionDesign1));

        controller.parmArgs(arg);


        controller.startOperation();

    }


    protected void preRunModifyContract()

    {

        TRG_SalesSummaryContract   dataContract;

        

        TRG_SalesSummaryParameter TRG_SalesSummaryParameter;

        TRG_SalesSummary reportType;


        super();


        dataContract = this.parmReportContract().parmRdpContract() as TRG_SalesSummaryContract;


        reportType = dataContract.parmReportType();


        delete_from TRG_SalesSummaryParameter;


        TRG_SalesSummaryParameter.Fromdate =dataContract.parmFromDate();

        TRG_SalesSummaryParameter.Todate=dataContract.parmToDate();

        TRG_SalesSummaryParameter.Division=dataContract.parmDivisionId();

        TRG_SalesSummaryParameter.Category=dataContract.parmCategoryId();

        TRG_SalesSummaryParameter.Itemid=dataContract.parmItemId();

        TRG_SalesSummaryParameter.Warehouse=dataContract.parmInventLocationId();

        TRG_SalesSummaryParameter.Site = dataContract.parmInventSiteId();

        TRG_SalesSummaryParameter.Customer = dataContract.parmCustAccount();

        TRG_SalesSummaryParameter.SalesGroup= dataContract.parmCommissSalesGroup();

        TRG_SalesSummaryParameter.insert();

       

       

        switch (reportType)

        {

            case TRG_SalesSummary::Customer:

                this.getReportContract().parmReportName(ssrsReportStr(TRG_SalesSummaryCustomerReport, PrecisionDesign1));

                this.parmReportName(ssrsReportStr(TRG_SalesSummaryCustomerReport, PrecisionDesign1));

                break;


            case TRG_SalesSummary::Currency:

                this.getReportContract().parmReportName(ssrsReportStr(TRG_SalesSummaryCurrencyReport, PrecisionDesign1));

                this.parmReportName(ssrsReportStr(TRG_SalesSummaryCurrencyReport, PrecisionDesign1));

                

                break;

        }


       

    }


}


===========================================================



/// TRG_AgedReceivables

/// <summary>

/// Controller class for Aged receivables report

/// </summary>

class TRG_InvoiceHistoryController extends SrsReportRunController

{

   


    public static TRG_InvoiceHistoryController construct()

    {

        return new TRG_InvoiceHistoryController();

    }


    public static void main(Args arg)

    {

        TRG_InvoiceHistoryController controller = TRG_InvoiceHistoryController::construct();

        

        controller.parmReportName(ssrsReportStr(TRG_InvoiceHistory, DetailByEachBillingWithCost));

        controller.parmArgs(arg);


        controller.startOperation();

    }


    protected void preRunModifyContract()

    {

        TRG_InvoiceHistoryContract   dataContract;


        TRG_SalesSummaryParameter TRG_SalesSummaryParameter;

        TRG_InvoiceHistory reportType;


        super();


        dataContract = this.parmReportContract().parmRdpContract() as TRG_InvoiceHistoryContract;


        reportType = dataContract.parmReportType();


        //delete_from TRG_SalesSummaryParameter;


        //TRG_SalesSummaryParameter.Fromdate =dataContract.parmFromDate();

        //TRG_SalesSummaryParameter.Todate=dataContract.parmToDate();

        //TRG_SalesSummaryParameter.Division=dataContract.parmDivisionId();

        //TRG_SalesSummaryParameter.Category=dataContract.parmCategoryId();

        //TRG_SalesSummaryParameter.Itemid=dataContract.parmItemId();

        //TRG_SalesSummaryParameter.Warehouse=dataContract.parmInventLocationId();

        //TRG_SalesSummaryParameter.Site = dataContract.parmInventSiteId();

        //TRG_SalesSummaryParameter.Customer = dataContract.parmCustAccount();

        //TRG_SalesSummaryParameter.SalesGroup= dataContract.parmCommissSalesGroup();

        //TRG_SalesSummaryParameter.insert();



        switch (reportType)

        {

            case TRG_InvoiceHistory::DetailByEachBillingWithCost:

                this.getReportContract().parmReportName(ssrsReportStr(TRG_InvoiceHistory, DetailByEachBillingWithCost));

                this.parmReportName(ssrsReportStr(TRG_InvoiceHistory, DetailByEachBillingWithCost));

                break;


            case TRG_InvoiceHistory::DetailByEachBillingWithOutCost:

                this.getReportContract().parmReportName(ssrsReportStr(TRG_InvoiceHistory, DetailByEachBillingWithOutCost));

                this.parmReportName(ssrsReportStr(TRG_InvoiceHistory, DetailByEachBillingWithOutCost));


                break;

        }



    }


}


No comments:

Post a Comment

Give me the commetns and solutions

Ledger Voucher creation Framework and x++ code to create ledger voucher

 Please click her for MS reference file Below is the out of the box example reference and code. SalesInvoiceJournalPostSubBill_Extension->...