course details changes done
This commit is contained in:
parent
ceab8e4200
commit
79f245f402
@ -937,6 +937,98 @@ class Fees_status_model extends CI_Model
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* send notification for student
|
||||
* created by kms
|
||||
* */
|
||||
public function studentNotification(){
|
||||
$date = new DateTime(date("d-m-Y"));
|
||||
$date->modify('+2 day');
|
||||
$tomorrowDATE = $date->format('d-m-Y');
|
||||
|
||||
$this->db->select('FIN.ID,FIN.Name,FIN.FeesID,FIN.Amount,FIN.DueDate,SFS.StudentID,SFS.CourseID');
|
||||
$this->db->from(FEES_INSTALLMENT.' as FIN');
|
||||
$this->db->join(STUDENTS_FEES_STATUS.' as SFS', 'FIN.FeesID = SFS.FeesID');
|
||||
$this->db->join(STUDENTS_FEES_PAID.' as SFP', 'SFP.FeesId = FIN.FeesID','left');
|
||||
$this->db->where('FIN.DueDate',$tomorrowDATE);
|
||||
$getStudentDetails = $this->db->get();
|
||||
if ($getStudentDetails->result()){
|
||||
foreach ($getStudentDetails->result() as $row){
|
||||
$this->db->select('ifnull(SUM((SFP.BillAmount)),0) as BillAmount');
|
||||
$this->db->from(STUDENTS_FEES_PAID.' as SFP');
|
||||
$this->db->join(STUDENTS_FEES_STATUS.' as SFS', 'SFP.FeesId = SFS.FeesID');
|
||||
$this->db->where('SFS.CourseID',$row->CourseID);
|
||||
$this->db->where('SFS.StudentID',$row->StudentID);
|
||||
$getStudentPaiDetails = $this->db->get()->result();
|
||||
if($row->Amount < $getStudentPaiDetails[0]->BillAmount){
|
||||
$this->smssend($row->StudentID,$row->DueDate);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
$date1 = new DateTime(date("d-m-Y"));
|
||||
$date1->modify('+7 day');
|
||||
$afterFiveDays = $date1->format('d-m-Y');
|
||||
$this->db->select('FIN.ID,FIN.Name,FIN.FeesID,FIN.Amount,FIN.DueDate,SFS.StudentID,SFS.CourseID');
|
||||
$this->db->from(FEES_INSTALLMENT.' as FIN');
|
||||
$this->db->join(STUDENTS_FEES_STATUS.' as SFS', 'FIN.FeesID = SFS.FeesID');
|
||||
$this->db->join(STUDENTS_FEES_PAID.' as SFP', 'SFP.FeesId = FIN.FeesID','left');
|
||||
$this->db->where('FIN.DueDate',$afterFiveDays);
|
||||
$getStudentDetails1 = $this->db->get();
|
||||
if ($getStudentDetails1->result()){
|
||||
foreach ($getStudentDetails1->result() as $row1){
|
||||
$this->db->select('ifnull(SUM((SFP.BillAmount)),0) as BillAmount');
|
||||
$this->db->from(STUDENTS_FEES_PAID.' as SFP');
|
||||
$this->db->join(STUDENTS_FEES_STATUS.' as SFS', 'SFP.FeesId = SFS.FeesID');
|
||||
$this->db->where('SFS.CourseID',$row1->CourseID);
|
||||
$this->db->where('SFS.StudentID',$row1->StudentID);
|
||||
$getStudentPaiDetails1 = $this->db->get()->result();
|
||||
if($row->Amount < $getStudentPaiDetails1[0]->BillAmount){
|
||||
$this->smssend($row1->StudentID,$row1->DueDate);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* this is for sms send
|
||||
* created by kms
|
||||
* */
|
||||
public function smssend($studentID=null,$date=null)
|
||||
{
|
||||
|
||||
$studentDetails = $this->get_registered_mobile($studentID);
|
||||
$msg ="Dear $studentDetails->Firstname, Fees Payment for your course is falling due on $date. Please ignore if already paid.";
|
||||
|
||||
$mobile = "91$studentDetails->MobileNumber";
|
||||
// $message ="Your new password for logging into Apollo student portal is SAMPLE. Please change the password as soon as you login.";
|
||||
// $mobile = "91$mobile";
|
||||
|
||||
$message = urlencode($msg);
|
||||
|
||||
$ch=curl_init();
|
||||
curl_setopt($ch,CURLOPT_URL,"https://smsapi.24x7sms.com/api_2.0/SendSMS.aspx?APIKEY=xegCdYUIMf3&MobileNo=".$mobile."&SenderID=APOLLO&Message=".$message."&ServiceName=TEMPLATE_BASED");
|
||||
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
|
||||
$output =curl_exec($ch);
|
||||
|
||||
// print_r($output);exit();
|
||||
curl_close($ch);
|
||||
return $output;
|
||||
}
|
||||
|
||||
// self function for getting registered mobile for sms
|
||||
public function get_registered_mobile($num) {
|
||||
$this->db->select('MobileNumber,Firstname');
|
||||
$this->db->from(STUDENTS);
|
||||
$this->db->where('StudentID', $num);
|
||||
$roleDetails = $this->db->get()->first_row();
|
||||
return $roleDetails;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user