diff --git a/Apollo/api/application/controllers/Batch_Controller.php b/Apollo/api/application/controllers/Batch_Controller.php index 348b13d5..7a53f21c 100755 --- a/Apollo/api/application/controllers/Batch_Controller.php +++ b/Apollo/api/application/controllers/Batch_Controller.php @@ -41,6 +41,7 @@ class Batch_Controller extends REST_Controller { $details['UniversityID'] = $this->post('universityName'); $details['CreatedBy'] = $this->post('createdBy'); $details['IsActive'] = $this->post('status'); + $details['BranchCode'] = $this->post('branchCode'); $details['CreatedOn'] = $now->format('Y-m-d H:i:s'); $batchDetails = $this->batch_model->addBatch($details);// Check if the users data store contains users (in case the database result returns NULL) @@ -68,7 +69,8 @@ class Batch_Controller extends REST_Controller { public function getBatchDetails_post() { $requestedBy = $this->post('requestedBy'); - $getBatch = $this->batch_model->getBatch($requestedBy); + $branchCode = $this->post('branchCode'); + $getBatch = $this->batch_model->getBatch($requestedBy,$branchCode); if ($getBatch) { $getBatch['status'] = REST_Controller::HTTP_OK; @@ -99,6 +101,7 @@ class Batch_Controller extends REST_Controller { $details['BatchDate'] = $this->post('batchDate'); $details['IsActive'] = $this->post('status'); $details['UpdatedBy'] = $this->post('updatedBy'); + $details['BranchCode'] = $this->post('branchCode'); $details['UpdatedOn'] = $now->format("Y-m-d H:i:s"); // print_r( $details['UpdatedOn']) @@ -134,6 +137,7 @@ class Batch_Controller extends REST_Controller { $details['UniversityID'] = $this->post('universityID'); $details['IsDefault'] = $this->post('IsDefault'); $details['UpdatedBy'] = $this->post('updatedBy'); + $details['BranchCode'] = $this->post('branchCode'); $details['UpdatedOn'] = $now->format("Y-m-d H:i:s"); $updateDetails = $this->batch_model->updateDefaultBatch($details);// Check if the users data store contains users (in case the database result returns NULL) diff --git a/Apollo/api/application/controllers/Center_Controller.php b/Apollo/api/application/controllers/Center_Controller.php index 8b000cd8..2cff09cc 100755 --- a/Apollo/api/application/controllers/Center_Controller.php +++ b/Apollo/api/application/controllers/Center_Controller.php @@ -40,6 +40,7 @@ class Center_Controller extends REST_Controller { $details['Comments'] = $this->post('Comments'); $details['CreatedBy'] = $this->post('createdBy'); $details['IsActive'] = $this->post('status'); + $details['BranchCode'] = $this->post('branchCode'); $details['CreatedOn'] = $now->format('Y-m-d H:i:s'); $centerDetails = $this->center_model->addCenter($details);// Check if the users data store contains users (in case the database result returns NULL) @@ -67,7 +68,8 @@ class Center_Controller extends REST_Controller { public function getCenterDetails_post() { $requestedBy = $this->post('requestedBy'); - $getCenter = $this->center_model->getCenter($requestedBy); + $branchCode = $this->post('branchCode'); + $getCenter = $this->center_model->getCenter($requestedBy,$branchCode); // print_r($getCenter); // die; if ($getCenter) @@ -103,6 +105,7 @@ class Center_Controller extends REST_Controller { $CenterID=$this->post('CenterID'); $details['IsActive'] = $this->post('status'); $details['UpdateBy'] = $this->post('updateBy'); + $details['BranchCode'] = $this->post('branchCode'); $details['UpdateOn'] = $now->format("Y-m-d H:i:s"); diff --git a/Apollo/api/application/controllers/Course_Controller.php b/Apollo/api/application/controllers/Course_Controller.php index fc35a4d3..b7cf973a 100755 --- a/Apollo/api/application/controllers/Course_Controller.php +++ b/Apollo/api/application/controllers/Course_Controller.php @@ -38,6 +38,7 @@ class Course_Controller extends REST_Controller { $details['UniversityID'] = $this->post('universityName'); $details['Specilization1'] = $this->post('specilization1'); $details['Specilization2'] = $this->post('specilization2'); + $details['BranchCode'] = $this->post('branchCode'); //$details['FeesType'] = $this->post('feesType'); $details['PC'] = $this->post('provFess'); @@ -59,9 +60,9 @@ class Course_Controller extends REST_Controller { array_push($jsonSemFeesData,$jsonLateralFeesData); } // get subject details - $subjectDetails=$this->post('subjects'); + //$subjectDetails=$this->post('subjects'); - $courseDetails = $this->course_model->addCourse($details,$jsonSemFeesData,$subjectDetails);// Check if the users data store contains users (in case the database result returns NULL) + $courseDetails = $this->course_model->addCourse($details,$jsonSemFeesData);// $subjectDetails Check if the users data store contains users (in case the database result returns NULL) if ($courseDetails) { $courseDetails['status'] = REST_Controller::HTTP_OK; @@ -86,7 +87,8 @@ class Course_Controller extends REST_Controller { public function getCourseDetails_post() { $requestedBy = $this->post('requestedBy'); - $getCourse = $this->course_model->getCourse($requestedBy); + $branchCode = $this->post('branchCode'); + $getCourse = $this->course_model->getCourse($requestedBy,$branchCode); if ($getCourse) { @@ -108,7 +110,8 @@ class Course_Controller extends REST_Controller { public function getCourseUnivFeesDetails_post() { $requestedBy = $this->post('requestedBy'); - $getCourseUnivFee = $this->course_model->getCourseUnivFeesTypes($requestedBy); + $branchCode = $this->post('branchCode'); + $getCourseUnivFee = $this->course_model->getCourseUnivFeesTypes($requestedBy,$branchCode); if ($getCourseUnivFee) { @@ -148,6 +151,7 @@ class Course_Controller extends REST_Controller { $details['OtherFees'] = $this->post('otherAmount'); $details['UpdatedBy'] = $this->post('updatedBy'); $details['UpdatedOn'] = $now->format('Y-m-d H:i:s'); + $details['BranchCode'] = $this->post('branchCode'); $existCourseID = $this->post('existCourseID'); $jsonRegularFeesData=$this->post('regularFeesAmounts'); $jsonLateralFeesData=$this->post('lateralFeesAmounts'); @@ -163,13 +167,14 @@ class Course_Controller extends REST_Controller { } // update course subject details - $subjectDetails['UniversityID'] = $this->post('universityID'); + /* $subjectDetails['UniversityID'] = $this->post('universityID'); $subjectDetails['CourseID'] = $this->post('courseID'); $subjectDetails['Subjects'] = $this->post('subjects'); $subjectDetails['UpdatedBy'] = $this->post('updatedBy'); - $subjectDetails['UpdatedOn'] = $now->format('Y-m-d H:i:s'); + $subjectDetails['UpdatedOn'] = $now->format('Y-m-d H:i:s');*/ - $updateDetails = $this->course_model->updateCourse($details,$jsonSemFeesData,$subjectDetails);// Check if the users data store contains users (in case the database result returns NULL) + + $updateDetails = $this->course_model->updateCourse($details,$jsonSemFeesData);// $subjectDetails Check if the users data store contains users (in case the database result returns NULL) if ($updateDetails) { $updateDetails['status'] = REST_Controller::HTTP_OK; diff --git a/Apollo/api/application/controllers/SessionMater_Controller.php b/Apollo/api/application/controllers/SessionMater_Controller.php index 5fd2eabb..b54e3493 100755 --- a/Apollo/api/application/controllers/SessionMater_Controller.php +++ b/Apollo/api/application/controllers/SessionMater_Controller.php @@ -35,6 +35,7 @@ class SessionMater_Controller extends REST_Controller { $details['SessionDate'] = $this->post('sessionDate'); $details['CreatedBy'] = $this->post('createdBy'); $details['IsActive'] = $this->post('status'); + $details['BranchCode'] = $this->post('branchCode'); $details['CreatedOn'] = $now->format('Y-m-d H:i:s'); $university['UniversityID'] = $this->post('universityName'); @@ -63,7 +64,8 @@ class SessionMater_Controller extends REST_Controller { public function getSessionMaterDetails_post() { $requestedBy = $this->post('requestedBy'); - $getSession = $this->sessionM_model->getSession($requestedBy); + $branchCode = $this->post('branchCode'); + $getSession = $this->sessionM_model->getSession($requestedBy,$branchCode); if ($getSession) { $getSession['status'] = REST_Controller::HTTP_OK; @@ -96,6 +98,7 @@ class SessionMater_Controller extends REST_Controller { $universityDetails['University'] = $this->post('university'); $details['UpdatedBy'] = $this->post('updatedBy'); $details['UpdatedOn'] = $now->format("Y-m-d H:i:s"); + $details['BranchCode'] = $this->post('branchCode'); $updateDetails = $this->sessionM_model->updateSession($details,$universityDetails);// Check if the users data store contains users (in case the database result returns NULL) if ($updateDetails) diff --git a/Apollo/api/application/controllers/Subject_Controller.php b/Apollo/api/application/controllers/Subject_Controller.php index 0ed22917..cd87d7f6 100755 --- a/Apollo/api/application/controllers/Subject_Controller.php +++ b/Apollo/api/application/controllers/Subject_Controller.php @@ -38,6 +38,7 @@ class Subject_Controller extends REST_Controller { $details['SubjectName'] = $this->post('SubjectName'); $details['IsActive'] = $this->post('Status'); $details['CreatedBy'] = $this->post('createdBy'); + $details['BranchCode'] = $this->post('branchCode'); $details['CreatedOn'] = $now->format('Y-m-d H:i:s'); $subjectDetails = $this->subject_model->addSubject($details);// Check if the users data store contains users (in case the database result returns NULL) @@ -66,8 +67,9 @@ class Subject_Controller extends REST_Controller { public function getSubjectDetails_post() { $requestedBy = $this->post('requestedBy'); + $branchCode = $this->post('branchCode'); - $getSubject = $this->subject_model->getSubject($requestedBy); + $getSubject = $this->subject_model->getSubject($requestedBy,$branchCode); @@ -101,6 +103,7 @@ class Subject_Controller extends REST_Controller { $SubjectID = $this->post('SubjectID'); $details['IsActive'] = $this->post('Status'); $details['UpdatedBy'] = $this->post('updatedBy'); + $details['BranchCode'] = $this->post('branchCode'); $details['UpdatedOn'] = $now->format('Y-m-d H:i:s'); // print_r($SubjectID);die(); diff --git a/Apollo/api/application/models/Batch_model.php b/Apollo/api/application/models/Batch_model.php index 9353c76f..62d49ffa 100755 --- a/Apollo/api/application/models/Batch_model.php +++ b/Apollo/api/application/models/Batch_model.php @@ -20,6 +20,7 @@ class Batch_model extends CI_Model { $this->db->select('BatchCode'); $this->db->where('BatchCode', $arrayDetails['BatchCode']); + $this->db->where('BranchCode', $arrayDetails['BranchCode']); if($this->db->get(BATCH)->first_row()){ $result['batchStatus'] = false; $result['message'] = "This batch code is already exist."; @@ -45,11 +46,13 @@ class Batch_model extends CI_Model { * created by srk * */ - public function getBatch() + public function getBatch($requestedBy=null,$branchCode=null) { $this->db->select('CU.BatchCode,CU.BatchName,CU.IsActive,CU.BatchDate,CU.IsDefault,US.UniversityID,US.UniversityName'); $this->db->from(BATCH.' as CU'); $this->db->join(UNIVERSITY.' as US', 'US.UniversityID = CU.UniversityID'); + $this->db->where('CU.BranchCode',$branchCode); + $this->db->where('US.BranchCode',$branchCode); $this->db->order_by('CU.CreatedOn','DESC'); $batchDetails = $this->db->get(); @@ -63,7 +66,7 @@ class Batch_model extends CI_Model { $result['message'] = "No records found!"; } - $result['universityDetails'] = $this->getUniversityDetails(); + $result['universityDetails'] = $this->getUniversityDetails($requestedBy,$branchCode); return $result; @@ -76,6 +79,7 @@ class Batch_model extends CI_Model { public function updateBatch($arrayDetails=null) { $this->db->where('BatchCode',$arrayDetails['BatchCode']); + $this->db->where('BranchCode',$arrayDetails['BranchCode']); $upateStatus=$this->db->update(BATCH, $arrayDetails); if($upateStatus){ @@ -97,11 +101,12 @@ class Batch_model extends CI_Model { * Get university details * created by Srk * */ - public function getUniversityDetails()//doubt + public function getUniversityDetails($requestedBy,$branchCode) { $this->db->select('UniversityID,UniversityName'); $this->db->order_by('UniversityID','ASC'); $this->db->where('IsActive','1'); + $this->db->where('BranchCode',$branchCode); // $this->db->where_not_in('ID', $id); $universityDetails = $this->db->get(UNIVERSITY); return $universityDetails->result(); @@ -118,6 +123,7 @@ class Batch_model extends CI_Model { $setDefaultBatch['UpdatedOn'] = $details['UpdatedOn']; // $this->db->where('BatchCode',$details['BatchCode']); $this->db->where('UniversityID',$details['UniversityID']); + $this->db->where('BranchCode',$details['BranchCode']); $upateStatus=$this->db->update(BATCH, $setDefaultBatch); if($upateStatus){ $this->db->where('BatchCode',$details['BatchCode']); diff --git a/Apollo/api/application/models/Center_model.php b/Apollo/api/application/models/Center_model.php index 02d085de..22a196a2 100755 --- a/Apollo/api/application/models/Center_model.php +++ b/Apollo/api/application/models/Center_model.php @@ -20,6 +20,7 @@ class Center_model extends CI_Model { $this->db->select('CenterCode'); $this->db->where('CenterCode', $arrayDetails['CenterCode']); + $this->db->where('BranchCode', $arrayDetails['BranchCode']); if($this->db->get(CENTER)->first_row()){ $result['centerStatus'] = false; $result['message'] = "This center Code is already exist!"; @@ -46,10 +47,11 @@ class Center_model extends CI_Model { - public function getCenter() + public function getCenter($requestedBy=null,$branchCode=null) { - $this->db->select('*'); - $this->db->order_by('CreatedOn','DESC'); + $this->db->select('*'); + $this->db->where('BranchCode',$branchCode); + $this->db->order_by('CenterID','DESC'); $centerDetails = $this->db->get(CENTER); // print_r($centerDetails); // die; @@ -77,14 +79,15 @@ class Center_model extends CI_Model { $this->db->select('CenterCode'); $this->db->where('CenterCode',$arrayDetails['CenterCode']); - //$this->db->where('SubjectCode !=', $arrayDetails['SubjectCode']); - $this->db->where('CenterCode !=',$arrayDetails['CenterCode']); + $this->db->where('BranchCode',$arrayDetails['BranchCode']); + $this->db->where('CenterID !=',$CenterID); if($this->db->get(CENTER)->first_row()){ $result['centerStatus']=false; $result['message']= " This Center code already exist"; } else{ $this->db->where('CenterID',$CenterID); + $this->db->where('BranchCode',$arrayDetails['BranchCode']); $updateStatus=$this->db->update(CENTER, $arrayDetails); if($updateStatus){ diff --git a/Apollo/api/application/models/Course_model.php b/Apollo/api/application/models/Course_model.php index 3b91345a..178bd819 100755 --- a/Apollo/api/application/models/Course_model.php +++ b/Apollo/api/application/models/Course_model.php @@ -15,11 +15,12 @@ class Course_model extends CI_Model { * created by kms * */ - public function addCourse($arrayDetails=null,$jsonSemFeesData=null,$subjectDetails=null) + public function addCourse($arrayDetails=null,$jsonSemFeesData=null) //$subjectDetails=null { $this->db->select('CourseCode'); $this->db->where('CourseCode', $arrayDetails['CourseCode']); $this->db->where('UniversityID', $arrayDetails['UniversityID']); + $this->db->where('BranchCode', $arrayDetails['BranchCode']); if($this->db->get(COURSE)->first_row()){ $result['courseStatus'] = false; $result['message'] = "This course id is already exist in same university"; @@ -40,9 +41,11 @@ class Course_model extends CI_Model { $this->db->insert(COURSE_FEES, $insertFeesArray); } - if($subjectDetails){ + /* + // hide subject insert query + if($subjectDetails){ $this->insertCourseSubjects($arrayDetails,$insert_id,$subjectDetails); - } + }*/ $result['courseStatus'] = true; $result['message'] = "Successfully course details added"; @@ -71,12 +74,14 @@ class Course_model extends CI_Model { * created by kms * */ - public function getCourse() + public function getCourse($requestedBy,$branchCode) { $this->db->select('CU.CourseID,CU.CourseCode,CU.CourseName,CU.FeesType,CU.Specilization1,CU.Specilization2,CU.PC,CU.DC,CU.TC,CU.MC,CU.OtherFees,CU.IsActive,US.UniversityID,US.UniversityName'); $this->db->from(COURSE.' as CU'); $this->db->join(UNIVERSITY.' as US', 'US.UniversityID = CU.UniversityID'); - $this->db->order_by('CU.CreatedOn','DESC'); + $this->db->where('CU.BranchCode',$branchCode); + $this->db->where('US.BranchCode',$branchCode); + $this->db->order_by('CU.CourseID','DESC'); $courseDetails = $this->db->get(); if($courseDetails->result()){ @@ -99,27 +104,24 @@ class Course_model extends CI_Model { $fetchData['UniversityID']=$row->UniversityID; $fetchData['UniversityName']=$row->UniversityName; $fetchData['feesStructures'] = $this->getCourseFeesDetails($row->CourseID); - $fetchData['existSubjects'] = $this->getExistCourseSubjectDetails($row->CourseID); - // print_r($fetchData);exit(); + // $fetchData['existSubjects'] = $this->getExistCourseSubjectDetails($row->CourseID); $storeCourseArray[]=$fetchData; } $result['details'] = $storeCourseArray; - // print_r($storeCourseArray);exit(); } else { $result['courseStatus'] = false; $result['message'] = "No records found!"; } - - // print_r($result);exit(); + return $result; } - public function getCourseUnivFeesTypes() { - $result['universityDetails'] = $this->getUniversityDetails(); + public function getCourseUnivFeesTypes($requestedBy=null,$requestedBranch=null) { + $result['universityDetails'] = $this->getUniversityDetails($requestedBy,$requestedBranch); $result['feesDetails'] = $this->getFeesDetails(); - $result['subjectetails'] = $this->getSubjectDetails(); + // $result['subjectetails'] = $this->getSubjectDetails($requestedBy,$requestedBranch); $result['courseStatus'] = true; return $result; } @@ -128,11 +130,12 @@ class Course_model extends CI_Model { * update course details * created by kms * */ - public function updateCourse($arrayDetails=null,$jsonData=null,$subjectDetails=null) + public function updateCourse($arrayDetails=null,$jsonData=null) //$subjectDetails=null { $this->db->select('CourseCode'); $this->db->where('CourseCode', $arrayDetails['CourseCode']); $this->db->where('UniversityID', $arrayDetails['UniversityID']); + $this->db->where('BranchCode', $arrayDetails['BranchCode']); $this->db->where('CourseID !=', $arrayDetails['CourseID']); if($this->db->get(COURSE)->first_row()){ $result['courseStatus'] = false; @@ -140,6 +143,7 @@ class Course_model extends CI_Model { } else{ $this->db->where('CourseID',$arrayDetails['CourseID']); + $this->db->where('BranchCode', $arrayDetails['BranchCode']); $upateStatus=$this->db->update(COURSE, $arrayDetails); if($upateStatus) { @@ -165,7 +169,7 @@ class Course_model extends CI_Model { } // update course subject details - $this->updateCourseSubjcetDetails($subjectDetails); + // $this->updateCourseSubjcetDetails($subjectDetails); $result['courseStatus'] = true; @@ -189,11 +193,12 @@ class Course_model extends CI_Model { * get university details * created by kms * */ - public function getUniversityDetails() + public function getUniversityDetails($requestedBy,$requestedBranch) { $this->db->select('UniversityID,UniversityName'); $this->db->order_by('UniversityID','ASC'); $this->db->where('IsActive','1'); + $this->db->where('BranchCode',$requestedBranch); $universityDetails = $this->db->get(UNIVERSITY); return $universityDetails->result(); } @@ -269,10 +274,11 @@ class Course_model extends CI_Model { * get subject details * created by kms * */ - public function getSubjectDetails(){ + public function getSubjectDetails($requestedBy,$requestedBranch){ $this->db->select('SubjectID,SubjectCode,SubjectName'); $this->db->order_by('SubjectID','DESC'); $this->db->where('IsActive','1'); + $this->db->where('BranchCode',$requestedBranch); $subjectDetails = $this->db->get(SUBJECTMASTER); return $subjectDetails->result(); } diff --git a/Apollo/api/application/models/SeesionMaster_model.php b/Apollo/api/application/models/SeesionMaster_model.php index 5b83bc62..2de03cc8 100755 --- a/Apollo/api/application/models/SeesionMaster_model.php +++ b/Apollo/api/application/models/SeesionMaster_model.php @@ -20,6 +20,7 @@ class SeesionMaster_model extends CI_Model { $this->db->select('SessionName'); $this->db->where('SessionName', $arrayDetails['SessionName']); + $this->db->where('BranchCode', $arrayDetails['BranchCode']); if($this->db->get(SESSIONMASTER)->first_row()){ $result['sessionStatus'] = false; $result['message'] ="This sessions is already exist."; @@ -30,6 +31,7 @@ class SeesionMaster_model extends CI_Model { $insertMaster['CreatedBy']=$arrayDetails['CreatedBy']; $insertMaster['IsActive']=$arrayDetails['IsActive']; $insertMaster['CreatedOn']=$arrayDetails['CreatedOn']; + $insertMaster['BranchCode']=$arrayDetails['BranchCode']; $this->db->insert(SESSIONMASTER, $insertMaster); @@ -66,13 +68,15 @@ class SeesionMaster_model extends CI_Model { * created by kms * */ - public function getSession() + public function getSession($requestedBy=null,$branchCode=null) { $this->db->select('SM.SessionID,SM.SessionDate,SM.SessionName,GROUP_CONCAT(SD.UniversityID) as UniversityID,GROUP_CONCAT(SM.SessionID) as GrpID,SM.IsActive,GROUP_CONCAT(US.UniversityName) as UniversityName'); $this->db->from(SESSIONMASTER.' as SM'); $this->db->join(SESSIONDETAILS.' as SD', 'SM.SessionID = SD.SessionID'); $this->db->join(UNIVERSITY.' as US', 'US.UniversityID = SD.UniversityID'); $this->db->where('SD.IsActive','1'); + $this->db->where('SM.BranchCode',$branchCode); + $this->db->where('US.BranchCode',$branchCode); $this->db->order_by('SM.SessionID','DESC'); $this->db->group_by('SM.SessionID','DESC'); $sessionDetails = $this->db->get(); @@ -87,7 +91,7 @@ class SeesionMaster_model extends CI_Model { } // load batch model for get university details $this->load->model('Batch_model', 'batch'); - $result['universityDetails'] = $this->batch->getUniversityDetails(); + $result['universityDetails'] = $this->batch->getUniversityDetails($requestedBy,$branchCode); return $result; @@ -102,6 +106,7 @@ class SeesionMaster_model extends CI_Model { { $this->db->select('SessionName'); $this->db->where('SessionName', $arrayDetails['SessionName']); + $this->db->where('BranchCode', $arrayDetails['BranchCode']); $this->db->where('SessionID !=', $arrayDetails['SessionID']); if($this->db->get(SESSIONMASTER)->first_row()){ $result['sessionStatus'] = false; @@ -109,6 +114,7 @@ class SeesionMaster_model extends CI_Model { } else{ $this->db->where('SessionID', $arrayDetails['SessionID']); + $this->db->where('BranchCode', $arrayDetails['BranchCode']); $upateStatus=$this->db->update(SESSIONMASTER, $arrayDetails); if($upateStatus){ @@ -174,11 +180,12 @@ class SeesionMaster_model extends CI_Model { * Get university details * created by kms * */ - public function getUniversityDetails()//doubt + public function getUniversityDetails($requestedBy,$branchCode) { $this->db->select('UniversityID,UniversityName'); $this->db->order_by('UniversityID','ASC'); $this->db->where('IsActive','1'); + $this->db->where('BranchCode',$branchCode); // $this->db->where_not_in('ID', $id); $universityDetails = $this->db->get(UNIVERSITY); return $universityDetails->result(); diff --git a/Apollo/api/application/models/Subject_model.php b/Apollo/api/application/models/Subject_model.php index d4e185a9..cdc61da0 100755 --- a/Apollo/api/application/models/Subject_model.php +++ b/Apollo/api/application/models/Subject_model.php @@ -15,6 +15,7 @@ class Subject_model extends CI_Model $this->db->select('SubjectCode'); $this->db->where('SubjectCode',$arrayDetails['SubjectCode']); + $this->db->where('BranchCode',$arrayDetails['BranchCode']); if($this->db->get(SUBJECTMASTER)->first_row()){ $result['SubjectStatus']=false; $result['message']="This subject code already exists"; @@ -44,12 +45,14 @@ public function updateSubject($arrayDetails=null,$SubjectID=null) { $this->db->select('SubjectCode'); $this->db->where('SubjectCode',$arrayDetails['SubjectCode']); - $this->db->where('SubjectCode !=', $arrayDetails['SubjectCode']); + $this->db->where('SubjectID !=', $SubjectID); + $this->db->where('BranchCode', $arrayDetails['BranchCode']); if($this->db->get(SUBJECTMASTER)->first_row()){ $result['SubjectStatus']=false; $result['message']="This subject code is already exists"; }else{ $this->db->where('SubjectID',$SubjectID); + $this->db->where('BranchCode', $arrayDetails['BranchCode']); $upateStatus=$this->db->update(SUBJECTMASTER, $arrayDetails); @@ -78,10 +81,11 @@ public function updateSubject($arrayDetails=null,$SubjectID=null) - public function getSubject() + public function getSubject($requestedBy=null,$branchCode=null) { - $this->db->select('*'); - $this->db->order_by('CreatedOn','DESC'); + $this->db->select('*'); + $this->db->where('BranchCode',$branchCode); + $this->db->order_by('SubjectID','DESC'); $subjectDetails = $this->db->get(SUBJECTMASTER); diff --git a/Apollo/assets/js/controllers/batchCtrl.js b/Apollo/assets/js/controllers/batchCtrl.js index 1965ed58..31400e69 100755 --- a/Apollo/assets/js/controllers/batchCtrl.js +++ b/Apollo/assets/js/controllers/batchCtrl.js @@ -104,7 +104,8 @@ app.controller('batchCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTabl batcheDate: $filter('date')(new Date(myModel.date), 'dd-MM-yyyy'), universityName: myModel.universityName, status: myModel.switchsetting, - createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID + createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + branchCode:JSON.parse(localStorage.getItem('localObj')).localBranchID } }; $http(addBatch).then(function (response) { @@ -170,7 +171,8 @@ app.controller('batchCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTabl batchName: editModel.editBatchName, batchDate: editModel.editDate, status: myModel.IsActive, - createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID + createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + branchCode:JSON.parse(localStorage.getItem('localObj')).localBranchID } }; $http(update).then(function (response) { @@ -210,7 +212,8 @@ app.controller('batchCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTabl batchCode: details.BatchCode, IsDefault: $scope.defaultBatch, universityID: details.UniversityID, - updatedBy: JSON.parse(localStorage.getItem('localObj')).localUserID + updatedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + branchCode:JSON.parse(localStorage.getItem('localObj')).localBranchID } }; $http(changeDefault).then(function (response) { @@ -246,7 +249,8 @@ app.controller('batchCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTabl '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 } }; diff --git a/Apollo/assets/js/controllers/centerCtrl.js b/Apollo/assets/js/controllers/centerCtrl.js index 50616c38..8203f8c7 100755 --- a/Apollo/assets/js/controllers/centerCtrl.js +++ b/Apollo/assets/js/controllers/centerCtrl.js @@ -83,7 +83,8 @@ app.controller('centerCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab Address: myModel.Address, Comments:myModel.Comment, status: myModel.switchsetting, - createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID + createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + branchCode:JSON.parse(localStorage.getItem('localObj')).localBranchID } }; $http(addCenter).then(function (response) { @@ -160,7 +161,8 @@ app.controller('centerCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab Comments:myModel.Comments, status: myModel.IsActive, CenterID:myModel.CenterID, - updateBy: JSON.parse(localStorage.getItem('localObj')).localUserID + updateBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + branchCode:JSON.parse(localStorage.getItem('localObj')).localBranchID } }; $http(update).then(function (response) { @@ -196,7 +198,8 @@ app.controller('centerCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab '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 } }; diff --git a/Apollo/assets/js/controllers/courseCtrl.js b/Apollo/assets/js/controllers/courseCtrl.js index a0569932..dfd947cb 100755 --- a/Apollo/assets/js/controllers/courseCtrl.js +++ b/Apollo/assets/js/controllers/courseCtrl.js @@ -34,8 +34,8 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab $rootScope.updateMoreItems = []; $scope.editId = -1; $scope.setEditId = function (pid,p) { - $scope.localSubjectDetails=""; - $scope.localSubjectDetails = JSON.parse(localStorage.getItem('localSubjectDetails')); + // $scope.localSubjectDetails=""; + // $scope.localSubjectDetails = JSON.parse(localStorage.getItem('localSubjectDetails')); $scope.localUniversityDetails=""; $scope.localUniversityDetails = JSON.parse(localStorage.getItem('localUniversityDetails')); @@ -106,7 +106,7 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab // get exist subject details - $scope.editSubject = []; + /* $scope.editSubject = []; angular.forEach(p.existSubjects, function (values, keys) { $scope.getDeactiveSub = { @@ -123,7 +123,7 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab $scope.viewSubject = { list: $scope.editSubject, - } + }*/ $scope.editId = pid; }; @@ -214,7 +214,8 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID, specilization1:myModel.specilization1, specilization2:myModel.specilization2, - subjects:myModel.subject + // subjects:myModel.subject, + branchCode:JSON.parse(localStorage.getItem('localObj')).localBranchID } }; $http(addCourse).then(function (response) { @@ -304,7 +305,9 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab specilization1:myModel.Specilization1, specilization2:myModel.Specilization2, existCourseID:myModel.CourseID, - subjects:subjects.list + // subjects:subjects.list, + branchCode:JSON.parse(localStorage.getItem('localObj')).localBranchID + } }; $http(update).then(function (response) { @@ -344,7 +347,9 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab '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(getCourse).then(function (response) { @@ -354,70 +359,17 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab $scope.data = response.data.details; - // $scope.university=response.data.universityDetails; - // $scope.feesDetails=response.data.feesDetails; - // $scope.myModel.ListName=$scope.feesDetails[0]; - - // $scope.myModel.programListName=$scope.myModel.ListName.programType[0].ListCode; - - // // single sitting regular course details in model - - // $scope.myModelRegular = { - // "FeesType":$scope.feesDetails[0].ListCode, - // "FeesName":$scope.feesDetails[0].ListName, - // "program":$scope.feesDetails[0].programType[0].ListCode, - // "programName":$scope.feesDetails[0].programType[0].ListName, - // "FeesAmount":"", - - // }; - - // // single sitting lateral course details in model - - // $scope.myModelLateral = { - // "FeesType":$scope.feesDetails[0].ListCode, - // "FeesName":$scope.feesDetails[0].ListName, - // "program":$scope.feesDetails[0].programType[1].ListCode, - // "programName":$scope.feesDetails[0].programType[1].ListName, - // "FeesAmount":"", - - // }; - - // // single sitting Sem_Year course details in model - - // $scope.myModelSemYear = { - // "FeesType":$scope.feesDetails[1].ListCode, - // "FeesName":$scope.feesDetails[1].ListName, - // "program":$scope.feesDetails[1].programType[0].ListCode, - // "programName":"", - // "FeesAmount":"", - - // }; - // $rootScope.myModelSemYear1 = { - // "FeesType":$scope.feesDetails[1].ListCode, - // "FeesName":$scope.feesDetails[1].ListName, - // "program":$scope.feesDetails[1].programType[0].ListCode, - // "programName":"", - // "FeesAmount":"", - - // }; - } else { $scope.emptyData=false; $scope.loader=true; - // getUniversity_FeesDetails(); - // $scope.university=response.data.universityDetails; - // $scope.feesDetails=response.data.feesDetails; - // $scope.myModel.ListName=$scope.feesDetails[0]; - // $scope.myModel.programListName=$scope.myModel.ListName.programType[0].ListCode; - } }); }; function getUniversity_FeesDetails() { - localStorage.setItem('localSubjectDetails', ''); + // localStorage.setItem('localSubjectDetails', ''); localStorage.setItem('localUniversityDetails', ''); $scope.subjectDetails=[]; @@ -428,26 +380,29 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab '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(getCourseUnivFee).then(function (response) { if (response.data.status==200 && response.data.courseStatus) { $scope.university=response.data.universityDetails; - $scope.subjectDetails=[]; + // $scope.subjectDetails=[]; $scope.feesDetails=response.data.feesDetails; $scope.myModel.ListName=$scope.feesDetails[0]; $scope.myModel.programListName=$scope.myModel.ListName.programType[0].ListCode; + //hide subject details - angular.forEach(response.data.subjectetails, function (values, keys) { + /* angular.forEach(response.data.subjectetails, function (values, keys) { $scope.subData = { SubjectID: values.SubjectID, SubjectName: values.SubjectCode +'-'+values.SubjectName }; $scope.subjectDetails.push($scope.subData); - }); + });*/ // single sitting regular course details in model @@ -501,7 +456,7 @@ app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTab } localStorage.setItem('localUniversityDetails', JSON.stringify($scope.university)); - localStorage.setItem('localSubjectDetails', JSON.stringify($scope.subjectDetails)); + // localStorage.setItem('localSubjectDetails', JSON.stringify($scope.subjectDetails)); }); diff --git a/Apollo/assets/js/controllers/sessionMasterCtrl.js b/Apollo/assets/js/controllers/sessionMasterCtrl.js index 2871be8e..29c3e35f 100755 --- a/Apollo/assets/js/controllers/sessionMasterCtrl.js +++ b/Apollo/assets/js/controllers/sessionMasterCtrl.js @@ -98,7 +98,9 @@ app.controller('sessionMasterCtrl', ["$scope","$rootScope","toaster", "$filter", sessionDate: $filter('date')(new Date(myModel.date), 'dd-MM-yyyy'), universityName: myModel.universityName, status: myModel.switchsetting, - createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID + createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + branchCode:JSON.parse(localStorage.getItem('localObj')).localBranchID + } }; $http(addSession).then(function (response) { @@ -162,7 +164,9 @@ app.controller('sessionMasterCtrl', ["$scope","$rootScope","toaster", "$filter", sessionName: editModel.editSessionName, status: myModel.IsActive, university: university.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) { @@ -198,7 +202,9 @@ app.controller('sessionMasterCtrl', ["$scope","$rootScope","toaster", "$filter", '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 + } }; diff --git a/Apollo/assets/js/controllers/subjectCtrl.js b/Apollo/assets/js/controllers/subjectCtrl.js index 0b8b93d9..ce579b62 100755 --- a/Apollo/assets/js/controllers/subjectCtrl.js +++ b/Apollo/assets/js/controllers/subjectCtrl.js @@ -81,7 +81,9 @@ app.controller('subjectCtrl', ["$scope", "$rootScope","toaster", "$filter", "ngT SubjectCode:myModel.SubjectCode, SubjectName:myModel.SubjectName, Status: myModel.switchsetting, - createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID + createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + branchCode:JSON.parse(localStorage.getItem('localObj')).localBranchID + } }; @@ -159,8 +161,10 @@ app.controller('subjectCtrl', ["$scope", "$rootScope","toaster", "$filter", "ngT SubjectName:myModel.SubjectName, Status:myModel.IsActive, SubjectID: myModel. SubjectID, //auto id - 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) { if (response.data.status==200 && response.data.SubjectStatus) { @@ -201,7 +205,9 @@ app.controller('subjectCtrl', ["$scope", "$rootScope","toaster", "$filter", "ngT '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 + } }; diff --git a/Apollo/assets/views/batch.html b/Apollo/assets/views/batch.html index ae2b97ac..8c5905aa 100755 --- a/Apollo/assets/views/batch.html +++ b/Apollo/assets/views/batch.html @@ -153,12 +153,12 @@ Batch code is required Invalid course id + ng-if="Form.batchCode.$dirty && Form.batchCode.$error.pattern">Invalid batch code