Skip to main content
1 of 2
Shrey
  • 151
  • 1
  • 3
  • 10

Need Apex Logic

I have a leave__c as a custom object. It contains 3 fields: Employee Name (lookup to User), Leave Start Date (Date) and Leave End Date (Date). Example: User "John" is on leave from Start Date "4th Jan 2018" to End Date "12th Jan 2018". Like wise there can be multiple leave records for different users. I want to generate a apex logic such that for month of January (1st Jan to 31t Jan 2018), weekwise how many users are on leave. I want to displa this info in VF Page in table format for reporting purpose.

So I am planning to create a wrapper as below:

dateWiseWrapper{ Date leaveDate; Boolean isOnLeave; }

weekWiseWrapper{ Integer weekNumber; Integer NumberofLeaves; List //Max 7 days }

UserWrapper{ User u; List; //Max 4 weeks }

UserWeekwiseResultWrapper{ List userWrapperList; }

Does my wrapper looks correct? Can you please help me out on how do I proceed with the apex logic

Shrey
  • 151
  • 1
  • 3
  • 10