diff --git a/Apollo/api/application/controllers/Fees_Status_Controller.php b/Apollo/api/application/controllers/Fees_Status_Controller.php index 22ca5714..fd3187bf 100755 --- a/Apollo/api/application/controllers/Fees_Status_Controller.php +++ b/Apollo/api/application/controllers/Fees_Status_Controller.php @@ -169,7 +169,9 @@ class Fees_Status_Controller extends REST_Controller { * */ public function getUniversityCourseForFees_post() { - $getUnivDetails = $this->Fees_model->getUniversityDetails(); + $requestedBy = $this->post('requestedBy'); + $requestedBranch = $this->post('branchCode'); + $getUnivDetails = $this->Fees_model->getUniversityDetails($requestedBy,$requestedBranch); if ($getUnivDetails) { $getUnivDetails['status'] = REST_Controller::HTTP_OK; @@ -202,6 +204,7 @@ class Fees_Status_Controller extends REST_Controller { $student['requestedBy'] = $this->post('requestedtBy'); $student['CourseID'] = $this->post('courseID'); $student['StudentID'] = $this->post('studentID'); + $student['BranchCode'] = $this->post('branchCode'); $getStudentFeesDetails = $this->Fees_model->getFeesStructureAssign($student); if ($getStudentFeesDetails) { diff --git a/Apollo/api/application/controllers/University_Controller.php b/Apollo/api/application/controllers/University_Controller.php index 35cc8d53..818ce1c7 100755 --- a/Apollo/api/application/controllers/University_Controller.php +++ b/Apollo/api/application/controllers/University_Controller.php @@ -169,6 +169,7 @@ class University_Controller extends REST_Controller { $details['CreatedBy'] = $this->post('createdBy'); $details['CreatedOn'] = $now->format('Y-m-d H:i:s'); $details['IsActive'] = $this->post('status'); + $details['BranchCode'] = $this->post('branchCode'); $jsonData=$this->post('activityStatus'); $activityDetails = $this->university_model->addActivity($details,$jsonData);// Check if the users data store contains users (in case the database result returns NULL) if ($activityDetails) { @@ -189,7 +190,8 @@ class University_Controller extends REST_Controller { public function getActivityDetails_post() { $requestedBy = $this->post('requestedBy'); - $getActivity = $this->university_model->getActivity($requestedBy); + $requestedBranch = $this->post('branchCode'); + $getActivity = $this->university_model->getActivity($requestedBy,$requestedBranch); if ($getActivity) { $getActivity['status'] = REST_Controller::HTTP_OK; @@ -220,6 +222,7 @@ class University_Controller extends REST_Controller { $details['IsActive'] = $this->post('status'); $details['UpdatedBy'] = $this->post('updatedBy'); $details['UpdatedOn'] = $now->format('Y-m-d H:i:s'); + $details['BranchCode'] = $this->post('branchCode'); $jsonData=$this->post('activityStatus'); $activityDetails = $this->university_model->updateActivity($details,$jsonData);// Check if the users data store contains users (in case the database result returns NULL) diff --git a/Apollo/api/application/models/Fees_status_model.php b/Apollo/api/application/models/Fees_status_model.php index 521078b4..81d3cad3 100755 --- a/Apollo/api/application/models/Fees_status_model.php +++ b/Apollo/api/application/models/Fees_status_model.php @@ -27,6 +27,8 @@ class Fees_status_model extends CI_Model $this->db->where('STC.IsActive','1'); if($search['requestedBranch']!='All'){ $this->db->where('STC.BranchID',$search['requestedBranch']); + $this->db->where('US.BranchCode',$search['requestedBranch']); + $this->db->where('CU.BranchCode',$search['requestedBranch']); } if($search['MobileNumber']!=''){ $this->db->where('ST.MobileNumber',$search['MobileNumber']); @@ -78,6 +80,7 @@ class Fees_status_model extends CI_Model * created by kms * */ public function getStudentFeesStructure($student=null){ + $this->db->distinct(); $this->db->select('CF.ID,CF.Sem_Year,CF.ProgramType,SFS.FeesID,SFS.CourseID,SFS.CourseFees,SFS.STFOrWR,SFS.Waiver,SFS.Others,SFS.RollNo,CU.PC,CU.TC,CU.DC,CU.MC,CU.OtherFees,SM.SessionName as SessionName,SM1.SessionName as ToSessionName,BA.BatchCode,BA.BatchName'); $this->db->from(STUDENTS_FEES_STATUS.' as SFS'); $this->db->join(SESSIONMASTER.' as SM', 'SM.SessionID = SFS.SessionName'); @@ -87,6 +90,7 @@ class Fees_status_model extends CI_Model $this->db->join(COURSE.' as CU', 'CU.CourseID = CF.CourseID'); $this->db->where('SFS.CourseID',$student['CourseID']); $this->db->where('SFS.StudentID',$student['StudentID']); + $this->db->where('BA.BranchCode',$student['BranchCode']); $enrolledFeesDetails = $this->db->get(); if($enrolledFeesDetails->result()){ $result_array['feesStatus']=true; @@ -662,11 +666,12 @@ class Fees_status_model extends CI_Model * get university details * created by kms * */ - public function getUniversityDetails() + public function getUniversityDetails($requestedBy=null,$requestedBranch=null) { $this->db->select('UniversityID,UniversityName'); $this->db->where('IsActive','1'); - $this->db->order_by('UniversityID','ASC'); + $this->db->where('BranchCode',$requestedBranch); + $this->db->order_by('CreatedOn','DESC'); $unviversityDetails = $this->db->get(UNIVERSITY); if($unviversityDetails->result()){ @@ -677,7 +682,7 @@ class Fees_status_model extends CI_Model $university_array['universityID'] = $row->UniversityID; $university_array['universityName'] = $row->UniversityName; - $university_array['courseDetails']= $this->getCourseDetails($row->UniversityID); + $university_array['courseDetails']= $this->getCourseDetails($row->UniversityID,$requestedBranch); $result_array[]=$university_array; } $result_university['univerSityDetails']= $result_array; @@ -699,11 +704,12 @@ class Fees_status_model extends CI_Model * @params university id * created by kms * */ - public function getCourseDetails($universityID=null) + public function getCourseDetails($universityID=null,$requestedBranch=null) { $this->db->select('CourseID,CONCAT(CourseName, "(",CourseCode,")") AS CourseName'); $this->db->where('UniversityID',$universityID); $this->db->where('IsActive','1'); + $this->db->where('BranchCode',$requestedBranch); $this->db->order_by('CourseID','ASC'); $courseDetails = $this->db->get(COURSE); return $courseDetails->result(); @@ -713,7 +719,6 @@ class Fees_status_model extends CI_Model * created by kms * */ public function getFeesStructureAssign($student=null){ - $this->db->select('ID,CourseID,ProgramType,FeesAmount,Sem_Year'); $this->db->where('CourseID',$student['CourseID']); $this->db->order_by('ProgramType'); @@ -768,7 +773,7 @@ class Fees_status_model extends CI_Model } - $batchDetails = $this->getBatchDetails($existData[0]->BatchCode,$student['CourseID'],$student['StudentID'],$row->ID); + $batchDetails = $this->getBatchDetails($existData[0]->BatchCode,$student['CourseID'],$student['StudentID'],$row->ID,$student['BranchCode']); if($batchDetails!=false){ $fetchData['batchDetails']=$batchDetails; } @@ -799,7 +804,7 @@ class Fees_status_model extends CI_Model $fetchData['PayableFees']=$row->FeesAmount; // for installment details $fetchData['InstallmentDetails']=""; - $batchDetails = $this->getBatchDetails('',$student['CourseID'],$student['StudentID'],''); + $batchDetails = $this->getBatchDetails('',$student['CourseID'],$student['StudentID'],'',$student['BranchCode']); if($batchDetails!=false){ $fetchData['batchDetails']=$batchDetails; } @@ -856,7 +861,7 @@ class Fees_status_model extends CI_Model * get batch details * created by kms * */ - public function getBatchDetails($batchCode=null,$courseID=null,$studentID=null,$feesType=null){ + public function getBatchDetails($batchCode=null,$courseID=null,$studentID=null,$feesType=null,$branchCode=null){ if($batchCode=='' OR $batchCode==null){ $this->db->select('BA.BatchCode,BA.BatchName,BA.BatchDate,BA.IsDefault,US.UniversityID,US.UniversityName,BA.IsActive'); $this->db->from(COURSE.' as CU'); @@ -865,6 +870,9 @@ class Fees_status_model extends CI_Model $this->db->order_by('BA.CreatedOn','DESC'); $this->db->where('CU.CourseID',$courseID); $this->db->where('BA.IsActive','1'); + $this->db->where('BA.BranchCode',$branchCode); + $this->db->where('US.BranchCode',$branchCode); + $batchDetails = $this->db->get(); if($batchDetails->result()){ @@ -887,6 +895,8 @@ class Fees_status_model extends CI_Model $this->db->where('CU.CourseID',$courseID); $this->db->where('STF.StudentID',$studentID); $this->db->where('STF.FeesType',$feesType); + $this->db->where('BA.BranchCode',$branchCode); + $this->db->where('US.BranchCode',$branchCode); $batchDetails = array(); /* $this->db->or_where('BA.IsActive','1'); @@ -1602,8 +1612,11 @@ class Fees_status_model extends CI_Model $this->db->join(UNIVERSITY.' as US', 'US.UniversityID = SD.UniversityID'); $this->db->join(COURSE.' as CU', 'CU.UniversityID = US.UniversityID'); // $this->db->where('SD.IsActive','1'); - $this->db->order_by('CU.CreatedOn','DESC'); + // $this->db->order_by('CU.CreatedOn','DESC'); + $this->db->order_by('SM.SessionID','DESC'); $this->db->where('CU.CourseID',$details['CourseID']); + $this->db->where('US.BranchCode',$details['BranchCode']); + $this->db->where('SM.BranchCode',$details['BranchCode']); // $this->db->group_by('SM.SessionName','DESC'); $sessionDetails = $this->db->get(); if($sessionDetails->result()){ diff --git a/Apollo/api/application/models/University_model.php b/Apollo/api/application/models/University_model.php index 7fdef201..69966e78 100755 --- a/Apollo/api/application/models/University_model.php +++ b/Apollo/api/application/models/University_model.php @@ -94,40 +94,38 @@ class University_model extends CI_Model public function addActivity($arrayDetails=null,$jsonData=null) { $this->db->select('ActivityID,ActivityName'); - $this->db->where('ActivityName', $arrayDetails['ActivityName']); + $this->db->where('BranchCode', $arrayDetails['BranchCode']); + if($this->db->get(ACTIVITY)->first_row()){ + $result['activityStatus'] = false; + $result['message'] = "Activity name is already exist!"; + } + else{ + $this->db->insert(ACTIVITY, $arrayDetails); + if($this->db->affected_rows() == '1'){ + $last = $this->db->order_by('ActivityID',"desc")->limit(1)->get(ACTIVITY)->row(); + $lastActivityID=$last->ActivityID; - if($this->db->get(ACTIVITY)->first_row()){ + if($jsonData){ + + foreach ($jsonData as $srow){ + $status_array["StatusName"]=$srow['id']; + $status_array["ActivityID"]=$lastActivityID; + $status_array["IsActive"]=$arrayDetails['IsActive']; + $status_array["CreatedBy"]=$arrayDetails['CreatedBy']; + $status_array["CreatedOn"]=$arrayDetails['CreatedOn']; + $this->db->insert(ACTIVITY_STATUS, $status_array); + } + } + $result['activityStatus'] = true; + $result['message'] = "Successfully activity details added"; + + } + else { $result['activityStatus'] = false; - $result['message'] = "Activity name is already exist!"; - } - else{ - - $this->db->insert(ACTIVITY, $arrayDetails); - if($this->db->affected_rows() == '1'){ - $last = $this->db->order_by('ActivityID',"desc")->limit(1)->get(ACTIVITY)->row(); - $lastActivityID=$last->ActivityID; - - if($jsonData){ - - foreach ($jsonData as $srow){ - $status_array["StatusName"]=$srow['id']; - $status_array["ActivityID"]=$lastActivityID; - $status_array["IsActive"]=$arrayDetails['IsActive']; - $status_array["CreatedBy"]=$arrayDetails['CreatedBy']; - $status_array["CreatedOn"]=$arrayDetails['CreatedOn']; - $this->db->insert(ACTIVITY_STATUS, $status_array); - } - } - $result['activityStatus'] = true; - $result['message'] = "Successfully activity details added"; - - } - else { - $result['activityStatus'] = false; - $result['message'] = "Something went wrong.please try again"; - } + $result['message'] = "Something went wrong.please try again"; } + } @@ -141,11 +139,12 @@ class University_model extends CI_Model * created by Surendiran * */ - public function getActivity() + public function getActivity($requestedBy=null,$requestedBranch=null) { $this->db->distinct(); - $this->db->select('ActivityID,ActivityName,Description,IsActive'); + $this->db->where('BranchCode',$requestedBranch); $this->db->order_by('ActivityID','DESC'); + $this->db->select('ActivityID,ActivityName,Description,IsActive'); $activityDetails=$this->db->get(ACTIVITY); if($activityDetails->result()){ @@ -172,7 +171,7 @@ class University_model extends CI_Model $activity_result['activityStatus'] = false; $activity_result['details'] = "No records found!"; } - $activity_result['masterStatusList']=$this->getAllStatusList('1'); + $activity_result['masterStatusList']=$this->getAllStatusList('1',$requestedBranch); return $activity_result; } @@ -202,6 +201,7 @@ class University_model extends CI_Model $this->db->select('ActivityName'); $this->db->where('ActivityName',$arrayDetails['ActivityName']); $this->db->where('ActivityID !=',$arrayDetails['ActivityID']); + $this->db->where('BranchCode',$arrayDetails['BranchCode']); if($this->db->get(ACTIVITY)->first_row()){ $result['activityStatus'] = false; $result['message'] = "Activity name is already exist!"; diff --git a/Apollo/assets/js/controllers/activityCtrl.js b/Apollo/assets/js/controllers/activityCtrl.js index 41e97646..69cda7bb 100755 --- a/Apollo/assets/js/controllers/activityCtrl.js +++ b/Apollo/assets/js/controllers/activityCtrl.js @@ -105,7 +105,8 @@ if(myModel.status.length > 0) { description: myModel.Description, status: myModel.switchsetting, activityStatus:myModel.status, - createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID + createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + branchCode:JSON.parse(localStorage.getItem('localObj')).localBranchID } }; $http(addactivity).then(function (response) { @@ -114,7 +115,11 @@ if(myModel.status.length > 0) { $scope.init(); swal("","Activity details added successfully.", "success"); $state.go($state.current, {}, { reload: true }); - } else { + } + else if(response.data.activityStatus==false){ + swal("",response.data.message, "warning"); + } + else { $scope.ldloading[loading.replace('-', '_')] = false; swal(" ", "Something went wrong.please try again.", "error"); } @@ -149,7 +154,8 @@ swal("Warning!", "Status are required", "warning"); 'Content-Type': 'application/json' }, data: { - requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID + requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + branchCode:JSON.parse(localStorage.getItem('localObj')).localBranchID } }; $http(getActivity).then(function (response) { @@ -224,7 +230,8 @@ swal("Warning!", "Status are required", "warning"); description: myModel.Description, status: myModel.IsActive, activityStatus:listStatus.list, - updatedBy: JSON.parse(localStorage.getItem('localObj')).localUserID + updatedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + branchCode:JSON.parse(localStorage.getItem('localObj')).localBranchID } }; $http(update).then(function (response) { @@ -236,7 +243,11 @@ swal("Warning!", "Status are required", "warning"); $scope.editId = -1; - } else { + } + else if(response.data.activityStatus==false){ + swal("",response.data.message, "warning"); + } + else { $scope.ldloading3[loading.replace('-', '_')] = false; swal(" ","Something went wrong.please try again", "error"); } diff --git a/Apollo/assets/js/controllers/feesStatusCtrl.js b/Apollo/assets/js/controllers/feesStatusCtrl.js index 6a4210ba..bf6c46b1 100755 --- a/Apollo/assets/js/controllers/feesStatusCtrl.js +++ b/Apollo/assets/js/controllers/feesStatusCtrl.js @@ -95,7 +95,9 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n 'Content-Type': 'application/json' }, data: { - requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID + requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + branchCode:JSON.parse(localStorage.getItem('localObj')).localBranchID + } }; $http(getUniv).then(function (response) { @@ -625,6 +627,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID, installmentItems:$rootScope.updateMoreItems, batchCode:updateModel.BatchCode, + branchCode:JSON.parse(localStorage.getItem('localObj')).localBranchID } }; @@ -681,7 +684,8 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n ID:ID, courseID: courseID, studentID: studeID, - requestedtBy: JSON.parse(localStorage.getItem('localObj')).localUserID + requestedtBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + branchCode:JSON.parse(localStorage.getItem('localObj')).localBranchID } }; $http(getFees).then(function (response) { @@ -741,7 +745,8 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n ID:ID, courseID: courseID, studentID: studeID, - requestedtBy: JSON.parse(localStorage.getItem('localObj')).localUserID + requestedtBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + branchCode:JSON.parse(localStorage.getItem('localObj')).localBranchID } }; $http(setFees).then(function (response) { diff --git a/Apollo/assets/views/editActivityDetails.html b/Apollo/assets/views/editActivityDetails.html index b2f2592c..54c92feb 100755 --- a/Apollo/assets/views/editActivityDetails.html +++ b/Apollo/assets/views/editActivityDetails.html @@ -8,52 +8,52 @@
-
+
- - Activity ID is required + Activity ID is required
-
+
- - Activity name is required - Invalid activity name + Activity name is required + Invalid activity name
-
+
- - Description is required - Invalid description + Description is required + Invalid description
+ ng-class="{'has-error':Form.EditStatus.$dirty && Form.EditStatus.$invalid && viewEditStatus.list.length==0, 'has-success':Form.EditStatus.$valid}"> - + {{$item.name}} @@ -63,11 +63,11 @@ - Status is required. + ng-if="Form.EditStatus.$dirty && Form.EditStatus.$error.required && viewEditStatus.list.length==0">Status is required.
@@ -97,11 +97,11 @@
- - +