• Money Care
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 9
    Replies
Hi Guys

How to handle this type of syntax error.when i am going to create currency formula field its showing the following error.
Error: Error in referenced formula Quote__r.H_Total_Job_Value_new__c.Total_Customization_Charge_N__c.Record_type_name__c, Field $RecordType.Name does not exist. Check spelling.
<apex:page standardController="Bill__c" showHeader="false" sidebar="false" standardStylesheets="false" renderAs="pdf">
 <head>
     <style type="text/css">

        @page {

                 size:A4;

                 margin: 10mm;

              }

   </style>

 </head> 
 <body>
    <table cellspacing="0" cellpadding="0" border="0" width="100%">
       <tr>

                    <td>

                        <table cellspacing="5" border="0" width="100%" cellpadding="2">
                            <tr>

                                <td valign="top" width="30%">

                                    <!--<apex:image url="{!$Resource.Synthesis_New_Logo}" height="75" width="350"/>-->
                                    <div>
                                    </div>
                                
                                </td>
                                <td valign="right" align="right">
                                    <table>
                                      <tr><td>
                                      
                                      
                                      </td></tr>
                                    </table>
                                </td>

                            </tr>

                        </table>

                    </td>

                </tr>
                <tr>

                    <td>

                        <table border="0" cellspacing="0" width="100%" align="middle">

                            <tr>

                                <td align="center" style=" font: 22px; font-family: Calibri;">
                                   <!-- <b> ISO 9001 : 2008 Cerified  </b>   -->
                                   
                                 </td>

                           </tr>

                        </table>

                    </td>

                </tr>          
               <tr>
                  <td>
                   <table border="0" cellspacing="0" width="100%">
                       <tr>
                           <td valign="top" width="70%">
        
                                 <div  style=" font: 16px; font-family: Arial;">
                                    <br/><br/><br/>To,<br/>
                                        <b> {!Bill__c.Transaction__r.Borrowing_Party__r.Name}</b><br/>
                                        {!Bill__c.Transaction__r.Borrowing_Party__r.billingStreet}<br/>
                                        {!Bill__c.Transaction__r.Borrowing_Party__r.BillingCity} - {!Bill__c.Transaction__r.Borrowing_Party__r.BillingPostalCode}<br/>

                                        {!Bill__c.Transaction__r.Borrowing_Party__r.BillingState}<br/>

                                        {!Bill__c.Transaction__r.Borrowing_Party__r.BillingCountry}<br/>
                                     
                                 </div>
        
                           </td>
                           <td valign="right" align="right"  style=" font: 16px; font-family: Arial;">
        
                                 <apex:outputText value="Date: {0,date,dd/MM/yyyy}">
        
                                     <apex:param value="{!Bill__c.Bill_Date_formula__c}"/>
        
                                 </apex:outputText><br/>
                                 {!Bill__c.Brokerage_Bill_No__c}
                           </td>
                       </tr>
                   </table>
                  </td>
               </tr>
             <!-- <tr>
                  <td> <br/></td>
                  <td> <br/></td>
               </tr>   --> 
               <tr>
                   <td>
                       <table border="0" cellspacing="0" width="100%">
                          <tr>
                              <td valign="middle" align="center"  style=" font: 14px; font-family: Times New Roman;">
                               <b><h2><i><u>BILL</u></i></h2></b><br/>
                              </td>
                          </tr>
                          <tr>
                                <td align="left"  style=" font: 16px; font-family: Times New Roman;">
                                   <b> <u>Being the amount of Brokerage on arranging Loan as per details given below</u> : </b>
                                </td><br/>
                          </tr>
                       </table>
                   </td>
               </tr>
                
               <tr>
                   <td>
                       <table border="0" cellspacing="0" width="100%">
                            <tr>
                                 <td valign="left" align="center" width="45%">
                                   <u> Name of the Lender</u>
                                 </td>
                                 <td valign="left" align="center" width="15%">
                                   <u> Amount</u>
                                 </td>
                                 <td valign="left" align="center" width="10%">
                                    <u>Days</u>
                                 </td> 
                                 <td valign="right" align="center" width="10%">
                                   <u> Rate</u>
                                 </td>
                                 <td valign="right" align="right" width="20%">
                                   <u>Brokerage(Rs.)</u>
                                 </td>    
                            </tr>
                           
                            <tr>
                                <td>
                                </td>
                              </tr>
                           <tr width="100%">
                                 <td valign="left" align="center" width="45%">
                                   <b> {!Bill__c.Transaction__r.Lending_Party__r.Name} <br/></b>
                                   ( From &nbsp;
                                         <apex:outputText value="{0,date,dd/MM/yyyy}">
                                           <apex:param value="{!Bill__c.Transaction__r.Due_Date_of_Repayment__c}" />
                                       </apex:outputText>
                                       
                                 to &nbsp;  <apex:outputText value="{0,date,dd/MM/yyyy}">
                                             <apex:param value="{!Bill__c.Transaction__r.Defaulter_s_Repayment_date_formula__c}"/>
                                         </apex:outputText> )
                                 </td>
                                  
                                 <td align="center" width="15%">
                                    <apex:outputText value="{0, number, ###,###}">
                                           <apex:param value="{!Bill__c.Transaction__r.Loan_Amount__c}"/>
                                      </apex:outputText>/-
                                 </td>
                                 <td valign="center" align="center" width="10%">
                                     <apex:outputText value="{0, number, ###,###}">
                                           <apex:param value="{!Bill__c.Transaction__r.Principal_Repayment_Delay__c}"/>
                                      </apex:outputText>
                                 </td>
                                 <td valign="right" align="center" width="10%">
                                 <apex:outputText value="{0, number, ###,###.00}">
                                           <apex:param value="{!Bill__c.Transaction__r.Supplementary_Brokerage_Rate__c}"/>
                                      </apex:outputText>%
                                 </td>
                                 <td valign="right" align="right" width="20%">
                                    <apex:outputText value="{0, number, ###,###}">
                                           <apex:param value="{!Bill__c.Transaction__r.Supplementary_Brokerage_Amount__c}"/>
                                      </apex:outputText>/-
                                 </td>
                            </tr>
                                <tr>
                                 <td valign="left" width="45%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="15%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td>
                                 <td valign="right" align="right" width="20%">
                                    <br/>
                                 </td>
                            </tr>
                        
                            <tr>
                             <td >
                       <apex:outputPanel rendered="{!IF(Bill__c.Transaction__r.ST_Amt_on_Supplementary_Brokerage__c==0,false,true)}"> 
                       <colgroup width="300"> <tr>           
                <td>&nbsp;&nbsp;&nbsp;&nbsp; Add: Service Tax @ {!Bill__c.Transaction__r.ST_on_Supplementary_Brokerage__c}% </td><td valign="left" align="left" width="15%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td> <td valign="right" align="right" width="20%">
                
                <apex:outputText value="{0, number, ###,###}">
                                           <apex:param value="{!Bill__c.Transaction__r.ST_Amt_on_Supplementary_Brokerage__c}"/>
                                      </apex:outputText>/-</td></tr></colgroup>
                                       </apex:outputPanel>
                                    
                                 </td>
                            </tr>
                            
                            
            <tr>
                             <td >
                       <apex:outputPanel rendered="{!IF(Bill__c.Transaction__r.Swach_Bharat_Cess__c==null,false,true)}"> 
                       <tr>           
                <td>&nbsp;&nbsp;&nbsp;&nbsp; Swachh Bharat Cess @ {!Bill__c.Transaction__r.Swach_Bharat_Cess__c}% </td><td valign="left" align="left" width="15%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td> <td valign="right" align="right" width="20%">
                
                <apex:outputText value="{0, number, ###,###}">
                                           <apex:param value="{!Bill__c.Transaction__r.Swach_Bharat_Cess_Amt_Sup_Brok__c}"/>
                                      </apex:outputText>/-</td></tr>
                                       </apex:outputPanel>
                                    
                                 </td>
                            </tr>
                            
                            <tr>
                             <td >
                       <apex:outputPanel rendered="{!IF(Bill__c.Transaction__r.Krishi_Kalyan_Cess__c==null,false,true)}"> 
                       <colgroup width="300"> <tr>           
                <td>&nbsp; &nbsp; Krishi Kalyan Cess @ {!Bill__c.Transaction__r.Krishi_Kalyan_Cess__c}% </td><td valign="left" align="left" width="15%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td> <td valign="right" align="right" width="20%">
                
                <apex:outputText value="{0, number, ###,###}">
                                           <apex:param value="{!Bill__c.Transaction__r.Krishi_Kalyan_Cess_Amt_Sup_Brok__c}"/>
                                      </apex:outputText>/-</td></tr></colgroup>
                                       </apex:outputPanel>
                                    
                                 </td>
                            </tr>
                         
                            
                            
                            <tr>
                             <td >
                       <apex:outputPanel rendered="{!IF(Bill__c.Transaction__r.Supp_Education_Cess_INR__c==0,false,true)}"> 
                       <colgroup width="300"> <tr>           
                <td>&nbsp;&nbsp;&nbsp;&nbsp; EC @2% of ST </td><td valign="left" align="left" width="15%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td> <td valign="right" align="right" width="20%">
                
                <apex:outputText value="{0, number, ###,###}">
                                           <apex:param value="{!Bill__c.Transaction__r.Supp_Education_Cess_INR__c}"/>
                                      </apex:outputText>/-</td></tr></colgroup>
                                       </apex:outputPanel>
                                    
                                 </td>
                            </tr>
                            
                            
                            <tr>
                             <td >
                       <apex:outputPanel rendered="{!IF(Bill__c.Transaction__r.Secondary_Supplementary_Educ_Cess_INR__c==0,false,true)}"> 
                       <colgroup width="300"> <tr>           
                <td>&nbsp;&nbsp;&nbsp;&nbsp; HEC @1% of ST </td><td valign="left" align="left" width="15%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td> <td valign="right" align="right" width="20%">
                
                <apex:outputText value="{0, number, ###,###}">
                                           <apex:param value="{!Bill__c.Transaction__r.Secondary_Supplementary_Educ_Cess_INR__c}"/>
                                      </apex:outputText>/-</td></tr></colgroup>
                                       </apex:outputPanel>
                                    
                                 </td>
                            </tr>
               
                            <tr>
                                <td>
                                    <br/>
                                </td>
                            </tr>
                            <tr>
                                 <td valign="left" width="45%">
                                   <br/>
                                 </td>
                                 <td valign="left" align="left" width="15%">
                                    <br/>    
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td>
                                 <td valign="right" align="right" width="20%">
                                    <table border="0" cellspacing="0" align="right" width="50%">
                                         <tr>
                                             <td colspan="2"><hr/>
                                               <apex:outputText value="{0, number, ###,###}">
                                           <apex:param value="{!Bill__c.Transaction__r.Sup_gross_Bro__c}"/>
                                      </apex:outputText>/-
                                             </td>
                                         </tr>
                                    </table>
                                    
                                 </td>
                            </tr>
                            <tr>
                                <td>
                                <br/>
                                <br/>
                                </td>
                              </tr>
                              <tr>
                            <td >
                       <apex:outputPanel rendered="{!IF(Bill__c.Transaction__r.TDS_Amt_on_Supplementary_Brokerage__c==0,false,true)}"> 
                       <colgroup width="300"> <tr>           
                <td>&nbsp;&nbsp;&nbsp;&nbsp; Less: TDS @ {!Bill__c.Transaction__r.TDS_on_Supplementary_Brokerage_Amt__c} % </td><td valign="left" align="left" width="15%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td> <td valign="right" align="right" width="20%">
                
                <apex:outputText value="{0, number, ###,###}">
                                           <apex:param value="{!Bill__c.Transaction__r.TDS_Amt_on_Supplementary_Brokerage__c}"/>
                                      </apex:outputText>/-</td></tr></colgroup>
                                       </apex:outputPanel>
                                      
                                      
                                 </td>
                            </tr>
                            <tr>
                                <td>
                                <br/>
                                </td>
                            </tr>
              </table>
              <table>
                            <tr>
                                 <td valign="left" width="70%">
                                   <i>( Rupees {!Bill__c.Transaction__r.Net_Supplementary_Brokerage_in_words__c} only )  </i>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td>
                                 <td valign="right" align="right" width="30%">
                                     <table border="0" cellspacing="0" width="100%">
                                         <tr>
                                             <td colspan="2"><hr/>
                                             </td>
                                         </tr>
                                    </table>
                                   <b>    <apex:outputText value="{0, number, ###,###}">
                                           <apex:param value="{!Bill__c.Transaction__r.Net_Suppl_Brokerage__c}"/>
                                      </apex:outputText>/-  </b>
                                   <table border="0" cellspacing="0" width="100%">
                                         <tr>
                                             <td colspan="2"><hr/>
                                             </td>
                                         </tr>
                                    </table>
                                 </td>
                            </tr>   
                        </table>
                    </td>
                </tr>
                </table>
                <br/>
               
     </body>
