diff --git a/Apollo/api/application/models/Studentview_model.php b/Apollo/api/application/models/Studentview_model.php index 9e191f72..990b69da 100644 --- a/Apollo/api/application/models/Studentview_model.php +++ b/Apollo/api/application/models/Studentview_model.php @@ -49,6 +49,153 @@ class Studentview_model extends CI_Model $this->db->join( BATCH . ' as BA', 'BA.BatchCode = SCU.BatchCode'); $this->db->where('SCU.StudentID', $studentId); $courseDetails = $this->db->get(); - return $courseDetails->result(); + 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; + // get student fees details + $fetchData['feesDetails']=$this->getStudentFeesDetails($studentId,$row->CourseID); + // get student boollet details + $fetchData['bookletDetails']=$this->getStudentBookletDetails($studentId,$row->CourseID); + // get certificate details + $fetchData['certificateDetails']=$this->getStudentCertificateDetails($studentId,$row->CourseID); + // get student application details + $fetchData['applicationDetails']=$this->getStudentApplicationDetails($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; + + } + + + return $mergeResult; + } + else { + return false; + } + + } + /* + * get student bool let details + * created by kms + * */ + public function getStudentBookletDetails($studentID=null,$courseID=null){ + $this->db->select('AB.AnsDate,AB.Comments,CF.Sem_Year,PLD.ListName'); + $this->db->from(ANSWER_BOOKLET.' as AB'); + $this->db->join(COURSE_FEES.' as CF','CF.ID = AB.CourseID'); + $this->db->join(COURSE.' as CU', 'CU.CourseID = CF.CourseID'); + $this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = AB.ListCode'); + $this->db->where('CU.CourseID', $courseID); + $this->db->where('AB.StudentID', $studentID); + $this->db->order_by('AB.ID', 'DESC'); + $getBoolDetails = $this->db->get(); + if ($getBoolDetails->result()){ + return $getBoolDetails->result(); + } + else{ + return false; + } + } + /* + * get student certificate details + * created by kms + * */ + public function getStudentCertificateDetails($studentID=null,$courseID=null){ + $this->db->select('CS.CertificationNo,CS.CDate,CS.Comments,CM.CertificateName,CF.Sem_Year,PLD.ListName'); + $this->db->from(CERTIFICATION_STATUS.' as CS'); + $this->db->join(CERTIFICATION_MASTER.' as CM','CM.CertificationID = CS.CertificationType'); + $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->order_by('CS.ID', 'DESC'); + $getCertDetails = $this->db->get(); + if ($getCertDetails->result()){ + return $getCertDetails->result(); + } + else{ + return false; + } + } + /* + * get student application details + * created by kms*/ + public function getStudentApplicationDetails($studentID=null,$courseID=null){ + $this->db->select('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; + } } } \ No newline at end of file