diff --git a/Apollo/api/application/controllers/Fees_Status_Controller.php b/Apollo/api/application/controllers/Fees_Status_Controller.php index b1e5e6e4..817e8eb0 100755 --- a/Apollo/api/application/controllers/Fees_Status_Controller.php +++ b/Apollo/api/application/controllers/Fees_Status_Controller.php @@ -145,7 +145,9 @@ class Fees_Status_Controller extends REST_Controller { $detailsChild['CreatedBy'] = $this->post('createdBy'); $detailsChild['CreatedOn'] = $now->format('Y-m-d H:i:s'); $detailsChild['UpdatedBy'] = $this->post('requestedBranch'); - $updateDetails = $this->Fees_model->updateFees($detailsChild,$this->post('courseID'),$this->post('feesName'));// Check if the users data store contains users (in case the database result returns NULL) + $smsDetails['FeesName'] = $this->post('feesName'); + $smsDetails['CurrentBalance'] = $this->post('currentBalance'); + $updateDetails = $this->Fees_model->updateFees($detailsChild,$this->post('courseID'),$this->post('feesName'),$smsDetails);// Check if the users data store contains users (in case the database result returns NULL) if ($updateDetails) { $updateDetails['status'] = REST_Controller::HTTP_OK; diff --git a/Apollo/api/application/models/Fees_status_model.php b/Apollo/api/application/models/Fees_status_model.php index 4d82dad9..8005ca09 100755 --- a/Apollo/api/application/models/Fees_status_model.php +++ b/Apollo/api/application/models/Fees_status_model.php @@ -441,7 +441,7 @@ class Fees_status_model extends CI_Model * created by kms * */ - public function updateFees($feesPaidDetails=null,$courseID=null,$feesName=null) + public function updateFees($feesPaidDetails=null,$courseID=null,$feesName=null,$smsDetails=null) { if($feesPaidDetails['UpdatedBy']=='All'){ $this->db->select('BranchID'); @@ -495,13 +495,15 @@ class Fees_status_model extends CI_Model if($feesPaidDetails['BillAmount']!='0'){ $dayBookEntry = $this->insertDayBookMaster($feesPaidDetails,$feesPayedID,$courseID,$feesName); + // set message content + $message='Thanks for the payment of Rs.'.$feesPaidDetails['BillAmount'].',BillNo-'. $feesPaidDetails['BillNO'].' for '. strtolower($smsDetails['FeesName']).' your balance fees is Rs.'.$smsDetails['CurrentBalance'].'.'; + $studentDetails = $this->get_registered_mobile($feesPaidDetails['StudentID']); + $this->smssend($studentDetails->MobileNumber,$message); } // Entry for all status screen except fees $this->entryForAllStatus($feesPaidDetails,$courseID); - - } else{ $result['paidStatus'] = false; @@ -1263,7 +1265,7 @@ class Fees_status_model extends CI_Model $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); - $this->db->where('SFP.IsActive','1'); + // $this->db->where('SFP.IsActive','1'); $getStudentDetails = $this->db->get(); if ($getStudentDetails->result()){ @@ -1277,7 +1279,10 @@ class Fees_status_model extends CI_Model $getStudentPaiDetails = $this->db->get()->result(); if($row->Amount > $getStudentPaiDetails[0]->BillAmount){ - $this->smssend($row->StudentID,$row->DueDate); + $studentDetails = $this->get_registered_mobile($row->StudentID); + $message ="Dear ". strtolower($studentDetails->Firstname)." your ". strtolower($row->Name)." installment due is on $row->DueDate.Please clear the dues."; + + $this->smssend($studentDetails->MobileNumber,$message); } } @@ -1290,7 +1295,7 @@ class Fees_status_model extends CI_Model $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); - $this->db->where('SFP.IsActive','1'); + // $this->db->where('SFP.IsActive','1'); $getStudentDetails1 = $this->db->get(); if ($getStudentDetails1->result()){ foreach ($getStudentDetails1->result() as $row1){ @@ -1301,8 +1306,11 @@ class Fees_status_model extends CI_Model $this->db->where('SFS.StudentID',$row1->StudentID); $this->db->where('SFP.IsActive','1'); $getStudentPaiDetails1 = $this->db->get()->result(); - if($row1->Amount < $getStudentPaiDetails1[0]->BillAmount){ - $this->smssend($row1->StudentID,$row1->DueDate); + if($row1->Amount > $getStudentPaiDetails1[0]->BillAmount){ + $studentDetails1 = $this->get_registered_mobile($row1->StudentID); + $message1 ="Dear ". strtolower($studentDetails1->Firstname)." your ". strtolower($row1->Name)." installment due is on $row1->DueDate.Please clear the dues."; + + $this->smssend($studentDetails1->MobileNumber,$message1); } } @@ -1318,7 +1326,7 @@ class Fees_status_model extends CI_Model $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',$preDATE); - $this->db->where('SFP.IsActive','1'); + //$this->db->where('SFP.IsActive','1'); $getStudentDetails2 = $this->db->get(); if ($getStudentDetails2->result()){ foreach ($getStudentDetails2->result() as $row2){ @@ -1331,9 +1339,13 @@ class Fees_status_model extends CI_Model $getStudentPaiDetails2 = $this->db->get()->result(); if($row2->Amount > $getStudentPaiDetails2[0]->BillAmount){ - - + // update in call track $this->updateFeesStatusInCallTrack($row2->StudentID,$row2->CourseID); + // send notification to student + $getStudentPaiDetails2 = $this->get_registered_mobile($row2->StudentID); + $message2 ="Dear ". strtolower($getStudentPaiDetails2->Firstname)." your ". strtolower($row2->Name)." installment date is overdue.Please clear this immediately.Ignore if already paid."; + $this->smssend($getStudentPaiDetails2->MobileNumber,$message2); + } @@ -1349,17 +1361,14 @@ class Fees_status_model extends CI_Model * this is for sms send * created by kms * */ - public function smssend($studentID=null,$date=null) + public function smssend($studentMobile=null,$data=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"; + // $msg ="Dear $studentDetails->Firstname, Fees Payment for your course is falling due on $date. Please ignore if already paid."; + $mobile = "91$studentMobile"; // $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); + $message = urlencode($data); $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"); diff --git a/Apollo/assets/js/controllers/feesStatusCtrl.js b/Apollo/assets/js/controllers/feesStatusCtrl.js index d9d9fd8b..51dc7472 100755 --- a/Apollo/assets/js/controllers/feesStatusCtrl.js +++ b/Apollo/assets/js/controllers/feesStatusCtrl.js @@ -418,12 +418,12 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n * created by kms * */ $scope.saveFees = function (myModel, form,updateModel, loading) { - $scope.totBalanceFees = 0; + $scope.currentBalance = 0; if(parseInt(updateModel.feesType.BalanceAmount) >= parseInt(updateModel.billAmount)){ - $scope.totBalanceFees = parseInt(updateModel.feesType.BalanceAmount)-parseInt(updateModel.billAmount); + $scope.currentBalance = parseInt(updateModel.feesType.BalanceAmount)-parseInt(updateModel.billAmount); } else{ - $scope.totBalanceFees = 0; + $scope.currentBalance = 0; } if(isNaN(updateModel.date)){ @@ -481,7 +481,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n course: myModel.CourseName, //statusCode: updateModel.statusCode, requestedBranch : JSON.parse(localStorage.getItem('localObj')).localBranchID, - balanceFees : $scope.totBalanceFees + currentBalance : $scope.currentBalance }