• SFDC Dummy
  • NEWBIE
  • 139 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 182
    Questions
  • 174
    Replies
Hi All

How to update picklist value af all record on every 31st march of the year using trigger
Hi

I have created a command Line Dataloader for Upserting record in schedular basic...Its working Propely in schedular basic,but problem is in my .csv file the Date value is 29/10/2015.after upserting using CMD in salesforce org the Date is 9/5/2017,means Date not taking right value..is there any setting or soluton for this....

Thanks in advancs
Hi

I have created a VF page for which i am tracking the record on particular date.Now i am selecting the date and click on display button then it is displaying all record related to particularr date.if i am clicking display button without selecting any date then it will be diplay a error message 

"Plz select the Date"..How its Possible...
 
<apex:page docType="html-5.0" standardController="MasterCopy__c"  extensions="dateInPBTbaleControllernewOk"  showHeader="false" sidebar="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:define name="body">
            
            <div style="width:1000px;margin: 0px auto 10px auto;border: 1px solid black;">
    <apex:form id="tableId">
        <apex:pageBlock >
            
                    <b><apex:outputLabel value="Trial Balance Report On: "  style="font-weight: bold;color:red;"/></b>
                     <apex:inputField value="{!account.DateUpdate__c}" style="font-weight: bold;color:red;"/>
                     
                     
                   <!--- Trial Balance Report On: <apex:input type="date" value="{!dat}"/>-->
                 
                 <apex:commandButton value="Display" action="{!displaingTable}" reRender="tableId" style="font-weight: bold;color:red;" oncomplete="window.opener.location.refresh();" />
        <b><apex:commandLink id="printable"  onclick="JavaScript:window.print();" value="Print"/></b> <br/><br/><br/>
                 <apex:actionFunction name="showMessage" action="{!showMessage}" rerender="jserror"/>
                 
                 <apex:outputPanel rendered="{!If(totalRevenue != totalRevenue1,true,false)}">
                 <apex:outputLabel style="font-weight: bold;color:red;font-size:15px;padding-left:49%"> Debit and Credit Balances do not match. </apex:outputLabel>
                 </apex:outputPanel>
                 
                 <apex:pageblockTable value="{!listAccount }" var="record"  >
                <apex:pageMessages id="jserror" ></apex:pageMessages>
                    <apex:column value="{!record.Master_Name__c}" headerValue="Master Code" headerClass="colHeadr" style="font-weight: bold;font-size:12px;height=18px;text-align:center;"/>
                    <apex:column value="{!record.Master_Code__c}" headerValue="Master Name" headerClass="colHeadr" style="text-align:center;"/>
                    
                    <apex:column value="{!record.Debit_Balance__c}" headerValue="Debit(+)" style="color:green;" headerClass="colHeadrRight" dir="RTL">
                     <apex:facet name="footer" >
        
                   <!---- <apex:outputText value=" Rs.{!totalRevenue}<br/> Rs.{!totalRevenuee}<br/>-----------------<br/> Rs.{!totalRevenuee1}" style="font-weight: bold;color:green;font-size:12px;height=18px;" escape="false">
                      
                       
                    </apex:outputText>-->
                    <apex:outputText value="Rs.{0, number, ###,###,###,##0.00}"  style="font-weight: bold;color:green;font-size:12px;height=18px;float:right;"  >
                        <apex:param value="{!totalRevenue}"  />
                    </apex:outputText> 
                </apex:facet>
            </apex:column>
                    <apex:column value="{!record.Credit_Balance__c}" headerValue="Credit(-)" style="color:red;"  headerClass="colHeadrRight" dir="RTL">
                    <apex:facet name="footer" >
                   
                        
                   <apex:outputText value="Rs.{0, number, ###,###,###,##0.00}"  style="font-weight: bold;color:red;font-size:12px;height=18px;float:right;"  >
                        <apex:param value="{!totalRevenue1}"  />
                    </apex:outputText> 
                </apex:facet>
                 
            </apex:column>
            
           
          
                    </apex:pageblockTable>
                            
                    
        </apex:pageBlock>
    </apex:form>
    
      
      </div>
        </apex:define>
</apex:page>

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

public with sharing class dateInPBTbaleControllernewOk {
    public MasterCopy__c account{get;set;}
    public List<MasterCopy__c> listAccount {get;set;}
    public Double totalRevenue {get;set;}
    public Double totalRevenue1 {get;set;}
    public Double totalRevenuee {get;set;}
    public Double totalRevenuee1 {get;set;}
   
    public Date dat {get;set;}
    
    public Map<Date,List<MasterCopy__c>> mapOfDateWithEntry;

    public dateInPBTbaleControllernewOk(ApexPages.StandardController controller){
    
        account = new MasterCopy__c();
        totalRevenue = 0;
        totalRevenue1 = 0;
        totalRevenuee = 0;
        totalRevenuee1 = 0;
        
    }
     
   public void setValues(){
        listAccount  = new List<MasterCopy__c>([SELECT id,  Closing_Balance__c,Credit__c,Credit_Formula__c,Debit_Formula__c,Date__c,DateUpdate__c,Debit__c,Debit_Balance__c,Credit_Balance__c,
        Group__c,Master_Code__c,Master_Name__c,New_Debit__c,New_Credit__c
                        FROM MasterCopy__c
                        order by Name ASC ]);
        mapOfDateWithEntry = new Map<Date,List<MasterCopy__c>>();
        List<MasterCopy__c> listOfEntryData;
        for(MasterCopy__c entry : listAccount){
            if(entry.DateUpdate__c != null){
                if(mapOfDateWithEntry.containsKey(entry.DateUpdate__c)){
                    mapOfDateWithEntry.get(entry.DateUpdate__c).add(entry);
                }
                else{
                    listOfEntryData = new List<MasterCopy__c>();
                    listOfEntryData.add(entry);
                    mapOfDateWithEntry.put(entry.DateUpdate__c,listOfEntryData);
                }
            }
        }
        calculateTotalRevenue();
        calculateTotalRevenue1();
        calculateTotalRevenue2();
   }
   public void displaingTable(){
        setValues();
        
        
        
 
        if(account.DateUpdate__c!= null){
            totalRevenue = 0;
            totalRevenue1 = 0;
            totalRevenuee = 0;
            totalRevenuee1 = 0;
            system.debug('Map '+mapOfDateWithEntry);
            Set<Date> allDateSet = mapOfDateWithEntry.keySet();
            if(allDateSet.contains(account.DateUpdate__c)){
                listAccount = mapOfDateWithEntry.get(account.DateUpdate__c);
            }
            else {
                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);
            }
        }
       calculateTotalRevenue();
        calculateTotalRevenue1();
        calculateTotalRevenue2(); 
    
    }
     public void calculateTotalRevenue() {
     //for(MasterCopy__c acct2 : listAccount) {
           // if(acct2.Closing_Balance__c!= null)
               // totalRevenuee= acct2.Closing_Balance__c;
                //}
        for(MasterCopy__c acct : listAccount) {
            if(acct.Debit_Balance__c!= null)
                totalRevenue+= acct.Debit_Balance__c;
                
                }
totalRevenuee1=totalRevenuee+totalRevenue;
             
       
        
    }
    
    
    
    public void calculateTotalRevenue2() {
        for(MasterCopy__c acct2 : listAccount) {
            if(acct2.Closing_Balance__c!= null)
                totalRevenuee= acct2.Closing_Balance__c;
            
              
        }
        
    }
    public void calculateTotalRevenue1() {
        for(MasterCopy__c acct1 : listAccount) {
            if(acct1.Credit_Balance__c!= null)
                totalRevenue1+= acct1.Credit_Balance__c;
                 
               
        }
        
    }
    
    public void showMessage() {
        system.debug('ddddddddd');
      if(totalRevenuee1!= totalRevenue1) {
         Apexpages.addMessage(new Apexpages.message(ApexPages.Severity.Error,'Sorry...... You have entered DUPLICATE MASTER CODE'));
      }
    }
}

 
Hi All

I have created vf page for inserting record .i need to put condtion if i am entering any duplicate recordit will be display error message..

like i have field
Type
master code==unique
mastername
opening balnce

if i will be entered any duplicate mastercode it will display error message
 
<apex:page controller="MasterTestEntryPage" tabstyle="Account" showHeader="true" sidebar="false">

<apex:pageMessages id="showmsg" ></apex:pageMessages>
<apex:define name="body">
            
            <div style="width:1000px;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:form >
   <apex:pageBlock title="Master Entry:">
   
    
      <apex:pageBlockTable value="{!wrappers}" var="wrapper" id="wtable">
      
      <apex:column headerValue="">
            <apex:commandButton value="X" action="{!delWrapper}" rerender="wtable" style="background:red">
               <apex:param name="toDelIdent" value="{!wrapper.ident}" assignTo="{!toDelIdent}"/> 
            </apex:commandButton>
         </apex:column>
         <apex:column headerValue="Sl.No" style="background:pink;">
            <apex:outputText value="{!wrapper.ident}"/>
         </apex:column>
         <apex:column headerValue="Select Account" style="background:pink;">
            <apex:inputField value="{!wrapper.acc.Type__c}" />
         </apex:column>
         <apex:column headerValue="Master Code" style="background:pink;">
            <apex:inputField value="{!wrapper.acc.Name}" />
         </apex:column>
         <apex:column headerValue="Master Name" style="background:pink;">
            <apex:inputField value="{!wrapper.acc.Master_Name__c}"/>
         </apex:column>
         <apex:column headerValue="Opening Balance" style="background:pink;">
         
                        <apex:inputField value="{!wrapper.acc.Opening_Balance__c}"/>
                   
            
         </apex:column>
         
         <apex:column headerValue="Remarks" style="background:pink;">
            <apex:inputField value="{!wrapper.acc.Remarks__c}"/>
         </apex:column>
       
        
       
       <apex:column headerValue="">
            <apex:commandButton value="Enter" action="{!addRows}" rerender="wtable" style="background:pink" >
         <apex:param name="addCount" value="1" assignTo="{!addCount}"/> 
      </apex:commandButton>
         </apex:column>
       
        
      </apex:pageBlockTable>
      
      <apex:commandButton value="Add 5 Rows" action="{!addRows}" rerender="wtable">
         <apex:param name="addCount" value="5" assignTo="{!addCount}"/> 
      </apex:commandButton>
       <apex:commandButton value="View Master List" action="{!parentPage }" rerender="wtable">
          
      </apex:commandButton>
      <apex:commandButton value="Save Master" action="{!save}"  />
   </apex:pageBlock>
 </apex:form>
  </div>
        </apex:define>
        
       
