Skip to main content
meghna m fragte in #Apex
Can any one help me on this.I have created a custom visual force page on Quote object which is in PDF format.I have written a wrapper class where values of the opportunity forecast objects is not getting displayed.This "Opportunity Forecast object " is a custom object which is  from a managed package installation.This package has Vf page created on Opportunity object ,which displays the product details for all the months .Now i would like get that data displayed in my custom vf page. Is that im making any blunt mistake in the code.Any help is very much appreciated.

Visual force code :

<apex:page standardController="Quote" 

        applyHtmlTag="false" renderAs="PDF" showheader="false" applyBodyTag="false" extensions="QuoteContentController">

<h2>OpportunityForecast Details</h2>

 <table class="bordered">

        <thead>

            <tr>

                <td class="header-table-heading" bgcolor="⌗C0C0C0"> Part Numbers</td>

                <td class="header-table-heading" bgcolor="⌗C0C0C0">Quantity</td>

                <td class="header-table-heading" bgcolor="⌗C0C0C0"> Price</td>

                <td class="header-table-heading" bgcolor="⌗C0C0C0"> Amount</td>

                <td class="header-table-heading" bgcolor="⌗C0C0C0">Quarter</td>

                <td class="header-table-heading" bgcolor="⌗C0C0C0">Actual Price</td>

            </tr>

        </thead>

        <tbody>

           <apex:repeat value="{!disp_list}" var="opf">

            <tr>

                <td class="header-table-data"><apex:outputText value="{!opf.gmod_Product}"/></td>

                <td class="header-table-data"><apex:outputText value="{!opf.gmod_Quantity}"/></td>

                <td class="header-table-data"><apex:outputText value="{!opf.gmod_Price }"/></td>

                <td class="header-table-data"><apex:outputText value="{!opf.gmod_Amount }"/></td>

                <td class="header-table-data"><apex:outputText value="{!opf.gmod_Quarter }"/></td>

                <td class="header-table-data"><apex:outputText value="{!opf.Actual_Price }"/></td>

             </tr>

            </apex:repeat> 

        </tbody>

    </table> 

</apex:page>

APEX CLASS:

public with sharing class QuoteContentController {

    public List<wrapperClass> disp_list {get;set;}

    public Competitor__c com{get;set;}

    public Id qId {get;set;}

    public QuoteContentController(ApexPages.StandardController controller) {

    qId=Apexpages.currentPage().getparameters().get('Id');

    }

   //Declare a wrapper class  

     public class Wrapperclass{

     public gmod__Opportunity_Forecast__c oppf{get;set;}

    //custom wrapper datatype  

      public string Name{get;set;}  

      public string AccountType{get;set;}  

      public date todaysDate{get;set;}  

      public date Expected_Order_Date{get;set;}

      public string Probability{get;set;}  

      public string Internal_Comment{get;set;}  

      public string External_Comment{get;set;}  

      public string Segment{get;set;}  

      public string Application{get;set;}  

      public string Persona{get;set;}  

      public string Geogrpahy{get;set;}  

      public string PartNumbers{get;set;}  

      public Decimal  Price{get;set;}  

      public Decimal End_Customer_Price{get;set;}  

      public Decimal Quantity {get;set;}  

      public Decimal Total{get;set;}  

      public string RFQ_justification{get;set;}  

      public string Main_Customer_of_Account{get;set;}  

      public string Bridgelux_competition_at_account{get;set;}

      public string Geographic_regions_serviced{get;set;}  

      public string Annual_lighting_revenue{get;set;}  

      public string Annual_LED_revenue_or_percent{get;set;}  

      public string Annual_purchases_of_LED_light_sources{get;set;}

      public string Percent_of_LED_purchases_that_are_COB{get;set;}  

      public string Other_information{get;set;}  

      public string Product_Series{get;set;}  

      public string Volume{get;set;} 

      public string Date_Price_is_Valid{get;set;} 

      Public string gmod_Product{get;set;}

      Public Decimal gmod_Quantity{get;set;}

      Public Decimal gmod_Price{get;set;}

      Public Decimal  gmod_Quarter{get;set;}

      Public Decimal gmod_Amount{get;set;}

      Public Decimal Actual_Price{get;set;}

      public wrapperClass(){} 

  }

    public QuoteContentController(){

    //define constructor to instantiate the wrapper data type 

      disp_list=new list<wrapperclass>();

    //Query all the list 

     list<Quote> q =[select id ,Name ,Effective_Date__c ,Comments__c ,

                    Quote.Opportunity.Probability ,Quote.Opportunity.AccSegment__c ,Quote.Opportunity.AccApplication__c,Quote.Opportunity.Persona__c,Quote.Opportunity.Region__c

                    from Quote where id=:apexpages.currentpage().getparameters().get('id')];

    list<QuoteLineItem> qli =[Select QuoteId , PricebookEntry.Product2.Name ,Unitprice ,End_Customer_Price__c ,Quantity , TotalPrice from QuoteLineItem where QuoteId =:qId ];

    list<Account> a = [Select id ,Name ,Main_Customers_of_Account__c ,Bridgelux_Competition_at_Account__c,Servicing_Region__c ,

                      Annual_LED_Revenue__c,Annual_Purchases_of_LED_Sources_SAM__c ,Percent_of_LED_purchases_that_are_COB__c from Account where account.id =:qId ];

   list<Competitor__c>  com = [Select id ,Part_Number__c,Product_Series__c,Price_Offered__c,Volume__c,Date_Price_is_Valid__c from Competitor__c ]  ; 

   list<gmod__Opportunity_Forecast__c>  opflist = [Select id ,gmod__Product__c,gmod__Quantity__c,gmod__Price__c ,   gmod__Quarter__c ,gmod__Amount__c ,Actual_Price__c from gmod__Opportunity_Forecast__c  where createddate!=null order by name limit 1 ]; 

       //Iterate through each list to extract the values and add it to the custom wrapper data type  

         for (Quote qt :q){

            for(integer i=0;i<opflist.size();i++){

                //Instantiating the wrapper SObject 

                wrapperclass w = new wrapperclass();

  //Assigning the wrapper variables from the SObject Fields in the database. 

  w.gmod_Product = opflist[i].gmod__Product__c;

  w.gmod_Quantity =opflist[i].gmod__Quantity__c;

  w.gmod_Price=opflist[i].gmod__Price__c;

  w.Name =opflist[i].Name;

  w.gmod_Quarter=opflist[i].gmod__Quarter__c;

  w.gmod_Amount=opflist[i]. gmod__Amount__c;

  w.Actual_Price=opflist[i].Actual_Price__c;

      //Adding everthing to the List  

     //disp_list.add(w);

     w.name =qt.name;

      disp_list.add(w);

       }

     }

   }  

 } //End of Class

6 Antworten
  1. 20. Jan. 2015, 08:07

    Hi James

    Thanks for your reply.

    Im new to this coding .Can u help me out where the necessary changes i need to do in the code.I shall appreciate your help.

0/9000