433 lines
20 KiB
PHP
Executable File
433 lines
20 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,$requestFrom=null)
|
|
{
|
|
if($requestFrom =='2'){
|
|
$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,$requestFrom);
|
|
}
|
|
else{
|
|
$result['studentStatus'] = false;
|
|
$result['studentInfo'] = "";
|
|
}
|
|
}
|
|
else if($requestFrom =='1'){
|
|
$this->db->select('ST.*');
|
|
$this->db->from( LOGIN . ' as LO');
|
|
$this->db->join( STUDENTS . ' as ST', 'LO.StaffID = ST.StudentID');
|
|
$this->db->where('ST.StudentID', $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,$requestFrom);
|
|
}
|
|
else{
|
|
$result['studentStatus'] = false;
|
|
$result['studentInfo'] = "";
|
|
}
|
|
}
|
|
else if ($requestFrom =='3'){
|
|
$this->db->select('ST.*');
|
|
$this->db->from( LOGIN . ' as LO');
|
|
$this->db->join( STUDENTS . ' as ST', 'LO.StaffID = ST.StudentID');
|
|
$this->db->where('ST.MobileNumber', $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,$requestFrom);
|
|
}
|
|
else{
|
|
$result['studentStatus'] = false;
|
|
$result['studentInfo'] = "";
|
|
}
|
|
}
|
|
|
|
return $result;
|
|
|
|
}
|
|
/*
|
|
* get student course details
|
|
* created by kms
|
|
* */
|
|
public function getStudentCourse($studentId=null,$requestFrom=null){
|
|
|
|
$this->db->select('SCU.EnrollmentID,CU.CourseID,CU.CourseName,US.UniversityID,US.UniversityName,US.UniversityShortName');
|
|
$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( SESSIONMASTER . ' as SM', 'SM.SessionID = SCU.SessionID');
|
|
$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['UniveShortName'] = $row->UniversityShortName;
|
|
// $fetchData['SessionName']=$row->SessionName;
|
|
$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
|
|
if($requestFrom!='2'){
|
|
$fetchData['applicationDetails']=$this->getStudentApplicationDetails($studentId,$row->CourseID);
|
|
$fetchData['answerbookletDetails']=$this->getStudentAnswerbookletDetails($studentId,$row->CourseID);
|
|
|
|
|
|
}
|
|
$fetchData['certificateDetails']=$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){
|
|
$serachArray=[WAIVER,REFERRAL];
|
|
|
|
$this->db->distinct();
|
|
$this->db->select('SFS.FeesID,SFS.FeesType,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,CF.FeesType as CourseFeesType,SM.SessionName,SM1.SessionName as ToSessionName,CF.ProgramType,BA.BatchName,BA.BatchDate');
|
|
$this->db->from(STUDENTS_FEES_STATUS.' as SFS');
|
|
$this->db->join(SESSIONMASTER.' as SM', 'SM.SessionID = SFS.SessionName');
|
|
$this->db->join(SESSIONMASTER.' as SM1', 'SM1.SessionID = SFS.ToSessionName','left');
|
|
$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->join(BATCH.' as BA', 'BA.BatchCode = SFS.BatchCode');
|
|
$this->db->where('SFS.CourseID', $courseID);
|
|
$this->db->where('SFS.StudentID', $studentID);
|
|
$this->db->where('SFP.IsActive', '1');
|
|
$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['ProgramType'] = $feeRow->ProgramType;
|
|
$storePaidDetails['SessionName'] = $feeRow->SessionName;
|
|
if($feeRow->ToSessionName=='' || $feeRow->ToSessionName==null){
|
|
$storePaidDetails['ToSessionName'] = "Not Applicable";
|
|
}
|
|
else{
|
|
$storePaidDetails['ToSessionName'] = $feeRow->ToSessionName;
|
|
}
|
|
|
|
$storePaidDetails['RollNo'] = $feeRow->RollNo;
|
|
$storePaidDetails['STFOrWR'] = $feeRow->STFOrWR;
|
|
$storePaidDetails['Waiver'] = $feeRow->Waiver;
|
|
$storePaidDetails['Others'] = $feeRow->Others;
|
|
$storePaidDetails['CourseFeesType'] = $feeRow->CourseFeesType;
|
|
$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);
|
|
$this->db->where('IsActive', '1');
|
|
$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;
|
|
}
|
|
|
|
// sepearte for student waiver and referral bill list
|
|
$this->db->select('ifnull(SUM((BillAmount)),0) as StudentWaiverRefAmount');
|
|
$this->db->where('FeesId',$feeRow->FeesID);
|
|
$this->db->where_in('ModeOfPayment',$serachArray);
|
|
$studentWaiverRefAmount = $this->db->get(STUDENTS_FEES_PAID)->result();
|
|
|
|
$storePaidDetails['StudentWaiverRefAmount']=$studentWaiverRefAmount[0]->StudentWaiverRefAmount;
|
|
|
|
$this->db->select('ifnull(SUM((BillAmount)),0) as StudentPaidAmount');
|
|
$this->db->where('FeesId',$feeRow->FeesID);
|
|
$this->db->where('ModeOfPayment !=',WAIVER);
|
|
$this->db->where('ModeOfPayment !=',REFERRAL);
|
|
$this->db->where('IsActive', '1');
|
|
$studentPaidAmount = $this->db->get(STUDENTS_FEES_PAID)->result();
|
|
|
|
$storePaidDetails['StudentPaidAmount']=$studentPaidAmount[0]->StudentPaidAmount;
|
|
$storePaidDetails['BatchName'] = $feeRow->BatchName;
|
|
$storePaidDetails['BatchDate'] = $feeRow->BatchDate;
|
|
|
|
// for get paid bill details
|
|
// for get paid bill details
|
|
$this->db->select('ifnull(SUM((BillAmount)),0) as BillAmount,BillNO,BillDate,ModeOfPayment,ReceiptNo,BR.BranchName,BR.Address,BR.LogoPath,STF.Firstname as ReceivedBy');
|
|
$this->db->from(STUDENTS_FEES_PAID.' as SFP');
|
|
$this->db->join(BRANCH.' as BR','BR.BranchCode = SFP.UpdatedBy','left');
|
|
$this->db->join(LOGIN.' as LO','LO.ID = SFP.CreatedBy');
|
|
$this->db->join(STAFF.' as STF','STF.StaffID = LO.StaffID');
|
|
$this->db->where('SFP.FeesId',$feeRow->FeesID);
|
|
$this->db->where('SFP.IsActive', '1');
|
|
$this->db->order_by('SFP.ID',"ASC");
|
|
$this->db->group_by('SFP.BillNO');
|
|
$storePaidDetails['paidDetails']=$this->db->get()->result();
|
|
// for installment details
|
|
$this->load->model('Fees_status_model');
|
|
|
|
$InstallemtResult = $this->Fees_status_model->getInstallmentDetails($feeRow->FeesID);
|
|
|
|
if($InstallemtResult != false){
|
|
$storePaidDetails['InstallmentDetails']=$InstallemtResult;
|
|
}
|
|
else{
|
|
|
|
$storePaidDetails['InstallmentDetails']="";
|
|
|
|
|
|
}
|
|
$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('SFP.IsActive', '1');
|
|
$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['ProgramType'] = $feeRow->FeesType;
|
|
$storePaidDetails['CourseFees'] = $feeRow->CourseFees;
|
|
$storePaidDetails['SessionName'] = "Not Applicable";
|
|
$storePaidDetails['ToSessionName'] = "Not Applicable";
|
|
$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);
|
|
$this->db->where('IsActive', '1');
|
|
$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;
|
|
}
|
|
$storePaidDetails['BatchName'] = "Not Applicable";
|
|
$storePaidDetails['BatchDate'] = "";
|
|
|
|
// for get paid bill details
|
|
$this->db->select('ifnull(SUM((BillAmount)),0) as BillAmount,BillNO,BillDate,ModeOfPayment,ReceiptNo,BR.BranchName,BR.Address,BR.LogoPath,STF.Firstname as ReceivedBy');
|
|
$this->db->from(STUDENTS_FEES_PAID.' as SFP');
|
|
$this->db->join(BRANCH.' as BR','BR.BranchCode = SFP.UpdatedBy','left');
|
|
$this->db->join(LOGIN.' as LO','LO.ID = SFP.CreatedBy');
|
|
$this->db->join(STAFF.' as STF','STF.StaffID = LO.StaffID');
|
|
$this->db->where('SFP.FeesId',$feeRow->FeesID);
|
|
$this->db->where('SFP.IsActive', '1');
|
|
$this->db->order_by('SFP.ID',"ASC");
|
|
$this->db->group_by('SFP.BillNO');
|
|
$storePaidDetails['paidDetails']=$this->db->get()->result();
|
|
$storePaidDetails['InstallmentDetails']="";
|
|
$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,SMS.Sem,CF.Sem_Year,CF.FeesType,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->where('CM.CertificateName !=', APPLICATION_CONST);
|
|
$this->db->order_by('AS.ID', 'DESC');
|
|
$getCertDetails = $this->db->get();
|
|
|
|
if($getCertDetails->result()){
|
|
return $getCertDetails->result();
|
|
}
|
|
|
|
else {
|
|
return false;
|
|
}
|
|
|
|
}
|
|
/*
|
|
* get student applications details
|
|
* created by kms
|
|
* */
|
|
public function getStudentApplicationDetails($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->where('CM.CertificateName', APPLICATION_CONST);
|
|
$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,CF.FeesType,CS.Sem,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 answer booklet details
|
|
* created by kms
|
|
* */
|
|
public function getStudentAnswerbookletDetails($studentID=null,$courseID=null){
|
|
$this->db->select('ABT.CourseID,ABT.AnsDate,ABT.Comments,CF.Sem_Year,CF.FeesType,ABT.Sem,PLD.ListName');
|
|
$this->db->from(ANSWER_BOOKLET.' as ABT');
|
|
$this->db->join(COURSE_FEES.' as CF','CF.ID = ABT.CourseID');
|
|
$this->db->join(COURSE.' as CU', 'CU.CourseID = CF.CourseID');
|
|
$this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = ABT.ListCode');
|
|
$this->db->where('CU.CourseID', $courseID);
|
|
$this->db->where('ABT.StudentID', $studentID);
|
|
$this->db->order_by('ABT.ID', 'DESC');
|
|
$getBookletDetails = $this->db->get();
|
|
if ($getBookletDetails->result()){
|
|
return $getBookletDetails->result();
|
|
}
|
|
else{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
} |