</apex:page>
--------------------------------------------------------------------------
/*---------------------------------------------------------------------
Version      : 34.0
Company      : Globalnest It Solution Pvt. Ltd.
Author       : Maheswar P
Date         : 26/07/2015
Description  : controller for VF page "MasterTestEntryPage "
History      :             
-------------------------------------------------------------------------*/


public class MasterTestEntryPage 
{
 public List<AccountWrapper> wrappers {get; set;}
 public static Integer toDelIdent {get; set;}
 public static Integer addCount {get; set;}
 private Integer nextIdent=1;
  
 public MasterTestEntryPage()
 {
  wrappers=new List<AccountWrapper>();
  for (Integer idx=0; idx<1; idx++)
  {
   wrappers.add(new AccountWrapper(nextIdent++));
  }
 }
  
 public void delWrapper()
 {
  Integer toDelPos=-1;
  for (Integer idx=0; idx<wrappers.size(); idx++)
  {
   if (wrappers[idx].ident==toDelIdent)
   {
    toDelPos=idx;
   }
  }
   
  if (-1!=toDelPos)
  {
   wrappers.remove(toDelPos);
  }
 }
  
 public void addRows()
 {
  for (Integer idx=0; idx<addCount; idx++)
  {
   wrappers.add(new AccountWrapper(nextIdent++));
  }
 }
  
 public PageReference save(){
  //try{
  List<MasterTest__c> accs=new List<MasterTest__c>();
  for (AccountWrapper wrap : wrappers)
  {
   accs.add(wrap.acc);
   
  }
   insert accs;
  
  return new PageReference('/' + Schema.getGlobalDescribe().get('MasterTest__c').getDescribe().getKeyPrefix() + '/o');
  
  //}
  
  //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,' Record already exist with same Master Code'));
      // } 
 
        return null; 
  
  
  
  
 }
 
 public pageReference parentPage () {

          return new pageReference('/apex/MasterDetailsPage');
} 
  
  
  
 public class AccountWrapper
 {
  public MasterTest__c acc {get; private set;}
  public Integer ident {get; private set;}
   
  public AccountWrapper(Integer inIdent)
  {
   ident=inIdent;
   acc=new MasterTest__c();
  }
 }
}

 
Hi Friends

Now i have created two object masterTest and bankbooktest


in mastertest object i have created field like

Type---Bank Account an party account
Mastercode
master name
Opening balance
Closing balance


In bankbookTest object i have created field like

date
BankAccount(which is masterdetails with masterTest and putting filter if type==bank Account)
Party Code (which is lookup with masterTest and putting filter if type==Party Account)
Payment Type
Amount

I am creating some record manualy in masterTest with respect to Type

when i am creating BankbookTest record ,i am selecting date ,bankaccount ,payment type ,party code,amount,after save it will update the closing balance of masterTest

If payment type==payment/receipt  then it will update closing balance of mastertest if type==bank Account,   closing balance will be opening balance-total payment+total reciept)
If payment type==payment/receipt then it will update closing balance of mastertest if type==Party Account,   closing balance will be opening balance+total payment-total reciept)
Hi...

I have two object Bank Account__c and party__c.i have created a vf page for searching record date wise.when i am searching record on particular date what the value of party is comming properly. i need all bank account details in my vf page on particular date

Bank Accout have 3 record

HDFC---10000
Axis----60000
etc....
 
public with sharing class dateInPBTbaleControllernew1 {
    public BankBook_Entry__c account{get;set;}
    public List<BankBook_Entry__c> listAccount {get;set;}
    public Double totalRevenue {get;set;}
    public Double totalRevenue1 {get;set;}
    public Double totalRevenuee {get;set;}
    public Double totalRevenuee1 {get;set;}
   
    public Date dat {get;set;}
    
    public Map<Date,List<BankBook_Entry__c>> mapOfDateWithEntry;

    public dateInPBTbaleControllernew1(ApexPages.StandardController controller){
    
        account = new BankBook_Entry__c();
        totalRevenue = 0;
        totalRevenue1 = 0;
        totalRevenuee = 0;
        totalRevenuee1 = 0;
        
    }
     
   public void setValues(){
        listAccount  = new List<BankBook_Entry__c>([SELECT id, CB__c,Date__c,Debit__c,Master_Code1__c,Master_Name__c,Bank_Closing_Balance__c
                        FROM BankBook_Entry__c
                        order by Master_Code1__c ASC ]);
        mapOfDateWithEntry = new Map<Date,List<BankBook_Entry__c>>();
        List<BankBook_Entry__c> listOfEntryData;
        for(BankBook_Entry__c entry : listAccount){
            if(mapOfDateWithEntry.containsKey(entry.Date__c)){
                mapOfDateWithEntry.get(entry.Date__c).add(entry);
            }
            else{
                listOfEntryData = new List<BankBook_Entry__c>();
                listOfEntryData.add(entry);
                mapOfDateWithEntry.put(entry.Date__c,listOfEntryData);
            }
        }
        calculateTotalRevenue();
        calculateTotalRevenue1();
        calculateTotalRevenue2();
   }
   public void displaingTable(){
        setValues();
        if(account.Date__c != null){
            totalRevenue = 0;
            totalRevenue1 = 0;
            totalRevenuee = 0;
            totalRevenuee1 = 0;
            Set<Date> allDateSet = mapOfDateWithEntry.keySet();
            if(allDateSet.contains(account.Date__c)){
                listAccount = mapOfDateWithEntry.get(account.Date__c);
            }
            else {
                Date compareDate ;
                Integer count = 0;
                for(Date firstKeydate : allDateSet){
                    compareDate = firstKeydate;
                    break;
                }
                for(Date keyDate : allDateSet){
                    if(keydate < account.Date__c && keydate > compareDate){
                        compareDate = keyDate;
                    }
                    if(account.Date__c < keyDate){
                        count ++ ;
                    }
                }
                Date requiredDate ;
                
                if(allDateSet.size() == count){
                    requiredDate = [Select Date__c from BankBook_Entry__c Order by Date__c Desc LIMIT 1][0].Date__c;
                }
                else {
                    requiredDate = compareDate;
                }
                listAccount = mapOfDateWithEntry.get(requiredDate);
            }
        }
       calculateTotalRevenue();
        calculateTotalRevenue1();
        calculateTotalRevenue2(); 
    
    }
     public void calculateTotalRevenue() {
     for(BankBook_Entry__c acct2 : listAccount) {
            if(acct2.Bank_Closing_Balance__c!= null)
                totalRevenuee= acct2.Bank_Closing_Balance__c;
                }
        for(BankBook_Entry__c acct : listAccount) {
            if(acct.Debit__c!= null)
                totalRevenue+= acct.Debit__c;
                
                }
totalRevenuee1=totalRevenuee+totalRevenue;
             
       
        
    }
    
    
    
    public void calculateTotalRevenue2() {
        for(BankBook_Entry__c acct2 : listAccount) {
            if(acct2.Bank_Closing_Balance__c!= null)
                totalRevenuee= acct2.Bank_Closing_Balance__c;
            
              
        }
        
    }
    public void calculateTotalRevenue1() {
        for(BankBook_Entry__c acct1 : listAccount) {
            if(acct1.CB__c!= null)
                totalRevenue1+= acct1.CB__c;
                 
               
        }
        
    }
}

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

<apex:page docType="html-5.0" standardController="BankBook_Entry__c"  extensions="dateInPBTbaleControllernew1"  showHeader="false" sidebar="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;}     
    </style>


        <apex:define name="body">
            
            <div style="width:1200px;margin: 0px auto 10px auto;border: 1px solid black;">
    <apex:form id="tableId">
        <apex:pageBlock >
            
                    <b><apex:outputLabel value="Trial Balance Report On: "  style="font-weight: bold;color:red;"/></b>
                     <apex:inputField value="{!account.Date__c}" style="font-weight: bold;color:red;"/>
                     
                     
                   <!--- Trial Balance Report On: <apex:input type="date" value="{!dat}"/>-->
                 
                 <apex:commandButton value="Display" action="{!displaingTable}" reRender="tableId" style="font-weight: bold;color:red;" oncomplete="window.opener.location.refresh();" />
        <b><apex:commandLink id="printable"  onclick="JavaScript:window.print();" value="Print"/>
        
        <apex:outputText style="font-style:italic;color:red;float:right;" value="This is {0} Trial Report."> 
