292 lines
13 KiB
PHP
Executable File
292 lines
13 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: karthi
|
|
* Date: 12/21/17
|
|
* Time: 3:46 PM
|
|
*/
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class Studentview_model extends CI_Model
|
|
{
|
|
|
|
/*
|
|
* student details
|
|
* created by kms
|
|
* */
|
|
|
|
// get student list based on login user
|
|
public function getStudentInfo($requestedBy=null)
|
|
{
|
|
$this->db->select('ST.*');
|
|
$this->db->from( LOGIN . ' as LO');
|
|
$this->db->join( STUDENTS . ' as ST', 'LO.StaffID = ST.StudentID');
|
|
$this->db->where('LO.ID', $requestedBy);
|
|
$studentDetails = $this->db->get()->first_row();
|
|
if($studentDetails){
|
|
$result['studentStatus'] = true;
|
|
$result['studentDetails'] = $studentDetails;
|
|
// get student course details
|
|
$result['courseDetails'] = $this->getStudentCourse($studentDetails->StudentID);
|
|
}
|
|
else{
|
|
$result['studentStatus'] = false;
|
|
$result['studentInfo'] = "";
|
|
}
|
|
return $result;
|
|
|
|
}
|
|
/*
|
|
* get student course details
|
|
* created by kms
|
|
* */
|
|
public function getStudentCourse($studentId=null){
|
|
|
|
$this->db->select('SCU.EnrollmentID,CU.CourseID,CU.CourseName,US.UniversityID,US.UniversityName,BA.BatchName');
|
|
$this->db->from( STUDENTCOURSE . ' as SCU');
|
|
$this->db->join( COURSE . ' as CU', 'CU.CourseID = SCU.CourseID');
|
|
$this->db->join( UNIVERSITY . ' as US', 'US.UniversityID = SCU.UniversityID');
|
|
$this->db->join( BATCH . ' as BA', 'BA.BatchCode = SCU.BatchCode');
|
|
$this->db->where('SCU.StudentID', $studentId);
|
|
$courseDetails = $this->db->get();
|
|
if($courseDetails->result()){
|
|
$studentCourseStatus['status'] = true;
|
|
foreach ($courseDetails->result() as $row){
|
|
$fetchData['CourseID']=$row->CourseID;
|
|
$fetchData['CourseName']=$row->CourseName;
|
|
$fetchData['UniversityID']=$row->UniversityID;
|
|
$fetchData['UniversityName']=$row->UniversityName;
|
|
$fetchData['BatchName']=$row->BatchName;
|
|
$fetchData['EnrollmentID']=$row->EnrollmentID;
|
|
// get student fees details
|
|
$fetchData['feesDetails']=$this->getStudentFeesDetails($studentId,$row->CourseID);
|
|
// get student boollet details
|
|
$fetchData['studyMaterialDetails']=$this->getStudentMaterialDetails($studentId,$row->CourseID);
|
|
// get application details
|
|
$fetchData['applicationDetails']=$this->getStudentCertificateDetails($studentId,$row->CourseID);
|
|
// get student Mark crad details
|
|
$fetchData['markCardDetails']=$this->getMarkcardDetails($studentId,$row->CourseID);
|
|
|
|
$CourseArray[]=$fetchData;
|
|
|
|
|
|
}
|
|
$studentCourseStatus['courseStatus'] = $CourseArray;
|
|
}
|
|
else{
|
|
$studentCourseStatus['status'] = false;
|
|
}
|
|
|
|
return $studentCourseStatus;
|
|
}
|
|
|
|
/*
|
|
* get student fees details
|
|
* created by kms
|
|
* */
|
|
public function getStudentFeesDetails($studentID=null,$courseID=null){
|
|
$this->db->distinct();
|
|
$this->db->select('SFS.FeesID,SFS.FeesType,SFS.SessionName,SFS.RollNo,ifnull(SFS.CourseFees,0) as CourseFees,ifnull(SFS.STFOrWR,0) as STFOrWR,ifnull(SFS.Waiver,0) as Waiver,ifnull(SFS.Others,0) as Others,CF.Sem_Year');
|
|
$this->db->from(STUDENTS_FEES_STATUS.' as SFS');
|
|
$this->db->join(STUDENTS_FEES_PAID.' as SFP','SFP.FeesId = SFS.FeesID','left');
|
|
$this->db->join(COURSE_FEES.' as CF', 'CF.ID = SFS.FeesType');
|
|
$this->db->where('SFS.CourseID', $courseID);
|
|
$this->db->where('SFS.StudentID', $studentID);
|
|
$this->db->order_by('SFS.FeesID', 'ASC');
|
|
$getFeeDetails = $this->db->get();
|
|
if($getFeeDetails->result()){
|
|
foreach ($getFeeDetails->result() as $feeRow){
|
|
$storePaidDetails['FeesID'] = $feeRow->FeesID;
|
|
$storePaidDetails['FeesName'] = $feeRow->Sem_Year;
|
|
$storePaidDetails['CourseFees'] = $feeRow->CourseFees;
|
|
$storePaidDetails['SessionName'] = $feeRow->SessionName;
|
|
$storePaidDetails['RollNo'] = $feeRow->RollNo;
|
|
$storePaidDetails['STFOrWR'] = $feeRow->STFOrWR;
|
|
$storePaidDetails['Waiver'] = $feeRow->Waiver;
|
|
$storePaidDetails['Others'] = $feeRow->Others;
|
|
$storePaidDetails['PayableAmount'] = $feeRow->CourseFees+$feeRow->STFOrWR+$feeRow->Others-$feeRow->Waiver;
|
|
|
|
$this->db->select('ifnull(SUM((BillAmount)),0) as PaidBillAmount');
|
|
$this->db->where('FeesId',$feeRow->FeesID);
|
|
$paidBillAmount = $this->db->get(STUDENTS_FEES_PAID)->result();
|
|
$storePaidDetails['PaidBillAmount']=$paidBillAmount[0]->PaidBillAmount;
|
|
if($paidBillAmount[0]->PaidBillAmount > $storePaidDetails['PayableAmount']){
|
|
$storePaidDetails['BalanceAmount']=0;
|
|
|
|
}
|
|
else{
|
|
$storePaidDetails['BalanceAmount']=$storePaidDetails['PayableAmount'] - $paidBillAmount[0]->PaidBillAmount;
|
|
}
|
|
|
|
// for get paid bill details
|
|
$this->db->select('ifnull(SUM((BillAmount)),0) as BillAmount,BillNO,BillDate,ModeOfPayment');
|
|
$this->db->where('FeesId',$feeRow->FeesID);
|
|
$this->db->order_by('ID',"ASC");
|
|
$this->db->group_by('BillNO');
|
|
$storePaidDetails['paidDetails']=$this->db->get(STUDENTS_FEES_PAID)->result();
|
|
$mergeResult[]=$storePaidDetails;
|
|
|
|
}
|
|
|
|
$getStudentDefaultFees = $this->getDefaultCourseFees($studentID,$courseID);
|
|
if($getStudentDefaultFees != false){
|
|
return array_merge($mergeResult,$getStudentDefaultFees);
|
|
}
|
|
else{
|
|
return$mergeResult;
|
|
}
|
|
|
|
}
|
|
else {
|
|
return false;
|
|
}
|
|
|
|
}
|
|
/*
|
|
* get default course details
|
|
* created by kms
|
|
* */
|
|
public function getDefaultCourseFees($studentID=null,$courseID=null){
|
|
$serachArray = ["PC","TC","DC","MC","OTHER"];
|
|
$this->db->distinct();
|
|
$this->db->select('SFS.FeesID,SFS.FeesType,SFS.SessionName,SFS.RollNo,ifnull(SFS.CourseFees,0) as CourseFees,ifnull(SFS.STFOrWR,0) as STFOrWR,ifnull(SFS.Waiver,0) as Waiver,ifnull(SFS.Others,0) as Others');
|
|
$this->db->from(STUDENTS_FEES_STATUS.' as SFS');
|
|
$this->db->join(STUDENTS_FEES_PAID.' as SFP','SFP.FeesId = SFS.FeesID','left');
|
|
//$this->db->join(COURSE_FEES.' as CF', 'CF.ID = SFS.FeesType');
|
|
$this->db->where('SFS.CourseID', $courseID);
|
|
$this->db->where('SFS.StudentID', $studentID);
|
|
$this->db->where_in('SFS.FeesType', $serachArray);
|
|
$this->db->order_by('SFS.FeesID', 'ASC');
|
|
$getFeeDetails = $this->db->get();
|
|
if($getFeeDetails->result()){
|
|
foreach ($getFeeDetails->result() as $feeRow){
|
|
$storePaidDetails['FeesID'] = $feeRow->FeesID;
|
|
$storePaidDetails['FeesName'] = $feeRow->FeesType;
|
|
$storePaidDetails['CourseFees'] = $feeRow->CourseFees;
|
|
$storePaidDetails['SessionName'] = $feeRow->SessionName;
|
|
$storePaidDetails['RollNo'] = $feeRow->RollNo;
|
|
$storePaidDetails['STFOrWR'] = $feeRow->STFOrWR;
|
|
$storePaidDetails['Waiver'] = $feeRow->Waiver;
|
|
$storePaidDetails['Others'] = $feeRow->Others;
|
|
$storePaidDetails['PayableAmount'] = $feeRow->CourseFees+$feeRow->STFOrWR+$feeRow->Others-$feeRow->Waiver;
|
|
|
|
$this->db->select('ifnull(SUM((BillAmount)),0) as PaidBillAmount');
|
|
$this->db->where('FeesId',$feeRow->FeesID);
|
|
$paidBillAmount = $this->db->get(STUDENTS_FEES_PAID)->result();
|
|
$storePaidDetails['PaidBillAmount']=$paidBillAmount[0]->PaidBillAmount;
|
|
if($paidBillAmount[0]->PaidBillAmount > $storePaidDetails['PayableAmount']){
|
|
$storePaidDetails['BalanceAmount']=0;
|
|
|
|
}
|
|
else{
|
|
$storePaidDetails['BalanceAmount']=$storePaidDetails['PayableAmount'] - $paidBillAmount[0]->PaidBillAmount;
|
|
}
|
|
|
|
// for get paid bill details
|
|
$this->db->select('ifnull(SUM((BillAmount)),0) as BillAmount,BillNO,BillDate,ModeOfPayment');
|
|
$this->db->where('FeesId',$feeRow->FeesID);
|
|
$this->db->order_by('ID',"ASC");
|
|
$this->db->group_by('BillNO');
|
|
$storePaidDetails['paidDetails']=$this->db->get(STUDENTS_FEES_PAID)->result();
|
|
$mergeResult[]=$storePaidDetails;
|
|
|
|
}
|
|
|
|
return $mergeResult;
|
|
}
|
|
else {
|
|
return false;
|
|
}
|
|
|
|
}
|
|
|
|
/*
|
|
* get student study material details
|
|
* created by kms
|
|
* */
|
|
public function getStudentMaterialDetails($studentID=null,$courseID=null){
|
|
$this->db->select('SMS.CourseID,SMS.SDate,SMS.Comments,CF.Sem_Year,PLD.ListName');
|
|
$this->db->from(STUDY_MATERIAL_STATUS.' as SMS');
|
|
$this->db->join(COURSE_FEES.' as CF','CF.ID = SMS.CourseID');
|
|
$this->db->join(COURSE.' as CU', 'CU.CourseID = CF.CourseID');
|
|
$this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = SMS.ListCode');
|
|
$this->db->where('CU.CourseID', $courseID);
|
|
$this->db->where('SMS.StudentID', $studentID);
|
|
$this->db->order_by('SMS.ID', 'DESC');
|
|
$getMaterialDetails = $this->db->get();
|
|
if ($getMaterialDetails->result()){
|
|
return $getMaterialDetails->result();
|
|
}
|
|
else{
|
|
return false;
|
|
}
|
|
}
|
|
/*
|
|
* get student certificate details
|
|
* created by kms
|
|
* */
|
|
public function getStudentCertificateDetails($studentID=null,$courseID=null){
|
|
$this->db->select('AS.CertificationNo,AS.AppDate,AS.Comments,CM.CertificateName,PLD.ListName');
|
|
$this->db->from(APPLICATION_STATUS.' as AS');
|
|
$this->db->join(CERTIFICATION_MASTER.' as CM','CM.CertificationID = AS.CertificationType');
|
|
//$this->db->join(COURSE_FEES.' as CF','CF.ID = AS.CourseID');
|
|
$this->db->join(COURSE.' as CU', 'CU.CourseID = AS.CourseID');
|
|
$this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = AS.ListCode');
|
|
$this->db->where('CU.CourseID', $courseID);
|
|
$this->db->where('AS.StudentID', $studentID);
|
|
$this->db->order_by('AS.ID', 'DESC');
|
|
$getCertDetails = $this->db->get();
|
|
|
|
if($getCertDetails->result()){
|
|
return $getCertDetails->result();
|
|
}
|
|
|
|
else {
|
|
return false;
|
|
}
|
|
|
|
}
|
|
/*
|
|
* get mark card details
|
|
* created by kms
|
|
* */
|
|
public function getMarkcardDetails($studentID=null,$courseID=null){
|
|
|
|
$this->db->select('CS.CourseID,CS.CertificationNo,CS.CDate,CS.Comments,CS.CertificationType as CertificateName,CF.Sem_Year,PLD.ListName');
|
|
$this->db->from(CERTIFICATION_STATUS.' as CS');
|
|
$this->db->join(COURSE_FEES.' as CF','CF.ID = CS.CourseID');
|
|
$this->db->join(COURSE.' as CU', 'CU.CourseID = CF.CourseID');
|
|
$this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = CS.ListCode');
|
|
$this->db->where('CU.CourseID', $courseID);
|
|
$this->db->where('CS.StudentID', $studentID);
|
|
$this->db->where_in('CS.CertificationType', 'MARK CARD');
|
|
$this->db->order_by('CS.ID', 'DESC');
|
|
$getMarkDetails = $this->db->get();
|
|
if ($getMarkDetails->result()){
|
|
return $getMarkDetails->result();
|
|
}
|
|
else{
|
|
return false;
|
|
}
|
|
}
|
|
/*
|
|
* get student application details
|
|
* created by kms*/
|
|
public function getStudentApplicationDetails($studentID=null,$courseID=null){
|
|
$this->db->select('AS.CourseID,AS.AppDate,AS.Comments,CF.Sem_Year,PLD.ListName');
|
|
$this->db->from(APPLICATION_STATUS.' as AS');
|
|
$this->db->join(COURSE_FEES.' as CF','CF.ID = AS.CourseID');
|
|
$this->db->join(COURSE.' as CU', 'CU.CourseID = CF.CourseID');
|
|
$this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = AS.ListCode');
|
|
$this->db->where('CU.CourseID', $courseID);
|
|
$this->db->where('AS.StudentID', $studentID);
|
|
$this->db->order_by('AS.ID', 'DESC');
|
|
$getAppDetails = $this->db->get();
|
|
if ($getAppDetails->result()){
|
|
return $getAppDetails->result();
|
|
}
|
|
else{
|
|
return false;
|
|
}
|
|
}
|
|
} |