Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. public List<BarData> getOpportunityTarget(){
  2. Integer CurrentMonth = Date.Today().Month();
  3. Decimal total = 0.0;
  4. TargetList = new List<BarData>();
  5. if(MonthlyTargetMap.get(currentMonth) != null){
  6. if(OpportunityList.size()>0){
  7. for(Opportunity objOpportunity : OpportunityList){
  8. if(objOpportunity.StageName == 'Approved' && objOpportunity.Amount != null && objOpportunity.closeDate.Month() == CurrentMonth){
  9. total += objOpportunity.Amount;
  10. }
  11. }
  12. TargetList.add(new BarData('Closed',total.setScale(0)));
  13. TargetList.add(new BarData('Target',MonthlyTargetMap.get(currentMonth).setScale(0)));
  14. }else{
  15. TargetList.add(new BarData('Closed',0));
  16. TargetList.add(new BarData('Target',MonthlyTargetMap.get(currentMonth).setScale(0)));
  17. }
  18. }
  19. return TargetList;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement