Merge branch 'master' of https://bitbucket.org/venbainformationtechnology/apollodec
This commit is contained in:
commit
3ae3704e5f
@ -198,6 +198,8 @@ $route['getDayBookMasterDetails'] = 'DayBookMaster_Controller/getDayBookMasterDe
|
||||
$route['addDaybookMasterDetails'] = 'DayBookMaster_Controller/addDaybookMasterDetails';
|
||||
$route['updateDayBookMasterDetails'] = 'DayBookMaster_Controller/updateDayBookMasterDetails';
|
||||
|
||||
/** This is for CRONE JOB*/
|
||||
$route['sendStudentNotification'] = 'Fees_Status_Controller/sendStudentNotification';
|
||||
|
||||
|
||||
|
||||
|
||||
@ -39,6 +39,7 @@ class Fees_Status_Controller extends REST_Controller {
|
||||
$this->methods['getUniversityCourseForFees_post']['limit'] = 1000; // 1000 requests per hour per user/key
|
||||
$this->methods['getFeesStructureAssign_post']['limit'] = 1000; // 1000 requests per hour per user/key
|
||||
$this->methods['setFeesForStudent_post']['limit'] = 1000; // 1000 requests per hour per user/key
|
||||
$this->methods['sendStudentNotification_post']['limit'] = 2000; // 2000 requests per hour per user/key
|
||||
|
||||
|
||||
// load the model
|
||||
@ -258,6 +259,31 @@ class Fees_Status_Controller extends REST_Controller {
|
||||
|
||||
|
||||
}
|
||||
/*
|
||||
* send notification for student
|
||||
* created by kms
|
||||
* */
|
||||
public function sendStudentNotification_post(){
|
||||
|
||||
$sendMessage = $this->Fees_model->studentNotification();
|
||||
|
||||
if ($sendMessage)
|
||||
{
|
||||
$this->response([
|
||||
'message' => 'Done!',
|
||||
'status' => REST_Controller::HTTP_OK
|
||||
], REST_Controller::HTTP_OK); // NOT_FOUND (404) being the HTTP response code
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set the response and exit
|
||||
$this->response([
|
||||
'message' => 'No records found!',
|
||||
'status' => REST_Controller::HTTP_NOT_FOUND
|
||||
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -158,6 +158,7 @@ app.constant('JS_REQUIRES', {
|
||||
// day book master
|
||||
'dayBookMasterCtrl':'assets/js/controllers/dayBookMasterCtrl.js',
|
||||
'sendSMSsuperadminCtrl':'assets/js/controllers/sendSMSsuperadminCtrl.js',
|
||||
'feesNotification':'assets/js/controllers/feesNotification.js',
|
||||
|
||||
|
||||
//*** Filters
|
||||
|
||||
@ -32,7 +32,11 @@ app.config(['$stateProvider', '$urlRouterProvider', '$controllerProvider', '$com
|
||||
// Set up the states
|
||||
$stateProvider
|
||||
// Login routes
|
||||
.state('login', {
|
||||
.state('feesNotification', {
|
||||
url: '/feesNotification',
|
||||
templateUrl: "assets/views/feesNotification.html",
|
||||
resolve: loadSequence('feesNotification','moment')
|
||||
}).state('login', {
|
||||
url: '/login',
|
||||
template: '<div ui-view class="fade-in-right-big smooth"></div>',
|
||||
resolve: loadSequence('modernizr', 'moment', 'angularMoment', 'uiSwitch', 'perfect-scrollbar-plugin', 'toaster', 'ngAside', 'vAccordion', 'sweet-alert', 'chartjs', 'tc.chartjs', 'oitozero.ngSweetAlert', 'chatCtrl'),
|
||||
|
||||
22
Apollo/assets/js/controllers/feesNotification.js
Normal file
22
Apollo/assets/js/controllers/feesNotification.js
Normal file
@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
/**
|
||||
* daybook details capturing
|
||||
*
|
||||
*/
|
||||
app.controller('feesNotification', ["$scope", "$rootScope", "$filter", "API_POINTS", "$localStorage", "$http", "$state", 'ipCookie', '$window', function ($scope, $rootScope, $filter, apiPoint, $localStorage, $http, $state, ipCookie, $window) {
|
||||
var sendNotification = {
|
||||
method: 'POST',
|
||||
url: apiPoint.url + 'sendStudentNotification/',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
data: {
|
||||
localReqDetails: ""
|
||||
}
|
||||
};
|
||||
$http(sendNotification).then(function (response) {
|
||||
|
||||
});
|
||||
}]);
|
||||
|
||||
|
||||
25
Apollo/assets/views/feesNotification.html
Normal file
25
Apollo/assets/views/feesNotification.html
Normal file
@ -0,0 +1,25 @@
|
||||
<!-- start: PAGE TITLE -->
|
||||
<section id="page-title">
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
<h1 class="mainTitle" translate="Send Fees Notification">{{ mainTitle }}</h1>
|
||||
<!--
|
||||
<span class="mainDescription">Over a dozen reusable components built to provide popovers, media objects, navigation, tooltips and much more. </span>
|
||||
-->
|
||||
</div>
|
||||
<div ncy-breadcrumb></div>
|
||||
</div>
|
||||
</section>
|
||||
<!-- end: PAGE TITLE -->
|
||||
<!-- start: LIST GROUP -->
|
||||
<div class="container-fluid container-fullw bg-white">
|
||||
<div class="row" ng-controller="feesNotification">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- end: LIST GROUP -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user