<apex:param value="Balanced"/> 
 
 </apex:outputText>
        </b> <br/><br/><br/>
                 
                 <apex:pageblockTable value="{!listAccount }" var="record"  >
                
                    <apex:column value="{!record.Master_Code1__c}" headerValue="Master Code" headerClass="colHeadr" />
                    <apex:column value="{!record.Master_Name__c}" headerValue="Master Name" headerClass="colHeadr" style="float:center;">
                    <apex:facet name="footer" >
                    
                    <apex:outputText value="BANK CLOSING BALANCE:" style="font-weight: bold;color:black;font-size:12px;height=18px;float:center;" >
                        <apex:param value="{!totalRevenuee}" />
                   
                     </apex:outputText>
                </apex:facet>
            </apex:column>
                    <apex:column value="{!record.Debit__c}" headerValue="Debit(+)" style="color:green;float:right;" headerClass="colHeadr" >
                     <apex:facet name="footer" >
        
                    <apex:outputText value=" Rs.{!totalRevenue}<br/> Rs.{!totalRevenuee}<br/>-----------------<br/> Rs.{!totalRevenuee1}" style="font-weight: bold;color:green;font-size:12px;height=18px;float:right;" escape="false" />
                    <!--- <apex:outputText value="Rs.{0, number, ###,###,###,##0.00}"  style="font-weight: bold;color:green;font-size:12px;height=18px;float:right;"  >
                        <apex:param value="{!totalRevenue}"  />
                    </apex:outputText> ---->  
                       
                   
                </apex:facet>
                
                 
            </apex:column>
                    <apex:column value="{!record.CB__c}" headerValue="Credit(-)" style="color:red;" headerClass="colHeadr">
                    <apex:facet name="footer" >
                   
                       <apex:outputText value="Rs.{0, number, ###,###,###,##0.00}"  style="font-weight: bold;color:red;font-size:12px;height=18px;float:right;"  >
                        <apex:param value="{!totalRevenue1}"  />
                    </apex:outputText> 
                        
                 
                </apex:facet>
                 
            </apex:column>
            
            
           
                    </apex:pageblockTable>
                            
                    
        </apex:pageBlock>
    </apex:form>
      </div>
        </apex:define>
</apex:page>
User-added image
 
Hi All

I have two object Obj1 and Obj2 .both are lookup realtionship.
i have created Obj1 manually..when i am going to create Obj2 ,after creating Obj2 ,some field of Obj1 will be updated in Obj2...
Hi..
How to display record in visualforce page from diffrent object...
How to dispaly messages when facet value is not same in vf page
Hi

How to run a bath file in schedular time for command line dataloade in windows 8
Hi All

I have created a Vf page for trial the balance.i want to dispaly a alert message when debit and credit balance not same and now debit balance showing 0.0 format i want to display that in 0.00 format like credi balance how to chnage that for my requirment

User-added image
<apex:page docType="html-5.0" standardController="MasterCopy__c"  extensions="dateInPBTbaleControllernewOk"  showHeader="false" sidebar="false">
<apex:pageMessages id="showmsg" ></apex:pageMessages>

<style type="text/css" media="print">
@media print
{
#non-printable { display: none; }
#printable {
display: block;
width: 100%;
height: 100%;
}
}
</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="Trial Balance Report On: "  style="font-weight: bold;color:red;"/></b>
                     <apex:inputField value="{!account.Date__c}" style="font-weight: bold;color:red;"/>
                     
                     
                   <!--- Trial Balance Report On: <apex:input type="date" value="{!dat}"/>-->
                 
                 <apex:commandButton value="Display" action="{!displaingTable}" reRender="tableId" style="font-weight: bold;color:red;" oncomplete="window.opener.location.refresh();" />
        <b><apex:commandLink id="printable"  onclick="JavaScript:window.print();" value="Print"/></b> <br/><br/><br/>
                 
                 <apex:pageblockTable value="{!listAccount }" var="record"  >
                
                    <apex:column value="{!record.Master_Code__c}" headerValue="Master Code"/>
                    <apex:column value="{!record.Master_Name__c}" headerValue="Master Name">
                    <apex:facet name="footer" >
                    
                    <apex:outputText value="HDFC CLOSING BALANCE: Rs.{0, number, ###,###,###,##0.00}"  style="font-weight: bold;color:green;font-size:12px;height=18px;"  >
                        <apex:param value="{!totalRevenuee}" />
                   
                     </apex:outputText>
                </apex:facet>
            </apex:column>
                    <apex:column value="{!record.New_Debit__c}" headerValue="Debit(+)" style="color:green;" >
                     <apex:facet name="footer" >
        
                    <apex:outputText value=" Rs.{!totalRevenue}<br/> Rs.{!totalRevenuee}<br/>-----------------<br/> Rs.{!totalRevenuee1}" style="font-weight: bold;color:green;font-size:12px;height=18px;" escape="false">
                      
                       
                    </apex:outputText>
                </apex:facet>
            </apex:column>
                    <apex:column value="{!record.New_Credit__c}" headerValue="Credit(-)" style="color:red;"  >
                    <apex:facet name="footer" >
                   
                        
                        
                     <apex:outputText value="Rs.{!totalRevenue1}"  style="font-weight: bold;color:red;font-size:12px;height=18px;"  >
                        
                    </apex:outputText>
                     
                </apex:facet>
                 
            </apex:column>
            
             <!---  <td  style="background-color: #DAFFFF" ><b> <apex:outputText value="Current Total" /></b></td>
           <apex:column value="{!record.Bank_Closing_Balance__c}" headerValue="Bank Closing Balance" style="color:green;">
                    <apex:facet name="footer" >
                    <apex:outputText value="Rs.{0, number, ###,###,###,##0.00}"  style="font-weight: bold;color:green;font-size:12px;height=18px;"  >
                        <apex:param value="{!totalRevenuee}"  />
                    </apex:outputText>
                </apex:facet>
            </apex:column>-->
             
           
                    </apex:pageblockTable>
                            
                    
        </apex:pageBlock>
    </apex:form>
      </div>
        </apex:define>
</apex:page>
-------------------------------------------------------------------------------------------------

public with sharing class dateInPBTbaleControllernewOk {
    public MasterCopy__c account{get;set;}
    public List<MasterCopy__c> listAccount {get;set;}
    public Double totalRevenue {get;set;}
    public Double totalRevenue1 {get;set;}
    public Double totalRevenuee {get;set;}
    public Double totalRevenuee1 {get;set;}
   
    public Date dat {get;set;}
    
    public Map<Date,List<MasterCopy__c>> mapOfDateWithEntry;

    public dateInPBTbaleControllernewOk(ApexPages.StandardController controller){
    
        account = new MasterCopy__c();
        totalRevenue = 0;
        totalRevenue1 = 0;
        totalRevenuee = 0;
        totalRevenuee1 = 0;
        
    }
     
   public void setValues(){
        listAccount  = new List<MasterCopy__c>([SELECT id,  Closing_Balance__c,Credit__c,Credit_Formula__c,Debit_Formula__c,Date__c,DateUpdate__c,Debit__c,
        Group__c,Master_Code__c,Master_Name__c,New_Debit__c,New_Credit__c
                        FROM MasterCopy__c
                        order by Master_Code__c ASC ]);
        mapOfDateWithEntry = new Map<Date,List<MasterCopy__c>>();
        List<MasterCopy__c> listOfEntryData;
        for(MasterCopy__c entry : listAccount){
            if(mapOfDateWithEntry.containsKey(entry.Date__c)){
                mapOfDateWithEntry.get(entry.Date__c).add(entry);
            }
            else{
                listOfEntryData = new List<MasterCopy__c>();
                listOfEntryData.add(entry);
                mapOfDateWithEntry.put(entry.Date__c,listOfEntryData);
            }
        }
        calculateTotalRevenue();
        calculateTotalRevenue1();
        calculateTotalRevenue2();
   }
   public void displaingTable(){
        setValues();
        if(account.Date__c != null){
            totalRevenue = 0;
            totalRevenue1 = 0;
            totalRevenuee = 0;
            totalRevenuee1 = 0;
            Set<Date> allDateSet = mapOfDateWithEntry.keySet();
            if(allDateSet.contains(account.Date__c)){
                listAccount = mapOfDateWithEntry.get(account.Date__c);
            }
            else {
                Date compareDate ;
                Integer count = 0;
                for(Date firstKeydate : allDateSet){
                    compareDate = firstKeydate;
                    break;
                }
                for(Date keyDate : allDateSet){
                    if(keydate < account.Date__c && keydate > compareDate){
                        compareDate = keyDate;
                    }
                    if(account.Date__c < keyDate){
                        count ++ ;
                    }
                }
                Date requiredDate ;
                
                if(allDateSet.size() == count){
                    requiredDate = [Select Date__c from MasterCopy__c Order by Date__c Desc LIMIT 1][0].Date__c;
                }
                else {
                    requiredDate = compareDate;
                }
                listAccount = mapOfDateWithEntry.get(requiredDate);
            }
        }
       calculateTotalRevenue();
        calculateTotalRevenue1();
        calculateTotalRevenue2(); 
    
    }
     public void calculateTotalRevenue() {
     for(MasterCopy__c acct2 : listAccount) {
            if(acct2.Closing_Balance__c!= null)
                totalRevenuee= acct2.Closing_Balance__c;
                }
        for(MasterCopy__c acct : listAccount) {
            if(acct.New_Debit__c!= null)
                totalRevenue+= acct.New_Debit__c;
                
                }
totalRevenuee1=totalRevenuee+totalRevenue;
             
       
        
    }
    
    
    
    public void calculateTotalRevenue2() {
        for(MasterCopy__c acct2 : listAccount) {
            if(acct2.Closing_Balance__c!= null)
                totalRevenuee= acct2.Closing_Balance__c;
            
              
        }
        
    }
    public void calculateTotalRevenue1() {
        for(MasterCopy__c acct1 : listAccount) {
            if(acct1.New_Credit__c!= null)
                totalRevenue1+= acct1.New_Credit__c;
                 
               
        }
        
    }
}

 
Hi

I have created a batch file for running command line loader using schedular time.but it not working......
like this i have created batch file
cls
call process "D:\test1" AccountUpsert
Hi

I have created a controller for searching record.there is no error in code it saved .but at the time of searching record it will dispaly error..