</apex:page>

 
Hi Guys
I have a challenge in my current job.that is i have created a vf page and custom button for open this vf page.now i will create a checkbox field in my custom object and requirment is when i click to custom button to open vf page the check box automatically checked.how it is possible ,is anybody have idea to resloving this challenge.

Thanks
Hi Guys
I have facing a isssue from a long time that i have a percentage field which default value is 10% currently.i need to change that default value 5% from 10% on or later 01/06/2016 created


Thanks in adv
Hi
I have created a page which is search record based on date.i have created but when i click there no return of record .any one can help me out .
<apex:page sidebar="false" Controller="BankBookSectionsController"   showHeader="false">  
<apex:form >

<apex:pageMessages ></apex:pageMessages>
<style type="text/css" media="print">
@media print
{
#non-printable { display: none; }
#printable {
display: block;
width: 100%;
height: 100%;
}
}
</style>

<style type = "text/css">
        .colHeadr {text-align:center;}
        .colHeadrRight{
            text-align:right;
        }
        }
    </style>
    
    
     
    <apex:define name="body">
            
            <div style="width:800px;margin: 0px auto 10px auto;border: 1px solid black;">
          <center><h1><apex:sectionHeader title="This is Party/Master Group Report"/></h1></center>
            <apex:outputLink style="font-weight: bold;float:right;" value="{!URLFOR($Page.LoginPage)}"><b>Back To Home</b>
              
            </apex:outputLink>
    
   
       <b>Start Date</b><apex:inputField value="{!j.Date__c}"/>&nbsp;&nbsp;&nbsp;
     <b>End Date</b><apex:inputField value="{!j.Date__c}"/>
     <apex:commandButton value="Go" action="{!displaingTable}" reRender="dt" style="background:green"/>
      <b><apex:commandLink id="printable"  onclick="JavaScript:window.print();" value="Print"/></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;                     
 
  
  <apex:repeat value="{!Groups }" var="state" >
   
    <apex:pageBlock title="{!state}">

      <apex:repeat value="{!accounts}" var="account"> 
      

        <apex:outputPanel rendered="{!IF(state=account.Group__c,true,false)}" style="color:red;">
        {!account.Name} - {!account.Master_Code__c}<br/>
        </apex:outputPanel>
        

      </apex:repeat>

    </apex:pageBlock>
   

  </apex:repeat>
    
       
                      </div>
        </apex:define>
</apex:form>
</apex:page>
public with sharing class BankBookSectionsController {

 
 public MasterTest__c j { get; set; }
  public List<MasterTest__c> accounts {get;set;}  
  public String[] Groups {get;set;}
  
  public BankBookSectionsController (){
     accounts =new List<MasterTest__c>();
    j=new MasterTest__c();
}
  
  public date startdate1;
       public date enddate1;

  
   public void displaingTable(){
   
  
   
        
        
 startdate1=j.Date__c;
         enddate1=j.Date__c;
    
 
      accounts = [select ID,name,Group__c,Master_Code__c,Date__c from MasterTest__c where (Date__c>=:startdate1) AND (Date__c<=:enddate1)order by Date__c ASC];  
        
        // accounts = [Select ID, Name,Group__c,Master_Code__c,Date__c From MasterTest__c
     // Where Group__c IN ('Group 00','Group 01','Group 02','Group 03','Group 04','Group 05','Group 06','Group 07','Group 08','Group 09','Group 10','Group 11','Group 12','Group 13'
     // ,'Group 14','Group 15','Group 16','Group 17','Group 18','Group 19','Group 20','Group 21','Group 22','Group 23','Group 24','Group 25','Group 26','Group 27','Group 28',
      //'Group 29','Group 30','Group 31','Group 32','Group 33','Group 34','Group 35','Group 36','Group 37','Group 38','Group 39','Group 40') ];




    // dynamically create set of unique states from query
    Set<String> stateSet = new Set<String>();
    for (MasterTest__c a : accounts)
      stateSet.add(a.Group__c);

    // convert the set into a string array  
    Groups = new String[stateSet.size()];
    Integer i = 0;
    for (String state : stateSet) { 
      Groups [i] = state;
      i++;
    }

  }
            
          
    
    
    
    
    
    
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  



    // for demo purposes limit the states  
   

}


 
Hi Guys

I have created a Vf page which like a custom report.but here my problem is i am not unable to grouping the record .see my  screenshot now i am getting this User-added image
 
public with sharing class PartyMaster {



    public List<MasterTest__c> accounts {get;set;}  
    public String[] Groups {get;set;}

    public MasterTest__c j { get; set; }
    
    public String Id { get; set; }
    public List<MasterTest__c> jb { get; set; }
    public String keyword { get; set; }
   
   //Dc 
    public PartyMaster (){
     jb=new List<MasterTest__c>();
    j=new MasterTest__c();
}

    public PageReference getid() {
    jb=[select ID, Name,Group__c,Master_Code__c,Date__c From MasterTest__c where Name=:id ];
        return null;
    }

     public PageReference getKey_search() {
 jb=[select ID, Name,Group__c,Master_Code__c,Date__c From MasterTest__c where Name=:id ];
        
        return null;
    }

//we need to assign some temp var,for data type
       public date startdate1;
       public date enddate1;
public PageReference go() {
    startdate1=j.Date__c;
    enddate1=j.Date__c;
    
    jb=[select  ID, Name,Group__c,Master_Code__c,Date__c From MasterTest__c where (Date__c>=:startdate1) AND (Date__c<=:enddate1)order by Date__c ASC];
    
        return null;
    }
    

}
}

--------------------------------------------------------------------------------------

<apex:page controller="PartyMaster" sidebar="false" showHeader="false"><style type="text/css" media="print">
@media print
{
#non-printable { display: none; }
#printable {
display: block;
width: 100%;
height: 100%;
}
}
</style>

