How to change Purchase Order Confirmation report design with your own design in X++?

How can we override Purchase Order Confirmation report design with our own report and design in X++?

To do so, it has two methods you need to change, one is mandatory and another one is needed only if you use Print Management. They are local function loadPrintSettings.setSettingDetail in FormLetterReport class and local function getSettings.makeSettingDetail in PrintMgmt class.

For FormLetterReport class, the code is something like below:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
public void loadPrintSettings(Common _jourTable, Common _transTable, str _languageId, str _documentKeyValue = '')
{
    //.....
    void setSettingDetail(PrintMgmtDocInstanceType _type, SRSPrintDestinationSettings _defaultSettings)
    {
        PrintMgmtPrintSettingDetail printSettingDetail = new PrintMgmtPrintSettingDetail();
        //.....
            printSettingDetail.parmReportFormatName(PrintMgmtReportFormat::findSystem(this.getPrintMgmtDocumentType()).Name);
            //Override here
            if(printMgmtReportRun.parmDocType() == PrintMgmtDocumentType::PurchaseOrderRequisition)
            {
                printSettingDetail.parmReportFormatName(ssrsReportStr(YourNewPurchPurchaseOrderReport, YourDesign));
            }
        //.....
    }
    //.....
}

Finally, you need to make the modification at local function getSettings.makeSettingDetail in PrintMgmt class if using Print Management.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
public static PrintMgmtPrintSetting getSettings(PrintMgmtPrintContext _printContext)
{
    //.....
    PrintMgmtPrintSettingDetail makeSettingDetail(PrintMgmtSetupSettings _setupSettings)
    {
        PrintMgmtPrintSettingDetail newSettingDetail = new PrintMgmtPrintSettingDetail();
        //.....
        newSettingDetail.parmReportFormatName(PrintMgmtReportFormat::findWithSystem(_setupSettings.parmReportFormat(), instance.parmParent().parmDocumentType()).Name);
        //Override here
        if(instance.parmParent().parmDocumentType() == PrintMgmtDocumentType::PurchaseOrderRequisition)
        {
            newSettingDetail.parmReportFormatName(ssrsReportStr(YourNewPurchPurchaseOrderReport, YourDesign));
        }
        //.....
    }
    //.....
}

Alternately, you can override the PurchPurchaseOrderController.outputReport method like the one in Sales Invoice report (create a new override method if not exist).

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s