
I get the Table Created as :
ProductName Q1 Q2 Q3 Q4 Total
ABC 100 200 300 400 1000
PQR 50 150 250 350 800
XYZ 200 300 400 500 1400
SubTotal
GrandTotal
But the table should get displayed as :
ProductName Q1 Q2 Q3 Q4 Total
ABC 100 200 300 400 1000
PQR 50 150 250 350 800
XYZ 200 300 400 500 1400
SubTotal 350 650 950 1250 3200 /Subtotalshouldgetdisplayed
GrandTotal 350 650 950 1250 3200
Here is Code written but it does not gives the correct value
Any help is very much appreciated.Public Integer subtotalofquantity{get;set;}
Public Integer subtotalofamount{get;set;}
subtotalofquantity=0;
subtotalofamount=0;
for (Quote qt :q){
System.debug('Quote Size ++ '+q.size());
System.debug('opp forcast ++ ' +opflist.size());
for(integer i=0;i<opflist.size();i++){
subtotalofquantity+= integer.valueOf(opflist[i].gmod__Quantity__c);
subtotalofamount+= integer.valueOf(opflist[i]. gmod__Amount__c);

Hi Can you try the below one,
Public Integer subtotalofquantity{get;set;}
Public Integer subtotalofamount{get;set;}
subtotalofquantity = 0;
subtotalofamount = 0;
Integer tempsubtotalofquantity=0;
Integer tempsubtotalofamount=0;
for (Quote qt :q){
System.debug('Quote Size ++ '+q.size());
System.debug('opp forcast ++ ' +opflist.size());
for(integer i=0;i<opflist.size();i++){
tempsubtotalofquantity+= integer.valueOf(opflist[i].gmod__Quantity__c);
subtotalofquantity = tempsubtotalofquantity;
tempsubtotalofamount+= integer.valueOf(opflist[i]. gmod__Amount__c);
subtotalofamount =tempsubtotalofamount;
}
}