custaccountstatement report update the fields when report runs
Today we have requirement to update the fileds which is used in report. When the report runs to fill the value and display in report :-
To achieve this we have create a one class that helps for the print management and the after process done then update it :-
// DevOps-33918 - Extension class for custaccountstatement - CMS 17/03/2021
class AVACustAccountStatementExtExtension
{
// To set and return the custom report name and design
[SubscribesTo(classstr(PrintMgmtDocType), delegatestr(PrintMgmtDocType, getDefaultReportFormatDelegate))]
public static void getDefaultReportFormatDelegate(PrintMgmtDocumentType _docType, EventHandlerResult _result)
{
switch (_docType)
{
case PrintMgmtDocumentType::CustAccountStatement:
_result.result(ssrsReportStr(AVACustAccountStatementExt, Report));
break;
}
}
//Cust Account statement report - new field added Document date and to populate the document date from custtrans - CMS 17/03/2021
[PostHandlerFor(classStr(CustAccountStatementExtDP), methodStr(CustAccountStatementExtDP, processReport))]
public static void CustAccountStatementExtDP_Post_processReport(XppPrePostArgs args)
{
CustAccountStatementExtDP dpInstance = args.getThis() as CustAccountStatementExtDP;
CustAccountStatementExtTmp custAccountStatement = dpInstance.getCustAccountStatementExtTmp();
ttsbegin;
while select forUpdate custAccountStatement
{
custAccountStatement.AVADocumentDate = CustTrans::findFromInvoice(custAccountStatement.CustTrans_Invoice,custAccountStatement.CustTable_AccountNum).DocumentDate;
custAccountStatement.update();
}
ttscommit;
}
}
=======================================================================
Comments
Post a Comment