apollodec/Apollo/assets/js/api/application/controllers/Fees_Status_Controller.php
2020-11-28 17:37:53 +05:30

330 lines
13 KiB
PHP

<?php
/**
* Created by PhpStorm.
* User: karthi
* Date: 12/12/17
* Time: 11:56 AM
*/
defined('BASEPATH') OR exit('No direct script access allowed');
// This can be removed if you use __autoload() in config.php OR use Modular Extensions
/** @noinspection PhpIncludeInspection */
require_once APPPATH . '/libraries/REST_Controller.php';
/**
* This is an example of a few basic user interaction methods you could use
* all done with a hardcoded array
*
* @package CodeIgniter
* @subpackage Rest Server
* @category Controller
* @author
* @license MIT
* @link
*/
class Fees_Status_Controller extends REST_Controller {
function __construct()
{
// Construct the parent class
parent::__construct();
// Configure limits on our controller methods
// Ensure you have created the 'limits' table and enabled 'limits' within application/config/rest.php
$this->methods['getStudentList_get']['limit'] = 500; // 500 requests per hour per user/key
$this->methods['getStudentList_post']['limit'] = 1000; // 1000 requests per hour per user/key
$this->methods['getStudentList_delete']['limit'] = 50; // 50 requests per hour per user/key
$this->methods['getFeesStructure_post']['limit'] = 1000; // 1000 requests per hour per user/key
$this->methods['updateFeesDetails_post']['limit'] = 1000; // 1000 requests per hour per user/key
$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
$this->methods['deleteSetFeesDetails_post']['limit'] = 1000;
// load the model
$this->load->model('Fees_status_model', 'Fees_model');
}
/*
* get student list for fees update
* created by kms
* */
public function getStudentList_post()
{
echo "i am here";die();
$search['requestedBy'] = $this->post('requestedtBy');
$search['Firstname'] = $this->post('studentName');
$search['MobileNumber'] = $this->post('mobileNumber');
$search['UniversityID'] = $this->post('university');
$search['CourseID'] = $this->post('course');
$search['requestedDept'] = $this->post('requestedDept');
$search['requestedBranch'] = $this->post('branchId');
$search['BatchCode'] = $this->post('batch');
$getStudentDetails = $this->Fees_model->getStudentList($search);
if ($getStudentDetails)
{
$getStudentDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($getStudentDetails, REST_Controller::HTTP_OK); // OK (200) 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
}
}
/*
* get student fees structure
* created by kms
* */
public function getFeesStructure_post()
{
$student['ID'] = $this->post('ID');
$student['requestedBy'] = $this->post('requestedtBy');
$student['CourseID'] = $this->post('courseID');
$student['StudentID'] = $this->post('studentID');
$student['BranchCode'] = $this->post('branchCode');
$getStudentFeesDetails = $this->Fees_model->getStudentFeesStructure($student);
if ($getStudentFeesDetails)
{
$getStudentFeesDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($getStudentFeesDetails, REST_Controller::HTTP_OK); // OK (200) 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
}
}
/*
* update fees details for student
* created by kms
* */
public function updateFeesDetails_post()
{
$now = new DateTime();
$now->setTimezone(new DateTimezone('Asia/Kolkata'));
/*for track purpose*/
/* $trackDetails['MobileNumber'] = $this->post('mobileNumber');
$trackDetails['LeadName'] = $this->post('studentName');
$trackDetails['University'] = $this->post('university');
$trackDetails['Course'] = $this->post('course');
$trackDetails['StatusCode'] = $this->post('statusCode');
$trackDetails['FollowupOn'] = $now->format('d-m-Y');
$trackDetails['FollowupComments'] = $this->post('commentsForStudent');
$trackDetails['CreatedBy'] = $this->post('createdBy');
$trackDetails['CreatedOn'] = $now->format('Y-m-d H:i:s');*/
/*track array end*/
$detailsChild['StudentID'] = $this->post('studID');
$detailsChild['FeesId'] = $this->post('feesID');
$detailsChild['ReceiptNo'] = $this->post('billNO');
$detailsChild['BillDate'] = $this->post('billDate');
$detailsChild['BillAmount'] = $this->post('billAmount');
$detailsChild['ModeOfPayment'] = $this->post('modeOfPayment');
$detailsChild['CommentsForStudent'] = $this->post('commentsForStudent');
$detailsChild['InternalComments'] = $this->post('internalComments');
$detailsChild['CreatedBy'] = $this->post('createdBy');
$detailsChild['CreatedOn'] = $now->format('Y-m-d H:i:s');
$detailsChild['UpdatedBy'] = $this->post('requestedBranch');
$detailsChild['Installment'] = $this->post('existPaidCount');
$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;
// Set the response and exit
$this->response($updateDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'Something went wrong.please try again!',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
/*
* get university and course details for fees update
* created by kms
* */
public function getUniversityCourseForFees_post()
{
$requestedBy = $this->post('requestedBy');
$requestedBranch = $this->post('branchCode');
$getUnivDetails = $this->Fees_model->getUniversityDetails($requestedBy,$requestedBranch);
if ($getUnivDetails)
{
$getUnivDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($getUnivDetails, REST_Controller::HTTP_OK); // OK (200) 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
}
}
/*
* get student set fees details
* created by kms
* */
/*
* get student fees structure
* created by kms
* */
public function getFeesStructureAssign_post()
{
$student['ID'] = $this->post('ID');
$student['requestedBy'] = $this->post('requestedtBy');
$student['CourseID'] = $this->post('courseID');
$student['StudentID'] = $this->post('studentID');
$student['BranchCode'] = $this->post('branchCode');
$getStudentFeesDetails = $this->Fees_model->getFeesStructureAssign($student);
if ($getStudentFeesDetails)
{
$getStudentFeesDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($getStudentFeesDetails, REST_Controller::HTTP_OK); // OK (200) 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
}
}
/*
* set fees for student
* created by kms
* */
public function setFeesForStudent_post()
{
$now = new DateTime();
$now->setTimezone(new DateTimezone('Asia/Kolkata'));
$details['StudentID'] = $this->post('studID');
$details['CourseID'] = $this->post('courseID');
$details['FeesType'] = $this->post('feesID');
$details['CourseFees'] = $this->post('courseAmount');
$details['SessionName'] = $this->post('session');
$details['ToSessionName'] = $this->post('sessionTo');
$details['RollNo'] = $this->post('rollNo');
$details['STFOrWR'] = $this->post('STFWR');
$details['Waiver'] = $this->post('waiver');
$details['Others'] = $this->post('other');
$details['CreatedBy'] = $this->post('createdBy');
$details['CreatedOn'] = $now->format('Y-m-d H:i:s');
$details['BatchCode'] = $this->post('batchCode');
$details['BranchCode'] = $this->post('branchCode');
$details['Comments'] = $this->post('comments');
$jsonInstallmenData = $this->post('installmentItems');
//print_r($details);
$updateDetails = $this->Fees_model->setFees($details,$jsonInstallmenData);// Check if the users data store contains users (in case the database result returns NULL)
if ($updateDetails)
{
$updateDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($updateDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'Something went wrong.please try again!',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
/*
* send notification for student
* created by kms
* */
public function sendStudentNotification_get(){
$sendMessage = $this->Fees_model->studentNotification();
if ($sendMessage)
{
echo "Success";
/* $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*/
}
}
/*
* delete student set fees details
* created by kms
* */
public function deleteSetFeesDetails_post(){
$details['FeesID'] = $this->post('feesAssignID');
$deleteSetFeesDetails = $this->Fees_model->deleteSetFees($details);
if ($deleteSetFeesDetails)
{
$deleteSetFeesDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($deleteSetFeesDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
}
else
{
// Set the response and exit
$this->response([
'message' => 'Something went wrong.please try again!',
'status' => REST_Controller::HTTP_NOT_FOUND
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
}