enrolment upload model

This commit is contained in:
gandhimathi 2018-09-04 10:36:07 +05:30
parent 5c60bda053
commit 990395d7b4

View File

@ -452,25 +452,31 @@ class Receive_Enrolment_Fees_Univ_model extends CI_Model {
$results['stuFeeList_details'] = "details updated successfully.";
return $results;
}
public function getStudentUnivFeeCompareDetails($univCode=null,$session=null){
$this->db->select('t1.FormID, t1.FormType, t1.SemesterYear, t1.EnrolmentNo,t1.CourseName,t1.RollNo, t4.*,t5.UniversityID, t5.UniversityName,t3.CourseID,t2.Amount as UniversityPaidAmount');
$this->db->from(ENROLMENTRECEIVEDFROMUNIV.' as t1');
$this->db->join(STUDENTCOURSE.' as t3', 't3.EnrollmentID = t1.EnrolmentNo');
$this->db->join(STUDENTS.' as t4', 't4.StudentID = t3.StudentID');
$this->db->join(UNIVERSITY.' as t5', 't5.UniversityID = t3.UniversityID');
$this->db->join(FORMFEESRECEIVEDFROMUNIV.' as t2', 't2.FormID = t1.FormID','left');
//$this->db->where('t1.CourseCode', $courseCode);
$this->db->where('t1.UniversityCode', $univCode);
$this->db->distinct('ENU.FormID');
$this->db->select('ENU.FormID, ENU.FormType, ENU.SemesterYear, ENU.EnrolmentNo,ENU.RollNo, ST.*,UN.UniversityID, UN.UniversityName,CM.CourseID,CM.CourseCode,CM.CourseName');
$this->db->from(ENROLMENTRECEIVEDFROMUNIV.' as ENU');
$this->db->join(STUDENTCOURSE.' as STC', 'STC.EnrollmentID = ENU.EnrolmentNo');
$this->db->join(COURSE.' as CM', 'CM.CourseID = STC.CourseID');
$this->db->join(STUDENTS.' as ST', 'ST.StudentID = STC.StudentID');
$this->db->join(UNIVERSITY.' as UN', 'UN.UniversityID = STC.UniversityID');
// $this->db->join(FORMFEESRECEIVEDFROMUNIV.' as t2', 't2.FormID = t1.FormID','left');
//$this->db->where('t1.CourseCode', $courseCode);
$this->db->where('ENU.UniversityCode', $univCode);
$details = $this->db->get();
$detailsList = $details->result();
if($detailsList){
foreach ($detailsList as $fetchStudentRow){
$details = $this->db->get();
$detailsList = $details->result();
if($detailsList){
foreach ($detailsList as $fetchStudentRow){
// form id bases get student paid details
$getStudentsetFeesDetails=$this->getStudentsetFeesDetails($fetchStudentRow->StudentID,$fetchStudentRow->CourseID,$fetchStudentRow->SemesterYear,$session);
if(isset($getStudentsetFeesDetails['status']) AND $getStudentsetFeesDetails['status']==true ){
$formResult['SessionName']=$getStudentsetFeesDetails['SessionName'];
$formResult['FormID']=$fetchStudentRow->FormID;
$formResult['FormType']=$fetchStudentRow->FormType;
$formResult['SemesterYear']=$fetchStudentRow->SemesterYear;
$formResult['EnrolmentNo']=$fetchStudentRow->EnrolmentNo;
$formResult['CourseCode']=$fetchStudentRow->CourseCode;
$formResult['CourseName']=$fetchStudentRow->CourseName;
$formResult['RollNo']=$fetchStudentRow->RollNo;
$formResult['StudentID']=$fetchStudentRow->StudentID;
@ -491,179 +497,90 @@ class Receive_Enrolment_Fees_Univ_model extends CI_Model {
$formResult['Qualification']=$fetchStudentRow->Qualification;
$formResult['UniversityID']=$fetchStudentRow->UniversityID;
$formResult['UniversityName']=$fetchStudentRow->UniversityName;
$formResult['UniversityPaidAmount']=$fetchStudentRow->UniversityPaidAmount;
// form id bases get student paid details
$getStudentPaidDetails=$this->getFormIDStudentPaidDetails($fetchStudentRow->StudentID,$fetchStudentRow->CourseID,$fetchStudentRow->SemesterYear);
if(sizeof($getStudentPaidDetails)!=0){
$formResult['StudentPaidAmount']=$getStudentPaidDetails['StudentPaidAmount'];
}
else{
$formResult['StudentPaidAmount']='';
}
$mergeFormDetails[]=$formResult;
$mergeFormDetails[]=$formResult;
}
$resultArr['studentFeeCompareDetails'] = $mergeFormDetails;
$resultArr['formTypeStatus'] = true;
$resultArr['message'] = "Successfully data generated";
} else {
$resultArr['studentFeeCompareDetails'] = [];
$resultArr['formTypeStatus'] = false;
$resultArr['message'] = "No record found";
/* if(sizeof($getStudentPaidDetails)!=0){
$formResult['StudentPaidAmount']=$getStudentPaidDetails['StudentPaidAmount'];
}
else{
$formResult['StudentPaidAmount']='';
}*/
}
$resultArr['studentFeeCompareDetails'] = $mergeFormDetails;
$resultArr['formTypeStatus'] = true;
$resultArr['message'] = "Successfully data generated";
} else {
$resultArr['studentFeeCompareDetails'] = [];
$resultArr['formTypeStatus'] = false;
$resultArr['message'] = "No record found";
}
return $resultArr;
}
/*form id bases get student paid details for getStudentUnivFeeCompareDetails methods*/
public function getFormIDStudentPaidDetails($studentID=null,$courseID=null,$sem=null){
public function getStudentsetFeesDetails($studentID=null,$courseID=null,$sem=null,$session=null){
// create array for find sem value
$keyArray = array(0 => 'SEM1', 1 => 'SEM2', 2 => 'SEM3', 3 => 'SEM4',4 => 'SEM5',5 => 'SEM6',6 => 'SEM7',7 => 'SEM8',8 => 'YEAR1',9 => 'YEAR2',10 => 'YEAR3',11 => 'YEAR4',12 => "DMC CHANGE SEM1",13 => "DMC CHANGE SEM2",14 => "DMC CHANGE SEM3",15 => "DMC CHANGE SEM4",16 => "DMC CHANGE SEM5",17 => "DMC CHANGE SEM6",18 => "DMC CHANGE SEM7",19 => "DMC CHANGE SEM8",20 => "DMC CHANGE YEAR1",21 => "DMC CHANGE YEAR2",22 => "DMC CHANGE YEAR3",23 => "DMC CHANGE YEAR4");
$valueArray = array("1","2","3","4","5","6","7","8","1","2","3","4","1","2","3","4","5","6","7","8","1","2","3","4");
$feesArray=array();
$this->db->select("CF.ID,CF.ProgramType,CF.Sem_Year");
$this->db->from(COURSE_FEES . ' as CF');
$this->db->where('CF.CourseID', $courseID);
$courseFeesDetails = $this->db->get();
//this is for sem year type check fees
if ($courseFeesDetails->num_rows() > 1) {
foreach ($courseFeesDetails->result() as $fetchRow) {
$serachKey = array_search(strtoupper($fetchRow->Sem_Year), $keyArray);
if ($valueArray[$serachKey] == $sem) {
$this->db->select("SUM(BillAMount) as StudentPaidAmount");
$this->db->from(STUDENTS_FEES_STATUS . ' as SFS');
$this->db->join(STUDENTS_FEES_PAID . ' as SFP', 'SFP.FeesId = SFS.FeesID');
$this->db->where('SFS.FeesType', $fetchRow->ID);
$this->db->where('SFS.StudentID', $studentID);
$this->db->where('SFP.IsActive', '1');
$feesDetails = $this->db->get()->last_row();
if ($feesDetails) {
$feesArray['StudentPaidAmount'] = $feesDetails->StudentPaidAmount;
break;
} else {
$feesArray['StudentPaidAmount'] = 0;
break;
}
}
}
}
else if($courseFeesDetails->num_rows()==1){
foreach ($courseFeesDetails->result() as $fetchRow){
$this->db->select("SUM(BillAMount) as StudentPaidAmount");
$this->db->from(STUDENTS_FEES_STATUS.' as SFS');
$this->db->join(STUDENTS_FEES_PAID.' as SFP', 'SFP.FeesId = SFS.FeesID');
$this->db->where('SFS.FeesType',$fetchRow->ID);
$this->db->where('SFS.StudentID',$studentID);
$this->db->where('SFP.IsActive','1');
$this->db->from(COURSE_FEES . ' as CF');
$this->db->where('CF.CourseID', $courseID);
$courseFeesDetails = $this->db->get();
//this is for sem year type check fees
if ($courseFeesDetails->num_rows() > 1) {
foreach ($courseFeesDetails->result() as $fetchRow) {
$serachKey = array_search(strtoupper($fetchRow->Sem_Year), $keyArray);
if ($valueArray[$serachKey] == $sem) {
$this->db->select("SM.SessionName,SM.SessionID");
$this->db->from(STUDENTS_FEES_STATUS . ' as SFS');
$this->db->join(SESSIONMASTER . ' as SM' , 'SM.SessionID = SFS.SessionName');
$this->db->where('SFS.FeesType', $fetchRow->ID);
$this->db->where('SFS.StudentID', $studentID);
$this->db->where('SFS.SessionName', $session);
$feesDetails = $this->db->get()->last_row();
if ($feesDetails) {
$feesArray['StudentPaidAmount'] = $feesDetails->StudentPaidAmount;
$feesArray['status'] = true;
$feesArray['SessionName'] = $feesDetails->SessionName;
$feesArray['SessionID'] = $feesDetails->SessionID;
break;
} else {
$feesArray['StudentPaidAmount'] = 0;
break;
}
}
}
else{
$feesArray['StudentPaidAmount'] = 0;
}
return $feesArray;
}
/*
* form id bases get fees compare details
* created by kms
* */
public function getFormIDFeeDetails($serachForm=null){
// create array for find sem value
$keyArray = array(0 => 'SEM1', 1 => 'SEM2', 2 => 'SEM3', 3 => 'SEM4',4 => 'SEM5',5 => 'SEM6',6 => 'SEM7',7 => 'SEM8',8 => 'YEAR1',9 => 'YEAR2',10 => 'YEAR3',11 => 'YEAR4',12 => "DMC CHANGE SEM1",13 => "DMC CHANGE SEM2",14 => "DMC CHANGE SEM3",15 => "DMC CHANGE SEM4",16 => "DMC CHANGE SEM5",17 => "DMC CHANGE SEM6",18 => "DMC CHANGE SEM7",19 => "DMC CHANGE SEM8",20 => "DMC CHANGE YEAR1",21 => "DMC CHANGE YEAR2",22 => "DMC CHANGE YEAR3",23 => "DMC CHANGE YEAR4");
$valueArray = array("1","2","3","4","5","6","7","8","1","2","3","4","1","2","3","4","5","6","7","8","1","2","3","4");
if($serachForm['FormID']!=''){
$this->db->select("ENU.FormID,ENU.SemesterYear,STC.StudentID,STC.BranchID,CF.ID,CF.ProgramType,CF.Sem_Year,FFRU.Amount as UniversityPaidAmount");
$this->db->from(ENROLMENTRECEIVEDFROMUNIV.' as ENU');
$this->db->join(STUDENTCOURSE.' as STC', 'STC.EnrollmentID = ENU.EnrolmentNo');
$this->db->join(COURSE_FEES.' as CF', 'CF.CourseID = STC.CourseID');
$this->db->join(FORMFEESRECEIVEDFROMUNIV.' as FFRU', 'FFRU.FormID = ENU.FormID');
$this->db->where('ENU.FormID',$serachForm['FormID']);
$this->db->where('ENU.EnrolmentNo',$serachForm['EnrolmentNo']);
$studentCourseDetails = $this->db->get();
//this is for sem year type check fees
if($studentCourseDetails->num_rows()>1){
foreach ($studentCourseDetails->result() as $fetchRow){
$serachKey= array_search(strtoupper($fetchRow->Sem_Year),$keyArray);
if($valueArray[$serachKey]==$fetchRow->SemesterYear){
$this->db->select("SUM(BillAMount) as StudentPaidAmount");
$this->db->from(STUDENTS_FEES_STATUS.' as SFS');
$this->db->join(STUDENTS_FEES_PAID.' as SFP', 'SFP.FeesId = SFS.FeesID');
$this->db->where('SFS.FeesType',$fetchRow->ID);
$this->db->where('SFS.StudentID',$fetchRow->StudentID);
$this->db->where('SFP.IsActive','1');
$feesDetails = $this->db->get()->last_row();
if($feesDetails){
$feesArray['status']=true;
$feesArray['Message']="Fees paid both student and university";
$feesArray['Type']=$fetchRow->Sem_Year;
$feesArray['UniversityPaidAmount']=$fetchRow->UniversityPaidAmount;
$feesArray['StudentPaidAmount']=$feesDetails->StudentPaidAmount;
break;
}
else{
$feesArray['status']=true;
$feesArray['Message']="University fees paid and student fees pending";
$feesArray['Type']=$fetchRow->Sem_Year;
$feesArray['UniversityPaidAmount']=$fetchRow->UniversityPaidAmount;
$feesArray['StudentPaidAmount']=0;
$feesArray['status'] = false;
break;
}
}
}
}
else if($studentCourseDetails->num_rows()==1){
foreach ($studentCourseDetails->result() as $fetchRow){
$this->db->select("SUM(BillAMount) as StudentPaidAmount");
$this->db->from(STUDENTS_FEES_STATUS.' as SFS');
$this->db->join(STUDENTS_FEES_PAID.' as SFP', 'SFP.FeesId = SFS.FeesID');
$this->db->where('SFS.FeesType',$fetchRow->ID);
$this->db->where('SFS.StudentID',$fetchRow->StudentID);
$this->db->where('SFP.IsActive','1');
$feesDetails = $this->db->get()->last_row();
if($feesDetails){
$feesArray['status']=true;
$feesArray['Message']="Fees paid both student and university";
$feesArray['Type']=$fetchRow->Sem_Year;
$feesArray['UniversityPaidAmount']=$fetchRow->UniversityPaidAmount;
$feesArray['StudentPaidAmount']=$feesDetails->StudentPaidAmount;
break;
}
else{
$feesArray['status']=true;
$feesArray['Message']="University fees paid and student fees pending";
$feesArray['Type']=$fetchRow->Sem_Year;
$feesArray['UniversityPaidAmount']=$fetchRow->UniversityPaidAmount;
$feesArray['StudentPaidAmount']=0;
}
else if($courseFeesDetails->num_rows()==1){
foreach ($courseFeesDetails->result() as $fetchRow){
$this->db->select("SM.SessionName,SM.SessionID");
$this->db->from(STUDENTS_FEES_STATUS.' as SFS');
$this->db->join(SESSIONMASTER . ' as SM' , 'SM.SessionID = SFS.SessionName');
$this->db->where('SFS.FeesType',$fetchRow->ID);
$this->db->where('SFS.StudentID',$studentID);
$this->db->where('SFS.SessionName', $session);
$feesDetails = $this->db->get()->last_row();
if ($feesDetails) {
$feesArray['status'] = true;
}
}
else{
$feesArray['status']=false;
$feesArray['Message']="Student record is mismatch because of enrolment number is not registered in student course details";
}
$feesArray['SessionName'] = $feesDetails->SessionName;
$feesArray['SessionID'] = $feesDetails->SessionID;
break;
} else {
$feesArray['status'] = false;
break;
}
else{
$feesArray['status']=false;
$feesArray['Message']="Please check form id";
}
return $feesArray;
}
}
else{
$feesArray['status'] = false;
}
return $feesArray;
}
/**
* Unmached file details