You need to sign in to do that
Don't have an account?
suji srinivasan
How to write two methods in apex wrapperclass? I am getting error for my second method
public class SalaryRewards {
public List <salaryInfo> lsalaryInfo{get;set;}
public List <Salary_Detail__c> salarydetail{get;set;}
public SalaryRewards(ApexPages.StandardController controller)
{
lsalaryInfo = new list <salaryInfo>();
salarydetail = new list<Salary_Detail__c>();
salarydetail =[SELECT Id, Professional_Tax__c,BasicAllowance__c,HouseRentAllowance__c,Skill_up_Allowance__c,PF__c,SpecialAllowance__c,TotalEarnings__c,TotalDeductions__c, NetPay__c,createdDate FROM Salary_Detail__c WHERE createdDate = THIS_YEAR ];
for(integer i=0;i<System.now().month();i++)
{
salaryInfo sinfo = new salaryInfo ();
sinfo.month = datetime.newinstance(2013,1,1).addmonths(i).format('MMM');
sinfo.count = 0;
lsalaryInfo.add(sinfo);
system.debug('salary-month===>'+lsalaryInfo);
}}
// lsalaryInfo = new List <salaryInfo>();
public getsalary(){
for( Salary_Detail__c sal :[SELECT Id, Professional_Tax__c,BasicAllowance__c,HouseRentAllowance__c,Skill_up_Allowance__c,PF__c,SpecialAllowance__c,TotalEarnings__c,TotalDeductions__c, NetPay__c,createdDate FROM Salary_Detail__c WHERE createdDate = THIS_YEAR ]){
//Integer Basic_Allowance = integer.valueof(sal.get(''));
lsalaryInfo.add(new salaryInfo(Salary_Detail__c= salarydetail.BasicAllowance__c));
system.debug('salary-month===>'+lsalaryInfo);}}
}
I got invalid constructor error for the highlighted code
Thanks in advance .
public List <salaryInfo> lsalaryInfo{get;set;}
public List <Salary_Detail__c> salarydetail{get;set;}
public SalaryRewards(ApexPages.StandardController controller)
{
lsalaryInfo = new list <salaryInfo>();
salarydetail = new list<Salary_Detail__c>();
salarydetail =[SELECT Id, Professional_Tax__c,BasicAllowance__c,HouseRentAllowance__c,Skill_up_Allowance__c,PF__c,SpecialAllowance__c,TotalEarnings__c,TotalDeductions__c, NetPay__c,createdDate FROM Salary_Detail__c WHERE createdDate = THIS_YEAR ];
for(integer i=0;i<System.now().month();i++)
{
salaryInfo sinfo = new salaryInfo ();
sinfo.month = datetime.newinstance(2013,1,1).addmonths(i).format('MMM');
sinfo.count = 0;
lsalaryInfo.add(sinfo);
system.debug('salary-month===>'+lsalaryInfo);
}}
// lsalaryInfo = new List <salaryInfo>();
public getsalary(){
for( Salary_Detail__c sal :[SELECT Id, Professional_Tax__c,BasicAllowance__c,HouseRentAllowance__c,Skill_up_Allowance__c,PF__c,SpecialAllowance__c,TotalEarnings__c,TotalDeductions__c, NetPay__c,createdDate FROM Salary_Detail__c WHERE createdDate = THIS_YEAR ]){
//Integer Basic_Allowance = integer.valueof(sal.get(''));
lsalaryInfo.add(new salaryInfo(Salary_Detail__c= salarydetail.BasicAllowance__c));
system.debug('salary-month===>'+lsalaryInfo);}}
}
I got invalid constructor error for the highlighted code
Thanks in advance .
Refer the below link have solution for similar kind of ask.
https://developer.salesforce.com/forums/?id=906F00000008y7QIAQ
Thanks!!