Customize purchase order confirmation request report.

 Today we have a requirement that create a customization on the po confirmation report 


1) Create a controller class.


/// <summary>

/// The <c>PurchConfirmationRequestControllerExt</c> class starts the purchase order confirmation request report.

/// </summary>

public class AVAPurchConfirmationRequestControllerExt extends PurchConfirmationRequestController

{

  

  

    



    public static AVAPurchConfirmationRequestControllerExt construct()

    {

        return new AVAPurchConfirmationRequestControllerExt();

    }


    public static void main(Args _args)

    {

        SrsReportRunController          formLetterController = AVAPurchConfirmationRequestControllerExt::construct();

        AVAPurchConfirmationRequestControllerExt    controller =  AVAPurchConfirmationRequestControllerExt::construct();


        controller.parmReportName(ssrsReportStr(AVAPurchPurchaseOrder, Report));

        controller.parmArgs(_args);

        controller.startOperation();

    }


    public static SrsReportDataContract newDataContract(Args _args)

    {

        AVAPurchConfirmationRequestControllerExt formLetterController = AVAPurchConfirmationRequestControllerExt::construct();


        if (_args.dataset() != tableNum(PurchConfirmationRequestJour))

        {

            throw error(strFmt("@SYS19306",funcName()));

        }


        formLetterController.initDataContract(_args, ssrsReportStr(AVAPurchPurchaseOrder, Report));


        return formLetterController.parmReportContract();

    }


    /// <summary>

    /// 34124  - add the PO number in the email subject

    /// </summary>

    public void runReport()

    {

        PurchaseOrderId purchId =  purchConfirmationRequestJour.DocumentNumber;

        if (reportContract.parmPrintSettings().printMediumType() == SRSPrintMediumType::Email)

        {

            reportContract.parmPrintSettings().emailSubject(Global::strReplace(reportContract.parmPrintSettings().emailSubject(),"@PurchId@",purchId));

        }

        super();

    }


}


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

Comments

Popular posts from this blog

Customization on Sales invoice Report in D365 F&O

75) COC - Create a coc of the table modified method

46) D365 FO: SHAREPOINT FILE UPLOAD USING X++