The looping part of the visualforce
<apex:repeat value="{!opp90Map}" var="category" >
<td width="25%" valign="top">
<apex:pageBlock title="Top 90 Opp for {!category}">
<apex:pageBlockTable value="{!opp90Map[category]}" var="opp">
and the map
the whole thing is a bit too big, but I include for completion sakepublic Map<String, List<OppWrapper>> opp90Map {get; set; }
repNameList = new List<String>{'Brit', 'Emma', 'Jeanette', 'Kara'};
opp90Map = new Map<String, List<oppWrapper>>();
Thanks,
public class GoalsOverView_Class {
List<Opportunity> oppListStart;
List<OppWrapper> opp90RepList;
public List<OppWrapper> opp90AllList { get; set; }
public List<OppWrapper> opp90BritList { get; set; }
public List<OppWrapper> opp90EmmaList { get; set; }
public List<OppWrapper> opp90JeanetteList { get; set; }
public List<OppWrapper> opp90KaraList { get; set; }
public List<String> repNameList {get; set; }
public Map<String, List<OppWrapper>> opp90Map {get; set; }
OppWrapper newOpp;
public aggregateResult aggOppTotal {get; set;}
decimal closedTotal;
public decimal variance {get; set;}
Rep_Goal__c goal;
Decimal goalTotal;
public Decimal oppTotal {get; set;}
String UserId;
public String userName {get; set;}
public GoalsOverView_Class() {
repNameList = new List<String>{'Brit', 'Emma', 'Jeanette', 'Kara'};
opp90Map = new Map<String, List<oppWrapper>>();
UserId = UserInfo.getUserId();
oppTotal = 0;
closedTotal = 0;
goalTotal = 0;
Variance = 0;
// top 10 all
oppListStart = [SELECT Name, StageName, Owner.firstname, Id, Amount, account.id, account.name, type, closedate FROM Opportunity
WHERE StageName = 'A. Pending Sale' AND Amount != 0 AND Amount != NULL AND OwnerID=:userID
ORDER BY Amount DESC LIMIT 10];
aggOppTotal = [SELECT Sum(Amount) TotalAmount FROM Opportunity WHERE StageName = 'W. Win' AND CloseDate = THIS_QUARTER];
goal = [SELECT Total_Revenue__c, Total_Margin__c, User__R.firstname FROM Rep_goal__c WHERE User__c = :userID AND Goals__r.Start_Date_of_new_Quarter__c = THIS_QUARTER];
goalTotal = goal.Total_Revenue__c;
closedTotal = (Decimal)aggOppTotal.get('TotalAmount');
opp90AllList = generateOppList(oppListStart, goalTotal, closedTotal);
for(String repName:repNameList) {
oppListStart = [SELECT Name, StageName, Owner.firstname, Id, Amount, account.id, account.name, type, closedate FROM Opportunity
WHERE Owner.firstname =:repName
ORDER BY Amount DESC LIMIT 10];
aggOppTotal = [SELECT Sum(Amount) TotalAmount FROM Opportunity WHERE StageName = 'W. Win' AND CloseDate = THIS_QUARTER];
goal = [SELECT Total_Revenue__c, Total_Margin__c, User__R.firstname FROM Rep_goal__c WHERE User__c = :userID AND Goals__r.Start_Date_of_new_Quarter__c = THIS_QUARTER];
goalTotal = goal.Total_Revenue__c;
closedTotal = (Decimal)aggOppTotal.get('TotalAmount');
opp90RepList = generateOppList(oppListStart, goalTotal, closedTotal);
opp90Map.put(repName, opp90RepList);
}
// Brit
opp90BritList = opp90Map.get('Brit');
opp90EmmaList = opp90Map.get('Emma');
opp90JeanetteList = opp90Map.get('Jeanette');
opp90KaraList = opp90Map.get('Kara');
}
public List<OppWrapper> generateOppList(List<Opportunity> oppListStart, Decimal goalTotal, Decimal closedTotal) {
List<OppWrapper> oppList = new List<OppWrapper>();
for (Opportunity opp:oppListStart) {
system.debug('username=' + opp.owner.firstname);
oppList.add(new OppWrapper(opp.owner.firstname, opp.account.name, opp.name, opp.CloseDate, opp.Amount, opp.id) );
oppTotal = oppTotal + opp.amount;
}
if (goalTotal == NULL) {goalTotal = 0; }
if (closedTotal == NULL) {closedTotal = 0; }
oppList.add(new OppWrapper(NULL, NULL, 'Total Open Opp', NULL, OppTotal, NULL));
oppList.add(new OppWrapper(NULL, NULL, NULL, NULL, NULL, NULL));
oppList.add(new OppWrapper(NULL, NULL, 'Total Closed Opp', NULL, closedTotal, NULL));
oppList.add(new OppWrapper(NULL, NULL, 'Total Goal', NULL, goalTotal, NULL));
return oppList;
}
public class OppWrapper {
public String oppName {get; set; }
public String acctName {get; set; }
public String repName {get; set; }
public Date closeDate {get; set; }
public Decimal amount {get; set; }
public String Id {get; set; }
public OppWrapper(String repName, String acctName, String oppName, Date closedate, Decimal amount, String id) {
this.oppName = oppName;
this.closeDate = closeDate;
this.amount = amount;
this.id = id;
this.acctname = acctName;
this.repName = repName;
}
}
}
From the error I see, I think there is some problem with the way Date is getting converted when putting it in a map. To isolate the issue, I would first change the Date type in your wrapper class to String and see if it resolves the issue?