title: In Scheduling a apex class with constructor
body: <p>Please help me with scheduled class code for it.</p>
  
  <pre><code>Public class HFCRecord {
      public EMI__c acct ;
  
  list&lt;Detailed_Payment_Schedule__c&gt; lst = new       list&lt;Detailed_Payment_Schedule__c&gt;();
        public integer NoOfdays{get;set;}
        public HFCRecord(ApexPages.StandardController stdController) {
          this.acct = (EMI__c )stdController.getRecord();
          Id emiId= acct.Id; 
  
  lst = [select id,Payment_Received_Date__c,Clearance__c,Date__c,Net_Payment__c from Detailed_Payment_Schedule__c where EMI_EQI__c =: emiId  order by Payment_Received_Date__c  Desc];
          system.debug('valis'+lst );
             }
      public PageReference  updateEMI() {
      integer i = 0;
      integer da = 0;
      integer dab = 0;
      integer dac = 0;
      integer dad = 0;
      integer  TotalNoOfDays = 360;
  
          for(Detailed_Payment_Schedule__c d : lst ){
  
  if(d.Clearance__c == true )acct.Last_Payment_Date__c = d.Payment_Received_Date__c;
  if(d.Clearance__c == false &amp;&amp; d.Date__c &lt;= system.today())i+=1;
  if(d.Clearance__c == false &amp;&amp; d.Date__c &lt;= system.today())da+=integer.valueOf(d.Net_Payment__c);
  if(d.Clearance__c == True &amp;&amp; d.Date__c &lt;= system.today())dab+=integer.valueOf(d.Net_Payment__c);
  if(d.Clearance__c == False &amp;&amp; d.Date__c.day() &lt;= system.today().day()){
  
         dac+=integer.valueOf(d.Net_Payment__c);
         NoOfdays = (d.Date__c.day() - System.today().day());
         acct.Penal_Charge__c = ((d.Net_Payment__c*(24/100)*1000/TotalNoOfDays)*NoOfdays);
         }
                          }
      system.debug('valisssdf'+i);
      acct.No_of_EMI_Overdue__c = i;
      acct.Overdue_Amount__c = da;
      acct.Amount_Collected__c= dab;
      acct.Penal_Charge__c = dac;
      acct.Total_Amount_Overdue__c = (acct.Penal_Charge__c +           acct.Overdue_Amount__c);
      update acct;
      PageReference pgref = new PageReference('/'+acct.id);
      pgref.setRedirect(true);
      return pgref;
  
      }
  }
  </code></pre>