Visualforce ErrorHelp for this Page
System.NullPointerException: Attempt to de-reference a null object
Error is in expression '{!displaingTable}' in component <apex:commandButton> in page newtrial1: Class.dateInPBTbaleControllernew1.calculateTotalRevenue: line 84, column 1
Class.dateInPBTbaleControllernew1.displaingTable: line 77, column 1
Class.dateInPBTbaleControllernew1.calculateTotalRevenue: line 84, column 1
Class.dateInPBTbaleControllernew1.displaingTable: line 77, column 1

 
public with sharing class dateInPBTbaleControllernew1 {
    public BankBook_Entry__c account{get;set;}
    public List<BankBook_Entry__c> listAccount {get;set;}
    public Double totalRevenue {get;set;}
    public Double totalRevenue1 {get;set;}
    public Double totalRevenuee {get;set;}
    public Double totalRevenuee1 {get;set;}
   
    public Date dat {get;set;}
    
    public Map<Date,List<BankBook_Entry__c>> mapOfDateWithEntry = new Map<Date,List<BankBook_Entry__c>>();
    
    public dateInPBTbaleControllernew1() {
    listAccount  = new List<BankBook_Entry__c>([SELECT id, CB__c,Date__c,Debit__c,Master_Code1__c,Master_Name__c,Bank_Closing_Balance__c
                        FROM BankBook_Entry__c
                        order by Master_Code1__c ASC ]);
        
        List<BankBook_Entry__c> listOfEntryData;
        for(BankBook_Entry__c entry : listAccount){
            if(mapOfDateWithEntry.containsKey(entry.Date__c)){
                mapOfDateWithEntry.get(entry.Date__c).add(entry);
            }
            else{
                listOfEntryData = new List<BankBook_Entry__c>();
                listOfEntryData.add(entry);
                mapOfDateWithEntry.put(entry.Date__c,listOfEntryData);
            }
        }
    }

    public dateInPBTbaleControllernew1(ApexPages.StandardController controller){
    
        account = new BankBook_Entry__c();
        totalRevenue = 0;
        totalRevenue1 = 0;
        totalRevenuee = 0;
        totalRevenuee1 = 0;
        
        
       
    }
       
   public void displaingTable(){
        if(account.Date__c != null){
            Set<Date> allDateSet = mapOfDateWithEntry.keySet();
            if(allDateSet.contains(account.Date__c)){
                listAccount = mapOfDateWithEntry.get(account.Date__c);
            }
            else {
                Date compareDate ;
                Integer count = 0;
                for(Date firstKeydate : allDateSet){
                    compareDate = firstKeydate;
                    break;
                }
                for(Date keyDate : allDateSet){
                    if(keydate < account.Date__c && keydate > compareDate){
                        compareDate = keyDate;
                    }
                    if(account.Date__c < keyDate){
                        count ++ ;
                    }
                }
                Date requiredDate ;
                
                if(allDateSet.size() == count){
                    requiredDate = [Select Date__c from BankBook_Entry__c Order by Date__c Desc LIMIT 1][0].Date__c;
                }
                else {
                    requiredDate = compareDate;
                }
                listAccount = mapOfDateWithEntry.get(requiredDate);
                
                
            }
        }
       calculateTotalRevenue();
        calculateTotalRevenue1();
        calculateTotalRevenue2(); 
       
    
    }
     public pagereference calculateTotalRevenue() {
     for(BankBook_Entry__c acct2 : listAccount) {
            if(acct2.Bank_Closing_Balance__c!= null)
                totalRevenuee= acct2.Bank_Closing_Balance__c;
                }
        for(BankBook_Entry__c acct : listAccount) {
            if(acct.Debit__c!= null)
                totalRevenue+= acct.Debit__c;
                
                }
totalRevenuee1=totalRevenuee+totalRevenue;
         return null;     
       
        
    }
    
    
    
    public void calculateTotalRevenue2() {
        for(BankBook_Entry__c acct2 : listAccount) {
            if(acct2.Bank_Closing_Balance__c!= null)
                totalRevenuee= acct2.Bank_Closing_Balance__c;
            
              
        }
        
    }
    public void calculateTotalRevenue1() {
        for(BankBook_Entry__c acct1 : listAccount) {
            if(acct1.CB__c!= null)
                totalRevenue1+= acct1.CB__c;
                 
               
        }
        
    }
}
----------------------------------------

<apex:page docType="html-5.0" standardController="BankBook_Entry__c"  extensions="dateInPBTbaleControllernew1" >

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


        <apex:define name="body">
            
            <div style="width:800px;margin: 0px auto 10px auto;border: 1px solid black;">
    <apex:form >
        <apex:pageBlock >
            
                    <b><apex:outputLabel value="Trial Balance Report On: "  style="font-weight: bold;color:red;"/></b>
                     <apex:inputField value="{!account.Date__c}" style="font-weight: bold;color:red;"/>
                     
                     
                   <!--- Trial Balance Report On: <apex:input type="date" value="{!dat}"/>-->
                 
                 <apex:commandButton value="Display" action="{!displaingTable}" reRender="tableId" style="font-weight: bold;color:red;" oncomplete="window.opener.location.refresh();" />
        <b><apex:commandLink id="printable"  onclick="JavaScript:window.print();" value="Print"/></b> <br/><br/><br/>
                 <apex:pageblockTable value="{!listAccount }" var="record"  id="tableId">
                
                    <apex:column value="{!record.Master_Code1__c}" headerValue="Master Code"/>
                    <apex:column value="{!record.Master_Name__c}" headerValue="Master Name">
                    <apex:facet name="footer" >
                    
                    <apex:outputText value="HDFC CLOSING BALANCE: Rs.{0, number, ###,###,###,##0.00}"  style="font-weight: bold;color:green;font-size:12px;height=18px;"  >
                        <apex:param value="{!totalRevenuee}" />
                   
                     </apex:outputText>
                </apex:facet>
            </apex:column>
                    <apex:column value="{!record.Debit__c}" headerValue="Debit(+)" style="color:green;" >
                     <apex:facet name="footer" >
        
                    <apex:outputText value=" Rs.{!totalRevenue}<br/> Rs.{!totalRevenuee}<br/>-----------------<br/> Rs.{!totalRevenuee1}" style="font-weight: bold;color:green;font-size:12px;height=18px;" escape="false">
                      
                       
                    </apex:outputText>
                </apex:facet>
            </apex:column>
                    <apex:column value="{!record.CB__c}" headerValue="Credit(-)" style="color:red;">
                    <apex:facet name="footer" >
                    <apex:outputText value="Rs.{!totalRevenue1}"  style="font-weight: bold;color:red;font-size:12px;height=18px;"  >
                       
                        
                        
                    </apex:outputText>
                     
                </apex:facet>
                 
            </apex:column>
            
             <!---  <td  style="background-color: #DAFFFF" ><b> <apex:outputText value="Current Total" /></b></td>
           <apex:column value="{!record.Bank_Closing_Balance__c}" headerValue="Bank Closing Balance" style="color:green;">
                    <apex:facet name="footer" >
                    <apex:outputText value="Rs.{0, number, ###,###,###,##0.00}"  style="font-weight: bold;color:green;font-size:12px;height=18px;"  >
                        <apex:param value="{!totalRevenuee}"  />
                    </apex:outputText>
                </apex:facet>
            </apex:column>-->
             
           
                    </apex:pageblockTable>
                            
                    
        </apex:pageBlock>
    </apex:form>
      </div>
        </apex:define>
</apex:page>

 
Hi...
I have created a page which will search record date wise...
like i have record

date                            value
10/9/2015--------------------a
11/9/2015--------------------aa
12/9/2015--------------------aaa
14/9/2015--------------------aaaa
15/9/2015--------------------aaaaa
20/9/2015--------------------aaaaaa

if i am searching record on 10/9/2015 the record will be display  'a'
if i am searching record on 11/9/2015 the record will be display  'aa'
if i am searching record on 13/9/2015 the record will be display  'aa'(12/9/2015 record)
if i am searching record on 14/9/2015 the record will be display  'aaaa'
if i am searching record on 20/9/2015 the record will be display  'aaaaaa'
if i am searching record on 19/9/2015 the record will be display  'aaaaa'(15/9/2015 record)

if there is record on particular date it will display if there is no record on that date it will display last date record

for example i have 10/1/2001 record if i am searching 10/1/2001 it will be displayed 10/1/2001.like this
User-added image