<style type = "text/css">
        .colHeadr {text-align:center;}
        .colHeadrRight{
            text-align:right;
        }
        }
    </style>


 <apex:form id="dt">
  <apex:define name="body">
            <div style="width:1250px;margin: 0px auto 10px auto;background-color:Gray;border: 1px solid black;">
            <apex:image id="theImage" value="{!$Resource.Emami}" width="100" height="100"/>
            <apex:outputLink style="font-weight: bold;float:right;" value="{!URLFOR($Page.LoginPage)}"><b>Back To Home</b>
            </apex:outputLink>
  <apex:pageBlock title="BankBook Details To Search">
  
        
     <!---search By Date Range-->
    <b>Start Date</b><apex:inputField value="{!j.Date__c}"/>&nbsp;&nbsp;&nbsp;
     <b>End Date</b><apex:inputField value="{!j.Date__c}"/>
     <apex:commandButton value="Go" action="{!go}" reRender="dt" style="background:pink"/>
      <b><apex:commandLink id="printable"  onclick="JavaScript:window.print();" value="Print"/></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     <!---search By word-->
      <apex:inputText value="{!keyword}"/>
      <apex:commandButton value="Search By Group" action="{!getKey_search}" style="background:pink"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     
     
      <!---search By Id-->
      <apex:inputtext value="{!Id}"/>
      <apex:commandButton value="Search By Party" action="{!getid}" style="background:pink"/>
     
     <!---which fiels we want to display -->
   <apex:pageBlockSection columns="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
   <apex:pageBlockTable var="jj" value="{!jb}" style="width:100%; font-size:10pt">
   <apex:column headerValue="Date" value="{!jj.Date__c}"/>
    <apex:column headerValue="Group" value="{!jj.Group__c}"/>
    
      <apex:column headerValue="Party Name" value="{!jj.Master_Code__c}"/>
      


     
   
    </apex:pageBlockTable>
   </apex:pageBlockSection>
  </apex:pageBlock>
 
  </div>
        </apex:define>
        <center><br/>
        <b><i style="font-size:10px;color:red;">Developed By GlobalNest IT Solution Pvt.Ltd. <a href="http://www.globalnest.com" target="_blank">[http://www.Globalnest.com]</a> </i></b>
    </center><br/>
    </apex:form>
</apex:page>
but i need this type of grouping  .,....

User-added image
 
Hi All

I have created a trigger for before insert which is fired on the basic of record creation.i need to add before insert and after update event but its not working,can any body find my fault.
trigger setBalance on BankBookTest__c (before insert,after update){
    Set<Id> masterTestIds = new Set<Id>();
    
    for(BankBookTest__c bankBook : trigger.new){
        if(bankBook.BankAccount__c != null){
            masterTestIds.add(bankBook.BankAccount__c);
        }
        if(bankBook.Party_Code__c != null){
            masterTestIds.add(bankBook.Party_Code__c);
        }
    }
    
    Map<Id,MasterTest__c> masterTestRecords = new Map<Id,MasterTest__c>();
    for(MasterTest__c master : [Select Closing_Balance__c from MasterTest__c where id in :masterTestIds]){
        masterTestRecords.put(master.id, master);
    }
     
    for(BankBookTest__c bankBook : trigger.new){
        if(masterTestRecords.containsKey(bankBook.BankAccount__c)){
            bankBook.Bank_Opening_Balance__c = masterTestRecords.get(bankBook.BankAccount__c).Closing_Balance__c;
            if(bankBook.Transaction_Type__c == 'Payment'){
                bankBook.Bank_Closing_Balance__c = masterTestRecords.get(bankBook.BankAccount__c).Closing_Balance__c - bankBook.Amount__c;
            }
            if(bankBook.Transaction_Type__c == 'Reciept'){
                bankBook.Bank_Closing_Balance__c = masterTestRecords.get(bankBook.BankAccount__c).Closing_Balance__c + bankBook.Amount__c;
            }
        }
        
        if(masterTestRecords.containsKey(bankBook.Party_Code__c)){
            bankBook.Party_Opening_Balance__c = masterTestRecords.get(bankBook.Party_Code__c).Closing_Balance__c;
            if(bankBook.Transaction_Type__c == 'Payment'){
                bankBook.Party_Closing_Balance__c = masterTestRecords.get(bankBook.Party_Code__c).Closing_Balance__c + bankBook.Amount__c;
            }
            if(bankBook.Transaction_Type__c == 'Reciept'){
                bankBook.Party_Closing_Balance__c = masterTestRecords.get(bankBook.Party_Code__c).Closing_Balance__c - bankBook.Amount__c;
            }
        }
        
        if(bankBook.Transaction_Type__c == 'Payment'){
            masterTestRecords.get(bankBook.BankAccount__c).Closing_Balance__c = masterTestRecords.get(bankBook.BankAccount__c).Closing_Balance__c - bankBook.Amount__c;
            masterTestRecords.get(bankBook.Party_Code__c).Closing_Balance__c = masterTestRecords.get(bankBook.Party_Code__c).Closing_Balance__c + bankBook.Amount__c;
        }
        if(bankBook.Transaction_Type__c == 'Reciept'){
            masterTestRecords.get(bankBook.BankAccount__c).Closing_Balance__c = masterTestRecords.get(bankBook.BankAccount__c).Closing_Balance__c + bankBook.Amount__c;
            masterTestRecords.get(bankBook.Party_Code__c).Closing_Balance__c = masterTestRecords.get(bankBook.Party_Code__c).Closing_Balance__c - bankBook.Amount__c;
        }
        bankBook.To_DateFUP__c=bankBook.Date__c;
        bankBook.From_DateFUP__c=bankBook.Date__c;
    }
}


 
Hi All

Account object having more than 4k record from 2010 to till.i want the lastmodified date which created date not equal in 1/4/2015 to 31/3/2016.

one record which created date is 23/4/2010 and modified date is 28/4/2016 .how to find this record


Thanks
 
Hi
I have created a class for file uploading.its working fine me now.but i want to put restriction like that if attachement then save otherwise it will display error message...How to achieve this
public class FormCurriculumController { 
  

public Purchase_Order__c curriculum {get; set;}
public Boolean privacy {get; set;}
public Boolean saved {get; set;}
public String styleClass {get; set;}

public Transient Blob resume {get; set;}
public String contentType {get; set;}
public String fileName {get; set;}
      
    public boolean showC1RecordType {get;set;}
    public boolean showC2RecordType {get;set;} 
    
    private Id c1RecordTypeId; 
    private Id c2RecordTypeId;


//ublic FormCurriculumController () {
    //curriculum = new Purchase_Order__c();
    //saved = false;
//}

  public FormCurriculumController(ApexPages.StandardController controller) {

        c1RecordTypeId = Schema.SObjectType.Purchase_Order__c.getRecordTypeInfosByName().get('C1').getRecordTypeId();
        c2RecordTypeId = Schema.SObjectType.Purchase_Order__c.getRecordTypeInfosByName().get('C2').getRecordTypeId();
        
        curriculum= new Purchase_Order__c();
        curriculum= (Purchase_Order__c)controller.getRecord();
         
        String isButtonClicked = Apexpages.currentPage().getParameters().get('setDefaultValues');
        if(isButtonClicked == 'true'){
            setDefaultValues();
        }
        
        showC1RecordType = false;
        showC2RecordType = false;
       
        if(curriculum.RecordTypeId == c1RecordTypeId){
            showC1RecordType = true;
            showC2RecordType = false;
        }
        else if(curriculum.RecordTypeId == c2RecordTypeId){
            showC1RecordType = false;
            showC2RecordType = true;
        }
        
    }
    
     public void setDefaultValues(){
        String quoteId = Apexpages.currentPage().getParameters().get('quoteId');
        Quote__c quote = [Select o.id, o.name, o.Quantity_formula__c, o.Opportunity_Product_Detail__r.Opportunity__c,
                    o.Opportunity__c, o.Record_type_name__c,o.Company_Name__c,Opportunity_Product_Detail__r.Opportunity__r.Account__c from Quote__c o WHERE O.id=:quoteId];
        //system.assert(false,quote);     
        curriculum.Opportunity__c = quote.Opportunity_Product_Detail__r.Opportunity__c;
        curriculum.Quote__c = quote.id;
        curriculum.Company__c = quote.Opportunity_Product_Detail__r.Opportunity__r.Account__c;
        
        if(quote.Record_type_name__c == 'C1'){
            curriculum.RecordTypeId = c1RecordTypeId;
        }
        else {
            curriculum.RecordTypeId = c2RecordTypeId;
        }
    }

    


public PageReference save() {
    try {
     
        if (!privacy) {
         ApexPages.Message reqMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Please upload recent Purchase Order  before saving the record');
                ApexPages.addMessage(reqMsg);
            
            return null;
        }


        
       
        
        if( ! Test.isRunningTest() )
        {   
            insert(curriculum);
        }
        
        if (resume != null) {
         
            Attachment attach = new Attachment();
            attach.Body = resume;
            attach.Name = fileName;
            attach.ContentType= contentType;
            attach.ParentId = curriculum.id;                
             
             
            
             try {
                
        
            
                insert(attach);
                return new PageReference('/'+curriculum.id);
}
             
             
            catch (Exception ex) {
               

                ApexPages.addMessages(ex);
                return null;
            }                    
        }

        update curriculum;

        saved = true;

    } 
    catch(Exception ex) {
        ApexPages.addMessages(ex);  
    }
    return null;   
}
}

 
Hi All
I have developed a class for file uploading.its working fine me now.but i want to put restriction that without file upload record couldnot save.if i am going for save record without file uplaod it will showing error message.how to solve this
 
public class FormCurriculumController { 
  

public Purchase_Order__c curriculum {get; set;}
public Boolean privacy {get; set;}
public Boolean saved {get; set;}
public String styleClass {get; set;}

public Transient Blob resume {get; set;}
public String contentType {get; set;}
public String fileName {get; set;}
      
    public boolean showC1RecordType {get;set;}
    public boolean showC2RecordType {get;set;} 
    
    private Id c1RecordTypeId; 
    private Id c2RecordTypeId;


//ublic FormCurriculumController () {
    //curriculum = new Purchase_Order__c();
    //saved = false;
//}

  public FormCurriculumController(ApexPages.StandardController controller) {

        c1RecordTypeId = Schema.SObjectType.Purchase_Order__c.getRecordTypeInfosByName().get('C1').getRecordTypeId();
        c2RecordTypeId = Schema.SObjectType.Purchase_Order__c.getRecordTypeInfosByName().get('C2').getRecordTypeId();
        
        curriculum= new Purchase_Order__c();
        curriculum= (Purchase_Order__c)controller.getRecord();
         
        String isButtonClicked = Apexpages.currentPage().getParameters().get('setDefaultValues');
        if(isButtonClicked == 'true'){
            setDefaultValues();
        }
        
        showC1RecordType = false;
        showC2RecordType = false;
       
        if(curriculum.RecordTypeId == c1RecordTypeId){
            showC1RecordType = true;
            showC2RecordType = false;
        }
        else if(curriculum.RecordTypeId == c2RecordTypeId){
            showC1RecordType = false;
            showC2RecordType = true;
        }
        
    }
    
     public void setDefaultValues(){
        String quoteId = Apexpages.currentPage().getParameters().get('quoteId');
        Quote__c quote = [Select o.id, o.name, o.Quantity_formula__c, o.Opportunity_Product_Detail__r.Opportunity__c,
                    o.Opportunity__c, o.Record_type_name__c,o.Company_Name__c,Opportunity_Product_Detail__r.Opportunity__r.Account__c from Quote__c o WHERE O.id=:quoteId];
        //system.assert(false,quote);     
        curriculum.Opportunity__c = quote.Opportunity_Product_Detail__r.Opportunity__c;
        curriculum.Quote__c = quote.id;
        curriculum.Company__c = quote.Opportunity_Product_Detail__r.Opportunity__r.Account__c;
        
        if(quote.Record_type_name__c == 'C1'){
            curriculum.RecordTypeId = c1RecordTypeId;
        }
        else {
            curriculum.RecordTypeId = c2RecordTypeId;
        }
    }

    


public PageReference save() {
    try {
     
        if (!privacy) {
        
             ApexPages.Message reqMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Please upload recent Purchase Order  before saving the record');
                ApexPages.addMessage(reqMsg);
            return null;
        }


        
       
        
        if( ! Test.isRunningTest() )
        {   
            insert(curriculum);
        }
        
        if (resume != null) {
            Attachment attach = new Attachment();
            attach.Body = resume;
            attach.Name = fileName;
            attach.ContentType= contentType;
            attach.ParentId = curriculum.id;                
            try {
                
               
                insert(attach);
                return new PageReference('/'+curriculum.id);

            } catch (Exception ex) {
               

                ApexPages.addMessages(ex);
                return null;
            }                    
        }

        update curriculum;

        saved = true;

    } 
    catch(Exception ex) {
        ApexPages.addMessages(ex);  
    }
    return null;   
}
}

 
Hi All

I have 2 object Oppertunity and OppertunityCustom__C and 3 profile (like Admin,profile1 and profile2)

Both object have relationship.
Oppertunitycustom have 4 record type (like R1,R2,R3,R4).

My requirment is profile1 can see profile2 record of record type R1 and R4 only not all in Oppertuntycustom__c.How to achieve this job
Hi all

I have created a custom report using visual force page.but i want to grouping this report uisng vf page.can anyone help me on this job ?
<apex:page docType="html-5.0" standardController="MasterTest__c"  extensions="PartyCodeReport"  showHeader="false" sidebar="false">
<center><h1 style="text-align:center;color:blue;">  This is Party/masterCode Report! </h1></center>
<apex:pageMessages ></apex:pageMessages>
<style type="text/css" media="print">
@media print
{
#non-printable { display: none; }
#printable {
display: block;
width: 100%;
height: 100%;
}
}
</style>

