diff --git a/Apollo/api/application/controllers/Reregister_Controller.php b/Apollo/api/application/controllers/Reregister_Controller.php index 8c5c9091..d4a781b9 100644 --- a/Apollo/api/application/controllers/Reregister_Controller.php +++ b/Apollo/api/application/controllers/Reregister_Controller.php @@ -53,14 +53,19 @@ class Reregister_Controller extends REST_Controller { { $UID = $this->post('university'); $batch = $this->post('batch'); + $batch = explode('###',$batch); + $batchCode = $batch[0]; + $batchDate = $batch[1]; $branchId = $this->post('branchId'); - $res = $this->Reregister_model->getStudentListForPromoteBatchmodal($UID,$batch,$branchId); - if(count($res) > 0) + $res = $this->Reregister_model->getStudentListForPromoteBatchmodal($UID,$batchCode,$branchId,$batchDate); + //print_r($res['studentList']);die(); + if(count($res['finalStudentList']) > 0) { $data['status'] = REST_Controller::HTTP_OK; $data['studentStatus'] = true; - $data['studentDetails'] = $res; + $data['studentDetails'] = $res['finalStudentList']; + $data['nextbatchDetails'] = $res['nextBatch']; $this->response($data, REST_Controller::HTTP_OK); } else diff --git a/Apollo/api/application/models/Reregister_model.php b/Apollo/api/application/models/Reregister_model.php index 1af927dc..e50d943d 100644 --- a/Apollo/api/application/models/Reregister_model.php +++ b/Apollo/api/application/models/Reregister_model.php @@ -63,43 +63,56 @@ class Reregister_model extends CI_Model - public function getStudentListForPromoteBatchmodal($UID,$batch,$branchId) + public function getStudentListForPromoteBatchmodal($UID,$batchCode,$branchId,$batchDate) { - $this->db->select('T_StudentDetails.StudentID,T_StudentDetails.MobileNumber,T_StudentDetails.Firstname,T_StudentDetails.Lastname,T_StudentDetails.EmailID'); + $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'); $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_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->where('T_Students_Fees_Status.BatchCode',$batch); + $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'); + $this->db->join('T_Session_Master','T_SessionDetails.SessionID = T_Session_Master.SessionID'); + $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'); $res = $this->db->get(); - $data = $res->result(); - return $data; - // $result_array = array(); - // if(count($data) > 0) - // { - // $result_array = array(); - // $prestu = ""; - // foreach($data as $r) - // { - // if($prestu != $r->StudentID) - // { - // $studetdetails['StudentID'] = $r->StudentID; - // $studetdetails['MobileNumber'] = $r->MobileNumber; - // $studetdetails['Firstname'] = $r->Firstname; - // $studetdetails['Lastname'] = $r->Lastname; - // $studetdetails['EmailID'] = $r->EmailID; - // $studetdetails['ProfilePicPath'] = $r->ProfilePicPath; - // $studetdetails['EnrollmentID'] = $r->EnrollmentID; - // $studetdetails['FeeDetails'] = $this->getFeeSemesterDetails($r->StudentID,$batch,$branchId,$courseID); - // $result_array[] = $studetdetails; - // $prestu = $r->StudentID; - // } - // } + $data['studentListOne'] = $res->result(); + + $data['finalStudentList'] = array(); + foreach($data['studentListOne'] as $student) + { + $tempArray['StudentID'] = $student->StudentID; + $tempArray['MobileNumber'] = $student->MobileNumber; + $tempArray['Firstname'] = $student->Firstname; + $tempArray['Lastname'] = $student->Lastname; + $tempArray['EmailID'] = $student->EmailID; + $tempArray['current_sem'] = $student->current_sem; + $tempArray['CourseID'] = $student->CourseID; + $tempArray['CourseCode'] = $student->CourseCode; + $tempArray['CourseName'] = $student->CourseName; + $tempArray['SessionID'] = $student->SessionID; + $tempArray['SessionName'] = $student->SessionName; + $tempArray['SessionDate'] = $student->SessionDate; - // } - // return $result_array; + $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(); + $tempArray['nextSessionName'] = $tempResult[0]->SessionName; + $tempArray['nextSessionID'] = $tempResult[0]->SessionID; + $data['finalStudentList'][] = $tempArray; + + } + + $sql = "SELECT * FROM apollod4_ApolloDECDev.T_BatchMaster where 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'))); + + $data['nextBatch'] = $res2->result(); + //echo $this->db->last_query(); + return $data; } } \ No newline at end of file diff --git a/Apollo/assets/js/controllers/BatchmomentCtrl.js b/Apollo/assets/js/controllers/BatchmomentCtrl.js index 54f27adc..5c1d7a2a 100644 --- a/Apollo/assets/js/controllers/BatchmomentCtrl.js +++ b/Apollo/assets/js/controllers/BatchmomentCtrl.js @@ -15,7 +15,7 @@ $scope.isTblShow = false; $scope.isLoader = false; $scope.isLoaderShow = false; $scope.isLoaderTxt = "Loading..."; - +$scope.isShowNxtBatch = false; /* * init function @@ -37,7 +37,7 @@ $scope.isLoaderTxt = "Loading..."; $http(getUniv).then(function (response) { if (response.data.status==200 && response.data.universityStatus) { $scope.university = response.data.univerSityDetails; - + } else { swal('University Not Found','','error'); @@ -85,8 +85,10 @@ $scope.isLoaderTxt = "Loading..."; $http(getStudents).then(function (response) { if (response.data.status == 200 && response.data.studentStatus) { $scope.studentInfo = response.data.studentDetails; + $scope.nextBatchDetails = response.data.nextbatchDetails; $scope.isLoaderShow = false; $scope.isTblShow = true; + $scope.isShowNxtBatch = true; } @@ -96,11 +98,15 @@ $scope.isLoaderTxt = "Loading..."; $scope.isLoaderShow = true; $scope.isTblShow = false; $scope.isLoaderTxt = "No Records Found"; + $scope.isShowNxtBatch = false; + $scope.nextBatchDetails = ""; } },function(error){ $scope.isLoaderShow = true; $scope.isTblShow = false; $scope.isLoaderTxt = "No Records Found"; + $scope.isShowNxtBatch = false; + $scope.nextBatchDetails = ""; }); @@ -141,7 +147,7 @@ $scope.isLoaderTxt = "Loading..."; $scope.selectedStudentsID.splice(pos,1); } - + console.log($scope.selectedStudentsID); } @@ -162,13 +168,54 @@ $scope.isLoaderTxt = "Loading..."; $scope.selectedStudentsID.push($scope.studentInfo[i]); } } + } else { $scope.selectedStudentsID = []; } - + console.log($scope.selectedStudentsID); + } + + + $scope.promoteStudents = function() + { + if($scope.selectedStudentsID.length == 0 ) + { + swal('Select Proper Details..!','University, Batch, and atleast one student','warning'); + return false; + } } -}]); \ No newline at end of file +}]); + + +app.filter('nxtSemFormat', function() { + return function(x) { + // console.log('FIRST'+x); + // console.log('FIRST'+x.length); + x = x.replace(/ +/g, ""); + x = x.toUpperCase(); + var txt = ""; + var n = x.lastIndexOf("SEM"); + // console.log('FIRST'+n); + if(n >= 0) + { + var num = x.substr(-1); + num = parseInt(num)+1; + txt = 'SEM'+num; + } + else + { + n = x.lastIndexOf("YEAR"); + if(n >= 0) + { + var num = x.substr(-1); + num = parseInt(num)+1; + txt = 'YEAR'+num; + } + } + return txt; + }; +}); \ No newline at end of file diff --git a/Apollo/assets/views/reregistration/promotebatch.html b/Apollo/assets/views/reregistration/promotebatch.html index 92e4f39e..9c0a0410 100644 --- a/Apollo/assets/views/reregistration/promotebatch.html +++ b/Apollo/assets/views/reregistration/promotebatch.html @@ -51,40 +51,45 @@ ng-options="i.universityName for i in university" ng-change=""> - + - - - - - - - - - - - - +
- +
+
+ + + + +
+

- + +
+ +
+ +
+
@@ -104,6 +109,9 @@ Student Name + + Course Name + @@ -114,9 +122,16 @@ EmailID - - - + Current Session + Next Session + Current Semester/Year + + + Next Semester/Year + + + + @@ -124,8 +139,13 @@ {{p.Firstname}}{{p.Lastname}} + {{p.CourseName}}{{(p.CourseCode)}} {{p.MobileNumber}} {{p.EmailID}} + {{p.SessionName}} + {{p.nextSessionName}} + {{p.current_sem}} + {{p.current_sem | nxtSemFormat }}