As per requirment there is no record in 11/1/ 2001 in  object if i am searching 11/1 2001 record it will be display last day record means 10/1/2001...but i am getting
User-added image
public with sharing class dateInPBTbaleController {
    public BankBook_Entry__c account{get;set;}
    public List<BankBook_Entry__c> listAccount {get;set;}
   
    //public Date startDate1;
    //public Date endDat1;
    public Double totalRevenue {get;set;}
    public Double totalRevenue1 {get;set;}
    public Double totalRevenuee {get;set;}
    public Double totalRevenuee1 {get;set;}
    public Date dat {get;set;}
    public dateInPBTbaleController() {
        listAccount  = [SELECT id, CB__c,Date__c,Debit__c,Master_Code1__c,Master_Name__c,Bank_Closing_Balance__c
                        FROM BankBook_Entry__c
                        order by Master_Code1__c ASC ];
    }

    public dateInPBTbaleController(ApexPages.StandardController controller){
    
        account = new BankBook_Entry__c();
        totalRevenue = 0;
        totalRevenue1 = 0;
        totalRevenuee = 0;
        totalRevenuee1 = 0;
    }
       
   public void displaingTable(){
        if(account.Date__c != null){
            listAccount  = [SELECT id, CB__c,Date__c,Debit__c,Master_Code1__c,Master_Name__c,Bank_Closing_Balance__c
                                FROM BankBook_Entry__c
                                WHERE Date__c =: account.Date__c order by Master_Code1__c ASC ];
            
            if(listAccount.size() == 0){
                listAccount  = [SELECT id, CB__c,Date__c,Debit__c,Master_Code1__c,Master_Name__c,Bank_Closing_Balance__c
                                FROM BankBook_Entry__c
                                WHERE Date__c <: account.Date__c order by Master_Code1__c ASC LIMIT 1 ];
            }
            
            if(account.Date__c == null){
                listAccount  = [SELECT id, CB__c,Date__c,Debit__c,Master_Code1__c,Master_Name__c,Bank_Closing_Balance__c,LastModified__c
                                FROM BankBook_Entry__c order by Master_Code1__c DESC LIMIT 1];
                                 
            }
        }
        calculateTotalRevenue();
        calculateTotalRevenue1();
        calculateTotalRevenue2();
     }
     public void calculateTotalRevenue() {
     for(BankBook_Entry__c acct2 : listAccount) {
            if(acct2.Bank_Closing_Balance__c!= null)
                totalRevenuee= acct2.Bank_Closing_Balance__c;
                }
        for(BankBook_Entry__c acct : listAccount) {
            if(acct.Debit__c!= null)
                totalRevenue+= acct.Debit__c;
                }
totalRevenuee1=totalRevenuee+totalRevenue;
              
       
        
    }
    
    
    
    public void calculateTotalRevenue2() {
        for(BankBook_Entry__c acct2 : listAccount) {
            if(acct2.Bank_Closing_Balance__c!= null)
                totalRevenuee= acct2.Bank_Closing_Balance__c;
            
              
        }
        
    }
    public void calculateTotalRevenue1() {
        for(BankBook_Entry__c acct1 : listAccount) {
            if(acct1.CB__c!= null)
                totalRevenue1+= acct1.CB__c;
               
        }
        
    }
}

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

<apex:page docType="html-5.0" standardController="BankBook_Entry__c"  extensions="dateInPBTbaleController">


        <apex:define name="body">
            
            <div style="width:800px;margin: 0px auto 10px auto;border: 1px solid black;">
    <apex:form >
        <apex:pageBlock >
            
                    <b><apex:outputLabel value="Trial Balance Report On: "  style="font-weight: bold;color:red;"/></b>
                     <apex:inputField value="{!account.Date__c}" style="font-weight: bold;color:red;"/>
                     
                     
                   <!--- Trial Balance Report On: <apex:input type="date" value="{!dat}"/>-->
                 
                 <apex:commandButton value="Display" action="{!displaingTable}" reRender="tableId" style="font-weight: bold;color:red;"/><br/><br/><br/>
         
                 <apex:pageblockTable value="{!listAccount }" var="record" id="tableId" >
                    <apex:column value="{!record.Master_Code1__c}" headerValue="Master Code"/>
                    <apex:column value="{!record.Master_Name__c}" headerValue="Master Name"/>
                    <apex:column value="{!record.Debit__c}" headerValue="Debit(+)" style="color:green;" id="tableId">
                     <apex:facet name="footer" >
                    <apex:outputText value="Rs.{0, number, ###,###,###,##0.00}" style="font-weight: bold;color:green;font-size:12px;height=18px;" >
                        <apex:param value="{!totalRevenuee1}"  />
                    </apex:outputText>
                </apex:facet>
            </apex:column>
                    <apex:column value="{!record.CB__c}" headerValue="Credit(-)" style="color:red;">
                    <apex:facet name="footer" >
                    <apex:outputText value="Rs.{0, number, ###,###,###,##0.00}"  style="font-weight: bold;color:red;font-size:12px;height=18px;"  >
                        <apex:param value="{!totalRevenue1}"  />
                    </apex:outputText>
                </apex:facet>
            </apex:column>
             <td  style="background-color: #DAFFFF" ><b> <apex:outputText value="Current Total" /></b></td>
            <!--- <apex:column value="{!record.Bank_Closing_Balance__c}" headerValue="Bank Closing Balance" style="color:green;">
                    <apex:facet name="footer" >
                    <apex:outputText value="Rs.{0, number, ###,###,###,##0.00}"  style="font-weight: bold;color:green;font-size:12px;height=18px;"  >
                        <apex:param value="{!totalRevenuee}"  />
                    </apex:outputText>
                </apex:facet>
            </apex:column>-->
                    
                    
                    </apex:pageblockTable>
             
        </apex:pageBlock>
    </apex:form>
      </div>
        </apex:define>
</apex:page>

 
HI

Hi...
I have created a page which will search record date wise...
like i have record

date                            value
10/9/2015--------------------a
11/9/2015--------------------aa
12/9/2015--------------------aaa
14/9/2015--------------------aaaa
15/9/2015--------------------aaaaa
20/9/2015--------------------aaaaaa

if i am searching record on 10/9/2015 the record will be display  'a'
if i am searching record on 11/9/2015 the record will be display  'aa'
if i am searching record on 13/9/2015 the record will be display  'aa'(12/9/2015 record)
if i am searching record on 14/9/2015 the record will be display  'aaaa'
if i am searching record on 20/9/2015 the record will be display  'aaaaaa'
if i am searching record on 19/9/2015 the record will be display  'aaaaa'(15/9/2015 record)

if there is record on particular date it will display if there is no record on that date it will display last date record

for example i have 10/1/2001 record if i am searching 10/1/2001 it will be displayed 10/1/2001.like this
User-added image

As per requirment there is no record in 11/1/ 2001 in m object if i am searching 11/1 2001 record it will be display last day record means 10/1/2001...but i am getting 
User-added image
public with sharing class dateInPBTbaleController {
    public BankBook_Entry__c account{get;set;}
    public List<BankBook_Entry__c> listAccount {get;set;}
   
    //public Date startDate1;
    //public Date endDat1;
    public Double totalRevenue {get;set;}
    public Double totalRevenue1 {get;set;}
    public Double totalRevenuee {get;set;}
    public Double totalRevenuee1 {get;set;}
    public Date dat {get;set;}
    public dateInPBTbaleController() {
        listAccount  = [SELECT id, CB__c,Date__c,Debit__c,Master_Code1__c,Master_Name__c,Bank_Closing_Balance__c
                        FROM BankBook_Entry__c
                        order by Master_Code1__c ASC ];
    }

    public dateInPBTbaleController(ApexPages.StandardController controller){
    
        account = new BankBook_Entry__c();
        totalRevenue = 0;
        totalRevenue1 = 0;
        totalRevenuee = 0;
        totalRevenuee1 = 0;
    }
       
   public void displaingTable(){
        if(account.Date__c != null){
            listAccount  = [SELECT id, CB__c,Date__c,Debit__c,Master_Code1__c,Master_Name__c,Bank_Closing_Balance__c
                                FROM BankBook_Entry__c
                                WHERE Date__c =: account.Date__c order by Master_Code1__c ASC ];
            
            if(listAccount.size() == 0){
                listAccount  = [SELECT id, CB__c,Date__c,Debit__c,Master_Code1__c,Master_Name__c,Bank_Closing_Balance__c
                                FROM BankBook_Entry__c
                                WHERE Date__c <: account.Date__c order by Master_Code1__c ASC LIMIT 1 ];
            }
            
            if(account.Date__c == null){
                listAccount  = [SELECT id, CB__c,Date__c,Debit__c,Master_Code1__c,Master_Name__c,Bank_Closing_Balance__c,LastModified__c
                                FROM BankBook_Entry__c order by Master_Code1__c DESC LIMIT 1];
                                 
            }
        }
        calculateTotalRevenue();
        calculateTotalRevenue1();
        calculateTotalRevenue2();
     }
     public void calculateTotalRevenue() {
     for(BankBook_Entry__c acct2 : listAccount) {
            if(acct2.Bank_Closing_Balance__c!= null)
                totalRevenuee= acct2.Bank_Closing_Balance__c;
                }
        for(BankBook_Entry__c acct : listAccount) {
            if(acct.Debit__c!= null)
                totalRevenue+= acct.Debit__c;
                }
totalRevenuee1=totalRevenuee+totalRevenue;
              
       
        
    }
    
    
    
    public void calculateTotalRevenue2() {
        for(BankBook_Entry__c acct2 : listAccount) {
            if(acct2.Bank_Closing_Balance__c!= null)
                totalRevenuee= acct2.Bank_Closing_Balance__c;
            
              
        }
        
    }
    public void calculateTotalRevenue1() {
        for(BankBook_Entry__c acct1 : listAccount) {
            if(acct1.CB__c!= null)
                totalRevenue1+= acct1.CB__c;
               
        }
        
    }
}

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