<style type = "text/css">
        .colHeadr {text-align:center;}
        .colHeadrRight{
            text-align:right;
        }
        }
    </style>


       <apex:define name="body">
            
            <div style="width:800px;margin: 0px auto 10px auto;border: 1px solid black;">
    <apex:form id="tableId">
        <apex:pageBlock >
            
                    <b><apex:outputLabel value="Party/MasterCode Report Report On: "  style="font-weight: bold;color:Black;"/></b>
                     <apex:inputField value="{!account.Date__c}" style="font-weight: bold;color:red;" required="false"/>
                     
                     
                   <!--- Trial Balance Report On: <apex:input type="date" value="{!dat}"/>-->
                 
                 <apex:commandButton value="Display" action="{!displaingTable}" reRender="tableId" style="font-weight: bold;color:Black;" oncomplete="window.opener.location.refresh();" />
        <b><apex:commandLink id="printable"  onclick="JavaScript:window.print();" value="Print"/></b> <br/><br/><br/>
                
                 
               
                 
                 <apex:outputPanel rendered="{!If(account.Date__c== null,true,false)}">
                 <apex:outputLabel style="font-weight: bold;color:blue;font-size:15px;padding-left:1%" > Please enter date to fetch accurate results. </apex:outputLabel>
                 </apex:outputPanel>
                 
  </apex:pageBlock>



 <table border="1" cellpadding="1" cellspacing="0" style="width:100%;border:1px solid #000000;font-familyans-serif;font-size:20px">
                    <tr style="font-family:verdana;color:Black;font-size:12px;height=18px;width:100%" >
                    
                        <td  style="background-color: #DAFFFF" ><b><apex:outputText value="Master Code"/></b> </td>
                        <td  style="background-color: #DAFFFF" ><b><apex:outputText value="Master Name"/></b> </td>
                         <td  style="background-color: #DAFFFF" ><b><apex:outputText value="Group"/></b> </td>
                        <!---<td  style="background-color: #DAFFFF" ><b><apex:outputText value="Debit Bal."/></b></td>
                        <td  style="background-color: #DAFFFF" ><b><apex:outputText value="Credit Bal."/></b></td>
                        <td  style="background-color: #DAFFFF" ><b><apex:outputText value="Account Type"/></b></td>-->
                    </tr>
                    
                    
                    
                      <apex:repeat value="{!listAccount}" var="c" id="InvRepeat">
                        <tr border="1" style="font-family:verdana;color:Black;font-size:12px;width:100%" >
                            <!---<td ><apex:outputText value="{!c.Txn_Date__c}"/></td>--->
                            
                            
                           
                         
                            <td><apex:outputText value="{!c.Name}"/></td>
                            <td><apex:outputText value=" {!c.Master_Code__c}"/></td>
                            <td><apex:outputText value=" {!c.Group__c}"/></td>
                            
                            
                          
                            </tr>
                    </apex:repeat>
                    
                     
       
         
                      
                    
                    
                    </table>
                    </apex:form>
                      </div>
        </apex:define>


</apex:page>
public with sharing class PartyCodeReport {
    public MasterTest__c account{get;set;}
    public List<MasterTest__c> listAccount {get;set;}
   
   
    public Date dat {get;set;}
    
    public Map<Date,List<MasterTest__c>> mapOfDateWithEntry;

    public PartyCodeReport(ApexPages.StandardController controller){
    
        account = new MasterTest__c();
      
    }
     
   public void setValues(){
        listAccount  = new List<MasterTest__c>([SELECT id,Name,Group__c,Master_Code__c, Date__c
                        FROM MasterTest__c
                        order by Group__c ASC ]);
        mapOfDateWithEntry = new Map<Date,List<MasterTest__c>>();
        List<MasterTest__c> listOfEntryData;
        for(MasterTest__c entry : listAccount){
            if(entry.Date__c != null){
                if(mapOfDateWithEntry.containsKey(entry.Date__c)){
                    mapOfDateWithEntry.get(entry.Date__c).add(entry);
                }
                else{
                    listOfEntryData = new List<MasterTest__c>();
                    listOfEntryData.add(entry);
                    mapOfDateWithEntry.put(entry.Date__c,listOfEntryData);
                }
            }
        }
       
   }
   public void displaingTable(){
   
   
   try{
   
        setValues();
        
        
        
 
        if(account.Date__c!= null){
           
            system.debug('Map '+mapOfDateWithEntry);
            Set<Date> allDateSet = mapOfDateWithEntry.keySet();
            if(allDateSet.contains(account.Date__c)){
                listAccount = mapOfDateWithEntry.get(account.Date__c);
            }
            else {
                List<Date> sortedDateList = new List<Date>();
                sortedDateList.addAll(allDateSet);
                sortedDateList.sort();
                
                Boolean isAnyPastDate = false;
                Date requiredDate;
                for(Date recordDate : sortedDateList){
                    if(account.Date__c > recordDate){
                        requiredDate = recordDate;
                        isAnyPastDate = true;
                    }
                    else{
                        break;
                    }
                }
                if(isAnyPastDate){
                    listAccount = mapOfDateWithEntry.get(requiredDate);
                }
                else{
                    listAccount = new List<MasterTest__c>();
                }
                /*Date compareDate ;
                Integer count = 0;
                for(Date firstKeydate : allDateSet){
                    compareDate = firstKeydate;
                    break;
                }
                system.debug('Before Compare Date'+compareDate);
                for(Date keyDate : allDateSet){
                    if(keydate < account.DateUpdate__c && keydate > compareDate){
                        compareDate = keyDate;
                    }
                    if(account.DateUpdate__c < keyDate){
                        count ++ ;
                    }
                }
                system.debug('After Compare Date'+compareDate);
                Date requiredDate ;
                
                if(allDateSet.size() == count){
                    requiredDate = [Select DateUpdate__c from MasterCopy__c Order by DateUpdate__c Desc LIMIT 1][0].DateUpdate__c;
                }
                else {
                    requiredDate = compareDate;
                }
                listAccount = mapOfDateWithEntry.get(requiredDate);*/
            }
        }
     
    }
    
    catch(Exception e)
        {  
        //ApexPages.Message myMsg = new  ApexPages.Message(ApexPages.Severity.ERROR,'Sorry...... You have entered DUPLICATE MASTER CODE' );
           // ApexPages.addMessage(myMsg); 
         
           Apexpages.addMessage(new Apexpages.message(ApexPages.Severity.Error,' NO RECORD FOUND'));
       }
       } 
   
    
    
    
   
  
}
User-added image

 
Hi Guys

I have created a class and written test class for this but i have able to code coverage 64%.i am trying to 75% but i am not getting excat .
can anyone help me for this .
public class FormCurriculumController { 
  

public Purchase_Order__c curriculum {get; set;}
public Boolean privacy {get; set;}
public Boolean saved {get; set;}
public String styleClass {get; set;}

public Transient Blob resume {get; set;}
public String contentType {get; set;}
public String fileName {get; set;}
      
    public boolean showC1RecordType {get;set;}
    public boolean showC2RecordType {get;set;} 
    
    private Id c1RecordTypeId; 
    private Id c2RecordTypeId;


//ublic FormCurriculumController () {
    //curriculum = new Purchase_Order__c();
    //saved = false;
//}

  public FormCurriculumController(ApexPages.StandardController controller) {

        c1RecordTypeId = Schema.SObjectType.Purchase_Order__c.getRecordTypeInfosByName().get('C1').getRecordTypeId();
        c2RecordTypeId = Schema.SObjectType.Purchase_Order__c.getRecordTypeInfosByName().get('C2').getRecordTypeId();
        
        curriculum= new Purchase_Order__c();
        curriculum= (Purchase_Order__c)controller.getRecord();
         
        String isButtonClicked = Apexpages.currentPage().getParameters().get('setDefaultValues');
        if(isButtonClicked == 'true'){
            setDefaultValues();
        }
        
        showC1RecordType = false;
        showC2RecordType = false;
       
        if(curriculum.RecordTypeId == c1RecordTypeId){
            showC1RecordType = true;
            showC2RecordType = false;
        }
        else if(curriculum.RecordTypeId == c2RecordTypeId){
            showC1RecordType = false;
            showC2RecordType = true;
        }
        
    }
    
