From bdafbe21084f3b25f85bfd69204929f3acece293 Mon Sep 17 00:00:00 2001 From: gayathri1990 Date: Tue, 11 Sep 2018 12:55:03 +0530 Subject: [PATCH] batchschdule changes --- .../controllers/HallTickets_Controller.php | 59 ++++++++++++------ .../application/models/Hallticket_model.php | 43 ++++++++++--- Apollo/assets/js/controllers/schCtrl.js | 4 +- .../assets/views/hallticket/batchshedule.html | 5 +- .../assets/views/hallticket/editShedule.html | 2 +- Apollo/images/Batchschedule.xlsx | Bin 0 -> 10236 bytes 6 files changed, 82 insertions(+), 31 deletions(-) create mode 100644 Apollo/images/Batchschedule.xlsx diff --git a/Apollo/api/application/controllers/HallTickets_Controller.php b/Apollo/api/application/controllers/HallTickets_Controller.php index 33906862..5a9be8a7 100644 --- a/Apollo/api/application/controllers/HallTickets_Controller.php +++ b/Apollo/api/application/controllers/HallTickets_Controller.php @@ -16,7 +16,7 @@ class HallTickets_Controller extends REST_Controller { function __construct() { - // Construct the parent class + // Construct the parent class parent::__construct(); // Configure limits on our controller methods @@ -320,13 +320,27 @@ class HallTickets_Controller extends REST_Controller { $branchId = $this->post('branchId'); $Cdate = new DateTime('now',new DateTimeZone('Asia/Kolkata')); $CreatedOn = $Cdate->format('Y-m-d H:i:s'); -/////////check semcoursemapping//// - // $data['subjectDetails'] = $this->Hallticket_model->getSubjectDetails($universityID,$tempCourseArray,$branchId); - $data['subjectDetails'] = $this->Hallticket_model->getExistDetailsfileupload($university,$courseArray,$branchId); - // print_r( $data['subjectDetails']); - if($data['subjectDetails'] == 1 ) + $fileArray = array(); + foreach($filedetails as $filedetailsarray) + { + $fileArray[]=$filedetailsarray['SubjectID']; + } + + $data['subjectDetails'] = $this->Hallticket_model->getExistDetailsfileupload($university,$courseArray,$branchId); + // print_r( $data['subjectDetails']); + if($data['subjectDetails'] == 1 ) { - foreach($courseArray as $CourseDatialArray) + + $data['SubjectMappingDetails'] = $this->Hallticket_model->getSubjectMappingDetails($university,$courseArray,$branchId); + $maparray=array(); + foreach ( $data['SubjectMappingDetails'] as $object) + { + $maparray[]=$object->SubjectCode; + } + if ($fileArray == $maparray) + { + + foreach($courseArray as $CourseDatialArray) { $course=$CourseDatialArray; $schedulemaster = array('UniversityID'=>$university,'CourseID'=>$course,'BranchCode'=>$branchId,'CreatedBy'=>$requestedBy,'CreatedOn'=>$CreatedOn); @@ -355,28 +369,35 @@ class HallTickets_Controller extends REST_Controller { 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); - } + } + } + else + { + $this->response([ + 'message' => 'Records Do Not Match With Mapped Subjects!', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); + } } // else if($data['subjectDetails'] == 0) else { $this->response([ - 'message' => 'Please Mapping the course supject!', + 'message' => ' Course Mapping for the Subject Not Found !', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); } - // else{ - - // $this->response([ - // 'message' => 'No records found!', - // 'status' => REST_Controller::HTTP_NOT_FOUND - // ], REST_Controller::HTTP_NOT_FOUND); - - // } -///////////////////// - + + + + + + + + + } public function SaveAllBatchSchedule_post() diff --git a/Apollo/api/application/models/Hallticket_model.php b/Apollo/api/application/models/Hallticket_model.php index a11cd9b0..4c17cf0e 100644 --- a/Apollo/api/application/models/Hallticket_model.php +++ b/Apollo/api/application/models/Hallticket_model.php @@ -10,7 +10,7 @@ class Hallticket_model extends CI_Model { - + /* * get university details * created by velz @@ -122,7 +122,7 @@ class Hallticket_model extends CI_Model and bsm.CourseID=semmaster.CourseID LEFT JOIN T_Batch_Schedule_Child bsc ON bsc.SchId = bsm.SchId and bsc.SubjectID=semchild.SubjectID LEFT JOIN T_SubjectMaster sm ON sm.SubjectID=semchild.SubjectID -WHERE semchild.isActive = '1' and bsm.SchId='".$mapid."' +WHERE semchild.isActive = '1' and bsm.SchId='".$mapid."' group by semchild.SubjectID,semchild.MapID"; $b=$this->db->query($sql); //print_r($b); @@ -135,8 +135,8 @@ group by semchild.SubjectID,semchild.MapID"; $this->db->select('T_Batch_Schedule_Child.SchId,T_Batch_Schedule_Child.SubjectID,T_Batch_Schedule_Child.ScheduleDate,T_Batch_Schedule_Child.FromTime,T_Batch_Schedule_Child.ToTime,T_Batch_Schedule_Child.SchChildId,T_Batch_Schedule_Child.SchId'); $this->db->from('T_Batch_Schedule_Master SCM'); $this->db->join('T_Batch_Schedule_Child','T_Batch_Schedule_Child.SchId = SCM.SchId'); - //$this->db->where('SCM.BranchCode',$branchcode); - // $this->db->where('T_Batch_Schedule_Child.SchId',$mapid); + $this->db->where('SCM.BranchCode',$branchcode); + $this->db->where('T_Batch_Schedule_Child.SchId',$mapid); $this->db->where('T_Batch_Schedule_Child.SubjectID',$row->SubjectID); $existsheduledetails = $this->db->get(); //print_r($existsheduledetails); @@ -200,16 +200,16 @@ group by semchild.SubjectID,semchild.MapID"; public function getExistDetailsfileupload($universityID,$courseIDS,$branchId) { -// print_r($courseIDS); -// echo $universityID; + $i=0; foreach($courseIDS as $c) { // $tempCourseArray= $c['CourseID']; - $this->db->select ('count(*) as count'); + $this->db->select ('count(*) as count,T_SemSubMap_Child.SubjectID'); $this->db->from('T_SemSubMap_Master'); + $this->db->join('T_SemSubMap_Child','T_SemSubMap_Child.MapID=T_SemSubMap_Master.MapID'); $this->db->where('UniversityID',$universityID); $this->db->where('CourseID',$c); $result = $this->db->get(); @@ -235,6 +235,35 @@ public function getExistDetailsfileupload($universityID,$courseIDS,$branchId) * @params university id and CourseID * created by Bala * */ +public function getSubjectMappingDetails($universityID,$courseIDS,$branchId) + { + + + + foreach($courseIDS as $c) + { + + // $tempCourseArray= $c['CourseID']; + + $this->db->select ('T_SubjectMaster.SubjectCode'); + $this->db->from('T_SemSubMap_Master'); + $this->db->join('T_SemSubMap_Child','T_SemSubMap_Child.MapID=T_SemSubMap_Master.MapID'); + $this->db->join('T_SubjectMaster','T_SubjectMaster.SubjectID=T_SemSubMap_Child.SubjectID'); + $this->db->where('T_SemSubMap_Master.UniversityID',$universityID); + $this->db->where('T_SemSubMap_Master.CourseID',$c); + $this->db->where('T_SubjectMaster.BranchCode',$branchId); + $result = $this->db->get(); + + + } + return $result->result(); + + } + /* + * check existing data,only batchschedule. + * @params university id and CourseID + * created by Bala + * */ public function getExistDetails($universityID,$courseIDS,$branchId) { diff --git a/Apollo/assets/js/controllers/schCtrl.js b/Apollo/assets/js/controllers/schCtrl.js index 8f5bd0a3..bacbd138 100644 --- a/Apollo/assets/js/controllers/schCtrl.js +++ b/Apollo/assets/js/controllers/schCtrl.js @@ -14,7 +14,7 @@ app.controller('schCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableP $scope.myModelAdd = { "date": "", - "periodStart": "", + "periodStart": "", "periodEnd":"", }; @@ -384,7 +384,7 @@ $scope.UploadFileData = function (FileDetails,myModel,courseDetails) { swal("", "Saved Successfully", "success"); $state.go($state.current, {}, {reload: true}); } else { - swal("", "Please Mapping the course supject", "error"); + swal("",response.data.message, "error"); $state.go($state.current, {}, {reload: true}); } },function(error){ diff --git a/Apollo/assets/views/hallticket/batchshedule.html b/Apollo/assets/views/hallticket/batchshedule.html index be0cc8d1..b54daebc 100644 --- a/Apollo/assets/views/hallticket/batchshedule.html +++ b/Apollo/assets/views/hallticket/batchshedule.html @@ -16,7 +16,7 @@ } a { - color: #007AFF; + color: #007AFF; } @@ -167,7 +167,8 @@

- Sample Format + + Sample Format
diff --git a/Apollo/assets/views/hallticket/editShedule.html b/Apollo/assets/views/hallticket/editShedule.html index 03090b7c..5f792e9a 100644 --- a/Apollo/assets/views/hallticket/editShedule.html +++ b/Apollo/assets/views/hallticket/editShedule.html @@ -6,7 +6,7 @@ Update Schedule Details -
+