<apex:page docType="html-5.0" standardController="BankBook_Entry__c"  extensions="dateInPBTbaleController">


        <apex:define name="body">
            
            <div style="width:800px;margin: 0px auto 10px auto;border: 1px solid black;">
    <apex:form >
        <apex:pageBlock >
            
                    <b><apex:outputLabel value="Trial Balance Report On: "  style="font-weight: bold;color:red;"/></b>
                     <apex:inputField value="{!account.Date__c}" style="font-weight: bold;color:red;"/>
                     
                     
                   <!--- Trial Balance Report On: <apex:input type="date" value="{!dat}"/>-->
                 
                 <apex:commandButton value="Display" action="{!displaingTable}" reRender="tableId" style="font-weight: bold;color:red;"/><br/><br/><br/>
         
                 <apex:pageblockTable value="{!listAccount }" var="record" id="tableId" >
                    <apex:column value="{!record.Master_Code1__c}" headerValue="Master Code"/>
                    <apex:column value="{!record.Master_Name__c}" headerValue="Master Name"/>
                    <apex:column value="{!record.Debit__c}" headerValue="Debit(+)" style="color:green;" id="tableId">
                     <apex:facet name="footer" >
                    <apex:outputText value="Rs.{0, number, ###,###,###,##0.00}" style="font-weight: bold;color:green;font-size:12px;height=18px;" >
                        <apex:param value="{!totalRevenuee1}"  />
                    </apex:outputText>
                </apex:facet>
            </apex:column>
                    <apex:column value="{!record.CB__c}" headerValue="Credit(-)" style="color:red;">
                    <apex:facet name="footer" >
                    <apex:outputText value="Rs.{0, number, ###,###,###,##0.00}"  style="font-weight: bold;color:red;font-size:12px;height=18px;"  >
                        <apex:param value="{!totalRevenue1}"  />
                    </apex:outputText>
                </apex:facet>
            </apex:column>
             <td  style="background-color: #DAFFFF" ><b> <apex:outputText value="Current Total" /></b></td>
            <!--- <apex:column value="{!record.Bank_Closing_Balance__c}" headerValue="Bank Closing Balance" style="color:green;">
                    <apex:facet name="footer" >
                    <apex:outputText value="Rs.{0, number, ###,###,###,##0.00}"  style="font-weight: bold;color:green;font-size:12px;height=18px;"  >
                        <apex:param value="{!totalRevenuee}"  />
                    </apex:outputText>
                </apex:facet>
            </apex:column>-->
                    
                    
                    </apex:pageblockTable>
             
        </apex:pageBlock>
    </apex:form>
      </div>
        </apex:define>
</apex:page>

 
Hi...
I have created a page which will search record date wise...
like i have record

date                            value
10/9/2015--------------------a
11/9/2015--------------------aa
12/9/2015--------------------aaa
14/9/2015--------------------aaaa
15/9/2015--------------------aaaaa
20/9/2015--------------------aaaaaa

if i am searching record on 10/9/2015 the record will be display  'a'
if i am searching record on 11/9/2015 the record will be display  'aa'
if i am searching record on 13/9/2015 the record will be display  'aa'(12/9/2015 record)
if i am searching record on 14/9/2015 the record will be display  'aaaa'
if i am searching record on 20/9/2015 the record will be display  'aaaaaa'
if i am searching record on 19/9/2015 the record will be display  'aaaaa'(15/9/2015 record)

if there is record on particular date it will display if there is no record on that date it will display last date record

 
public with sharing class dateInPBTbaleController {

    public dateInPBTbaleController() {

    }


    public dateInPBTbaleController(ApexPages.StandardController controller) 
    {
    
     account = new BankBook_Entry__c();
         totalRevenue = 0;
        totalRevenue1 = 0;
        totalRevenuee = 0;
        
    

    }

    public BankBook_Entry__c account{get;set;}
    public List<BankBook_Entry__c> listAccount {get;set;}
   
    public Date startDate1;
    public Date endDat1;
    public Double totalRevenue {get;set;}
    public Double totalRevenue1 {get;set;}
     public Double totalRevenuee {get;set;}
     public Double totalRevenuee1 {get;set;}
     public Date dat {get;set;}
   // public dateInPBTbaleController() {
       
       
     public void displaingTable(){
        startDate1 = account.Date__c; 
        endDat1 = account.Date__c;
        if(endDat1!=null){
 
 
        listAccount  = [SELECT id, CB__c,Date__c,Debit__c,Master_Code1__c,Master_Name__c,Bank_Closing_Balance__c
                          FROM BankBook_Entry__c
                        WHERE Date__c>=:startDate1 AND Date__c<=:endDat1 order by Master_Code1__c ASC ];
                        }//Date__c>=:startDate1 AND
       
       calculateTotalRevenue();
        calculateTotalRevenue1();
        calculateTotalRevenue2();
     }
     public void calculateTotalRevenue() {
        for(BankBook_Entry__c acct : listAccount) {
            if(acct.Debit__c!= null)
                totalRevenue+= acct.Debit__c;

              
        }
        
    }
    
    
    
    public void calculateTotalRevenue2() {
        for(BankBook_Entry__c acct2 : listAccount) {
            if(acct2.Bank_Closing_Balance__c!= null)
                totalRevenuee= acct2.Bank_Closing_Balance__c;
            // totalRevenuee+= acct.Bank_Closing_Balance__c+totalRevenue;
              
        }
        
    }
    public void calculateTotalRevenue1() {
        for(BankBook_Entry__c acct1 : listAccount) {
            if(acct1.CB__c!= null)
                totalRevenue1+= acct1.CB__c;
               
        }
        
    }
}
----------------------------------------------------------------------

<apex:page docType="html-5.0" standardController="BankBook_Entry__c"  extensions="dateInPBTbaleController">


        <apex:define name="body">
            
            <div style="width:800px;margin: 0px auto 10px auto;border: 1px solid black;">
    <apex:form >
        <apex:pageBlock >
            
                    <b><apex:outputLabel value="Trial Balance Report On: "  style="font-weight: bold;color:red;"/></b>
                     <apex:inputField value="{!account.Date__c}" style="font-weight: bold;color:red;"/>
                     
                     
                   <!--- Trial Balance Report On: <apex:input type="date" value="{!dat}"/>-->
                 
                 <apex:commandButton value="Display" action="{!displaingTable}" reRender="tableId" style="font-weight: bold;color:red;"/><br/><br/><br/>
         
                 <apex:pageblockTable value="{!listAccount }" var="record" id="tableId" >
                    <apex:column value="{!record.Master_Code1__c}" headerValue="Master Code"/>
                    <apex:column value="{!record.Master_Name__c}" headerValue="Master Name"/>
                    <apex:column value="{!record.Debit__c}" headerValue="Debit(+)" style="color:green;" id="tableId">
                     <apex:facet name="footer" >
                    <apex:outputText value="Rs.{0, number, ###,###,###,##0.00}" style="font-weight: bold;color:green;font-size:12px;height=18px;" >
                        <apex:param value="{!totalRevenue}"  />
                    </apex:outputText>
                </apex:facet>
            </apex:column>
                    <apex:column value="{!record.CB__c}" headerValue="Credit(-)" style="color:red;">
                    <apex:facet name="footer" >
                    <apex:outputText value="Rs.{0, number, ###,###,###,##0.00}"  style="font-weight: bold;color:red;font-size:12px;height=18px;"  >
                        <apex:param value="{!totalRevenue1}"  />
                    </apex:outputText>
                </apex:facet>
            </apex:column>
            
             <apex:column value="{!record.Bank_Closing_Balance__c}" headerValue="Bank Closing Balance" style="color:green;">
                    <apex:facet name="footer" >
                    <apex:outputText value="Rs.{0, number, ###,###,###,##0.00}"  style="font-weight: bold;color:red;font-size:12px;height=18px;"  >
                        <apex:param value="{!totalRevenue1}"  />
                    </apex:outputText>
                </apex:facet>
            </apex:column>
                    
                    
                    </apex:pageblockTable>
             
        </apex:pageBlock>
    </apex:form>
      </div>
        </apex:define>
</apex:page>

 
Visualforce Error
Help for this Page

System.NullPointerException: Argument cannot be null.
Error is in expression '{!displaingTable}' in component <apex:commandButton> in page todaystesting: Class.dateInPBTbaleController.calculateTotalRevenue: line 32, column 1
Class.dateInPBTbaleController.displaingTable: line 25, column 1

Class.dateInPBTbaleController.calculateTotalRevenue: line 32, column 1
Class.dateInPBTbaleController.displaingTable: line 25, column 1

 
public with sharing class dateInPBTbaleController {
    public BankBook_Entry__c account{get;set;}
    public List<BankBook_Entry__c> listAccount {get;set;}
   
    public Date startDate1;
    public Date endDat1;
    public Double totalRevenue {get;set;}
    public Double totalRevenue1 {get;set;}
     public Double totalRevenuee {get;set;}
     public Date dat {get;set;}
    public dateInPBTbaleController() {
       
        account = new BankBook_Entry__c();
         totalRevenue = 0;
        totalRevenue1 = 0;
        totalRevenuee = 0;
      
    }
     public void displaingTable(){
        startDate1 = account.Date__c; 
        endDat1 = account.Date__c;
        listAccount  = [SELECT id, CB__c,Date__c,Debit__c,Master_Code1__c,Master_Name__c,Bank_Closing_Balance__c
                          FROM BankBook_Entry__c
                        WHERE Date__c>=:startDate1 AND Date__c<=:endDat1 ];//Date__c>=:startDate1 AND
        calculateTotalRevenue();
        calculateTotalRevenue1();
       
     }
     public void calculateTotalRevenue() {
        for(BankBook_Entry__c acct : listAccount) {
            if(acct.Debit__c!= null)
                totalRevenue += acct.Debit__c+acct.Bank_Closing_Balance__c;
                //totalRevenuee = totalRevenue  
              
        }
        
    }
    public void calculateTotalRevenue1() {
        for(BankBook_Entry__c acct1 : listAccount) {
            if(acct1.CB__c!= null)
                totalRevenue1 += acct1.CB__c;
               
        }
        
    }
}

 
Hi Friends

I have facing a challenge long time but i am not getting the solution.

I have two custom object.(object1 and object2).
object1 have some reocrd where in object2 there no record initially.when i am creating record or updating record it will be papulate all record of object1 to object2 .

like if object1 have recrod

1---100-----1/2/2010
2---200-----2/2/2010
3---300-----3/2/2010........when i am updating record on 1---100-----1/2/2010 to 1---500-----10/2/2010 on object1

it will be papulate in object2  like
1---500-----10/2/2010
2---200-----10/2/2010
3---300-----10/2/2010........means it will papulate all existing reccord with updated date field.if i am upadting again with same date it
will be updated on same record.if i am creating record with diffrent date means date not same as before it will be again papulate all existing field with updated date field..