     public void setDefaultValues(){
        String quoteId = Apexpages.currentPage().getParameters().get('quoteId');
        Quote__c quote = [Select o.id, o.name, o.Quantity_formula__c, o.Opportunity_Product_Detail__r.Opportunity__c,
                    o.Opportunity__c, o.Record_type_name__c,o.Company_Name__c,Opportunity_Product_Detail__r.Opportunity__r.Account__c from Quote__c o WHERE O.id=:quoteId];
        //system.assert(false,quote);     
        curriculum.Opportunity__c = quote.Opportunity_Product_Detail__r.Opportunity__c;
        curriculum.Quote__c = quote.id;
        curriculum.Company__c = quote.Opportunity_Product_Detail__r.Opportunity__r.Account__c;
        
        if(quote.Record_type_name__c == 'C1'){
            curriculum.RecordTypeId = c1RecordTypeId;
        }
        else {
            curriculum.RecordTypeId = c2RecordTypeId;
        }
    }

    


public PageReference save() {
    try {
     
        if (!privacy) {
        
            ApexPages.Message reqMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Please upload recent Purchase Order  before saving the record');
            ApexPages.addMessage(reqMsg);
            return null;
        }


        
       
        
        
        insert(curriculum);
     
        if (resume != null) {
            Attachment attach = new Attachment();
            attach.Body = resume;
            attach.Name = fileName;
            attach.ContentType= contentType;
            attach.ParentId = curriculum.id;                
            try {
                insert(attach);
                return new PageReference('/'+curriculum.id);

            } catch (Exception ex) {
               

                ApexPages.addMessages(ex);
                return null;
            }                    
        }

        update curriculum;

        saved = true;

    } 
    catch(Exception ex) {
        ApexPages.addMessages(ex);  
    }
    return null;   
}
}
 
@IsTest
public class TestFormCurriculumController  
{
static testMethod void TestMethodFormCurriculumController  ()
{

        account a=new account(name='test',Region__c='East');
        insert a;
        
        Master_Product__c mp=new Master_Product__c(name='test name',Product_Code__c='c2');
        insert mp;
        
        contact c=new contact(firstname='Meenakshmi',lastname='Goswami',Designation__c='Developer',Accountid=a.id);
        insert c;


        Opportunity2__c op=new Opportunity2__c(Name='test1',Account__c=a.id,Master_Product__c=mp.id,Technical_Bid_date__c=date.Today(),Type_of_Business__c='Regular',Contact_Person__c=c.id);
        insert op;
     
        Opportunity_Product_Detail__c opd=new Opportunity_Product_Detail__c(Opportunity__c=op.id,Company__c=a.id,Quantity__c=10,Make__c='Datalogic-Barcode Scanner', Model__c='S4M 203 Dpi');
        insert opd;
        
        Quote__c qt=new Quote__c(Opportunity_Product_Detail__c=opd.id,Basic_Price_per_1000__c=100,Basic_Price_Each_item__c=200,Purpose_of_Sales__c='SEZ',Declaration_form_be_provided__c='No');
        insert qt;
        
        Quote__c qt1=[select Quantity_formula__c from Quote__c where id=:qt.id];
        system.debug('--------Quote quantity--------'+qt1.Quantity_formula__c );
        
        RecordType rt = [Select id,name from RecordType where SobjectType='Purchase_Order__c' and Name='C1'];
        
        Purchase_Order__c sco=new Purchase_Order__c(RecordTypeId=rt.id,Quote__c=qt.id,Opportunity__c=op.id,Sale_Confirmation_Order_Date__c=date.Today());
        sco.Sale_Confirmation_Order_Number__c='100';
      
       
        insert sco;
    
         test.startTest();
         PageReference pageRef = Page.FormCurriculumController ;
         Test.setCurrentPage(pageRef);
         ApexPages.Standardcontroller sc = new ApexPages.Standardcontroller(sco);
         
         ApexPages.currentPage().getParameters().put('Id',sco.id);
         FormCurriculumController  objMyController= new FormCurriculumController  (sc);
         
         
         
         
         
         
         /*ApexPages.currentPage().getParameters().put('Id',emp.id);
            ApexPages.currentPage().getParameters().put('setDefaultValues','true');
            ApexPages.currentPage().getParameters().put('id',sco.id);
           
            ApexPages.StandardController stdLead = new ApexPages.StandardController(sco);
            NewSalesConfirmationExtension objMyController  = new NewSalesConfirmationExtension (stdLead);*/
            objMyController.save();
            
         
        test.stopTest();
        
        
        }
static testMethod void TestMethodFormCurriculumController1()
{

 account a=new account(name='test',Region__c='East');
        insert a;
        
        Master_Product__c mp=new Master_Product__c(name='test name',Product_Code__c='c2');
        insert mp;
        
        contact c=new contact(firstname='Meenakshmi',lastname='Goswami',Designation__c='Developer',Accountid=a.id);
        insert c;


        Opportunity2__c op=new Opportunity2__c(Name='test1',Account__c=a.id,Master_Product__c=mp.id,Technical_Bid_date__c=date.Today(),Type_of_Business__c='Regular',Contact_Person__c=c.id);
        insert op;
     
        Opportunity_Product_Detail__c opd=new Opportunity_Product_Detail__c(Opportunity__c=op.id,Company__c=a.id,Quantity__c=10,Make__c='Datalogic-Barcode Scanner', Model__c='S4M 203 Dpi');
        insert opd;
        
        RecordType quoteRt = [Select id,name from RecordType where SobjectType='Quote__c' and Name='C2'];
        
        Quote__c qt=new Quote__c(RecordTypeId=quoteRt.id,Opportunity_Product_Detail__c=opd.id,Basic_Price_per_1000__c=100,Basic_Price_Each_item__c=200,Purpose_of_Sales__c='SEZ',Declaration_form_be_provided__c='No');
        insert qt;
        
        Quote__c qt1=[select Quantity_formula__c from Quote__c where id=:qt.id];
        system.debug('--------Quote quantity--------'+qt1.Quantity_formula__c );
        
        RecordType rt = [Select id,name from RecordType where SobjectType='Purchase_Order__c' and Name='C2'];
        
        Purchase_Order__c sco=new Purchase_Order__c(RecordTypeId=rt.id,Quote__c=qt.id,Opportunity__c=op.id,Sale_Confirmation_Order_Date__c=date.Today());
        sco.Sale_Confirmation_Order_Number__c='100';
        insert sco;
        
         test.startTest();
            //ApexPages.currentPage().getParameters().put('id',sco.id);
            ApexPages.currentPage().getParameters().put('setDefaultValues','true');
            ApexPages.currentPage().getParameters().put('quoteId',qt.id);
            ApexPages.StandardController stdLead = new ApexPages.StandardController(sco);
            FormCurriculumController  objMyController  = new FormCurriculumController (stdLead);
            objMyController.fileName='Test Class';
           
            objMyController.contentType='XYZ';
           
            objMyController.resume=Blob.valueOf('Unit Test Attachment Body');
            
            objMyController.save();
            
            
            
         
        
        test.stopTest();
        
        }
        
        
}


 
Hi Guys

I have created a Vf page which like a custom report.but here my problem is i am not unable to grouping the record .see my  screenshot now i am getting this User-added image
 
public with sharing class PartyMaster {



    public List<MasterTest__c> accounts {get;set;}  
    public String[] Groups {get;set;}

    public MasterTest__c j { get; set; }
    
    public String Id { get; set; }
    public List<MasterTest__c> jb { get; set; }
    public String keyword { get; set; }
   
   //Dc 
    public PartyMaster (){
     jb=new List<MasterTest__c>();
    j=new MasterTest__c();
}

    public PageReference getid() {
    jb=[select ID, Name,Group__c,Master_Code__c,Date__c From MasterTest__c where Name=:id ];
        return null;
    }

     public PageReference getKey_search() {
 jb=[select ID, Name,Group__c,Master_Code__c,Date__c From MasterTest__c where Name=:id ];
        
        return null;
    }

//we need to assign some temp var,for data type
       public date startdate1;
       public date enddate1;
public PageReference go() {
    startdate1=j.Date__c;
    enddate1=j.Date__c;
    
    jb=[select  ID, Name,Group__c,Master_Code__c,Date__c From MasterTest__c where (Date__c>=:startdate1) AND (Date__c<=:enddate1)order by Date__c ASC];
    
        return null;
    }
    

}
}

--------------------------------------------------------------------------------------

<apex:page controller="PartyMaster" sidebar="false" showHeader="false"><style type="text/css" media="print">
@media print
{
#non-printable { display: none; }
#printable {
display: block;
width: 100%;
height: 100%;
}
}
</style>

