Skip to main content
Can any one help on this .The Scenario is the product name get repeated in different quarters(Say q1,q2,q3,q4) and need to filter by adding its quantity and Amount.I get the Quantities and Amount with the total displayed with the Product Name for all the 4 quarters.Now i would like to get the Subtotals added and displayed.

1)How to get Subtotal Added and displayed on a VIsual force page which is in PDF format.

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 

 

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);

Any help is very much appreciated.

 
4 个回答
  1. 2015年3月2日 13:14

    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;

    }

    }

     
0/9000