like  when i am updating record on 1---100-----10/2/2010 to 1---1000-----15/2/2010 on object1

it will be papulate in object2  like
1---1000-----15/2/2010
2---200-----15/2/2010
3---300-----15/2/2010......

i have created a trigger but it will be created or upadted only one record which i am creating.if i have 10 record in object1 it will be papulate all 10 record in 
object2 when trigger fire...


 
trigger UpsertMasterNew on Debtors_Ledger__c(after insert,after update) {
    
    Set<Date> dateSet = new Set<Date>();
    for(Debtors_Ledger__c debtor : trigger.new)
    {
        dateSet.add(debtor.DailyUpdate__c);
    }
    
    List<MasterCopy__c> allMasterData = new List<MasterCopy__c>([Select Name,Date__c,Group__c,Master_Code__c,Master_Name__c,Credit__c,Debit__c from MasterCopy__c where Date__c IN : dateSet]);
    
    Map<Date,MasterCopy__c> masterDataMap = new Map<Date,MasterCopy__c>();
    
    for(MasterCopy__c masData : allMasterData){
        masterDataMap.put(masData.Date__c,masData);
    }
    List<MasterCopy__c> insertMasterList = new List<MasterCopy__c>();
    MasterCopy__c master;
    for(Debtors_Ledger__c debtor : trigger.new){
        if(masterDataMap.containsKey(debtor.DailyUpdate__c)){
            masterDataMap.get(debtor.DailyUpdate__c).Master_Code__c= debtor.Name;   // masterDataMap.get(debtor.DailyUpdate__c).Name + ' ' +
           masterDataMap.get(debtor.DailyUpdate__c).Credit__c=  debtor.Credit_formula__c;
           masterDataMap.get(debtor.DailyUpdate__c).Debit__c=  debtor.Debit_formula__c;
           masterDataMap.get(debtor.DailyUpdate__c).Group__c=  debtor.Group__c;
           masterDataMap.get(debtor.DailyUpdate__c).Master_Name__c=  debtor.Debtor_Name__c;
           masterDataMap.get(debtor.DailyUpdate__c).Date__c =  debtor.DailyUpdate__c;
        }
        else{
            master = new MasterCopy__c();
            master.Master_Code__c= debtor.Name;
            master.Date__c = debtor.DailyUpdate__c;
            
            master.Master_Name__c= debtor.Debtor_Name__c;
            master.Credit__c= debtor.Credit_formula__c;
            master.Debit__c= debtor.Debit_formula__c;
            master.Group__c= debtor.Group__c;
            insertMasterList.add(master);
        }
    }
    insertMasterList.addAll(masterDataMap.values());
    upsert insertMasterList;
}

 
Hi Friends

I have facing a challenge long time but i am not getting the solution.

I have two custom object.(object1 and object2).
object1 have some reocrd where in object2 there no record initially.when i am creating record or updating record it will be papulate all record of object1 to object2 .

like if object1 have recrod

1---100-----1/2/2010
2---200-----2/2/2010
3---300-----3/2/2010........when i am updating record on 1---100-----1/2/2010 to 1---500-----10/2/2010 on object1

it will be papulate in object2  like
1---500-----10/2/2010
2---200-----10/2/2010
3---300-----10/2/2010........means it will papulate all existing reccord with updated date field.if i am upadting again with same date it
will be updated on same record.if i am creating record with diffrent date means date not same as before it will be again papulate all existing field with updated date field..

like  when i am updating record on 1---100-----10/2/2010 to 1---1000-----15/2/2010 on object1

it will be papulate in object2  like
1---1000-----15/2/2010
2---200-----15/2/2010
3---300-----15/2/2010......

i ahve created a trigger but it will be created or upadted only one record which i am creating
 
trigger UpsertMasterNew on Debtors_Ledger__c(after insert,after update) {
    
    Set<Date> dateSet = new Set<Date>();
    for(Debtors_Ledger__c debtor : trigger.new)
    {
        dateSet.add(debtor.DailyUpdate__c);
    }
    
    List<MasterCopy__c> allMasterData = new List<MasterCopy__c>([Select Name,Date__c,Group__c,Master_Code__c,Master_Name__c,Credit__c,Debit__c from MasterCopy__c where Date__c IN : dateSet]);
    
    Map<Date,MasterCopy__c> masterDataMap = new Map<Date,MasterCopy__c>();
    
    for(MasterCopy__c masData : allMasterData){
        masterDataMap.put(masData.Date__c,masData);
    }
    List<MasterCopy__c> insertMasterList = new List<MasterCopy__c>();
    MasterCopy__c master;
    for(Debtors_Ledger__c debtor : trigger.new){
        if(masterDataMap.containsKey(debtor.DailyUpdate__c)){
            masterDataMap.get(debtor.DailyUpdate__c).Master_Code__c= debtor.Name;   // masterDataMap.get(debtor.DailyUpdate__c).Name + ' ' +
           masterDataMap.get(debtor.DailyUpdate__c).Credit__c=  debtor.Credit_formula__c;
           masterDataMap.get(debtor.DailyUpdate__c).Debit__c=  debtor.Debit_formula__c;
           masterDataMap.get(debtor.DailyUpdate__c).Group__c=  debtor.Group__c;
           masterDataMap.get(debtor.DailyUpdate__c).Master_Name__c=  debtor.Debtor_Name__c;
           masterDataMap.get(debtor.DailyUpdate__c).Date__c =  debtor.DailyUpdate__c;
        }
        else{
            master = new MasterCopy__c();
            master.Master_Code__c= debtor.Name;
            master.Date__c = debtor.DailyUpdate__c;
            
            master.Master_Name__c= debtor.Debtor_Name__c;
            master.Credit__c= debtor.Credit_formula__c;
            master.Debit__c= debtor.Debit_formula__c;
            master.Group__c= debtor.Group__c;
            insertMasterList.add(master);
        }
    }
    insertMasterList.addAll(masterDataMap.values());
    upsert insertMasterList;
}
it will be papulate like thiss....
User-added image
 
Hi all

How to copy all existing record to nother object when record created...uisng trigger
Hi All 
I am facing problem when creating formula field it showing

You have reached the maximum number of 10 object references 

How to update field value of one object from other object field with some calculation.is it possible using trigger
Hi

I have created a command Line Dataloader for Upserting record in schedular basic...Its working Propely in schedular basic,but problem is in my .csv file the Date value is 29/10/2015.after upserting using CMD in salesforce org the Date is 9/5/2017,means Date not taking right value..is there any setting or soluton for this....

Thanks in advancs
Hi All

I have created a Vf page for trial the balance.i want to dispaly a alert message when debit and credit balance not same and now debit balance showing 0.0 format i want to display that in 0.00 format like credi balance how to chnage that for my requirment

User-added image
<apex:page docType="html-5.0" standardController="MasterCopy__c"  extensions="dateInPBTbaleControllernewOk"  showHeader="false" sidebar="false">
<apex:pageMessages id="showmsg" ></apex:pageMessages>

<style type="text/css" media="print">
@media print
{
#non-printable { display: none; }
#printable {
display: block;
width: 100%;
height: 100%;
}
}
</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="Trial Balance Report On: "  style="font-weight: bold;color:red;"/></b>
                     <apex:inputField value="{!account.Date__c}" style="font-weight: bold;color:red;"/>
                     
                     
                   <!--- Trial Balance Report On: <apex:input type="date" value="{!dat}"/>-->
                 
                 <apex:commandButton value="Display" action="{!displaingTable}" reRender="tableId" style="font-weight: bold;color:red;" oncomplete="window.opener.location.refresh();" />
        <b><apex:commandLink id="printable"  onclick="JavaScript:window.print();" value="Print"/></b> <br/><br/><br/>
                 
                 <apex:pageblockTable value="{!listAccount }" var="record"  >
                
                    <apex:column value="{!record.Master_Code__c}" headerValue="Master Code"/>
                    <apex:column value="{!record.Master_Name__c}" headerValue="Master Name">
                    <apex:facet name="footer" >
                    
                    <apex:outputText value="HDFC CLOSING BALANCE: Rs.{0, number, ###,###,###,##0.00}"  style="font-weight: bold;color:green;font-size:12px;height=18px;"  >
                        <apex:param value="{!totalRevenuee}" />
                   
                     </apex:outputText>
                </apex:facet>
            </apex:column>
                    <apex:column value="{!record.New_Debit__c}" headerValue="Debit(+)" style="color:green;" >
                     <apex:facet name="footer" >
        
                    <apex:outputText value=" Rs.{!totalRevenue}<br/> Rs.{!totalRevenuee}<br/>-----------------<br/> Rs.{!totalRevenuee1}" style="font-weight: bold;color:green;font-size:12px;height=18px;" escape="false">
                      
                       
                    </apex:outputText>
                </apex:facet>
            </apex:column>
                    <apex:column value="{!record.New_Credit__c}" headerValue="Credit(-)" style="color:red;"  >
                    <apex:facet name="footer" >
                   
                        
                        
                     <apex:outputText value="Rs.{!totalRevenue1}"  style="font-weight: bold;color:red;font-size:12px;height=18px;"  >
                        
                    </apex:outputText>
                     
                </apex:facet>
                 
            </apex:column>
            
             <!---  <td  style="background-color: #DAFFFF" ><b> <apex:outputText value="Current Total" /></b></td>
           <apex:column value="{!record.Bank_Closing_Balance__c}" headerValue="Bank Closing Balance" style="color:green;">
                    <apex:facet name="footer" >
                    <apex:outputText value="Rs.{0, number, ###,###,###,##0.00}"  style="font-weight: bold;color:green;font-size:12px;height=18px;"  >
                        <apex:param value="{!totalRevenuee}"  />
                    </apex:outputText>
                </apex:facet>
            </apex:column>-->
             
           
                    </apex:pageblockTable>
                            
                    
        </apex:pageBlock>
    </apex:form>
      </div>
        </apex:define>
