diff --git a/Apollo/api/application/models/Reregister_model.php b/Apollo/api/application/models/Reregister_model.php index 8ace89ce..27beec85 100644 --- a/Apollo/api/application/models/Reregister_model.php +++ b/Apollo/api/application/models/Reregister_model.php @@ -67,6 +67,9 @@ class Reregister_model extends CI_Model { + $tempUniversityID = $UID['universityID']; + + $sql = "SELECT * FROM T_BatchMaster where isActive = 1 and UniversityID = ? and BranchCode = ? and str_to_date(BatchDate,'%d-%m-%Y') > str_to_date(?,'%d-%m-%Y') order by str_to_date(BatchDate,'%d-%m-%Y') asc limit 1"; $res2 = $this->db->query($sql,array($UID['universityID'],$branchId,date_format(date_create($batchDate),'d-m-Y'))); @@ -75,25 +78,38 @@ class Reregister_model extends CI_Model //echo $data['nextBatch'][0]->BatchCode; - $this->db->select('T_StudentDetails.StudentID,T_StudentDetails.MobileNumber,T_StudentDetails.Firstname,T_StudentDetails.Lastname,T_StudentDetails.EmailID,max(T_Course_Fees_Details.Sem_Year) as current_sem,T_CourseMaster.CourseID,T_CourseMaster.CourseCode,T_CourseMaster.CourseName,T_Session_Master.SessionID,T_Session_Master.SessionName,T_Session_Master.SessionDate,T_Students_Fees_Status.FeesType'); - $this->db->from('T_Students_Fees_Status'); - $this->db->join('T_StudentDetails','T_Students_Fees_Status.StudentID = T_StudentDetails.StudentID and T_StudentDetails.IsActive = 1'); - $this->db->join('T_Course_Fees_Details','T_Students_Fees_Status.CourseID = T_Course_Fees_Details.CourseID and T_Students_Fees_Status.FeesType = T_Course_Fees_Details.ID and T_Course_Fees_Details.ProgramType = "Y001" and T_Course_Fees_Details.FeesType = "F002" and T_StudentDetails.IsActive = 1' ); - $this->db->join('T_CourseMaster','T_Students_Fees_Status.CourseID=T_CourseMaster.CourseID'); - $this->db->join('T_SessionDetails','T_Students_Fees_Status.SessionName=T_SessionDetails.SessionID and T_SessionDetails.isActive=1'); - $this->db->join('T_Session_Master','T_SessionDetails.SessionID = T_Session_Master.SessionID and T_Session_Master.isActive=1'); - $this->db->where('T_Students_Fees_Status.BatchCode',$batchCode); - $this->db->where('T_Students_Fees_Status.BranchCode',$branchId); + $this->db->select("T_StudentDetails.StudentID,T_StudentDetails.MobileNumber,T_StudentDetails.Firstname,T_StudentDetails.Lastname,T_StudentDetails.EmailID,max(T_Course_Fees_Details.Sem_Year) as current_sem,T_CourseMaster.CourseID,T_CourseMaster.CourseCode,T_CourseMaster.CourseName,max(T_Session_Master.SessionID) as SessionID,T_Students_Fees_Status.FeesType"); + $this->db->from("T_Students_Fees_Status"); + $this->db->join("T_StudentDetails","T_Students_Fees_Status.StudentID = T_StudentDetails.StudentID and T_StudentDetails.IsActive = 1"); + $this->db->join("T_Course_Fees_Details","T_Students_Fees_Status.CourseID = T_Course_Fees_Details.CourseID and T_Students_Fees_Status.FeesType = T_Course_Fees_Details.ID and T_Course_Fees_Details.ProgramType = 'Y001' and T_Course_Fees_Details.FeesType = 'F002' and T_StudentDetails.IsActive = 1" ); + $this->db->join("T_CourseMaster","T_Students_Fees_Status.CourseID=T_CourseMaster.CourseID"); + $this->db->join("T_SessionDetails","T_Students_Fees_Status.SessionName=T_SessionDetails.SessionID and T_SessionDetails.isActive=1 and T_SessionDetails.BranchID = '$branchId' and T_SessionDetails.UniversityID = '$tempUniversityID'"); + $this->db->join("T_Session_Master","T_SessionDetails.SessionID = T_Session_Master.SessionID and T_Session_Master.isActive=1"); + $this->db->where("T_Students_Fees_Status.BatchCode",$batchCode); + $this->db->where("T_Students_Fees_Status.BranchCode",$branchId); // $this->db->where('T_Session_Master.BranchCode',$branchId); // $this->db->where('T_SessionDetails.BranchID',$branchId); - $this->db->group_by('T_StudentDetails.StudentID'); + $this->db->group_by("T_StudentDetails.StudentID"); $res = $this->db->get(); $data['studentListOne'] = $res->result(); - + //print_r($data['studentListOne']); $data['finalStudentList'] = array(); foreach($data['studentListOne'] as $student) { + + //Get Session Details by Session ID + + $this->db->trans_start(); + $this->db->select('SessionName,SessionDate'); + $this->db->from('T_Session_Master'); + $this->db->where('T_Session_Master.SessionID',$student->SessionID); + $this->db->where('T_Session_Master.isActive',1); + $this->db->where('T_Session_Master.BranchCode',$branchId); + $sesstionDetails = $this->db->get(); + $this->db->trans_complete(); + $sesstionDetails = $sesstionDetails ->result_array(); + //print_r($sesstionDetails);die(); //FIND OUT NEXT SEM NUMBER OR YEAR NUMBER $string = $student->current_sem; $string = str_replace(' ','',$string); @@ -126,7 +142,7 @@ class Reregister_model extends CI_Model $sql = "SELECT ID,FeesAmount FROM T_Course_Fees_Details where CourseID = ? and ProgramType = 'Y001' and FeesType = 'F002' and Sem_Year like ?"; $res = $this->db->query($sql,array($student->CourseID,$sem)); $res = $res->result_array(); - + if(!empty($res)) { $feesID = $res[0]['ID']; @@ -161,15 +177,15 @@ class Reregister_model extends CI_Model $tempArray['CourseCode'] = $student->CourseCode; $tempArray['CourseName'] = $student->CourseName; $tempArray['SessionID'] = $student->SessionID; - $tempArray['SessionName'] = $student->SessionName; - $tempArray['SessionDate'] = $student->SessionDate; + $tempArray['SessionName'] = $sesstionDetails[0]['SessionName']; + $tempArray['SessionDate'] = $sesstionDetails[0]['SessionDate']; $sqlquery ="SELECT SessionID,SessionName FROM T_Session_Master where BranchCode = ? and str_to_date(SessionDate,'%d-%m-%Y') > str_to_date(?,'%d-%m-%Y') order by str_to_date(SessionDate,'%d-%m-%Y') asc limit 1"; $tempResult = $this->db->query($sqlquery,array($branchId,$tempArray['SessionDate'])); $tempResult = $tempResult->result(); //echo $this->db->last_query(); - if($tempResult){ + if($tempResult[0]){ $tempArray['nextSessionName'] = $tempResult[0]->SessionName; $tempArray['nextSessionID'] = $tempResult[0]->SessionID; } diff --git a/Apollo/assets/js/controllers/BatchmomentCtrl.js b/Apollo/assets/js/controllers/BatchmomentCtrl.js index 8e2563b8..7041168e 100644 --- a/Apollo/assets/js/controllers/BatchmomentCtrl.js +++ b/Apollo/assets/js/controllers/BatchmomentCtrl.js @@ -16,6 +16,11 @@ $scope.isLoader = false; $scope.isLoaderShow = false; $scope.isLoaderTxt = "Loading..."; $scope.isShowNxtBatch = false; +$scope.getStudentButtonTxt = 'GET STUDENTS'; +$scope.promoteButtonTxt = 'PROMOTE'; +$scope.promoteButtonStatus = false; + + /* * init function @@ -62,8 +67,8 @@ $scope.isShowNxtBatch = false; return false; } - - + $scope.isLoaderTxt = "Loading..."; + $scope.getStudentButtonTxt = 'PLEASE WAIT'; $scope.selectedStudentsID = []; $scope.isLoaderShow = true; $scope.myModel.all = false; @@ -89,7 +94,7 @@ $scope.isShowNxtBatch = false; $scope.isLoaderShow = false; $scope.isTblShow = true; $scope.isShowNxtBatch = true; - + $scope.getStudentButtonTxt = 'GET STUDENTS'; } else @@ -97,16 +102,18 @@ $scope.isShowNxtBatch = false; $scope.studentInfo=""; $scope.isLoaderShow = true; $scope.isTblShow = false; - $scope.isLoaderTxt = "No Records Found"; + $scope.isLoaderTxt = "No Records Found/ No Next Batch available"; $scope.isShowNxtBatch = false; $scope.nextBatchDetails = ""; + $scope.getStudentButtonTxt = 'GET STUDENTS'; } },function(error){ $scope.isLoaderShow = true; $scope.isTblShow = false; - $scope.isLoaderTxt = "No Records Found"; + $scope.isLoaderTxt = "No Records Found/ No Next Batch available"; $scope.isShowNxtBatch = false; $scope.nextBatchDetails = ""; + $scope.getStudentButtonTxt = 'GET STUDENTS'; }); @@ -223,6 +230,8 @@ $scope.isShowNxtBatch = false; } //calculate Due Dates + $scope.promoteButtonStatus = true; + $scope.promoteButtonTxt = "PLEASE WAIT"; var nxtBatchDate1 = $scope.nextBatchDetails[0].BatchDate; var nxtBatchDate2 = nxtBatchDate1.split('-'); diff --git a/Apollo/assets/views/reregistration/promotebatch.html b/Apollo/assets/views/reregistration/promotebatch.html index d422fb04..17831284 100644 --- a/Apollo/assets/views/reregistration/promotebatch.html +++ b/Apollo/assets/views/reregistration/promotebatch.html @@ -83,13 +83,13 @@

- +

- +