
Greetings dears!
I have modified the design for the Project Invoice named "PSAProjInvoice".
But I'm unable to add my custom report design in the print management under Project Management and accounting > Set up > Form set up.
I have created 2 classes:
1- Extension of PrintMgmtReportFormatPopulator
[ExtensionOf(classStr(PrintMgmtReportFormatPopulator))]
public final class PrintMgmtReportFormatPopulator_Extension
{
#ISOCountryRegionCodes
#PrintMgmtSetup
#RusReportFormats
public void populate(boolean _deleteAll, boolean _showConfirmation)
{
next populate(_deleteAll, _showConfirmation);
this.addOther(PrintMgmtDocumentType::SIManagedProjInvoice,
ssrsReportStr(Custom_PSAProjInvoice, PrecisionDesign1),
ssrsReportStr(Custom_PSAProjInvoice, PrecisionDesign1),
#NoCountryRegionId);
this.addOther(PrintMgmtDocumentType::SIManagedProjInvoiceWithBR,
ssrsReportStr(Custom_PSAProjInvoice, PrecisionDesign1),
ssrsReportStr(Custom_PSAProjInvoice, PrecisionDesign1),
#NoCountryRegionId);
this.addOther(PrintMgmtDocumentType::ProjectInvoice,
ssrsReportStr(Custom_PSAProjInvoice, PrecisionDesign1),
ssrsReportStr(Custom_PSAProjInvoice, PrecisionDesign1),
#NoCountryRegionId);
}
}
2- Handler class that subscribes to PrintMgmtDocType
class Custom_PrintMgmtDocTypeHandler
{
[SubscribesTo(classStr(PrintMgmtDocType), delegateStr(PrintMgmtDocType, getDefaultReportFormatDelegate))]
public static void getDefaultReportformatDelegateHandler(PrintMgmtDocumentType _docType, EventHandlerResult _result)
{
switch(_docType)
{
case PrintMgmtDocumentType::SIManagedProjInvoice:
_result.result(ssrsReportStr(Custom_PSAProjInvoice, PrecisionDesign1));
break;
case PrintMgmtDocumentType::SIManagedProjInvoiceWithBR:
_result.result(ssrsReportStr(Custom_PSAProjInvoice, PrecisionDesign1));
break;
case PrintMgmtDocumentType::ProjectInvoice:
_result.result(ssrsReportStr(Custom_PSAProjInvoice, PrecisionDesign1));
break;
}
}
}
This type of implementation was working for me with Customer and Vendor invoices.
But it's not working with project invoices.
What am I missing?
Any advice is appreciated!
Thanks in advance !
It turns out that the code above works fine but I was using wrong document types in the switch statement.
The following code includes the correct document type:
class Custom_PrintMgmtDocTypeHandler
{
[SubscribesTo(classStr(PrintMgmtDocType), delegateStr(PrintMgmtDocType, getDefaultReportFormatDelegate))]
public static void getDefaultReportformatDelegateHandler(PrintMgmtDocumentType _docType, EventHandlerResult _result)
{
switch(_docType)
{
case PrintMgmtDocumentType::SIProjInvoice:
_result.result(ssrsReportStr(Custom_PSAProjInvoice, PrecisionDesign1));
break;
}
}
}