• SFDC Forum 007
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 20
    Questions
  • 24
    Replies

Hi,

 

 I have a pdf report where i display all the detials of callreport , but the recently created callreport are gettting displayed at the bottom below to the callreport created previously in decending order, I want the newly created callreport to be displayed at the top

 

 

Hw do i do this , should i use ny order by class in my controller

 

Please help me

Hi,

 

 I have a pdf page i want to represent the pdf in a tabular form or a grid form , please tell me how to do this

Hi,

 

 I have a VF Page which a pdf rerport is generated on click of a button , I want all the details in the vf page to be displayed in a tabular format

 

Please help me to do this

apex:page standardController="Call_Report__c" renderAs="PDF" showHeader="false" standardStylesheets="false" extensions="CallReportExtn" >
<html>
    <head>  
<style type="text/css">

</style>
                        </head>
                        <body class="bodys">
                            <div class="header">   
                                <apex:outputLabel styleClass="callSch" >Call Schedule :</apex:outputLabel>
                                <apex:outputText styleClass="callSch" value="{0,date,dd MMM yyyy}">
                                     <apex:param value="{!NOW()}" />
                                </apex:outputText>
                            </div>
                            
                            
                            <table width="100%" height="100%" class="bodycontent" >
                                
                                <tr style="background-color:#FFFFFF">
                                        <td colspan="5" style="padding:0px;font-size: 14px ;background-color:#FFFFFF">                                    
                                              <table width="100%" height="100%" class="custtable" >                                                
                                                <apex:repeat value="{!pdfWrapperList}" var="ba">
                                               
                                                <tr>
                                                      <td><b>Name</b></td>
                                                     <!-- <td><b>Time</b></td>-->
                                                      <td><b>Address</b></td>
                                                      <td><b>Post Code</b></td>
                                                      <td><b>Phone</b></td>
                                                      <td><b>Rep Event</b></td>
                                                      <td><b>Type</b></td>
                                                      <td><b>Segmentation</b></td>
                                                      <td><b>Patients</b></td>
                                                      <td><b>Seats</b></td>
                                                      
                                                      
                                                 </tr>
                                                 <!--<apex:repeat value="{!pdfWrapperList}" var="ba"> -->
                                                      <tr>
                                                      
                                                      
                                                  <!--  <td width ="50%" align="center">
                                                    <font face="verdana" color="#0000FF">-->
                                                   <td>
                                                   <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                  
                                                    {!ba.cr.Account__r.Name}
                                                    </textarea>
                                                  
                                                   <!-- </font>-->
                                                    </td>
                                                    
                                                    
                                                    
                                                     <!-- <td>
                                                       <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                          <!--<apex:outputText value="{0,date,hh:mm}">-->
                                                               <!--<apex:param value="{!ba.cr.Date__c}" />-->
                                                         <!-- </apex:outputText> -->
                                                            <!--</textarea>
                                                      </td>-->
                                                       
                                                      <td>
                                                      <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                      {!ba.cr.Account__r.BillingStreet},{!ba.cr.Account__r.BillingCity},{!ba.cr.Account__r.BillingState},{!ba.cr.Account__r.BillingCountry}
                                                       </textarea>
                                                       </td>
                                                       
                                                      <td>
                                                      <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                      {!ba.cr.Account__r.BillingPostalCode}</textarea></td>
                                                      <td>
                                                       <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                      {!ba.cr.Account__r.Phone}
                                                      
                                                      
                                                      </textarea></td>
                                                      
                                                     <td><textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                     Rep Event
                                                     </textarea>
                                                     </td>
                                                      
                                                     
                                                      <td> <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                      {!ba.cr.Account__r.Type}
                                                      </textarea>
                                                      </td>
                                                      <td>
                                                       <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                      {!ba.cr.Account__r.Segment_status__c}
                                                      </textarea>
                                                      </td>
                                                      <td>
                                                       <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                          <apex:outputText value="{0,number,0}">
                                                                 <apex:param value="{!ba.cr.Account__r.Total_Number_Of_Patients__c}" />
                                                           </apex:outputText>
                                                          </textarea>
                                                      </td>
                                                      <td>
                                                       <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                          <apex:outputText value="{0,number,0}">
                                                                 <apex:param value="{!ba.cr.Account__r.No_of_Seats__c}" />
                                                           </apex:outputText>
                                                          </textarea>
                                                      </td>
                                                     
                                                 </tr>
                                                 
                                             
                                                   <apex:repeat value="{!ba.pernAcctList}" var="pa">                                               
                                                 
                                                 
                                                 <tr>
                                               
                                                  
                                                     <td>{!pa.paName}</td>
                                                     
                                                      <td>{!pa.paJobTitle}</td>
                                                      
                                                      
                                                       

                                                    
                                                    <td> {!pa.crdate}</td>
                                                     
                                                    
                                                    
                                                      <td>
                                                      {!pa.paLastvisit}
                                                     <!-- <apex:outputText value="{0,date,dd/mm/yyyy}">
                                                               <apex:param value="{!pa.paLastvisit}" />
                                                         </apex:outputText>-->

                                                      </td>
                                                      
                                                      
                                                      
                                                      
                                                      
                                                     <td>{!pa.paBrand1}</td>
                                                     <!-- <td>{!BBLS}</td>-->
                                                     <td>{!pa.paBrand2}</td>
                                                     <td>{!pa.paBrand3}</td>
                                                     <td>{!pa.callObjective1}</td>
                                                     <td>{!pa.callObjective2}</td>
                                                    
                                                 </tr>
                                                 
                                                 </apex:repeat>
                                                     <tr>
                                                      
                                                 </tr>
                                                 
                                               
                                                                                            
                                                  <tr>
                                                      <td colspan="10"><hr class="accline"></hr></td>
                                                 </tr>
                                                 </apex:repeat>
                                                                                                 
                                                 
                                             </table>                                  
                                   </td>                                                                    
                                </tr>
                                                               
                                  
                            </table>                              
                        
                              
                        </body>
            </html>


           </apex:page>

 

This is my vf page

 

Please help me with my issue

 

 

Thanks and regards

Hi,

 

 I have a VF Page which a pdf rerport is generated on click of a button , I want all the details in the vf page to be displayed in a tabular format

 

Please help me to do this

apex:page standardController="Call_Report__c" renderAs="PDF" showHeader="false" standardStylesheets="false" extensions="CallReportExtn" >
<html>
    <head>  
<style type="text/css">

</style>
                        </head>
                        <body class="bodys">
                            <div class="header">   
                                <apex:outputLabel styleClass="callSch" >Call Schedule :</apex:outputLabel>
                                <apex:outputText styleClass="callSch" value="{0,date,dd MMM yyyy}">
                                     <apex:param value="{!NOW()}" />
                                </apex:outputText>
                            </div>
                            
                            
                            <table width="100%" height="100%" class="bodycontent" >
                                
                                <tr style="background-color:#FFFFFF">
                                        <td colspan="5" style="padding:0px;font-size: 14px ;background-color:#FFFFFF">                                    
                                              <table width="100%" height="100%" class="custtable" >                                                
                                                <apex:repeat value="{!pdfWrapperList}" var="ba">
                                               
                                                <tr>
                                                      <td><b>Name</b></td>
                                                     <!-- <td><b>Time</b></td>-->
                                                      <td><b>Address</b></td>
                                                      <td><b>Post Code</b></td>
                                                      <td><b>Phone</b></td>
                                                      <td><b>Rep Event</b></td>
                                                      <td><b>Type</b></td>
                                                      <td><b>Segmentation</b></td>
                                                      <td><b>Patients</b></td>
                                                      <td><b>Seats</b></td>
                                                      
                                                      
                                                 </tr>
                                                 <!--<apex:repeat value="{!pdfWrapperList}" var="ba"> -->
                                                      <tr>
                                                      
                                                      
                                                  <!--  <td width ="50%" align="center">
                                                    <font face="verdana" color="#0000FF">-->
                                                   <td>
                                                   <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                  
                                                    {!ba.cr.Account__r.Name}
                                                    </textarea>
                                                  
                                                   <!-- </font>-->
                                                    </td>
                                                    
                                                    
                                                    
                                                     <!-- <td>
                                                       <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                          <!--<apex:outputText value="{0,date,hh:mm}">-->
                                                               <!--<apex:param value="{!ba.cr.Date__c}" />-->
                                                         <!-- </apex:outputText> -->
                                                            <!--</textarea>
                                                      </td>-->
                                                       
                                                      <td>
                                                      <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                      {!ba.cr.Account__r.BillingStreet},{!ba.cr.Account__r.BillingCity},{!ba.cr.Account__r.BillingState},{!ba.cr.Account__r.BillingCountry}
                                                       </textarea>
                                                       </td>
                                                       
                                                      <td>
                                                      <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                      {!ba.cr.Account__r.BillingPostalCode}</textarea></td>
                                                      <td>
                                                       <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                      {!ba.cr.Account__r.Phone}
                                                      
                                                      
                                                      </textarea></td>
                                                      
                                                     <td><textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                     Rep Event
                                                     </textarea>
                                                     </td>
                                                      
                                                     
                                                      <td> <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                      {!ba.cr.Account__r.Type}
                                                      </textarea>
                                                      </td>
                                                      <td>
                                                       <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                      {!ba.cr.Account__r.Segment_status__c}
                                                      </textarea>
                                                      </td>
                                                      <td>
                                                       <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                          <apex:outputText value="{0,number,0}">
                                                                 <apex:param value="{!ba.cr.Account__r.Total_Number_Of_Patients__c}" />
                                                           </apex:outputText>
                                                          </textarea>
                                                      </td>
                                                      <td>
                                                       <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                          <apex:outputText value="{0,number,0}">
                                                                 <apex:param value="{!ba.cr.Account__r.No_of_Seats__c}" />
                                                           </apex:outputText>
                                                          </textarea>
                                                      </td>
                                                     
                                                 </tr>
                                                 
                                             
                                                   <apex:repeat value="{!ba.pernAcctList}" var="pa">                                               
                                                 
                                                 
                                                 <tr>
                                               
                                                  
                                                     <td>{!pa.paName}</td>
                                                     
                                                      <td>{!pa.paJobTitle}</td>
                                                      
                                                      
                                                       

                                                    
                                                    <td> {!pa.crdate}</td>
                                                     
                                                    
                                                    
                                                      <td>
                                                      {!pa.paLastvisit}
                                                     <!-- <apex:outputText value="{0,date,dd/mm/yyyy}">
                                                               <apex:param value="{!pa.paLastvisit}" />
                                                         </apex:outputText>-->

                                                      </td>
                                                      
                                                      
                                                      
                                                      
                                                      
                                                     <td>{!pa.paBrand1}</td>
                                                     <!-- <td>{!BBLS}</td>-->
                                                     <td>{!pa.paBrand2}</td>
                                                     <td>{!pa.paBrand3}</td>
                                                     <td>{!pa.callObjective1}</td>
                                                     <td>{!pa.callObjective2}</td>
                                                    
                                                 </tr>
                                                 
                                                 </apex:repeat>
                                                     <tr>
                                                      
                                                 </tr>
                                                 
                                               
                                                                                            
                                                  <tr>
                                                      <td colspan="10"><hr class="accline"></hr></td>
                                                 </tr>
                                                 </apex:repeat>
                                                                                                 
                                                 
                                             </table>                                  
                                   </td>                                                                    
                                </tr>
                                                               
                                  
                            </table>                              
                        
                              
                        </body>
            </html>


           </apex:page>

 