<style type = "text/css">
        .colHeadr {text-align:center;}
        .colHeadrRight{
            text-align:right;
        }
        }
    </style>


 <apex:form id="dt">
  <apex:define name="body">
            <div style="width:1250px;margin: 0px auto 10px auto;background-color:Gray;border: 1px solid black;">
            <apex:image id="theImage" value="{!$Resource.Emami}" width="100" height="100"/>
            <apex:outputLink style="font-weight: bold;float:right;" value="{!URLFOR($Page.LoginPage)}"><b>Back To Home</b>
            </apex:outputLink>
  <apex:pageBlock title="BankBook Details To Search">
  
        
     <!---search By Date Range-->
    <b>Start Date</b><apex:inputField value="{!j.Date__c}"/>&nbsp;&nbsp;&nbsp;
     <b>End Date</b><apex:inputField value="{!j.Date__c}"/>
     <apex:commandButton value="Go" action="{!go}" reRender="dt" style="background:pink"/>
      <b><apex:commandLink id="printable"  onclick="JavaScript:window.print();" value="Print"/></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     <!---search By word-->
      <apex:inputText value="{!keyword}"/>
      <apex:commandButton value="Search By Group" action="{!getKey_search}" style="background:pink"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     
     
      <!---search By Id-->
      <apex:inputtext value="{!Id}"/>
      <apex:commandButton value="Search By Party" action="{!getid}" style="background:pink"/>
     
     <!---which fiels we want to display -->
   <apex:pageBlockSection columns="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
   <apex:pageBlockTable var="jj" value="{!jb}" style="width:100%; font-size:10pt">
   <apex:column headerValue="Date" value="{!jj.Date__c}"/>
    <apex:column headerValue="Group" value="{!jj.Group__c}"/>
    
      <apex:column headerValue="Party Name" value="{!jj.Master_Code__c}"/>
      


     
   
    </apex:pageBlockTable>
   </apex:pageBlockSection>
  </apex:pageBlock>
 
  </div>
        </apex:define>
        <center><br/>
        <b><i style="font-size:10px;color:red;">Developed By GlobalNest IT Solution Pvt.Ltd. <a href="http://www.globalnest.com" target="_blank">[http://www.Globalnest.com]</a> </i></b>
    </center><br/>
    </apex:form>
</apex:page>
but i need this type of grouping  .,....

User-added image
 
Hi All

Account object having more than 4k record from 2010 to till.i want the lastmodified date which created date not equal in 1/4/2015 to 31/3/2016.

one record which created date is 23/4/2010 and modified date is 28/4/2016 .how to find this record


Thanks
 
<apex:page standardController="Bill__c" showHeader="false" sidebar="false" standardStylesheets="false" renderAs="pdf">
 <head>
     <style type="text/css">

        @page {

                 size:A4;

                 margin: 10mm;

              }

   </style>

 </head> 
 <body>
    <table cellspacing="0" cellpadding="0" border="0" width="100%">
       <tr>

                    <td>

                        <table cellspacing="5" border="0" width="100%" cellpadding="2">
                            <tr>

                                <td valign="top" width="30%">

                                    <!--<apex:image url="{!$Resource.Synthesis_New_Logo}" height="75" width="350"/>-->
                                    <div>
                                    </div>
                                
                                </td>
                                <td valign="right" align="right">
                                    <table>
                                      <tr><td>
                                      
                                      
                                      </td></tr>
                                    </table>
                                </td>

                            </tr>

                        </table>

                    </td>

                </tr>
                <tr>

                    <td>

                        <table border="0" cellspacing="0" width="100%" align="middle">

                            <tr>

                                <td align="center" style=" font: 22px; font-family: Calibri;">
                                   <!-- <b> ISO 9001 : 2008 Cerified  </b>   -->
                                   
                                 </td>

                           </tr>

                        </table>

                    </td>

                </tr>          
               <tr>
                  <td>
                   <table border="0" cellspacing="0" width="100%">
                       <tr>
                           <td valign="top" width="70%">
        
                                 <div  style=" font: 16px; font-family: Arial;">
                                    <br/><br/><br/>To,<br/>
                                        <b> {!Bill__c.Transaction__r.Borrowing_Party__r.Name}</b><br/>
                                        {!Bill__c.Transaction__r.Borrowing_Party__r.billingStreet}<br/>
                                        {!Bill__c.Transaction__r.Borrowing_Party__r.BillingCity} - {!Bill__c.Transaction__r.Borrowing_Party__r.BillingPostalCode}<br/>

                                        {!Bill__c.Transaction__r.Borrowing_Party__r.BillingState}<br/>

                                        {!Bill__c.Transaction__r.Borrowing_Party__r.BillingCountry}<br/>
                                     
                                 </div>
        
                           </td>
                           <td valign="right" align="right"  style=" font: 16px; font-family: Arial;">
        
                                 <apex:outputText value="Date: {0,date,dd/MM/yyyy}">
        
                                     <apex:param value="{!Bill__c.Bill_Date_formula__c}"/>
        
                                 </apex:outputText><br/>
                                 {!Bill__c.Brokerage_Bill_No__c}
                           </td>
                       </tr>
                   </table>
                  </td>
               </tr>
             <!-- <tr>
                  <td> <br/></td>
                  <td> <br/></td>
               </tr>   --> 
               <tr>
                   <td>
                       <table border="0" cellspacing="0" width="100%">
                          <tr>
                              <td valign="middle" align="center"  style=" font: 14px; font-family: Times New Roman;">
                               <b><h2><i><u>BILL</u></i></h2></b><br/>
                              </td>
                          </tr>
                          <tr>
                                <td align="left"  style=" font: 16px; font-family: Times New Roman;">
                                   <b> <u>Being the amount of Brokerage on arranging Loan as per details given below</u> : </b>
                                </td><br/>
                          </tr>
                       </table>
                   </td>
               </tr>
                
               <tr>
                   <td>
                       <table border="0" cellspacing="0" width="100%">
                            <tr>
                                 <td valign="left" align="center" width="45%">
                                   <u> Name of the Lender</u>
                                 </td>
                                 <td valign="left" align="center" width="15%">
                                   <u> Amount</u>
                                 </td>
                                 <td valign="left" align="center" width="10%">
                                    <u>Days</u>
                                 </td> 
                                 <td valign="right" align="center" width="10%">
                                   <u> Rate</u>
                                 </td>
                                 <td valign="right" align="right" width="20%">
                                   <u>Brokerage(Rs.)</u>
                                 </td>    
                            </tr>
                           
                            <tr>
                                <td>
                                </td>
                              </tr>
                           <tr width="100%">
                                 <td valign="left" align="center" width="45%">
                                   <b> {!Bill__c.Transaction__r.Lending_Party__r.Name} <br/></b>
                                   ( From &nbsp;
                                         <apex:outputText value="{0,date,dd/MM/yyyy}">
                                           <apex:param value="{!Bill__c.Transaction__r.Due_Date_of_Repayment__c}" />
                                       </apex:outputText>
                                       
                                 to &nbsp;  <apex:outputText value="{0,date,dd/MM/yyyy}">
                                             <apex:param value="{!Bill__c.Transaction__r.Defaulter_s_Repayment_date_formula__c}"/>
                                         </apex:outputText> )
                                 </td>
                                  
                                 <td align="center" width="15%">
                                    <apex:outputText value="{0, number, ###,###}">
                                           <apex:param value="{!Bill__c.Transaction__r.Loan_Amount__c}"/>
                                      </apex:outputText>/-
                                 </td>
                                 <td valign="center" align="center" width="10%">
                                     <apex:outputText value="{0, number, ###,###}">
                                           <apex:param value="{!Bill__c.Transaction__r.Principal_Repayment_Delay__c}"/>
                                      </apex:outputText>
                                 </td>
                                 <td valign="right" align="center" width="10%">
                                 <apex:outputText value="{0, number, ###,###.00}">
                                           <apex:param value="{!Bill__c.Transaction__r.Supplementary_Brokerage_Rate__c}"/>
                                      </apex:outputText>%
                                 </td>
                                 <td valign="right" align="right" width="20%">
                                    <apex:outputText value="{0, number, ###,###}">
                                           <apex:param value="{!Bill__c.Transaction__r.Supplementary_Brokerage_Amount__c}"/>
                                      </apex:outputText>/-
                                 </td>
                            </tr>
                                <tr>
                                 <td valign="left" width="45%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="15%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td>
                                 <td valign="right" align="right" width="20%">
                                    <br/>
                                 </td>
                            </tr>
                        
                            <tr>
                             <td >
                       <apex:outputPanel rendered="{!IF(Bill__c.Transaction__r.ST_Amt_on_Supplementary_Brokerage__c==0,false,true)}"> 
                       <colgroup width="300"> <tr>           
                <td>&nbsp;&nbsp;&nbsp;&nbsp; Add: Service Tax @ {!Bill__c.Transaction__r.ST_on_Supplementary_Brokerage__c}% </td><td valign="left" align="left" width="15%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td> <td valign="right" align="right" width="20%">
                
                <apex:outputText value="{0, number, ###,###}">
                                           <apex:param value="{!Bill__c.Transaction__r.ST_Amt_on_Supplementary_Brokerage__c}"/>
                                      </apex:outputText>/-</td></tr></colgroup>
                                       </apex:outputPanel>
                                    
                                 </td>
                            </tr>
                            
                            
            <tr>
                             <td >
                       <apex:outputPanel rendered="{!IF(Bill__c.Transaction__r.Swach_Bharat_Cess__c==null,false,true)}"> 
                       <tr>           
                <td>&nbsp;&nbsp;&nbsp;&nbsp; Swachh Bharat Cess @ {!Bill__c.Transaction__r.Swach_Bharat_Cess__c}% </td><td valign="left" align="left" width="15%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td> <td valign="right" align="right" width="20%">
                
                <apex:outputText value="{0, number, ###,###}">
                                           <apex:param value="{!Bill__c.Transaction__r.Swach_Bharat_Cess_Amt_Sup_Brok__c}"/>
                                      </apex:outputText>/-</td></tr>
                                       </apex:outputPanel>
                                    
                                 </td>
                            </tr>
                            
                            <tr>
                             <td >
                       <apex:outputPanel rendered="{!IF(Bill__c.Transaction__r.Krishi_Kalyan_Cess__c==null,false,true)}"> 
                       <colgroup width="300"> <tr>           
                <td>&nbsp; &nbsp; Krishi Kalyan Cess @ {!Bill__c.Transaction__r.Krishi_Kalyan_Cess__c}% </td><td valign="left" align="left" width="15%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td> <td valign="right" align="right" width="20%">
                
                <apex:outputText value="{0, number, ###,###}">
                                           <apex:param value="{!Bill__c.Transaction__r.Krishi_Kalyan_Cess_Amt_Sup_Brok__c}"/>
                                      </apex:outputText>/-</td></tr></colgroup>
                                       </apex:outputPanel>
                                    
                                 </td>
                            </tr>
                         
                            
                            
                            <tr>
                             <td >
                       <apex:outputPanel rendered="{!IF(Bill__c.Transaction__r.Supp_Education_Cess_INR__c==0,false,true)}"> 
                       <colgroup width="300"> <tr>           
                <td>&nbsp;&nbsp;&nbsp;&nbsp; EC @2% of ST </td><td valign="left" align="left" width="15%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td> <td valign="right" align="right" width="20%">
                
                <apex:outputText value="{0, number, ###,###}">
                                           <apex:param value="{!Bill__c.Transaction__r.Supp_Education_Cess_INR__c}"/>
                                      </apex:outputText>/-</td></tr></colgroup>
                                       </apex:outputPanel>
                                    
                                 </td>
                            </tr>
                            
                            
                            <tr>
                             <td >
                       <apex:outputPanel rendered="{!IF(Bill__c.Transaction__r.Secondary_Supplementary_Educ_Cess_INR__c==0,false,true)}"> 
                       <colgroup width="300"> <tr>           
                <td>&nbsp;&nbsp;&nbsp;&nbsp; HEC @1% of ST </td><td valign="left" align="left" width="15%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td> <td valign="right" align="right" width="20%">
                
                <apex:outputText value="{0, number, ###,###}">
                                           <apex:param value="{!Bill__c.Transaction__r.Secondary_Supplementary_Educ_Cess_INR__c}"/>
                                      </apex:outputText>/-</td></tr></colgroup>
                                       </apex:outputPanel>
                                    
                                 </td>
                            </tr>
               
                            <tr>
                                <td>
                                    <br/>
                                </td>
                            </tr>
                            <tr>
                                 <td valign="left" width="45%">
                                   <br/>
                                 </td>
                                 <td valign="left" align="left" width="15%">
                                    <br/>    
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td>
                                 <td valign="right" align="right" width="20%">
                                    <table border="0" cellspacing="0" align="right" width="50%">
                                         <tr>
                                             <td colspan="2"><hr/>
                                               <apex:outputText value="{0, number, ###,###}">
                                           <apex:param value="{!Bill__c.Transaction__r.Sup_gross_Bro__c}"/>
                                      </apex:outputText>/-
                                             </td>
                                         </tr>
                                    </table>
                                    
                                 </td>
                            </tr>
                            <tr>
                                <td>
                                <br/>
                                <br/>
                                </td>
                              </tr>
                              <tr>
                            <td >
                       <apex:outputPanel rendered="{!IF(Bill__c.Transaction__r.TDS_Amt_on_Supplementary_Brokerage__c==0,false,true)}"> 
                       <colgroup width="300"> <tr>           
                <td>&nbsp;&nbsp;&nbsp;&nbsp; Less: TDS @ {!Bill__c.Transaction__r.TDS_on_Supplementary_Brokerage_Amt__c} % </td><td valign="left" align="left" width="15%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td> <td valign="right" align="right" width="20%">
                
                <apex:outputText value="{0, number, ###,###}">
                                           <apex:param value="{!Bill__c.Transaction__r.TDS_Amt_on_Supplementary_Brokerage__c}"/>
                                      </apex:outputText>/-</td></tr></colgroup>
                                       </apex:outputPanel>
                                      
                                      
                                 </td>
                            </tr>
                            <tr>
                                <td>
                                <br/>
                                </td>
                            </tr>
              </table>
              <table>
                            <tr>
                                 <td valign="left" width="70%">
                                   <i>( Rupees {!Bill__c.Transaction__r.Net_Supplementary_Brokerage_in_words__c} only )  </i>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td>
                                 <td valign="left" align="left" width="10%">
                                    <br/>
                                 </td>
                                 <td valign="right" align="right" width="30%">
                                     <table border="0" cellspacing="0" width="100%">
                                         <tr>
                                             <td colspan="2"><hr/>
                                             </td>
                                         </tr>
                                    </table>
                                   <b>    <apex:outputText value="{0, number, ###,###}">
                                           <apex:param value="{!Bill__c.Transaction__r.Net_Suppl_Brokerage__c}"/>
                                      </apex:outputText>/-  </b>
                                   <table border="0" cellspacing="0" width="100%">
                                         <tr>
                                             <td colspan="2"><hr/>
                                             </td>
                                         </tr>
                                    </table>
                                 </td>
                            </tr>   
                        </table>
                    </td>
                </tr>
                </table>
                <br/>
               
     </body>
</apex:page>

 
Hi Guys
I have facing a isssue from a long time that i have a percentage field which default value is 10% currently.i need to change that default value 5% from 10% on or later 01/06/2016 created


Thanks in adv
Hi All

I have 2 object Oppertunity and OppertunityCustom__C and 3 profile (like Admin,profile1 and profile2)

Both object have relationship.
Oppertunitycustom have 4 record type (like R1,R2,R3,R4).

My requirment is profile1 can see profile2 record of record type R1 and R4 only not all in Oppertuntycustom__c.How to achieve this job
Hi all

I have created a custom report using visual force page.but i want to grouping this report uisng vf page.can anyone help me on this job ?
<apex:page docType="html-5.0" standardController="MasterTest__c"  extensions="PartyCodeReport"  showHeader="false" sidebar="false">
<center><h1 style="text-align:center;color:blue;">  This is Party/masterCode Report! </h1></center>
<apex:pageMessages ></apex:pageMessages>
<style type="text/css" media="print">
@media print
{
#non-printable { display: none; }
#printable {
display: block;
width: 100%;
height: 100%;
}
}
</style>

