569 lines
25 KiB
PHP
Executable File
569 lines
25 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: karthi
|
|
* Date: 12/12/17
|
|
* Time: 12:36 PM
|
|
*/
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class Fees_status_model extends CI_Model
|
|
{
|
|
/*
|
|
* get student list for fees update
|
|
* @params mobile number,name
|
|
* created by kms
|
|
* */
|
|
public function getStudentList($search=null)
|
|
{
|
|
if($search['MobileNumber']!='' OR $search['Firstname']!='' OR $search['UniversityID']!='' OR $search['CourseID']!=''){
|
|
$this->db->select('ST.StudentID,ST.MobileNumber,ST.Firstname,ST.Fathername,ST.EmailID,STC.ID,US.UniversityID,US.UniversityName,CU.CourseID,CU.CourseName,BA.BatchCode,BA.BatchName');
|
|
$this->db->from(STUDENTS.' as ST');
|
|
$this->db->join(STUDENTCOURSE.' as STC', 'STC.StudentID = ST.StudentID');
|
|
$this->db->join(COURSE.' as CU', 'CU.CourseID = STC.CourseID');
|
|
$this->db->join(BATCH.' as BA', 'BA.BatchCode = STC.BatchCode');
|
|
$this->db->join(UNIVERSITY.' as US', 'US.UniversityID = CU.UniversityID');
|
|
$this->db->where('ST.IsActive','1');
|
|
$this->db->where('STC.IsActive','1');
|
|
if($search['MobileNumber']!=''){
|
|
$this->db->where('ST.MobileNumber',$search['MobileNumber']);
|
|
}
|
|
if($search['Firstname']!=''){
|
|
$this->db->where('ST.Firstname',$search['Firstname']);
|
|
}
|
|
if($search['UniversityID']!=''){
|
|
$this->db->where('STC.UniversityID',$search['UniversityID']);
|
|
}
|
|
if($search['CourseID']!=''){
|
|
$this->db->where('STC.CourseID',$search['CourseID']);
|
|
}
|
|
/* if($search['MobileNumber']!='' AND $search['Firstname']==''){
|
|
$this->db->where('ST.MobileNumber',$search['MobileNumber']);
|
|
}
|
|
else if($search['MobileNumber']=='' AND $search['Firstname']!=''){
|
|
$this->db->where('ST.Firstname',$search['Firstname']);
|
|
}
|
|
else if($search['MobileNumber']!='' AND $search['Firstname']!=''){
|
|
$this->db->where('ST.MobileNumber',$search['MobileNumber']);
|
|
$this->db->where('ST.Firstname',$search['Firstname']);
|
|
}*/
|
|
$searchDetails = $this->db->get();
|
|
|
|
if($searchDetails->result()) {
|
|
$result_array['studentStatus'] = true;
|
|
$result_array['details'] = $searchDetails->result();
|
|
|
|
|
|
}
|
|
else{
|
|
$result_array['studentStatus'] = false;
|
|
$result_array['details'] = "No records found!";
|
|
}
|
|
}
|
|
else{
|
|
$result_array['studentStatus'] = false;
|
|
$result_array['details'] = "No records found!";
|
|
}
|
|
|
|
return $result_array;
|
|
|
|
}
|
|
|
|
/*
|
|
* get student fees structure for fees update
|
|
* @params student ID
|
|
* created by kms
|
|
* */
|
|
public function getStudentFeesStructure($student=null){
|
|
|
|
|
|
$this->db->select('CF.ID,CF.Sem_Year,SFS.FeesID,SFS.CourseID,SFS.CourseFees,SFS.STFOrWR,SFS.Waiver,SFS.Others,SFS.SessionName,SFS.RollNo,CU.PC,CU.TC,CU.DC,CU.MC,CU.OtherFees');
|
|
$this->db->from(STUDENTS_FEES_STATUS.' as SFS');
|
|
$this->db->join(COURSE_FEES.' as CF', 'CF.ID = SFS.FeesType');
|
|
$this->db->join(COURSE.' as CU', 'CU.CourseID = CF.CourseID');
|
|
$this->db->where('SFS.CourseID',$student['CourseID']);
|
|
$this->db->where('SFS.StudentID',$student['StudentID']);
|
|
$enrolledFeesDetails = $this->db->get();
|
|
if($enrolledFeesDetails->result()){
|
|
$result_array['feesStatus']=true;
|
|
foreach ($enrolledFeesDetails->result() as $row) {
|
|
|
|
$fetchData['ID'] = $row->ID;
|
|
$fetchData['FeesID'] = $row->FeesID;
|
|
$fetchData['CourseID'] = $row->CourseID;
|
|
$fetchData['Sem_Year'] = $row->Sem_Year;
|
|
$fetchData['ActualFees'] = $row->CourseFees;
|
|
$fetchData['STFOrWR'] = $row->STFOrWR;
|
|
$fetchData['Waiver'] = $row->Waiver;
|
|
$fetchData['Others'] = $row->Others;
|
|
$fetchData['SessionName'] = $row->SessionName;
|
|
$fetchData['RollNo'] = $row->RollNo;
|
|
$fetchData['PayableFees']=$row->CourseFees+$row->STFOrWR+$row->Others-$row->Waiver;
|
|
|
|
$this->db->select('ifnull(SUM((BillAmount)),0) as PaidBillAmount');
|
|
$this->db->where('FeesId',$row->FeesID);
|
|
$paidBillAmount = $this->db->get(STUDENTS_FEES_PAID)->result();
|
|
if($paidBillAmount[0]->PaidBillAmount > $fetchData['PayableFees']){
|
|
$fetchData['BalanceAmount']=0;
|
|
|
|
}
|
|
else{
|
|
$fetchData['BalanceAmount']=$fetchData['PayableFees'] - $paidBillAmount[0]->PaidBillAmount;
|
|
}
|
|
$fetchData['PC'] = $row->PC;
|
|
$fetchData['TC'] = $row->TC;
|
|
$fetchData['DC'] = $row->DC;
|
|
$fetchData['MC'] = $row->MC;
|
|
$fetchData['OtherFees'] = $row->OtherFees;
|
|
|
|
$CourseFeesArray[]=$fetchData;
|
|
}
|
|
$result_array['feesDetails']=$CourseFeesArray;
|
|
$result_array['getFeesUpdateStatus']=$this->getFeesUpdateStatus(FEESUPDATE);
|
|
$result_array['getExistStudentFeesDetails']=$this->existStudentFeesDetails($student);
|
|
|
|
}
|
|
else{
|
|
$result_array['feesStatus']=false;
|
|
$result_array['message']="This student don't have fees details";
|
|
|
|
}
|
|
return $result_array;
|
|
/* $this->db->where('CourseID',$student['CourseID']);
|
|
$feesDetails = $this->db->get(COURSE_FEES);
|
|
if($feesDetails->result()){
|
|
|
|
$result_array['feesStatus']=true;
|
|
foreach ($feesDetails->result() as $row){
|
|
|
|
|
|
$this->db->select('CourseFees,STFOrWR,Waiver,Others');
|
|
$this->db->where('StudentID',$student['StudentID']);
|
|
$this->db->where('CourseID',$student['CourseID']);
|
|
$this->db->where('FeesType',$row->ID);
|
|
$existFeesDetails = $this->db->get(STUDENTS_FEES_STATUS);
|
|
if($existData=$existFeesDetails->result()){
|
|
$fetchData['ID']=$row->ID;
|
|
$fetchData['CourseID']=$row->CourseID;
|
|
$fetchData['Sem_Year']=$row->Sem_Year;
|
|
$fetchData['ActualFees']=$row->FeesAmount;
|
|
$fetchData['PayableFees']=$row->FeesAmount;
|
|
$fetchData['PendingFees']=$row->FeesAmount;
|
|
$fetchData['STFOrWR']=$existData[0]->STFOrWR;
|
|
$fetchData['Waiver']=$existData[0]->Waiver;
|
|
$fetchData['Others']=$existData[0]->Others;
|
|
|
|
$CourseFeesArray[]=$fetchData;
|
|
|
|
}
|
|
else{
|
|
$fetchData['ID']=$row->ID;
|
|
$fetchData['CourseID']=$row->CourseID;
|
|
$fetchData['Sem_Year']=$row->Sem_Year;
|
|
$fetchData['ActualFees']=$row->FeesAmount;
|
|
$fetchData['PayableFees']=0;
|
|
|
|
$fetchData['PendingFees']=$row->FeesAmount;
|
|
$fetchData['STFOrWR']=0;
|
|
$fetchData['Waiver']=0;
|
|
$fetchData['Others']=0;
|
|
|
|
$CourseFeesArray[]=$fetchData;
|
|
|
|
}
|
|
|
|
}
|
|
$result_array['feesDetails']=$CourseFeesArray;
|
|
$result_array['getFeesUpdateStatus']=$this->getFeesUpdateStatus(FEESUPDATE);
|
|
$result_array['getExistStudentFeesDetails']=$this->existStudentFeesDetails($student);
|
|
|
|
}
|
|
|
|
else{
|
|
$result_array['feesStatus']=false;
|
|
}
|
|
|
|
return $result_array;*/
|
|
}
|
|
/*
|
|
* get fees update status
|
|
* created by kms
|
|
* */
|
|
|
|
public function getFeesUpdateStatus($feesID=null)
|
|
{
|
|
$this->db->select('PLD.ListCode,PLD.ListName');
|
|
$this->db->from(DEFAULTACTIVITY.' as DA');
|
|
$this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = DA.StatusCode');
|
|
$this->db->where('StudentActivityCode',$feesID);
|
|
$this->db->where('DA.IsActive','1');
|
|
$this->db->where('PLD.IsActive','1');
|
|
$this->db->order_by('ListCode','ASC');
|
|
$status = $this->db->get();
|
|
return $status->result();
|
|
}
|
|
/*
|
|
* get exist student fees details
|
|
* created by kms
|
|
* */
|
|
|
|
public function existStudentFeesDetails($student=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,ST.Firstname,ST.MobileNumber,ST.Fathername,CU.CourseName,CU.CourseID,CF.Sem_Year,STC.EnrollmentID,US.UniversityName');
|
|
$this->db->from(STUDENTS_FEES_PAID.' as SFP');
|
|
$this->db->join(STUDENTS_FEES_STATUS.' as SFS','SFP.FeesId = SFS.FeesID');
|
|
$this->db->join(STUDENTS.' as ST', 'ST.StudentID = SFS.StudentID');
|
|
$this->db->join(COURSE.' as CU', 'CU.CourseID = SFS.CourseID');
|
|
$this->db->join(COURSE_FEES.' as CF', 'CF.ID = SFS.FeesType');
|
|
$this->db->join(STUDENTCOURSE.' as STC', 'STC.CourseID = SFS.CourseID');
|
|
$this->db->join(UNIVERSITY.' as US', 'US.UniversityID = STC.UniversityID');
|
|
$this->db->where('SFS.CourseID', $student['CourseID']);
|
|
$this->db->where('SFS.StudentID', $student['StudentID']);
|
|
$this->db->where('STC.StudentID', $student['StudentID']);
|
|
$this->db->where('SFP.StudentID', $student['StudentID']);
|
|
$this->db->order_by('SFP.ID', 'DESC');
|
|
$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;
|
|
$storePaidDetails['Firstname'] = $feeRow->Firstname;
|
|
$storePaidDetails['MobileNumber'] = $feeRow->MobileNumber;
|
|
$storePaidDetails['Fathername'] = $feeRow->Fathername;
|
|
$storePaidDetails['EnrollmentID'] = $feeRow->EnrollmentID;
|
|
$storePaidDetails['CourseName'] = $feeRow->CourseName;
|
|
$storePaidDetails['UniversityName'] = $feeRow->UniversityName;
|
|
$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,BR.BranchName');
|
|
$this->db->from(STUDENTS_FEES_PAID.' as SFP');
|
|
$this->db->join(BRANCH.' as BR','BR.BranchCode = SFP.UpdatedBy','left');
|
|
$this->db->where('FeesId',$feeRow->FeesID);
|
|
$this->db->order_by('ID',"ASC");
|
|
$this->db->group_by('BillNO');
|
|
$storePaidDetails['paidDetails']=$this->db->get()->result();
|
|
$mergeResult[]=$storePaidDetails;
|
|
|
|
}
|
|
|
|
|
|
return $mergeResult;
|
|
}
|
|
else {
|
|
return false;
|
|
}
|
|
|
|
}
|
|
|
|
/*
|
|
* update fees details
|
|
* created by kms
|
|
* */
|
|
|
|
public function updateFees($feesPaidDetails=null,$trackDetails=null)
|
|
{
|
|
$this->db->select('BillNO');
|
|
$this->db->where('BillNO', $feesPaidDetails['BillNO']);
|
|
if($this->db->get(STUDENTS_FEES_PAID)->first_row()){
|
|
$result['paidStatus'] = false;
|
|
$result['message'] = "This bill number is already exist!";
|
|
} else {
|
|
$this->db->insert(STUDENTS_FEES_PAID, $feesPaidDetails);
|
|
if ($this->db->affected_rows() == '1') {
|
|
$result['paidStatus'] = true;
|
|
$result['message'] = "Successfully fees details added";
|
|
$entryOfCallTrack = $this->updateInCallTrack($trackDetails);
|
|
|
|
}
|
|
else{
|
|
$result['paidStatus'] = false;
|
|
$result['message'] = "Something went wrong.please try again";
|
|
}
|
|
|
|
|
|
}
|
|
|
|
return $result;
|
|
|
|
|
|
}
|
|
|
|
/*
|
|
* update followup details
|
|
* created by kms
|
|
* */
|
|
public function updateInCallTrack($arrayDetails=null){
|
|
// create activity in call tracking
|
|
$this->db->select('ActivityID,ActivityName');
|
|
$this->db->like('ActivityName', 'Fees', 'after');
|
|
$this->db->where('IsActive', '1');
|
|
$activityDetails=$this->db->get(ACTIVITY)->last_row();
|
|
if($activityDetails){
|
|
$this->db->select('LD.LeadID,LT.TrackingID');
|
|
$this->db->from(LEAD_DETAILS.' as LD');
|
|
$this->db->join(LEAD_TRACKING.' as LT', 'LT.LeadID = LD.LeadID');
|
|
$this->db->where('LD.MobileNumber',$arrayDetails['MobileNumber']);
|
|
$this->db->where('LT.ActivityStatus',$activityDetails->ActivityID);
|
|
$this->db->like('LT.University',$arrayDetails['University'],'after');
|
|
$this->db->like('LT.Course',$arrayDetails['Course'],'after');
|
|
$leadDet=$this->db->get()->last_row();
|
|
|
|
if($leadDet){
|
|
$this->db->select('FollowupOn');
|
|
$this->db->where('TrackingID',$leadDet->TrackingID);
|
|
$this->db->order_by('InteractionId','DESC');
|
|
$existFollowupOn = $this->db->get(LEAD_TRACKING_FOLLOWUP)->last_row();
|
|
// upate tracking status
|
|
$changeStatusCode['StatusCode'] = $arrayDetails['StatusCode'];
|
|
$changeStatusCode['UpdatedBy'] = $arrayDetails['CreatedBy'];
|
|
$changeStatusCode['UpdatedOn'] = $arrayDetails['CreatedOn'];
|
|
$this->db->where('TrackingID',$leadDet->TrackingID);
|
|
$this->db->update(LEAD_TRACKING, $changeStatusCode);
|
|
// end update status
|
|
$updateTrackDetails['TrackingID'] = $leadDet->TrackingID;
|
|
$updateTrackDetails['FollowupOn'] = $existFollowupOn->FollowupOn;
|
|
$updateTrackDetails['FollowupComments'] = $arrayDetails['FollowupComments'];
|
|
$updateTrackDetails['CreatedBy'] = $arrayDetails['CreatedBy'];
|
|
$updateTrackDetails['CreatedOn'] = $arrayDetails['CreatedOn'];
|
|
$this->db->insert(LEAD_TRACKING_FOLLOWUP, $updateTrackDetails);
|
|
|
|
}
|
|
|
|
else{
|
|
$this->db->select('LeadID');
|
|
$this->db->where('MobileNumber',$arrayDetails['MobileNumber']);
|
|
$checkLeadDet=$this->db->get(LEAD_DETAILS)->last_row();
|
|
if($checkLeadDet){
|
|
$updateLeadDetails['LeadID'] = $checkLeadDet->LeadID;
|
|
$updateLeadDetails['ActivityStatus'] = $activityDetails->ActivityID;
|
|
$updateLeadDetails['University'] = $arrayDetails['University'];
|
|
$updateLeadDetails['Course'] = $arrayDetails['Course'];
|
|
$updateLeadDetails['AssignedTo'] = $arrayDetails['CreatedBy'];
|
|
$updateLeadDetails['StatusCode'] = $arrayDetails['StatusCode'];
|
|
$updateLeadDetails['CreatedBy'] = $arrayDetails['CreatedBy'];
|
|
$updateLeadDetails['CreatedOn'] = $arrayDetails['CreatedOn'];
|
|
$this->db->insert(LEAD_TRACKING, $updateLeadDetails);
|
|
// this if for insert tracking details
|
|
if($this->db->affected_rows() == '1'){
|
|
$followup_Details['TrackingID']=$this->db->insert_id();
|
|
$followup_Details['FollowupOn']=$arrayDetails['FollowupOn'];
|
|
$followup_Details['FollowupComments']=$arrayDetails['FollowupComments'];
|
|
$followup_Details['CreatedBy'] = $arrayDetails['CreatedBy'];
|
|
$followup_Details['CreatedOn'] = $arrayDetails['CreatedOn'];
|
|
$this->db->insert(LEAD_TRACKING_FOLLOWUP, $followup_Details);
|
|
// this if for insert follow up details
|
|
|
|
}
|
|
|
|
}
|
|
else{
|
|
$newLeadDetails['MobileNumber'] = $arrayDetails['MobileNumber'];
|
|
$newLeadDetails['LeadName'] = $arrayDetails['LeadName'];
|
|
$newLeadDetails['CreatedBy'] = $arrayDetails['CreatedBy'];
|
|
$newLeadDetails['CreatedOn'] = $arrayDetails['CreatedOn'];
|
|
$this->db->insert(LEAD_DETAILS, $newLeadDetails);
|
|
// this if for insert lead details
|
|
if($this->db->affected_rows() == '1'){
|
|
// get and store insert id from db
|
|
$track_Details['LeadID']=$this->db->insert_id();
|
|
$track_Details['ActivityStatus'] = $activityDetails->ActivityID;
|
|
$track_Details['University'] = $arrayDetails['University'];
|
|
$track_Details['Course'] = $arrayDetails['Course'];
|
|
$track_Details['AssignedTo'] = $arrayDetails['CreatedBy'];
|
|
$track_Details['StatusCode'] = $arrayDetails['StatusCode'];
|
|
$track_Details['CreatedBy'] = $arrayDetails['CreatedBy'];
|
|
$track_Details['CreatedOn'] = $arrayDetails['CreatedOn'];
|
|
$this->db->insert(LEAD_TRACKING, $track_Details);
|
|
// this if for insert tracking details
|
|
if($this->db->affected_rows() == '1'){
|
|
$insertfollowup_Details['TrackingID']=$this->db->insert_id();
|
|
$insertfollowup_Details['FollowupOn']=$arrayDetails['FollowupOn'];
|
|
$insertfollowup_Details['FollowupComments']=$arrayDetails['FollowupComments'];
|
|
$insertfollowup_Details['CreatedBy'] = $arrayDetails['CreatedBy'];
|
|
$insertfollowup_Details['CreatedOn'] = $arrayDetails['CreatedOn'];
|
|
$this->db->insert(LEAD_TRACKING_FOLLOWUP, $insertfollowup_Details);
|
|
// this if for insert follow up details
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
/*
|
|
* get university details
|
|
* created by kms
|
|
* */
|
|
public function getUniversityDetails()
|
|
{
|
|
$this->db->select('UniversityID,UniversityName');
|
|
$this->db->where('IsActive','1');
|
|
$this->db->order_by('UniversityID','ASC');
|
|
$unviversityDetails = $this->db->get(UNIVERSITY);
|
|
|
|
if($unviversityDetails->result()){
|
|
$result_university = array();
|
|
$result_university['universityStatus'] = true;
|
|
foreach ($unviversityDetails->result() as $row)
|
|
{
|
|
|
|
$university_array['universityID'] = $row->UniversityID;
|
|
$university_array['universityName'] = $row->UniversityName;
|
|
$university_array['courseDetails']= $this->getCourseDetails($row->UniversityID);
|
|
$result_array[]=$university_array;
|
|
}
|
|
$result_university['univerSityDetails']= $result_array;
|
|
}
|
|
else {
|
|
$result_university['universityStatus'] = false;
|
|
$result_university['message'] = "No records found!";
|
|
$result_university['universityID'] = "";
|
|
$result_university['universityName'] = "";
|
|
$result_university['courseDetails']= "";
|
|
}
|
|
|
|
|
|
return $result_university;
|
|
|
|
}
|
|
/*
|
|
* get course details
|
|
* @params university id
|
|
* created by kms
|
|
* */
|
|
public function getCourseDetails($universityID=null)
|
|
{
|
|
$this->db->select('CourseID,CourseName');
|
|
$this->db->where('UniversityID',$universityID);
|
|
$this->db->where('IsActive','1');
|
|
$this->db->order_by('CourseID','ASC');
|
|
$courseDetails = $this->db->get(COURSE);
|
|
return $courseDetails->result();
|
|
}
|
|
/*
|
|
* get fees details assign for student
|
|
* created by kms
|
|
* */
|
|
public function getFeesStructureAssign($student=null){
|
|
$this->db->select('ID,CourseID,ProgramType,FeesAmount,Sem_Year');
|
|
$this->db->where('CourseID',$student['CourseID']);
|
|
$feesDetails = $this->db->get(COURSE_FEES);
|
|
if($feesDetails->result()){
|
|
|
|
$result_array['feesStatus']=true;
|
|
foreach ($feesDetails->result() as $row){
|
|
$this->db->select('CourseFees, STFOrWR,Waiver,Others,SessionName,RollNo');
|
|
$this->db->where('StudentID',$student['StudentID']);
|
|
$this->db->where('CourseID',$student['CourseID']);
|
|
$this->db->where('FeesType',$row->ID);
|
|
$existFeesDetails = $this->db->get(STUDENTS_FEES_STATUS);
|
|
if($existData=$existFeesDetails->result()){
|
|
$fetchData['ExistValue']=1;
|
|
$fetchData['ID']=$row->ID;
|
|
$fetchData['CourseID']=$row->CourseID;
|
|
$fetchData['Sem_Year']=$row->Sem_Year;
|
|
$fetchData['ActualFees']=$existData[0]->CourseFees;
|
|
$fetchData['STFOrWR']=$existData[0]->STFOrWR;
|
|
$fetchData['Waiver']=$existData[0]->Waiver;
|
|
$fetchData['Others']=$existData[0]->Others;
|
|
$fetchData['SessionName']=$existData[0]->SessionName;
|
|
$fetchData['RollNo']=$existData[0]->RollNo;
|
|
$fetchData['PayableFees']=$existData[0]->CourseFees+$existData[0]->STFOrWR+$existData[0]->Others-$existData[0]->Waiver;
|
|
|
|
$CourseFeesArray[]=$fetchData;
|
|
|
|
}
|
|
else{
|
|
$fetchData['ExistValue']=0;
|
|
$fetchData['ID']=$row->ID;
|
|
$fetchData['CourseID']=$row->CourseID;
|
|
$fetchData['Sem_Year']=$row->Sem_Year;
|
|
$fetchData['ActualFees']=$row->FeesAmount;
|
|
$fetchData['STFOrWR']="";
|
|
$fetchData['Waiver']="";
|
|
$fetchData['Others']="";
|
|
$fetchData['SessionName']="";
|
|
$fetchData['RollNo']="";
|
|
$fetchData['PayableFees']=$row->FeesAmount;
|
|
|
|
$CourseFeesArray[]=$fetchData;
|
|
|
|
}
|
|
|
|
}
|
|
$result_array['feesDetails']=$CourseFeesArray;
|
|
}
|
|
|
|
else{
|
|
$result_array['feesStatus']=false;
|
|
}
|
|
|
|
return $result_array;
|
|
|
|
}
|
|
|
|
/*
|
|
* set fees for student
|
|
* created by kms
|
|
* */
|
|
public function setFees($details=null){
|
|
$this->db->select('FeesID');
|
|
$this->db->where('CourseID', $details['CourseID']);
|
|
$this->db->where('StudentID', $details['StudentID']);
|
|
$this->db->where('FeesType', $details['FeesType']);
|
|
$checkExist=$this->db->get(STUDENTS_FEES_STATUS);
|
|
if($checkExist->result()){
|
|
$feesId = $checkExist->result();
|
|
$updateDetails['SessionName'] = $details['SessionName'];
|
|
$updateDetails['RollNo'] = $details['RollNo'];
|
|
$updateDetails['STFOrWR'] = $details['STFOrWR'];
|
|
$updateDetails['Waiver'] = $details['Waiver'];
|
|
$updateDetails['Others'] = $details['Others'];
|
|
$updateDetails['UpdatedOn'] = $details['CreatedOn'];
|
|
$updateDetails['UpdatedBy'] = $details['CreatedBy'];
|
|
$this->db->where('FeesID', $feesId[0]->FeesID);
|
|
$this->db->update(STUDENTS_FEES_STATUS, $updateDetails);
|
|
$result['setStatus'] = true;
|
|
$result['message'] = "Successfully fees details is updated.";
|
|
|
|
}
|
|
else{
|
|
$this->db->insert(STUDENTS_FEES_STATUS, $details);
|
|
$result['setStatus'] = true;
|
|
$result['message'] = "Successfully fees details is added.";
|
|
|
|
}
|
|
return $result;
|
|
|
|
}
|
|
|
|
|
|
} |