diff --git a/Apollo/api/application/controllers/HallTickets_Controller.php b/Apollo/api/application/controllers/HallTickets_Controller.php index 636532ae..0a895003 100644 --- a/Apollo/api/application/controllers/HallTickets_Controller.php +++ b/Apollo/api/application/controllers/HallTickets_Controller.php @@ -600,7 +600,7 @@ class HallTickets_Controller extends REST_Controller { $UID = $this->post('university'); $courseID = $this->post('course'); $batch = $this->post('batch'); - $requestedBy = $this->post('requestedBy'); + $requestedBy = $this->post('requestedDept'); $branchId = $this->post('branchId'); $center = $this->post('center'); //print_r($center);die(); diff --git a/Apollo/api/application/models/Hallticket_model.php b/Apollo/api/application/models/Hallticket_model.php index f56489e1..4ceb3eb4 100644 --- a/Apollo/api/application/models/Hallticket_model.php +++ b/Apollo/api/application/models/Hallticket_model.php @@ -855,7 +855,7 @@ public function getSubjectMappingDetails($universityID,$courseIDS,$branchId) { $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,BalFees.balpayable,BalFees.semyr,T_Student_CourseDetails.CourseID as CourseID,T_CourseMaster.CourseName, + $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,BalFees.balpayable,BalFees.semyr,T_Student_CourseDetails.CourseID as CourseID,T_CourseMaster.CourseName,T_Student_CourseDetails.UniversityID, if(substr(substr(BalFees.semyr, -4), 1, 3) = "sem", substr(BalFees.semyr, -1), if(substr(substr(BalFees.semyr, -5), 1, 4) = "year", substr(BalFees.semyr, -1), false)) as SemID, if(substr(substr(BalFees.semyr, -4), 1, 3) = "sem", "SEM", @@ -883,6 +883,7 @@ BalFees.semyr'); //print_r($this->db->last_query()); die(); $result_array = array(); + $Course_array = array(); if(count($data) > 0) { $result_array = array(); @@ -910,6 +911,7 @@ BalFees.semyr'); $studetdetails['SemID'] =$r->SemID; $result_array[] = $studetdetails; $prestu = $r->StudentID; + array_push($Course_array,$course); //} @@ -921,10 +923,164 @@ BalFees.semyr'); // print_r($this->db->last_query()); die(); + //attendance save data start + + $this->saveDataForExamAttendance($UID,$courseID=null,$batch,$requestedBy,$branchId,$center,$data,$Course_array,$result_array); + + //attendance end + //print_r($result_array);die(); return $result_array; } + + + + function saveDataForExamAttendance($UID,$courseID=null,$batch,$requestedBy,$branchId,$center,$data,$Course_array,$result_array) + { + + $Course_array = array_unique($Course_array); + //print_r($result_array);die(); + $HallticketIDarray=[]; + + foreach ($Course_array as $keyy => $vvalue) + { + + $Ava_courseId = $vvalue; + $MASTERID = '00'; + + $this->db->select('HallTicket_ID'); + $this->db->from('T_Hallticket_Master'); + $this->db->where('UniversityID',$UID['universityID']); + $this->db->where('CourseID',$Ava_courseId); + $this->db->where('BatchCode',$batch); + $this->db->where('CenterID',$center['CenterID']); + $this->db->where('BranchCode',$branchId); + $isExist = $this->db->get(); + $isExist = $isExist->result_array(); + + + + + + if(!empty($isExist[0]['HallTicket_ID'])) + { + array_push($HallticketIDarray,$isExist[0]['HallTicket_ID']); + + } + + else + { + $masterArray = array('UniversityID'=>$UID['universityID'],'CourseID'=>$Ava_courseId,'BatchCode'=>$batch,'BranchCode'=>$branchId,'CreatedBy'=>$requestedBy,'CenterID'=>$center['CenterID']); + $this->db->trans_start(); + $this->db->insert('T_Hallticket_Master',$masterArray); + $MASTERID = $this->db->insert_id(); + $this->db->trans_complete(); + + + array_push($HallticketIDarray,$MASTERID); + } + + + } +//print_r($HallticketIDarray); + + foreach ($result_array as $key => $value) + { + //print_r($value); + //echo $value['CourseID']; + foreach ($HallticketIDarray as $keyy => $vval) + { + $HallId = $vval; + + $this->db->select('*'); + $this->db->from('T_Hallticket_Master'); + $this->db->join('T_Student_CourseDetails','T_Student_CourseDetails.UniversityID=T_Hallticket_Master.UniversityID and T_Student_CourseDetails.CourseID=T_Hallticket_Master.CourseID'); + $this->db->where('T_Student_CourseDetails.StudentID',$value['StudentID']); + $this->db->where('T_Hallticket_Master.HallTicket_ID',$HallId); + $this->db->where('T_Student_CourseDetails.UniversityID',$UID['universityID']); + $this->db->where('T_Student_CourseDetails.CourseID',$value['CourseID']); + //$this->db->where('BatchCode'); + + $studentcheck = $this->db->get(); + + // print_r($this->db->last_query()); + + if($studentcheck ->result()) + { //echo 'in'; + $this->db->select('*'); + $this->db->from('T_Hallticket_Student_Details'); + $this->db->where('Hallticket_ID',$HallId); + $this->db->where('StudentID',$value['StudentID']); + + $check = $this->db->get(); + + //print_r($check->result()); + //echo count($check); + if(count($check)>0) + { + + $tempArray = array('Hallticket_ID'=>$HallId,'StudentID'=>$value['StudentID'],'EnrollmentID'=>$value['EnrollmentID'],'Sem_Year'=>$value['semyr']); + + $this->db->trans_start(); + $this->db->insert('T_Hallticket_Student_Details',$tempArray); + $HallTicketStudentID = $this->db->insert_id(); + $HallTicketStudentID = $this->db->insert_id(); + $this->db->trans_complete(); + + $semid=substr($value['semyr'], -1); + + +//echo $semid; + $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 + where SemesterID= ? + group by T_Batch_Schedule_Child.SubjectID + order by T_Batch_Schedule_Child.ScheduleDate"; + $res = $this->db->query($sql,array($UID['universityID'],$value['CourseID'],$semid,$branchId,$UID['universityID'],$value['CourseID'],$branchId,$semid)); + + + $res= $res->result(); + + foreach ($res as $keyres => $valueres) + { + + $tempSubjectArray = array('HallTicket_Student_ID'=>$HallTicketStudentID,'SubjectCode'=>$valueres->SubjectID,'ExamDate'=>$valueres->ScheduleDate,'FromTime'=>$valueres->FromTime,'EndTime'=>$valueres->ToTime); + + $this->db->trans_start(); + $this->db->insert('T_Hallticket_Subject_Details',$tempSubjectArray); + $this->db->trans_complete(); + + } + + } + + } + } + + } +return true; + + } + + + + + + + + + + + + + + + + function getFeeSemesterDetails($stuid,$bcode,$branchId,$courseID) { $this->db->distinct(); @@ -984,7 +1140,7 @@ BalFees.semyr'); 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 group by T_Batch_Schedule_Child.SubjectID order by T_Batch_Schedule_Child.ScheduleDate"; - $res = $this->db->query($sql,array($UID['universityID'],$loopcourseID,$ind['SemID'],$branchId,$UID['universityID'],$loopcourseID,$branchId)); + $res = $this->db->query($sql,array($UID['universityID'],$id['CourseID'],$ind['SemID'],$branchId,$UID['universityID'],$loopcourseID,$branchId)); //$id['FeeDetails'][$key2] = $res->result(); $in = $res->result(); //array_push($id['FeeDetails'][$key2],$ind);