<style type = "text/css">
        .colHeadr {text-align:center;}
        .colHeadrRight{
            text-align:right;
        }
        }
    </style>


       <apex:define name="body">
            
            <div style="width:800px;margin: 0px auto 10px auto;border: 1px solid black;">
    <apex:form id="tableId">
        <apex:pageBlock >
            
                    <b><apex:outputLabel value="Party/MasterCode Report Report On: "  style="font-weight: bold;color:Black;"/></b>
                     <apex:inputField value="{!account.Date__c}" style="font-weight: bold;color:red;" required="false"/>
                     
                     
                   <!--- Trial Balance Report On: <apex:input type="date" value="{!dat}"/>-->
                 
                 <apex:commandButton value="Display" action="{!displaingTable}" reRender="tableId" style="font-weight: bold;color:Black;" oncomplete="window.opener.location.refresh();" />
        <b><apex:commandLink id="printable"  onclick="JavaScript:window.print();" value="Print"/></b> <br/><br/><br/>
                
                 
               
                 
                 <apex:outputPanel rendered="{!If(account.Date__c== null,true,false)}">
                 <apex:outputLabel style="font-weight: bold;color:blue;font-size:15px;padding-left:1%" > Please enter date to fetch accurate results. </apex:outputLabel>
                 </apex:outputPanel>
                 
  </apex:pageBlock>



 <table border="1" cellpadding="1" cellspacing="0" style="width:100%;border:1px solid #000000;font-familyans-serif;font-size:20px">
                    <tr style="font-family:verdana;color:Black;font-size:12px;height=18px;width:100%" >
                    
                        <td  style="background-color: #DAFFFF" ><b><apex:outputText value="Master Code"/></b> </td>
                        <td  style="background-color: #DAFFFF" ><b><apex:outputText value="Master Name"/></b> </td>
                         <td  style="background-color: #DAFFFF" ><b><apex:outputText value="Group"/></b> </td>
                        <!---<td  style="background-color: #DAFFFF" ><b><apex:outputText value="Debit Bal."/></b></td>
                        <td  style="background-color: #DAFFFF" ><b><apex:outputText value="Credit Bal."/></b></td>
                        <td  style="background-color: #DAFFFF" ><b><apex:outputText value="Account Type"/></b></td>-->
                    </tr>
                    
                    
                    
                      <apex:repeat value="{!listAccount}" var="c" id="InvRepeat">
                        <tr border="1" style="font-family:verdana;color:Black;font-size:12px;width:100%" >
                            <!---<td ><apex:outputText value="{!c.Txn_Date__c}"/></td>--->
                            
                            
                           
                         
                            <td><apex:outputText value="{!c.Name}"/></td>
                            <td><apex:outputText value=" {!c.Master_Code__c}"/></td>
                            <td><apex:outputText value=" {!c.Group__c}"/></td>
                            
                            
                          
                            </tr>
                    </apex:repeat>
                    
                     
       
         
                      
                    
                    
                    </table>
                    </apex:form>
                      </div>
        </apex:define>


</apex:page>
public with sharing class PartyCodeReport {
    public MasterTest__c account{get;set;}
    public List<MasterTest__c> listAccount {get;set;}
   
   
    public Date dat {get;set;}
    
    public Map<Date,List<MasterTest__c>> mapOfDateWithEntry;

    public PartyCodeReport(ApexPages.StandardController controller){
    
        account = new MasterTest__c();
      
    }
     
   public void setValues(){
        listAccount  = new List<MasterTest__c>([SELECT id,Name,Group__c,Master_Code__c, Date__c
                        FROM MasterTest__c
                        order by Group__c ASC ]);
        mapOfDateWithEntry = new Map<Date,List<MasterTest__c>>();
        List<MasterTest__c> listOfEntryData;
        for(MasterTest__c entry : listAccount){
            if(entry.Date__c != null){
                if(mapOfDateWithEntry.containsKey(entry.Date__c)){
                    mapOfDateWithEntry.get(entry.Date__c).add(entry);
                }
                else{
                    listOfEntryData = new List<MasterTest__c>();
                    listOfEntryData.add(entry);
                    mapOfDateWithEntry.put(entry.Date__c,listOfEntryData);
                }
            }
        }
       
   }
   public void displaingTable(){
   
   
   try{
   
        setValues();
        
        
        
 
        if(account.Date__c!= null){
           
            system.debug('Map '+mapOfDateWithEntry);
            Set<Date> allDateSet = mapOfDateWithEntry.keySet();
            if(allDateSet.contains(account.Date__c)){
                listAccount = mapOfDateWithEntry.get(account.Date__c);
            }
            else {
                List<Date> sortedDateList = new List<Date>();
                sortedDateList.addAll(allDateSet);
                sortedDateList.sort();
                
                Boolean isAnyPastDate = false;
                Date requiredDate;
                for(Date recordDate : sortedDateList){
                    if(account.Date__c > recordDate){
                        requiredDate = recordDate;
                        isAnyPastDate = true;
                    }
                    else{
                        break;
                    }
                }
                if(isAnyPastDate){
                    listAccount = mapOfDateWithEntry.get(requiredDate);
                }
                else{
                    listAccount = new List<MasterTest__c>();
                }
                /*Date compareDate ;
                Integer count = 0;
                for(Date firstKeydate : allDateSet){
                    compareDate = firstKeydate;
                    break;
                }
                system.debug('Before Compare Date'+compareDate);
                for(Date keyDate : allDateSet){
                    if(keydate < account.DateUpdate__c && keydate > compareDate){
                        compareDate = keyDate;
                    }
                    if(account.DateUpdate__c < keyDate){
                        count ++ ;
                    }
                }
                system.debug('After Compare Date'+compareDate);
                Date requiredDate ;
                
                if(allDateSet.size() == count){
                    requiredDate = [Select DateUpdate__c from MasterCopy__c Order by DateUpdate__c Desc LIMIT 1][0].DateUpdate__c;
                }
                else {
                    requiredDate = compareDate;
                }
                listAccount = mapOfDateWithEntry.get(requiredDate);*/
            }
        }
     
    }
    
    catch(Exception e)
        {  
        //ApexPages.Message myMsg = new  ApexPages.Message(ApexPages.Severity.ERROR,'Sorry...... You have entered DUPLICATE MASTER CODE' );
           // ApexPages.addMessage(myMsg); 
         
           Apexpages.addMessage(new Apexpages.message(ApexPages.Severity.Error,' NO RECORD FOUND'));
       }
       } 
   
    
    
    
   
  
}
User-added image

 
Hi Guys

