Skip to main content
meghna m preguntó en #Visualforce
Can any one help me out .How to show past,current and future years data in visual force page pdf format . I get the data displayed for the current year (2015 ).Any Example, Any Suggestion .I shall appreciate your help.

Code :

for (gmod__Opportunity_Forecast__c oppforecast: opflist) {

String prodName = oppforecast.gmod__Product__r.Name;

String monthText = oppforecast.gmod__Month_Text__c;

Integer year = Integer.valueof(oppforecast.gmod__Year__c);

Integer previousyear = date.today().year()-1;

Integer currentyear = date.today().year();

Map<String, Decimal> quarterMap;

Map<String, Decimal> amountMap;

if ((monthText == 'Jan' || monthText == 'Feb' || monthText == 'Mar')&&(year==currentyear)){

quarterMap = Quarter1;

system.debug('quarterMap@@@@@@@@'+quarterMap);

amountMap = Amount1;

if (quarterMap.containskey(prodName)) {

quarterMap.put(prodName, quarterMap.get(prodName) + oppforecast.gmod__Quantity__c);

amountMap.put(prodName, amountMap.get(prodName) + oppforecast.gmod__Amount__c);

} else {

quarterMap.put(prodName, oppforecast.gmod__Quantity__c);

amountMap.put(prodName, oppforecast.gmod__Amount__c);

}

Similary for the quarters the code gets repeated.The logic should if the data exists or not it should display the o/p as per the products.

 
1 respuesta
  1. 27 abr 2015, 12:27
    Hi Nikky,

    Please check with below queries an ddisplay in PDF .

     

    SELECT Id FROM gmod__Opportunity_Forecast__c WHERE CloseDate < NEXT_N_YEARS:20

    SELECT Id FROM gmod__Opportunity_Forecast__c WHERE CloseDate > LAST_N_YEARS:20

    SELECT Id FROM gmod__Opportunity_Forecast__c WHERE CloseDate = THIS_YEAR

    I think it will help you if you want more than 20 or less than that you can change and add filter on that .

    Please let me know if it helps . 
0/9000