2019 lines
74 KiB
PHP
2019 lines
74 KiB
PHP
<?php
|
|
/**
|
|
* Created by Notepad++.
|
|
* User: velz
|
|
* Date: 3/19/18
|
|
* Time: 7:48 PM
|
|
*/
|
|
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class Hallticket_model extends CI_Model
|
|
{
|
|
|
|
/*
|
|
* get university details
|
|
* created by velz
|
|
* */
|
|
public function getUniversityDetails($branchId)
|
|
{
|
|
$this->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,SemesterID,SemesterID
|
|
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->result());die();
|
|
|
|
//print_r($this->db->last_query());die();
|
|
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,SCM.SEM_Year as Sem_year');
|
|
$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('SCM.CourseID',$CourseID);
|
|
// $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->result);die();
|
|
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;
|
|
$fetchData['Sem_year'] = $existData[0]->Sem_year;
|
|
$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;
|
|
$fetchData['Sem_year'] = "";
|
|
|
|
}
|
|
$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)
|
|
{
|
|
|
|
|
|
$i=0;
|
|
foreach($courseIDS as $c)
|
|
{
|
|
|
|
// $tempCourseArray= $c['CourseID'];
|
|
|
|
$this->db->select ('count(*) as count,T_SemSubMap_Child.SubjectID');
|
|
$this->db->from('T_SemSubMap_Master');
|
|
$this->db->join('T_SemSubMap_Child','T_SemSubMap_Child.MapID=T_SemSubMap_Master.MapID');
|
|
$this->db->where('UniversityID',$universityID);
|
|
$this->db->where('CourseID',$c);
|
|
$result = $this->db->get();
|
|
$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 getSubjectMappingDetails($universityID,$courseIDS,$branchId)
|
|
{
|
|
|
|
|
|
|
|
foreach($courseIDS as $c)
|
|
{
|
|
|
|
// $tempCourseArray= $c['CourseID'];
|
|
|
|
$this->db->select ('T_SubjectMaster.SubjectCode');
|
|
$this->db->from('T_SemSubMap_Master');
|
|
$this->db->join('T_SemSubMap_Child','T_SemSubMap_Child.MapID=T_SemSubMap_Master.MapID');
|
|
$this->db->join('T_SubjectMaster','T_SubjectMaster.SubjectID=T_SemSubMap_Child.SubjectID');
|
|
$this->db->where('T_SemSubMap_Master.UniversityID',$universityID);
|
|
$this->db->where('T_SemSubMap_Master.CourseID',$c);
|
|
$this->db->where('T_SubjectMaster.BranchCode',$branchId);
|
|
$result = $this->db->get();
|
|
|
|
|
|
}
|
|
return $result->result();
|
|
|
|
}
|
|
/*
|
|
* check existing data,only batchschedule.
|
|
* @params university id and CourseID
|
|
* created by Bala
|
|
* */
|
|
|
|
public function getExistDetails($universityID,$courseIDS,$branchId,$Sem_Year)
|
|
{
|
|
|
|
//print_r($courseIDS);die();
|
|
//echo $Sem_Year;die();
|
|
// echo substr($Sem_Year, -1);
|
|
$sem_yr_no ='';
|
|
|
|
if($Sem_Year !='Regular')
|
|
{
|
|
$sem_yr_no = substr($Sem_Year, -1);
|
|
}
|
|
|
|
else
|
|
{
|
|
$sem_yr_no ='';
|
|
}
|
|
|
|
|
|
|
|
$yearcheck_str = substr($Sem_Year, 0, 4);
|
|
$year_to_Upper= strtoupper($yearcheck_str);
|
|
|
|
|
|
if($year_to_Upper=='YEAR')
|
|
{
|
|
|
|
if($sem_yr_no !='1')
|
|
{//echo 'in';
|
|
$sem_yr_no = $sem_yr_no+1;
|
|
}
|
|
}
|
|
|
|
// echo $sem_yr_no;
|
|
|
|
// die();
|
|
|
|
$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);
|
|
|
|
if($Sem_Year !='Regular')
|
|
{
|
|
$this->db->where('SEM_Year =',$Sem_Year);
|
|
}
|
|
// $this->db->where('BranchCode',$branchId);
|
|
$result = $this->db->get();
|
|
$res = $result->result();
|
|
|
|
//print_r($this->db->last_query());die();
|
|
|
|
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);
|
|
if($sem_yr_no != '')
|
|
{
|
|
$this->db->where('SMM.SemesterID',$sem_yr_no);
|
|
}
|
|
$result = $this->db->get();
|
|
|
|
// print_r($this->db->last_query());die();
|
|
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->WHERE('T_SemSubMap_Master.BranchCode',$branchId);
|
|
$this->db->group_by('T_SemSubMap_Master.UniversityID,T_SemSubMap_Master.CourseID');
|
|
$res = $this->db->get();
|
|
//echo $this->db->last_query();
|
|
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);
|
|
//echo $this->db->last_query();
|
|
//$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();
|
|
//echo $this->db->last_query(); die();
|
|
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=null,$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,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",
|
|
if(substr(substr(BalFees.semyr, -5), 1, 4) = "year","YEAR", false)) as SubType,
|
|
BalFees.semyr');
|
|
$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('BalFees','BalFees.student =T_Students_Fees_Status.StudentID and BalFees.course = T_Students_Fees_Status. CourseID and BalFees.branchCode = T_Students_Fees_Status.BranchCode and BalFees.bcode=T_Students_Fees_Status.BatchCode');
|
|
|
|
$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->join('T_CourseMaster','T_CourseMaster.CourseID = T_Student_CourseDetails.CourseID');
|
|
$this->db->where('T_Students_Fees_Status.BatchCode',$batch);
|
|
$this->db->where('T_Students_Fees_Status.BranchCode',$branchId);
|
|
if(($courseID !='')||($courseID != null))
|
|
{
|
|
$this->db->where('T_Students_Fees_Status.CourseID',$courseID);
|
|
}
|
|
|
|
|
|
$res = $this->db->get();
|
|
$data = $res->result();
|
|
|
|
//print_r($this->db->last_query()); die();
|
|
|
|
$result_array = array();
|
|
$Course_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['balpayable'] =$r->balpayable;
|
|
$course = $r->CourseID;
|
|
$studetdetails['FeeDetails'] = $this->getFeeSemesterDetails($r->StudentID,$batch,$branchId,$course);
|
|
$studetdetails['CourseID'] = $r->CourseID;
|
|
$studetdetails['CourseName'] = $r->CourseName;
|
|
$studetdetails['balpayable'] =$r->balpayable;
|
|
$studetdetails['semyr'] =$r->semyr;
|
|
$studetdetails['SemID'] =$r->SemID;
|
|
$result_array[] = $studetdetails;
|
|
$prestu = $r->StudentID;
|
|
array_push($Course_array,$course);
|
|
|
|
|
|
//}
|
|
}
|
|
|
|
|
|
//print_r($result_array);die();
|
|
}
|
|
|
|
// 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);die();
|
|
|
|
foreach ($result_array as $key => $value)
|
|
{
|
|
//print_r($value);
|
|
//echo $value['CourseID'];
|
|
// echo $value['semyr'];die();
|
|
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']);
|
|
$this->db->where('Sem_Year',$value['semyr']);
|
|
|
|
$check = $this->db->get();
|
|
|
|
$checkresult = $check->result();
|
|
|
|
|
|
if(!empty($checkresult))
|
|
{
|
|
//echo 'not empty';
|
|
}
|
|
|
|
else
|
|
{
|
|
|
|
//print_r($check->result());
|
|
//echo count($check);
|
|
// if(count($check)>0)
|
|
// {
|
|
|
|
|
|
$this->db->select('*');
|
|
$this->db->from('T_Batch_Schedule_Master');
|
|
$this->db->where('CourseID',$value['CourseID']);
|
|
$this->db->where('SEM_Year',$value['semyr']);
|
|
$schcheck = $this->db->get();
|
|
|
|
$sch_checkresult = $schcheck->result();
|
|
|
|
if(!empty($sch_checkresult))
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
$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 $value['semyr'];
|
|
|
|
|
|
|
|
$yearcheck_str = substr($value['semyr'], 0, 4);
|
|
$year_to_Upper= strtoupper($yearcheck_str);
|
|
|
|
|
|
if($year_to_Upper=='YEAR')
|
|
{
|
|
|
|
if($semid !='1')
|
|
{//echo 'in';
|
|
$semid = $semid+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();
|
|
|
|
//print_r($this->db->last_query());
|
|
|
|
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();
|
|
$this->db->select("T_Course_Fees_Details.ID as FeesID,BalFees.balpayable,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->join('BalFees','BalFees.feestype = T_Course_Fees_Details.ID and BalFees.student = T_Students_Fees_Status.StudentID'); $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();
|
|
|
|
//print_r($this->db->last_query());die();
|
|
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)
|
|
{
|
|
//print_r($studentIDs);die();
|
|
|
|
//echo $courseID.'course';die();
|
|
$a=array();
|
|
$feeArray = array();
|
|
foreach($studentIDs as $key1 => $id)
|
|
{
|
|
|
|
$loopcourseID= $id['CourseID'];
|
|
|
|
// $a=array();
|
|
array_push($a,$loopcourseID);
|
|
|
|
// echo $courseID;
|
|
foreach($id['FeeDetails'] as $key2 => $ind)
|
|
{
|
|
array_push($feeArray,$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
|
|
group by T_Batch_Schedule_Child.SubjectID
|
|
order by T_Batch_Schedule_Child.ScheduleDate";
|
|
$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);
|
|
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
|
|
group by T_Batch_Schedule_Child.SubjectID
|
|
order by T_Batch_Schedule_Child.ScheduleDate";
|
|
$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);
|
|
|
|
|
|
}
|
|
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
|
|
group by T_Batch_Schedule_Child.SubjectID
|
|
order by T_Batch_Schedule_Child.ScheduleDate";
|
|
$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);
|
|
|
|
|
|
// }
|
|
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
|
|
group by T_Batch_Schedule_Child.SubjectID
|
|
order by T_Batch_Schedule_Child.ScheduleDate";
|
|
$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);
|
|
|
|
|
|
// }
|
|
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
|
|
group by T_Batch_Schedule_Child.SubjectID
|
|
order by T_Batch_Schedule_Child.ScheduleDate";
|
|
$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);
|
|
|
|
|
|
// }
|
|
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
|
|
group by T_Batch_Schedule_Child.SubjectID
|
|
order by T_Batch_Schedule_Child.ScheduleDate";
|
|
$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);
|
|
|
|
|
|
}
|
|
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
|
|
group by T_Batch_Schedule_Child.SubjectID
|
|
order by T_Batch_Schedule_Child.ScheduleDate";
|
|
$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);
|
|
|
|
|
|
}
|
|
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();
|
|
|
|
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');
|
|
$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 "</br>";
|
|
if(!empty($student['FeeDetails']))
|
|
{
|
|
foreach($student['FeeDetails'] as $key => $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();
|
|
$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 "</br>";
|
|
$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))
|
|
{
|
|
|
|
|
|
|
|
|
|
$this->db->select('*');
|
|
$this->db->from('T_Students_Fees_Status');
|
|
$this->db->where('StudentID',$student['StudentID']);
|
|
$this->db->where('CourseID',$courseID);
|
|
|
|
|
|
$studentcheck = $this->db->get();
|
|
|
|
if($studentcheck ->result())
|
|
{
|
|
|
|
|
|
$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))
|
|
{
|
|
|
|
|
|
$this->db->select('*');
|
|
$this->db->from('T_Students_Fees_Status');
|
|
$this->db->where('StudentID',$student['StudentID']);
|
|
$this->db->where('CourseID',$courseID);
|
|
|
|
|
|
$studentcheck = $this->db->get();
|
|
|
|
if($studentcheck ->result())
|
|
{
|
|
|
|
|
|
$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))
|
|
{
|
|
|
|
$this->db->select('*');
|
|
$this->db->from('T_Students_Fees_Status');
|
|
$this->db->where('StudentID',$student['StudentID']);
|
|
$this->db->where('CourseID',$courseID);
|
|
|
|
|
|
$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();
|
|
$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,$exam_attendance)
|
|
{
|
|
|
|
//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,RollNo 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
|
|
Join T_Students_Fees_Status on T_Students_Fees_Status.StudentID=T_StudentDetails.StudentID and T_Students_Fees_Status.BatchCode='".$batch."'
|
|
|
|
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')";
|
|
|
|
|
|
if ($exam_attendance == 'Morning')
|
|
{
|
|
|
|
$sql.=" and substring(T_Hallticket_Subject_Details.FromTime,6,2) ='AM'";
|
|
|
|
}
|
|
|
|
|
|
if ($exam_attendance == 'AfterNoon')
|
|
{
|
|
|
|
$sql.=" and substring(T_Hallticket_Subject_Details.FromTime,6,2) ='PM'";
|
|
|
|
}
|
|
|
|
$sql.="order by T_CourseMaster.CourseName,T_Hallticket_Student_Details.Sem_Year";
|
|
$res = $this->db->query($sql,array($UID,$batch,$branchId,$centerName['CenterID'],$examDate));
|
|
$result = $res->result();
|
|
//print_r($this->db->last_query());die();
|
|
//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,$Sem_Year)
|
|
{
|
|
|
|
$Sem_Year = $Sem_Year;
|
|
|
|
//echo $Sem_Year;die();
|
|
|
|
$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;
|
|
}
|
|
|
|
|
|
|
|
public function Get_Select_CourseDetails($CourseID)
|
|
{
|
|
$this->db->select('CourseID,Sem_Year');
|
|
$this->db->from('T_Course_Fees_Details');
|
|
$this->db->where('CourseID',$CourseID);
|
|
|
|
$CourseDetails = $this->db->get()->result();
|
|
|
|
if($CourseDetails)
|
|
{
|
|
$result_array['searchst'] = true;
|
|
$result_array['details'] = $CourseDetails;
|
|
}
|
|
|
|
else
|
|
{
|
|
$result_array['searchst'] = false;
|
|
$result_array['details'] = "No records found!";
|
|
}
|
|
|
|
//print_r($result_array);die();
|
|
return $result_array;
|
|
}
|
|
|
|
|
|
public function SendFeeBalanceSMS($mobileno)
|
|
{
|
|
|
|
$mobile = "91$mobileno";
|
|
$msg = 'Dear Student, Your Fee Payment is pending. So we are unable to generate the Hall Ticket, Please pay the balance immediately';
|
|
|
|
$message = urlencode($msg);
|
|
|
|
$ch=curl_init();
|
|
curl_setopt($ch,CURLOPT_URL,"https://smsapi.24x7sms.com/api_2.0/SendSMS.aspx?APIKEY=xegCdYUIMf3&MobileNo=".$mobile."&SenderID=APODEC&Message=".$message."&ServiceName=PROMOTIONAL_HIGH");
|
|
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
|
|
$output =curl_exec($ch);
|
|
|
|
// print_r($output);exit();
|
|
curl_close($ch);
|
|
|
|
$arrss = explode('<br>', $output);
|
|
|
|
$time = date('Y-m-d H:i:s');
|
|
$dateTime = $time;
|
|
$msgGroup = date('YmdHis');
|
|
|
|
//print_r($arrss);
|
|
|
|
|
|
$data = array( 'MobileNumber' => $mobile, 'MsgBody' => $msg, 'CreatedOn' => $dateTime,'MsgGroup' => $msgGroup);
|
|
//print_r($data);die();
|
|
|
|
$this->db->insert('T_BroadcastStatus',$data);
|
|
return $output;
|
|
}
|
|
|
|
} |