This is my vf page

 

Please help me with my issue

 

 

Thanks and regards

Hi,

 

 I have a VF Page which a pdf rerport is generated on click of a button , I want all the details in the vf page to be displayed in a tabular format

 

Please help me to do this

apex:page standardController="Call_Report__c" renderAs="PDF" showHeader="false" standardStylesheets="false" extensions="CallReportExtn" >
<html>
    <head>  
<style type="text/css">

</style>
                        </head>
                        <body class="bodys">
                            <div class="header">   
                                <apex:outputLabel styleClass="callSch" >Call Schedule :</apex:outputLabel>
                                <apex:outputText styleClass="callSch" value="{0,date,dd MMM yyyy}">
                                     <apex:param value="{!NOW()}" />
                                </apex:outputText>
                            </div>
                            
                            
                            <table width="100%" height="100%" class="bodycontent" >
                                
                                <tr style="background-color:#FFFFFF">
                                        <td colspan="5" style="padding:0px;font-size: 14px ;background-color:#FFFFFF">                                    
                                              <table width="100%" height="100%" class="custtable" >                                                
                                                <apex:repeat value="{!pdfWrapperList}" var="ba">
                                               
                                                <tr>
                                                      <td><b>Name</b></td>
                                                     <!-- <td><b>Time</b></td>-->
                                                      <td><b>Address</b></td>
                                                      <td><b>Post Code</b></td>
                                                      <td><b>Phone</b></td>
                                                      <td><b>Rep Event</b></td>
                                                      <td><b>Type</b></td>
                                                      <td><b>Segmentation</b></td>
                                                      <td><b>Patients</b></td>
                                                      <td><b>Seats</b></td>
                                                      
                                                      
                                                 </tr>
                                                 <!--<apex:repeat value="{!pdfWrapperList}" var="ba"> -->
                                                      <tr>
                                                      
                                                      
                                                  <!--  <td width ="50%" align="center">
                                                    <font face="verdana" color="#0000FF">-->
                                                   <td>
                                                   <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                  
                                                    {!ba.cr.Account__r.Name}
                                                    </textarea>
                                                  
                                                   <!-- </font>-->
                                                    </td>
                                                    
                                                    
                                                    
                                                     <!-- <td>
                                                       <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                          <!--<apex:outputText value="{0,date,hh:mm}">-->
                                                               <!--<apex:param value="{!ba.cr.Date__c}" />-->
                                                         <!-- </apex:outputText> -->
                                                            <!--</textarea>
                                                      </td>-->
                                                       
                                                      <td>
                                                      <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                      {!ba.cr.Account__r.BillingStreet},{!ba.cr.Account__r.BillingCity},{!ba.cr.Account__r.BillingState},{!ba.cr.Account__r.BillingCountry}
                                                       </textarea>
                                                       </td>
                                                       
                                                      <td>
                                                      <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                      {!ba.cr.Account__r.BillingPostalCode}</textarea></td>
                                                      <td>
                                                       <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                      {!ba.cr.Account__r.Phone}
                                                      
                                                      
                                                      </textarea></td>
                                                      
                                                     <td><textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                     Rep Event
                                                     </textarea>
                                                     </td>
                                                      
                                                     
                                                      <td> <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                      {!ba.cr.Account__r.Type}
                                                      </textarea>
                                                      </td>
                                                      <td>
                                                       <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                      {!ba.cr.Account__r.Segment_status__c}
                                                      </textarea>
                                                      </td>
                                                      <td>
                                                       <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                          <apex:outputText value="{0,number,0}">
                                                                 <apex:param value="{!ba.cr.Account__r.Total_Number_Of_Patients__c}" />
                                                           </apex:outputText>
                                                          </textarea>
                                                      </td>
                                                      <td>
                                                       <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                          <apex:outputText value="{0,number,0}">
                                                                 <apex:param value="{!ba.cr.Account__r.No_of_Seats__c}" />
                                                           </apex:outputText>
                                                          </textarea>
                                                      </td>
                                                     
                                                 </tr>
                                                 
                                             
                                                   <apex:repeat value="{!ba.pernAcctList}" var="pa">                                               
                                                 
                                                 
                                                 <tr>
                                               
                                                  
                                                     <td>{!pa.paName}</td>
                                                     
                                                      <td>{!pa.paJobTitle}</td>
                                                      
                                                      
                                                       

                                                    
                                                    <td> {!pa.crdate}</td>
                                                     
                                                    
                                                    
                                                      <td>
                                                      {!pa.paLastvisit}
                                                     <!-- <apex:outputText value="{0,date,dd/mm/yyyy}">
                                                               <apex:param value="{!pa.paLastvisit}" />
                                                         </apex:outputText>-->

                                                      </td>
                                                      
                                                      
                                                      
                                                      
                                                      
                                                     <td>{!pa.paBrand1}</td>
                                                     <!-- <td>{!BBLS}</td>-->
                                                     <td>{!pa.paBrand2}</td>
                                                     <td>{!pa.paBrand3}</td>
                                                     <td>{!pa.callObjective1}</td>
                                                     <td>{!pa.callObjective2}</td>
                                                    
                                                 </tr>
                                                 
                                                 </apex:repeat>
                                                     <tr>
                                                      
                                                 </tr>
                                                 
                                               
                                                                                            
                                                  <tr>
                                                      <td colspan="10"><hr class="accline"></hr></td>
                                                 </tr>
                                                 </apex:repeat>
                                                                                                 
                                                 
                                             </table>                                  
                                   </td>                                                                    
                                </tr>
                                                               
                                  
                            </table>                              
                        
                              
                        </body>
            </html>


           </apex:page>

 

This is my vf page

 

Please help me with my issue

 

 

Thanks and regards

Hi,

 

 Please help me with test class coverage for the below portion alone, finding difficulties with the test coverage

 

