Customization on Po Report part 2
Today we have a requirement to customization on the PO report.
[ExtensionOf(classStr(PrintMgmtReportFormatPopulator))]
final class MMSPrintMgmtReportFormatPopulator_Extension
{
#ISOCountryRegionCodes
#PrintMgmtSetup
/// <summary>
/// Adds records to the <c>PrintMgmtReportFormat</c> table.
/// </summary>
protected void addDocuments()
{
next addDocuments();
this.mmsAddPurchaseDocuments();
}
/// <summary>
/// Adds purchase records to the <c>PrintMgmtReportFormat</c> table.
/// </summary>
protected void mmsAddPurchaseDocuments()
{
//PO confirmation
this.addOther(PrintMgmtDocumentType::PurchaseOrderRequisition,
ssrsReportStr(MMSPurchPurchaseOrder,Report),
ssrsReportStr(MMSPurchPurchaseOrder,Report),#NoCountryRegionId);
}
}
=================================================================
/// <summary>
/// Add the custom report for the sales invoice i.e "MMSSalesInvoice.Report" in the prient management setting.
/// </summary>
class MMSPrintMgtDocTypeHandlersExt
{
[SubscribesTo(classstr(PrintMgmtDocType), delegatestr(PrintMgmtDocType, getDefaultReportFormatDelegate))]
public static void getDefaultReportFormatDelegate(PrintMgmtDocumentType _docType, EventHandlerResult _result)
{
switch (_docType)
{
// Sales invoice report.
case PrintMgmtDocumentType::SalesOrderInvoice:
_result.result(ssrsReportStr(MMSSalesInvoice, Report));
break;
//PO Confirmation report.
case PrintMgmtDocumentType::PurchaseOrderRequisition:
_result.result(ssrsReportStr(MMSPurchPurchaseOrder,Report));
break;
}
}
}
=====================================================================
/// <summary>
/// Extension of the controller class to call the custom design of report "MMSPurchPurchaseOrder.report" for MMS legal entity.
/// </summary>
class MMSPurchPurchaseOrderController extends PurchPurchaseOrderController
{
public static MMSPurchPurchaseOrderController construct()
{
return new MMSPurchPurchaseOrderController();
}
public static void main(Args _args)
{
SrsReportRunController formLetterController = MMSPurchPurchaseOrderController::construct();
MMSPurchPurchaseOrderController controller = formLetterController;
if(curExt() == "MMS")
{
controller.parmReportName(ssrsReportStr(MMSPurchPurchaseOrder, Report));
}
else
{
controller.parmReportName(ssrsReportStr(HSPurchPurchaseOrder, Report));
}
controller.parmArgs(_args);
formLetterController.parmShowDialog(false);
controller.startOperation();
}
public static SrsReportDataContract newDataContract(Args _args)
{
MMSPurchPurchaseOrderController formLetterController = MMSPurchPurchaseOrderController::construct();
if (_args.dataset() != tableNum(VendPurchOrderJour))
{
throw error(strFmt("@SYS19306",funcName()));
}
formLetterController.initDataContract(_args, PrintMgmtDocType::construct(PrintMgmtDocumentType::PurchaseOrderRequisition).getDefaultReportFormat());
return formLetterController.parmReportContract();
}
}
==================================================================
Comments
Post a Comment