From 84c0f1fc623f13a13444b00cd9a7ac3fd0a535ff Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Sat, 8 Sep 2018 16:19:16 +0530 Subject: [PATCH 01/14] checkin by bala --- .../controllers/HallTickets_Controller.php | 1247 +++---- .../application/models/Hallticket_model.php | 2992 +++++++++-------- Apollo/assets/js/controllers/schCtrl.js | 1456 ++++---- .../assets/views/hallticket/batchshedule.html | 604 ++-- .../assets/views/hallticket/editShedule.html | 314 +- 5 files changed, 3317 insertions(+), 3296 deletions(-) mode change 100755 => 100644 Apollo/api/application/controllers/HallTickets_Controller.php mode change 100755 => 100644 Apollo/api/application/models/Hallticket_model.php mode change 100755 => 100644 Apollo/assets/js/controllers/schCtrl.js mode change 100755 => 100644 Apollo/assets/views/hallticket/batchshedule.html mode change 100755 => 100644 Apollo/assets/views/hallticket/editShedule.html diff --git a/Apollo/api/application/controllers/HallTickets_Controller.php b/Apollo/api/application/controllers/HallTickets_Controller.php old mode 100755 new mode 100644 index 4c8b7d13..33906862 --- a/Apollo/api/application/controllers/HallTickets_Controller.php +++ b/Apollo/api/application/controllers/HallTickets_Controller.php @@ -1,622 +1,627 @@ -methods['getCourseSubjectDetails_post']['limit'] = 500; // 500 requests per hour per user/key - $this->methods['getUniversityCourseDetails_post']['limit'] = 500; // 500 requests per hour per user/key - $this->methods['updateSheduleDetails_post']['limit'] = 500; // 500 requests per hour per user/key - $this->methods['BatchUploadDataDetails_post']['limit'] = 500; - - // load the model - $this->load->model('Hallticket_model', 'Hallticket_model'); - - } - - - - /* - * get university and course details for semester course mappinig - * created by velz - * */ - public function getUniversityCourseDetails_post() - { - $branchId = $this->post('branchId'); - $getUnivDetails = $this->Hallticket_model->getUniversityDetails($branchId); - $getCenterDetails = $this->Hallticket_model->getCenterDetails($branchId); - if ($getUnivDetails) - { - $getUnivDetails['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($getUnivDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code - } - else - { - // Set the response and exit - $this->response([ - 'message' => 'No records found!', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code - } - - - } - - /* - * get shedule time and date from T_Batch_Schedule_Child - * created by TamilBala - * */ - public function getSheduleDetails_post() - { - - $mapid = $this->post('mapid'); - $subid = $this->post('subid'); - $branchcode = $this->post('branchcode'); - //$getSheduleData = $this->Hallticket_model->getShedules($mapid); - $get_unShedules = $this->Hallticket_model->get_unShedules($mapid,$subid,$branchcode); - //print_r($get_unShedules); - if ($get_unShedules) - { - //echo "model"; - $getSheduleinfo['status'] = REST_Controller::HTTP_OK; - $getSheduleinfo['getunSheduleDetailsinfo']=$get_unShedules; - //print_r($getSheduleinfo['getunSheduleDetailsinfo']); - // Set the response and exit - $this->response($getSheduleinfo, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code - } - else - { - // Set the response and exit - $this->response([ - 'message' => 'No records found!', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code - } - - - } - - - /* - * get universityid and courseid details for Shedule view - * created by TamilBala - * */ - - public function getUniversityCourseId_post() - { - $branchCode = $this->post('branchCode'); - //print_r($branchCode); - $getUnivDetailsid = $this->Hallticket_model->getUniversityid($branchCode); - - if ($getUnivDetailsid) - { - $getUnivinfo['status'] = REST_Controller::HTTP_OK; - $getUnivinfo['getUnivDetailsinfo'] = $getUnivDetailsid; - - // Set the response and exit - $this->response($getUnivinfo, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code - } - else - { - // Set the response and exit - $this->response([ - 'message' => 'No records found!', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code - } - - - } - - - - - - /* - * get semester and subjects list for sem course mapping - * created by velz - * */ - public function getSemesterSubjectDetails_post() - { - $universityID = $this->post('universityID'); - $courseIDS = $this->post('courseID'); - $requestedBy = $this->post('requestedBy'); - $branchId = $this->post('branchId'); - $tempCourseArray = array(); - foreach($courseIDS as $val) - { - foreach($val as $v){ - $tempCourseArray[] = $v; - } - //print_r($value); - } - - $data['subjectDetails'] = $this->Hallticket_model->getSubjectDetails($universityID,$tempCourseArray,$branchId); - //$data['semesterDetails'] = $this->Hallticket_model->getSemesterDetails($universityID,$tempCourseArray); - - if($data['subjectDetails']) - { - $data['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($data, REST_Controller::HTTP_OK); - } - else{ - - $this->response([ - 'message' => 'No records found!', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); - - } - - } - - /* - * get semester and subjects list for sem course mapping - * created by Bala - * */ - public function getExistingMapping_post() - { - $universityID = $this->post('universityID'); - $courseIDS = $this->post('courseID'); - $requestedBy = $this->post('requestedBy'); - $branchId = $this->post('branchId'); - $tempCourseArray = array(); - foreach($courseIDS as $val) - { - foreach($val as $v){ - $tempCourseArray[] = $v; - } - //print_r($value); - } - - $data['subjectDetails'] = $this->Hallticket_model->getExistDetails($universityID,$tempCourseArray,$branchId); - // print_r( $data['subjectDetails']); - // die(); - //$data['semesterDetails'] = $this->Hallticket_model->getSemesterDetails($universityID,$tempCourseArray); - //1000 it means already data exist http sents 1000// - - if($data['subjectDetails'] == 1 ) - { - $this->response([ - 'message' => 'Already Exist', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); - } - - else if($data['subjectDetails']) - { - $data['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($data, REST_Controller::HTTP_OK); - } - else{ - - $this->response([ - 'message' => 'No records found!', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); - - } - - } - - public function getBatchAndCenterDetails_post() - { - $requestedBy = $this->post('requestedBy'); - $branchId = $this->post('branchId'); - - $result = $this->Hallticket_model->getBatchAndCenterDetailsModel($branchId); - //print_r($result['batchDetails']);die(); - if(!empty($result['batchDetails']) && !empty($result['centerDetails'])) - { - $data['status'] = REST_Controller::HTTP_OK; - $data['batchDetails'] = $result['batchDetails']; - $data['centerDetails'] = $result['centerDetails']; - $this->response($data, REST_Controller::HTTP_OK); - } - else - { - $this->response([ - 'message' => 'Batch OR Center Details Not Available', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); - } - } - - - public function getStudentDetailsForExamAttendance_post() - { - $requestedBy = $this->post('requestedBy'); - $branchId = $this->post('branchId'); - $centerName = $this->post('centerName'); - $examDate = $this->post('examDate'); - //$examDate = strtotime($examDate); - $examDate = date_create($examDate); - $examDate = date_format(date_add($examDate,date_interval_create_from_date_string("1 days")),'Y-m-d'); - $batch = $this->post('batch'); - //echo $examDate; - $universityID = $this->post('university'); - //print_r($universityID);die(); - $result = $this->Hallticket_model->getExamAttendance_model($universityID['universityID'],$branchId,$centerName,$examDate,$batch); - if($result) - { - $data['status'] = REST_Controller::HTTP_OK; - $data['studentDetails'] = $result; - $this->response($data, REST_Controller::HTTP_OK); - } - else - { - $this->response([ - 'message' => 'No Data Found', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); - } - - } - public function saveAllSemesterSubjectMapping_post() - { - - - $UID = $this->post('universityID'); - $courseIDS = $this->post('courseID'); - $requestedBy = $this->post('requestedBy'); - $branchId = $this->post('branchId'); - $semArray = $this->post('Semesters'); - $res = $this->Hallticket_model->saveAllSemesterSubjectMappingmodel($UID,$courseIDS,$requestedBy,$branchId,$semArray,$requestedBy); - - if($res['insert'] == true and $res['exist'] == false) - { - $data['status'] = REST_Controller::HTTP_OK; - $data['txtStatus'] = '1'; - $this->response($data, REST_Controller::HTTP_OK); - } - else if($res['insert'] == false and $res['exist'] == true) - { - $data['status'] = REST_Controller::HTTP_OK; - $data['txtStatus'] = '2'; - $this->response($data, REST_Controller::HTTP_OK); - } - else if($res['insert'] == false and $res['exist'] == false) - { - - $this->response([ - 'message' => 'Something Went Wrong!', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); - - } - } - public function BatchUploadDataDetails_post() - { - // echo 'hai'; - $university= $this->post('universityDetails'); - $courseArray = $this->post('courseDetails'); - $filedetails = $this->post('details'); - $requestedBy = $this->post('requestedBy'); - $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 ) - { - foreach($courseArray as $CourseDatialArray) - { - $course=$CourseDatialArray; - $schedulemaster = array('UniversityID'=>$university,'CourseID'=>$course,'BranchCode'=>$branchId,'CreatedBy'=>$requestedBy,'CreatedOn'=>$CreatedOn); - $schedulemasteradd = $this->Hallticket_model->AddBatchScheduleMasterFile($schedulemaster,$filedetails); - - } - $SchId = ''; - if(count($schedulemasteradd)>0) - { - $SchId = $schedulemasteradd[0]['SchId']; - } - - - - if((count($schedulemasteradd)>0)) - { - $data['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($data, REST_Controller::HTTP_OK); - } - - else - { - $this->response([ - 'message' => 'No records found!', - '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!', - '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() - { - $detailArray = $this->post('scheduleDetails'); - $university =$this->post('getuniversityid'); - //$courseid= $this->post('getcourseid'); - $requestedBy = $this->post('requestedBy'); - $branchId = $this->post('branchId'); - $Cdate = new DateTime('now',new DateTimeZone('Asia/Kolkata')); - $CreatedOn = $Cdate->format('Y-m-d H:i:s'); - $CourseDatialArray = $this->post('courseDetails'); - foreach($CourseDatialArray as $coursedetails) - { - $course=$coursedetails; - $schedulemaster = array('UniversityID'=>$university,'CourseID'=>$course,'BranchCode'=>$branchId,'CreatedBy'=>$requestedBy,'CreatedOn'=>$CreatedOn); - $schedulemasteradd = $this->Hallticket_model->AddBatchScheduleMaster($schedulemaster,$detailArray); - - } - //print_r($CourseDatialArray); - - - // echo $courseIDS.'-'.$UniversityID; - - - - - $SchId = ''; - if(count($schedulemasteradd)>0) - { - $SchId = $schedulemasteradd[0]['SchId']; - } - - - - if((count($schedulemasteradd)>0)) - { - $data['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($data, REST_Controller::HTTP_OK); - } - - else - { - $this->response([ - 'message' => 'No records found!', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); - - } - - } - - - public function updateSheduleDetails_post() - { - $schedulearray = $this->post('updatescheduledetails'); - $updateBy = $this->post('createdBy'); - $scheduleID = $this->post('scheduleID'); - $res = $this->Hallticket_model->scheduleUpdate($schedulearray,$updateBy,$scheduleID); - if(count($res) > 0 ) - { - - //$data['semsubstatus'] = true; - $data['status'] = REST_Controller::HTTP_OK;; - //$data['semsubjects'] = $res; - $this->response($data, REST_Controller::HTTP_OK); - } - else - { - $this->response([ - 'message' => 'Something Went Wrong!', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); - } - - } - - - public function getAllSemesterSubjects_get() - { - $branchId = $this->post('branchId'); - $res = $this->Hallticket_model->getAllSemesterSubjectsmodel($branchId); - - //$result_array = array(); - if(count($res) > 0 ) - { - - $data['semsubstatus'] = true; - $data['status'] = REST_Controller::HTTP_OK;; - $data['semsubjects'] = $res; - $this->response($data, REST_Controller::HTTP_OK); - } - else - { - $this->response([ - 'message' => 'Something Went Wrong!', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); - } - - } - - - public function getIndividualCourseSemMappingDetails_post() - { - $universityID = $this->post('universityID'); - $courseID = $this->post('courseID'); - $branchId = $this->post('branchId'); - - $res = $this->Hallticket_model->getIndividualCourseSemMappingDetailsmodel($universityID,$courseID,$branchId); - //print_r($res); - if(count($res['mappedSubjects']) == 0) - { - $data['subjectStatus'] = false; - $data['status'] = REST_Controller::HTTP_OK; - $data['subjects'] = ""; - $this->response($data, REST_Controller::HTTP_OK); - } - else - { - $data['subjectStatus'] = true; - $data['status'] = REST_Controller::HTTP_OK; - $data['subjects'] = $res['mappedSubjects']; - $data['overAllSubjects'] = $res['overAllSubjects']; - $this->response($data, REST_Controller::HTTP_OK); - } - - - - } - - - - public function updateAllSemesterSubjectMapping_post() - { - $UID = $this->post('universityID'); - $courseIDS = $this->post('courseID'); - $requestedBy = $this->post('requestedBy'); - $branchId = $this->post('branchId'); - $semArray = $this->post('Semesters'); - $res = $this->Hallticket_model->updateAllSemesterSubjectMappingmodel($UID,$courseIDS,$requestedBy,$branchId,$semArray,$requestedBy); - - if($res) - { - $data['status'] = REST_Controller::HTTP_OK; - $data['txtStatus'] = true; - $this->response($data, REST_Controller::HTTP_OK); - } - else - { - $this->response([ - 'message' => 'Something Went Wrong!', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); - - } - } - - public function getStudentListForHallTicket_post() - { - $UID = $this->post('university'); - $courseID = $this->post('course'); - $batch = $this->post('batch'); - $requestedBy = $this->post('requestedBy'); - $branchId = $this->post('branchId'); - $center = $this->post('center'); - //print_r($center);die(); - $res = $this->Hallticket_model->getStudentListForHallTicketmodel($UID,$courseID,$batch,$requestedBy,$branchId,$center); - // echo "CON"; - // print_r($res);die(); - if(count($res) > 0) - { - $data['status'] = REST_Controller::HTTP_OK; - $data['studentStatus'] = true; - $data['studentDetails'] = $res; - $this->response($data, REST_Controller::HTTP_OK); - } - else - { - $this->response([ - 'message' => 'Something Went Wrong!', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); - } - } - - public function getHallTicket_post() - { - $UID = $this->post('universityID'); - $courseID = $this->post('courseID'); - $batch = $this->post('batchName'); - $requestedBy = $this->post('requestedBy'); - $branchId = $this->post('branchId'); - $studentIDs = $this->post('StudentIDs'); - $centerName = $this->post('centerName'); - - $res['UniversityDetails'] = $this->Hallticket_model->getUniversityDetials($UID,$branchId); - $res['studentDetails'] = $this->Hallticket_model->getStudentDetails($UID,$courseID,$branchId,$studentIDs,$centerName,$batch,$requestedBy); - - - if(count($res['UniversityDetails']) != 0 || count($res['studentDetails']) != 0 ) - { - $data['status'] = REST_Controller::HTTP_OK; - $data['hallTicketStatus'] = true; - $data['hallTicketData'] = $res; - $data['semDataType'] = $res['studentDetails']['NUMTYPE']; - $this->response($data, REST_Controller::HTTP_OK); - } - else - { - $this->response([ - 'message' => 'Something Went Wrong!', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); - } - - } - - - - public function getSubjectDetaillist_post() - { - $sub['SubjectCode'] =$this->post('SubjectCode'); - $sub['requestedBy'] = $this->post('requestedBy'); - $sub['branchId'] = $this->post('branchCode'); - $sublistdet = $this->Hallticket_model->GetSubListDetails($sub); - if($sublistdet) - { - $sublistdet['status'] = REST_Controller::HTTP_OK; - // Set the response and exit - $this->response($sublistdet, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code - } - else - { - $this->response([ - 'message' => 'No records found!', - 'status' => REST_Controller::HTTP_NOT_FOUND - ], REST_Controller::HTTP_NOT_FOUND); - - } - - } - - - - +methods['getCourseSubjectDetails_post']['limit'] = 500; // 500 requests per hour per user/key + $this->methods['getUniversityCourseDetails_post']['limit'] = 500; // 500 requests per hour per user/key + $this->methods['updateSheduleDetails_post']['limit'] = 500; // 500 requests per hour per user/key + $this->methods['BatchUploadDataDetails_post']['limit'] = 500; + + // load the model + $this->load->model('Hallticket_model', 'Hallticket_model'); + + } + + + + /* + * get university and course details for semester course mappinig + * created by velz + * */ + public function getUniversityCourseDetails_post() + { + $branchId = $this->post('branchId'); + $getUnivDetails = $this->Hallticket_model->getUniversityDetails($branchId); + $getCenterDetails = $this->Hallticket_model->getCenterDetails($branchId); + if ($getUnivDetails) + { + $getUnivDetails['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getUnivDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No records found!', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + + + } + + /* + * get shedule time and date from T_Batch_Schedule_Child + * created by TamilBala + * */ + public function getSheduleDetails_post() + { + + $courseDetails =$this->post('courseDetails'); + //print_r($courseDetails); + $CourseID = $courseDetails['CourseID']; + $universityID= $courseDetails['UniversityID']; + //print_r($courseDetails); + $mapid = $this->post('mapid'); + $subid = $this->post('subid'); + $branchcode = $this->post('branchcode'); + //$getSheduleData = $this->Hallticket_model->getShedules($mapid); + $get_unShedules = $this->Hallticket_model->get_unShedules($mapid,$subid,$branchcode,$CourseID,$universityID); + //print_r($get_unShedules); + if ($get_unShedules) + { + //echo "model"; + $getSheduleinfo['status'] = REST_Controller::HTTP_OK; + $getSheduleinfo['getunSheduleDetailsinfo']=$get_unShedules; + //print_r($getSheduleinfo['getunSheduleDetailsinfo']); + // Set the response and exit + $this->response($getSheduleinfo, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No records found!', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + + + } + + + /* + * get universityid and courseid details for Shedule view + * created by TamilBala + * */ + + public function getUniversityCourseId_post() + { + $branchCode = $this->post('branchCode'); + //print_r($branchCode); + $getUnivDetailsid = $this->Hallticket_model->getUniversityid($branchCode); + + if ($getUnivDetailsid) + { + $getUnivinfo['status'] = REST_Controller::HTTP_OK; + $getUnivinfo['getUnivDetailsinfo'] = $getUnivDetailsid; + + // Set the response and exit + $this->response($getUnivinfo, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + // Set the response and exit + $this->response([ + 'message' => 'No records found!', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + } + + + } + + + + + + /* + * get semester and subjects list for sem course mapping + * created by velz + * */ + public function getSemesterSubjectDetails_post() + { + $universityID = $this->post('universityID'); + $courseIDS = $this->post('courseID'); + $requestedBy = $this->post('requestedBy'); + $branchId = $this->post('branchId'); + $tempCourseArray = array(); + foreach($courseIDS as $val) + { + foreach($val as $v){ + $tempCourseArray[] = $v; + } + //print_r($value); + } + + $data['subjectDetails'] = $this->Hallticket_model->getSubjectDetails($universityID,$tempCourseArray,$branchId); + //$data['semesterDetails'] = $this->Hallticket_model->getSemesterDetails($universityID,$tempCourseArray); + + if($data['subjectDetails']) + { + $data['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($data, REST_Controller::HTTP_OK); + } + else{ + + $this->response([ + 'message' => 'No records found!', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); + + } + + } + + /* + * get semester and subjects list for sem course mapping + * created by Bala + * */ + public function getExistingMapping_post() + { + $universityID = $this->post('universityID'); + $courseIDS = $this->post('courseID'); + $requestedBy = $this->post('requestedBy'); + $branchId = $this->post('branchId'); + $tempCourseArray = array(); + foreach($courseIDS as $val) + { + foreach($val as $v){ + $tempCourseArray[] = $v; + } + //print_r($value); + } + + $data['subjectDetails'] = $this->Hallticket_model->getExistDetails($universityID,$tempCourseArray,$branchId); + // print_r( $data['subjectDetails']); + // die(); + //$data['semesterDetails'] = $this->Hallticket_model->getSemesterDetails($universityID,$tempCourseArray); + //1000 it means already data exist http sents 1000// + + if($data['subjectDetails'] == 1 ) + { + $this->response([ + 'message' => 'Already Exist', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); + } + + else if($data['subjectDetails']) + { + $data['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($data, REST_Controller::HTTP_OK); + } + else{ + + $this->response([ + 'message' => 'No records found!', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); + + } + + } + + public function getBatchAndCenterDetails_post() + { + $requestedBy = $this->post('requestedBy'); + $branchId = $this->post('branchId'); + + $result = $this->Hallticket_model->getBatchAndCenterDetailsModel($branchId); + //print_r($result['batchDetails']);die(); + if(!empty($result['batchDetails']) && !empty($result['centerDetails'])) + { + $data['status'] = REST_Controller::HTTP_OK; + $data['batchDetails'] = $result['batchDetails']; + $data['centerDetails'] = $result['centerDetails']; + $this->response($data, REST_Controller::HTTP_OK); + } + else + { + $this->response([ + 'message' => 'Batch OR Center Details Not Available', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); + } + } + + + public function getStudentDetailsForExamAttendance_post() + { + $requestedBy = $this->post('requestedBy'); + $branchId = $this->post('branchId'); + $centerName = $this->post('centerName'); + $examDate = $this->post('examDate'); + //$examDate = strtotime($examDate); + $examDate = date_create($examDate); + $examDate = date_format(date_add($examDate,date_interval_create_from_date_string("1 days")),'Y-m-d'); + $batch = $this->post('batch'); + //echo $examDate; + $universityID = $this->post('university'); + //print_r($universityID);die(); + $result = $this->Hallticket_model->getExamAttendance_model($universityID['universityID'],$branchId,$centerName,$examDate,$batch); + if($result) + { + $data['status'] = REST_Controller::HTTP_OK; + $data['studentDetails'] = $result; + $this->response($data, REST_Controller::HTTP_OK); + } + else + { + $this->response([ + 'message' => 'No Data Found', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); + } + + } + public function saveAllSemesterSubjectMapping_post() + { + + + $UID = $this->post('universityID'); + $courseIDS = $this->post('courseID'); + $requestedBy = $this->post('requestedBy'); + $branchId = $this->post('branchId'); + $semArray = $this->post('Semesters'); + $res = $this->Hallticket_model->saveAllSemesterSubjectMappingmodel($UID,$courseIDS,$requestedBy,$branchId,$semArray,$requestedBy); + + if($res['insert'] == true and $res['exist'] == false) + { + $data['status'] = REST_Controller::HTTP_OK; + $data['txtStatus'] = '1'; + $this->response($data, REST_Controller::HTTP_OK); + } + else if($res['insert'] == false and $res['exist'] == true) + { + $data['status'] = REST_Controller::HTTP_OK; + $data['txtStatus'] = '2'; + $this->response($data, REST_Controller::HTTP_OK); + } + else if($res['insert'] == false and $res['exist'] == false) + { + + $this->response([ + 'message' => 'Something Went Wrong!', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); + + } + } + public function BatchUploadDataDetails_post() + { + // echo 'hai'; + $university= $this->post('universityDetails'); + $courseArray = $this->post('courseDetails'); + $filedetails = $this->post('details'); + $requestedBy = $this->post('requestedBy'); + $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 ) + { + foreach($courseArray as $CourseDatialArray) + { + $course=$CourseDatialArray; + $schedulemaster = array('UniversityID'=>$university,'CourseID'=>$course,'BranchCode'=>$branchId,'CreatedBy'=>$requestedBy,'CreatedOn'=>$CreatedOn); + $schedulemasteradd = $this->Hallticket_model->AddBatchScheduleMasterFile($schedulemaster,$filedetails); + + } + $SchId = ''; + if(count($schedulemasteradd)>0) + { + $SchId = $schedulemasteradd[0]['SchId']; + } + + + + if((count($schedulemasteradd)>0)) + { + $data['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($data, REST_Controller::HTTP_OK); + } + + else + { + $this->response([ + 'message' => 'No records found!', + '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!', + '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() + { + $detailArray = $this->post('scheduleDetails'); + $university =$this->post('getuniversityid'); + //$courseid= $this->post('getcourseid'); + $requestedBy = $this->post('requestedBy'); + $branchId = $this->post('branchId'); + $Cdate = new DateTime('now',new DateTimeZone('Asia/Kolkata')); + $CreatedOn = $Cdate->format('Y-m-d H:i:s'); + $CourseDatialArray = $this->post('courseDetails'); + foreach($CourseDatialArray as $coursedetails) + { + $course=$coursedetails; + $schedulemaster = array('UniversityID'=>$university,'CourseID'=>$course,'BranchCode'=>$branchId,'CreatedBy'=>$requestedBy,'CreatedOn'=>$CreatedOn); + $schedulemasteradd = $this->Hallticket_model->AddBatchScheduleMaster($schedulemaster,$detailArray); + + } + //print_r($CourseDatialArray); + + + // echo $courseIDS.'-'.$UniversityID; + + + + + $SchId = ''; + if(count($schedulemasteradd)>0) + { + $SchId = $schedulemasteradd[0]['SchId']; + } + + + + if((count($schedulemasteradd)>0)) + { + $data['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($data, REST_Controller::HTTP_OK); + } + + else + { + $this->response([ + 'message' => 'No records found!', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); + + } + + } + + + public function updateSheduleDetails_post() + { + $schedulearray = $this->post('updatescheduledetails'); + $updateBy = $this->post('createdBy'); + $scheduleID = $this->post('scheduleID'); + $res = $this->Hallticket_model->scheduleUpdate($schedulearray,$updateBy,$scheduleID); + if(count($res) > 0 ) + { + + //$data['semsubstatus'] = true; + $data['status'] = REST_Controller::HTTP_OK;; + //$data['semsubjects'] = $res; + $this->response($data, REST_Controller::HTTP_OK); + } + else + { + $this->response([ + 'message' => 'Something Went Wrong!', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); + } + + } + + + public function getAllSemesterSubjects_get() + { + $branchId = $this->post('branchId'); + $res = $this->Hallticket_model->getAllSemesterSubjectsmodel($branchId); + + //$result_array = array(); + if(count($res) > 0 ) + { + + $data['semsubstatus'] = true; + $data['status'] = REST_Controller::HTTP_OK;; + $data['semsubjects'] = $res; + $this->response($data, REST_Controller::HTTP_OK); + } + else + { + $this->response([ + 'message' => 'Something Went Wrong!', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); + } + + } + + + public function getIndividualCourseSemMappingDetails_post() + { + $universityID = $this->post('universityID'); + $courseID = $this->post('courseID'); + $branchId = $this->post('branchId'); + + $res = $this->Hallticket_model->getIndividualCourseSemMappingDetailsmodel($universityID,$courseID,$branchId); + //print_r($res); + if(count($res['mappedSubjects']) == 0) + { + $data['subjectStatus'] = false; + $data['status'] = REST_Controller::HTTP_OK; + $data['subjects'] = ""; + $this->response($data, REST_Controller::HTTP_OK); + } + else + { + $data['subjectStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['subjects'] = $res['mappedSubjects']; + $data['overAllSubjects'] = $res['overAllSubjects']; + $this->response($data, REST_Controller::HTTP_OK); + } + + + + } + + + + public function updateAllSemesterSubjectMapping_post() + { + $UID = $this->post('universityID'); + $courseIDS = $this->post('courseID'); + $requestedBy = $this->post('requestedBy'); + $branchId = $this->post('branchId'); + $semArray = $this->post('Semesters'); + $res = $this->Hallticket_model->updateAllSemesterSubjectMappingmodel($UID,$courseIDS,$requestedBy,$branchId,$semArray,$requestedBy); + + if($res) + { + $data['status'] = REST_Controller::HTTP_OK; + $data['txtStatus'] = true; + $this->response($data, REST_Controller::HTTP_OK); + } + else + { + $this->response([ + 'message' => 'Something Went Wrong!', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); + + } + } + + public function getStudentListForHallTicket_post() + { + $UID = $this->post('university'); + $courseID = $this->post('course'); + $batch = $this->post('batch'); + $requestedBy = $this->post('requestedBy'); + $branchId = $this->post('branchId'); + $center = $this->post('center'); + //print_r($center);die(); + $res = $this->Hallticket_model->getStudentListForHallTicketmodel($UID,$courseID,$batch,$requestedBy,$branchId,$center); + // echo "CON"; + // print_r($res);die(); + if(count($res) > 0) + { + $data['status'] = REST_Controller::HTTP_OK; + $data['studentStatus'] = true; + $data['studentDetails'] = $res; + $this->response($data, REST_Controller::HTTP_OK); + } + else + { + $this->response([ + 'message' => 'Something Went Wrong!', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); + } + } + + public function getHallTicket_post() + { + $UID = $this->post('universityID'); + $courseID = $this->post('courseID'); + $batch = $this->post('batchName'); + $requestedBy = $this->post('requestedBy'); + $branchId = $this->post('branchId'); + $studentIDs = $this->post('StudentIDs'); + $centerName = $this->post('centerName'); + + $res['UniversityDetails'] = $this->Hallticket_model->getUniversityDetials($UID,$branchId); + $res['studentDetails'] = $this->Hallticket_model->getStudentDetails($UID,$courseID,$branchId,$studentIDs,$centerName,$batch,$requestedBy); + + + if(count($res['UniversityDetails']) != 0 || count($res['studentDetails']) != 0 ) + { + $data['status'] = REST_Controller::HTTP_OK; + $data['hallTicketStatus'] = true; + $data['hallTicketData'] = $res; + $data['semDataType'] = $res['studentDetails']['NUMTYPE']; + $this->response($data, REST_Controller::HTTP_OK); + } + else + { + $this->response([ + 'message' => 'Something Went Wrong!', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); + } + + } + + + + public function getSubjectDetaillist_post() + { + $sub['SubjectCode'] =$this->post('SubjectCode'); + $sub['requestedBy'] = $this->post('requestedBy'); + $sub['branchId'] = $this->post('branchCode'); + $sublistdet = $this->Hallticket_model->GetSubListDetails($sub); + if($sublistdet) + { + $sublistdet['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($sublistdet, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + } + else + { + $this->response([ + 'message' => 'No records found!', + 'status' => REST_Controller::HTTP_NOT_FOUND + ], REST_Controller::HTTP_NOT_FOUND); + + } + + } + + + + } \ No newline at end of file diff --git a/Apollo/api/application/models/Hallticket_model.php b/Apollo/api/application/models/Hallticket_model.php old mode 100755 new mode 100644 index b5dc11ca..a11cd9b0 --- a/Apollo/api/application/models/Hallticket_model.php +++ b/Apollo/api/application/models/Hallticket_model.php @@ -1,1490 +1,1504 @@ -db->select('UniversityID,UniversityName'); - $this->db->where('IsActive','1'); - $this->db->where('BranchCode',$branchId); - $this->db->order_by('UniversityID','ASC'); - $unviversityDetails = $this->db->get(UNIVERSITY); - - if($unviversityDetails->result()){ - $result_university = array(); - $result_university['universityStatus'] = true; - foreach ($unviversityDetails->result() as $row) - { - - $university_array['universityID'] = $row->UniversityID; - $university_array['universityName'] = $row->UniversityName; - $university_array['courseDetails']= $this->getCourseDetails($row->UniversityID,$branchId); - $university_array['batchDetails']= $this->getBatchDetails($row->UniversityID,$branchId); - $result_array[]=$university_array; - } - $result_university['univerSityDetails']= $result_array; - $result_university['centerDetails'] = $this->getCenterDetails($branchId); - } - else { - $result_university['universityStatus'] = false; - $result_university['message'] = "No records found!"; - $result_university['universityID'] = ""; - $result_university['universityName'] = ""; - $result_university['courseDetails']= ""; - } - - - return $result_university; - - } - - - public function getCenterDetails($branchId) - { - $this->db->select('CenterID,CenterCode,CenterName,CenterAddress'); - $this->db->from('T_CenterMaster'); - $this->db->where('IsActive',1); - $this->db->where('BranchCode',$branchId); - $res = $this->db->get(); - return $res->result(); - } - /* - * get university details and course details - * for view shedule - * created by TamilBala - * */ - public function getUniversityid($branchCode) - { - $this->db->distinct(); - $this->db->select('T_Batch_Schedule_Master.UniversityID,T_Batch_Schedule_Master.CourseID,T_Batch_Schedule_Master.SchId,T_UniversityMaster.UniversityName,T_CourseMaster.CourseName,T_CourseMaster.CourseCode,T_Batch_Schedule_Child.ScheduleDate,T_Batch_Schedule_Child.FromTime,T_Batch_Schedule_Child.ToTime,T_Batch_Schedule_Child.SchId,T_SubjectMaster.SubjectName,T_SubjectMaster.SubjectID,T_UniversityMaster.UniversityID,T_SubjectMaster.BranchCode'); - $this->db->from('T_Batch_Schedule_Master'); - $this->db->join('T_UniversityMaster','T_Batch_Schedule_Master.UniversityID=T_UniversityMaster.UniversityID'); - $this->db->join('T_CourseMaster','T_Batch_Schedule_Master.CourseID=T_CourseMaster.CourseID'); - $this->db->join('T_Batch_Schedule_Child','T_Batch_Schedule_Master.SchId=T_Batch_Schedule_Child.SchId'); - $this->db->join('T_SubjectMaster','T_Batch_Schedule_Child.SubjectID=T_SubjectMaster.SubjectID'); - $this->db->where('T_Batch_Schedule_Master.BranchCode',$branchCode); - $this->db->where('T_Batch_Schedule_Master.IsActive',1); - $this->db->group_by('T_CourseMaster.CourseName'); - $result = $this->db->get(); - //print_r($result->result()); - return $result->result(); - } - /* - * get shedule details details - * for edit/view shedule - * created by TamilBala - * */ - public function getShedules($mapid) - { - $this->db->select('T_Batch_Schedule_Child.ScheduleDate,T_Batch_Schedule_Child.FromTime,T_Batch_Schedule_Child.ToTime,T_SubjectMaster.SubjectName,T_Batch_Schedule_Child.SchChildId,T_Batch_Schedule_Child.SubjectID'); - $this->db->from('T_SubjectMaster'); - $this->db->join('T_Batch_Schedule_Child','T_Batch_Schedule_Child.SubjectID=T_SubjectMaster.SubjectID','left'); - $this->db->where('T_Batch_Schedule_Child.SchId',$mapid); - $result = $this->db->get(); - //print_r($result->result()); - //die(); - return $result->result(); - } - /* - * get shedule details details - * for edit/view shedule - * created by TamilBala - * */ - public function get_unShedules($mapid,$subid,$branchcode) - { - - $this->db->select('SM.SubjectName,SM.SubjectID'); - $this->db->from('T_SubjectMaster SM'); - $this->db->join('T_Batch_Schedule_Child','T_Batch_Schedule_Child.SubjectID=SM.SubjectID'); - $this->db->where('SM.BranchCode',$branchcode); - $this->db->where('T_Batch_Schedule_Child.SchId',$mapid); - $result = $this->db->get(); - if($result->result()){ - $resultShedule['status']=true; - $mastScheduleID=""; - foreach($result->result() as $row) - { - - $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('T_Batch_Schedule_Child.SubjectID',$row->SubjectID); - $existsheduledetails = $this->db->get(); - - if($existData=$existsheduledetails->result()) - { - - $fetchData['ID']="1"; - $fetchData['SubjectID']=$row->SubjectID; - $fetchData['SubjectName']=$row->SubjectName; - $fetchData['ScheduleDate']=$existData[0]->ScheduleDate; - $fetchData['FromTime']=$existData[0]->FromTime; - $fetchData['ToTime']=$existData[0]->ToTime; - $fetchData['SchChildId']=$existData[0]->SchChildId; - $fetchData['SchId']=$existData[0]->SchId; - $mastScheduleID=$existData[0]->SchId; - - } - else - { - - $fetchData['SubjectID']=$row->SubjectID; - $fetchData['SubjectName']=$row->SubjectName; - $fetchData['ID']="0"; - $fetchData['ScheduleDate']=""; - $fetchData['FromTime']=""; - $fetchData['ToTime']=""; - $fetchData['SchChildId']=""; - $fetchData['SchId']= $mastScheduleID; - - } - $fetchshedule[]=$fetchData; - } - $resultShedule['scheduleDetails']=$fetchshedule; - } - else{ - $resultShedule['status']=false; - $resultShedule['scheduleDetails']=""; - } - //print_r($resultShedule); - //die(); - return $resultShedule; - } - /* - * get course details - * @params university id - * created by velz - * */ - public function getCourseDetails($universityID=null,$branchId) - { - - $this->db->select('T_CourseMaster.CourseID,CONCAT(T_CourseMaster.CourseName, "(",T_CourseMaster.CourseCode,")") AS CourseName,T_Course_Fees_Details.ProgramType,T_Course_Fees_Details.FeesType,T_Course_Fees_Details.Sem_Year'); - $this->db->join('T_Course_Fees_Details','T_CourseMaster.CourseID = T_Course_Fees_Details.CourseID'); - $this->db->where('UniversityID',$universityID); - $this->db->where('BranchCode',$branchId); - $this->db->where('IsActive','1'); - $this->db->group_by('CourseName'); - $this->db->order_by('CourseID','ASC'); - $courseDetails = $this->db->get('T_CourseMaster'); - return $courseDetails->result(); - } -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->from('T_SemSubMap_Master'); - $this->db->where('UniversityID',$universityID); - $this->db->where('CourseID',$c); - $result = $this->db->get(); - $res = $result->result(); - - if($res[0]->count > 0 ) - { - $i++; - } - } - - if( $i > 0 ) - { - return 1; - } - else - { - return 0; - } - } - /* - * check existing data,only batchschedule. - * @params university id and CourseID - * created by Bala - * */ - - public function getExistDetails($universityID,$courseIDS,$branchId) - { - - $i=0; - foreach($courseIDS as $c) - { - - // $tempCourseArray= $c['CourseID']; - - $this->db->select ('count(*) as count'); - $this->db->from('T_Batch_Schedule_Master'); - $this->db->where('UniversityID',$universityID); - $this->db->where('CourseID', $c); - // $this->db->where('BranchCode',$branchId); - $result = $this->db->get(); - $res = $result->result(); - - if($res[0]->count > 0 ) - { - $i++; - } - } - - if( $i > 0 ) - { - return 1; - } - else - { - - foreach($courseIDS as $c) - { - $this->db->distinct(); - $this->db->select('SM.SubjectID,SM.SubjectCode,SM.SubjectName'); - $this->db->from('T_SubjectMaster SM'); - $this->db->join('T_SemSubMap_Child SC','SC.SubjectID = SM.SubjectID'); - $this->db->join('T_SemSubMap_Master SMM','SMM.mapID = SC.mapID'); - $this->db->where('SMM.UniversityID',$universityID); - $this->db->where('SMM.CourseID',$c); - $result = $this->db->get(); - return $result->result(); - } - } - } - - /* - * get subject details - * @params university id and CourseID - * created by velz - * */ - public function getSubjectDetails($universityID,$courseIDS,$branchId) - { - - $this->db->distinct(); - $this->db->select('SubjectID,SubjectCode,SubjectName'); - $this->db->from('T_SubjectMaster'); - //$this->db->join('T_SubjectMaster','T_CourseSubject_Details.SubjectID=T_SubjectMaster.SubjectID'); - $this->db->where('T_SubjectMaster.IsActive','1'); - // $this->db->where('T_CourseSubject_Details.UniversityID',$universityID); - $this->db->where_in('T_SubjectMaster.BranchCode',$branchId); - $result = $this->db->get(); - //echo $this->db->last_query(); - return $result->result(); - } - - - /* - * get semester details - * @params university id and CourseID - * created by velz - * */ - public function getSemesterDetails($universityID,$courseIDS) - { - $this->db->distinct(); - $this->db->select('CourseID,Sem_Year'); - $this->db->from('T_Course_Fees_Details'); - $this->db->where('IsActive','1'); - $this->db->where_in('T_Course_Fees_Details.CourseID',$courseIDS); - $result = $this->db->get(); - return $result->result(); - } - - - /* - * save All Semester Subject Mapping Info - * @params university id,CourseID,requestedBy,branchId,semArray - * created by velz - * */ - public function saveAllSemesterSubjectMappingmodel($UID,$courseIDS,$requestedBy,$branchId,$semArray) - { - - // echo "from MODEL"; - // print_r($courseIDS);die(); - - $tempCourseArray = array(); - foreach($courseIDS as $c) - { - $tempCourseArray[] = $c['CourseID']; - } - $sem1 = 0;$sem2=0;$sem3=0;$sem4=0;$sem5=0;$sem6=0;$sem7=0;$sem8 = 0; - foreach($semArray as $key => $s) - { - if($key == 0) - { - $sem1 = $s; - } - if($key == 1) - { - $sem2 = $s; - }if($key == 2) - { - $sem3 = $s; - }if($key == 3) - { - $sem4 = $s; - }if($key == 4) - { - $sem5 = $s; - }if($key == 5) - { - $sem6 = $s; - } - if($key == 6) - { - $sem7 = $s; - } - if($key == 7) - { - $sem8 = $s; - } - } - //Check If Exist or Not for UniversityID and CourseID's - - $this->db->select('count(*) as counts'); - $this->db->from('T_SemSubMap_Master'); - $this->db->where('BranchCode',$branchId); - $this->db->where('UniversityID',$UID); - $this->db->where_in('CourseID',$tempCourseArray); - $isExist = $this->db->get(); - $isExist = $isExist->result(); - $result_array = array('insert'=>'','exist'=>''); - if($isExist[0]->counts == 0 ) - { - - - - - $ids = array(); - - foreach($tempCourseArray as $course) - { - for($i=1;$i<=8;$i++) - { - - $dataArray = array('UniversityID'=>$UID,'CourseID'=>$course,'SemesterID'=>$i,'BranchCode'=>$branchId,'CreatedBy'=>$requestedBy); - - $this->db->trans_start(); - $this->db->insert('T_SemSubMap_Master',$dataArray); - $last_id = $this->db->insert_id(); - $this->db->trans_complete(); - //echo $last_id; - //$current = '$sem'.$i; - //echo $current;die(); - $ids[] = $last_id; - if($i == 1) - { - if(count($sem1) != 0){ - foreach($sem1 as $s) - { - $childArray = array('MapID'=>$last_id,'SubjectID'=>$s['SubjectID']); - $this->db->trans_start(); - $this->db->insert('T_SemSubMap_Child',$childArray); - $this->db->trans_complete(); - } - } - } - - if($i == 2) - { - if(count($sem2) != 0){ - foreach($sem2 as $s) - { - $childArray = array('MapID'=>$last_id,'SubjectID'=>$s['SubjectID']); - $this->db->trans_start(); - $this->db->insert('T_SemSubMap_Child',$childArray); - $this->db->trans_complete(); - } - } - } - - if($i == 3) - { - if(count($sem3) != 0){ - foreach($sem3 as $s) - { - $childArray = array('MapID'=>$last_id,'SubjectID'=>$s['SubjectID']); - $this->db->trans_start(); - $this->db->insert('T_SemSubMap_Child',$childArray); - $this->db->trans_complete(); - } - } - } - - if($i == 4) - { - if(count($sem4) != 0){ - foreach($sem4 as $s) - { - $childArray = array('MapID'=>$last_id,'SubjectID'=>$s['SubjectID']); - $this->db->trans_start(); - $this->db->insert('T_SemSubMap_Child',$childArray); - $this->db->trans_complete(); - } - } - } - - if($i == 5) - { - if(count($sem5) != 0){ - foreach($sem5 as $s) - { - $childArray = array('MapID'=>$last_id,'SubjectID'=>$s['SubjectID']); - $this->db->trans_start(); - $this->db->insert('T_SemSubMap_Child',$childArray); - $this->db->trans_complete(); - } - } - } - - if($i == 6) - { - if(count($sem6) != 0){ - foreach($sem6 as $s) - { - $childArray = array('MapID'=>$last_id,'SubjectID'=>$s['SubjectID']); - $this->db->trans_start(); - $this->db->insert('T_SemSubMap_Child',$childArray); - $this->db->trans_complete(); - } - } - } - - if($i == 7) - { - if(count($sem7) != 0){ - foreach($sem7 as $s) - { - $childArray = array('MapID'=>$last_id,'SubjectID'=>$s['SubjectID']); - $this->db->trans_start(); - $this->db->insert('T_SemSubMap_Child',$childArray); - $this->db->trans_complete(); - } - } - } - - if($i == 8) - { - if(count($sem8) != 0){ - foreach($sem8 as $s) - { - $childArray = array('MapID'=>$last_id,'SubjectID'=>$s['SubjectID']); - $this->db->trans_start(); - $this->db->insert('T_SemSubMap_Child',$childArray); - $this->db->trans_complete(); - } - } - } - - } - - - } - - if(count($ids) > 0) - { - $result_array['insert'] = true; - $result_array['exist'] = false; - return $result_array; - } - else - { - $result_array['insert'] = false; - $result_array['exist'] = false; - return $result_array; - - } - - } - else - { - - - $result_array['insert'] = false; - $result_array['exist'] = true; - return $result_array; - } - - } - - /* - * get All Semester Subject Mapping Info - * @params branchId - * created by velz - * */ - public function getAllSemesterSubjectsmodel($branchId) - { - $this->db->select('T_SemSubMap_Master.UniversityID,T_UniversityMaster.UniversityName,T_CourseMaster.CourseID,T_CourseMaster.CourseCode,T_CourseMaster.CourseName,T_Course_Fees_Details.ProgramType,T_Course_Fees_Details.FeesType,T_Course_Fees_Details.Sem_Year'); - $this->db->from('T_SemSubMap_Master'); - $this->db->join('T_UniversityMaster','T_SemSubMap_Master.UniversityID=T_UniversityMaster.UniversityID and T_SemSubMap_Master.BranchCode=T_UniversityMaster.BranchCode') ; - $this->db->join('T_CourseMaster','T_SemSubMap_Master.CourseID=T_CourseMaster.CourseID and T_SemSubMap_Master.BranchCode=T_CourseMaster.BranchCode'); - $this->db->join('T_Course_Fees_Details','T_SemSubMap_Master.CourseID=T_Course_Fees_Details.CourseID and T_CourseMaster.CourseID=T_Course_Fees_Details.CourseID'); - $this->db->group_by('T_SemSubMap_Master.UniversityID,T_SemSubMap_Master.CourseID'); - $res = $this->db->get(); - return $res->result(); - - - } - - public function getIndividualCourseSemMappingDetailsmodel($universityID,$courseID,$branchId) - { - //FOR GET MAPPED SUBJECTS FOR $universityID,$courseID,$branchId - $this->db->select('T_SemSubMap_Master.UniversityID,T_SemSubMap_Master.SemesterID,T_UniversityMaster.UniversityName,T_CourseMaster.CourseID,T_CourseMaster.CourseCode,T_CourseMaster.CourseName,T_SubjectMaster.SubjectID,T_SubjectMaster.SubjectCode,T_SubjectMaster.SubjectName'); - $this->db->from('T_SemSubMap_Master'); - $this->db->join('T_UniversityMaster','T_SemSubMap_Master.UniversityID=T_UniversityMaster.UniversityID and T_SemSubMap_Master.BranchCode=T_UniversityMaster.BranchCode','left') ; - $this->db->join('T_CourseMaster','T_SemSubMap_Master.CourseID=T_CourseMaster.CourseID and T_SemSubMap_Master.BranchCode=T_CourseMaster.BranchCode','left'); - $this->db->join('T_SemSubMap_Child','T_SemSubMap_Master.MapID=T_SemSubMap_Child.MapID and T_SemSubMap_Child.isActive = 1','left'); - $this->db->join('T_SubjectMaster','T_SemSubMap_Child.SubjectID=T_SubjectMaster.SubjectID','left'); - $this->db->where('T_SemSubMap_Master.UniversityID',$universityID); - $this->db->where('T_SemSubMap_Master.CourseID',$courseID); - $this->db->where('T_SemSubMap_Master.BranchCode',$branchId); - - //$this->db->group_by('T_SemSubMap_Master.UniversityID,T_SemSubMap_Master.CourseID'); - $res1 = $this->db->get(); - $res['mappedSubjects'] = $res1->result(); - - //FOR GET OVERALL SUBJECTS FOR $universityID,$courseID,$branchId - $this->db->distinct(); - $this->db->select('T_SubjectMaster.SubjectID,T_SubjectMaster.SubjectCode,T_SubjectMaster.SubjectName'); - $this->db->from('T_SubjectMaster'); - $this->db->where('T_SubjectMaster.IsActive','1'); - $this->db->where('T_SubjectMaster.BranchCode',$branchId); - $result = $this->db->get(); - $res['overAllSubjects'] = $result->result(); - - return $res; - } - - - /* - * update All Semester Subject Mapping Info - * @params university id,CourseID,requestedBy,branchId,semArray - * created by velz - * */ - public function updateAllSemesterSubjectMappingmodel($UID,$courseIDS,$requestedBy,$branchId,$semArray) - { - - //echo $courseIDS;die(); - $sem1 = 0;$sem2=0;$sem3=0;$sem4=0;$sem5=0;$sem6=0;$sem7=0;$sem8 = 0; - foreach($semArray as $key => $s) - { - if($key == 0) - { - $sem1 = $s; - } - if($key == 1) - { - $sem2 = $s; - }if($key == 2) - { - $sem3 = $s; - }if($key == 3) - { - $sem4 = $s; - }if($key == 4) - { - $sem5 = $s; - }if($key == 5) - { - $sem6 = $s; - } - if($key == 6) - { - $sem7 = $s; - } - if($key == 7) - { - $sem8 = $s; - } - } - //Check If Exist or Not for UniversityID and CourseID's - // echo 'FROM MODEL-'.$UID.'-'.$courseIDS.'-'.$branchId.'-'.$requestedBy; - // print_r(array($sem1,$sem2,$sem3,$sem4,$sem5,$sem6,$sem7,$sem8)); - // die(); - - - - - for($i=1;$i<=8;$i++) - { - $this->db->trans_start(); - $this->db->select('MapID'); - $this->db->from('T_SemSubMap_Master'); - $this->db->where('BranchCode',$branchId); - $this->db->where('UniversityID',$UID); - $this->db->where('CourseID',$courseIDS); - $this->db->where('SemesterID',$i); - $isExist = $this->db->get(); - $this->db->trans_complete(); - $isExist = $isExist->result(); - if(!empty($isExist[0]->MapID)) - { - - $MapID = $isExist[0]->MapID; - - $this->db->trans_start(); - $this->db->set('UpdatedBy',$requestedBy); - $this->db->where('MapID',$MapID); - $this->db->update('T_SemSubMap_Master'); - $this->db->trans_complete(); - - - $this->db->trans_start(); - $this->db->set('isActive',0); - $this->db->where('MapID',$MapID); - $this->db->update('T_SemSubMap_Child'); - $this->db->trans_complete(); - - if($i == 1) - { - if(count($sem1) != 0){ - foreach($sem1 as $s) - { - $childArray = array('MapID'=>$MapID,'SubjectID'=>$s['SubjectID']); - $this->db->trans_start(); - $this->db->insert('T_SemSubMap_Child',$childArray); - $this->db->trans_complete(); - } - } - } - - if($i == 2) - { - if(count($sem2) != 0){ - foreach($sem2 as $s) - { - $childArray = array('MapID'=>$MapID,'SubjectID'=>$s['SubjectID']); - $this->db->trans_start(); - $this->db->insert('T_SemSubMap_Child',$childArray); - $this->db->trans_complete(); - } - } - } - - if($i == 3) - { - if(count($sem3) != 0){ - foreach($sem3 as $s) - { - $childArray = array('MapID'=>$MapID,'SubjectID'=>$s['SubjectID']); - $this->db->trans_start(); - $this->db->insert('T_SemSubMap_Child',$childArray); - $this->db->trans_complete(); - } - } - } - - if($i == 4) - { - if(count($sem4) != 0){ - foreach($sem4 as $s) - { - $childArray = array('MapID'=>$MapID,'SubjectID'=>$s['SubjectID']); - $this->db->trans_start(); - $this->db->insert('T_SemSubMap_Child',$childArray); - $this->db->trans_complete(); - } - } - } - - if($i == 5) - { - if(count($sem5) != 0){ - foreach($sem5 as $s) - { - $childArray = array('MapID'=>$MapID,'SubjectID'=>$s['SubjectID']); - $this->db->trans_start(); - $this->db->insert('T_SemSubMap_Child',$childArray); - $this->db->trans_complete(); - } - } - } - - if($i == 6) - { - if(count($sem6) != 0){ - foreach($sem6 as $s) - { - $childArray = array('MapID'=>$MapID,'SubjectID'=>$s['SubjectID']); - $this->db->trans_start(); - $this->db->insert('T_SemSubMap_Child',$childArray); - $this->db->trans_complete(); - } - } - } - - if($i == 7) - { - if(count($sem7) != 0){ - foreach($sem7 as $s) - { - $childArray = array('MapID'=>$MapID,'SubjectID'=>$s['SubjectID']); - $this->db->trans_start(); - $this->db->insert('T_SemSubMap_Child',$childArray); - $this->db->trans_complete(); - } - } - } - - if($i == 8) - { - if(count($sem8) != 0){ - foreach($sem8 as $s) - { - $childArray = array('MapID'=>$MapID,'SubjectID'=>$s['SubjectID']); - $this->db->trans_start(); - $this->db->insert('T_SemSubMap_Child',$childArray); - $this->db->trans_complete(); - } - } - } - - } - - - } - return true; - - } - - - - public function getBatchDetails($UniversityID,$branchId) - { - $this->db->select("BatchID,BatchCode,BatchName,str_to_date( BatchDate,'%d-%m-%Y') as BD"); - $this->db->from('T_BatchMaster'); - $this->db->where('UniversityID',$UniversityID); - $this->db->where('IsActive',1); - $this->db->where('BranchCode',$branchId); - $this->db->order_by("BD","DESC"); - $res = $this->db->get(); - return $res->result(); - - } - - public function getStudentListForHallTicketmodel($UID,$courseID,$batch,$requestedBy,$branchId,$center) - { - - $this->db->distinct(); - $this->db->select('T_StudentDetails.StudentID,T_StudentDetails.MobileNumber,T_StudentDetails.Firstname,T_StudentDetails.Lastname,T_StudentDetails.EmailID,T_StudentDetails.ProfilePicPath,T_Student_CourseDetails.EnrollmentID,T_Hallticket_Master.HallTicket_ID,T_Hallticket_Student_Details.HallTicket_ID as isFlag'); - $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_Student_CourseDetails','T_StudentDetails.StudentID = T_Student_CourseDetails.StudentID and T_Students_Fees_Status.CourseID = T_Student_CourseDetails.CourseID'); - $this->db->join('T_Hallticket_Master','T_Students_Fees_Status.CourseID = T_Hallticket_Master.CourseID and T_Students_Fees_Status.BatchCode = T_Hallticket_Master.BatchCode and T_Students_Fees_Status.BranchCode = T_Hallticket_Master.BranchCode and T_Hallticket_Master.CenterID='.$center['CenterID'],'left'); - $this->db->join('T_Hallticket_Student_Details','T_Hallticket_Master.HallTicket_ID = T_Hallticket_Student_Details.HallTicket_ID and T_Students_Fees_Status.StudentID = T_Hallticket_Student_Details.StudentID','left'); - $this->db->where('T_Students_Fees_Status.BatchCode',$batch); - $this->db->where('T_Students_Fees_Status.BranchCode',$branchId); - $this->db->where('T_Students_Fees_Status.CourseID',$courseID); - - $res = $this->db->get(); - $data = $res->result(); - - $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['HallTicketMasterID'] = $r->HallTicket_ID; - $studetdetails['isFlag'] = $r->isFlag; - $studetdetails['FeeDetails'] = $this->getFeeSemesterDetails($r->StudentID,$batch,$branchId,$courseID); - $result_array[] = $studetdetails; - $prestu = $r->StudentID; - } - } - - } - return $result_array; - - } - - function getFeeSemesterDetails($stuid,$bcode,$branchId,$courseID) - { - $this->db->select("T_Course_Fees_Details.ID as FeesID,if(substr(substr(T_Course_Fees_Details.sem_Year,-4),1,3) = 'sem',substr(sem_Year,-1),if(substr(substr(T_Course_Fees_Details.sem_Year,-5),1,4) = 'year',substr(T_Course_Fees_Details.sem_Year,-1),false)) as SemID,if(substr(substr(T_Course_Fees_Details.sem_Year,-4),1,3) = 'sem','SEM',if(substr(substr(T_Course_Fees_Details.sem_Year,-5),1,4) = 'year','YEAR',false)) as SubType,T_Course_Fees_Details.Sem_Year,if(T_Course_Fees_Details.ProgramType = 'Y001','SEM',if(ProgramType = 'P001','REG',if(ProgramType = 'P002','LAT','FALSE'))) as Type"); - $this->db->from('T_Students_Fees_Status'); - //$this->db->join('T_StudentDetails','T_Students_Fees_Status.StudentID=T_StudentDetails.StudentID'); - $this->db->join('T_Course_Fees_Details','T_Students_Fees_Status.FeesType=T_Course_Fees_Details.ID'); - $this->db->where('T_Students_Fees_Status.BatchCode',$bcode); - $this->db->where('T_Students_Fees_Status.BranchCode',$branchId); - $this->db->where('T_Students_Fees_Status.CourseID',$courseID); - $this->db->where('T_Students_Fees_Status.StudentID',$stuid); - $res = $this->db->get(); - return $res->result(); - } - - public function getUniversityDetials($UID,$branchId) - { - $this->db->select('UniversityID,UniversityName,MobileNumber,EmailID,Address,ProfilePicPath'); - $this->db->from('T_UniversityMaster'); - $this->db->where('T_UniversityMaster.BranchCode',$branchId); - $this->db->where('T_UniversityMaster.IsActive',1); - $this->db->where('T_UniversityMaster.UniversityID',$UID['universityID']); - $res = $this->db->get(); - return $res->result(); - - } - - //Student Details with All Corresponding Semesters and Subjects - public function getStudentDetails($UID,$courseID,$branchId,$studentIDs,$centerName,$batch,$requestedBy) - { - - foreach($studentIDs as $key1 => $id) - { - foreach($id['FeeDetails'] as $key2 => $ind) - { - // Get Normel Semester - if(strcasecmp($ind['Type'],'sem') == 0 && strcasecmp($ind['SubType'],'sem') == 0 ) - { - - $sql = "SELECT T_SemSubMap_Child.SubjectID,T_SubjectMaster.SubjectCode,T_SubjectMaster.SubjectName,T_SemSubMap_Master.SemesterID,T_Batch_Schedule_Child.ScheduleDate,T_Batch_Schedule_Child.FromTime,T_Batch_Schedule_Child.ToTime FROM T_SemSubMap_Child - JOIN T_SubjectMaster on T_SemSubMap_Child.SubjectID = T_SubjectMaster.SubjectID - JOIN T_SemSubMap_Master on T_SemSubMap_Child.MapID = T_SemSubMap_Master.MapID and T_SemSubMap_Master.UniversityID = ? and T_SemSubMap_Master.CourseID = ? and T_SemSubMap_Master.SemesterID = ? and T_SemSubMap_Master.BranchCode = ? and T_SemSubMap_Child.IsActive = 1 - JOIN T_Batch_Schedule_Master on T_Batch_Schedule_Master.UniversityID = ? and T_Batch_Schedule_Master.CourseID = ? and T_Batch_Schedule_Master.BranchCode = ? - JOIN T_Batch_Schedule_Child on T_Batch_Schedule_Master.SchId = T_Batch_Schedule_Child.SchId and T_SemSubMap_Child.SubjectID = T_Batch_Schedule_Child.SubjectID and T_Batch_Schedule_Child.IsActive = 1 - order by T_Batch_Schedule_Child.ScheduleDate"; - $res = $this->db->query($sql,array($UID['universityID'],$courseID,$ind['SemID'],$branchId,$UID['universityID'],$courseID,$branchId)); - //$id['FeeDetails'][$key2] = $res->result(); - $in = $res->result(); - //array_push($id['FeeDetails'][$key2],$ind); - array_splice($id['FeeDetails'][$key2],0,6,$in); - $studentIDs['NUMTYPE'] = 'SEM'; - //return $ind; - } - else if(strcasecmp($ind['Type'],'sem') == 0 && strcasecmp($ind['SubType'],'year') == 0) - { - //GET Year Based Semester - - if($ind['SemID'] == 1)//First Year - { - //$i = 1; - for($i = 1;$i <= 1; $i++) - { - $sql = "SELECT T_SemSubMap_Child.SubjectID,T_SubjectMaster.SubjectCode,T_SubjectMaster.SubjectName,T_SemSubMap_Master.SemesterID,T_Batch_Schedule_Child.ScheduleDate,T_Batch_Schedule_Child.FromTime,T_Batch_Schedule_Child.ToTime FROM T_SemSubMap_Child - JOIN T_SubjectMaster on T_SemSubMap_Child.SubjectID = T_SubjectMaster.SubjectID - JOIN T_SemSubMap_Master on T_SemSubMap_Child.MapID = T_SemSubMap_Master.MapID and T_SemSubMap_Master.UniversityID = ? and T_SemSubMap_Master.CourseID = ? and T_SemSubMap_Master.SemesterID = ? and T_SemSubMap_Master.BranchCode = ? and T_SemSubMap_Child.IsActive = 1 - JOIN T_Batch_Schedule_Master on T_Batch_Schedule_Master.UniversityID = ? and T_Batch_Schedule_Master.CourseID = ? and T_Batch_Schedule_Master.BranchCode = ? - JOIN T_Batch_Schedule_Child on T_Batch_Schedule_Master.SchId = T_Batch_Schedule_Child.SchId and T_SemSubMap_Child.SubjectID = T_Batch_Schedule_Child.SubjectID and T_Batch_Schedule_Child.IsActive = 1 - order by T_Batch_Schedule_Child.ScheduleDate"; - $res = $this->db->query($sql,array($UID['universityID'],$courseID,$i,$branchId,$UID['universityID'],$courseID,$branchId)); - //$id['FeeDetails'][$key2] = $res->result(); - $in1[] = $res->result(); - //array_push($id['FeeDetails'][$key2],$ind); - - - } - array_splice($id['FeeDetails'][$key2],0,6,$in1[0]); - - } - - else if($ind['SemID'] == 2)//Sec Year - { - $j = 3; - // for($j = 3;$j <= 3; $j++) - // { - $sql = "SELECT T_SemSubMap_Child.SubjectID,T_SubjectMaster.SubjectCode,T_SubjectMaster.SubjectName,T_SemSubMap_Master.SemesterID,T_Batch_Schedule_Child.ScheduleDate,T_Batch_Schedule_Child.FromTime,T_Batch_Schedule_Child.ToTime FROM T_SemSubMap_Child - JOIN T_SubjectMaster on T_SemSubMap_Child.SubjectID = T_SubjectMaster.SubjectID - JOIN T_SemSubMap_Master on T_SemSubMap_Child.MapID = T_SemSubMap_Master.MapID and T_SemSubMap_Master.UniversityID = ? and T_SemSubMap_Master.CourseID = ? and T_SemSubMap_Master.SemesterID = ? and T_SemSubMap_Master.BranchCode = ? and T_SemSubMap_Child.IsActive = 1 - JOIN T_Batch_Schedule_Master on T_Batch_Schedule_Master.UniversityID = ? and T_Batch_Schedule_Master.CourseID = ? and T_Batch_Schedule_Master.BranchCode = ? - JOIN T_Batch_Schedule_Child on T_Batch_Schedule_Master.SchId = T_Batch_Schedule_Child.SchId and T_SemSubMap_Child.SubjectID = T_Batch_Schedule_Child.SubjectID and T_Batch_Schedule_Child.IsActive = 1 - order by T_Batch_Schedule_Child.ScheduleDate"; - $res = $this->db->query($sql,array($UID['universityID'],$courseID,$j,$branchId,$UID['universityID'],$courseID,$branchId)); - //$id['FeeDetails'][$key2] = $res->result(); - $in2[] = $res->result(); - //array_push($id['FeeDetails'][$key2],$ind); - - - // } - array_splice($id['FeeDetails'][$key2],0,6,$in2[0]); - } - - - else if($ind['SemID'] == 3) - { - $k = 5; - // for($k = 5;$k <= 5; $k++) - // { - $sql = "SELECT T_SemSubMap_Child.SubjectID,T_SubjectMaster.SubjectCode,T_SubjectMaster.SubjectName,T_SemSubMap_Master.SemesterID,T_Batch_Schedule_Child.ScheduleDate,T_Batch_Schedule_Child.FromTime,T_Batch_Schedule_Child.ToTime FROM T_SemSubMap_Child - JOIN T_SubjectMaster on T_SemSubMap_Child.SubjectID = T_SubjectMaster.SubjectID - JOIN T_SemSubMap_Master on T_SemSubMap_Child.MapID = T_SemSubMap_Master.MapID and T_SemSubMap_Master.UniversityID = ? and T_SemSubMap_Master.CourseID = ? and T_SemSubMap_Master.SemesterID = ? and T_SemSubMap_Master.BranchCode = ? and T_SemSubMap_Child.IsActive = 1 - JOIN T_Batch_Schedule_Master on T_Batch_Schedule_Master.UniversityID = ? and T_Batch_Schedule_Master.CourseID = ? and T_Batch_Schedule_Master.BranchCode = ? - JOIN T_Batch_Schedule_Child on T_Batch_Schedule_Master.SchId = T_Batch_Schedule_Child.SchId and T_SemSubMap_Child.SubjectID = T_Batch_Schedule_Child.SubjectID and T_Batch_Schedule_Child.IsActive = 1 - order by T_Batch_Schedule_Child.ScheduleDate"; - $res = $this->db->query($sql,array($UID['universityID'],$courseID,$k,$branchId,$UID['universityID'],$courseID,$branchId)); - //$id['FeeDetails'][$key2] = $res->result(); - $in3[] = $res->result(); - //array_push($id['FeeDetails'][$key2],$ind); - - - // } - array_splice($id['FeeDetails'][$key2],0,6,$in3[0]); - } - - - else if($ind['SemID'] == 4) - { - $l = 7; - // for($l = 7;$l <= 7; $l++) - // { - $sql = "SELECT T_SemSubMap_Child.SubjectID,T_SubjectMaster.SubjectCode,T_SubjectMaster.SubjectName,T_SemSubMap_Master.SemesterID,T_Batch_Schedule_Child.ScheduleDate,T_Batch_Schedule_Child.FromTime,T_Batch_Schedule_Child.ToTime FROM T_SemSubMap_Child - JOIN T_SubjectMaster on T_SemSubMap_Child.SubjectID = T_SubjectMaster.SubjectID - JOIN T_SemSubMap_Master on T_SemSubMap_Child.MapID = T_SemSubMap_Master.MapID and T_SemSubMap_Master.UniversityID = ? and T_SemSubMap_Master.CourseID = ? and T_SemSubMap_Master.SemesterID = ? and T_SemSubMap_Master.BranchCode = ? and T_SemSubMap_Child.IsActive = 1 - JOIN T_Batch_Schedule_Master on T_Batch_Schedule_Master.UniversityID = ? and T_Batch_Schedule_Master.CourseID = ? and T_Batch_Schedule_Master.BranchCode = ? - JOIN T_Batch_Schedule_Child on T_Batch_Schedule_Master.SchId = T_Batch_Schedule_Child.SchId and T_SemSubMap_Child.SubjectID = T_Batch_Schedule_Child.SubjectID and T_Batch_Schedule_Child.IsActive = 1 - order by T_Batch_Schedule_Child.ScheduleDate"; - $res = $this->db->query($sql,array($UID['universityID'],$courseID,$l,$branchId,$UID['universityID'],$courseID,$branchId)); - //$id['FeeDetails'][$key2] = $res->result(); - $in4[] = $res->result(); - //array_push($id['FeeDetails'][$key2],$ind); - - - // } - array_splice($id['FeeDetails'][$key2],0,6,$in4[0]); - } - - $studentIDs['NUMTYPE'] = 'YEAR'; - } - else if(strcasecmp($ind['Type'],'REG') == 0) - { - //Get Regular(All Semester) - for($m = 1;$m <= 8; $m++) - { - $sql = "SELECT T_SemSubMap_Child.SubjectID,T_SubjectMaster.SubjectCode,T_SubjectMaster.SubjectName,T_SemSubMap_Master.SemesterID,T_Batch_Schedule_Child.ScheduleDate,T_Batch_Schedule_Child.FromTime,T_Batch_Schedule_Child.ToTime FROM T_SemSubMap_Child - JOIN T_SubjectMaster on T_SemSubMap_Child.SubjectID = T_SubjectMaster.SubjectID - JOIN T_SemSubMap_Master on T_SemSubMap_Child.MapID = T_SemSubMap_Master.MapID and T_SemSubMap_Master.UniversityID = ? and T_SemSubMap_Master.CourseID = ? and T_SemSubMap_Master.SemesterID = ? and T_SemSubMap_Master.BranchCode = ? and T_SemSubMap_Child.IsActive = 1 - JOIN T_Batch_Schedule_Master on T_Batch_Schedule_Master.UniversityID = ? and T_Batch_Schedule_Master.CourseID = ? and T_Batch_Schedule_Master.BranchCode = ? - JOIN T_Batch_Schedule_Child on T_Batch_Schedule_Master.SchId = T_Batch_Schedule_Child.SchId and T_SemSubMap_Child.SubjectID = T_Batch_Schedule_Child.SubjectID and T_Batch_Schedule_Child.IsActive = 1 - order by T_Batch_Schedule_Child.ScheduleDate"; - $res = $this->db->query($sql,array($UID['universityID'],$courseID,$m,$branchId,$UID['universityID'],$courseID,$branchId)); - //$id['FeeDetails'][$key2] = $res->result(); - $in[] = $res->result(); - //array_push($id['FeeDetails'][$key2],$ind); - - - } - array_splice($id['FeeDetails'][$key2],0,6,$in); - $studentIDs['NUMTYPE'] = 'REG'; - } - else if(strcasecmp($ind['Type'],'LAT') == 0) - { - //Get Later Entry all semester except 1 and 2 - for($i = 3;$i <= 8; $i++) - { - $sql = "SELECT T_SemSubMap_Child.SubjectID,T_SubjectMaster.SubjectCode,T_SubjectMaster.SubjectName,T_SemSubMap_Master.SemesterID,T_Batch_Schedule_Child.ScheduleDate,T_Batch_Schedule_Child.FromTime,T_Batch_Schedule_Child.ToTime FROM T_SemSubMap_Child - JOIN T_SubjectMaster on T_SemSubMap_Child.SubjectID = T_SubjectMaster.SubjectID - JOIN T_SemSubMap_Master on T_SemSubMap_Child.MapID = T_SemSubMap_Master.MapID and T_SemSubMap_Master.UniversityID = ? and T_SemSubMap_Master.CourseID = ? and T_SemSubMap_Master.SemesterID = ? and T_SemSubMap_Master.BranchCode = ? and T_SemSubMap_Child.IsActive = 1 - JOIN T_Batch_Schedule_Master on T_Batch_Schedule_Master.UniversityID = ? and T_Batch_Schedule_Master.CourseID = ? and T_Batch_Schedule_Master.BranchCode = ? - JOIN T_Batch_Schedule_Child on T_Batch_Schedule_Master.SchId = T_Batch_Schedule_Child.SchId and T_SemSubMap_Child.SubjectID = T_Batch_Schedule_Child.SubjectID and T_Batch_Schedule_Child.IsActive = 1 - order by T_Batch_Schedule_Child.ScheduleDate"; - $res = $this->db->query($sql,array($UID['universityID'],$courseID,$i,$branchId,$UID['universityID'],$courseID,$branchId)); - //$id['FeeDetails'][$key2] = $res->result(); - $in[] = $res->result(); - //array_push($id['FeeDetails'][$key2],$ind); - - - } - array_splice($id['FeeDetails'][$key2],0,6,$in); - $studentIDs['NUMTYPE'] = 'LAT'; - } - - - } - array_splice($studentIDs[$key1]['FeeDetails'],0,10,$id['FeeDetails']) ; - - } - // echo "COE"; - // print_r($studentIDs);die(); - $this->saveHallTicketDataForExamAttendance($UID,$courseID,$branchId,$studentIDs,$centerName,$batch,$requestedBy); - return $studentIDs; - } - - - public function saveHallTicketDataForExamAttendance($UID,$courseID,$branchId,$studentIDs,$centerName,$batch,$requestedBy) - { - - $MASTERID = '00'; - - $this->db->select('HallTicket_ID'); - $this->db->from('T_Hallticket_Master'); - $this->db->where('UniversityID',$UID['universityID']); - $this->db->where('CourseID',$courseID); - $this->db->where('BatchCode',$batch); - $this->db->where('CenterID',$centerName['CenterID']); - $this->db->where('BranchCode',$branchId); - $isExist = $this->db->get(); - $isExist = $isExist->result_array(); - - //print_r($isExist);die(); - if(!empty($isExist[0]['HallTicket_ID'])) - { - $MASTERID = $isExist[0]['HallTicket_ID']; - - $this->db->trans_start(); - $this->db->where('HallTicket_ID',$MASTERID); - $this->db->update('T_Hallticket_Master',array('UpdatedBy'=>$requestedBy)); - $this->db->trans_complete(); - - $this->db->trans_start(); - $this->db->select('HallTicket_Student_ID'); - $this->db->from('T_Hallticket_Student_Details'); - $this->db->where('`HallTicket_ID',$MASTERID); - $existStudentID = $this->db->get(); - $existStudentID = $existStudentID->result_array(); - $this->db->trans_complete(); - $finalExistStudentID = array(); - foreach($existStudentID as $exist) - { - $finalExistStudentID[] = $exist['HallTicket_Student_ID']; - } - - $this->db->trans_start(); - $this->db->where_in('HallTicket_ID',$MASTERID); - $this->db->delete('T_Hallticket_Student_Details'); - $this->db->trans_complete(); - - $this->db->trans_start(); - $this->db->where_in('HallTicket_Student_ID',$finalExistStudentID); - $this->db->delete('T_Hallticket_Subject_Details'); - $this->db->trans_complete(); - } - else - { - $masterArray = array('UniversityID'=>$UID['universityID'],'CourseID'=>$courseID,'BatchCode'=>$batch,'BranchCode'=>$branchId,'CreatedBy'=>$requestedBy,'CenterID'=>$centerName['CenterID']); - $this->db->trans_start(); - $this->db->insert('T_Hallticket_Master',$masterArray); - $MASTERID = $this->db->insert_id(); - $this->db->trans_complete(); - } - //Save University,Course,Batch,BranchCode, and Center ID - - if($studentIDs['NUMTYPE'] == 'SEM') - { - foreach($studentIDs as $student) - { - //print_r($student);echo "
"; - if(!empty($student['FeeDetails'])) - { - foreach($student['FeeDetails'] as $key => $fees) - { - //print_r($fees); - $tempArray = array('Hallticket_ID'=>$MASTERID,'StudentID'=>$student['StudentID'],'EnrollmentID'=>$student['EnrollmentID'],'Sem_Year'=>('SEM'.($key + 1))); - - $this->db->trans_start(); - $this->db->insert('T_Hallticket_Student_Details',$tempArray); - $HallTicketStudentID = $this->db->insert_id(); - $this->db->trans_complete(); - - foreach($fees as $subject) - { - //echo $subject->SubjectCode;echo "
"; - $tempSubjectArray = array('HallTicket_Student_ID'=>$HallTicketStudentID,'SubjectCode'=>$subject->SubjectID,'ExamDate'=>$subject->ScheduleDate,'FromTime'=>$subject->FromTime,'EndTime'=>$subject->ToTime); - - $this->db->trans_start(); - $this->db->insert('T_Hallticket_Subject_Details',$tempSubjectArray); - $this->db->trans_complete(); - - } - - - } - } - } - } - else if($studentIDs['NUMTYPE'] == 'YEAR') - { - foreach($studentIDs as $student) - { - - if(!empty($student['FeeDetails'])) - { - - foreach($student['FeeDetails'][0] as $key => $fees) - { - - if(!empty($fees)) - { - $tempArray = array('Hallticket_ID'=>$MASTERID,'StudentID'=>$student['StudentID'],'EnrollmentID'=>$student['EnrollmentID'],'Sem_Year'=>('YEAR'.($key + 1))); - - $this->db->trans_start(); - $this->db->insert('T_Hallticket_Student_Details',$tempArray); - $HallTicketStudentID = $this->db->insert_id(); - $this->db->trans_complete(); - - $tempSubjectArray = array('HallTicket_Student_ID'=>$HallTicketStudentID,'SubjectCode'=>$fees->SubjectID,'ExamDate'=>$fees->ScheduleDate,'FromTime'=>$fees->FromTime,'EndTime'=>$fees->ToTime); - - $this->db->trans_start(); - $this->db->insert('T_Hallticket_Subject_Details',$tempSubjectArray); - $this->db->trans_complete(); - - - } - } - } - } - - } - else if($studentIDs['NUMTYPE'] == 'LAT') - { - foreach($studentIDs as $student) - { - if(!empty($student['FeeDetails'])) - { - foreach($student['FeeDetails'][0] as $key => $fees) - { - - if(!empty($fees)) - { - $tempArray = array('Hallticket_ID'=>$MASTERID,'StudentID'=>$student['StudentID'],'EnrollmentID'=>$student['EnrollmentID'],'Sem_Year'=>('SEM'.($key + 2))); - - $this->db->trans_start(); - $this->db->insert('T_Hallticket_Student_Details',$tempArray); - $HallTicketStudentID = $this->db->insert_id(); - $this->db->trans_complete(); - - foreach($fees as $subject) - { - - $tempSubjectArray = array('HallTicket_Student_ID'=>$HallTicketStudentID,'SubjectCode'=>$subject->SubjectID,'ExamDate'=>$subject->ScheduleDate,'FromTime'=>$subject->FromTime,'EndTime'=>$subject->ToTime); - - $this->db->trans_start(); - $this->db->insert('T_Hallticket_Subject_Details',$tempSubjectArray); - $this->db->trans_complete(); - - } - } - } - } - } - } - else if($studentIDs['NUMTYPE'] == 'REG') - { - foreach($studentIDs as $student) - { - if(!empty($student['FeeDetails'])) - { - foreach($student['FeeDetails'][0] as $key => $fees) - { - - if(!empty($fees)) - { - $tempArray = array('Hallticket_ID'=>$MASTERID,'StudentID'=>$student['StudentID'],'EnrollmentID'=>$student['EnrollmentID'],'Sem_Year'=>('SEM'.($key + 1))); - - $this->db->trans_start(); - $this->db->insert('T_Hallticket_Student_Details',$tempArray); - $HallTicketStudentID = $this->db->insert_id(); - $this->db->trans_complete(); - - foreach($fees as $subject) - { - - $tempSubjectArray = array('HallTicket_Student_ID'=>$HallTicketStudentID,'SubjectCode'=>$subject->SubjectID,'ExamDate'=>$subject->ScheduleDate,'FromTime'=>$subject->FromTime,'EndTime'=>$subject->ToTime); - - $this->db->trans_start(); - $this->db->insert('T_Hallticket_Subject_Details',$tempSubjectArray); - $this->db->trans_complete(); - - } - } - } - } - } - } - - - } - - public function getBatchAndCenterDetailsModel($branchID) - { - $this->db->distinct(); - $this->db->select("BatchCode,BatchDate,BatchName,str_to_date(BatchDate,'%d-%m-%Y') as BD"); - $this->db->from('T_BatchMaster'); - $this->db->where('BranchCode',$branchID); - $this->db->where('IsActive',1); - $this->db->order_by('BD','DESC'); - $result = $this->db->get(); - $data['batchDetails'] = $result->result(); - - $this->db->select('CenterID,CenterCode,CenterName,CenterAddress'); - $this->db->from('T_CenterMaster'); - $this->db->where('BranchCode',$branchID); - $this->db->where('IsActive',1); - $result2 = $this->db->get(); - $data['centerDetails'] = $result2->result(); - - return $data; - - } - public function getExamAttendance_model($UID,$branchId,$centerName,$examDate,$batch) - { - - //echo $UID;die(); - $sql = "SELECT DISTINCT T_Hallticket_Master.UniversityID,T_UniversityMaster.UniversityName,T_Hallticket_Master.CourseID,T_CourseMaster.CourseName,T_CourseMaster.CourseCode,T_Hallticket_Master.BatchCode,T_BatchMaster.BatchName,T_Hallticket_Master.BranchCode,T_Hallticket_Master.CenterID,T_CenterMaster.CenterName,T_Hallticket_Student_Details.StudentID,T_StudentDetails.Firstname,T_StudentDetails.Lastname,T_Hallticket_Student_Details.EnrollmentID,T_Hallticket_Student_Details.Sem_Year,T_Hallticket_Subject_Details.SubjectCode,T_SubjectMaster.SubjectName,T_SubjectMaster.SubjectCode,T_Hallticket_Subject_Details.ExamDate,T_Hallticket_Subject_Details.FromTime,T_Hallticket_Subject_Details.EndTime FROM T_Hallticket_Master - - JOIN T_Hallticket_Student_Details ON T_Hallticket_Master.HallTicket_ID = T_Hallticket_Student_Details.HallTicket_ID - - JOIN T_Hallticket_Subject_Details ON T_Hallticket_Student_Details.HallTicket_Student_ID = T_Hallticket_Subject_Details.HallTicket_Student_ID - - JOIN T_UniversityMaster ON T_Hallticket_Master.UniversityID = T_UniversityMaster.UniversityID AND T_UniversityMaster.BranchCode = T_Hallticket_Master.BranchCode - - JOIN T_CourseMaster ON T_Hallticket_Master.CourseID = T_CourseMaster.CourseID - - JOIN T_BatchMaster ON T_Hallticket_Master.BatchCode = T_BatchMaster.BatchCode AND T_BatchMaster.BranchCode = T_Hallticket_Master.BranchCode - - JOIN T_CenterMaster ON T_Hallticket_Master.CenterID = T_CenterMaster.CenterID AND T_CenterMaster.BranchCode = T_Hallticket_Master.BranchCode - - JOIN T_SubjectMaster ON T_Hallticket_Subject_Details.SubjectCode = T_SubjectMaster.SubjectID AND T_SubjectMaster.BranchCode = T_Hallticket_Master.BranchCode - - JOIN T_StudentDetails ON T_Hallticket_Student_Details.StudentID = T_StudentDetails.StudentID AND T_StudentDetails.BranchCode = T_Hallticket_Master.BranchCode - - WHERE T_Hallticket_Master.UniversityID = ? AND T_Hallticket_Master.BatchCode = ? AND T_Hallticket_Master.BranchCode = ? AND T_Hallticket_Master.CenterID = ? AND STR_TO_DATE(T_Hallticket_Subject_Details.ExamDate,'%Y-%m-%d') = STR_TO_DATE(?,'%Y-%m-%d')"; - - $res = $this->db->query($sql,array($UID,$batch,$branchId,$centerName['CenterID'],$examDate)); - $result = $res->result(); - //print_r($this->db->last_query()); - //echo "MODEL";print_r($result);die(); - return $result; - - } - public function AddBatchScheduleMasterFile($schedulemaster,$filedetails) - { - - $this->db->trans_start(); - $this->db->insert('T_Batch_Schedule_Master', $schedulemaster); - $insert_id = $this->db->affected_rows(); - $this->db->trans_complete(); - // print_r($this->db->last_query()); - if($insert_id>0) - { - $subQuery = 'select max(SchId) as SchId from T_Batch_Schedule_Master'; - - $query = $this->db->query($subQuery); - $result = $query->result_array(); - $schid= $result[0]['SchId']; - - // if(($schid != '')||($schid !=0)) - - if(count($result)>0) - { - - foreach($filedetails as $det) - { - - $sudate = $det['schduleDate']; - $SubDate = date("Y-m-d", strtotime($sudate)); - // $SubDate=$sudate->format('Y-m-d H:i:s'); - $stime = $det['FromTime']; - $etime = $det['ToTime']; - $isactive=1; - $subcode = $det['SubjectID']; - $Cdate = new DateTime('now',new DateTimeZone('Asia/Kolkata')); - $CreatedOn = $Cdate->format('Y-m-d H:i:s'); - $this->db->select('SubjectCode,SubjectID,SubjectName'); - $this->db->from('T_SubjectMaster'); - $this->db->where('T_SubjectMaster.BranchCode', $schedulemaster['BranchCode']); - $this->db->where('T_SubjectMaster.SubjectCode', $det['SubjectID']); - $subDetails = $this->db->get()->result(); - $SubjectID=$subDetails[0]->SubjectID; - $schedulchild = array('SchId'=>$schid,'SubjectID'=>$SubjectID,'SchChildId'=>'','ScheduleDate'=>$SubDate,'FromTime'=>$stime,'ToTime'=>$etime,'IsActive'=>$isactive); - $this->db->trans_start(); - $this->db->insert('T_Batch_Schedule_Child',$schedulchild); - $this->db->trans_complete(); - - - - - } - - } - - //echo $schid; - // $schid=$query[0]['SchId']; - - // echo $schid; - - - } - return true; - - // return $query->result_array(); - - - } - - public function AddBatchScheduleMaster($schedulemaster,$detailArray) - { - - $this->db->trans_start(); - $this->db->insert('T_Batch_Schedule_Master', $schedulemaster); - $insert_id = $this->db->affected_rows(); - $this->db->trans_complete(); - // print_r($this->db->last_query()); - if($insert_id>0) - { - $subQuery = 'select max(SchId) as SchId from T_Batch_Schedule_Master'; - - $query = $this->db->query($subQuery); - - - $result = $query->result_array(); - $schid= $result[0]['SchId']; - - // if(($schid != '')||($schid !=0)) - - if(count($result)>0) - { - - foreach($detailArray as $det) - { - - $sudate = $det['scheduleDate']; - $SubDate = date("Y-m-d", strtotime($sudate)); - // $SubDate=$sudate->format('Y-m-d H:i:s'); - $stime = $det['scheduleStart']; - $etime = $det['scheduleEnd']; - $isactive=1; - $subId = $det['subjectID']; - $Cdate = new DateTime('now',new DateTimeZone('Asia/Kolkata')); - $CreatedOn = $Cdate->format('Y-m-d H:i:s'); - - $schedulchild = array('SchId'=>$schid,'SubjectID'=>$subId,'SchChildId'=>'','ScheduleDate'=>$SubDate,'FromTime'=>$stime,'ToTime'=>$etime,'IsActive'=>$isactive); - $this->db->trans_start(); - $this->db->insert('T_Batch_Schedule_Child',$schedulchild); - $this->db->trans_complete(); - - - - - // print_r($schedulchild); - //die(); - - //$schedulchildadd = $this->Hallticket_model->AddScheduleChild($schedulchild); - } - - } - - //echo $schid; - // $schid=$query[0]['SchId']; - - // echo $schid; - - - } - return true; - - // return $query->result_array(); - - - } - public function scheduleUpdate($schedulearray,$up,$scheduleID) - { - //print_r($schedulearray);die(); - $MasterID = ""; - foreach($schedulearray as $shed) - { - $ChildID = $shed['schChildId']; - //echo $ChildID; - $sudate = $shed['scheduleDate']; - $SubDate = date("Y-m-d", strtotime($sudate)); - $MasterID = $shed['SchId']; - - $SubjectID = $shed['SubjectID']; - $scheduleStart = $shed['scheduleStart']; - $scheduleEnd = $shed['scheduleEnd']; - $isactive=1; - if($ChildID != '') - { - - $schedulchildUpdate = array('ScheduleDate'=>$SubDate,'FromTime'=>$scheduleStart,'ToTime'=>$scheduleEnd); - - $this->db->trans_start(); - $this->db->where('T_Batch_Schedule_Child.SchChildId',$ChildID); - $this->db->where('T_Batch_Schedule_Child.SubjectID',$SubjectID); - $this->db->where('T_Batch_Schedule_Child.SchId',$MasterID); - $this->db->update('T_Batch_Schedule_Child',$schedulchildUpdate); - $this->db->trans_complete(); - - } - else - { - - $schedulchildInsert = array('SchId'=>$scheduleID,'SubjectID'=>$SubjectID,'ScheduleDate'=>$SubDate,'FromTime'=>$scheduleStart,'ToTime'=>$scheduleEnd,'IsActive'=>$isactive); - $this->db->trans_start(); - $this->db->insert('T_Batch_Schedule_Child',$schedulchildInsert); - $this->db->trans_complete(); - - } - } - - $schedulMaster = array('UpdatedBy'=>$up); - - $this->db->trans_start(); - $this->db->update('T_Batch_Schedule_Master',$schedulMaster); - $this->db->where('T_Batch_Schedule_Master.SchId',$MasterID); - $this->db->trans_complete(); - - return $up; - - } - - - // public function AddScheduleChild($schedulchild) - // { - // $this->db->trans_start(); - // $this->db->insert('T_Batch_Schedule_Child',$schedulchild); - // $this->db->trans_complete(); - // return true; - - // } - - - - public function GetSubListDetails($sub) - { - $this->db->select('SubjectCode,SubjectID,SubjectName'); - $this->db->from('T_SubjectMaster'); - $this->db->where('T_SubjectMaster.BranchCode',$sub['branchId']); - $this->db->where('T_SubjectMaster.SubjectCode',$sub['SubjectCode']); - $subDetails = $this->db->get()->result(); - - - // print_r($subDetails); - // die(); - - if($subDetails) - { - $result_array['searchst'] = true; - $result_array['details'] = $subDetails; - } - - else - { - $result_array['searchst'] = false; - $result_array['details'] = "No records found!"; - } - return $result_array; - } - +db->select('UniversityID,UniversityName'); + $this->db->where('IsActive','1'); + $this->db->where('BranchCode',$branchId); + $this->db->order_by('UniversityID','ASC'); + $unviversityDetails = $this->db->get(UNIVERSITY); + + if($unviversityDetails->result()){ + $result_university = array(); + $result_university['universityStatus'] = true; + foreach ($unviversityDetails->result() as $row) + { + + $university_array['universityID'] = $row->UniversityID; + $university_array['universityName'] = $row->UniversityName; + $university_array['courseDetails']= $this->getCourseDetails($row->UniversityID,$branchId); + $university_array['batchDetails']= $this->getBatchDetails($row->UniversityID,$branchId); + $result_array[]=$university_array; + } + $result_university['univerSityDetails']= $result_array; + $result_university['centerDetails'] = $this->getCenterDetails($branchId); + } + else { + $result_university['universityStatus'] = false; + $result_university['message'] = "No records found!"; + $result_university['universityID'] = ""; + $result_university['universityName'] = ""; + $result_university['courseDetails']= ""; + } + + + return $result_university; + + } + + + public function getCenterDetails($branchId) + { + $this->db->select('CenterID,CenterCode,CenterName,CenterAddress'); + $this->db->from('T_CenterMaster'); + $this->db->where('IsActive',1); + $this->db->where('BranchCode',$branchId); + $res = $this->db->get(); + return $res->result(); + } + /* + * get university details and course details + * for view shedule + * created by TamilBala + * */ + public function getUniversityid($branchCode) + { + $this->db->distinct(); + $this->db->select('T_Batch_Schedule_Master.UniversityID,T_Batch_Schedule_Master.CourseID,T_Batch_Schedule_Master.SchId,T_UniversityMaster.UniversityName,T_CourseMaster.CourseName,T_CourseMaster.CourseCode,T_Batch_Schedule_Child.ScheduleDate,T_Batch_Schedule_Child.FromTime,T_Batch_Schedule_Child.ToTime,T_Batch_Schedule_Child.SchId,T_SubjectMaster.SubjectName,T_SubjectMaster.SubjectID,T_UniversityMaster.UniversityID,T_SubjectMaster.BranchCode'); + $this->db->from('T_Batch_Schedule_Master'); + $this->db->join('T_UniversityMaster','T_Batch_Schedule_Master.UniversityID=T_UniversityMaster.UniversityID'); + $this->db->join('T_CourseMaster','T_Batch_Schedule_Master.CourseID=T_CourseMaster.CourseID'); + $this->db->join('T_Batch_Schedule_Child','T_Batch_Schedule_Master.SchId=T_Batch_Schedule_Child.SchId'); + $this->db->join('T_SubjectMaster','T_Batch_Schedule_Child.SubjectID=T_SubjectMaster.SubjectID'); + $this->db->where('T_Batch_Schedule_Master.BranchCode',$branchCode); + $this->db->where('T_Batch_Schedule_Master.IsActive',1); + $this->db->group_by('T_CourseMaster.CourseName'); + $result = $this->db->get(); + //print_r($result->result()); + return $result->result(); + } + /* + * get shedule details details + * for edit/view shedule + * created by TamilBala + * */ + public function getShedules($mapid) + { + $this->db->select('T_Batch_Schedule_Child.ScheduleDate,T_Batch_Schedule_Child.FromTime,T_Batch_Schedule_Child.ToTime,T_SubjectMaster.SubjectName,T_Batch_Schedule_Child.SchChildId,T_Batch_Schedule_Child.SubjectID'); + $this->db->from('T_SubjectMaster'); + $this->db->join('T_Batch_Schedule_Child','T_Batch_Schedule_Child.SubjectID=T_SubjectMaster.SubjectID','left'); + $this->db->where('T_Batch_Schedule_Child.SchId',$mapid); + $result = $this->db->get(); + //print_r($result->result()); + //die(); + return $result->result(); + } + /* + * get shedule details details + * for edit/view shedule + * created by TamilBala + * */ + //////////// + // $this->db->join('T_Batch_Schedule_Child','T_Batch_Schedule_Child.SchId = SCM.SchId'); + // $this->db->join('T_SemSubMap_Master','T_SemSubMap_Master.UniversityID=SCM.UniversityID and T_SemSubMap_Master.CourseID=SCM.CourseID'); + // $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',$CourseID); + //////////// + public function get_unShedules($mapid,$subid,$branchcode,$CourseID,$universityID) + { + //echo $mapid; + $sql="SELECT semchild.SubjectID,semchild.MapID,bsc.ScheduleDate,bsc.FromTime,bsc.ToTime,sm.SubjectName + FROM T_SemSubMap_Child semchild + LEFT JOIN T_SemSubMap_Master semmaster ON semmaster.MapID = semchild.MapID + LEFT JOIN T_Batch_Schedule_Master bsm ON bsm.UniversityID = semmaster.UniversityID +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."' +group by semchild.SubjectID,semchild.MapID"; + $b=$this->db->query($sql); + //print_r($b); + if($b->result()){ + $resultShedule['status']=true; + $mastScheduleID=""; + foreach($b->result() as $row) + { + + $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('T_Batch_Schedule_Child.SubjectID',$row->SubjectID); + $existsheduledetails = $this->db->get(); + //print_r($existsheduledetails); + if($existData=$existsheduledetails->result()) + { + + $fetchData['ID']="1"; + $fetchData['SubjectID']=$row->SubjectID; + $fetchData['SubjectName']=$row->SubjectName; + $fetchData['ScheduleDate']=$existData[0]->ScheduleDate; + $fetchData['FromTime']=$existData[0]->FromTime; + $fetchData['ToTime']=$existData[0]->ToTime; + $fetchData['SchChildId']=$existData[0]->SchChildId; + $fetchData['SchId']=$existData[0]->SchId; + $mastScheduleID=$existData[0]->SchId; + + } + else + { + + $fetchData['SubjectID']=$row->SubjectID; + $fetchData['SubjectName']=$row->SubjectName; + $fetchData['ID']="0"; + $fetchData['ScheduleDate']=""; + $fetchData['FromTime']=""; + $fetchData['ToTime']=""; + $fetchData['SchChildId']=""; + $fetchData['SchId']= $mastScheduleID; + + } + $fetchshedule[]=$fetchData; + } + $resultShedule['scheduleDetails']=$fetchshedule; + } + else{ + $resultShedule['status']=false; + $resultShedule['scheduleDetails']=""; + } + //print_r($resultShedule); + //die(); + return $resultShedule; + } + /* + * get course details + * @params university id + * created by velz + * */ + public function getCourseDetails($universityID=null,$branchId) + { + + $this->db->select('T_CourseMaster.CourseID,CONCAT(T_CourseMaster.CourseName, "(",T_CourseMaster.CourseCode,")") AS CourseName,T_Course_Fees_Details.ProgramType,T_Course_Fees_Details.FeesType,T_Course_Fees_Details.Sem_Year'); + $this->db->join('T_Course_Fees_Details','T_CourseMaster.CourseID = T_Course_Fees_Details.CourseID'); + $this->db->where('UniversityID',$universityID); + $this->db->where('BranchCode',$branchId); + $this->db->where('IsActive','1'); + $this->db->group_by('CourseName'); + $this->db->order_by('CourseID','ASC'); + $courseDetails = $this->db->get('T_CourseMaster'); + return $courseDetails->result(); + } +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->from('T_SemSubMap_Master'); + $this->db->where('UniversityID',$universityID); + $this->db->where('CourseID',$c); + $result = $this->db->get(); + $res = $result->result(); + + if($res[0]->count > 0 ) + { + $i++; + } + } + + if( $i > 0 ) + { + return 1; + } + else + { + return 0; + } + } + /* + * check existing data,only batchschedule. + * @params university id and CourseID + * created by Bala + * */ + + public function getExistDetails($universityID,$courseIDS,$branchId) + { + + $i=0; + foreach($courseIDS as $c) + { + + // $tempCourseArray= $c['CourseID']; + + $this->db->select ('count(*) as count'); + $this->db->from('T_Batch_Schedule_Master'); + $this->db->where('UniversityID',$universityID); + $this->db->where('CourseID', $c); + // $this->db->where('BranchCode',$branchId); + $result = $this->db->get(); + $res = $result->result(); + + if($res[0]->count > 0 ) + { + $i++; + } + } + + if( $i > 0 ) + { + return 1; + } + else + { + + foreach($courseIDS as $c) + { + $this->db->distinct(); + $this->db->select('SM.SubjectID,SM.SubjectCode,SM.SubjectName'); + $this->db->from('T_SubjectMaster SM'); + $this->db->join('T_SemSubMap_Child SC','SC.SubjectID = SM.SubjectID'); + $this->db->join('T_SemSubMap_Master SMM','SMM.mapID = SC.mapID'); + $this->db->where('SMM.UniversityID',$universityID); + $this->db->where('SMM.CourseID',$c); + $result = $this->db->get(); + return $result->result(); + } + } + } + + /* + * get subject details + * @params university id and CourseID + * created by velz + * */ + public function getSubjectDetails($universityID,$courseIDS,$branchId) + { + + $this->db->distinct(); + $this->db->select('SubjectID,SubjectCode,SubjectName'); + $this->db->from('T_SubjectMaster'); + //$this->db->join('T_SubjectMaster','T_CourseSubject_Details.SubjectID=T_SubjectMaster.SubjectID'); + $this->db->where('T_SubjectMaster.IsActive','1'); + // $this->db->where('T_CourseSubject_Details.UniversityID',$universityID); + $this->db->where_in('T_SubjectMaster.BranchCode',$branchId); + $result = $this->db->get(); + //echo $this->db->last_query(); + return $result->result(); + } + + + /* + * get semester details + * @params university id and CourseID + * created by velz + * */ + public function getSemesterDetails($universityID,$courseIDS) + { + $this->db->distinct(); + $this->db->select('CourseID,Sem_Year'); + $this->db->from('T_Course_Fees_Details'); + $this->db->where('IsActive','1'); + $this->db->where_in('T_Course_Fees_Details.CourseID',$courseIDS); + $result = $this->db->get(); + return $result->result(); + } + + + /* + * save All Semester Subject Mapping Info + * @params university id,CourseID,requestedBy,branchId,semArray + * created by velz + * */ + public function saveAllSemesterSubjectMappingmodel($UID,$courseIDS,$requestedBy,$branchId,$semArray) + { + + // echo "from MODEL"; + // print_r($courseIDS);die(); + + $tempCourseArray = array(); + foreach($courseIDS as $c) + { + $tempCourseArray[] = $c['CourseID']; + } + $sem1 = 0;$sem2=0;$sem3=0;$sem4=0;$sem5=0;$sem6=0;$sem7=0;$sem8 = 0; + foreach($semArray as $key => $s) + { + if($key == 0) + { + $sem1 = $s; + } + if($key == 1) + { + $sem2 = $s; + }if($key == 2) + { + $sem3 = $s; + }if($key == 3) + { + $sem4 = $s; + }if($key == 4) + { + $sem5 = $s; + }if($key == 5) + { + $sem6 = $s; + } + if($key == 6) + { + $sem7 = $s; + } + if($key == 7) + { + $sem8 = $s; + } + } + //Check If Exist or Not for UniversityID and CourseID's + + $this->db->select('count(*) as counts'); + $this->db->from('T_SemSubMap_Master'); + $this->db->where('BranchCode',$branchId); + $this->db->where('UniversityID',$UID); + $this->db->where_in('CourseID',$tempCourseArray); + $isExist = $this->db->get(); + $isExist = $isExist->result(); + $result_array = array('insert'=>'','exist'=>''); + if($isExist[0]->counts == 0 ) + { + + + + + $ids = array(); + + foreach($tempCourseArray as $course) + { + for($i=1;$i<=8;$i++) + { + + $dataArray = array('UniversityID'=>$UID,'CourseID'=>$course,'SemesterID'=>$i,'BranchCode'=>$branchId,'CreatedBy'=>$requestedBy); + + $this->db->trans_start(); + $this->db->insert('T_SemSubMap_Master',$dataArray); + $last_id = $this->db->insert_id(); + $this->db->trans_complete(); + //echo $last_id; + //$current = '$sem'.$i; + //echo $current;die(); + $ids[] = $last_id; + if($i == 1) + { + if(count($sem1) != 0){ + foreach($sem1 as $s) + { + $childArray = array('MapID'=>$last_id,'SubjectID'=>$s['SubjectID']); + $this->db->trans_start(); + $this->db->insert('T_SemSubMap_Child',$childArray); + $this->db->trans_complete(); + } + } + } + + if($i == 2) + { + if(count($sem2) != 0){ + foreach($sem2 as $s) + { + $childArray = array('MapID'=>$last_id,'SubjectID'=>$s['SubjectID']); + $this->db->trans_start(); + $this->db->insert('T_SemSubMap_Child',$childArray); + $this->db->trans_complete(); + } + } + } + + if($i == 3) + { + if(count($sem3) != 0){ + foreach($sem3 as $s) + { + $childArray = array('MapID'=>$last_id,'SubjectID'=>$s['SubjectID']); + $this->db->trans_start(); + $this->db->insert('T_SemSubMap_Child',$childArray); + $this->db->trans_complete(); + } + } + } + + if($i == 4) + { + if(count($sem4) != 0){ + foreach($sem4 as $s) + { + $childArray = array('MapID'=>$last_id,'SubjectID'=>$s['SubjectID']); + $this->db->trans_start(); + $this->db->insert('T_SemSubMap_Child',$childArray); + $this->db->trans_complete(); + } + } + } + + if($i == 5) + { + if(count($sem5) != 0){ + foreach($sem5 as $s) + { + $childArray = array('MapID'=>$last_id,'SubjectID'=>$s['SubjectID']); + $this->db->trans_start(); + $this->db->insert('T_SemSubMap_Child',$childArray); + $this->db->trans_complete(); + } + } + } + + if($i == 6) + { + if(count($sem6) != 0){ + foreach($sem6 as $s) + { + $childArray = array('MapID'=>$last_id,'SubjectID'=>$s['SubjectID']); + $this->db->trans_start(); + $this->db->insert('T_SemSubMap_Child',$childArray); + $this->db->trans_complete(); + } + } + } + + if($i == 7) + { + if(count($sem7) != 0){ + foreach($sem7 as $s) + { + $childArray = array('MapID'=>$last_id,'SubjectID'=>$s['SubjectID']); + $this->db->trans_start(); + $this->db->insert('T_SemSubMap_Child',$childArray); + $this->db->trans_complete(); + } + } + } + + if($i == 8) + { + if(count($sem8) != 0){ + foreach($sem8 as $s) + { + $childArray = array('MapID'=>$last_id,'SubjectID'=>$s['SubjectID']); + $this->db->trans_start(); + $this->db->insert('T_SemSubMap_Child',$childArray); + $this->db->trans_complete(); + } + } + } + + } + + + } + + if(count($ids) > 0) + { + $result_array['insert'] = true; + $result_array['exist'] = false; + return $result_array; + } + else + { + $result_array['insert'] = false; + $result_array['exist'] = false; + return $result_array; + + } + + } + else + { + + + $result_array['insert'] = false; + $result_array['exist'] = true; + return $result_array; + } + + } + + /* + * get All Semester Subject Mapping Info + * @params branchId + * created by velz + * */ + public function getAllSemesterSubjectsmodel($branchId) + { + $this->db->select('T_SemSubMap_Master.UniversityID,T_UniversityMaster.UniversityName,T_CourseMaster.CourseID,T_CourseMaster.CourseCode,T_CourseMaster.CourseName,T_Course_Fees_Details.ProgramType,T_Course_Fees_Details.FeesType,T_Course_Fees_Details.Sem_Year'); + $this->db->from('T_SemSubMap_Master'); + $this->db->join('T_UniversityMaster','T_SemSubMap_Master.UniversityID=T_UniversityMaster.UniversityID and T_SemSubMap_Master.BranchCode=T_UniversityMaster.BranchCode') ; + $this->db->join('T_CourseMaster','T_SemSubMap_Master.CourseID=T_CourseMaster.CourseID and T_SemSubMap_Master.BranchCode=T_CourseMaster.BranchCode'); + $this->db->join('T_Course_Fees_Details','T_SemSubMap_Master.CourseID=T_Course_Fees_Details.CourseID and T_CourseMaster.CourseID=T_Course_Fees_Details.CourseID'); + $this->db->group_by('T_SemSubMap_Master.UniversityID,T_SemSubMap_Master.CourseID'); + $res = $this->db->get(); + return $res->result(); + + + } + + public function getIndividualCourseSemMappingDetailsmodel($universityID,$courseID,$branchId) + { + //FOR GET MAPPED SUBJECTS FOR $universityID,$courseID,$branchId + $this->db->select('T_SemSubMap_Master.UniversityID,T_SemSubMap_Master.SemesterID,T_UniversityMaster.UniversityName,T_CourseMaster.CourseID,T_CourseMaster.CourseCode,T_CourseMaster.CourseName,T_SubjectMaster.SubjectID,T_SubjectMaster.SubjectCode,T_SubjectMaster.SubjectName'); + $this->db->from('T_SemSubMap_Master'); + $this->db->join('T_UniversityMaster','T_SemSubMap_Master.UniversityID=T_UniversityMaster.UniversityID and T_SemSubMap_Master.BranchCode=T_UniversityMaster.BranchCode','left') ; + $this->db->join('T_CourseMaster','T_SemSubMap_Master.CourseID=T_CourseMaster.CourseID and T_SemSubMap_Master.BranchCode=T_CourseMaster.BranchCode','left'); + $this->db->join('T_SemSubMap_Child','T_SemSubMap_Master.MapID=T_SemSubMap_Child.MapID and T_SemSubMap_Child.isActive = 1','left'); + $this->db->join('T_SubjectMaster','T_SemSubMap_Child.SubjectID=T_SubjectMaster.SubjectID','left'); + $this->db->where('T_SemSubMap_Master.UniversityID',$universityID); + $this->db->where('T_SemSubMap_Master.CourseID',$courseID); + $this->db->where('T_SemSubMap_Master.BranchCode',$branchId); + + //$this->db->group_by('T_SemSubMap_Master.UniversityID,T_SemSubMap_Master.CourseID'); + $res1 = $this->db->get(); + $res['mappedSubjects'] = $res1->result(); + + //FOR GET OVERALL SUBJECTS FOR $universityID,$courseID,$branchId + $this->db->distinct(); + $this->db->select('T_SubjectMaster.SubjectID,T_SubjectMaster.SubjectCode,T_SubjectMaster.SubjectName'); + $this->db->from('T_SubjectMaster'); + $this->db->where('T_SubjectMaster.IsActive','1'); + $this->db->where('T_SubjectMaster.BranchCode',$branchId); + $result = $this->db->get(); + $res['overAllSubjects'] = $result->result(); + + return $res; + } + + + /* + * update All Semester Subject Mapping Info + * @params university id,CourseID,requestedBy,branchId,semArray + * created by velz + * */ + public function updateAllSemesterSubjectMappingmodel($UID,$courseIDS,$requestedBy,$branchId,$semArray) + { + + //echo $courseIDS;die(); + $sem1 = 0;$sem2=0;$sem3=0;$sem4=0;$sem5=0;$sem6=0;$sem7=0;$sem8 = 0; + foreach($semArray as $key => $s) + { + if($key == 0) + { + $sem1 = $s; + } + if($key == 1) + { + $sem2 = $s; + }if($key == 2) + { + $sem3 = $s; + }if($key == 3) + { + $sem4 = $s; + }if($key == 4) + { + $sem5 = $s; + }if($key == 5) + { + $sem6 = $s; + } + if($key == 6) + { + $sem7 = $s; + } + if($key == 7) + { + $sem8 = $s; + } + } + //Check If Exist or Not for UniversityID and CourseID's + // echo 'FROM MODEL-'.$UID.'-'.$courseIDS.'-'.$branchId.'-'.$requestedBy; + // print_r(array($sem1,$sem2,$sem3,$sem4,$sem5,$sem6,$sem7,$sem8)); + // die(); + + + + + for($i=1;$i<=8;$i++) + { + $this->db->trans_start(); + $this->db->select('MapID'); + $this->db->from('T_SemSubMap_Master'); + $this->db->where('BranchCode',$branchId); + $this->db->where('UniversityID',$UID); + $this->db->where('CourseID',$courseIDS); + $this->db->where('SemesterID',$i); + $isExist = $this->db->get(); + $this->db->trans_complete(); + $isExist = $isExist->result(); + if(!empty($isExist[0]->MapID)) + { + + $MapID = $isExist[0]->MapID; + + $this->db->trans_start(); + $this->db->set('UpdatedBy',$requestedBy); + $this->db->where('MapID',$MapID); + $this->db->update('T_SemSubMap_Master'); + $this->db->trans_complete(); + + + $this->db->trans_start(); + $this->db->set('isActive',0); + $this->db->where('MapID',$MapID); + $this->db->update('T_SemSubMap_Child'); + $this->db->trans_complete(); + + if($i == 1) + { + if(count($sem1) != 0){ + foreach($sem1 as $s) + { + $childArray = array('MapID'=>$MapID,'SubjectID'=>$s['SubjectID']); + $this->db->trans_start(); + $this->db->insert('T_SemSubMap_Child',$childArray); + $this->db->trans_complete(); + } + } + } + + if($i == 2) + { + if(count($sem2) != 0){ + foreach($sem2 as $s) + { + $childArray = array('MapID'=>$MapID,'SubjectID'=>$s['SubjectID']); + $this->db->trans_start(); + $this->db->insert('T_SemSubMap_Child',$childArray); + $this->db->trans_complete(); + } + } + } + + if($i == 3) + { + if(count($sem3) != 0){ + foreach($sem3 as $s) + { + $childArray = array('MapID'=>$MapID,'SubjectID'=>$s['SubjectID']); + $this->db->trans_start(); + $this->db->insert('T_SemSubMap_Child',$childArray); + $this->db->trans_complete(); + } + } + } + + if($i == 4) + { + if(count($sem4) != 0){ + foreach($sem4 as $s) + { + $childArray = array('MapID'=>$MapID,'SubjectID'=>$s['SubjectID']); + $this->db->trans_start(); + $this->db->insert('T_SemSubMap_Child',$childArray); + $this->db->trans_complete(); + } + } + } + + if($i == 5) + { + if(count($sem5) != 0){ + foreach($sem5 as $s) + { + $childArray = array('MapID'=>$MapID,'SubjectID'=>$s['SubjectID']); + $this->db->trans_start(); + $this->db->insert('T_SemSubMap_Child',$childArray); + $this->db->trans_complete(); + } + } + } + + if($i == 6) + { + if(count($sem6) != 0){ + foreach($sem6 as $s) + { + $childArray = array('MapID'=>$MapID,'SubjectID'=>$s['SubjectID']); + $this->db->trans_start(); + $this->db->insert('T_SemSubMap_Child',$childArray); + $this->db->trans_complete(); + } + } + } + + if($i == 7) + { + if(count($sem7) != 0){ + foreach($sem7 as $s) + { + $childArray = array('MapID'=>$MapID,'SubjectID'=>$s['SubjectID']); + $this->db->trans_start(); + $this->db->insert('T_SemSubMap_Child',$childArray); + $this->db->trans_complete(); + } + } + } + + if($i == 8) + { + if(count($sem8) != 0){ + foreach($sem8 as $s) + { + $childArray = array('MapID'=>$MapID,'SubjectID'=>$s['SubjectID']); + $this->db->trans_start(); + $this->db->insert('T_SemSubMap_Child',$childArray); + $this->db->trans_complete(); + } + } + } + + } + + + } + return true; + + } + + + + public function getBatchDetails($UniversityID,$branchId) + { + $this->db->select("BatchID,BatchCode,BatchName,str_to_date( BatchDate,'%d-%m-%Y') as BD"); + $this->db->from('T_BatchMaster'); + $this->db->where('UniversityID',$UniversityID); + $this->db->where('IsActive',1); + $this->db->where('BranchCode',$branchId); + $this->db->order_by("BD","DESC"); + $res = $this->db->get(); + return $res->result(); + + } + + public function getStudentListForHallTicketmodel($UID,$courseID,$batch,$requestedBy,$branchId,$center) + { + + $this->db->distinct(); + $this->db->select('T_StudentDetails.StudentID,T_StudentDetails.MobileNumber,T_StudentDetails.Firstname,T_StudentDetails.Lastname,T_StudentDetails.EmailID,T_StudentDetails.ProfilePicPath,T_Student_CourseDetails.EnrollmentID,T_Hallticket_Master.HallTicket_ID,T_Hallticket_Student_Details.HallTicket_ID as isFlag'); + $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_Student_CourseDetails','T_StudentDetails.StudentID = T_Student_CourseDetails.StudentID and T_Students_Fees_Status.CourseID = T_Student_CourseDetails.CourseID'); + $this->db->join('T_Hallticket_Master','T_Students_Fees_Status.CourseID = T_Hallticket_Master.CourseID and T_Students_Fees_Status.BatchCode = T_Hallticket_Master.BatchCode and T_Students_Fees_Status.BranchCode = T_Hallticket_Master.BranchCode and T_Hallticket_Master.CenterID='.$center['CenterID'],'left'); + $this->db->join('T_Hallticket_Student_Details','T_Hallticket_Master.HallTicket_ID = T_Hallticket_Student_Details.HallTicket_ID and T_Students_Fees_Status.StudentID = T_Hallticket_Student_Details.StudentID','left'); + $this->db->where('T_Students_Fees_Status.BatchCode',$batch); + $this->db->where('T_Students_Fees_Status.BranchCode',$branchId); + $this->db->where('T_Students_Fees_Status.CourseID',$courseID); + + $res = $this->db->get(); + $data = $res->result(); + + $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['HallTicketMasterID'] = $r->HallTicket_ID; + $studetdetails['isFlag'] = $r->isFlag; + $studetdetails['FeeDetails'] = $this->getFeeSemesterDetails($r->StudentID,$batch,$branchId,$courseID); + $result_array[] = $studetdetails; + $prestu = $r->StudentID; + } + } + + } + return $result_array; + + } + + function getFeeSemesterDetails($stuid,$bcode,$branchId,$courseID) + { + $this->db->select("T_Course_Fees_Details.ID as FeesID,if(substr(substr(T_Course_Fees_Details.sem_Year,-4),1,3) = 'sem',substr(sem_Year,-1),if(substr(substr(T_Course_Fees_Details.sem_Year,-5),1,4) = 'year',substr(T_Course_Fees_Details.sem_Year,-1),false)) as SemID,if(substr(substr(T_Course_Fees_Details.sem_Year,-4),1,3) = 'sem','SEM',if(substr(substr(T_Course_Fees_Details.sem_Year,-5),1,4) = 'year','YEAR',false)) as SubType,T_Course_Fees_Details.Sem_Year,if(T_Course_Fees_Details.ProgramType = 'Y001','SEM',if(ProgramType = 'P001','REG',if(ProgramType = 'P002','LAT','FALSE'))) as Type"); + $this->db->from('T_Students_Fees_Status'); + //$this->db->join('T_StudentDetails','T_Students_Fees_Status.StudentID=T_StudentDetails.StudentID'); + $this->db->join('T_Course_Fees_Details','T_Students_Fees_Status.FeesType=T_Course_Fees_Details.ID'); + $this->db->where('T_Students_Fees_Status.BatchCode',$bcode); + $this->db->where('T_Students_Fees_Status.BranchCode',$branchId); + $this->db->where('T_Students_Fees_Status.CourseID',$courseID); + $this->db->where('T_Students_Fees_Status.StudentID',$stuid); + $res = $this->db->get(); + return $res->result(); + } + + public function getUniversityDetials($UID,$branchId) + { + $this->db->select('UniversityID,UniversityName,MobileNumber,EmailID,Address,ProfilePicPath'); + $this->db->from('T_UniversityMaster'); + $this->db->where('T_UniversityMaster.BranchCode',$branchId); + $this->db->where('T_UniversityMaster.IsActive',1); + $this->db->where('T_UniversityMaster.UniversityID',$UID['universityID']); + $res = $this->db->get(); + return $res->result(); + + } + + //Student Details with All Corresponding Semesters and Subjects + public function getStudentDetails($UID,$courseID,$branchId,$studentIDs,$centerName,$batch,$requestedBy) + { + + foreach($studentIDs as $key1 => $id) + { + foreach($id['FeeDetails'] as $key2 => $ind) + { + // Get Normel Semester + if(strcasecmp($ind['Type'],'sem') == 0 && strcasecmp($ind['SubType'],'sem') == 0 ) + { + + $sql = "SELECT T_SemSubMap_Child.SubjectID,T_SubjectMaster.SubjectCode,T_SubjectMaster.SubjectName,T_SemSubMap_Master.SemesterID,T_Batch_Schedule_Child.ScheduleDate,T_Batch_Schedule_Child.FromTime,T_Batch_Schedule_Child.ToTime FROM T_SemSubMap_Child + JOIN T_SubjectMaster on T_SemSubMap_Child.SubjectID = T_SubjectMaster.SubjectID + JOIN T_SemSubMap_Master on T_SemSubMap_Child.MapID = T_SemSubMap_Master.MapID and T_SemSubMap_Master.UniversityID = ? and T_SemSubMap_Master.CourseID = ? and T_SemSubMap_Master.SemesterID = ? and T_SemSubMap_Master.BranchCode = ? and T_SemSubMap_Child.IsActive = 1 + JOIN T_Batch_Schedule_Master on T_Batch_Schedule_Master.UniversityID = ? and T_Batch_Schedule_Master.CourseID = ? and T_Batch_Schedule_Master.BranchCode = ? + JOIN T_Batch_Schedule_Child on T_Batch_Schedule_Master.SchId = T_Batch_Schedule_Child.SchId and T_SemSubMap_Child.SubjectID = T_Batch_Schedule_Child.SubjectID and T_Batch_Schedule_Child.IsActive = 1 + order by T_Batch_Schedule_Child.ScheduleDate"; + $res = $this->db->query($sql,array($UID['universityID'],$courseID,$ind['SemID'],$branchId,$UID['universityID'],$courseID,$branchId)); + //$id['FeeDetails'][$key2] = $res->result(); + $in = $res->result(); + //array_push($id['FeeDetails'][$key2],$ind); + array_splice($id['FeeDetails'][$key2],0,6,$in); + $studentIDs['NUMTYPE'] = 'SEM'; + //return $ind; + } + else if(strcasecmp($ind['Type'],'sem') == 0 && strcasecmp($ind['SubType'],'year') == 0) + { + //GET Year Based Semester + + if($ind['SemID'] == 1)//First Year + { + //$i = 1; + for($i = 1;$i <= 1; $i++) + { + $sql = "SELECT T_SemSubMap_Child.SubjectID,T_SubjectMaster.SubjectCode,T_SubjectMaster.SubjectName,T_SemSubMap_Master.SemesterID,T_Batch_Schedule_Child.ScheduleDate,T_Batch_Schedule_Child.FromTime,T_Batch_Schedule_Child.ToTime FROM T_SemSubMap_Child + JOIN T_SubjectMaster on T_SemSubMap_Child.SubjectID = T_SubjectMaster.SubjectID + JOIN T_SemSubMap_Master on T_SemSubMap_Child.MapID = T_SemSubMap_Master.MapID and T_SemSubMap_Master.UniversityID = ? and T_SemSubMap_Master.CourseID = ? and T_SemSubMap_Master.SemesterID = ? and T_SemSubMap_Master.BranchCode = ? and T_SemSubMap_Child.IsActive = 1 + JOIN T_Batch_Schedule_Master on T_Batch_Schedule_Master.UniversityID = ? and T_Batch_Schedule_Master.CourseID = ? and T_Batch_Schedule_Master.BranchCode = ? + JOIN T_Batch_Schedule_Child on T_Batch_Schedule_Master.SchId = T_Batch_Schedule_Child.SchId and T_SemSubMap_Child.SubjectID = T_Batch_Schedule_Child.SubjectID and T_Batch_Schedule_Child.IsActive = 1 + order by T_Batch_Schedule_Child.ScheduleDate"; + $res = $this->db->query($sql,array($UID['universityID'],$courseID,$i,$branchId,$UID['universityID'],$courseID,$branchId)); + //$id['FeeDetails'][$key2] = $res->result(); + $in1[] = $res->result(); + //array_push($id['FeeDetails'][$key2],$ind); + + + } + array_splice($id['FeeDetails'][$key2],0,6,$in1[0]); + + } + + else if($ind['SemID'] == 2)//Sec Year + { + $j = 3; + // for($j = 3;$j <= 3; $j++) + // { + $sql = "SELECT T_SemSubMap_Child.SubjectID,T_SubjectMaster.SubjectCode,T_SubjectMaster.SubjectName,T_SemSubMap_Master.SemesterID,T_Batch_Schedule_Child.ScheduleDate,T_Batch_Schedule_Child.FromTime,T_Batch_Schedule_Child.ToTime FROM T_SemSubMap_Child + JOIN T_SubjectMaster on T_SemSubMap_Child.SubjectID = T_SubjectMaster.SubjectID + JOIN T_SemSubMap_Master on T_SemSubMap_Child.MapID = T_SemSubMap_Master.MapID and T_SemSubMap_Master.UniversityID = ? and T_SemSubMap_Master.CourseID = ? and T_SemSubMap_Master.SemesterID = ? and T_SemSubMap_Master.BranchCode = ? and T_SemSubMap_Child.IsActive = 1 + JOIN T_Batch_Schedule_Master on T_Batch_Schedule_Master.UniversityID = ? and T_Batch_Schedule_Master.CourseID = ? and T_Batch_Schedule_Master.BranchCode = ? + JOIN T_Batch_Schedule_Child on T_Batch_Schedule_Master.SchId = T_Batch_Schedule_Child.SchId and T_SemSubMap_Child.SubjectID = T_Batch_Schedule_Child.SubjectID and T_Batch_Schedule_Child.IsActive = 1 + order by T_Batch_Schedule_Child.ScheduleDate"; + $res = $this->db->query($sql,array($UID['universityID'],$courseID,$j,$branchId,$UID['universityID'],$courseID,$branchId)); + //$id['FeeDetails'][$key2] = $res->result(); + $in2[] = $res->result(); + //array_push($id['FeeDetails'][$key2],$ind); + + + // } + array_splice($id['FeeDetails'][$key2],0,6,$in2[0]); + } + + + else if($ind['SemID'] == 3) + { + $k = 5; + // for($k = 5;$k <= 5; $k++) + // { + $sql = "SELECT T_SemSubMap_Child.SubjectID,T_SubjectMaster.SubjectCode,T_SubjectMaster.SubjectName,T_SemSubMap_Master.SemesterID,T_Batch_Schedule_Child.ScheduleDate,T_Batch_Schedule_Child.FromTime,T_Batch_Schedule_Child.ToTime FROM T_SemSubMap_Child + JOIN T_SubjectMaster on T_SemSubMap_Child.SubjectID = T_SubjectMaster.SubjectID + JOIN T_SemSubMap_Master on T_SemSubMap_Child.MapID = T_SemSubMap_Master.MapID and T_SemSubMap_Master.UniversityID = ? and T_SemSubMap_Master.CourseID = ? and T_SemSubMap_Master.SemesterID = ? and T_SemSubMap_Master.BranchCode = ? and T_SemSubMap_Child.IsActive = 1 + JOIN T_Batch_Schedule_Master on T_Batch_Schedule_Master.UniversityID = ? and T_Batch_Schedule_Master.CourseID = ? and T_Batch_Schedule_Master.BranchCode = ? + JOIN T_Batch_Schedule_Child on T_Batch_Schedule_Master.SchId = T_Batch_Schedule_Child.SchId and T_SemSubMap_Child.SubjectID = T_Batch_Schedule_Child.SubjectID and T_Batch_Schedule_Child.IsActive = 1 + order by T_Batch_Schedule_Child.ScheduleDate"; + $res = $this->db->query($sql,array($UID['universityID'],$courseID,$k,$branchId,$UID['universityID'],$courseID,$branchId)); + //$id['FeeDetails'][$key2] = $res->result(); + $in3[] = $res->result(); + //array_push($id['FeeDetails'][$key2],$ind); + + + // } + array_splice($id['FeeDetails'][$key2],0,6,$in3[0]); + } + + + else if($ind['SemID'] == 4) + { + $l = 7; + // for($l = 7;$l <= 7; $l++) + // { + $sql = "SELECT T_SemSubMap_Child.SubjectID,T_SubjectMaster.SubjectCode,T_SubjectMaster.SubjectName,T_SemSubMap_Master.SemesterID,T_Batch_Schedule_Child.ScheduleDate,T_Batch_Schedule_Child.FromTime,T_Batch_Schedule_Child.ToTime FROM T_SemSubMap_Child + JOIN T_SubjectMaster on T_SemSubMap_Child.SubjectID = T_SubjectMaster.SubjectID + JOIN T_SemSubMap_Master on T_SemSubMap_Child.MapID = T_SemSubMap_Master.MapID and T_SemSubMap_Master.UniversityID = ? and T_SemSubMap_Master.CourseID = ? and T_SemSubMap_Master.SemesterID = ? and T_SemSubMap_Master.BranchCode = ? and T_SemSubMap_Child.IsActive = 1 + JOIN T_Batch_Schedule_Master on T_Batch_Schedule_Master.UniversityID = ? and T_Batch_Schedule_Master.CourseID = ? and T_Batch_Schedule_Master.BranchCode = ? + JOIN T_Batch_Schedule_Child on T_Batch_Schedule_Master.SchId = T_Batch_Schedule_Child.SchId and T_SemSubMap_Child.SubjectID = T_Batch_Schedule_Child.SubjectID and T_Batch_Schedule_Child.IsActive = 1 + order by T_Batch_Schedule_Child.ScheduleDate"; + $res = $this->db->query($sql,array($UID['universityID'],$courseID,$l,$branchId,$UID['universityID'],$courseID,$branchId)); + //$id['FeeDetails'][$key2] = $res->result(); + $in4[] = $res->result(); + //array_push($id['FeeDetails'][$key2],$ind); + + + // } + array_splice($id['FeeDetails'][$key2],0,6,$in4[0]); + } + + $studentIDs['NUMTYPE'] = 'YEAR'; + } + else if(strcasecmp($ind['Type'],'REG') == 0) + { + //Get Regular(All Semester) + for($m = 1;$m <= 8; $m++) + { + $sql = "SELECT T_SemSubMap_Child.SubjectID,T_SubjectMaster.SubjectCode,T_SubjectMaster.SubjectName,T_SemSubMap_Master.SemesterID,T_Batch_Schedule_Child.ScheduleDate,T_Batch_Schedule_Child.FromTime,T_Batch_Schedule_Child.ToTime FROM T_SemSubMap_Child + JOIN T_SubjectMaster on T_SemSubMap_Child.SubjectID = T_SubjectMaster.SubjectID + JOIN T_SemSubMap_Master on T_SemSubMap_Child.MapID = T_SemSubMap_Master.MapID and T_SemSubMap_Master.UniversityID = ? and T_SemSubMap_Master.CourseID = ? and T_SemSubMap_Master.SemesterID = ? and T_SemSubMap_Master.BranchCode = ? and T_SemSubMap_Child.IsActive = 1 + JOIN T_Batch_Schedule_Master on T_Batch_Schedule_Master.UniversityID = ? and T_Batch_Schedule_Master.CourseID = ? and T_Batch_Schedule_Master.BranchCode = ? + JOIN T_Batch_Schedule_Child on T_Batch_Schedule_Master.SchId = T_Batch_Schedule_Child.SchId and T_SemSubMap_Child.SubjectID = T_Batch_Schedule_Child.SubjectID and T_Batch_Schedule_Child.IsActive = 1 + order by T_Batch_Schedule_Child.ScheduleDate"; + $res = $this->db->query($sql,array($UID['universityID'],$courseID,$m,$branchId,$UID['universityID'],$courseID,$branchId)); + //$id['FeeDetails'][$key2] = $res->result(); + $in[] = $res->result(); + //array_push($id['FeeDetails'][$key2],$ind); + + + } + array_splice($id['FeeDetails'][$key2],0,6,$in); + $studentIDs['NUMTYPE'] = 'REG'; + } + else if(strcasecmp($ind['Type'],'LAT') == 0) + { + //Get Later Entry all semester except 1 and 2 + for($i = 3;$i <= 8; $i++) + { + $sql = "SELECT T_SemSubMap_Child.SubjectID,T_SubjectMaster.SubjectCode,T_SubjectMaster.SubjectName,T_SemSubMap_Master.SemesterID,T_Batch_Schedule_Child.ScheduleDate,T_Batch_Schedule_Child.FromTime,T_Batch_Schedule_Child.ToTime FROM T_SemSubMap_Child + JOIN T_SubjectMaster on T_SemSubMap_Child.SubjectID = T_SubjectMaster.SubjectID + JOIN T_SemSubMap_Master on T_SemSubMap_Child.MapID = T_SemSubMap_Master.MapID and T_SemSubMap_Master.UniversityID = ? and T_SemSubMap_Master.CourseID = ? and T_SemSubMap_Master.SemesterID = ? and T_SemSubMap_Master.BranchCode = ? and T_SemSubMap_Child.IsActive = 1 + JOIN T_Batch_Schedule_Master on T_Batch_Schedule_Master.UniversityID = ? and T_Batch_Schedule_Master.CourseID = ? and T_Batch_Schedule_Master.BranchCode = ? + JOIN T_Batch_Schedule_Child on T_Batch_Schedule_Master.SchId = T_Batch_Schedule_Child.SchId and T_SemSubMap_Child.SubjectID = T_Batch_Schedule_Child.SubjectID and T_Batch_Schedule_Child.IsActive = 1 + order by T_Batch_Schedule_Child.ScheduleDate"; + $res = $this->db->query($sql,array($UID['universityID'],$courseID,$i,$branchId,$UID['universityID'],$courseID,$branchId)); + //$id['FeeDetails'][$key2] = $res->result(); + $in[] = $res->result(); + //array_push($id['FeeDetails'][$key2],$ind); + + + } + array_splice($id['FeeDetails'][$key2],0,6,$in); + $studentIDs['NUMTYPE'] = 'LAT'; + } + + + } + array_splice($studentIDs[$key1]['FeeDetails'],0,10,$id['FeeDetails']) ; + + } + // echo "COE"; + // print_r($studentIDs);die(); + $this->saveHallTicketDataForExamAttendance($UID,$courseID,$branchId,$studentIDs,$centerName,$batch,$requestedBy); + return $studentIDs; + } + + + public function saveHallTicketDataForExamAttendance($UID,$courseID,$branchId,$studentIDs,$centerName,$batch,$requestedBy) + { + + $MASTERID = '00'; + + $this->db->select('HallTicket_ID'); + $this->db->from('T_Hallticket_Master'); + $this->db->where('UniversityID',$UID['universityID']); + $this->db->where('CourseID',$courseID); + $this->db->where('BatchCode',$batch); + $this->db->where('CenterID',$centerName['CenterID']); + $this->db->where('BranchCode',$branchId); + $isExist = $this->db->get(); + $isExist = $isExist->result_array(); + + //print_r($isExist);die(); + if(!empty($isExist[0]['HallTicket_ID'])) + { + $MASTERID = $isExist[0]['HallTicket_ID']; + + $this->db->trans_start(); + $this->db->where('HallTicket_ID',$MASTERID); + $this->db->update('T_Hallticket_Master',array('UpdatedBy'=>$requestedBy)); + $this->db->trans_complete(); + + $this->db->trans_start(); + $this->db->select('HallTicket_Student_ID'); + $this->db->from('T_Hallticket_Student_Details'); + $this->db->where('`HallTicket_ID',$MASTERID); + $existStudentID = $this->db->get(); + $existStudentID = $existStudentID->result_array(); + $this->db->trans_complete(); + $finalExistStudentID = array(); + foreach($existStudentID as $exist) + { + $finalExistStudentID[] = $exist['HallTicket_Student_ID']; + } + + $this->db->trans_start(); + $this->db->where_in('HallTicket_ID',$MASTERID); + $this->db->delete('T_Hallticket_Student_Details'); + $this->db->trans_complete(); + + $this->db->trans_start(); + $this->db->where_in('HallTicket_Student_ID',$finalExistStudentID); + $this->db->delete('T_Hallticket_Subject_Details'); + $this->db->trans_complete(); + } + else + { + $masterArray = array('UniversityID'=>$UID['universityID'],'CourseID'=>$courseID,'BatchCode'=>$batch,'BranchCode'=>$branchId,'CreatedBy'=>$requestedBy,'CenterID'=>$centerName['CenterID']); + $this->db->trans_start(); + $this->db->insert('T_Hallticket_Master',$masterArray); + $MASTERID = $this->db->insert_id(); + $this->db->trans_complete(); + } + //Save University,Course,Batch,BranchCode, and Center ID + + if($studentIDs['NUMTYPE'] == 'SEM') + { + foreach($studentIDs as $student) + { + //print_r($student);echo "
"; + if(!empty($student['FeeDetails'])) + { + foreach($student['FeeDetails'] as $key => $fees) + { + //print_r($fees); + $tempArray = array('Hallticket_ID'=>$MASTERID,'StudentID'=>$student['StudentID'],'EnrollmentID'=>$student['EnrollmentID'],'Sem_Year'=>('SEM'.($key + 1))); + + $this->db->trans_start(); + $this->db->insert('T_Hallticket_Student_Details',$tempArray); + $HallTicketStudentID = $this->db->insert_id(); + $this->db->trans_complete(); + + foreach($fees as $subject) + { + //echo $subject->SubjectCode;echo "
"; + $tempSubjectArray = array('HallTicket_Student_ID'=>$HallTicketStudentID,'SubjectCode'=>$subject->SubjectID,'ExamDate'=>$subject->ScheduleDate,'FromTime'=>$subject->FromTime,'EndTime'=>$subject->ToTime); + + $this->db->trans_start(); + $this->db->insert('T_Hallticket_Subject_Details',$tempSubjectArray); + $this->db->trans_complete(); + + } + + + } + } + } + } + else if($studentIDs['NUMTYPE'] == 'YEAR') + { + foreach($studentIDs as $student) + { + + if(!empty($student['FeeDetails'])) + { + + foreach($student['FeeDetails'][0] as $key => $fees) + { + + if(!empty($fees)) + { + $tempArray = array('Hallticket_ID'=>$MASTERID,'StudentID'=>$student['StudentID'],'EnrollmentID'=>$student['EnrollmentID'],'Sem_Year'=>('YEAR'.($key + 1))); + + $this->db->trans_start(); + $this->db->insert('T_Hallticket_Student_Details',$tempArray); + $HallTicketStudentID = $this->db->insert_id(); + $this->db->trans_complete(); + + $tempSubjectArray = array('HallTicket_Student_ID'=>$HallTicketStudentID,'SubjectCode'=>$fees->SubjectID,'ExamDate'=>$fees->ScheduleDate,'FromTime'=>$fees->FromTime,'EndTime'=>$fees->ToTime); + + $this->db->trans_start(); + $this->db->insert('T_Hallticket_Subject_Details',$tempSubjectArray); + $this->db->trans_complete(); + + + } + } + } + } + + } + else if($studentIDs['NUMTYPE'] == 'LAT') + { + foreach($studentIDs as $student) + { + if(!empty($student['FeeDetails'])) + { + foreach($student['FeeDetails'][0] as $key => $fees) + { + + if(!empty($fees)) + { + $tempArray = array('Hallticket_ID'=>$MASTERID,'StudentID'=>$student['StudentID'],'EnrollmentID'=>$student['EnrollmentID'],'Sem_Year'=>('SEM'.($key + 2))); + + $this->db->trans_start(); + $this->db->insert('T_Hallticket_Student_Details',$tempArray); + $HallTicketStudentID = $this->db->insert_id(); + $this->db->trans_complete(); + + foreach($fees as $subject) + { + + $tempSubjectArray = array('HallTicket_Student_ID'=>$HallTicketStudentID,'SubjectCode'=>$subject->SubjectID,'ExamDate'=>$subject->ScheduleDate,'FromTime'=>$subject->FromTime,'EndTime'=>$subject->ToTime); + + $this->db->trans_start(); + $this->db->insert('T_Hallticket_Subject_Details',$tempSubjectArray); + $this->db->trans_complete(); + + } + } + } + } + } + } + else if($studentIDs['NUMTYPE'] == 'REG') + { + foreach($studentIDs as $student) + { + if(!empty($student['FeeDetails'])) + { + foreach($student['FeeDetails'][0] as $key => $fees) + { + + if(!empty($fees)) + { + $tempArray = array('Hallticket_ID'=>$MASTERID,'StudentID'=>$student['StudentID'],'EnrollmentID'=>$student['EnrollmentID'],'Sem_Year'=>('SEM'.($key + 1))); + + $this->db->trans_start(); + $this->db->insert('T_Hallticket_Student_Details',$tempArray); + $HallTicketStudentID = $this->db->insert_id(); + $this->db->trans_complete(); + + foreach($fees as $subject) + { + + $tempSubjectArray = array('HallTicket_Student_ID'=>$HallTicketStudentID,'SubjectCode'=>$subject->SubjectID,'ExamDate'=>$subject->ScheduleDate,'FromTime'=>$subject->FromTime,'EndTime'=>$subject->ToTime); + + $this->db->trans_start(); + $this->db->insert('T_Hallticket_Subject_Details',$tempSubjectArray); + $this->db->trans_complete(); + + } + } + } + } + } + } + + + } + + public function getBatchAndCenterDetailsModel($branchID) + { + $this->db->distinct(); + $this->db->select("BatchCode,BatchDate,BatchName,str_to_date(BatchDate,'%d-%m-%Y') as BD"); + $this->db->from('T_BatchMaster'); + $this->db->where('BranchCode',$branchID); + $this->db->where('IsActive',1); + $this->db->order_by('BD','DESC'); + $result = $this->db->get(); + $data['batchDetails'] = $result->result(); + + $this->db->select('CenterID,CenterCode,CenterName,CenterAddress'); + $this->db->from('T_CenterMaster'); + $this->db->where('BranchCode',$branchID); + $this->db->where('IsActive',1); + $result2 = $this->db->get(); + $data['centerDetails'] = $result2->result(); + + return $data; + + } + public function getExamAttendance_model($UID,$branchId,$centerName,$examDate,$batch) + { + + //echo $UID;die(); + $sql = "SELECT DISTINCT T_Hallticket_Master.UniversityID,T_UniversityMaster.UniversityName,T_Hallticket_Master.CourseID,T_CourseMaster.CourseName,T_CourseMaster.CourseCode,T_Hallticket_Master.BatchCode,T_BatchMaster.BatchName,T_Hallticket_Master.BranchCode,T_Hallticket_Master.CenterID,T_CenterMaster.CenterName,T_Hallticket_Student_Details.StudentID,T_StudentDetails.Firstname,T_StudentDetails.Lastname,T_Hallticket_Student_Details.EnrollmentID,T_Hallticket_Student_Details.Sem_Year,T_Hallticket_Subject_Details.SubjectCode,T_SubjectMaster.SubjectName,T_SubjectMaster.SubjectCode,T_Hallticket_Subject_Details.ExamDate,T_Hallticket_Subject_Details.FromTime,T_Hallticket_Subject_Details.EndTime FROM T_Hallticket_Master + + JOIN T_Hallticket_Student_Details ON T_Hallticket_Master.HallTicket_ID = T_Hallticket_Student_Details.HallTicket_ID + + JOIN T_Hallticket_Subject_Details ON T_Hallticket_Student_Details.HallTicket_Student_ID = T_Hallticket_Subject_Details.HallTicket_Student_ID + + JOIN T_UniversityMaster ON T_Hallticket_Master.UniversityID = T_UniversityMaster.UniversityID AND T_UniversityMaster.BranchCode = T_Hallticket_Master.BranchCode + + JOIN T_CourseMaster ON T_Hallticket_Master.CourseID = T_CourseMaster.CourseID + + JOIN T_BatchMaster ON T_Hallticket_Master.BatchCode = T_BatchMaster.BatchCode AND T_BatchMaster.BranchCode = T_Hallticket_Master.BranchCode + + JOIN T_CenterMaster ON T_Hallticket_Master.CenterID = T_CenterMaster.CenterID AND T_CenterMaster.BranchCode = T_Hallticket_Master.BranchCode + + JOIN T_SubjectMaster ON T_Hallticket_Subject_Details.SubjectCode = T_SubjectMaster.SubjectID AND T_SubjectMaster.BranchCode = T_Hallticket_Master.BranchCode + + JOIN T_StudentDetails ON T_Hallticket_Student_Details.StudentID = T_StudentDetails.StudentID AND T_StudentDetails.BranchCode = T_Hallticket_Master.BranchCode + + WHERE T_Hallticket_Master.UniversityID = ? AND T_Hallticket_Master.BatchCode = ? AND T_Hallticket_Master.BranchCode = ? AND T_Hallticket_Master.CenterID = ? AND STR_TO_DATE(T_Hallticket_Subject_Details.ExamDate,'%Y-%m-%d') = STR_TO_DATE(?,'%Y-%m-%d')"; + + $res = $this->db->query($sql,array($UID,$batch,$branchId,$centerName['CenterID'],$examDate)); + $result = $res->result(); + //print_r($this->db->last_query()); + //echo "MODEL";print_r($result);die(); + return $result; + + } + public function AddBatchScheduleMasterFile($schedulemaster,$filedetails) + { + + $this->db->trans_start(); + $this->db->insert('T_Batch_Schedule_Master', $schedulemaster); + $insert_id = $this->db->affected_rows(); + $this->db->trans_complete(); + // print_r($this->db->last_query()); + if($insert_id>0) + { + $subQuery = 'select max(SchId) as SchId from T_Batch_Schedule_Master'; + + $query = $this->db->query($subQuery); + $result = $query->result_array(); + $schid= $result[0]['SchId']; + + // if(($schid != '')||($schid !=0)) + + if(count($result)>0) + { + + foreach($filedetails as $det) + { + + $sudate = $det['schduleDate']; + $SubDate = date("Y-m-d", strtotime($sudate)); + // $SubDate=$sudate->format('Y-m-d H:i:s'); + $stime = $det['FromTime']; + $etime = $det['ToTime']; + $isactive=1; + $subcode = $det['SubjectID']; + $Cdate = new DateTime('now',new DateTimeZone('Asia/Kolkata')); + $CreatedOn = $Cdate->format('Y-m-d H:i:s'); + $this->db->select('SubjectCode,SubjectID,SubjectName'); + $this->db->from('T_SubjectMaster'); + $this->db->where('T_SubjectMaster.BranchCode', $schedulemaster['BranchCode']); + $this->db->where('T_SubjectMaster.SubjectCode', $det['SubjectID']); + $subDetails = $this->db->get()->result(); + $SubjectID=$subDetails[0]->SubjectID; + $schedulchild = array('SchId'=>$schid,'SubjectID'=>$SubjectID,'SchChildId'=>'','ScheduleDate'=>$SubDate,'FromTime'=>$stime,'ToTime'=>$etime,'IsActive'=>$isactive); + $this->db->trans_start(); + $this->db->insert('T_Batch_Schedule_Child',$schedulchild); + $this->db->trans_complete(); + + + + + } + + } + + //echo $schid; + // $schid=$query[0]['SchId']; + + // echo $schid; + + + } + return true; + + // return $query->result_array(); + + + } + + public function AddBatchScheduleMaster($schedulemaster,$detailArray) + { + + $this->db->trans_start(); + $this->db->insert('T_Batch_Schedule_Master', $schedulemaster); + $insert_id = $this->db->affected_rows(); + $this->db->trans_complete(); + // print_r($this->db->last_query()); + if($insert_id>0) + { + $subQuery = 'select max(SchId) as SchId from T_Batch_Schedule_Master'; + + $query = $this->db->query($subQuery); + + + $result = $query->result_array(); + $schid= $result[0]['SchId']; + + // if(($schid != '')||($schid !=0)) + + if(count($result)>0) + { + + foreach($detailArray as $det) + { + + $sudate = $det['scheduleDate']; + $SubDate = date("Y-m-d", strtotime($sudate)); + // $SubDate=$sudate->format('Y-m-d H:i:s'); + $stime = $det['scheduleStart']; + $etime = $det['scheduleEnd']; + $isactive=1; + $subId = $det['subjectID']; + $Cdate = new DateTime('now',new DateTimeZone('Asia/Kolkata')); + $CreatedOn = $Cdate->format('Y-m-d H:i:s'); + + $schedulchild = array('SchId'=>$schid,'SubjectID'=>$subId,'SchChildId'=>'','ScheduleDate'=>$SubDate,'FromTime'=>$stime,'ToTime'=>$etime,'IsActive'=>$isactive); + $this->db->trans_start(); + $this->db->insert('T_Batch_Schedule_Child',$schedulchild); + $this->db->trans_complete(); + + + + + // print_r($schedulchild); + //die(); + + //$schedulchildadd = $this->Hallticket_model->AddScheduleChild($schedulchild); + } + + } + + //echo $schid; + // $schid=$query[0]['SchId']; + + // echo $schid; + + + } + return true; + + // return $query->result_array(); + + + } + public function scheduleUpdate($schedulearray,$up,$scheduleID) + { + //print_r($schedulearray);die(); + $MasterID = ""; + foreach($schedulearray as $shed) + { + $ChildID = $shed['schChildId']; + //echo $ChildID; + $sudate = $shed['scheduleDate']; + $SubDate = date("Y-m-d", strtotime($sudate)); + $MasterID = $shed['SchId']; + + $SubjectID = $shed['SubjectID']; + $scheduleStart = $shed['scheduleStart']; + $scheduleEnd = $shed['scheduleEnd']; + $isactive=1; + if($ChildID != '') + { + + $schedulchildUpdate = array('ScheduleDate'=>$SubDate,'FromTime'=>$scheduleStart,'ToTime'=>$scheduleEnd); + + $this->db->trans_start(); + $this->db->where('T_Batch_Schedule_Child.SchChildId',$ChildID); + $this->db->where('T_Batch_Schedule_Child.SubjectID',$SubjectID); + $this->db->where('T_Batch_Schedule_Child.SchId',$MasterID); + $this->db->update('T_Batch_Schedule_Child',$schedulchildUpdate); + $this->db->trans_complete(); + + } + else + { + + $schedulchildInsert = array('SchId'=>$scheduleID,'SubjectID'=>$SubjectID,'ScheduleDate'=>$SubDate,'FromTime'=>$scheduleStart,'ToTime'=>$scheduleEnd,'IsActive'=>$isactive); + $this->db->trans_start(); + $this->db->insert('T_Batch_Schedule_Child',$schedulchildInsert); + $this->db->trans_complete(); + + } + } + + $schedulMaster = array('UpdatedBy'=>$up); + + $this->db->trans_start(); + $this->db->update('T_Batch_Schedule_Master',$schedulMaster); + $this->db->where('T_Batch_Schedule_Master.SchId',$MasterID); + $this->db->trans_complete(); + + return $up; + + } + + + // public function AddScheduleChild($schedulchild) + // { + // $this->db->trans_start(); + // $this->db->insert('T_Batch_Schedule_Child',$schedulchild); + // $this->db->trans_complete(); + // return true; + + // } + + + + public function GetSubListDetails($sub) + { + $this->db->select('SubjectCode,SubjectID,SubjectName'); + $this->db->from('T_SubjectMaster'); + $this->db->where('T_SubjectMaster.BranchCode',$sub['branchId']); + $this->db->where('T_SubjectMaster.SubjectCode',$sub['SubjectCode']); + $subDetails = $this->db->get()->result(); + + + // print_r($subDetails); + // die(); + + if($subDetails) + { + $result_array['searchst'] = true; + $result_array['details'] = $subDetails; + } + + else + { + $result_array['searchst'] = false; + $result_array['details'] = "No records found!"; + } + return $result_array; + } + } \ No newline at end of file diff --git a/Apollo/assets/js/controllers/schCtrl.js b/Apollo/assets/js/controllers/schCtrl.js old mode 100755 new mode 100644 index e84cd727..8f5bd0a3 --- a/Apollo/assets/js/controllers/schCtrl.js +++ b/Apollo/assets/js/controllers/schCtrl.js @@ -1,728 +1,730 @@ -'use strict'; -/** - * controllers for ng-table - * Simple table with sorting and filtering on AngularJS - */ -app.controller('schCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableParams", "API_POINTS", "$localStorage", "$http", "$state", function ($scope,$rootScope,toaster, $filter, ngTableParams, apiPoint, $localStorage, $http, $state) { - - $scope.myModel = { - "studentName": "", - "mobileNumber": "", - "universityName":"", - "semsterName":"" - }; - - $scope.myModelAdd = { - "date": "", - "periodStart": "", - "periodEnd":"", - - }; - $scope.details = []; - $scope.viewPage = { - "CourseDetails":[] - }; - - $scope.editId = -1; - $scope.editModel = { - "editSubject": "", - "editScheduleDate": "", - "editFromTime":"", - "editToTime":"", - - }; - $scope.semDropDownShowLoading1 = false; - $scope.semDetailsLoadingStatus1 = false; - $scope.semDetailsLoadingTxt1 = ""; - $scope.setEditId = function (pid,cid,schid,subid,c) { - var branchid=JSON.parse(localStorage.getItem('localObj')).localBranchID; - $scope.semDetailsLoadingStatus1 = true; - $scope.semDetailsLoadingTxt1 = "Loading..."; - //alert(branchid); - //alert(pid); - $scope.editModel.editSubject = c.SubjectName; - $scope.editModel.editScheduleDate = c.ScheduleDate; - $scope.editModel.editFromTime = c.FromTime; - $scope.editModel.editToTime = c.ToTime; - //$scope.localUniversityDetails=""; - //$scope.localUniversityDetails = JSON.parse(localStorage.getItem('localUniversityDetails')); - - - $scope.editId = pid; - $scope.courseCode = cid; - $scope.mappingid = schid; - //alert(mappingid+'n'); - var getsheduledetails = { - method: 'POST', - url: apiPoint.url + 'getSheduleDetails/', - headers: { - 'Content-Type': 'application/json' - }, - data: { - //requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, - mapid:$scope.mappingid, - subid:subid, - branchcode:branchid, - - - } - }; - $http(getsheduledetails).then(function (response) { - if (response.data.status==200) - { - - $scope.unsheduledetails=response.data.getunSheduleDetailsinfo.scheduleDetails; - - - - } else { - $scope.unsheduledetails=""; - - } - }); - - - - }; - // $scope.details = []; - $scope.cancel = function () { - $scope.init(); - $scope.editId = -1; - - }; - $scope.semDropDownShow = false; - $scope.semDropDownShowLoading = false; - $scope.saveButtonDisabled = false; - $scope.saveButtonTxt = "SAVE"; - $rootScope.userType = JSON.parse(localStorage.getItem('localObj')).localType; - $scope.semDetailsLoadingStatus = false; - $scope.semDetailsLoadingTxt = ""; - - - $scope.selectedCourseName = []; - $scope.selectedUniversityCourseName = ''; - $scope.selectedSemSubjetcsSem1 = []; - $scope.selectedSemSubjetcsSem2 = []; - $scope.selectedSemSubjetcsSem3 = []; - $scope.selectedSemSubjetcsSem4 = []; - $scope.selectedSemSubjetcsSem5 = []; - $scope.selectedSemSubjetcsSem6 = []; - $scope.selectedSemSubjetcsSem7 = []; - $scope.selectedSemSubjetcsSem8 = []; - $scope.overallSelectedSubjetcs = []; - - // sorting function for table params - $scope.sort = function(keyname){ - $scope.sortKey = keyname; //set the sortKey to the param passed - $scope.reverse = !$scope.reverse; //if true make it false and vice versa - } - - - - - //Assign Courses to Course array for Multiple select - $scope.getuniversity = function(){ - $scope.selectedUniversityCourseName = $scope.myModel.universityName.courseDetails; - if($scope.selectedUniversityCourseName.length == 0){ swal('No Courses Available','','info'); } - $scope.selectedCourseNameC = { - list: $scope.selectedCourseName, - } - - } - - - /* - * get course semester,subjects details - * created by TamilBala - * */ - - var course=''; - $scope.getSemSubDetails = function(UID,COURSES){ - course=COURSES; - //alert(course) - var firstError = null; - if (form.$invalid) { - - var field = null, firstError = null; - for (field in form) { - if (field[0] != '$') { - if (firstError === null && !form[field].$valid) { - firstError = form[field].$name; - } - if (form[field].$pristine) { - form[field].$dirty = true; - } - } - } - angular.element('.ng-invalid[name=' + firstError + ']').focus(); - - } - else - { - - - if(UID == undefined || UID == '') - { - swal("Select University"); - return false; - } - if(COURSES.list == '') - { - swal("Select Course"); - return false; - } - $scope.editId=1; - $scope.semDropDownShowLoading = false; - $scope.semDropDownShow = false; - $scope.semDropDownShowLoading = true; - var getsubject = { - method: 'POST', - url: apiPoint.url + 'getExistingMapping/', - headers: { - 'Content-Type': 'application/json' - }, - data: { - universityID : UID, - courseID : COURSES, - requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, - branchId:JSON.parse(localStorage.getItem('localObj')).localBranchID - } - }; - $http(getsubject).then(function (response) { - console.log(response); - if(response.data.status == 200) - { - $scope.semDropDownShowLoading = false; - $scope.semDropDownShow = true; - $scope.subjects = [];// For Main Dropdown - $scope.subjectsFromDBtoComapare = []; - //$scope.semesters = response.data.semesterDetails; - $scope.subjectsFromDB = response.data.subjectDetails; //Store Response Data to subjectsFromDB - - angular.forEach($scope.subjectsFromDB,function(value,key){ - $scope.subjects.push({ - "Subject":value, - "ScheduleDate":"", - "ScheduleStartTime":"", - "ScheduleEndTime":"" - - });// For Main Dropdown - }); - - - - - } - - - - - - },function(error){ - $scope.semDropDownShowLoading = false; - swal(error.data.message,'','error'); - $state.go($state.current, {}, {reload: true}); - - } ); - - - - } - } - $scope.remove = function () { - $scope.init(); - $scope.semDropDownShow = false; - - - }; - /* - * Remove Subjects from Master Subjects Arry - * after selecting subjects for each semester - * created by TamilBala - * */ - $scope.removeSelectedSubjetcs = function(newsublist){ - - //Every time copy all subjetcs from subjectsFromDB to ompare - angular.forEach($scope.subjectsFromDB,function(value,key){ - $scope.subjectsFromDBtoComapare.push(value); - }); - - //For Compare Single Semesters Array and Master Subjetcs Array and remove selected subjects from Master Subjetcs Array - angular.forEach(newsublist,function(value,key){ - angular.forEach($scope.subjects,function(value2,key2){ - - if(value.SubjectID == value2.SubjectID) - { - $scope.subjects.splice(key2,1); - } - - }); - }); - - //For Concat all subjetcs from all semsters. - $scope.overallSelectedSubjetcs=[].concat($scope.selectedSubjetcsSem1C.list,$scope.selectedSubjetcsSem2C.list,$scope.selectedSubjetcsSem3C.list,$scope.selectedSubjetcsSem4C.list,$scope.selectedSubjetcsSem5C.list,$scope.selectedSubjetcsSem6C.list,$scope.selectedSubjetcsSem7C.list,$scope.selectedSubjetcsSem8C.list); - - - //For Compare Over all selected subjects And Master Subjetcs to avoid duplicate. - angular.forEach($scope.overallSelectedSubjetcs,function(value,key){ - - angular.forEach($scope.subjectsFromDBtoComapare,function(value2,key2){ - if(value.SubjectID != value2.SubjectID) - { - - if ($scope.overallSelectedSubjetcs.indexOf(value2) == -1 && $scope.subjects.indexOf(value2) == -1) - { - $scope.subjects.push(value2); - $scope.subjectsFromDBtoComapare.splice(key2,1); - } - - } - - }); - - }); - - $scope.subjectsFromDBtoComapare = []; - - } - - - - var date= ''; - var stime= ''; - var etime=''; - var subjectname= ''; - var subjectcode = ''; - var c=''; - var subid=''; - var subjectId= ''; - $scope.details = []; - - $scope.add= function(index,myModelAdd,p) - { - - var subname = p.SubjectName; - var item=[]; - c = $scope.details.length + 1; - var formate = "dd-MM-yyyy"; - date = $filter('date')(new Date(myModelAdd.date), formate); - stime = myModelAdd.periodStart; - etime = myModelAdd.periodEnd; - subjectname = p.SubjectName; - subjectcode = p.SubjectCode; - subid = p.SubjectID; - - - - item.push({ - - date : date, - stime : stime, - etime : etime, - subjectname : subjectname, - subjectcode : subjectcode, - subjectId : subid - - - }); - - $scope.details.splice(0,0,item); - - - } - /* upload file for batch schedule - * created by bala - * */ - $scope.extractFileDetails=""; - $scope.readUploadBatchDetails = function (workbook) { - /* DO SOMETHING WITH workbook HERE */ - for (var sheetName in workbook.Sheets) { - var jsonData = XLSX.utils.sheet_to_json(workbook.Sheets[sheetName]); - if(jsonData.length!=0){ - $scope.extractFileDetails=jsonData; - } - - } - $scope.error = function (e) { - /* DO SOMETHING WHEN ERROR IS THROWN */ - //console.log(e); - } - - } -/*upload file and extract data Created By bala */ - -$scope.UploadFileData = function (FileDetails,myModel,courseDetails) { - $scope.courseDetailsArray=courseDetails.list; - $scope.universityDetails=myModel.universityName.universityID; - // //console.log($scope.universityDetails); - // $scope.scheduledDetails=[]; - // $scope.scheduledDetails.push({ - // "universityID":myModel.universityName.universityID, - // }); - var updateUniversityEnrolment = { - method: 'POST', - url: apiPoint.url + 'batchUploadDataDetails/', - headers: { - 'Content-Type': 'application/json' - }, - data: { - details: FileDetails, - universityDetails : $scope.universityDetails, - courseDetails : $scope.courseDetailsArray, - requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, - branchId:JSON.parse(localStorage.getItem('localObj')).localBranchID - - } - - }; - - $http(updateUniversityEnrolment).then(function (response) { - console.log(response); - if (response.data.status == 200) { - swal("", "Saved Successfully", "success"); - $state.go($state.current, {}, {reload: true}); - } else { - swal("", "Please Mapping the course supject", "error"); - $state.go($state.current, {}, {reload: true}); - } - },function(error){ - $scope.semDropDownShowLoading = false; - swal(error.data.message,'','error'); - $state.go($state.current, {}, {reload: true}); - - } ); - } - // end - - $scope.saveAll= function(myModel,courseDetails,subjectsDetails) - { - $scope.courseDetailsArray=courseDetails.list; - - $scope.scheduledDetails=[]; - - angular.forEach(subjectsDetails,function (value) { - if((value.ScheduleDate!='' && value.ScheduleDate!=undefined) && (value.ScheduleStartTime!='' && value.ScheduleStartTime!=undefined) && (value.ScheduleEndTime!='' && value.ScheduleEndTime!=undefined)){ - - // var timeToaddAM = "05:30:00"; - // var timeToaddPM = "15:30:00"; - // var tempDate = $filter('date')(value.ScheduleDate, 'yyyy-MM-dd'); - // var ScheduleStartTime = value.ScheduleStartTime; - // var STARTAMPM = ScheduleStartTime.substr(-2); - // var ScheduleStartTime = ScheduleStartTime.substr(0,5)+":00"; - // console.log('ScheduleStartTime'+ScheduleStartTime); - // var timeToAddArr = ""; - // if(STARTAMPM == 'AM' || STARTAMPM == 'am') - // { - // timeToAddArr = timeToaddAM.split(":"); - // }else { timeToAddArr = timeToaddPM.split(":"); } - // var ms = (60 * 60 * parseInt(timeToAddArr[0]) + 60 * (parseInt(timeToAddArr[1])) ) * 1000; - // var newStartTime =new Date('1970-01-01T' + ScheduleStartTime ).getTime() + ms - // var finalStartTime = new Date(newStartTime).toLocaleString('en-GB').slice(12 ,20); - // finalStartTime = tempDate+'T'+finalStartTime+':000Z'; - // console.log(finalStartTime); - - // var ScheduleEndTime = value.ScheduleEndTime; - // var ENDAMPM = ScheduleEndTime.substr(-2); - // var ScheduleEndTime = ScheduleEndTime.substr(0,5)+":00"; - // console.log('ScheduleEndTime'+ScheduleEndTime); - // var timeToAddArr2 = ''; - // if(ENDAMPM == 'AM' || ENDAMPM == 'am') - // { - // timeToAddArr2 = timeToaddAM.split(":"); - // }else { timeToAddArr2 = timeToaddPM.split(":"); } - // var ms2 = (60 * 60 * parseInt(timeToAddArr2[0]) + 60 * (parseInt(timeToAddArr2[1])) ) * 1000; - // var newEndTime =new Date('1970-01-01T' + ScheduleEndTime ).getTime() + ms2 - // var finalEndTime = new Date(newEndTime).toLocaleString('en-GB').slice(12 ,20); - // finalEndTime = tempDate+'T'+finalEndTime+':000Z'; - // console.log(finalEndTime); - - - - - $scope.scheduledDetails.push({ - "universityID":myModel.universityName.universityID, - //"courseID":courseDetails.list[0], - "subjectID":value.Subject.SubjectID, - "scheduleDate":$filter('date')(value.ScheduleDate, 'dd-MM-yyyy'), - "scheduleStart":value.ScheduleStartTime, - "scheduleEnd":value.ScheduleEndTime, - - }); - - } - }); - //return false; - - var saveAllInfo = { - method: 'POST', - url: apiPoint.url + 'saveBatchSchedule/', - headers: { - 'Content-Type': 'application/json' - }, - data: { - getuniversityid :myModel.universityName.universityID, - //getcourseid :courseDetails.list[0], - courseDetails : $scope.courseDetailsArray, - scheduleDetails : $scope.scheduledDetails, - requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, - branchId:JSON.parse(localStorage.getItem('localObj')).localBranchID - - - } - }; - - $http(saveAllInfo).then(function(response) - { - //console.log(status); - if (response.data.status==200) - { - swal(" Saved successfully", "", "success"); - //$scope.init(); - $state.go($state.current, {}, {reload: true}); - } - },function(error){ - - swal('Some Thing Went Wrong!','Try Later','error'); - $state.go($state.current, {}, {reload: true}); - - }); - - } - - $scope.updateShedule = function (unsheduledetails) { - - $scope.UpdatescheduledDetails=[]; - - angular.forEach(unsheduledetails,function (value) { - if((value.ScheduleDate!='' && value.ScheduleDate!=undefined) && (value.FromTime!='' && value. FromTime!=undefined) && (value.ToTime!='' && value.ToTime!=undefined)){ - - $scope.UpdatescheduledDetails.push({ - "SchId":value.SchId, - "SubjectID":value.SubjectID, - "schChildId":value.SchChildId, - "scheduleDate":$filter('date')(value.ScheduleDate, 'dd-MM-yyyy'), - "scheduleStart":value.FromTime, - "scheduleEnd":value.ToTime, - - }); - - } - }); - - - - var update = { - method: 'POST', - url: apiPoint.url + 'updateSheduleDetails/', - headers: { - 'Content-Type': 'application/json' - }, - data: { - - updatescheduledetails : $scope.UpdatescheduledDetails, - //status: myModel.IsActive, - createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID, - scheduleID:$scope.mappingid - } - }; - $http(update).then(function (response) { - if (response.data.status==200 ) { - // $scope.ldloading[loading.replace('-', '_')] = false; - // - - swal("", "Saved Successfully.", "success"); - //$scope.editId = -1; - // $scope.init(); - $state.go($state.current, {}, {reload: true}); - - } else { - $scope.ldloading[loading.replace('-', '_')] = false; - swal("", response.data.message,"error"); - $state.go($state.current, {}, {reload: true}); - } - }); - }; - - - - - - - - - - - - - - - $scope.addForm ={ - submit:function(myModelAdd,addmoreItem) - { - //alert(); - time = myModelAdd.ScheduleTime; - $scope.details.push({ - time:time}) - - - - - - } - }; - $scope.processDataforViewPage = function() - { - $scope.viewPage.UniversityID = $scope.existSemesterSubjectMapDetails[0].UniversityID; - $scope.viewPage.UniversityName = $scope.existSemesterSubjectMapDetails[0].UniversityName; - var tArry = []; - angular.forEach($scope.existSemesterSubjectMapDetails,function(value,key){ - - if(tArry.indexOf(value.CourseID) == -1) - { - tArry.push(value.CourseID); - var tempArray = {'CourseID':value.CourseID,'CourseCode':value.CourseCode,'CourseName':value.CourseName}; - $scope.viewPage.CourseDetails.push(tempArray); - } - - - }); - - - } - /* - * init function - * created by TamilBala - * */ - $scope.init = function () { - - - - var logcheck = JSON.parse(localStorage.getItem('localObj')); - - const LOCALTYPE = logcheck.localType; - if (logcheck != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' || LOCALTYPE == 'R002' || LOCALTYPE == 'R005')) { - console.log("if"); - }else { - if(logcheck != null && LOCALTYPE !='R001') { - console.log("else if"); - $state.go('app.dashboard'); - } else { - - console.log("else else"); - //ipCookie.remove('cookiechk'); - window.localStorage.clear(); - $state.go('login.signin'); - } - } - - - var branchid=JSON.parse(localStorage.getItem('localObj')).localBranchID; - //alert(branchid); - $scope.semDetailsLoadingStatus = true; - $scope.semDetailsLoadingTxt = "Loading..."; - - var getUniv = { - method: 'POST', - url: apiPoint.url + 'getUniversityCourseDetails/', - headers: { - 'Content-Type': 'application/json' - }, - data: { - requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, - branchId:JSON.parse(localStorage.getItem('localObj')).localBranchID - - } - }; - - - $http(getUniv).then(function (response) { - if (response.data.status==200 && response.data.universityStatus) { - $scope.university=response.data.univerSityDetails; - - - - } else { - - $scope.university=""; - - } - }); - - $scope.selectedCourseNameC = { - list: $scope.selectedCourseName, - } - - /* - * getUnivid function - * created by TamilBala - * */ - - var getUnivid = { - method: 'POST', - url: apiPoint.url + 'getUniversityCourseId/', - headers: { - 'Content-Type': 'application/json' - }, - data: { - //requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, - branchCode:branchid, - - } - }; - $http(getUnivid).then(function (response) { - if (response.data.status==200) - { - - $scope.universitycourse=response.data.getUnivDetailsinfo; - - - - } else { - - - $scope.universitycourse=""; - - } - }); - - - - - } - - -$scope.batchschedule={ - submit: function (form, myModelAdd) - { - - - var alldata = $("#batchsch"); - - }, -}; - -$scope.validateTime = function(time,ide){ - //alert(time); - var tempTime = time; - var tempID = ide.target.attributes.id.value; - ///console.log(tempID); - var arrayTime = time.split(":"); - ////console.log(!isNaN(arrayTime[0])); - //console.log(!isNaN(arrayTime[1].substr(0,2))); - //console.log(isNaN(arrayTime[1].substr(-2))); - //return false; - - if(time.length != 7 || isNaN(arrayTime[0]) || isNaN(arrayTime[1].substr(0,2)) || !isNaN(arrayTime[1].substr(-2))){ - swal('Wrong Time Format...!',' Enter as "09:00AM" ','error'); - document.getElementById(tempID).value = ""; - window.setTimeout(function () - { - document.getElementById(tempID).focus(); - }, 0); - //return false; - } - - -} - +'use strict'; +/** + * controllers for ng-table + * Simple table with sorting and filtering on AngularJS + */ +app.controller('schCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableParams", "API_POINTS", "$localStorage", "$http", "$state", function ($scope,$rootScope,toaster, $filter, ngTableParams, apiPoint, $localStorage, $http, $state) { + + $scope.myModel = { + "studentName": "", + "mobileNumber": "", + "universityName":"", + "semsterName":"" + }; + + $scope.myModelAdd = { + "date": "", + "periodStart": "", + "periodEnd":"", + + }; + $scope.details = []; + $scope.viewPage = { + "CourseDetails":[] + }; + + $scope.editId = -1; + $scope.editModel = { + "editSubject": "", + "editScheduleDate": "", + "editFromTime":"", + "editToTime":"", + + }; + $scope.semDropDownShowLoading1 = false; + $scope.semDetailsLoadingStatus1 = false; + $scope.semDetailsLoadingTxt1 = ""; + $scope.setEditId = function (pid,cid,schid,subid,c) { + var branchid=JSON.parse(localStorage.getItem('localObj')).localBranchID; + $scope.semDetailsLoadingStatus1 = true; + $scope.semDetailsLoadingTxt1 = "Loading..."; + //alert(branchid); + //alert(pid); + $scope.editModel.editSubject = c.SubjectName; + $scope.editModel.editScheduleDate = c.ScheduleDate; + $scope.editModel.editFromTime = c.FromTime; + $scope.editModel.editToTime = c.ToTime; + //$scope.localUniversityDetails=""; + //$scope.localUniversityDetails = JSON.parse(localStorage.getItem('localUniversityDetails')); + + + $scope.editId = pid; + $scope.courseCode = cid; + $scope.mappingid = schid; + //$scope.sample=subid; + $scope.sample1=c; + //alert(mappingid+'n'); + var getsheduledetails = { + method: 'POST', + url: apiPoint.url + 'getSheduleDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + //requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + mapid:$scope.mappingid, + subid:subid, + branchcode:branchid, + courseDetails:$scope.sample1 + + } + }; + $http(getsheduledetails).then(function (response) { + if (response.data.status==200) + { + + $scope.unsheduledetails=response.data.getunSheduleDetailsinfo.scheduleDetails; + + + + } else { + $scope.unsheduledetails=""; + + } + }); + + + + }; + // $scope.details = []; + $scope.cancel = function () { + $scope.init(); + $scope.editId = -1; + + }; + $scope.semDropDownShow = false; + $scope.semDropDownShowLoading = false; + $scope.saveButtonDisabled = false; + $scope.saveButtonTxt = "SAVE"; + $rootScope.userType = JSON.parse(localStorage.getItem('localObj')).localType; + $scope.semDetailsLoadingStatus = false; + $scope.semDetailsLoadingTxt = ""; + + + $scope.selectedCourseName = []; + $scope.selectedUniversityCourseName = ''; + $scope.selectedSemSubjetcsSem1 = []; + $scope.selectedSemSubjetcsSem2 = []; + $scope.selectedSemSubjetcsSem3 = []; + $scope.selectedSemSubjetcsSem4 = []; + $scope.selectedSemSubjetcsSem5 = []; + $scope.selectedSemSubjetcsSem6 = []; + $scope.selectedSemSubjetcsSem7 = []; + $scope.selectedSemSubjetcsSem8 = []; + $scope.overallSelectedSubjetcs = []; + + // sorting function for table params + $scope.sort = function(keyname){ + $scope.sortKey = keyname; //set the sortKey to the param passed + $scope.reverse = !$scope.reverse; //if true make it false and vice versa + } + + + + + //Assign Courses to Course array for Multiple select + $scope.getuniversity = function(){ + $scope.selectedUniversityCourseName = $scope.myModel.universityName.courseDetails; + if($scope.selectedUniversityCourseName.length == 0){ swal('No Courses Available','','info'); } + $scope.selectedCourseNameC = { + list: $scope.selectedCourseName, + } + + } + + + /* + * get course semester,subjects details + * created by TamilBala + * */ + + var course=''; + $scope.getSemSubDetails = function(UID,COURSES){ + course=COURSES; + //alert(course) + var firstError = null; + if (form.$invalid) { + + var field = null, firstError = null; + for (field in form) { + if (field[0] != '$') { + if (firstError === null && !form[field].$valid) { + firstError = form[field].$name; + } + if (form[field].$pristine) { + form[field].$dirty = true; + } + } + } + angular.element('.ng-invalid[name=' + firstError + ']').focus(); + + } + else + { + + + if(UID == undefined || UID == '') + { + swal("Select University"); + return false; + } + if(COURSES.list == '') + { + swal("Select Course"); + return false; + } + $scope.editId=1; + $scope.semDropDownShowLoading = false; + $scope.semDropDownShow = false; + $scope.semDropDownShowLoading = true; + var getsubject = { + method: 'POST', + url: apiPoint.url + 'getExistingMapping/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + universityID : UID, + courseID : COURSES, + requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + branchId:JSON.parse(localStorage.getItem('localObj')).localBranchID + } + }; + $http(getsubject).then(function (response) { + console.log(response); + if(response.data.status == 200) + { + $scope.semDropDownShowLoading = false; + $scope.semDropDownShow = true; + $scope.subjects = [];// For Main Dropdown + $scope.subjectsFromDBtoComapare = []; + //$scope.semesters = response.data.semesterDetails; + $scope.subjectsFromDB = response.data.subjectDetails; //Store Response Data to subjectsFromDB + + angular.forEach($scope.subjectsFromDB,function(value,key){ + $scope.subjects.push({ + "Subject":value, + "ScheduleDate":"", + "ScheduleStartTime":"", + "ScheduleEndTime":"" + + });// For Main Dropdown + }); + + + + + } + + + + + + },function(error){ + $scope.semDropDownShowLoading = false; + swal(error.data.message,'','error'); + $state.go($state.current, {}, {reload: true}); + + } ); + + + + } + } + $scope.remove = function () { + $scope.init(); + $scope.semDropDownShow = false; + + + }; + /* + * Remove Subjects from Master Subjects Arry + * after selecting subjects for each semester + * created by TamilBala + * */ + $scope.removeSelectedSubjetcs = function(newsublist){ + + //Every time copy all subjetcs from subjectsFromDB to ompare + angular.forEach($scope.subjectsFromDB,function(value,key){ + $scope.subjectsFromDBtoComapare.push(value); + }); + + //For Compare Single Semesters Array and Master Subjetcs Array and remove selected subjects from Master Subjetcs Array + angular.forEach(newsublist,function(value,key){ + angular.forEach($scope.subjects,function(value2,key2){ + + if(value.SubjectID == value2.SubjectID) + { + $scope.subjects.splice(key2,1); + } + + }); + }); + + //For Concat all subjetcs from all semsters. + $scope.overallSelectedSubjetcs=[].concat($scope.selectedSubjetcsSem1C.list,$scope.selectedSubjetcsSem2C.list,$scope.selectedSubjetcsSem3C.list,$scope.selectedSubjetcsSem4C.list,$scope.selectedSubjetcsSem5C.list,$scope.selectedSubjetcsSem6C.list,$scope.selectedSubjetcsSem7C.list,$scope.selectedSubjetcsSem8C.list); + + + //For Compare Over all selected subjects And Master Subjetcs to avoid duplicate. + angular.forEach($scope.overallSelectedSubjetcs,function(value,key){ + + angular.forEach($scope.subjectsFromDBtoComapare,function(value2,key2){ + if(value.SubjectID != value2.SubjectID) + { + + if ($scope.overallSelectedSubjetcs.indexOf(value2) == -1 && $scope.subjects.indexOf(value2) == -1) + { + $scope.subjects.push(value2); + $scope.subjectsFromDBtoComapare.splice(key2,1); + } + + } + + }); + + }); + + $scope.subjectsFromDBtoComapare = []; + + } + + + + var date= ''; + var stime= ''; + var etime=''; + var subjectname= ''; + var subjectcode = ''; + var c=''; + var subid=''; + var subjectId= ''; + $scope.details = []; + + $scope.add= function(index,myModelAdd,p) + { + + var subname = p.SubjectName; + var item=[]; + c = $scope.details.length + 1; + var formate = "dd-MM-yyyy"; + date = $filter('date')(new Date(myModelAdd.date), formate); + stime = myModelAdd.periodStart; + etime = myModelAdd.periodEnd; + subjectname = p.SubjectName; + subjectcode = p.SubjectCode; + subid = p.SubjectID; + + + + item.push({ + + date : date, + stime : stime, + etime : etime, + subjectname : subjectname, + subjectcode : subjectcode, + subjectId : subid + + + }); + + $scope.details.splice(0,0,item); + + + } + /* upload file for batch schedule + * created by bala + * */ + $scope.extractFileDetails=""; + $scope.readUploadBatchDetails = function (workbook) { + /* DO SOMETHING WITH workbook HERE */ + for (var sheetName in workbook.Sheets) { + var jsonData = XLSX.utils.sheet_to_json(workbook.Sheets[sheetName]); + if(jsonData.length!=0){ + $scope.extractFileDetails=jsonData; + } + + } + $scope.error = function (e) { + /* DO SOMETHING WHEN ERROR IS THROWN */ + //console.log(e); + } + + } +/*upload file and extract data Created By bala */ + +$scope.UploadFileData = function (FileDetails,myModel,courseDetails) { + $scope.courseDetailsArray=courseDetails.list; + $scope.universityDetails=myModel.universityName.universityID; + // //console.log($scope.universityDetails); + // $scope.scheduledDetails=[]; + // $scope.scheduledDetails.push({ + // "universityID":myModel.universityName.universityID, + // }); + var updateUniversityEnrolment = { + method: 'POST', + url: apiPoint.url + 'batchUploadDataDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + details: FileDetails, + universityDetails : $scope.universityDetails, + courseDetails : $scope.courseDetailsArray, + requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + branchId:JSON.parse(localStorage.getItem('localObj')).localBranchID + + } + + }; + + $http(updateUniversityEnrolment).then(function (response) { + console.log(response); + if (response.data.status == 200) { + swal("", "Saved Successfully", "success"); + $state.go($state.current, {}, {reload: true}); + } else { + swal("", "Please Mapping the course supject", "error"); + $state.go($state.current, {}, {reload: true}); + } + },function(error){ + $scope.semDropDownShowLoading = false; + swal(error.data.message,'','error'); + $state.go($state.current, {}, {reload: true}); + + } ); + } + // end + + $scope.saveAll= function(myModel,courseDetails,subjectsDetails) + { + $scope.courseDetailsArray=courseDetails.list; + + $scope.scheduledDetails=[]; + + angular.forEach(subjectsDetails,function (value) { + if((value.ScheduleDate!='' && value.ScheduleDate!=undefined) && (value.ScheduleStartTime!='' && value.ScheduleStartTime!=undefined) && (value.ScheduleEndTime!='' && value.ScheduleEndTime!=undefined)){ + + // var timeToaddAM = "05:30:00"; + // var timeToaddPM = "15:30:00"; + // var tempDate = $filter('date')(value.ScheduleDate, 'yyyy-MM-dd'); + // var ScheduleStartTime = value.ScheduleStartTime; + // var STARTAMPM = ScheduleStartTime.substr(-2); + // var ScheduleStartTime = ScheduleStartTime.substr(0,5)+":00"; + // console.log('ScheduleStartTime'+ScheduleStartTime); + // var timeToAddArr = ""; + // if(STARTAMPM == 'AM' || STARTAMPM == 'am') + // { + // timeToAddArr = timeToaddAM.split(":"); + // }else { timeToAddArr = timeToaddPM.split(":"); } + // var ms = (60 * 60 * parseInt(timeToAddArr[0]) + 60 * (parseInt(timeToAddArr[1])) ) * 1000; + // var newStartTime =new Date('1970-01-01T' + ScheduleStartTime ).getTime() + ms + // var finalStartTime = new Date(newStartTime).toLocaleString('en-GB').slice(12 ,20); + // finalStartTime = tempDate+'T'+finalStartTime+':000Z'; + // console.log(finalStartTime); + + // var ScheduleEndTime = value.ScheduleEndTime; + // var ENDAMPM = ScheduleEndTime.substr(-2); + // var ScheduleEndTime = ScheduleEndTime.substr(0,5)+":00"; + // console.log('ScheduleEndTime'+ScheduleEndTime); + // var timeToAddArr2 = ''; + // if(ENDAMPM == 'AM' || ENDAMPM == 'am') + // { + // timeToAddArr2 = timeToaddAM.split(":"); + // }else { timeToAddArr2 = timeToaddPM.split(":"); } + // var ms2 = (60 * 60 * parseInt(timeToAddArr2[0]) + 60 * (parseInt(timeToAddArr2[1])) ) * 1000; + // var newEndTime =new Date('1970-01-01T' + ScheduleEndTime ).getTime() + ms2 + // var finalEndTime = new Date(newEndTime).toLocaleString('en-GB').slice(12 ,20); + // finalEndTime = tempDate+'T'+finalEndTime+':000Z'; + // console.log(finalEndTime); + + + + + $scope.scheduledDetails.push({ + "universityID":myModel.universityName.universityID, + //"courseID":courseDetails.list[0], + "subjectID":value.Subject.SubjectID, + "scheduleDate":$filter('date')(value.ScheduleDate, 'dd-MM-yyyy'), + "scheduleStart":value.ScheduleStartTime, + "scheduleEnd":value.ScheduleEndTime, + + }); + + } + }); + //return false; + + var saveAllInfo = { + method: 'POST', + url: apiPoint.url + 'saveBatchSchedule/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + getuniversityid :myModel.universityName.universityID, + //getcourseid :courseDetails.list[0], + courseDetails : $scope.courseDetailsArray, + scheduleDetails : $scope.scheduledDetails, + requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + branchId:JSON.parse(localStorage.getItem('localObj')).localBranchID + + + } + }; + + $http(saveAllInfo).then(function(response) + { + //console.log(status); + if (response.data.status==200) + { + swal(" Saved successfully", "", "success"); + //$scope.init(); + $state.go($state.current, {}, {reload: true}); + } + },function(error){ + + swal('Some Thing Went Wrong!','Try Later','error'); + $state.go($state.current, {}, {reload: true}); + + }); + + } + + $scope.updateShedule = function (unsheduledetails) { + + $scope.UpdatescheduledDetails=[]; + + angular.forEach(unsheduledetails,function (value) { + if((value.ScheduleDate!='' && value.ScheduleDate!=undefined) && (value.FromTime!='' && value. FromTime!=undefined) && (value.ToTime!='' && value.ToTime!=undefined)){ + + $scope.UpdatescheduledDetails.push({ + "SchId":value.SchId, + "SubjectID":value.SubjectID, + "schChildId":value.SchChildId, + "scheduleDate":$filter('date')(value.ScheduleDate, 'dd-MM-yyyy'), + "scheduleStart":value.FromTime, + "scheduleEnd":value.ToTime, + + }); + + } + }); + + + + var update = { + method: 'POST', + url: apiPoint.url + 'updateSheduleDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + + updatescheduledetails : $scope.UpdatescheduledDetails, + //status: myModel.IsActive, + createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + scheduleID:$scope.mappingid + } + }; + $http(update).then(function (response) { + if (response.data.status==200 ) { + // $scope.ldloading[loading.replace('-', '_')] = false; + // + + swal("", "Saved Successfully.", "success"); + //$scope.editId = -1; + // $scope.init(); + $state.go($state.current, {}, {reload: true}); + + } else { + $scope.ldloading[loading.replace('-', '_')] = false; + swal("", response.data.message,"error"); + $state.go($state.current, {}, {reload: true}); + } + }); + }; + + + + + + + + + + + + + + + $scope.addForm ={ + submit:function(myModelAdd,addmoreItem) + { + //alert(); + time = myModelAdd.ScheduleTime; + $scope.details.push({ + time:time}) + + + + + + } + }; + $scope.processDataforViewPage = function() + { + $scope.viewPage.UniversityID = $scope.existSemesterSubjectMapDetails[0].UniversityID; + $scope.viewPage.UniversityName = $scope.existSemesterSubjectMapDetails[0].UniversityName; + var tArry = []; + angular.forEach($scope.existSemesterSubjectMapDetails,function(value,key){ + + if(tArry.indexOf(value.CourseID) == -1) + { + tArry.push(value.CourseID); + var tempArray = {'CourseID':value.CourseID,'CourseCode':value.CourseCode,'CourseName':value.CourseName}; + $scope.viewPage.CourseDetails.push(tempArray); + } + + + }); + + + } + /* + * init function + * created by TamilBala + * */ + $scope.init = function () { + + + + var logcheck = JSON.parse(localStorage.getItem('localObj')); + + const LOCALTYPE = logcheck.localType; + if (logcheck != null && (LOCALTYPE == 'R003' || LOCALTYPE == 'R004' || LOCALTYPE == 'R002' || LOCALTYPE == 'R005')) { + console.log("if"); + }else { + if(logcheck != null && LOCALTYPE !='R001') { + console.log("else if"); + $state.go('app.dashboard'); + } else { + + console.log("else else"); + //ipCookie.remove('cookiechk'); + window.localStorage.clear(); + $state.go('login.signin'); + } + } + + + var branchid=JSON.parse(localStorage.getItem('localObj')).localBranchID; + //alert(branchid); + $scope.semDetailsLoadingStatus = true; + $scope.semDetailsLoadingTxt = "Loading..."; + + var getUniv = { + method: 'POST', + url: apiPoint.url + 'getUniversityCourseDetails/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + branchId:JSON.parse(localStorage.getItem('localObj')).localBranchID + + } + }; + + + $http(getUniv).then(function (response) { + if (response.data.status==200 && response.data.universityStatus) { + $scope.university=response.data.univerSityDetails; + + + + } else { + + $scope.university=""; + + } + }); + + $scope.selectedCourseNameC = { + list: $scope.selectedCourseName, + } + + /* + * getUnivid function + * created by TamilBala + * */ + + var getUnivid = { + method: 'POST', + url: apiPoint.url + 'getUniversityCourseId/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + //requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + branchCode:branchid, + + } + }; + $http(getUnivid).then(function (response) { + if (response.data.status==200) + { + + $scope.universitycourse=response.data.getUnivDetailsinfo; + + + + } else { + + + $scope.universitycourse=""; + + } + }); + + + + + } + + +$scope.batchschedule={ + submit: function (form, myModelAdd) + { + + + var alldata = $("#batchsch"); + + }, +}; + +$scope.validateTime = function(time,ide){ + //alert(time); + var tempTime = time; + var tempID = ide.target.attributes.id.value; + ///console.log(tempID); + var arrayTime = time.split(":"); + ////console.log(!isNaN(arrayTime[0])); + //console.log(!isNaN(arrayTime[1].substr(0,2))); + //console.log(isNaN(arrayTime[1].substr(-2))); + //return false; + + if(time.length != 7 || isNaN(arrayTime[0]) || isNaN(arrayTime[1].substr(0,2)) || !isNaN(arrayTime[1].substr(-2))){ + swal('Wrong Time Format...!',' Enter as "09:00AM" ','error'); + document.getElementById(tempID).value = ""; + window.setTimeout(function () + { + document.getElementById(tempID).focus(); + }, 0); + //return false; + } + + +} + }]); \ No newline at end of file diff --git a/Apollo/assets/views/hallticket/batchshedule.html b/Apollo/assets/views/hallticket/batchshedule.html old mode 100755 new mode 100644 index ffc98192..be0cc8d1 --- a/Apollo/assets/views/hallticket/batchshedule.html +++ b/Apollo/assets/views/hallticket/batchshedule.html @@ -1,302 +1,302 @@ - - -
-
-
- -

{{ mainTitle }}

- - Allocate Batch schedule - -
- -
-
- - - -
- - - -
-
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-

Loading...

-
- -
- - - - - -
University NameCourse NameAction
{{c.UniversityName}}{{c.CourseName}} - - - - - - - - - - -
- - -
- - - - - - -
-
-
- -
- - -
-
- Search -
-
- - - - -
-
- - - - - - - - - - - {{$item.CourseName}} - - - {{x.CourseName}} - - - - -
- -
-
- - -
-
-
-
- (OR) -
-
-
- -
- Sample Format - - -
-
- -
-
-
-

Loading...

-
- -
- - -
-
-
- -
-

Subject

-
-
-

Date

-
-
-

Start Time

-
-
-

End Time

-
-
- -
-
- -
- -
- - - -
- - -
-
- - -
-
-
- - - - - - - -
-
-
-
- - - - - - - - - - - -
-
- -
- - - -
- - -
-
-
-
-
-
- - - - -
-
-
-
-
-
-
- -
-
-
- - - - - - - - - + + +
+
+
+ +

{{ mainTitle }}

+ + Allocate Batch schedule + +
+ +
+
+ + + +
+ + + +
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

Loading...

+
+ +
+ + + + + +
University NameCourse NameAction
{{c.UniversityName}}{{c.CourseName}} + + + + + + + + + + +
+ + +
+ + + + + + +
+
+
+ +
+ + +
+
+ Search +
+
+ + + + +
+
+ + + + + + + + + + + {{$item.CourseName}} + + + {{x.CourseName}} + + + + +
+ +
+
+ + +
+
+
+
+ (OR) +
+
+
+ +
+ Sample Format + + +
+
+ +
+
+
+

Loading...

+
+ +
+ + +
+
+
+ +
+

Subject

+
+
+

Date

+
+
+

Start Time

+
+
+

End Time

+
+
+ +
+
+ +
+ +
+ + + +
+ + +
+
+ + +
+
+
+ + + + + + + +
+
+
+
+ + + + + + + + + + + +
+
+ +
+ + + +
+ + +
+
+
+
+
+
+ + + + +
+
+
+
+
+
+
+ +
+
+
+ + + + + + + + + diff --git a/Apollo/assets/views/hallticket/editShedule.html b/Apollo/assets/views/hallticket/editShedule.html old mode 100755 new mode 100644 index 786942b2..03090b7c --- a/Apollo/assets/views/hallticket/editShedule.html +++ b/Apollo/assets/views/hallticket/editShedule.html @@ -1,158 +1,158 @@ -
-
-
-
-
- - Update Schedule Details - -
-
-
- -
-

Subject

-
-
-

Date

-
-
-

Start Time

-
-
-

End Time

-
-
-
-
- -
- -
- - - - -
- -
-
- - - Shedule Date is required. - - -
- - -
- - -
- - -
-
- - - - - - - -
- -
- - - - -
-
- - -
-
- - - - - - - - -
- -
- - - - -
- - - -
-
-
-
-
-
-
-
- - - - - -
-
-
-
-
-
-
-
- - - - - +
+
+
+
+
+ + Update Schedule Details + +
+
+
+ +
+

Subject

+
+
+

Date

+
+
+

Start Time

+
+
+

End Time

+
+
+
+
+ +
+ +
+ + + + +
+ +
+
+ + + Shedule Date is required. + + +
+ + +
+ + +
+ + +
+
+ + + + + + + +
+ +
+ + + + +
+
+ + +
+
+ + + + + + + + +
+ +
+ + + + +
+ + + +
+
+
+
+
+
+
+
+ + + + + +
+
+
+
+
+
+
+
+ + + + + \ No newline at end of file From e20ef04a185a0ed6a67f24981f53dc57a963f85d Mon Sep 17 00:00:00 2001 From: dineshkumarkannan Date: Sat, 8 Sep 2018 18:36:25 +0530 Subject: [PATCH 02/14] form id details check update : kdk --- Apollo/api/application/config/routes.php | 3 + ...Receive_Enrolment_Fees_Univ_Controller.php | 59 ++++++- .../Receive_Enrolment_Fees_Univ_model.php | 154 +++++++++++++++++- .../studentUnivFormIdFeeDetailsCtrl.js | 89 ++++++++-- .../student/studentUnivFormIdFeeDetails.html | 134 +++++++++------ Apollo/images/student/Dri_Be563jFw2aQu.jpeg | Bin 0 -> 8618 bytes Apollo/images/student/Dri_hRifsSNIu7HX.jpeg | Bin 0 -> 8618 bytes 7 files changed, 372 insertions(+), 67 deletions(-) create mode 100644 Apollo/images/student/Dri_Be563jFw2aQu.jpeg create mode 100644 Apollo/images/student/Dri_hRifsSNIu7HX.jpeg diff --git a/Apollo/api/application/config/routes.php b/Apollo/api/application/config/routes.php index 44c4e2a1..c2bf3a6c 100755 --- a/Apollo/api/application/config/routes.php +++ b/Apollo/api/application/config/routes.php @@ -375,3 +375,6 @@ $route['getStudentUnivFormIdFeeDatailsList'] = 'Receive_Enrolment_Fees_Univ_Cont $route['getFormIdDetailsStatusUpdateList'] = 'Receive_Enrolment_Fees_Univ_Controller/getFormIdDetailsStatusUpdateList'; $route['insertStatusUpdateDetails'] = 'Receive_Enrolment_Fees_Univ_Controller/insertStatusUpdateDetails'; $route['paymentVerficationDetails'] = 'Receive_Enrolment_Fees_Univ_Controller/paymentVerficationDetails'; +$route['getUniversityCodeForFormDetailsGet'] = 'Receive_Enrolment_Fees_Univ_Controller/getUniversityCodeForFormDetailsGet'; +$route['getUnmatchedFormIdFeesDetails'] = 'Receive_Enrolment_Fees_Univ_Controller/getUnmatchedFormIdFeesDetails'; +$route['addToAccountStateList'] = 'Receive_Enrolment_Fees_Univ_Controller/addToAccountStateList'; diff --git a/Apollo/api/application/controllers/Receive_Enrolment_Fees_Univ_Controller.php b/Apollo/api/application/controllers/Receive_Enrolment_Fees_Univ_Controller.php index 637edb56..ba1705fd 100644 --- a/Apollo/api/application/controllers/Receive_Enrolment_Fees_Univ_Controller.php +++ b/Apollo/api/application/controllers/Receive_Enrolment_Fees_Univ_Controller.php @@ -85,7 +85,8 @@ class Receive_Enrolment_Fees_Univ_Controller extends REST_Controller { public function insertFormIdUnivFeeDetails_post(){ $formIdDetails = $this->post('details'); $localDetails = $this->post('localDetails'); - $updatedDetails = $this->receive_model->formIdFeeDetails($formIdDetails,$localDetails);// Check if the users data store contains users (in case the database result returns NULL) + $univDetails = $this->post('univ'); + $updatedDetails = $this->receive_model->formIdFeeDetails($formIdDetails,$localDetails, $univDetails);// Check if the users data store contains users (in case the database result returns NULL) if ($updatedDetails) { $updatedDetails['status'] = REST_Controller::HTTP_OK; @@ -289,7 +290,9 @@ class Receive_Enrolment_Fees_Univ_Controller extends REST_Controller { public function addForFormIdDraftDetails_post(){ $reqBranch = $this->post('localDetails'); $details = $this->post('details'); - $addForFormIdDraftDetails = $this->receive_model->addForFormIdDraftDetails($details, $reqBranch); // Check if the employee exist + $univDetails = $this->post('univ'); + + $addForFormIdDraftDetails = $this->receive_model->addForFormIdDraftDetails($details, $reqBranch, $univDetails); // Check if the employee exist if ($addForFormIdDraftDetails) { $addForFormIdDraftDetails['status'] = REST_Controller::HTTP_OK; // Set the response and exit @@ -391,5 +394,57 @@ class Receive_Enrolment_Fees_Univ_Controller extends REST_Controller { } } + public function getUniversityCodeForFormDetailsGet_post(){ + $reqData = $this->post('data'); + $loginUserId = $reqData['localUserID']; + $loginUserBranchId = $reqData['localBranchID']; + $loginUserType = $reqData['localType']; + $getUniversityListDetails = $this->receive_model->get_university_list($loginUserBranchId); // Check if the employee exist + if ($getUniversityListDetails) { + $getUniversityListDetails['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getUniversityListDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + + } else { + // Set the response and exit + $this->response(['message' => 'No list were found', 'status' => REST_Controller::HTTP_NOT_FOUND], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + + } + } + + public function getUnmatchedFormIdFeesDetails_post(){ + $localDetails = $this->post('localDetails'); + $getDetailsFor = $this->post('getDetailsFor'); + + $getUnmatchedFormIdFeesDetails = $this->receive_model->getUnmatchedFormIdFeesDetails($localDetails, $getDetailsFor); // Check if the employee exist + if ($getUnmatchedFormIdFeesDetails) { + $getUnmatchedFormIdFeesDetails['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($getUnmatchedFormIdFeesDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + + } else { + // Set the response and exit + $this->response(['message' => 'No list were found', 'status' => REST_Controller::HTTP_NOT_FOUND], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + + } + } + + public function addToAccountStateList_post(){ + $localDetails = $this->post('localDetails'); + $getDetailsFor = $this->post('details'); + + $addFormIdListToAccountState = $this->receive_model->addFormIdListToAccountState($localDetails, $getDetailsFor); // Check if the employee exist + if ($addFormIdListToAccountState) { + $addFormIdListToAccountState['status'] = REST_Controller::HTTP_OK; + // Set the response and exit + $this->response($addFormIdListToAccountState, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + + } else { + // Set the response and exit + $this->response(['message' => 'No list were found', 'status' => REST_Controller::HTTP_NOT_FOUND], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + + } + } + } \ No newline at end of file diff --git a/Apollo/api/application/models/Receive_Enrolment_Fees_Univ_model.php b/Apollo/api/application/models/Receive_Enrolment_Fees_Univ_model.php index a869d2b7..cf8abb13 100644 --- a/Apollo/api/application/models/Receive_Enrolment_Fees_Univ_model.php +++ b/Apollo/api/application/models/Receive_Enrolment_Fees_Univ_model.php @@ -368,9 +368,10 @@ class Receive_Enrolment_Fees_Univ_model extends CI_Model { } - public function formIdFeeDetails($formFeeDetails=null,$local=null){ + public function formIdFeeDetails($formFeeDetails=null,$local=null, $univ =null){ $localBranchID = $local['localBranchID']; $localUserID = $local['localUserID']; + $univId = $univ['univCode']; $time = date('Y-m-d H:i:s'); $CreatedOn = $time; @@ -443,9 +444,9 @@ class Receive_Enrolment_Fees_Univ_model extends CI_Model { if(count($queryDetails->result()) == 0){ $query = "INSERT INTO T_FormId_FeeDetails_Received_From_University - (FormID, FormType, CentreCode,Session,Year,Semester,Student_Name,Father_Name,CourseCode, ActualCourseFee, CourseFee, ExamFee, EnrollmentFee, ProspectusFee, ReRegFee, CreditTransferFee, LateralEntryFee, DualSpclFee, OtherFee, NRIFEE, ProvisionalFee, MigrationFee, UrgentResultDMCFee, AdditionalFee, Amount, CreatedBy, CreatedOn, BranchCode, DraftStatus, EditStatus) + (FormID, FormType, CentreCode,Session,Year,Semester,Student_Name,Father_Name,CourseCode, ActualCourseFee, CourseFee, ExamFee, EnrollmentFee, ProspectusFee, ReRegFee, CreditTransferFee, LateralEntryFee, DualSpclFee, OtherFee, NRIFEE, ProvisionalFee, MigrationFee, UrgentResultDMCFee, AdditionalFee, Amount,UniversityID, CreatedBy, CreatedOn, BranchCode, DraftStatus, EditStatus) VALUES - ( '$formIds', '$formType', '$CentreCode','$Session','$Year','$Semester','$Student_Name','$Father_Name', '$CourseCode', '$ActualCourseFee', '$CourseFee', '$ExamFee', '$EnrollmentFee', '$ProspectusFee', '$ReRegFee', '$CreditTransferFee', '$LateralEntryFee', '$DualSpclFee', '$OtherFee', '$NRIFEE', '$ProvisionalFee', '$MigrationFee', '$UrgentResultDMCFee', '$AdditionalFee', '$Amount', '$localUserID', '$CreatedOn', '$localBranchID' , 0, 0)"; + ( '$formIds', '$formType', '$CentreCode','$Session','$Year','$Semester','$Student_Name','$Father_Name', '$CourseCode', '$ActualCourseFee', '$CourseFee', '$ExamFee', '$EnrollmentFee', '$ProspectusFee', '$ReRegFee', '$CreditTransferFee', '$LateralEntryFee', '$DualSpclFee', '$OtherFee', '$NRIFEE', '$ProvisionalFee', '$MigrationFee', '$UrgentResultDMCFee', '$AdditionalFee', '$Amount', '$univId', '$localUserID', '$CreatedOn', '$localBranchID' , 0, 0)"; $queryDetails = $this->db->query($query); } else { echo 'else con'; @@ -905,10 +906,11 @@ class Receive_Enrolment_Fees_Univ_model extends CI_Model { return $result; } - public function addForFormIdDraftDetails($details, $local){ + public function addForFormIdDraftDetails($details, $local, $univ =null){ $localBranchID = $local['localBranchID']; $localUserID = $local['localUserID']; + $univId = $univ['univCode']; $time = date('Y-m-d H:i:s'); $CreatedOn = $time; @@ -967,9 +969,9 @@ class Receive_Enrolment_Fees_Univ_model extends CI_Model { if(count($queryDetails->result()) == 0){ $query = "INSERT INTO T_FormId_FeeDetails_Received_From_University - (FormID, FormType, CentreCode,Session,Year,Semester,Student_Name,Father_Name,CourseCode, ActualCourseFee, CourseFee, ExamFee, EnrollmentFee, ProspectusFee, ReRegFee, CreditTransferFee, LateralEntryFee, DualSpclFee, OtherFee, NRIFEE, ProvisionalFee, MigrationFee, UrgentResultDMCFee, AdditionalFee, Amount, CreatedBy, CreatedOn, BranchCode, DraftStatus, EditStatus) + (FormID, FormType, CentreCode,Session,Year,Semester,Student_Name,Father_Name,CourseCode, ActualCourseFee, CourseFee, ExamFee, EnrollmentFee, ProspectusFee, ReRegFee, CreditTransferFee, LateralEntryFee, DualSpclFee, OtherFee, NRIFEE, ProvisionalFee, MigrationFee, UrgentResultDMCFee, AdditionalFee, Amount, UniversityID, CreatedBy, CreatedOn, BranchCode, DraftStatus, EditStatus) VALUES - ( '$formIds', '$formType', '$CentreCode','$Session','$Year','$Semester','$Student_Name','$Father_Name', '$CourseCode', '$ActualCourseFee', '$CourseFee', '$ExamFee', '$EnrollmentFee', '$ProspectusFee', '$ReRegFee', '$CreditTransferFee', '$LateralEntryFee', '$DualSpclFee', '$OtherFee', '$NRIFEE', '$ProvisionalFee', '$MigrationFee', '$UrgentResultDMCFee', '$AdditionalFee', '$Amount', '$localUserID', '$CreatedOn', '$localBranchID' , 1, 1)"; + ( '$formIds', '$formType', '$CentreCode','$Session','$Year','$Semester','$Student_Name','$Father_Name', '$CourseCode', '$ActualCourseFee', '$CourseFee', '$ExamFee', '$EnrollmentFee', '$ProspectusFee', '$ReRegFee', '$CreditTransferFee', '$LateralEntryFee', '$DualSpclFee', '$OtherFee', '$NRIFEE', '$ProvisionalFee', '$MigrationFee', '$UrgentResultDMCFee', '$AdditionalFee', '$Amount', '$univId' , '$localUserID', '$CreatedOn', '$localBranchID' , 1, 1)"; $queryDetails = $this->db->query($query); if($queryDetails){ @@ -1153,7 +1155,11 @@ $result['updatedraftStatus'] = false; } public function getFormIdDetailsStatusUpdateList($reqBranchData, $searchDetails){ - $selectQuery = "SELECT * FROM T_FormId_FeeDetails_Received_From_University_StatusUpdate WHERE FormIdDetailsID = '$searchDetails'"; + $selectQuery = "SELECT * , concat(t3.Firstname, '', t3.Lastname) as CreatedByName + FROM T_FormId_FeeDetails_Received_From_University_StatusUpdate as t1 + LEFT JOIN T_Login as t2 ON t1.CreatedBy = t2.ID + LEFT JOIN T_StaffDetails as t3 ON t2.StaffID = t3.StaffID + WHERE FormIdDetailsID = '$searchDetails' ORDER BY t1.CreatedOn DESC "; $details = $this->db->query($selectQuery); $detailsList = $details->result(); if($detailsList) { @@ -1188,4 +1194,138 @@ $result['updatedraftStatus'] = false; return $result; } + // get university list + public function get_university_list($branch) { + $this->db->select('UniversityID, UniversityName'); + $this->db->order_by('CreatedOn', 'DESC'); + $this->db->from(UNIVERSITY); + $this->db->where('IsActive', 1); + $this->db->where('BranchCode', $branch); + $univDetails = $this->db->get(); + $universityDetails = $univDetails->result(); + if (count($universityDetails) > 0) { + $results['univList'] = true; + $results['university_details'] = $universityDetails; + } else { + $results['univList'] = false; + $results['message'] = 'No record found'; + } + return $results; + } + + public function getUnmatchedFormIdFeesDetails($localDetails, $getDetailsFor) { + + $searchUniv = $getDetailsFor['univCode']; + // echo $searchUniv;exit(); + $query = "select * + from T_FormId_FeeDetails_Received_From_University as t1 + where t1.FormID NOT IN (select FormID from T_Enrolment_Received_From_University) + and t1.UniversityID ='$searchUniv'"; + $details = $this->db->query($query); + $detailsList = $details->result(); + if($detailsList){ + $resultArr['unMatchedRecordDetails'] = $detailsList; + $resultArr['unMatchedRecordStatus'] = true; + $resultArr['unMatchedRecordFor'] = 'FormIDFile'; + $resultArr['message'] = "Successfully data generated"; + } else { + $resultArr['unMatchedRecordDetails'] = []; + $resultArr['unMatchedRecordStatus'] = false; + $resultArr['unMatchedRecordFor'] = 'FormIDFile'; + $resultArr['message'] = "No record found"; + } + return $resultArr; + } + + public function addFormIdListToAccountState($localDetails, $getDetailsFor){ + $localCreatedBy = $localDetails['localUserID']; + $time = date('Y-m-d H:i:s'); + $localCreatedOn = $time; + foreach($getDetailsFor as $row) { + $ids = $row['ID']; + $query = "SELECT t1.ID, t1.FormID, t1.Amount, t2.ApprovedDate , t2.CreatedOn ,t2.UniversityCode, t2.UniversityName + from T_FormId_FeeDetails_Received_From_University as t1 + LEFT JOIN T_Enrolment_Received_From_University as t2 ON t1.FormID = t2.FormID + WHERE t1.ID = '$ids'"; + $details = $this->db->query($query); + $detailsList = $details->result(); + if($detailsList){ + $arr['FormMapID'] = $detailsList[0]->ID; + $arr['FormID'] = $detailsList[0]->FormID; + $arr['CreditAmount'] = $detailsList[0]->Amount; + $ApprovedDate = date('y-m-d',strtotime($detailsList[0]->ApprovedDate)); + $CreatedOn = date('y-m-d',strtotime($detailsList[0]->CreatedOn)); + $arr['ApprovedDate'] = $ApprovedDate ? $ApprovedDate : $CreatedOn; + $arr['TypeID'] = 1; + $arr['TypeName'] = 'Credit'; + $arr['UniversityCode'] = $detailsList[0]->UniversityCode; + $arr['UniversityName'] = $detailsList[0]->UniversityName; + $arr['CreatedOn'] = $localCreatedOn; + $arr['CreatedBy'] = $localCreatedBy; + $this->db->insert('T_University_Credit_Debit', $arr); + if ($this->db->affected_rows() >= 1) { + $updateQuery = 'UPDATE `T_FormId_FeeDetails_Received_From_University` SET `AddToAccountStatus` = 1 WHERE `ID` = '.$ids; + $queryDetails = $this->db->query($updateQuery); + if ($this->db->affected_rows() == '1') { + $result['accountStateMoveStatus'] = true; + $result['accountStateMoveMessagae'] = "Updated Successfully."; + } else { + $result['accountStateMoveStatus'] = false; + $result['accountStateMoveMessagae'] = "Something went wrong."; + } + } else { + $result['accountStateMoveStatus'] = false; + $result['accountStateMoveMessagae'] = "Something went wrong."; + } + } else { + $result['accountStateMoveStatus'] = false; + $result['accountStateMoveMessagae'] = "Something went wrong."; + } + } + return $result; + } + + + // public function getUnmatchedFormDetails($reqType){ + // // $this->db->select('t1.*'); + // // $this->db->from('T_Enrolment_Received_From_University as t1'); + // // $this->db->join('T_Student_CourseDetails as t2', 't2.EnrollmentID = t1.EnrolmentNo'); + // if($reqType == 'EnrolmentIDFile'){ + // $query = "select * + // from T_Enrolment_Received_From_University as t1 + // where t1.EnrolmentNo NOT IN (select EnrollmentID from T_Student_CourseDetails)"; + // $details = $this->db->query($query); + // $detailsList = $details->result(); + // if($detailsList){ + // $resultArr['unMatchedRecordDetails'] = $detailsList; + // $resultArr['unMatchedRecordStatus'] = true; + // $resultArr['unMatchedRecordFor'] = 'EnrolmentIDFile'; + // $resultArr['message'] = "Successfully data generated"; + // } else { + // $resultArr['unMatchedRecordDetails'] = []; + // $resultArr['unMatchedRecordStatus'] = false; + // $resultArr['unMatchedRecordFor'] = 'EnrolmentIDFile'; + // $resultArr['message'] = "No record found"; + // } + // }else if($reqType == 'FormIDFile'){ + // $query = "select * + // from T_FormId_FeeDetails_Received_From_University as t1 + // where t1.FormID NOT IN (select FormID from T_Enrolment_Received_From_University)"; + // $details = $this->db->query($query); + // $detailsList = $details->result(); + // if($detailsList){ + // $resultArr['unMatchedRecordDetails'] = $detailsList; + // $resultArr['unMatchedRecordStatus'] = true; + // $resultArr['unMatchedRecordFor'] = 'FormIDFile'; + // $resultArr['message'] = "Successfully data generated"; + // } else { + // $resultArr['unMatchedRecordDetails'] = []; + // $resultArr['unMatchedRecordStatus'] = false; + // $resultArr['unMatchedRecordFor'] = 'FormIDFile'; + // $resultArr['message'] = "No record found"; + // } + // } + // return $resultArr; + // } + } \ No newline at end of file diff --git a/Apollo/assets/js/controllers/studentUnivFormIdFeeDetailsCtrl.js b/Apollo/assets/js/controllers/studentUnivFormIdFeeDetailsCtrl.js index 7f424922..e908a57a 100644 --- a/Apollo/assets/js/controllers/studentUnivFormIdFeeDetailsCtrl.js +++ b/Apollo/assets/js/controllers/studentUnivFormIdFeeDetailsCtrl.js @@ -37,6 +37,7 @@ app.controller('studentUnivFormIdFeeDetailsCtrl', ["$scope", "toaster", "$filter if (localDetails.localType === 'R004') { // $scope.getUniversityList(); $scope.getUniversitySearchList(); + $scope.getUniveesityListFromApp(); } else { ipCookie.remove('cookiechk'); $window.localStorage.clear(); @@ -47,11 +48,11 @@ app.controller('studentUnivFormIdFeeDetailsCtrl', ["$scope", "toaster", "$filter } - /*$scope.universityData = ''; - $scope.getUniversityList = function () { + $scope.universityData = ''; + $scope.getUniveesityListFromApp = function () { var empListreq = { method: 'POST', - url: apiPoint.url + 'getStudentUniversity/', + url: apiPoint.url + 'getUniversityCodeForFormDetailsGet/', headers: { 'Content-Type': 'application/json' }, @@ -65,7 +66,7 @@ app.controller('studentUnivFormIdFeeDetailsCtrl', ["$scope", "toaster", "$filter } else { } }); - }*/ + } // get University List $scope.universitySearchData = ''; $scope.getUniversitySearchList = function () { @@ -229,9 +230,12 @@ app.controller('studentUnivFormIdFeeDetailsCtrl', ["$scope", "toaster", "$filter } + $scope.formUploadUnivSelectID = { + 'univCode': '' + }; + $scope.receiveFormIdFeeDetails = function (details) { console.log(details); - var updateUniversityEnrolment = { method: 'POST', url: apiPoint.url + 'insertFormIdUnivFeeDetails/', @@ -240,7 +244,8 @@ app.controller('studentUnivFormIdFeeDetailsCtrl', ["$scope", "toaster", "$filter }, data: { localDetails: localDetail, - details: details + details: details, + univ: $scope.formUploadUnivSelectID } }; @@ -291,22 +296,26 @@ app.controller('studentUnivFormIdFeeDetailsCtrl', ["$scope", "toaster", "$filter }); } + + $scope.formIdMissMatchUnivSelectID = { + 'univCode': '' + }; + $scope.unMatchedLoadingStatus = false; // Get unmached details $scope.getUnmatchedRecord = function (ss) { $scope.unMatchedRecordDetails = ''; $scope.unMatchedNoRecordFound = false; $scope.unMatchedLoadingStatus = true; - var getDetailsFor = ss == 1 ? 'EnrolmentIDFile' : 'FormIDFile'; var getFeeCompareDetailsList = { method: 'POST', - url: apiPoint.url + 'getUnmatchedRecordDetails/', + url: apiPoint.url + 'getUnmatchedFormIdFeesDetails/', headers: { 'Content-Type': 'application/json' }, data: { localDetails: localDetail, - getDetailsFor: getDetailsFor + getDetailsFor: $scope.formIdMissMatchUnivSelectID } }; $http(getFeeCompareDetailsList).then(function (response) { @@ -404,7 +413,8 @@ app.controller('studentUnivFormIdFeeDetailsCtrl', ["$scope", "toaster", "$filter }, data: { localDetails: localDetail, - details : $scope.draftManualEntryDetails + details : $scope.draftManualEntryDetails, + univ: $scope.formUploadUnivSelectID } }; $http(addDraftDetailsList).then(function (response) { @@ -535,11 +545,17 @@ $scope.draftManualEntryDetails = { $scope.statusUpdateEditId = -1; $scope.statusUpdate = function(id){ $scope.statusUpdateEditId = id; + $scope.statusUpdateFormIdDetails = { + "Status": "", + "Comments": "" + } } + $scope.StatusListDetails = ''; $scope.getFormIdDetailsStatusListLoading = false; $scope.getFormIdDetailsStatusList = function(id){ + $scope.getFormIdDetailsStatusListLoading = true; var getFormIdDetailsStatusList = { method: 'POST', @@ -568,6 +584,13 @@ $scope.draftManualEntryDetails = { "Comments": "" } + $scope.resetStatusUpdateForm = function(){ + $scope.statusUpdateFormIdDetails = { + "Status": "", + "Comments": "" + } + } + $scope.addStatusUpdateDetails = function(id, formId){ var addStatusUpdateDetailsStatusList = { method: 'POST', @@ -598,4 +621,50 @@ $scope.draftManualEntryDetails = { }}); } + $scope.addToAccountState = function(id){ + + swal({ + title: "Are you sure?", + text: "You Want to Add this Record to Account State List!", + type: "warning", + showCancelButton: true, + confirmButtonColor: '#DD6B55', + confirmButtonText: 'Yes', + cancelButtonText: "No", + closeOnConfirm: false, + closeOnCancel: false + }, + function(isConfirm){ + if (isConfirm){ + var selectedItems = []; + function getUpdateDetails(id) { + this.ID = id; + } + let itemGetID = new getUpdateDetails(id); + selectedItems.push(itemGetID); + var addToAccountStateList = { + method: 'POST', + url: apiPoint.url + 'addToAccountStateList/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + localDetails: localDetail, + details : selectedItems + } + }; + $http(addToAccountStateList).then(function (response) { + if (response.data.accountStateMoveStatus == true) { + swal("", response.data.accountStateMoveMessagae, "success"); + $scope.onSubmit(); + } else { + swal("", response.data.accountStateMoveMessagae, "warning"); + + }}); + } else { + swal("Cancelled", "Your record not added to list :)", "error"); + } + }); + } + }]); diff --git a/Apollo/assets/views/student/studentUnivFormIdFeeDetails.html b/Apollo/assets/views/student/studentUnivFormIdFeeDetails.html index c9e7d398..109e1810 100644 --- a/Apollo/assets/views/student/studentUnivFormIdFeeDetails.html +++ b/Apollo/assets/views/student/studentUnivFormIdFeeDetails.html @@ -162,7 +162,8 @@ - + + {{p.FormID}} @@ -214,51 +215,81 @@ -
+

Loading...

-
-
+
+
-
-
+
+
+ Add Status + +
+
+ - + -
-
-
+
+ - +
+ +
+
+
+
+ {{addError}} + + + + + +
+
+
+ + +
+ +
\ No newline at end of file From 4980352f1de7c400456955c2abce973d4a5b2594 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Sat, 8 Sep 2018 20:14:00 +0530 Subject: [PATCH 08/14] university payment changes --- ...Receive_Enrolment_Fees_Univ_Controller.php | 21 ++++++++++++++ .../Receive_Enrolment_Fees_Univ_model.php | 28 +++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/Apollo/api/application/controllers/Receive_Enrolment_Fees_Univ_Controller.php b/Apollo/api/application/controllers/Receive_Enrolment_Fees_Univ_Controller.php index 94dc8585..c2cb6cff 100644 --- a/Apollo/api/application/controllers/Receive_Enrolment_Fees_Univ_Controller.php +++ b/Apollo/api/application/controllers/Receive_Enrolment_Fees_Univ_Controller.php @@ -446,6 +446,27 @@ class Receive_Enrolment_Fees_Univ_Controller extends REST_Controller { } } + /* + * get payment verfication details + * created by kms + * */ + public function paymentVerficationDetails_post(){ + $fromDetails['UniversityCode']=$this->post('universityID'); + $fromDetails['UniversityName']=$this->post('universityName'); + $getVerificationDetails=$this->receive_model->getPaymentVerificationDetails($fromDetails); + if($getVerificationDetails['status']==true){ + $this->response($getVerificationDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + + } + else if($getVerificationDetails['status']==false){ + $this->response($getVerificationDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code + + } + else{ + $this->response(['details' => 'No list were found', 'status' => false], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code + + } + } /* * add university payment details * created by kms diff --git a/Apollo/api/application/models/Receive_Enrolment_Fees_Univ_model.php b/Apollo/api/application/models/Receive_Enrolment_Fees_Univ_model.php index d1bddd1d..7c21481b 100644 --- a/Apollo/api/application/models/Receive_Enrolment_Fees_Univ_model.php +++ b/Apollo/api/application/models/Receive_Enrolment_Fees_Univ_model.php @@ -1327,6 +1327,34 @@ $result['updatedraftStatus'] = false; // } // return $resultArr; // } + /* + * get payment verification details + * created by kms + * */ + public function getPaymentVerificationDetails($search){ + $this->db->select('UNCD.ID,UNCD.FormMapID,UNCD.PaymentMapID,UNCD.FormID,UNCD.CreditAmount,UNCD.DebitAmount,UNCD.ApprovedDate,UNCD.UniversityCode,UNCD.UniversityName,UNCD.TypeID,ENU.EnrolmentNo'); + $this->db->from(UNIVERSITYCREDITDEBIY.' as UNCD'); + $this->db->join(FORMFEESRECEIVEDFROMUNIV.' as UNFR', 'UNFR.ID = UNCD.FormMapID','left'); + $this->db->join(UNIVERSITYPAYMENT.' as UNP', 'UNP.PID = UNCD.PaymentMapID','left'); + $this->db->join(ENROLMENTRECEIVEDFROMUNIV.' as ENU', 'ENU.FormID = UNFR.FormID','left'); + $this->db->order_by('UNCD.ApprovedDate','DESC'); + $this->db->where('UNCD.UniversityCode',$search['UniversityCode']); + $this->db->order_by('UNCD.UniversityName',$search['UniversityName']); + $details = $this->db->get(); + $resultArray=array(); + if($details->result()){ + $resultArray['status']=true; + $resultArray['details']=$details->result(); + + } + + else{ + $resultArray['status']=false; + $resultArray['details']="No list were found"; + } + return $resultArray; + + } /* * add payment details From e75fd5b9ee0d69c5498ac2fbc0ab1a8f77c0c2c3 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Sat, 8 Sep 2018 20:23:38 +0530 Subject: [PATCH 09/14] payment html changes --- .../application/models/Receive_Enrolment_Fees_Univ_model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Apollo/api/application/models/Receive_Enrolment_Fees_Univ_model.php b/Apollo/api/application/models/Receive_Enrolment_Fees_Univ_model.php index 7c21481b..8ebda10d 100644 --- a/Apollo/api/application/models/Receive_Enrolment_Fees_Univ_model.php +++ b/Apollo/api/application/models/Receive_Enrolment_Fees_Univ_model.php @@ -1332,7 +1332,7 @@ $result['updatedraftStatus'] = false; * created by kms * */ public function getPaymentVerificationDetails($search){ - $this->db->select('UNCD.ID,UNCD.FormMapID,UNCD.PaymentMapID,UNCD.FormID,UNCD.CreditAmount,UNCD.DebitAmount,UNCD.ApprovedDate,UNCD.UniversityCode,UNCD.UniversityName,UNCD.TypeID,ENU.EnrolmentNo'); + $this->db->select('UNCD.ID,UNCD.FormMapID,UNCD.PaymentMapID,UNCD.FormID,UNCD.CreditAmount,UNCD.DebitAmount,UNCD.ApprovedDate,UNCD.UniversityCode,UNCD.UniversityName,UNCD.TypeID,ENU.EnrolmentNo,UNP.BillNo,UNP.PID as PaymentID'); $this->db->from(UNIVERSITYCREDITDEBIY.' as UNCD'); $this->db->join(FORMFEESRECEIVEDFROMUNIV.' as UNFR', 'UNFR.ID = UNCD.FormMapID','left'); $this->db->join(UNIVERSITYPAYMENT.' as UNP', 'UNP.PID = UNCD.PaymentMapID','left'); From 9c495676091cd57b0f97af0c99c9624616b421a6 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Sat, 8 Sep 2018 20:23:48 +0530 Subject: [PATCH 10/14] payment html changes --- Apollo/assets/views/student/UnivFormPaymentDetails.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Apollo/assets/views/student/UnivFormPaymentDetails.html b/Apollo/assets/views/student/UnivFormPaymentDetails.html index d6ce30fc..eb2748c9 100644 --- a/Apollo/assets/views/student/UnivFormPaymentDetails.html +++ b/Apollo/assets/views/student/UnivFormPaymentDetails.html @@ -64,6 +64,7 @@ Form ID Enrolment No + Bill No Payable Paid Balance @@ -74,6 +75,7 @@ {{p.FormID}} {{p.EnrolmentNo}} + {{p.BillNo}} {{p.CreditAmount}} From 4aa5332c38119628850b2b9c848a2ed1b93025a1 Mon Sep 17 00:00:00 2001 From: dineshkumarkannan Date: Mon, 10 Sep 2018 10:34:59 +0530 Subject: [PATCH 11/14] university formid details changes : kdk --- ...Receive_Enrolment_Fees_Univ_Controller.php | 19 +- .../Receive_Enrolment_Fees_Univ_model.php | 24 +- .../studentUnivFormIdFeeDetailsCtrl.js | 335 +++++++++--------- .../student/studentUnivFormIdFeeDetails.html | 184 +++++----- 4 files changed, 307 insertions(+), 255 deletions(-) diff --git a/Apollo/api/application/controllers/Receive_Enrolment_Fees_Univ_Controller.php b/Apollo/api/application/controllers/Receive_Enrolment_Fees_Univ_Controller.php index c2cb6cff..01120c37 100644 --- a/Apollo/api/application/controllers/Receive_Enrolment_Fees_Univ_Controller.php +++ b/Apollo/api/application/controllers/Receive_Enrolment_Fees_Univ_Controller.php @@ -273,6 +273,8 @@ class Receive_Enrolment_Fees_Univ_Controller extends REST_Controller { } } + // get formid draft mode list details + // kdk public function getForFormIdDraftDetails_post(){ $reqBranch = $this->post('localDetails'); $getForFormIdDraftDetails = $this->receive_model->getForFormIdDraftDetails(); // Check if the employee exist @@ -288,6 +290,8 @@ class Receive_Enrolment_Fees_Univ_Controller extends REST_Controller { } } + // add formid manual details form the university and draftmode + // kdk public function addForFormIdDraftDetails_post(){ $reqBranch = $this->post('localDetails'); $details = $this->post('details'); @@ -306,6 +310,8 @@ class Receive_Enrolment_Fees_Univ_Controller extends REST_Controller { } } + // manual formid entry draft details move to the list details + // kdk public function draftMovetoList_post(){ $reqBranch = $this->post('localDetails'); $details = $this->post('details'); @@ -322,6 +328,8 @@ class Receive_Enrolment_Fees_Univ_Controller extends REST_Controller { } } + // edit draft mode formid manul entry details + // kdk public function editDraftFormIdFeesDetails_post(){ $reqBranch = $this->post('localDetails'); $details = $this->post('details'); @@ -341,7 +349,8 @@ class Receive_Enrolment_Fees_Univ_Controller extends REST_Controller { } } - // get formid fee details list with status + // get formid , fee details form the file upload for the university , course, student + // kdk public function getStudentUnivFormIdFeeDatailsList_post(){ $reqBranchData = $this->post('data'); $searchDetails = $this->post('search'); @@ -359,6 +368,8 @@ class Receive_Enrolment_Fees_Univ_Controller extends REST_Controller { } } + // get formid status list for that particular record + // kdk public function getFormIdDetailsStatusUpdateList_post(){ $reqBranchData = $this->post('localDetails'); $statusDetailsId = $this->post('detailsID'); @@ -376,6 +387,8 @@ class Receive_Enrolment_Fees_Univ_Controller extends REST_Controller { } } + // add formid list file status list for that record + // kdk public function insertStatusUpdateDetails_post(){ $reqBranchData = $this->post('localDetails'); $statusDetails = $this->post('details'); @@ -413,6 +426,8 @@ class Receive_Enrolment_Fees_Univ_Controller extends REST_Controller { } } + // get unmatched records of the formid file details , compare with file 1 + // kdk public function getUnmatchedFormIdFeesDetails_post(){ $localDetails = $this->post('localDetails'); $getDetailsFor = $this->post('getDetailsFor'); @@ -430,6 +445,8 @@ class Receive_Enrolment_Fees_Univ_Controller extends REST_Controller { } } + // add fromid university amount details to account state + // kdk public function addToAccountStateList_post(){ $localDetails = $this->post('localDetails'); $getDetailsFor = $this->post('details'); diff --git a/Apollo/api/application/models/Receive_Enrolment_Fees_Univ_model.php b/Apollo/api/application/models/Receive_Enrolment_Fees_Univ_model.php index 8ebda10d..e4c23cf8 100644 --- a/Apollo/api/application/models/Receive_Enrolment_Fees_Univ_model.php +++ b/Apollo/api/application/models/Receive_Enrolment_Fees_Univ_model.php @@ -367,7 +367,8 @@ class Receive_Enrolment_Fees_Univ_model extends CI_Model { return $finalArray; } - + // add student formid feedetails from the university by file upload , with check the unique entry + // kdk public function formIdFeeDetails($formFeeDetails=null,$local=null, $univ =null){ $localBranchID = $local['localBranchID']; $localUserID = $local['localUserID']; @@ -890,6 +891,8 @@ class Receive_Enrolment_Fees_Univ_model extends CI_Model { return $resultArray; } + // get formid draft mode list details + // kdk public function getForFormIdDraftDetails(){ $selectQuery = "SELECT * FROM T_FormId_FeeDetails_Received_From_University WHERE DraftStatus = 1"; $details = $this->db->query($selectQuery); @@ -906,6 +909,8 @@ class Receive_Enrolment_Fees_Univ_model extends CI_Model { return $result; } + // add formid manual details form the university and draftmode + // kdk public function addForFormIdDraftDetails($details, $local, $univ =null){ $localBranchID = $local['localBranchID']; @@ -988,6 +993,8 @@ class Receive_Enrolment_Fees_Univ_model extends CI_Model { return $result; } + // manual formid entry draft details move to the list details + // kdk public function draftMovetoList($detail, $local){ // print_r($details);exit(); @@ -1016,6 +1023,8 @@ class Receive_Enrolment_Fees_Univ_model extends CI_Model { return $result; } + // edit draft mode formid manul entry details + // kdk public function editDraftFormIdFeesDetails($reqBranch, $details, $detailsID){ $ids = $detailsID; $formIds = $details['FormID']; @@ -1085,6 +1094,8 @@ $result['updatedraftStatus'] = false; return $result; } + // get formid , fee details form the file upload for the university , course, student + // kdk public function getStudentUnivFormIdFeeDatailsList($reqBranchData, $searchDetails){ $this->db->select('FUD.*, concat(ST.FirstName," ", ST.Lastname) as app_StudentName, IF(concat(ST.FirstName," " , ST.Lastname) = FUD.Student_Name, "YES", "NO") as StudentNameStatus , @@ -1154,6 +1165,8 @@ $result['updatedraftStatus'] = false; } + // get formid status list for that particular record + // kdk public function getFormIdDetailsStatusUpdateList($reqBranchData, $searchDetails){ $selectQuery = "SELECT * , concat(t3.Firstname, '', t3.Lastname) as CreatedByName FROM T_FormId_FeeDetails_Received_From_University_StatusUpdate as t1 @@ -1174,6 +1187,8 @@ $result['updatedraftStatus'] = false; return $result; } + // add formid list file status list for that record + // kdk public function insertStatusUpdateDetails($reqBranchData, $statusDetails, $id, $formId ){ $newLeadDetails['FormIdDetailsID'] = $id; @@ -1194,7 +1209,8 @@ $result['updatedraftStatus'] = false; return $result; } - // get university list + // get university list for search + // kdk public function get_university_list($branch) { $this->db->select('UniversityID, UniversityName'); $this->db->order_by('CreatedOn', 'DESC'); @@ -1213,6 +1229,8 @@ $result['updatedraftStatus'] = false; return $results; } + // get unmatched records of the formid file details , compare with file 1 + // kdk public function getUnmatchedFormIdFeesDetails($localDetails, $getDetailsFor) { $searchUniv = $getDetailsFor['univCode']; @@ -1237,6 +1255,8 @@ $result['updatedraftStatus'] = false; return $resultArr; } + // Add formid , university amount payment details to the account state + // kdk public function addFormIdListToAccountState($localDetails, $getDetailsFor){ $localCreatedBy = $localDetails['localUserID']; $time = date('Y-m-d H:i:s'); diff --git a/Apollo/assets/js/controllers/studentUnivFormIdFeeDetailsCtrl.js b/Apollo/assets/js/controllers/studentUnivFormIdFeeDetailsCtrl.js index e908a57a..24c39d90 100644 --- a/Apollo/assets/js/controllers/studentUnivFormIdFeeDetailsCtrl.js +++ b/Apollo/assets/js/controllers/studentUnivFormIdFeeDetailsCtrl.js @@ -1,7 +1,6 @@ 'use strict'; /** - * controllers for ng-table - * Simple table with sorting and filtering on AngularJS + * Student University Formid, Fee details compare * kdk */ @@ -89,7 +88,7 @@ app.controller('studentUnivFormIdFeeDetailsCtrl', ["$scope", "toaster", "$filter }); }; - $scope.semDetails=["1","2","3","4","5","6","7","8"]; + $scope.semDetails = ["1", "2", "3", "4", "5", "6", "7", "8"]; $scope.searchData = { "University": "", @@ -164,15 +163,15 @@ app.controller('studentUnivFormIdFeeDetailsCtrl', ["$scope", "toaster", "$filter } } - $scope.myObj = { + $scope.myObj = { // "color" : "green", - "font-size" : "inherit" + "font-size": "inherit" } - $scope.myObjErr = { + $scope.myObjErr = { "text-decoration": "underline", "text-decoration-color": "red", - "font-size" : "inherit" + "font-size": "inherit" } $scope.editId = -1; @@ -296,7 +295,7 @@ app.controller('studentUnivFormIdFeeDetailsCtrl', ["$scope", "toaster", "$filter }); } - + $scope.formIdMissMatchUnivSelectID = { 'univCode': '' }; @@ -334,8 +333,8 @@ app.controller('studentUnivFormIdFeeDetailsCtrl', ["$scope", "toaster", "$filter // get subtab details for the formid fee details get form the university - $scope.subTabActive= function(tab){ - if( tab == 'subTabactive2'){ + $scope.subTabActive = function (tab) { + if (tab == 'subTabactive2') { getDraftFormIdDetails(); } } @@ -345,14 +344,14 @@ app.controller('studentUnivFormIdFeeDetailsCtrl', ["$scope", "toaster", "$filter 'FormID': '', 'FormType': 'NEW', 'CentreCode': '', - 'Session':'', - 'Year':'', - 'Semester':'', - 'Student_Name':'', - 'Father_Name':'', - 'CourseCode':'', - 'ActualCourseFee':'0', - 'CourseFee':'0', + 'Session': '', + 'Year': '', + 'Semester': '', + 'Student_Name': '', + 'Father_Name': '', + 'CourseCode': '', + 'ActualCourseFee': '0', + 'CourseFee': '0', 'ExamFee': '0', 'EnrollmentFee': '0', 'ProspectusFee': '0', @@ -361,7 +360,7 @@ app.controller('studentUnivFormIdFeeDetailsCtrl', ["$scope", "toaster", "$filter 'LateralEntryFee': '0', 'DualSpclFee': '0', 'OtherFee': '0', - 'NRIFEE':'0', + 'NRIFEE': '0', 'ProvisionalFee': '0', 'MigrationFee': '0', 'UrgentResultDMCFee': '0', @@ -369,12 +368,12 @@ app.controller('studentUnivFormIdFeeDetailsCtrl', ["$scope", "toaster", "$filter 'Amount': '0' } - + $scope.draftListDetails = ''; $scope.draftListDetailsNoRecordFound = false; $scope.draftListDetailsLoading = false; // get draft form id details - function getDraftFormIdDetails(){ + function getDraftFormIdDetails() { $scope.draftListDetailsLoading = true; $scope.draftListDetailsNoRecordFound = false; $scope.draftListDetails = ''; @@ -402,8 +401,8 @@ app.controller('studentUnivFormIdFeeDetailsCtrl', ["$scope", "toaster", "$filter // manual entry details add - $scope.addManualData = function() { - alert(JSON.stringify($scope.draftManualEntryDetails)); + $scope.addManualData = function () { + // alert(JSON.stringify($scope.draftManualEntryDetails)); var addDraftDetailsList = { method: 'POST', @@ -413,7 +412,7 @@ app.controller('studentUnivFormIdFeeDetailsCtrl', ["$scope", "toaster", "$filter }, data: { localDetails: localDetail, - details : $scope.draftManualEntryDetails, + details: $scope.draftManualEntryDetails, univ: $scope.formUploadUnivSelectID } }; @@ -430,93 +429,96 @@ app.controller('studentUnivFormIdFeeDetailsCtrl', ["$scope", "toaster", "$filter }); } - function getEmptycall(){ -$scope.draftManualEntryDetails = { - 'FormID': '', - 'FormType': 'NEW', - 'CentreCode': '', - 'Session':'', - 'Year':'', - 'Semester':'', - 'Student_Name':'', - 'Father_Name':'', - 'CourseCode':'', - 'ActualCourseFee':'0', - 'CourseFee':'0', - 'ExamFee': '0', - 'EnrollmentFee': '0', - 'ProspectusFee': '0', - 'ReRegFee': '0', - 'CreditTransferFee': '0', - 'LateralEntryFee': '0', - 'DualSpclFee': '0', - 'OtherFee': '0', - 'NRIFEE':'0', - 'ProvisionalFee': '0', - 'MigrationFee': '0', - 'UrgentResultDMCFee': '0', - 'AdditionalFee': '0', - 'Amount': '0' + function getEmptycall() { + $scope.draftManualEntryDetails = { + 'FormID': '', + 'FormType': 'NEW', + 'CentreCode': '', + 'Session': '', + 'Year': '', + 'Semester': '', + 'Student_Name': '', + 'Father_Name': '', + 'CourseCode': '', + 'ActualCourseFee': '0', + 'CourseFee': '0', + 'ExamFee': '0', + 'EnrollmentFee': '0', + 'ProspectusFee': '0', + 'ReRegFee': '0', + 'CreditTransferFee': '0', + 'LateralEntryFee': '0', + 'DualSpclFee': '0', + 'OtherFee': '0', + 'NRIFEE': '0', + 'ProvisionalFee': '0', + 'MigrationFee': '0', + 'UrgentResultDMCFee': '0', + 'AdditionalFee': '0', + 'Amount': '0' + } + return 0; } - return 0; -} - $scope.addToList = function(id){ - swal({ - title: "Are you sure?", - text: "You Want to Add this Record to List!", - type: "warning", - showCancelButton: true, - confirmButtonColor: '#DD6B55', - confirmButtonText: 'Yes', - cancelButtonText: "No", - closeOnConfirm: false, - closeOnCancel: false - }, - function(isConfirm){ - if (isConfirm){ - var selectedItems = []; - function getUpdateDetails(id) { - this.ID = id; - this.DraftStatus = 0; - } - let itemGetID = new getUpdateDetails(id); - selectedItems.push(itemGetID); - var draftMoveToList = { - method: 'POST', - url: apiPoint.url + 'draftMovetoList/', - headers: { - 'Content-Type': 'application/json' - }, - data: { - localDetails: localDetail, - details : selectedItems + // add draft details to list + $scope.addToList = function (id) { + swal({ + title: "Are you sure?", + text: "You Want to Add this Record to List!", + type: "warning", + showCancelButton: true, + confirmButtonColor: '#DD6B55', + confirmButtonText: 'Yes', + cancelButtonText: "No", + closeOnConfirm: false, + closeOnCancel: false + }, + function (isConfirm) { + if (isConfirm) { + var selectedItems = []; + function getUpdateDetails(id) { + this.ID = id; + this.DraftStatus = 0; } - }; - $http(draftMoveToList).then(function (response) { - if (response.data.draftStatus == true) { - // alert(); - swal("", response.data.draftDetailsMessagae, "success"); - getDraftFormIdDetails(); - } else { - swal("", response.data.draftDetailsMessagae, "warning"); - - }}); + let itemGetID = new getUpdateDetails(id); + selectedItems.push(itemGetID); + var draftMoveToList = { + method: 'POST', + url: apiPoint.url + 'draftMovetoList/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + localDetails: localDetail, + details: selectedItems + } + }; + $http(draftMoveToList).then(function (response) { + if (response.data.draftStatus == true) { + // alert(); + swal("", response.data.draftDetailsMessagae, "success"); + getDraftFormIdDetails(); + } else { + swal("", response.data.draftDetailsMessagae, "warning"); + + } + }); } else { - swal("Cancelled", "Your record not added to list :)", "error"); + swal("Cancelled", "Your record not added to list :)", "error"); } }); } $scope.editId = -1; $scope.leader = {}; - $scope.editList = function(details, d){ + $scope.editList = function (details, d) { $scope.leader = {}; angular.copy(d, $scope.leader); $scope.editId = details; } - $scope.updateFeeIDDetails = function(id, p){ + // update feeid details in draft mode + $scope.updateFeeIDDetails = function (id, p) { var editDraftMoveToList = { method: 'POST', url: apiPoint.url + 'editDraftFormIdFeesDetails/', @@ -525,7 +527,7 @@ $scope.draftManualEntryDetails = { }, data: { localDetails: localDetail, - details : p, + details: p, detailsID: id } }; @@ -535,27 +537,29 @@ $scope.draftManualEntryDetails = { swal("", response.data.updatedraftDetailsMessagae, "success"); getDraftFormIdDetails(); $scope.editId = -1; - $scope.leader = {}; + $scope.leader = {}; } else { swal("", response.data.updatedraftDetailsMessagae, "warning"); - - }}); + + } + }); } $scope.statusUpdateEditId = -1; - $scope.statusUpdate = function(id){ + $scope.statusUpdate = function (id) { $scope.statusUpdateEditId = id; - $scope.statusUpdateFormIdDetails = { + $scope.statusUpdateFormIdDetails = { "Status": "", "Comments": "" } } - $scope.StatusListDetails = ''; + $scope.StatusListDetails = ''; $scope.getFormIdDetailsStatusListLoading = false; - $scope.getFormIdDetailsStatusList = function(id){ - + // formid records status details + $scope.getFormIdDetailsStatusList = function (id) { + $scope.getFormIdDetailsStatusListLoading = true; var getFormIdDetailsStatusList = { method: 'POST', @@ -565,18 +569,19 @@ $scope.draftManualEntryDetails = { }, data: { localDetails: localDetail, - detailsID : id + detailsID: id } }; $http(getFormIdDetailsStatusList).then(function (response) { if (response.data.formIdstatusListStatus == true) { - $scope.getFormIdDetailsStatusListLoading = false; + $scope.getFormIdDetailsStatusListLoading = false; $scope.StatusListDetails = response.data.formIdstatusListDetails; } else { - $scope.getFormIdDetailsStatusListLoading = false; + $scope.getFormIdDetailsStatusListLoading = false; $scope.StatusListDetails = response.data.formIdstatusListDetails; $scope.StatusListDetailsApiMessage = response.data.formIdstatusListMessagae; - }}); + } + }); } $scope.statusUpdateFormIdDetails = { @@ -584,14 +589,16 @@ $scope.draftManualEntryDetails = { "Comments": "" } - $scope.resetStatusUpdateForm = function(){ - $scope.statusUpdateFormIdDetails = { + $scope.resetStatusUpdateForm = function () { + $scope.statusUpdateFormIdDetails = { "Status": "", "Comments": "" } } - $scope.addStatusUpdateDetails = function(id, formId){ + // add status for the formid record details + // kdk + $scope.addStatusUpdateDetails = function (id, formId) { var addStatusUpdateDetailsStatusList = { method: 'POST', url: apiPoint.url + 'insertStatusUpdateDetails/', @@ -600,69 +607,73 @@ $scope.draftManualEntryDetails = { }, data: { localDetails: localDetail, - details : $scope.statusUpdateFormIdDetails, + details: $scope.statusUpdateFormIdDetails, id: id, - formId : formId + formId: formId } }; $http(addStatusUpdateDetailsStatusList).then(function (response) { if (response.data.insertStatusUpdateDetailsStatus == true) { - $scope.statusUpdateFormIdDetails = { - "Status": "", - "Comments": "" - } - $scope.statusUpdateEditId = -1; - swal("", response.data.insertStatusUpdateDetailsMessagae, "success"); - } else { - swal("", response.data.insertStatusUpdateDetailsMessagae, "success"); + $scope.statusUpdateFormIdDetails = { + "Status": "", + "Comments": "" + } + $scope.statusUpdateEditId = -1; + swal("", response.data.insertStatusUpdateDetailsMessagae, "success"); + } else { + swal("", response.data.insertStatusUpdateDetailsMessagae, "success"); // $scope.getFormIdDetailsStatusListLoading = false; // $scope.StatusListDetails = response.data.formIdstatusListDetails; // $scope.StatusListDetailsApiMessage = response.data.formIdstatusListMessagae; - }}); + } + }); } - $scope.addToAccountState = function(id){ + // add formid list details to account state + // kdk + $scope.addToAccountState = function (id) { - swal({ - title: "Are you sure?", - text: "You Want to Add this Record to Account State List!", - type: "warning", - showCancelButton: true, - confirmButtonColor: '#DD6B55', - confirmButtonText: 'Yes', - cancelButtonText: "No", - closeOnConfirm: false, - closeOnCancel: false - }, - function(isConfirm){ - if (isConfirm){ - var selectedItems = []; - function getUpdateDetails(id) { - this.ID = id; - } - let itemGetID = new getUpdateDetails(id); - selectedItems.push(itemGetID); - var addToAccountStateList = { - method: 'POST', - url: apiPoint.url + 'addToAccountStateList/', - headers: { - 'Content-Type': 'application/json' - }, - data: { - localDetails: localDetail, - details : selectedItems + swal({ + title: "Are you sure?", + text: "You Want to Add this Record to Account State List!", + type: "warning", + showCancelButton: true, + confirmButtonColor: '#DD6B55', + confirmButtonText: 'Yes', + cancelButtonText: "No", + closeOnConfirm: false, + closeOnCancel: false + }, + function (isConfirm) { + if (isConfirm) { + var selectedItems = []; + function getUpdateDetails(id) { + this.ID = id; } - }; - $http(addToAccountStateList).then(function (response) { - if (response.data.accountStateMoveStatus == true) { - swal("", response.data.accountStateMoveMessagae, "success"); - $scope.onSubmit(); - } else { - swal("", response.data.accountStateMoveMessagae, "warning"); - - }}); + let itemGetID = new getUpdateDetails(id); + selectedItems.push(itemGetID); + var addToAccountStateList = { + method: 'POST', + url: apiPoint.url + 'addToAccountStateList/', + headers: { + 'Content-Type': 'application/json' + }, + data: { + localDetails: localDetail, + details: selectedItems + } + }; + $http(addToAccountStateList).then(function (response) { + if (response.data.accountStateMoveStatus == true) { + swal("", response.data.accountStateMoveMessagae, "success"); + $scope.onSubmit(); + } else { + swal("", response.data.accountStateMoveMessagae, "warning"); + + } + }); } else { - swal("Cancelled", "Your record not added to list :)", "error"); + swal("Cancelled", "Your record not added to list :)", "error"); } }); } diff --git a/Apollo/assets/views/student/studentUnivFormIdFeeDetails.html b/Apollo/assets/views/student/studentUnivFormIdFeeDetails.html index b9ff5667..7072f594 100644 --- a/Apollo/assets/views/student/studentUnivFormIdFeeDetails.html +++ b/Apollo/assets/views/student/studentUnivFormIdFeeDetails.html @@ -5,7 +5,7 @@

{{ mainTitle }}

Student University FormId Fees Details.
- +
@@ -105,7 +105,7 @@ - @@ -147,23 +147,23 @@ - - - - - + --> - + + + + + + + + + + + +
Action + Action FormID NRIFEE ProvisionalFee + ProvisionalFee MigrationFee + MigrationFee UrgentResultDMCFee + UrgentResultDMCFee AdditionalFee - Amount + AdditionalFee + Amount
- - + + {{p.FormID}} @@ -184,10 +184,10 @@ {{p.Semester}} - {{p.Student_Name}} + {{p.Student_Name}} - {{p.Father_Name}} + {{p.Father_Name}} {{p.CourseCode}} @@ -213,15 +213,16 @@
- -
-
-
-

Loading...

-
- -
+
+ +
+
+
+

Loading...

+
+
+ +
@@ -253,7 +254,8 @@
-
- - - - - - - - - - - - -
FormIDStatusCommentsUpdated On
{{s.FormID}}{{s.Status}}{{s.Comments}}{{s.CreatedOn}}
+
FormIDStatusCommentsUpdated On
{{s.FormID}}{{s.Status}}{{s.Comments}}{{s.CreatedOn}}
-
-

{{StatusListDetailsApiMessage}}

-
-
-
-
- +
+
+

{{StatusListDetailsApiMessage}}

-
- - +
+
+
+ +
+
+
+ + +
- - +
+
- -
- +
@@ -443,7 +447,7 @@ UrgentResultDMCFee AdditionalFee Amount - + @@ -471,7 +475,7 @@ {{p.DualSpclFee}} {{p.OtherFee}} {{p.NRIFEE}} - {{p.ProvisionalFee}} + {{p.ProvisionalFee}} {{p.MigrationFee}} {{p.UrgentResultDMCFee}} {{p.AdditionalFee}} @@ -485,76 +489,76 @@ - +
- +
- +
- +
-
+
- +
- +
-
- +
+
- +
- +
- +
- +
- +
- +
@@ -562,76 +566,76 @@ - +
- +
- +
- +
- +
- +
- +
- +
- +
-
+
- +
- +
- +
- +
@@ -639,7 +643,7 @@ - +
@@ -662,7 +666,7 @@
- +
- -
@@ -778,8 +782,8 @@ +
- - \ No newline at end of file + \ No newline at end of file From 988991dfea00eb5ab1a57fcb6f7069579c529eac Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Mon, 10 Sep 2018 11:43:43 +0530 Subject: [PATCH 12/14] feestatus control_bala --- Apollo/assets/js/controllers/feesStatusCtrl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Apollo/assets/js/controllers/feesStatusCtrl.js b/Apollo/assets/js/controllers/feesStatusCtrl.js index 5634d7b2..d498a33b 100755 --- a/Apollo/assets/js/controllers/feesStatusCtrl.js +++ b/Apollo/assets/js/controllers/feesStatusCtrl.js @@ -1389,7 +1389,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n } else { - startPayableAmt = Math.round(startPayableAmt / 10) * 10; + startPayableAmt = Math.round(startPayableAmt); $scope.updateMoreItems.push({ ID: "", Name: installmentService.installmentWords(i), From a5633be534b700a0f5a9a4a301b3034c15f22fea Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Mon, 10 Sep 2018 11:45:28 +0530 Subject: [PATCH 13/14] batch comtroller bala --- Apollo/api/application/controllers/Batch_Controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Apollo/api/application/controllers/Batch_Controller.php b/Apollo/api/application/controllers/Batch_Controller.php index 9a77c55b..9124550c 100755 --- a/Apollo/api/application/controllers/Batch_Controller.php +++ b/Apollo/api/application/controllers/Batch_Controller.php @@ -44,7 +44,7 @@ class Batch_Controller extends REST_Controller { $details['IsActive'] = $this->post('status'); $details['BranchCode'] = $this->post('branchCode'); $details['CreatedOn'] = $now->format('Y-m-d H:i:s'); - print_r( $details +'samplearray'); + //print_r( $details +'samplearray'); $batchDetails = $this->batch_model->addBatch($details);// Check if the users data store contains users (in case the database result returns NULL) if ($batchDetails) From a1439385c9a50f72ab034d592dc290b9c82a13c1 Mon Sep 17 00:00:00 2001 From: gayathri1990 Date: Mon, 10 Sep 2018 12:05:39 +0530 Subject: [PATCH 14/14] setfees --- Apollo/assets/js/controllers/feesStatusCtrl.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Apollo/assets/js/controllers/feesStatusCtrl.js b/Apollo/assets/js/controllers/feesStatusCtrl.js index 5634d7b2..f5464221 100755 --- a/Apollo/assets/js/controllers/feesStatusCtrl.js +++ b/Apollo/assets/js/controllers/feesStatusCtrl.js @@ -865,9 +865,9 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n }; $http(setFees).then(function (response) { if (response.data.status==200 && response.data.feesStatus) { - + $scope.masterSessionDetails = response.data.sessionDetails; - + // service call for session master list in desc order based on date angular.forEach($scope.masterSessionDetails,function (fvalue,fkey) { var parts = fvalue.SessionDate.split("-"); @@ -1070,8 +1070,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n else{ $scope.convertGetDate=new Date($rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].DueDate).toDateString(); $scope.pushDueDate = $filter('date')(new Date($scope.convertGetDate), 'dd-MM-yyyy'); - - } + } var MoreInsAmt= Math.round($rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].Amount * 50 / 100); var afterMoreInsAmt = parseInt($rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].Amount)-parseInt(MoreInsAmt); $rootScope.updateMoreItems[$rootScope.updateMoreItems.length-1].Amount = MoreInsAmt; @@ -1374,8 +1373,9 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n startPayableAmt = parseInt(totAmt); var percentage = Math.round(startPayableAmt * 70 / 100); percentage = Math.round(percentage / 10) * 10; + startPayableAmt = startPayableAmt - percentage; - + // alert(startPayableAmt); $scope.insFirstDate = $filter('date')(new Date(cDate), 'dd-MM-yyyy'); $scope.insSecondDate = $filter('date')(new Date(cDate), 'dd-MM-yyyy'); @@ -1389,7 +1389,7 @@ app.controller('feesStatusCtrl', ["$scope","$rootScope","toaster", "$filter", "n } else { - startPayableAmt = Math.round(startPayableAmt / 10) * 10; + startPayableAmt = Math.round(startPayableAmt); $scope.updateMoreItems.push({ ID: "", Name: installmentService.installmentWords(i),