for(Id baId:accIdSet){
        //Fetching all the person account headers and details dynamically
            PADetailsList=new List<PADetails>();           
            PADetails paDetHeader=new PADetails();
            paDetHeader.paName='Name';
            paDetHeader.paJobTitle='Job Title';
        
           
            if(crList!=null && crList.size()>0 && crList.get(0)!=null && crList.get(0).Date__c!=null){
                paDetHeader.crdate='Time';     
            }else{
                paDetHeader.crdate='';    
            }

 

Thanks in Advance

Hi,

 

 I have a wrapper class for which i have written a test class for it, i need some help to cover certain methods in the class which i am experiencing difficulty

 

i have written the methods as follows,

 

// methods need help(warpper class)

public class PdfWrapper{
        public Call_Report__c cr{get;set;}
        public List<PADetails> pernAcctList{get;set;}
        public List<PADetails> pernAcctList2{get;set;}
        public Call_Item__c callitemList{get;set;}
        public List<Customer_Brand__c> customerbrndbbl {get;set;}
        public String baId{get;set;}

 

// method help

 

public class PADetails{
        public List<Contact> cclist{get;set;}
        public String paName{get;set;}
        public String paaccName{get;set;}
        public String paJobTitle{get;set;}
        public String paLastvisit{get;set;}
        public String paBrand1{get;set;}
        public String paBrand2{get;set;}
        public String paBrand3{get;set;}
        public String callObjective1{get;set;}
        public String callObjective2{get;set;}
        public String crdate{get;set;}
    }

 

//Fetching all the person account headers and details dynamically
            PADetailsList=new List<PADetails>();           
            PADetails paDetHeader=new PADetails();
            paDetHeader.paName='Name';
            paDetHeader.paJobTitle='Job Title';
        
           
            if(crList!=null && crList.size()>0 && crList.get(0)!=null && crList.get(0).Date__c!=null){
                paDetHeader.crdate='Time';     
            }else{
                paDetHeader.crdate='';    
            }

 

Thanks in advance

 

 

 

 

Hi,

 

Please help me to write a testclass for the following apex class

 

 

//Apex class to generate a PDF from Account view page on button click

//Displays all the business account details, Person account details, brands with related BBL information,time,lastvisit,callobjective


public class CallReportExtn{
    
    public class PdfWrapper{
        public Call_Report__c cr{get;set;}
        public List<PADetails> pernAcctList{get;set;}
        public List<PADetails> pernAcctList2{get;set;}
        public Call_Item__c callitemList{get;set;}
        public List<Customer_Brand__c> customerbrndbbl {get;set;}
        public String baId{get;set;}
    }
    public class PADetails{
        public List<Contact> cclist{get;set;}
        public String paName{get;set;}
        public String paaccName{get;set;}
        public String paJobTitle{get;set;}
        public String paLastvisit{get;set;}
        public String paBrand1{get;set;}
        public String paBrand2{get;set;}
        public String paBrand3{get;set;}
        public String callObjective1{get;set;}
        public String callObjective2{get;set;}
        public String crdate{get;set;}
    }
    set<id> top3bbl =  new set<id>();      
    public String brand1{get;set;}
    public String brand2{get;set;}
    public String brand3{get;set;}
    public list<string> callnames{get;set;}
    public List<Call_Report__c> crList{get;set;}
    public List<Customer_Brand__c> cbList{get;set;}
    public List<PdfWrapper> pdfWrapperList{get;set;}
    public List<PADetails> PADetailsList{get;set;}    
    public String userid=UserInfo.getUserId();
    Map<Id,List<PADetails>> paMap=new Map<Id,List<PADetails>>();
    Map<Id,Call_Item__c> callitempaMap=new Map<Id,Call_Item__c>();
    Map<Id,Call_Report__c> callReppaMap=new Map<Id,Call_Report__c>();
    Map<String,Customer_Brand__c> cCBpaMap=new Map<String,Customer_Brand__c>();
    Map<String,Contact> conmap=new Map<String,Contact>();
    Map<Id,List<PADetails>> cpmap=new Map<Id,List<PADetails>>();
    List<Customer_Brand__c> customerbrnd = new List<Customer_Brand__c>();
    List<Call_Item__c>  calltemplst=new List<Call_Item__c>();
        
        public CallReportExtn(ApexPages.StandardController controller){
        pdfWrapperList=baAccInfo();       
    }
    public List<PdfWrapper> baAccInfo(){
        List<PdfWrapper> pdfWrapper=new List<PdfWrapper>();
        Set<Id> accIdSet=new Set<Id>();
        Set<Id> callplanIdSet=new Set<Id>();
        if(userid !=null)
        //Fetching all the business account fields from call report
        crList=[select id,Contact__c,Date__c,Call_plan__c,Account__r.Name,Account__c,Account__r.id,Account__r.BillingCity,Account__r.BillingStreet,Account__r.BillingState,Account__r.BillingCountry,Account__r.BillingPostalCode,Account__r.phone,Account__r.Type,Account__r.Segment_Status__c,Account__r.Total_Number_Of_Patients__c,Account__r.No_of_Seats__c,Objective__r.Name,Objective2__r.Name from Call_Report__c where CallDate__c=TODAY and OwnerId=:userid];
       System.debug('crList==> '+crList);   
        for(Call_Report__c callRep:crList)
        {
             if(callRep.Account__c !=null)
             {
              if(!accIdSet.contains(callRep.Account__c))
              {
                 accIdSet.add(callRep.Account__c);
                   

                 }
           }
                 
            if(callRep.Call_plan__c !=null)
            {
            if(!callplanIdSet.contains(callRep.Call_plan__c))
            callplanIdSet.add(callRep.Call_plan__c);
              }
              callReppaMap.put(callRep.Contact__c,callRep);   
                             
                                    
        }  
        //Fetching all the person accounts from a list
       List<Account> paList=[select Name,Job_Title__pc,Primary_Customer__pc,id,PersonContactId,Last_Activity__pc  from Account where Primary_Customer__pc in:accIdSet];
       //Fetching the last activity date from contact object
       List<Contact> cclist=[select Last_Activity__c from contact where Last_Activity__c !=null];
        System.debug('cclist ==> '+cclist );
        //Fetching the top three priority brands id callplan is added to callreport  
        if(callplanIdSet.size()>0){
             calltemplst = [select id,Brand__c,Brand__r.name,Position__c,Brand_Call_Plan__c from Call_Item__c where Brand_Call_Plan__c in:callplanIdSet ORDER BY Position__c limit 3];
             System.debug('calltemplst ==> '+calltemplst );        
        }
            
            
      
        for(Id baId:accIdSet){
        //Fetching all the person account headers and details dynamically
            PADetailsList=new List<PADetails>();           
            PADetails paDetHeader=new PADetails();
            paDetHeader.paName='Name';
            paDetHeader.paJobTitle='Job Title';
        
           
            if(crList!=null && crList.size()>0 && crList.get(0)!=null && crList.get(0).Date__c!=null){
                paDetHeader.crdate='Time';     
            }else{
                paDetHeader.crdate='';    
            }
            
           if(calltemplst!=null && calltemplst.size()>0 && calltemplst.get(0)!=null && calltemplst.get(0).Brand__r.name!=''){
                paDetHeader.paBrand1=calltemplst.get(0).Brand__r.name;
                top3bbl.add(calltemplst.get(0).Brand__c);               
                                
            }else{
                paDetHeader.paBrand1='';    
            }
            
            
       
            if(calltemplst!=null && calltemplst.size()>0 && calltemplst.get(0)!=null && calltemplst.get(0).Brand__r.name!=''){
                paDetHeader.paBrand1=calltemplst.get(0).Brand__r.name;
                top3bbl.add(calltemplst.get(0).Brand__c);               
                                
            }else{
                paDetHeader.paBrand1='';    
            }
            
            if(calltemplst!=null && calltemplst.size()>1 && calltemplst.get(1)!=null && calltemplst.get(1).Brand__r.name!=''){
                paDetHeader.paBrand2=calltemplst.get(1).Brand__r.name;  
                top3bbl.add(calltemplst.get(1).Brand__c);                
            }else{
                paDetHeader.paBrand2='';    
            }
            
            if(calltemplst!=null && calltemplst.size()>2 && calltemplst.get(2)!=null && calltemplst.get(2).Brand__r.name!=''){
                paDetHeader.paBrand3=calltemplst.get(2).Brand__r.name;
                top3bbl.add(calltemplst.get(2).Brand__c);               
            }else{
                paDetHeader.paBrand3='';    
            }
            
            
             if(crList!=null && crList.size()>0 && crList.get(0)!=null && crList.get(0).Objective__r.Name!=''){
                paDetHeader.callObjective1='Objective1';     
            }else{
                paDetHeader.callObjective1='';    
            }
            
            if(crList!=null && crList.size()>0 && crList.get(0)!=null && crList.get(0).Objective__r.Name!=''){
                paDetHeader.callObjective2='Objective2';     
            }else{
                paDetHeader.callObjective2='';    
            }
            
             if(cclist!=null){
                paDetHeader.paLastvisit='Lastvisit';     
            }else{
                paDetHeader.paLastvisit='';    
            }
            
           //Fetching the top three brands from customer brand object based on related HCP
       if(top3bbl.size()>0){
           cbList= [select BBL__c,HCP__c,Brand__r.Name from Customer_Brand__c where  Brand__c in:top3bbl and HCP__c in:callReppaMap.keyset()];
           System.debug('cbList==> '+cbList);
           if(cbList.size()>0)
           {
           for(Customer_Brand__c cb:cbList){
               cCBpaMap.put(cb.HCP__c+cb.Brand__r.Name,cb);    
           }
           }
       }
       
      
            
            PADetailsList.add(paDetHeader);
                   
            for(Account ac:paList){
                    System.debug('ac.Name ==> '+ac.Name);
                    PADetails paDet=new PADetails();
                    paDet.paName=ac.Name;
                    if(ac.Primary_Customer__pc !=null)
                    
                    paDet.paJobTitle=ac.Job_Title__pc;
                    
                 if(callReppaMap.get(ac.personContactId)!=null){
                    paDet.crdate=String.valueof(callReppaMap.get(ac.personContactId).Date__c.format('hh:mm'));
                    }else{
                        paDet.crdate='';

                    }
 
                   
                   
                       
                  
                    if(callReppaMap.get(ac.personContactId)!=null){
                        paDet.callObjective1=callReppaMap.get(ac.personContactId).Objective__r.Name;
                    }else{
                        paDet.callObjective1='';

                    }
                    if(callReppaMap.get(ac.personContactId)!=null){
                        paDet.callObjective2=callReppaMap.get(ac.personContactId).Objective2__r.Name;
                    }else{
                        paDet.callObjective2='';

                    }
                    if(calltemplst.size()>0)
                    {
                    if(cCBpaMap.get(ac.personContactId+calltemplst.get(0).Brand__r.name)!=null){
                        paDet.paBrand1=cCBpaMap.get(ac.personContactId+calltemplst.get(0).Brand__r.name).BBL__c;
                    }else{
                        paDet.paBrand1='';

                    }
                    }
                    if(calltemplst.size()>1)
                    {
                    if(cCBpaMap.get(ac.personContactId+calltemplst.get(1).Brand__r.name)!=null){
                        paDet.paBrand2=cCBpaMap.get(ac.personContactId+calltemplst.get(1).Brand__r.name).BBL__c;
                    }else{
                        paDet.paBrand2='';

                    }
                    }
                    if(calltemplst.size()>2)
                    {
                    if(cCBpaMap.get(ac.personContactId+calltemplst.get(2).Brand__r.name)!=null){
                        paDet.paBrand3=cCBpaMap.get(ac.personContactId+calltemplst.get(2).Brand__r.name).BBL__c;
                    }else{
                        paDet.paBrand3='';

                    }
                    }                   
                    if(ac.Last_Activity__pc!=null){
                        System.debug('ac.Last_Activity__pc ==> '+ac.Last_Activity__pc);
                        String str=String.valueOf(ac.Last_Activity__pc);                        
                        paDet.paLastvisit=str.substring(8,10)+'/'+str.substring(5,7)+'/'+str.substring(0,4);
                       
                        
                     }
                     
                     else
                     {
                         paDet.paLastvisit='';
                         
                     }
                     
                 
                     
                     
                     
                    
                     if(ac.Primary_Customer__pc !=null)
                     {
                    if(baId == ac.Primary_Customer__pc)
                    {
                    PADetailsList.add(paDet);
                    paMap.put(baId,PADetailsList);    
                    }
                    }
          }
          
         }
        
         
        if(crList.size()>0){
        Map<String,String> baIdMap=new Map<String,String>();
        for(Call_Report__c callRep:crList){
            if(baIdMap!=null && baIdMap.get(callRep.Account__c)==null){    
                PdfWrapper pw=new PdfWrapper();
                pw.cr=callRep;
                if(callRep.Account__c !=null){
                    baIdMap.put(callRep.Account__c,callRep.Account__c);
                    pw.pernAcctList=paMap.get(callRep.Account__c);
                }
           
                if(callRep.Call_plan__c !=null)
                pw.callitemList=callitempaMap.get(callRep.Call_plan__c);
                pdfWrapper.add(pw);
            }
                                
        }
        }
        
        return pdfWrapper;
    }
    
    

}

Hi,

 

 Please help me out with my issue

 

I have a call report object where call plan is attached to it, whre the corresponding accounts are displayed in a pdf, but my issue wen i create a new call report on today's date along with the existing call report created on todays date , the accounts are getting displayed twice with the same name , where i want it to be displayed only once.

 

 

Its in this line of my controller

 

crList=[select id,Contact__c,Date__c,Call_plan__c,Account__r.Name,Account__c,Account__r.id,Account__r.BillingCity,Account__r.BillingStreet,Account__r.BillingState,Account__r.BillingCountry,Account__r.BillingPostalCode,Account__r.phone,Account__r.Type,Account__r.Segment_Status__c,Account__r.Total_Number_Of_Patients__c,Account__r.No_of_Seats__c,Objective__r.Name,Objective2__r.Name from Call_Report__c where CallDate__c=TODAY and OwnerId=:userid];
       System.debug('crList==> '+crList);   
        for(Call_Report__c callRep:crList){
             if(callRep.Account__c !=null)
                 accIdSet.add(callRep.Account__c);
                 
            if(callRep.Call_plan__c !=null)
                 callplanIdSet.add(callRep.Call_plan__c);  
                 
            callReppaMap.put(callRep.Contact__c,callRep);    

 

Please help me out with my case

 

 

Thanks in advance

Hi,

 

 Please help me out with my issue

 

I have a call report object where call plan is attached to it, whre the corresponding accounts are displayed in a pdf, but my issue wen i create a new call report on today's date along with the existing call report created on todays date , the accounts are getting displayed twice with the same name , where i want it to be displayed only once.

 

<apex:page standardController="Call_Report__c" renderAs="PDF" showHeader="false" standardStylesheets="false" extensions="CallReportExtn" >
<html>
    <head>  
<style type="text/css">
    
   
                        

                        </style>
                        </head>
                        <body class="bodys">
                            <div class="header">   
                                <apex:outputLabel styleClass="callSch" >Call Schedule :</apex:outputLabel>
                                <apex:outputText styleClass="callSch" value="{0,date,dd MMM yyyy}">
                                     <apex:param value="{!NOW()}" />
                                </apex:outputText>
                            </div>
                            
                            
                            <table width="100%" height="100%" class="bodycontent" >
                                
                                <tr style="background-color:#FFFFFF">
                                        <td colspan="5" style="padding:0px;font-size: 14px ;background-color:#FFFFFF">                                    
                                              <table width="100%" height="100%" class="custtable" >                                                
                                                <apex:repeat value="{!pdfWrapperList}" var="ba">
                                               
                                                <tr>
                                                      <td><b>Name</b></td>
                                                     <!-- <td><b>Time</b></td>-->
                                                      <td><b>Address</b></td>
                                                      <td><b>Post Code</b></td>
                                                      <td><b>Phone</b></td>
                                                      <td><b>Rep Event</b></td>
                                                      <td><b>Type</b></td>
                                                      <td><b>Segmentation</b></td>
                                                      <td><b>Patients</b></td>
                                                      <td><b>Seats</b></td>
                                                      
                                                      
                                                 </tr>
                                                 <!--<apex:repeat value="{!pdfWrapperList}" var="ba"> -->
                                                      <tr>
                                                      
                                                      
                                                  <!--  <td width ="50%" align="center">
                                                    <font face="verdana" color="#0000FF">-->
                                                   <td>
                                                   <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                   
                                                    {!ba.cr.Account__r.Name}
                                                    </textarea>
                                                  
                                                   <!-- </font>-->
                                                    </td>
                                                    
                                                    
                                                    
                                                     <!-- <td>
                                                       <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                          <!--<apex:outputText value="{0,date,hh:mm}">-->
                                                               <!--<apex:param value="{!ba.cr.Date__c}" />-->
                                                         <!-- </apex:outputText> -->
                                                            <!--</textarea>
                                                      </td>-->
                                                       
                                                      <td>
                                                      <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                      {!ba.cr.Account__r.BillingStreet},{!ba.cr.Account__r.BillingCity},{!ba.cr.Account__r.BillingState},{!ba.cr.Account__r.BillingCountry}
                                                       </textarea>
                                                       </td>
                                                       
                                                      <td>
                                                      <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                      {!ba.cr.Account__r.BillingPostalCode}</textarea></td>
                                                      <td>
                                                       <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                      {!ba.cr.Account__r.Phone}
                                                      
                                                      
                                                      </textarea></td>
                                                      
                                                     <td><textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                     Rep Event
                                                     </textarea>
                                                     </td>
                                                      
                                                     
                                                      <td> <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                      {!ba.cr.Account__r.Type}
                                                      </textarea>
                                                      </td>
                                                      <td>
                                                       <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                      {!ba.cr.Account__r.Segment_status__c}
                                                      </textarea>
                                                      </td>
                                                      <td>
                                                       <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                          <apex:outputText value="{0,number,0}">
                                                                 <apex:param value="{!ba.cr.Account__r.Total_Number_Of_Patients__c}" />
                                                           </apex:outputText>
                                                          </textarea>
                                                      </td>
                                                      <td>
                                                       <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                          <apex:outputText value="{0,number,0}">
                                                                 <apex:param value="{!ba.cr.Account__r.No_of_Seats__c}" />
                                                           </apex:outputText>
                                                          </textarea>
                                                      </td>
                                                     
                                                 </tr>
                                                 
                                             
                                                   <apex:repeat value="{!ba.pernAcctList}" var="pa">                                               
                                                 
                                                 
                                                 <tr>
                                               
                                                  
                                                     <td><b>{!pa.paName}</b></td>
                                                     
                                                      <td><b>{!pa.paJobTitle}</b></td>
                                                      
                                                      
                                                       

                                                    
                                                    <td> <b>{!pa.crdate}</b></td>
                                                     
                                                    
                                                    
                                                      <td><b>
                                                      {!pa.paLastvisit}
                                                     <!-- <apex:outputText value="{0,date,dd/mm/yyyy}">
                                                               <apex:param value="{!pa.paLastvisit}" />
                                                         </apex:outputText>-->

                                                      </b></td>
                                                      
                                                      
                                                      
                                                      
                                                      
                                                     <td><b>{!pa.paBrand1}</b></td>
                                                     <!-- <td>{!BBLS}</td>-->
                                                     <td><b>{!pa.paBrand2}</b></td>
                                                     <td><b>{!pa.paBrand3}</b></td>
                                                     <td> <b> {!pa.callObjective1}</b></td>
                                                     <td> <b> {!pa.callObjective2}</b></td>
                                                    
                                                 </tr>
                                                 
                                                 </apex:repeat>
                                                     <tr>
                                                      
                                                 </tr>
                                                 
                                               
                                                                                            
                                                  <tr>
                                                      <td colspan="10"><hr class="accline"></hr></td>
                                                 </tr>
                                                 </apex:repeat>
                                                                                                 
                                                 
                                             </table>                                  
                                   </td>                                                                    
                                </tr>
                                                               
                                  
                            </table>                              
                        
                              
                        </body>
            </html>


           </apex:page>
                             

Hi,

 

 Please help me out with my issue

 

I have a call report object where call plan is attached to it, whre the corresponding accounts are displayed in a pdf, but my issue wen i create a new call report on today's date along with the existing call report created on todays date , the accounts are getting displayed twice with the same name , where i want it to be displayed only once.

 

// vf page

 

<apex:page standardController="Call_Report__c" renderAs="PDF" showHeader="false" standardStylesheets="false" extensions="CallReportExtn" >
<html>
    <head>  
<style type="text/css">
    
    @page {
                 
                margin-left:45px;
                margin-right:45px;
                margin-top:100px;
                margin-bottom:87px;
                @top-center {                   
                    content: element(header);
                    height:70px;
                    vertical-align:top;               
                      
                }
                                     
               @bottom-right{
                    content:"Page"  counter(page) "&nbsp; Of &nbsp;" counter(pages);
                    font-family:Arial Unicode MS;
                    font-size:14px;
                    color:#999999;         
                }
               
                       
           }                       
         
            div.header {                                          
                position: running(header);
                padding-top:35px;
                padding-left:0px;
                padding-bottom:70px;
                
                          
             }
             table.bodycontent{
                 position:absolute;                                 
                 left:0px;                               
                 width:725;
                 padding: 0px;
                 margin: 0px;
                 border-style: none;
                 border-width: 0px;
                 border-spacing: 0px;
                 border-collapse: collapse;
                 
             }
             div.dtlcontent{
                 position:relative;
                 top:100px;
                 left:0px;
                 right:-5px;
             }
             div.prdcontent{
                 position:relative;
                 top:100px;
                 left:0px;
                 right:-5px;
             }
             div.tccontent{
                 position:relative;
                 top:440px;
                 left:0px;
                 right:-5px;
             }
             div.tccontentgp{
                 position:relative;
                 top:440px;
                 left:0px;
                 right:-5px;
             }
             table.custtable{
                 padding:0px;                 
                 margin: 0px;
                 border-style: none;
                 border-width: 0px;
                 border-spacing: 0px;
                 border-collapse: collapse;
             }
             table.custtabletc{
                 padding:0px;                 
                 margin: 0px;
                 border-style: none;
                 border-width: 0px;
                 border-spacing: 0px;
                 border-collapse: collapse;
             }
                         
            
            div.footer {
                padding-top:50px;
                padding-bottom:25px;
                padding-left:-5px;
                
                position: running(footer);                                   
            }
                        .bodys{
                            width:770px;
                            height:850px;
                            padding:0px;
                            margin:0px;
                        }
                        .callSch{
                            font-family:Arial Unicode MS;
                            font-size:14px;
                            color: #118888;
                            padding-left:10px
                        }
                        .custlbl{
                        font-family:Arial Unicode MS;
                        color:#000000;
                        font-size:14px;
                        padding-left:10px;
                        }
                        .prdlbl{
                        font-family:Arial Unicode MS;
                        color:#000000;
                        font-size:14px;
                        }
                        .prdlbl13{
                        font-family:Arial Unicode MS;
                        color:#000000;
                        font-size:14px;
                        width:130px;
                        }
                        .prdlb2{
                        font-family:Arial Unicode MS;
                        color:#000000;
                        font-size:14px;
                        width:160px;
                        }
                        .prdlbl4{
                        font-family:Arial Unicode MS;
                        color:#000000;
                        font-size:14px;
                        width:190px;
                        }
                        .prdlblgp13{
                        width:15px;
                        }
                        .prdlblgp2{
                        width:30px;
                        }
                        .prdlblgp4{
                        width:10px;
                        }
                        .detaillbl{
                        font-family:Arial Unicode MS;
                        font-weight:bold;
                        color:#000000;
                        font-size:14px;
                        }
                        .custrowspace{
                        height:10px;
                        }
                        .custline{
                        line-weight:1px;
                        color:#D8D8D8;
                        border-bottom: 0px #FFFFFF;
                        }
                        .accline{
                        line-weight:1px;
                        color:#118888;
                        border-bottom: 0px;
                        }
                        .prdline1{
                        line-weight:1px;
                        color:#E4E4E4;
                        border-bottom: 0px;
                        }
                        .custtext{
                        font-family:Arial Unicode MS;
                        font-size:14px;
                        line-height:1.5;
                        color:#5F5F5F;
                        
                        }
                        .prdtext{
                        font-family:Arial Unicode MS;
                        font-size:14px;
                        line-height:1.83;
                        color:#5F5F5F;
                        }
                        .tctext{
                        font-family:Arial Unicode MS;
                        font-size:14px;
                        color:#000000;
                        }
                        .tcpara{
                        font-family:Arial Unicode MS;
                        font-size:14px;
                        line-height:1.5;
                        color:#000000;
                        }
                        .tcparagp{
                        height:30px;
                        }
                        
                         
                        textarea {
                    background-color: blue;
                    color: #0000FF;
                   font-size: 14px;
                       }

                       
                        

                        </style>
                        </head>
                        <body class="bodys">
                            <div class="header">   
                                <apex:outputLabel styleClass="callSch" >Call Schedule :</apex:outputLabel>
                                <apex:outputText styleClass="callSch" value="{0,date,dd MMM yyyy}">
                                     <apex:param value="{!NOW()}" />
                                </apex:outputText>
                            </div>
                            
                            
                            <table width="100%" height="100%" class="bodycontent" >
                                
                                <tr style="background-color:#FFFFFF">
                                        <td colspan="5" style="padding:0px;font-size: 14px ;background-color:#FFFFFF">                                    
                                              <table width="100%" height="100%" class="custtable" >                                                
                                                <apex:repeat value="{!pdfWrapperList}" var="ba">
                                               
                                                <tr>
                                                      <td><b>Name</b></td>
                                                     <!-- <td><b>Time</b></td>-->
                                                      <td><b>Address</b></td>
                                                      <td><b>Post Code</b></td>
                                                      <td><b>Phone</b></td>
                                                      <td><b>Rep Event</b></td>
                                                      <td><b>Type</b></td>
                                                      <td><b>Segmentation</b></td>
                                                      <td><b>Patients</b></td>
                                                      <td><b>Seats</b></td>
                                                      
                                                      
                                                 </tr>
                                                 <!--<apex:repeat value="{!pdfWrapperList}" var="ba"> -->
                                                      <tr>
                                                      
                                                      
                                                  <!--  <td width ="50%" align="center">
                                                    <font face="verdana" color="#0000FF">-->
                                                   <td>
                                                   <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                   
                                                    {!ba.cr.Account__r.Name}
                                                    </textarea>
                                                  
                                                   <!-- </font>-->
                                                    </td>
                                                    
                                                    
                                                    
                                                     <!-- <td>
                                                       <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                          <!--<apex:outputText value="{0,date,hh:mm}">-->
                                                               <!--<apex:param value="{!ba.cr.Date__c}" />-->
                                                         <!-- </apex:outputText> -->
                                                            <!--</textarea>
                                                      </td>-->
                                                       
                                                      <td>
                                                      <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                      {!ba.cr.Account__r.BillingStreet},{!ba.cr.Account__r.BillingCity},{!ba.cr.Account__r.BillingState},{!ba.cr.Account__r.BillingCountry}
                                                       </textarea>
                                                       </td>
                                                       
                                                      <td>
                                                      <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                      {!ba.cr.Account__r.BillingPostalCode}</textarea></td>
                                                      <td>
                                                       <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                      {!ba.cr.Account__r.Phone}
                                                      
                                                      
                                                      </textarea></td>
                                                      
                                                     <td><textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                     Rep Event
                                                     </textarea>
                                                     </td>
                                                      
                                                     
                                                      <td> <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                      {!ba.cr.Account__r.Type}
                                                      </textarea>
                                                      </td>
                                                      <td>
                                                       <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                      {!ba.cr.Account__r.Segment_status__c}
                                                      </textarea>
                                                      </td>
                                                      <td>
                                                       <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                          <apex:outputText value="{0,number,0}">
                                                                 <apex:param value="{!ba.cr.Account__r.Total_Number_Of_Patients__c}" />
                                                           </apex:outputText>
                                                          </textarea>
                                                      </td>
                                                      <td>
                                                       <textarea style="background: #FFFFFF; font-size: 14px; color: #0000FF;" cols="20" rows="10">
                                                          <apex:outputText value="{0,number,0}">
                                                                 <apex:param value="{!ba.cr.Account__r.No_of_Seats__c}" />
                                                           </apex:outputText>
                                                          </textarea>
                                                      </td>
                                                     
                                                 </tr>
                                                 
                                             
                                                   <apex:repeat value="{!ba.pernAcctList}" var="pa">                                               
                                                 
                                                 
                                                 <tr>
                                               
                                                  
                                                     <td><b>{!pa.paName}</b></td>
                                                     
                                                      <td><b>{!pa.paJobTitle}</b></td>
                                                      
                                                      
                                                       

                                                    
                                               
                            </table>                              
                        
                              
                        </body>
            </html>


           </apex:page>

 

 

 

Please helpme with my issue

 

 

 

 

 

 

Thanks in Advance

 


                             

Hi,

 

 Please help me out with my issue

 

I have a call report object where call plan is attached to it, whre the corresponding accounts are displayed in a pdf, but my issue wen i create a new call report on today's date along with the existing call report created on todays date , the accounts are getting displayed twice with the same name , where i want it to be displayed only once.

 

//controller

 

public class CallReportExtn{
    
        public class PdfWrapper{
            public Call_Report__c cr{get;set;}
            public List<PADetails> pernAcctList{get;set;}
            public List<PADetails> pernAcctList2{get;set;}
            public Call_Item__c callitemList{get;set;}
           public List<Customer_Brand__c> customerbrndbbl {get;set;}
        }
            public class PADetails{
            public List<Contact> cclist{get;set;}
            public String paName{get;set;}
            public String paaccName{get;set;}
            public String paJobTitle{get;set;}
            
            public String paLastvisit{get;set;}
            
            public String paBrand1{get;set;}
            public String paBrand2{get;set;}
            public String paBrand3{get;set;}
            public String callObjective1{get;set;}
            public String callObjective2{get;set;}
             public String crdate{get;set;}
        }
         set<id> top3bbl =  new set<id>();
         public string bblval{get;set;}
        public String brand1{get;set;}
        public String brand2{get;set;}
        public String brand3{get;set;}
        public list<string> callnames{get;set;}
        public List<Call_Report__c> crList{get;set;}
        public List<Customer_Brand__c> cbList{get;set;}
        public List<PdfWrapper> pdfWrapperList{get;set;}
        public List<PADetails> PADetailsList{get;set;}    
        public String userid=UserInfo.getUserId();
        Map<Id,List<PADetails>> paMap=new Map<Id,List<PADetails>>();
        Map<Id,Call_Item__c> callitempaMap=new Map<Id,Call_Item__c>();
        Map<Id,Call_Report__c> callReppaMap=new Map<Id,Call_Report__c>();
        Map<String,Customer_Brand__c> cCBpaMap=new Map<String,Customer_Brand__c>();
        Map<String,Contact> conmap=new Map<String,Contact>();
        Map<Id,List<PADetails>> cpmap=new Map<Id,List<PADetails>>();
         List<Customer_Brand__c> customerbrnd = new List<Customer_Brand__c>();
        List<Call_Item__c>  calltemplst=new List<Call_Item__c>();
        
        
           public List<SelectOption> getBBLS()
  {
  List<SelectOption> options = new List<SelectOption>();
        
   Schema.DescribeFieldResult fieldResult =
 Customer_Brand__c.BBL_Override__c.getDescribe();
   List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
       options.add(new SelectOption('','--None--'));  
   for( Schema.PicklistEntry f : ple)
   {
      options.add(new SelectOption(f.getLabel(), f.getValue()));
   }       
   return options;
  }    
 
 
 
 
    public CallReportExtn(ApexPages.StandardController controller){
        pdfWrapperList=baAccInfo();       
    }
    public List<PdfWrapper> baAccInfo(){
        List<PdfWrapper> pdfWrapper=new List<PdfWrapper>();
        Set<Id> accIdSet=new Set<Id>();
        Set<Id> callplanIdSet=new Set<Id>();
        if(userid !=null)
        crList=[select id,Contact__c,Date__c,Call_plan__c,Account__r.Name,Account__c,Account__r.id,Account__r.BillingCity,Account__r.BillingStreet,Account__r.BillingState,Account__r.BillingCountry,Account__r.BillingPostalCode,Account__r.phone,Account__r.Type,Account__r.Segment_Status__c,Account__r.Total_Number_Of_Patients__c,Account__r.No_of_Seats__c,Objective__r.Name,Objective2__r.Name from Call_Report__c where CallDate__c=TODAY and OwnerId=:userid];
       System.debug('crList==> '+crList);   
        for(Call_Report__c callRep:crList){
             if(callRep.Account__c !=null)
                 accIdSet.add(callRep.Account__c);
                 
            if(callRep.Call_plan__c !=null)
                 callplanIdSet.add(callRep.Call_plan__c);  
                 
            callReppaMap.put(callRep.Contact__c,callRep);     
                        
        }  
        
       List<Account> paList=[select Name,Job_Title__pc,Primary_Customer__pc,id,PersonContactId,Last_Activity__pc  from Account where Primary_Customer__pc in:accIdSet];
       List<Contact> cclist=[select Last_Activity__c from contact where Last_Activity__c !=null];
        System.debug('cclist ==> '+cclist );   
        if(callplanIdSet.size()>0){
             calltemplst = [select id,Brand__c, Brand__r.name,Position__c,Brand_Call_Plan__c from Call_Item__c where Brand_Call_Plan__c in:callplanIdSet ORDER BY Position__c limit 3];
             System.debug('calltemplst ==> '+calltemplst );        
        }
            
            
      
        for(Id baId:accIdSet){
            PADetailsList=new List<PADetails>();           
            PADetails paDetHeader=new PADetails();
            paDetHeader.paName='Name';
            paDetHeader.paJobTitle='Job Title';
           // paDetHeader.paLastvisit='Lastvisit';
           paDetHeader.crdate='Time';
           
            if(crList!=null && crList.size()>0 && crList.get(0)!=null && crList.get(0).Date__c!=null){
                paDetHeader.crdate='Time';     
            }else{
                paDetHeader.crdate='';    
            }
            
           if(calltemplst!=null && calltemplst.size()>0 && calltemplst.get(0)!=null && calltemplst.get(0).Brand__r.name!=''){
                paDetHeader.paBrand1=calltemplst.get(0).Brand__r.name;
                top3bbl.add(calltemplst.get(0).Brand__c);               
                                
            }else{
                paDetHeader.paBrand1='';    
            }
            
            
       
            if(calltemplst!=null && calltemplst.size()>0 && calltemplst.get(0)!=null && calltemplst.get(0).Brand__r.name!=''){
                paDetHeader.paBrand1=calltemplst.get(0).Brand__r.name;
                top3bbl.add(calltemplst.get(0).Brand__c);               
                                
            }else{
                paDetHeader.paBrand1='';    
            }
            
            if(calltemplst!=null && calltemplst.size()>1 && calltemplst.get(1)!=null && calltemplst.get(1).Brand__r.name!=''){
                paDetHeader.paBrand2=calltemplst.get(1).Brand__r.name;  
               top3bbl.add(calltemplst.get(1).Brand__c);                
            }else{
                paDetHeader.paBrand2='';    
            }
            
            if(calltemplst!=null && calltemplst.size()>2 && calltemplst.get(2)!=null && calltemplst.get(2).Brand__r.name!=''){
                paDetHeader.paBrand3=calltemplst.get(2).Brand__r.name;
                top3bbl.add(calltemplst.get(2).Brand__c);               
            }else{
                paDetHeader.paBrand3='';    
            }
            
            
             if(crList!=null && crList.size()>0 && crList.get(0)!=null && crList.get(0).Objective__r.Name!=''){
                paDetHeader.callObjective1='Objective1';     
            }else{
                paDetHeader.callObjective1='';    
            }
            
            if(crList!=null && crList.size()>0 && crList.get(0)!=null && crList.get(0).Objective__r.Name!=''){
                paDetHeader.callObjective2='Objective2';     
            }else{
                paDetHeader.callObjective2='';    
            }
            
             if(cclist!=null){
                paDetHeader.paLastvisit='Lastvisit';     
            }else{
                paDetHeader.paLastvisit='';    
            }
            
            
       if(top3bbl.size()>0){
           cbList= [select BBL__c,HCP__c,Brand__r.Name from Customer_Brand__c where  Brand__c in:top3bbl and HCP__c in:callReppaMap.keyset()];
           System.debug('cbList==> '+cbList);
           if(cbList.size()>0)
           {
           for(Customer_Brand__c cb:cbList){
               cCBpaMap.put(cb.HCP__c+cb.Brand__r.Name,cb);    
           }
           }
       }
       
      
            
            PADetailsList.add(paDetHeader);
                   
            for(Account ac:paList){
                    System.debug('ac.Name ==> '+ac.Name);
                    PADetails paDet=new PADetails();
                    paDet.paName=ac.Name;
                    if(ac.Primary_Customer__pc !=null)
                    //paDet.paaccName = ac.Primary_Customer__pc;
                    paDet.paJobTitle=ac.Job_Title__pc;
                    
                 if(callReppaMap.get(ac.personContactId)!=null){
                    paDet.crdate=String.valueof(callReppaMap.get(ac.personContactId).Date__c.format('hh:mm'));
                    }else{
                        paDet.crdate='';

                    }
 
                   
                   
                       
                  
                    if(callReppaMap.get(ac.personContactId)!=null){
                        paDet.callObjective1=callReppaMap.get(ac.personContactId).Objective__r.Name;
                    }else{
                        paDet.callObjective1='';

                    }
                    if(callReppaMap.get(ac.personContactId)!=null){
                        paDet.callObjective2=callReppaMap.get(ac.personContactId).Objective2__r.Name;
                    }else{
                        paDet.callObjective2='';

                    }
                    if(calltemplst.size()>0)
                    {
                    if(cCBpaMap.get(ac.personContactId+calltemplst.get(0).Brand__r.name)!=null){
                        paDet.paBrand1=cCBpaMap.get(ac.personContactId+calltemplst.get(0).Brand__r.name).BBL__c;
                    }else{
                        paDet.paBrand1='';

                    }
                    }
                    if(calltemplst.size()>1)
                    {
                    if(cCBpaMap.get(ac.personContactId+calltemplst.get(1).Brand__r.name)!=null){
                        paDet.paBrand2=cCBpaMap.get(ac.personContactId+calltemplst.get(1).Brand__r.name).BBL__c;
                    }else{
                        paDet.paBrand2='';

                    }
                    }
                    if(calltemplst.size()>2)
                    {
                    if(cCBpaMap.get(ac.personContactId+calltemplst.get(2).Brand__r.name)!=null){
                        paDet.paBrand3=cCBpaMap.get(ac.personContactId+calltemplst.get(2).Brand__r.name).BBL__c;
                    }else{
                        paDet.paBrand3='';

                    }
                    }                   
                    if(ac.Last_Activity__pc!=null){
                        System.debug('ac.Last_Activity__pc ==> '+ac.Last_Activity__pc);
                        String str=String.valueOf(ac.Last_Activity__pc);                        
                        paDet.paLastvisit=str.substring(8,10)+'/'+str.substring(5,7)+'/'+str.substring(0,4);
                       
                        
                     }
                     
                     else
                     {
                         paDet.paLastvisit='';
                         
                     }
                     
                 
                     
                     
                     
                    
                     if(ac.Primary_Customer__pc !=null)
                     {
                    if(baId == ac.Primary_Customer__pc)
                    {
                    PADetailsList.add(paDet);
                    paMap.put(baId,PADetailsList);    
                    }
                    }
          }
          
         }
        
         
        if(crList.size()>0)
        {
        for(Call_Report__c callRep:crList){
            PdfWrapper pw=new PdfWrapper();
            pw.cr=callRep;
            if(callRep.Account__c !=null)
            pw.pernAcctList=paMap.get(callRep.Account__c);
            //if(pw.pernAcctList.size()>0)
            //{
           // for(PADetails obj:pw.pernAcctList)
            //{
            //if(obj.paaccName !=null && callRep.Account__r.Name !=null)
           // {
           // if(callRep.Account__r.Name != obj.paaccName)
           // {
            // pw.pernAcctList2.add(obj);
            //}
            //}
            //}
            //}
            if(callRep.Call_plan__c !=null)
            pw.callitemList=callitempaMap.get(callRep.Call_plan__c);
            pdfWrapper.add(pw);
                                
        }
        }
        
        return pdfWrapper;
    }
        Thanks

 

 



}

Hi,

 

 I want to represent the time in hh:mm format , i am using the following code below,

 

 if(callReppaMap.get(ac.personContactId)!=null){
                    DateTime dt=System.now();
                    String dtStr=dt.format('HH:mm');
                    paDet.crdate=String.valueof(callReppaMap.get(ac.pe

rsonContactId).Date__c);
                    }else{
                        paDet.crdate='';

                    }

 

but i am getting the date as well as time, please help me with my issue.

 

 

Thanks in Advance

Hi,

 

 I want to represent the time in hh:mm format , i am using the following code below,

 

 if(callReppaMap.get(ac.personContactId)!=null){
                    DateTime dt=System.now();
                    String dtStr=dt.format('HH:mm');
                    paDet.crdate=String.valueof(callReppaMap.get(ac.pe

rsonContactId).Date__c);
                    }else{
                        paDet.crdate='';

                    }

 

but i am getting the date as well as time, please help me with my issue.

 

 

Thanks in Advance

Hi ,

 

 I have the below following code which displays both time and date , but i want to display only the time and not the date,

 

 

if(callReppaMap.get(ac.personContactId)!=null){
                    DateTime dt=System.now();
                    String dtStr=dt.format('HH:mm');
                    paDet.crdate=String.valueof(callReppaMap.get(ac.personContactId).Date__c);
                    }else{
                        paDet.crdate='';

                    }

 

Please help me out with my case

 

Thanks in Advance

Hi ,

 

 I have a date/time field which i am fetching dynamically , i want the time field to be displayed in hh:mm format, below is my code written for time

 

 

if(callReppaMap.get(ac.personContactId)!=null){
                        paDet.crdate=string.valueof(callReppaMap.get(ac.pe

rsonContactId).Date__c.time());
                    }else{
                        paDet.crdate='';

                    }

 

 

Please help me out to fetch the time in hh:mm format

 

 

Thanks in Advance

Hi,

Kindly help me out with my requirement,

I have a callreport (object) which i am attaching it to account via lookup for generating a pdf, which populates all the account details

 

I have a lookup called as "Call Plan" in call report, object which i am attaching to account, wen i am not entering any values in call plan lookup under callreport and wen i am attaching the call report to account

 

By clicking on the pdf button "PDF" , an error message "List index out of bound[0], displays but wen i attach the call plan its working fine Instead of that error message i want to display an meaningful message like "Please attach the callplan to call report",

 

Please help me out Thanks in Advance

Hi,

 

 Please help me out with my issue

 

1)I have 3 radio buttons in my vf page that i have created eg :1,2,3

2) On loading the vf page only one radio button only one radio button should be selected by default eg:3

 

Please do guide me to solve my issue

 

 

Thanks in Advance...

Hi, Can anyone tell me how to retrive the values from VF page to Apex in salesforce .. Thanks in advance

Hi,

 

 Please help me with test class coverage for the below portion alone, finding difficulties with the test coverage

 

for(Id baId:accIdSet){
        //Fetching all the person account headers and details dynamically
            PADetailsList=new List<PADetails>();           
            PADetails paDetHeader=new PADetails();
            paDetHeader.paName='Name';
            paDetHeader.paJobTitle='Job Title';
        
           
            if(crList!=null && crList.size()>0 && crList.get(0)!=null && crList.get(0).Date__c!=null){
                paDetHeader.crdate='Time';     
            }else{
                paDetHeader.crdate='';    
            }

 

Thanks in Advance

Hi,

 

 I have a wrapper class for which i have written a test class for it, i need some help to cover certain methods in the class which i am experiencing difficulty

 

i have written the methods as follows,

 

// methods need help(warpper class)

public class PdfWrapper{
        public Call_Report__c cr{get;set;}
        public List<PADetails> pernAcctList{get;set;}
        public List<PADetails> pernAcctList2{get;set;}
        public Call_Item__c callitemList{get;set;}
        public List<Customer_Brand__c> customerbrndbbl {get;set;}
        public String baId{get;set;}

 

// method help

 

public class PADetails{
        public List<Contact> cclist{get;set;}
        public String paName{get;set;}
        public String paaccName{get;set;}
        public String paJobTitle{get;set;}
        public String paLastvisit{get;set;}
        public String paBrand1{get;set;}
        public String paBrand2{get;set;}
        public String paBrand3{get;set;}
        public String callObjective1{get;set;}
        public String callObjective2{get;set;}
        public String crdate{get;set;}
    }

 

//Fetching all the person account headers and details dynamically
            PADetailsList=new List<PADetails>();           
            PADetails paDetHeader=new PADetails();
            paDetHeader.paName='Name';
            paDetHeader.paJobTitle='Job Title';
        
           
            if(crList!=null && crList.size()>0 && crList.get(0)!=null && crList.get(0).Date__c!=null){
                paDetHeader.crdate='Time';     
            }else{
                paDetHeader.crdate='';    
            }

 

Thanks in advance

 

 

 

 

Hi,

 

Please help me to write a testclass for the following apex class

 

 

//Apex class to generate a PDF from Account view page on button click

//Displays all the business account details, Person account details, brands with related BBL information,time,lastvisit,callobjective


public class CallReportExtn{
    
    public class PdfWrapper{
        public Call_Report__c cr{get;set;}
        public List<PADetails> pernAcctList{get;set;}
        public List<PADetails> pernAcctList2{get;set;}
        public Call_Item__c callitemList{get;set;}
        public List<Customer_Brand__c> customerbrndbbl {get;set;}
        public String baId{get;set;}
    }
    public class PADetails{
        public List<Contact> cclist{get;set;}
        public String paName{get;set;}
        public String paaccName{get;set;}
        public String paJobTitle{get;set;}
        public String paLastvisit{get;set;}
        public String paBrand1{get;set;}
        public String paBrand2{get;set;}
        public String paBrand3{get;set;}
        public String callObjective1{get;set;}
        public String callObjective2{get;set;}
        public String crdate{get;set;}
    }
    set<id> top3bbl =  new set<id>();      
    public String brand1{get;set;}
    public String brand2{get;set;}
    public String brand3{get;set;}
    public list<string> callnames{get;set;}
    public List<Call_Report__c> crList{get;set;}
    public List<Customer_Brand__c> cbList{get;set;}
    public List<PdfWrapper> pdfWrapperList{get;set;}
    public List<PADetails> PADetailsList{get;set;}    
    public String userid=UserInfo.getUserId();
    Map<Id,List<PADetails>> paMap=new Map<Id,List<PADetails>>();
    Map<Id,Call_Item__c> callitempaMap=new Map<Id,Call_Item__c>();
    Map<Id,Call_Report__c> callReppaMap=new Map<Id,Call_Report__c>();
    Map<String,Customer_Brand__c> cCBpaMap=new Map<String,Customer_Brand__c>();
    Map<String,Contact> conmap=new Map<String,Contact>();
    Map<Id,List<PADetails>> cpmap=new Map<Id,List<PADetails>>();
    List<Customer_Brand__c> customerbrnd = new List<Customer_Brand__c>();
    List<Call_Item__c>  calltemplst=new List<Call_Item__c>();
        
        public CallReportExtn(ApexPages.StandardController controller){
        pdfWrapperList=baAccInfo();       
    }
    public List<PdfWrapper> baAccInfo(){
        List<PdfWrapper> pdfWrapper=new List<PdfWrapper>();
        Set<Id> accIdSet=new Set<Id>();
        Set<Id> callplanIdSet=new Set<Id>();
        if(userid !=null)
        //Fetching all the business account fields from call report
        crList=[select id,Contact__c,Date__c,Call_plan__c,Account__r.Name,Account__c,Account__r.id,Account__r.BillingCity,Account__r.BillingStreet,Account__r.BillingState,Account__r.BillingCountry,Account__r.BillingPostalCode,Account__r.phone,Account__r.Type,Account__r.Segment_Status__c,Account__r.Total_Number_Of_Patients__c,Account__r.No_of_Seats__c,Objective__r.Name,Objective2__r.Name from Call_Report__c where CallDate__c=TODAY and OwnerId=:userid];
       System.debug('crList==> '+crList);   
        for(Call_Report__c callRep:crList)
        {
             if(callRep.Account__c !=null)
             {
              if(!accIdSet.contains(callRep.Account__c))
              {
                 accIdSet.add(callRep.Account__c);
                   

                 }
           }
                 
            if(callRep.Call_plan__c !=null)
            {
            if(!callplanIdSet.contains(callRep.Call_plan__c))
            callplanIdSet.add(callRep.Call_plan__c);
              }
              callReppaMap.put(callRep.Contact__c,callRep);   
                             
                                    
        }  
        //Fetching all the person accounts from a list
       List<Account> paList=[select Name,Job_Title__pc,Primary_Customer__pc,id,PersonContactId,Last_Activity__pc  from Account where Primary_Customer__pc in:accIdSet];
       //Fetching the last activity date from contact object
       List<Contact> cclist=[select Last_Activity__c from contact where Last_Activity__c !=null];
        System.debug('cclist ==> '+cclist );
        //Fetching the top three priority brands id callplan is added to callreport  
        if(callplanIdSet.size()>0){
             calltemplst = [select id,Brand__c,Brand__r.name,Position__c,Brand_Call_Plan__c from Call_Item__c where Brand_Call_Plan__c in:callplanIdSet ORDER BY Position__c limit 3];
             System.debug('calltemplst ==> '+calltemplst );        
        }
            
            
      
        for(Id baId:accIdSet){
        //Fetching all the person account headers and details dynamically
            PADetailsList=new List<PADetails>();           
            PADetails paDetHeader=new PADetails();
            paDetHeader.paName='Name';
            paDetHeader.paJobTitle='Job Title';
        
           
            if(crList!=null && crList.size()>0 && crList.get(0)!=null && crList.get(0).Date__c!=null){
                paDetHeader.crdate='Time';     
            }else{
                paDetHeader.crdate='';    
            }
            
           if(calltemplst!=null && calltemplst.size()>0 && calltemplst.get(0)!=null && calltemplst.get(0).Brand__r.name!=''){
                paDetHeader.paBrand1=calltemplst.get(0).Brand__r.name;
                top3bbl.add(calltemplst.get(0).Brand__c);               
                                
            }else{
                paDetHeader.paBrand1='';    
            }
            
            
       
            if(calltemplst!=null && calltemplst.size()>0 && calltemplst.get(0)!=null && calltemplst.get(0).Brand__r.name!=''){
                paDetHeader.paBrand1=calltemplst.get(0).Brand__r.name;
                top3bbl.add(calltemplst.get(0).Brand__c);               
                                
            }else{
                paDetHeader.paBrand1='';    
            }
            
            if(calltemplst!=null && calltemplst.size()>1 && calltemplst.get(1)!=null && calltemplst.get(1).Brand__r.name!=''){
                paDetHeader.paBrand2=calltemplst.get(1).Brand__r.name;  
                top3bbl.add(calltemplst.get(1).Brand__c);                
            }else{
                paDetHeader.paBrand2='';    
            }
            
            if(calltemplst!=null && calltemplst.size()>2 && calltemplst.get(2)!=null && calltemplst.get(2).Brand__r.name!=''){
                paDetHeader.paBrand3=calltemplst.get(2).Brand__r.name;
                top3bbl.add(calltemplst.get(2).Brand__c);               
            }else{
                paDetHeader.paBrand3='';    
            }
            
            
             if(crList!=null && crList.size()>0 && crList.get(0)!=null && crList.get(0).Objective__r.Name!=''){
                paDetHeader.callObjective1='Objective1';     
            }else{
                paDetHeader.callObjective1='';    
            }
            
            if(crList!=null && crList.size()>0 && crList.get(0)!=null && crList.get(0).Objective__r.Name!=''){
                paDetHeader.callObjective2='Objective2';     
            }else{
                paDetHeader.callObjective2='';    
            }
            
             if(cclist!=null){
                paDetHeader.paLastvisit='Lastvisit';     
            }else{
                paDetHeader.paLastvisit='';    
            }
            
           //Fetching the top three brands from customer brand object based on related HCP
       if(top3bbl.size()>0){
           cbList= [select BBL__c,HCP__c,Brand__r.Name from Customer_Brand__c where  Brand__c in:top3bbl and HCP__c in:callReppaMap.keyset()];
           System.debug('cbList==> '+cbList);
           if(cbList.size()>0)
           {
           for(Customer_Brand__c cb:cbList){
               cCBpaMap.put(cb.HCP__c+cb.Brand__r.Name,cb);    
           }
           }
       }
       
      
            
            PADetailsList.add(paDetHeader);
                   
            for(Account ac:paList){
                    System.debug('ac.Name ==> '+ac.Name);
                    PADetails paDet=new PADetails();
                    paDet.paName=ac.Name;
                    if(ac.Primary_Customer__pc !=null)
                    
                    paDet.paJobTitle=ac.Job_Title__pc;
                    
                 if(callReppaMap.get(ac.personContactId)!=null){
                    paDet.crdate=String.valueof(callReppaMap.get(ac.personContactId).Date__c.format('hh:mm'));
                    }else{
                        paDet.crdate='';

                    }
 
                   
                   
                       
                  
                    if(callReppaMap.get(ac.personContactId)!=null){
                        paDet.callObjective1=callReppaMap.get(ac.personContactId).Objective__r.Name;
                    }else{
                        paDet.callObjective1='';

                    }
                    if(callReppaMap.get(ac.personContactId)!=null){
                        paDet.callObjective2=callReppaMap.get(ac.personContactId).Objective2__r.Name;
                    }else{
                        paDet.callObjective2='';

                    }
                    if(calltemplst.size()>0)
                    {
                    if(cCBpaMap.get(ac.personContactId+calltemplst.get(0).Brand__r.name)!=null){
                        paDet.paBrand1=cCBpaMap.get(ac.personContactId+calltemplst.get(0).Brand__r.name).BBL__c;
                    }else{
                        paDet.paBrand1='';

                    }
                    }
                    if(calltemplst.size()>1)
                    {
                    if(cCBpaMap.get(ac.personContactId+calltemplst.get(1).Brand__r.name)!=null){
                        paDet.paBrand2=cCBpaMap.get(ac.personContactId+calltemplst.get(1).Brand__r.name).BBL__c;
                    }else{
                        paDet.paBrand2='';

                    }
                    }
                    if(calltemplst.size()>2)
                    {
                    if(cCBpaMap.get(ac.personContactId+calltemplst.get(2).Brand__r.name)!=null){
                        paDet.paBrand3=cCBpaMap.get(ac.personContactId+calltemplst.get(2).Brand__r.name).BBL__c;
                    }else{
                        paDet.paBrand3='';

                    }
                    }                   
                    if(ac.Last_Activity__pc!=null){
                        System.debug('ac.Last_Activity__pc ==> '+ac.Last_Activity__pc);
                        String str=String.valueOf(ac.Last_Activity__pc);                        
                        paDet.paLastvisit=str.substring(8,10)+'/'+str.substring(5,7)+'/'+str.substring(0,4);
                       
                        
                     }
                     
                     else
                     {
                         paDet.paLastvisit='';
                         
                     }
                     
                 
                     
                     
                     
                    
                     if(ac.Primary_Customer__pc !=null)
                     {
                    if(baId == ac.Primary_Customer__pc)
                    {
                    PADetailsList.add(paDet);
                    paMap.put(baId,PADetailsList);    
                    }
                    }
          }
          
         }
        
         
        if(crList.size()>0){
        Map<String,String> baIdMap=new Map<String,String>();
        for(Call_Report__c callRep:crList){
            if(baIdMap!=null && baIdMap.get(callRep.Account__c)==null){    
                PdfWrapper pw=new PdfWrapper();
                pw.cr=callRep;
                if(callRep.Account__c !=null){
                    baIdMap.put(callRep.Account__c,callRep.Account__c);
                    pw.pernAcctList=paMap.get(callRep.Account__c);
                }
           
                if(callRep.Call_plan__c !=null)
                pw.callitemList=callitempaMap.get(callRep.Call_plan__c);
                pdfWrapper.add(pw);
            }
                                
        }
        }
        
        return pdfWrapper;
    }
    
    

}

Hi,

 

 Please help me out with my issue

 

I have a call report object where call plan is attached to it, whre the corresponding accounts are displayed in a pdf, but my issue wen i create a new call report on today's date along with the existing call report created on todays date , the accounts are getting displayed twice with the same name , where i want it to be displayed only once.

 

Hi,

 

 I want to represent the time in hh:mm format , i am using the following code below,

 

 if(callReppaMap.get(ac.personContactId)!=null){
                    DateTime dt=System.now();
                    String dtStr=dt.format('HH:mm');
                    paDet.crdate=String.valueof(callReppaMap.get(ac.pe

rsonContactId).Date__c);
                    }else{
                        paDet.crdate='';

                    }

 

but i am getting the date as well as time, please help me with my issue.

 

 

Thanks in Advance

Hi ,

 

 I have the below following code which displays both time and date , but i want to display only the time and not the date,

 

 

if(callReppaMap.get(ac.personContactId)!=null){
                    DateTime dt=System.now();
                    String dtStr=dt.format('HH:mm');
                    paDet.crdate=String.valueof(callReppaMap.get(ac.personContactId).Date__c);
                    }else{
                        paDet.crdate='';

                    }

 

Please help me out with my case

 

Thanks in Advance

Hi ,

 

 I have a date/time field which i am fetching dynamically , i want the time field to be displayed in hh:mm format, below is my code written for time

 

 

if(callReppaMap.get(ac.personContactId)!=null){
                        paDet.crdate=string.valueof(callReppaMap.get(ac.pe

rsonContactId).Date__c.time());
                    }else{
                        paDet.crdate='';

                    }

 

 

Please help me out to fetch the time in hh:mm format

 

 

Thanks in Advance

Hi,

Kindly help me out with my requirement,

I have a callreport (object) which i am attaching it to account via lookup for generating a pdf, which populates all the account details

 

I have a lookup called as "Call Plan" in call report, object which i am attaching to account, wen i am not entering any values in call plan lookup under callreport and wen i am attaching the call report to account

 

By clicking on the pdf button "PDF" , an error message "List index out of bound[0], displays but wen i attach the call plan its working fine Instead of that error message i want to display an meaningful message like "Please attach the callplan to call report",

 

Please help me out Thanks in Advance