</apex:page>
-------------------------------------------------------------------------------------------------

public with sharing class dateInPBTbaleControllernewOk {
    public MasterCopy__c account{get;set;}
    public List<MasterCopy__c> listAccount {get;set;}
    public Double totalRevenue {get;set;}
    public Double totalRevenue1 {get;set;}
    public Double totalRevenuee {get;set;}
    public Double totalRevenuee1 {get;set;}
   
    public Date dat {get;set;}
    
    public Map<Date,List<MasterCopy__c>> mapOfDateWithEntry;

    public dateInPBTbaleControllernewOk(ApexPages.StandardController controller){
    
        account = new MasterCopy__c();
        totalRevenue = 0;
        totalRevenue1 = 0;
        totalRevenuee = 0;
        totalRevenuee1 = 0;
        
    }
     
   public void setValues(){
        listAccount  = new List<MasterCopy__c>([SELECT id,  Closing_Balance__c,Credit__c,Credit_Formula__c,Debit_Formula__c,Date__c,DateUpdate__c,Debit__c,
        Group__c,Master_Code__c,Master_Name__c,New_Debit__c,New_Credit__c
                        FROM MasterCopy__c
                        order by Master_Code__c ASC ]);
        mapOfDateWithEntry = new Map<Date,List<MasterCopy__c>>();
        List<MasterCopy__c> listOfEntryData;
        for(MasterCopy__c entry : listAccount){
            if(mapOfDateWithEntry.containsKey(entry.Date__c)){
                mapOfDateWithEntry.get(entry.Date__c).add(entry);
            }
            else{
                listOfEntryData = new List<MasterCopy__c>();
                listOfEntryData.add(entry);
                mapOfDateWithEntry.put(entry.Date__c,listOfEntryData);
            }
        }
        calculateTotalRevenue();
        calculateTotalRevenue1();
        calculateTotalRevenue2();
   }
   public void displaingTable(){
        setValues();
        if(account.Date__c != null){
            totalRevenue = 0;
            totalRevenue1 = 0;
            totalRevenuee = 0;
            totalRevenuee1 = 0;
            Set<Date> allDateSet = mapOfDateWithEntry.keySet();
            if(allDateSet.contains(account.Date__c)){
                listAccount = mapOfDateWithEntry.get(account.Date__c);
            }
            else {
                Date compareDate ;
                Integer count = 0;
                for(Date firstKeydate : allDateSet){
                    compareDate = firstKeydate;
                    break;
                }
                for(Date keyDate : allDateSet){
                    if(keydate < account.Date__c && keydate > compareDate){
                        compareDate = keyDate;
                    }
                    if(account.Date__c < keyDate){
                        count ++ ;
                    }
                }
                Date requiredDate ;
                
                if(allDateSet.size() == count){
                    requiredDate = [Select Date__c from MasterCopy__c Order by Date__c Desc LIMIT 1][0].Date__c;
                }
                else {
                    requiredDate = compareDate;
                }
                listAccount = mapOfDateWithEntry.get(requiredDate);
            }
        }
       calculateTotalRevenue();
        calculateTotalRevenue1();
        calculateTotalRevenue2(); 
    
    }
     public void calculateTotalRevenue() {
     for(MasterCopy__c acct2 : listAccount) {
            if(acct2.Closing_Balance__c!= null)
                totalRevenuee= acct2.Closing_Balance__c;
                }
        for(MasterCopy__c acct : listAccount) {
            if(acct.New_Debit__c!= null)
                totalRevenue+= acct.New_Debit__c;
                
                }
totalRevenuee1=totalRevenuee+totalRevenue;
             
       
        
    }
    
    
    
    public void calculateTotalRevenue2() {
        for(MasterCopy__c acct2 : listAccount) {
            if(acct2.Closing_Balance__c!= null)
                totalRevenuee= acct2.Closing_Balance__c;
            
              
        }
        
    }
    public void calculateTotalRevenue1() {
        for(MasterCopy__c acct1 : listAccount) {
            if(acct1.New_Credit__c!= null)
                totalRevenue1+= acct1.New_Credit__c;
                 
               
        }
        
    }
}

 
Hi...
I have created a page which will search record date wise...
like i have record

date                            value
10/9/2015--------------------a
11/9/2015--------------------aa
12/9/2015--------------------aaa
14/9/2015--------------------aaaa
15/9/2015--------------------aaaaa
20/9/2015--------------------aaaaaa

if i am searching record on 10/9/2015 the record will be display  'a'
if i am searching record on 11/9/2015 the record will be display  'aa'
if i am searching record on 13/9/2015 the record will be display  'aa'(12/9/2015 record)
if i am searching record on 14/9/2015 the record will be display  'aaaa'
if i am searching record on 20/9/2015 the record will be display  'aaaaaa'
if i am searching record on 19/9/2015 the record will be display  'aaaaa'(15/9/2015 record)

if there is record on particular date it will display if there is no record on that date it will display last date record

 
public with sharing class dateInPBTbaleController {

    public dateInPBTbaleController() {

    }


    public dateInPBTbaleController(ApexPages.StandardController controller) 
    {
    
     account = new BankBook_Entry__c();
         totalRevenue = 0;
        totalRevenue1 = 0;
        totalRevenuee = 0;
        
    

    }

    public BankBook_Entry__c account{get;set;}
    public List<BankBook_Entry__c> listAccount {get;set;}
   
    public Date startDate1;
    public Date endDat1;
    public Double totalRevenue {get;set;}
    public Double totalRevenue1 {get;set;}
     public Double totalRevenuee {get;set;}
     public Double totalRevenuee1 {get;set;}
     public Date dat {get;set;}
   // public dateInPBTbaleController() {
       
       
     public void displaingTable(){
        startDate1 = account.Date__c; 
        endDat1 = account.Date__c;
        if(endDat1!=null){
 
 
        listAccount  = [SELECT id, CB__c,Date__c,Debit__c,Master_Code1__c,Master_Name__c,Bank_Closing_Balance__c
                          FROM BankBook_Entry__c
                        WHERE Date__c>=:startDate1 AND Date__c<=:endDat1 order by Master_Code1__c ASC ];
                        }//Date__c>=:startDate1 AND
       
       calculateTotalRevenue();
        calculateTotalRevenue1();
        calculateTotalRevenue2();
     }
     public void calculateTotalRevenue() {
        for(BankBook_Entry__c acct : listAccount) {
            if(acct.Debit__c!= null)
                totalRevenue+= acct.Debit__c;

              
        }
        
    }
    
    
    
    public void calculateTotalRevenue2() {
        for(BankBook_Entry__c acct2 : listAccount) {
            if(acct2.Bank_Closing_Balance__c!= null)
                totalRevenuee= acct2.Bank_Closing_Balance__c;
            // totalRevenuee+= acct.Bank_Closing_Balance__c+totalRevenue;
              
        }
        
    }
    public void calculateTotalRevenue1() {
        for(BankBook_Entry__c acct1 : listAccount) {
            if(acct1.CB__c!= null)
                totalRevenue1+= acct1.CB__c;
               
        }
        
    }
}
----------------------------------------------------------------------

<apex:page docType="html-5.0" standardController="BankBook_Entry__c"  extensions="dateInPBTbaleController">


        <apex:define name="body">
            
            <div style="width:800px;margin: 0px auto 10px auto;border: 1px solid black;">
    <apex:form >
        <apex:pageBlock >
            
                    <b><apex:outputLabel value="Trial Balance Report On: "  style="font-weight: bold;color:red;"/></b>
                     <apex:inputField value="{!account.Date__c}" style="font-weight: bold;color:red;"/>
                     
                     
                   <!--- Trial Balance Report On: <apex:input type="date" value="{!dat}"/>-->
                 
                 <apex:commandButton value="Display" action="{!displaingTable}" reRender="tableId" style="font-weight: bold;color:red;"/><br/><br/><br/>
         
                 <apex:pageblockTable value="{!listAccount }" var="record" id="tableId" >
                    <apex:column value="{!record.Master_Code1__c}" headerValue="Master Code"/>
                    <apex:column value="{!record.Master_Name__c}" headerValue="Master Name"/>
                    <apex:column value="{!record.Debit__c}" headerValue="Debit(+)" style="color:green;" id="tableId">
                     <apex:facet name="footer" >
                    <apex:outputText value="Rs.{0, number, ###,###,###,##0.00}" style="font-weight: bold;color:green;font-size:12px;height=18px;" >
                        <apex:param value="{!totalRevenue}"  />
                    </apex:outputText>
                </apex:facet>
            </apex:column>
                    <apex:column value="{!record.CB__c}" headerValue="Credit(-)" style="color:red;">
                    <apex:facet name="footer" >
                    <apex:outputText value="Rs.{0, number, ###,###,###,##0.00}"  style="font-weight: bold;color:red;font-size:12px;height=18px;"  >
                        <apex:param value="{!totalRevenue1}"  />
                    </apex:outputText>
                </apex:facet>
            </apex:column>
            
             <apex:column value="{!record.Bank_Closing_Balance__c}" headerValue="Bank Closing Balance" style="color:green;">
                    <apex:facet name="footer" >
                    <apex:outputText value="Rs.{0, number, ###,###,###,##0.00}"  style="font-weight: bold;color:red;font-size:12px;height=18px;"  >
                        <apex:param value="{!totalRevenue1}"  />
                    </apex:outputText>
                </apex:facet>
            </apex:column>
                    
                    
                    </apex:pageblockTable>
             
        </apex:pageBlock>
    </apex:form>
      </div>
        </apex:define>
</apex:page>