diff --git a/Apollo/api/application/config/routes.php b/Apollo/api/application/config/routes.php index 3feb7264..9693945b 100755 --- a/Apollo/api/application/config/routes.php +++ b/Apollo/api/application/config/routes.php @@ -392,6 +392,7 @@ $route['getUniversityCourseDetailsforms'] = 'Reregister_Controller/getUniversity $route['CourseSemDetails'] = 'HallTickets_Controller/CourseSemDetails'; +$route['SendMessagetoFeeBalance'] = 'HallTickets_Controller/SendMessagetoFeeBalance'; ///PROMOTE BATCH AND $route['getUniversityBatchDetails'] = 'Reregister_Controller/getUniversityBatchDetails'; $route['getStudentListForPromoteBatch'] = 'Reregister_Controller/getStudentListForPromoteBatch'; diff --git a/Apollo/api/application/controllers/HallTickets_Controller.php b/Apollo/api/application/controllers/HallTickets_Controller.php index ea1d8a9f..fd8a10b2 100644 --- a/Apollo/api/application/controllers/HallTickets_Controller.php +++ b/Apollo/api/application/controllers/HallTickets_Controller.php @@ -681,6 +681,32 @@ class HallTickets_Controller extends REST_Controller { } + public function SendMessagetoFeeBalance_post() + { + $mobileno = $this->post('mobileno'); + $branchId = $this->post('branchId'); + + $sendsms = $this->Hallticket_model->SendFeeBalanceSMS($mobileno); + + if($sendsms) + { + //$sendsms['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($sendsms, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + $this->response([ + 'message' => 'No records found!', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); + + } + + + } + + } \ No newline at end of file diff --git a/Apollo/api/application/models/Hallticket_model.php b/Apollo/api/application/models/Hallticket_model.php index 03a0ddf2..7edaa44c 100644 --- a/Apollo/api/application/models/Hallticket_model.php +++ b/Apollo/api/application/models/Hallticket_model.php @@ -1628,4 +1628,38 @@ public function getSubjectMappingDetails($universityID,$courseIDS,$branchId) return $result_array; } + + public function SendFeeBalanceSMS($mobileno) + { + + $mobile = "91$mobileno"; + $msg = 'Dear Student, Your Fee Payment is pending. So we are unable to generate the Hall Ticket, Please pay the balance immediately'; + + $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=APODEC&Message=".$message."&ServiceName=PROMOTIONAL_HIGH"); + + curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); + $output =curl_exec($ch); + + // print_r($output);exit(); + curl_close($ch); + + $arrss = explode('
', $output); + + $time = date('Y-m-d H:i:s'); + $dateTime = $time; + $msgGroup = date('YmdHis'); + + //print_r($arrss); + + + $data = array( 'MobileNumber' => $mobile, 'MsgBody' => $msg, 'CreatedOn' => $dateTime,'MsgGroup' => $msgGroup); + //print_r($data);die(); + + $this->db->insert('T_BroadcastStatus',$data); + return $output; + } + } \ No newline at end of file diff --git a/Apollo/assets/js/controllers/generateHallTicketCtrl.js b/Apollo/assets/js/controllers/generateHallTicketCtrl.js index 952d4116..7bfd5de9 100755 --- a/Apollo/assets/js/controllers/generateHallTicketCtrl.js +++ b/Apollo/assets/js/controllers/generateHallTicketCtrl.js @@ -162,6 +162,40 @@ $scope.generateButtonStatus = false; $scope.studentInfo = response.data.studentDetails; $scope.isLoaderShow = false; $scope.isTblShow = true; + + //console.log($scope.studentInfo); + + + angular.forEach(($scope.studentInfo),function(studentInfo,key) + { + console.log($scope.studentInfo); + if(studentInfo.balpayable != 0) + { + var mobileno = studentInfo.MobileNumber; + var sendmsg = + { + method: 'POST', + url: apiPoint.url + 'SendMessagetoFeeBalance/', + headers: + { + 'Content-Type': 'application/json' + }, + data: + { + mobileno:mobileno, + branchId: JSON.parse(localStorage.getItem('localObj')).localBranchID, + } + }; + + $http(sendmsg).then(function (response) + { + console.log(response.data); + }); + + + } + //break; + }); }