Customer Aging Report - Global Level i.e. Company Level i.e. Legal Entity
Main Logic to convert existing Customer Aging Report into Company Level Aging Report by adding ChangeCompany(CompanyName) in ProcessReport Method of Report DP Class.
Step 1 Include new Parameter in Contract Class i.e. CustAgingReportContract
1.1. Declare List entity; in Class Declaration of CustAgingReportContract Class
1.2 CustAgingReportContract --> New Method -->
[DataMemberAttribute('Entity'),
AifCollectionTypeAttribute('Entity', Types::String),
SysOperationLabelAttribute(literalstr("Entity")),
SysOperationHelpTextAttribute(literalstr("Entity"))]
public List parmEntity(List _entity = entity)
{entity = _entity;
return entity;}
1.3 Add new validation in validate() method
if(!lstEntities.elements())
{
ret = checkFailed("@SYS330812");
}
Step 2 Include New Param in UI Builder for LegalEntity CustAgingReportUIBuilder
2.1 Declare in Class Declaration DialogField dialogEntity;
2.2 Include below code in build()
dialogEntity= this.bindInfo().getDialogField(custAgingReportContract1,methodStr(CustAgingReportContract, parmEntity));
if (dialogEntity){dialogEntity.lookupButton(2);}
2.3 Add new method for Legal Entity Lookup
public void lookupEntity (FormStringControl _formStringControl)
{
Query query = new Query();
TableId multiSelectTableNum = tableNum(DataArea);
container selectedFields = [multiSelectTableNum, fieldName2id(multiSelectTableNum, fieldStr(DataArea, id))];
query.addDataSource(tableNum(DataArea));
query.dataSourceTable(tableNum(DataArea)).addSelectionField(fieldNum(DataArea,id));
query.dataSourceTable(tableNum(DataArea)).addSelectionField(fieldNum(DataArea,Name));
SysLookupMultiSelectGrid::lookup(query, _formStringControl,_formStringControl,selectedFields);
}
2.4 Include below code in postRun()
dialogEntity.registerOverrideMethod(methodStr(FormStringControl, lookup),methodStr(CustAgingReportUIBuilder,lookupEntity),this);
Step 3 Update processReport method in CustAgingReportDP
Add ChangeCompany logic as per user legal entity filter
public void processReport()
{
QueryRun qr;
ForwardBackwardPrinting tmpDirection;
boolean reverseAmountsAndHeadings;
boolean isPublicSectorScenario;
List lstEntities = new List(Types::String);
ListIterator iterator;
str LE,second;
contract = this.parmDataContract() as CustAgingReportContract;
lstEntities=contract.parmEntity();
iterator = new ListIterator(lstEntities);
while(iterator.more())
{
LE= iterator.value();
changeCompany(LE)
{
qr = new QueryRun(this.parmQuery());
..........
.........
Other Logics follows
..........
..........
//Pass Company Value to below method and save it in Tmp Table
this.insertCustAgingReportTmp(reverseAmountsAndHeadings,LE);
}
iterator.next();
}
}
Step 4 Update insertCustAgingReport method in CustAgingReportDP
4.1 Insert new Fields in custAgingReportTmp table for Company and Company Currency
private void insertCustAgingReportTmp(boolean _reverseAmountsAndHeadings,str LE)
{
......
String255 LegalEntity=LE;
String255 CC= Ledger::accountingCurrency(CompanyInfo::current());
//Insert above string values in custAgingReportTmp Table and show it in report with Company Grouping.
}
Parameters
Report Output - (Change or Create new Precision design for Company based report or keep existing report and add new field Company and Change the Group By Company)
Main Logic to convert existing Customer Aging Report into Company Level Aging Report by adding ChangeCompany(CompanyName) in ProcessReport Method of Report DP Class.
Step 1 Include new Parameter in Contract Class i.e. CustAgingReportContract
1.1. Declare List entity; in Class Declaration of CustAgingReportContract Class
1.2 CustAgingReportContract --> New Method -->
[DataMemberAttribute('Entity'),
AifCollectionTypeAttribute('Entity', Types::String),
SysOperationLabelAttribute(literalstr("Entity")),
SysOperationHelpTextAttribute(literalstr("Entity"))]
public List parmEntity(List _entity = entity)
{entity = _entity;
return entity;}
1.3 Add new validation in validate() method
if(!lstEntities.elements())
{
ret = checkFailed("@SYS330812");
}
Step 2 Include New Param in UI Builder for LegalEntity CustAgingReportUIBuilder
2.1 Declare in Class Declaration DialogField dialogEntity;
2.2 Include below code in build()
dialogEntity= this.bindInfo().getDialogField(custAgingReportContract1,methodStr(CustAgingReportContract, parmEntity));
if (dialogEntity){dialogEntity.lookupButton(2);}
2.3 Add new method for Legal Entity Lookup
public void lookupEntity (FormStringControl _formStringControl)
{
Query query = new Query();
TableId multiSelectTableNum = tableNum(DataArea);
container selectedFields = [multiSelectTableNum, fieldName2id(multiSelectTableNum, fieldStr(DataArea, id))];
query.addDataSource(tableNum(DataArea));
query.dataSourceTable(tableNum(DataArea)).addSelectionField(fieldNum(DataArea,id));
query.dataSourceTable(tableNum(DataArea)).addSelectionField(fieldNum(DataArea,Name));
SysLookupMultiSelectGrid::lookup(query, _formStringControl,_formStringControl,selectedFields);
}
2.4 Include below code in postRun()
dialogEntity.registerOverrideMethod(methodStr(FormStringControl, lookup),methodStr(CustAgingReportUIBuilder,lookupEntity),this);
Step 3 Update processReport method in CustAgingReportDP
Add ChangeCompany logic as per user legal entity filter
public void processReport()
{
QueryRun qr;
ForwardBackwardPrinting tmpDirection;
boolean reverseAmountsAndHeadings;
boolean isPublicSectorScenario;
List lstEntities = new List(Types::String);
ListIterator iterator;
str LE,second;
contract = this.parmDataContract() as CustAgingReportContract;
lstEntities=contract.parmEntity();
iterator = new ListIterator(lstEntities);
while(iterator.more())
{
LE= iterator.value();
changeCompany(LE)
{
qr = new QueryRun(this.parmQuery());
..........
.........
Other Logics follows
..........
..........
//Pass Company Value to below method and save it in Tmp Table
this.insertCustAgingReportTmp(reverseAmountsAndHeadings,LE);
}
iterator.next();
}
}
Step 4 Update insertCustAgingReport method in CustAgingReportDP
4.1 Insert new Fields in custAgingReportTmp table for Company and Company Currency
private void insertCustAgingReportTmp(boolean _reverseAmountsAndHeadings,str LE)
{
......
String255 LegalEntity=LE;
String255 CC= Ledger::accountingCurrency(CompanyInfo::current());
//Insert above string values in custAgingReportTmp Table and show it in report with Company Grouping.
}
Parameters
Report Output - (Change or Create new Precision design for Company based report or keep existing report and add new field Company and Change the Group By Company)
Comments
Post a Comment