0
スケジュールされたクラスコードを手伝ってください。コンストラクタを使用したapexクラスのスケジューリング
Public class HFCRecord {
public EMI__c acct ;
list<Detailed_Payment_Schedule__c> lst = new list<Detailed_Payment_Schedule__c>();
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 && d.Date__c <= system.today())i+=1;
if(d.Clearance__c == false && d.Date__c <= system.today())da+=integer.valueOf(d.Net_Payment__c);
if(d.Clearance__c == True && d.Date__c <= system.today())dab+=integer.valueOf(d.Net_Payment__c);
if(d.Clearance__c == False && d.Date__c.day() <= 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;
}
}
私は スケジュールクラスを書いたとして、それのスケジューラを作成するには助けてください。ライン3 25 \t グローバルクラスSchedule_HFCRecordが実装カラムで()スケジュール可能{ グローバルボイド(SchedulableContext SC)を実行{ HFCRecordのACC =新しいHFCRecord()。 acc.HFCRecord(); } } –
質問を正しく書式設定することを検討し、問題を明確にし、これまでに解決しようとしたことを明確にする必要があります。また、あなたのための最小の例を作成することは貴重です。これは答えを得ることに近づくでしょう。 – Wilmerton
こんにちはWilmerton、上記のクラス:HFCRecordは私が書いたクラスです。今私はそれをスケジュールしようとしています。私がそれをスケジュールすることができれば、そして、スケジュールよりも、どうすればいいのかチェックしてください。ありがとうございます。 –