diff --git a/Apollo/api/application/controllers/HallTickets_Controller.php b/Apollo/api/application/controllers/HallTickets_Controller.php index fd8a10b2..636532ae 100644 --- a/Apollo/api/application/controllers/HallTickets_Controller.php +++ b/Apollo/api/application/controllers/HallTickets_Controller.php @@ -634,7 +634,7 @@ class HallTickets_Controller extends REST_Controller { $centerName = $this->post('centerName'); $res['UniversityDetails'] = $this->Hallticket_model->getUniversityDetials($UID,$branchId); - $res['studentDetails'] = $this->Hallticket_model->getStudentDetails($UID,$branchId,$studentIDs,$centerName,$batch,$requestedBy); + $res['studentDetails'] = $this->Hallticket_model->getStudentDetails($UID,$courseID,$branchId,$studentIDs,$centerName,$batch,$requestedBy); if(count($res['UniversityDetails']) != 0 || count($res['studentDetails']) != 0 ) diff --git a/Apollo/api/application/models/Hallticket_model.php b/Apollo/api/application/models/Hallticket_model.php index 65a934ba..944df02b 100644 --- a/Apollo/api/application/models/Hallticket_model.php +++ b/Apollo/api/application/models/Hallticket_model.php @@ -851,7 +851,7 @@ public function getSubjectMappingDetails($universityID,$courseIDS,$branchId) } - public function getStudentListForHallTicketmodel($UID,$courseID,$batch,$requestedBy,$branchId,$center) + public function getStudentListForHallTicketmodel($UID,$courseID=null,$batch,$requestedBy,$branchId,$center) { $this->db->distinct(); @@ -947,15 +947,22 @@ $studetdetails['CourseName'] = $r->CourseName; return $res->result(); } - //Student Details with All Corresponding Semesters and Subjects - public function getStudentDetails($UID,$branchId,$studentIDs,$centerName,$batch,$requestedBy) + public function getStudentDetails($UID,$courseID,$branchId,$studentIDs,$centerName,$batch,$requestedBy) { - + //print_r($studentIDs);die(); + + //echo $courseID.'course';die(); + $a=array(); foreach($studentIDs as $key1 => $id) { - $courseID= $id['CourseID']; + $loopcourseID= $id['CourseID']; + + // $a=array(); + array_push($a,$loopcourseID); + + // echo $courseID; foreach($id['FeeDetails'] as $key2 => $ind) { // Get Normel Semester @@ -967,9 +974,8 @@ $studetdetails['CourseName'] = $r->CourseName; 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 - group by T_Batch_Schedule_Child.SubjectID order by T_Batch_Schedule_Child.ScheduleDate"; - $res = $this->db->query($sql,array($UID['universityID'],$courseID,$ind['SemID'],$branchId,$UID['universityID'],$courseID,$branchId)); + $res = $this->db->query($sql,array($UID['universityID'],$loopcourseID,$ind['SemID'],$branchId,$UID['universityID'],$loopcourseID,$branchId)); //$id['FeeDetails'][$key2] = $res->result(); $in = $res->result(); //array_push($id['FeeDetails'][$key2],$ind); @@ -991,9 +997,8 @@ $studetdetails['CourseName'] = $r->CourseName; 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 - group by T_Batch_Schedule_Child.SubjectID order by T_Batch_Schedule_Child.ScheduleDate"; - $res = $this->db->query($sql,array($UID['universityID'],$courseID,$i,$branchId,$UID['universityID'],$courseID,$branchId)); + $res = $this->db->query($sql,array($UID['universityID'],$loopcourseID,$i,$branchId,$UID['universityID'],$loopcourseID,$branchId)); //$id['FeeDetails'][$key2] = $res->result(); $in1[] = $res->result(); //array_push($id['FeeDetails'][$key2],$ind); @@ -1014,9 +1019,8 @@ $studetdetails['CourseName'] = $r->CourseName; 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 - group by T_Batch_Schedule_Child.SubjectID order by T_Batch_Schedule_Child.ScheduleDate"; - $res = $this->db->query($sql,array($UID['universityID'],$courseID,$j,$branchId,$UID['universityID'],$courseID,$branchId)); + $res = $this->db->query($sql,array($UID['universityID'],$loopcourseID,$j,$branchId,$UID['universityID'],$loopcourseID,$branchId)); //$id['FeeDetails'][$key2] = $res->result(); $in2[] = $res->result(); //array_push($id['FeeDetails'][$key2],$ind); @@ -1037,9 +1041,8 @@ $studetdetails['CourseName'] = $r->CourseName; 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 - group by T_Batch_Schedule_Child.SubjectID order by T_Batch_Schedule_Child.ScheduleDate"; - $res = $this->db->query($sql,array($UID['universityID'],$courseID,$k,$branchId,$UID['universityID'],$courseID,$branchId)); + $res = $this->db->query($sql,array($UID['universityID'],$loopcourseID,$k,$branchId,$UID['universityID'],$loopcourseID,$branchId)); //$id['FeeDetails'][$key2] = $res->result(); $in3[] = $res->result(); //array_push($id['FeeDetails'][$key2],$ind); @@ -1060,9 +1063,8 @@ $studetdetails['CourseName'] = $r->CourseName; 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 - group by T_Batch_Schedule_Child.SubjectID order by T_Batch_Schedule_Child.ScheduleDate"; - $res = $this->db->query($sql,array($UID['universityID'],$courseID,$l,$branchId,$UID['universityID'],$courseID,$branchId)); + $res = $this->db->query($sql,array($UID['universityID'],$loopcourseID,$l,$branchId,$UID['universityID'],$loopcourseID,$branchId)); //$id['FeeDetails'][$key2] = $res->result(); $in4[] = $res->result(); //array_push($id['FeeDetails'][$key2],$ind); @@ -1084,9 +1086,8 @@ $studetdetails['CourseName'] = $r->CourseName; 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 - group by T_Batch_Schedule_Child.SubjectID order by T_Batch_Schedule_Child.ScheduleDate"; - $res = $this->db->query($sql,array($UID['universityID'],$courseID,$m,$branchId,$UID['universityID'],$courseID,$branchId)); + $res = $this->db->query($sql,array($UID['universityID'],$loopcourseID,$m,$branchId,$UID['universityID'],$loopcourseID,$branchId)); //$id['FeeDetails'][$key2] = $res->result(); $in[] = $res->result(); //array_push($id['FeeDetails'][$key2],$ind); @@ -1106,9 +1107,8 @@ $studetdetails['CourseName'] = $r->CourseName; 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 - group by T_Batch_Schedule_Child.SubjectID order by T_Batch_Schedule_Child.ScheduleDate"; - $res = $this->db->query($sql,array($UID['universityID'],$courseID,$i,$branchId,$UID['universityID'],$courseID,$branchId)); + $res = $this->db->query($sql,array($UID['universityID'],$loopcourseID,$i,$branchId,$UID['universityID'],$loopcourseID,$branchId)); //$id['FeeDetails'][$key2] = $res->result(); $in[] = $res->result(); //array_push($id['FeeDetails'][$key2],$ind); @@ -1123,18 +1123,46 @@ $studetdetails['CourseName'] = $r->CourseName; } array_splice($studentIDs[$key1]['FeeDetails'],0,10,$id['FeeDetails']) ; - //} + } // echo "COE"; // print_r($studentIDs);die(); + + if(($courseID != null)||($courseID !='')) + { $this->saveHallTicketDataForExamAttendance($UID,$courseID,$branchId,$studentIDs,$centerName,$batch,$requestedBy); - } + + } + + else + { + + $result_Course = array_unique($a); + + + //print_r($result_Course); + + foreach ($result_Course as $keyy => $vvalue) + { + + //echo "{$keyy} => {$vvalue} "; + //print_r($arr); + + $Ava_courseId = $vvalue; + + $this->saveHallTicketDataForExamAttendance($UID,$Ava_courseId,$branchId,$studentIDs,$centerName,$batch,$requestedBy); + + + } + + } return $studentIDs; } + public function saveHallTicketDataForExamAttendance($UID,$courseID,$branchId,$studentIDs,$centerName,$batch,$requestedBy) { - + //print_r($studentIDs);die(); $MASTERID = '00'; $this->db->select('HallTicket_ID'); @@ -1199,7 +1227,20 @@ $studetdetails['CourseName'] = $r->CourseName; { foreach($student['FeeDetails'] as $key => $fees) { - //print_r($fees); + //print_r($fees);die(); + + $this->db->select('*'); + $this->db->from('T_Students_Fees_Status'); + $this->db->where('StudentID',$student['StudentID']); + $this->db->where('CourseID',$courseID); + //$this->db->where('BatchCode'); + + $studentcheck = $this->db->get(); + + if($studentcheck ->result()) + { + + $tempArray = array('Hallticket_ID'=>$MASTERID,'StudentID'=>$student['StudentID'],'EnrollmentID'=>$student['EnrollmentID'],'Sem_Year'=>('SEM'.($key + 1))); $this->db->trans_start(); @@ -1217,11 +1258,11 @@ $studetdetails['CourseName'] = $r->CourseName; $this->db->trans_complete(); } + + } } - - return true; } } } @@ -1254,8 +1295,6 @@ $studetdetails['CourseName'] = $r->CourseName; } } - - return true; } } @@ -1290,8 +1329,6 @@ $studetdetails['CourseName'] = $r->CourseName; } } } - - return true; } } } @@ -1325,8 +1362,6 @@ $studetdetails['CourseName'] = $r->CourseName; } } } - - return true; } } }