Tuesday, January 24, 2023

How to create print management

[ExtensionOf(classStr(PrintMgmtDocType))]

public final class xyzPrintMgmtDocType_Extension

{

  [SubscribesTo(classStr(PrintMgmtDocType), delegateStr(PrintMgmtDocType, getDefaultReportFormatDelegate))]

  public static void PrintMgmtDocType_getDefaultReportFormatDelegate(PrintMgmtDocumentType _docType, EventHandlerResult _result)

  {

    switch (_docType)

    {

      case PrintMgmtDocumentType:: xyzProFormaInvoice :

        _result.result(ssrsReportStr(xyzProformaInvoiceSO,Report));

        break;

    }

  }

}


[ExtensionOf(classStr(PrintMgmtDocType))]

public final class xyzPrintMgmtDocType_Extension

{

  [SubscribesTo(classStr(PrintMgmtDocType), delegateStr(PrintMgmtDocType, getDefaultReportFormatDelegate))]

  public static void PrintMgmtDocType_getDefaultReportFormatDelegate(PrintMgmtDocumentType _docType, EventHandlerResult _result)

  {

    switch (_docType)

    {

      case PrintMgmtDocumentType::xyzProFormaInvoice :

        _result.result(ssrsReportStr(xyzProformaInvoiceSO,Report));

        break;

    }

  }


[ExtensionOf(classStr(PrintMgmtReportFormatPublisher))]

public final class CPLPrintMgmtReportFormatPublisher_Extension

{

  [SubscribesTo(classStr(PrintMgmtReportFormatPublisher), delegateStr(PrintMgmtReportFormatPublisher, notifyPopulate))]

  public static void PrintMgmtReportFormatPublisher_notifyPopulate()

  {

    #PrintMgmtSetup

 

    void addFormat(PrintMgmtDocumentType _type, PrintMgmtReportFormatName _name,

                   PrintMgmtReportFormatCountryRegionId _countryRegionId = #NoCountryRegionId)

    {

      CPLProformaInvoiceAddPrintMgmtReportFormat::addPrintMgmtReportFormat(_type, _name, _name,

               _countryRegionId);

    }

 

    addFormat(PrintMgmtDocumentType::CPLProFormaInvoice,

                      ssrsReportStr(CPLProformaInvoiceSO, Report));

  }

}



class XYZProformaInvoiceAddPrintMgmtReportFormat

{

  public static void addPrintMgmtReportFormat(

        PrintMgmtDocumentType _type,

        PrintMgmtReportFormatName _name,

        PrintMgmtReportFormatDescription _description,

        PrintMgmtReportFormatCountryRegionId _countryRegionId,

        PrintMgmtReportFormatSystem _system = false,

        PrintMgmtSSRS _ssrs = PrintMgmtSSRS::SSRS)

  {

    PrintMgmtReportFormat printMgmtReportFormat;

 

    select firstonly printMgmtReportFormat

            where printMgmtReportFormat.DocumentType == _type

                && printMgmtReportFormat.Description == _description

                && printMgmtReportFormat.CountryRegionId == _countryRegionId;

 

    if (!printMgmtReportFormat)

    {

      // Add the new format

      printMgmtReportFormat.clear();

      printMgmtReportFormat.DocumentType = _type;

      printMgmtReportFormat.Name = _name;

      printMgmtReportFormat.Description = _description;

      printMgmtReportFormat.CountryRegionId = _countryRegionId;

      printMgmtReportFormat.System = _system;

      printMgmtReportFormat.ssrs = _ssrs;

      printMgmtReportFormat.insert();

    }

  }


}



No comments:

Post a Comment

Build Explained

Useful Blogs. https://axtechsolutions.blogspot.com/2018/08/performing-builds-in-d365.html https://community.dynamics.com/blogs/post/?postid=...