I have created a class and written test class for this but i have able to code coverage 64%.i am trying to 75% but i am not getting excat .
can anyone help me for this .
public class FormCurriculumController { 
  

public Purchase_Order__c curriculum {get; set;}
public Boolean privacy {get; set;}
public Boolean saved {get; set;}
public String styleClass {get; set;}

public Transient Blob resume {get; set;}
public String contentType {get; set;}
public String fileName {get; set;}
      
    public boolean showC1RecordType {get;set;}
    public boolean showC2RecordType {get;set;} 
    
    private Id c1RecordTypeId; 
    private Id c2RecordTypeId;


//ublic FormCurriculumController () {
    //curriculum = new Purchase_Order__c();
    //saved = false;
//}

  public FormCurriculumController(ApexPages.StandardController controller) {

        c1RecordTypeId = Schema.SObjectType.Purchase_Order__c.getRecordTypeInfosByName().get('C1').getRecordTypeId();
        c2RecordTypeId = Schema.SObjectType.Purchase_Order__c.getRecordTypeInfosByName().get('C2').getRecordTypeId();
        
        curriculum= new Purchase_Order__c();
        curriculum= (Purchase_Order__c)controller.getRecord();
         
        String isButtonClicked = Apexpages.currentPage().getParameters().get('setDefaultValues');
        if(isButtonClicked == 'true'){
            setDefaultValues();
        }
        
        showC1RecordType = false;
        showC2RecordType = false;
       
        if(curriculum.RecordTypeId == c1RecordTypeId){
            showC1RecordType = true;
            showC2RecordType = false;
        }
        else if(curriculum.RecordTypeId == c2RecordTypeId){
            showC1RecordType = false;
            showC2RecordType = true;
        }
        
    }
    
     public void setDefaultValues(){
        String quoteId = Apexpages.currentPage().getParameters().get('quoteId');
        Quote__c quote = [Select o.id, o.name, o.Quantity_formula__c, o.Opportunity_Product_Detail__r.Opportunity__c,
                    o.Opportunity__c, o.Record_type_name__c,o.Company_Name__c,Opportunity_Product_Detail__r.Opportunity__r.Account__c from Quote__c o WHERE O.id=:quoteId];
        //system.assert(false,quote);     
        curriculum.Opportunity__c = quote.Opportunity_Product_Detail__r.Opportunity__c;
        curriculum.Quote__c = quote.id;
        curriculum.Company__c = quote.Opportunity_Product_Detail__r.Opportunity__r.Account__c;
        
        if(quote.Record_type_name__c == 'C1'){
            curriculum.RecordTypeId = c1RecordTypeId;
        }
        else {
            curriculum.RecordTypeId = c2RecordTypeId;
        }
    }

    


public PageReference save() {
    try {
     
        if (!privacy) {
        
            ApexPages.Message reqMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'Please upload recent Purchase Order  before saving the record');
            ApexPages.addMessage(reqMsg);
            return null;
        }


        
       
        
        
        insert(curriculum);
     
        if (resume != null) {
            Attachment attach = new Attachment();
            attach.Body = resume;
            attach.Name = fileName;
            attach.ContentType= contentType;
            attach.ParentId = curriculum.id;                
            try {
                insert(attach);
                return new PageReference('/'+curriculum.id);

            } catch (Exception ex) {
               

                ApexPages.addMessages(ex);
                return null;
            }                    
        }

        update curriculum;

        saved = true;

    } 
    catch(Exception ex) {
        ApexPages.addMessages(ex);  
    }
    return null;   
}
}
 
@IsTest
public class TestFormCurriculumController  
{
static testMethod void TestMethodFormCurriculumController  ()
{

        account a=new account(name='test',Region__c='East');
        insert a;
        
        Master_Product__c mp=new Master_Product__c(name='test name',Product_Code__c='c2');
        insert mp;
        
        contact c=new contact(firstname='Meenakshmi',lastname='Goswami',Designation__c='Developer',Accountid=a.id);
        insert c;


        Opportunity2__c op=new Opportunity2__c(Name='test1',Account__c=a.id,Master_Product__c=mp.id,Technical_Bid_date__c=date.Today(),Type_of_Business__c='Regular',Contact_Person__c=c.id);
        insert op;
     
        Opportunity_Product_Detail__c opd=new Opportunity_Product_Detail__c(Opportunity__c=op.id,Company__c=a.id,Quantity__c=10,Make__c='Datalogic-Barcode Scanner', Model__c='S4M 203 Dpi');
        insert opd;
        
        Quote__c qt=new Quote__c(Opportunity_Product_Detail__c=opd.id,Basic_Price_per_1000__c=100,Basic_Price_Each_item__c=200,Purpose_of_Sales__c='SEZ',Declaration_form_be_provided__c='No');
        insert qt;
        
        Quote__c qt1=[select Quantity_formula__c from Quote__c where id=:qt.id];
        system.debug('--------Quote quantity--------'+qt1.Quantity_formula__c );
        
        RecordType rt = [Select id,name from RecordType where SobjectType='Purchase_Order__c' and Name='C1'];
        
        Purchase_Order__c sco=new Purchase_Order__c(RecordTypeId=rt.id,Quote__c=qt.id,Opportunity__c=op.id,Sale_Confirmation_Order_Date__c=date.Today());
        sco.Sale_Confirmation_Order_Number__c='100';
      
       
        insert sco;
    
         test.startTest();
         PageReference pageRef = Page.FormCurriculumController ;
         Test.setCurrentPage(pageRef);
         ApexPages.Standardcontroller sc = new ApexPages.Standardcontroller(sco);
         
         ApexPages.currentPage().getParameters().put('Id',sco.id);
         FormCurriculumController  objMyController= new FormCurriculumController  (sc);
         
         
         
         
         
         
         /*ApexPages.currentPage().getParameters().put('Id',emp.id);
            ApexPages.currentPage().getParameters().put('setDefaultValues','true');
            ApexPages.currentPage().getParameters().put('id',sco.id);
           
            ApexPages.StandardController stdLead = new ApexPages.StandardController(sco);
            NewSalesConfirmationExtension objMyController  = new NewSalesConfirmationExtension (stdLead);*/
            objMyController.save();
            
         
        test.stopTest();
        
        
        }
static testMethod void TestMethodFormCurriculumController1()
{

 account a=new account(name='test',Region__c='East');
        insert a;
        
        Master_Product__c mp=new Master_Product__c(name='test name',Product_Code__c='c2');
        insert mp;
        
        contact c=new contact(firstname='Meenakshmi',lastname='Goswami',Designation__c='Developer',Accountid=a.id);
        insert c;


        Opportunity2__c op=new Opportunity2__c(Name='test1',Account__c=a.id,Master_Product__c=mp.id,Technical_Bid_date__c=date.Today(),Type_of_Business__c='Regular',Contact_Person__c=c.id);
        insert op;
     
        Opportunity_Product_Detail__c opd=new Opportunity_Product_Detail__c(Opportunity__c=op.id,Company__c=a.id,Quantity__c=10,Make__c='Datalogic-Barcode Scanner', Model__c='S4M 203 Dpi');
        insert opd;
        
        RecordType quoteRt = [Select id,name from RecordType where SobjectType='Quote__c' and Name='C2'];
        
        Quote__c qt=new Quote__c(RecordTypeId=quoteRt.id,Opportunity_Product_Detail__c=opd.id,Basic_Price_per_1000__c=100,Basic_Price_Each_item__c=200,Purpose_of_Sales__c='SEZ',Declaration_form_be_provided__c='No');
        insert qt;
        
        Quote__c qt1=[select Quantity_formula__c from Quote__c where id=:qt.id];
        system.debug('--------Quote quantity--------'+qt1.Quantity_formula__c );
        
        RecordType rt = [Select id,name from RecordType where SobjectType='Purchase_Order__c' and Name='C2'];
        
        Purchase_Order__c sco=new Purchase_Order__c(RecordTypeId=rt.id,Quote__c=qt.id,Opportunity__c=op.id,Sale_Confirmation_Order_Date__c=date.Today());
        sco.Sale_Confirmation_Order_Number__c='100';
        insert sco;
        
         test.startTest();
            //ApexPages.currentPage().getParameters().put('id',sco.id);
            ApexPages.currentPage().getParameters().put('setDefaultValues','true');
            ApexPages.currentPage().getParameters().put('quoteId',qt.id);
            ApexPages.StandardController stdLead = new ApexPages.StandardController(sco);
            FormCurriculumController  objMyController  = new FormCurriculumController (stdLead);
            objMyController.fileName='Test Class';
           
            objMyController.contentType='XYZ';
           
            objMyController.resume=Blob.valueOf('Unit Test Attachment Body');
            
            objMyController.save();
            
            
            
         
        
        test.stopTest();
        
        }
        
        
}