db->query($sql1); $sql2 = "SELECT * from ".STAFF.""; $count2 = $this->db->query($sql2); if( $count2->num_rows() > 0) { $result['status'] = true; $result['total_student'] = $count1->num_rows(); $result['total_staff'] = $count2->num_rows(); $result['message'] = "Total Number of Users"; } else { $result['status'] = true; $result['total_student'] = $count1->num_rows(); $result['total_staff'] = $count2->num_rows(); $result['message'] = "No student Users"; } return $result; } // get total number of students public function get_total_students($data) { // print_r($data);exit(); $sql = "SELECT * from ".STUDENTS.""; $count = $this->db->query($sql); if( $count->num_rows() > 0) { $result['status'] = true; $result['total_student'] = $count->num_rows(); $result['message'] = "Total Number of Students"; } else { $result['status'] = true; $result['total_student'] = $count->num_rows(); $result['message'] = "No student exist"; } return $result; } // get total number of employees public function get_total_employee($data) { // print_r($data);exit(); $sql = "SELECT * from ".STAFF.""; $count = $this->db->query($sql); if( $count->num_rows() > 0) { $result['status'] = true; $result['total_employee'] = $count->num_rows(); $result['message'] = "Total Number of Employee"; } else { $result['status'] = true; $result['total_employee'] = $count->num_rows(); $result['message'] = "No Employee exist"; } return $result; } /* * get university registerd student details * created by kms * */ public function get_univ_registered_student($details){ $this->db->distinct(); $this->db->select('UniversityID,UniversityName'); $this->db->from(UNIVERSITY); $this->db->order_by('ID','DESC'); $this->db->where('BranchCode',$details['localBranchID']); $getUnivDetails = $this->db->get(); if($getUnivDetails->result()){ foreach ($getUnivDetails->result() as $rows){ $fetchDetails['UniversityID']=$rows->UniversityID; $fetchDetails['UniversityName']=$rows->UniversityName; $this->db->select('StudentID'); $this->db->from(STUDENTCOURSE); $this->db->where('BranchID',$details['localBranchID']); $this->db->where('UniversityID',$rows->UniversityID); $getRegisterDetails = $this->db->get(); if($getRegisterDetails->num_rows()>0){ $fetchDetails['StudentCounts']=$getRegisterDetails->num_rows(); } else{ $fetchDetails['StudentCounts']=0; } $getArray[]=$fetchDetails; $getFeesArray[]= $this->getUniversityFeesPending($rows->UniversityName,$rows->UniversityID,$details['localBranchID']); } $resultDetails['details']=$getArray; $resultDetails['universityFeesDetails']=$getFeesArray; } else{ $resultDetails['details']=false; $resultDetails['Message']="No records found!"; $resultDetails['universityFeesDetails']=false; } $resultDetails['batchFeesDetails']=$this->getBatchPendingFees($details['localBranchID']); return $resultDetails; } /* * get university pending fees details * created by kms * */ public function getUniversityFeesPending($universityName=null,$universityID=null,$branchCode=null){ $feesDetails=array(); $feesDetails['UniversityID']=$universityID; $feesDetails['UniversityName']=$universityName; $this->db->select("SUM(SFS.CourseFees+SFS.STFOrWR+Others) as PayableFees"); $this->db->from( STUDENTS_FEES_STATUS . ' as SFS'); $this->db->join( COURSE . ' as CU', 'CU.CourseID = SFS.CourseID'); $this->db->where('CU.UniversityID',$universityID); $this->db->where('CU.BranchCode',$branchCode); $this->db->order_by('CU.CourseID','DESC'); $getUnivFeesDetails = $this->db->get(); if($getUnivFeesDetails->result()){ foreach ($getUnivFeesDetails->result() as $payableRow){ $feesDetails['PayableFees']=$payableRow->PayableFees; } } else{ $feesDetails['PayableFees']=0; } $this->db->select("SUM(SFP.BillAmount) as PaidFees"); $this->db->from( STUDENTS_FEES_PAID . ' as SFP'); $this->db->join( STUDENTS_FEES_STATUS . ' as SFS', 'SFS.FeesID = SFP.FeesId'); $this->db->join( COURSE . ' as CU', 'CU.CourseID = SFS.CourseID'); $this->db->where('CU.UniversityID',$universityID); $this->db->where('CU.BranchCode',$branchCode); $this->db->where('SFP.IsActive','1'); $this->db->order_by('CU.CourseID','DESC'); $getUnivPaidFeesDetails = $this->db->get(); if($getUnivPaidFeesDetails->result()){ foreach ($getUnivPaidFeesDetails->result() as $paidRow){ $feesDetails['PaidFees']=$paidRow->PaidFees; } } else{ $feesDetails['PaidFees']=0; } return $feesDetails; } /* * get batch pending fees details * created by kms * */ public function getBatchPendingFees($branchCode=null){ $this->db->distinct(); $this->db->select('BatchCode,BatchName'); $this->db->from(BATCH); $this->db->order_by('BatchID','DESC'); $this->db->where('BranchCode',$branchCode); $getBatchDetails = $this->db->get(); if($getBatchDetails->result()){ foreach ($getBatchDetails->result() as $bRows){ $batchFeesDetails['BatchCode']=$bRows->BatchCode; $batchFeesDetails['BatchName']=$bRows->BatchName; $this->db->select("SUM(SFS.CourseFees+SFS.STFOrWR+Others) as PayableFees"); $this->db->from( STUDENTS_FEES_STATUS . ' as SFS'); $this->db->where('SFS.BatchCode',$bRows->BatchCode); $this->db->where('SFS.BranchCode',$branchCode); $getBatchFeesDetails = $this->db->get(); if($getBatchFeesDetails->result()){ foreach ($getBatchFeesDetails->result() as $bpayableRow){ $batchFeesDetails['PayableFees']=$bpayableRow->PayableFees; } } else{ $batchFeesDetails['PayableFees']=0; } // get paid details $this->db->select("SUM(SFP.BillAmount) as PaidFees"); $this->db->from( STUDENTS_FEES_PAID . ' as SFP'); $this->db->join( STUDENTS_FEES_STATUS . ' as SFS', 'SFS.FeesID = SFP.FeesId'); $this->db->where('SFP.IsActive','1'); $this->db->where('SFS.BatchCode',$bRows->BatchCode); $this->db->where('SFS.BranchCode',$branchCode); $getBatchPaidFeesDetails = $this->db->get(); if($getBatchPaidFeesDetails->result()){ foreach ($getBatchPaidFeesDetails->result() as $bpaidRow){ $batchFeesDetails['PaidFees']=$bpaidRow->PaidFees; } } else{ $batchFeesDetails['PaidFees']=0; } $fetchBatchFees[]=$batchFeesDetails; } return $fetchBatchFees; } else{ return false; } } }