changes in course
This commit is contained in:
parent
9407d9f564
commit
66a6f96b9f
@ -15,7 +15,7 @@ class Course_model extends CI_Model {
|
||||
* created by kms
|
||||
* */
|
||||
|
||||
public function addCourse($arrayDetails=null)
|
||||
public function addCourse($arrayDetails=null,$jsonData=null)
|
||||
{
|
||||
|
||||
$this->db->select('CourseID');
|
||||
@ -26,9 +26,30 @@ class Course_model extends CI_Model {
|
||||
} else {
|
||||
$this->db->insert(COURSE, $arrayDetails);
|
||||
if ($this->db->affected_rows() == '1') {
|
||||
if($jsonData){
|
||||
foreach($jsonData as $row){
|
||||
|
||||
$insertFeesArray['CourseID'] =$arrayDetails['CourseID'];
|
||||
$insertFeesArray['ProgramType'] =$row['program'];
|
||||
$insertFeesArray['FeesType'] =$arrayDetails['FeesType'];
|
||||
$insertFeesArray['FeesAmount'] =$row['FeesAmount'];
|
||||
$insertFeesArray['Sem_Year'] =$row['FeesName'];
|
||||
$insertFeesArray['UpdatedOn'] =$arrayDetails['CreatedOn'];
|
||||
$insertFeesArray['UpdatedBy'] =$arrayDetails['CreatedBy'];
|
||||
$this->db->insert(COURSE_FEES, $insertFeesArray);
|
||||
}
|
||||
|
||||
$result['courseStatus'] = true;
|
||||
$result['message'] = "Successfully course details added";
|
||||
}
|
||||
else{
|
||||
$this -> db -> where('CourseID', $arrayDetails['CourseID']);
|
||||
$this -> db -> delete('COURSE');
|
||||
$result['courseStatus'] = false;
|
||||
$result['message'] = "Something went wrong.please try again";
|
||||
}
|
||||
|
||||
|
||||
$result['courseStatus'] = true;
|
||||
$result['message'] = "Successfully course details added";
|
||||
} else {
|
||||
$result['courseStatus'] = false;
|
||||
$result['message'] = "Something went wrong.please try again";
|
||||
@ -47,7 +68,7 @@ class Course_model extends CI_Model {
|
||||
|
||||
public function getCourse()
|
||||
{
|
||||
$this->db->select('CU.CourseID,CU.CourseName,CU.IsActive,US.UniversityID,US.UniversityName');
|
||||
$this->db->select('CU.CourseID,CU.CourseName,CU.FeesType,CU.PC,CU.DC,CU.TC,CU.MC,CU.OtherFees,CU.IsActive,US.UniversityID,US.UniversityName');
|
||||
$this->db->from(COURSE.' as CU');
|
||||
$this->db->join(UNIVERSITY.' as US', 'US.UniversityID = CU.UniversityID');
|
||||
$this->db->order_by('CourseID','DESC');
|
||||
@ -56,7 +77,23 @@ class Course_model extends CI_Model {
|
||||
if($courseDetails->result()){
|
||||
|
||||
$result['courseStatus'] = true;
|
||||
$result['details'] = $courseDetails->result();
|
||||
|
||||
foreach ($courseDetails->result() as $row){
|
||||
$fetchData['CourseID']=$row->CourseID;
|
||||
$fetchData['CourseName']=$row->CourseName;
|
||||
$fetchData['FeesType']=$row->FeesType;
|
||||
$fetchData['PC']=$row->PC;
|
||||
$fetchData['DC']=$row->DC;
|
||||
$fetchData['TC']=$row->TC;
|
||||
$fetchData['MC']=$row->MC;
|
||||
$fetchData['OtherFees']=$row->OtherFees;
|
||||
$fetchData['IsActive']=$row->IsActive;
|
||||
$fetchData['UniversityID']=$row->UniversityID;
|
||||
$fetchData['UniversityName']=$row->UniversityName;
|
||||
$fetchData['feesStructures'] = $this->getCourseFeesDetails($row->CourseID);
|
||||
$storeCourseArray[]=$fetchData;
|
||||
}
|
||||
$result['details'] = $storeCourseArray;
|
||||
}
|
||||
else {
|
||||
$result['courseStatus'] = false;
|
||||
@ -64,6 +101,7 @@ class Course_model extends CI_Model {
|
||||
}
|
||||
|
||||
$result['universityDetails'] = $this->getUniversityDetails();
|
||||
$result['feesDetails'] = $this->getFeesDetails();
|
||||
|
||||
return $result;
|
||||
|
||||
@ -73,14 +111,29 @@ class Course_model extends CI_Model {
|
||||
* update course details
|
||||
* created by kms
|
||||
* */
|
||||
public function updateCourse($arrayDetails=null)
|
||||
public function updateCourse($arrayDetails=null,$jsonData=null)
|
||||
{
|
||||
$this->db->where('CourseID',$arrayDetails['CourseID']);
|
||||
$upateStatus=$this->db->update(COURSE, $arrayDetails);
|
||||
if($upateStatus){
|
||||
if($upateStatus) {
|
||||
|
||||
$result['courseStatus'] = true;
|
||||
$result['message'] = "Successfully course details updated";
|
||||
if ($jsonData) {
|
||||
foreach ($jsonData as $row) {
|
||||
$updateFeesArray['ID'] = $row['ID'];
|
||||
$updateFeesArray['CourseID'] = $arrayDetails['CourseID'];
|
||||
// $insertFeesArray['ProgramType'] =$row['program'];
|
||||
//$insertFeesArray['FeesType'] =$arrayDetails['FeesType'];
|
||||
$updateFeesArray['FeesAmount'] = $row['FeesAmount'];
|
||||
$updateFeesArray['Sem_Year'] = $row['Sem_Year'];
|
||||
$updateFeesArray['UpdatedOn'] = $arrayDetails['UpdatedOn'];
|
||||
$updateFeesArray['UpdatedBy'] = $arrayDetails['UpdatedBy'];
|
||||
$this->db->where('ID', $updateFeesArray['ID']);
|
||||
$this->db->update(COURSE_FEES, $updateFeesArray);
|
||||
}
|
||||
|
||||
$result['courseStatus'] = true;
|
||||
$result['message'] = "Successfully course details updated";
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
@ -101,10 +154,75 @@ class Course_model extends CI_Model {
|
||||
{
|
||||
$this->db->select('UniversityID,UniversityName');
|
||||
$this->db->order_by('UniversityID','ASC');
|
||||
$this->db->order_by('IsActive','1');
|
||||
$this->db->where('IsActive','1');
|
||||
$universityDetails = $this->db->get(UNIVERSITY);
|
||||
return $universityDetails->result();
|
||||
}
|
||||
/*
|
||||
* get fees details
|
||||
* created by kms
|
||||
* */
|
||||
public function getFeesDetails()
|
||||
{
|
||||
$this->db->select('ListCode,ListName');
|
||||
$this->db->order_by('ListCode','ASC');
|
||||
$this->db->where('IsActive','1');
|
||||
$this->db->where('ListGroup','3');
|
||||
$feesDetails = $this->db->get(PICK_LIST_DETAILS);
|
||||
if($feesDetails){
|
||||
$result_fees = array();
|
||||
foreach ($feesDetails->result() as $row)
|
||||
{
|
||||
$list_array['ListCode'] = $row->ListCode;
|
||||
$list_array['ListName'] = $row->ListName;
|
||||
if($row->ListCode=='F001'){
|
||||
$list_array['programType']=$this->getFeesProgram('4');
|
||||
|
||||
}
|
||||
else if($row->ListCode=='F002'){
|
||||
$list_array['programType']=$this->getFeesProgram('5');
|
||||
}
|
||||
else{
|
||||
$list_array['programType']="";
|
||||
}
|
||||
$result_fees[]=$list_array;
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
$result_fees[]="";
|
||||
}
|
||||
return $result_fees;
|
||||
}
|
||||
/*
|
||||
* get fees type
|
||||
* created by kms
|
||||
* */
|
||||
public function getFeesProgram($programType=null)
|
||||
{
|
||||
$this->db->select('ListCode,ListName');
|
||||
$this->db->order_by('ListCode','ASC');
|
||||
$this->db->where('IsActive','1');
|
||||
$this->db->where('ListGroup',$programType);
|
||||
$feesDetails = $this->db->get(PICK_LIST_DETAILS);
|
||||
return $feesDetails->result();
|
||||
}
|
||||
|
||||
/*
|
||||
* get course fees details
|
||||
* created by kms
|
||||
* */
|
||||
|
||||
public function getCourseFeesDetails($courseID=null){
|
||||
$this->db->select('ID,CourseID,ProgramType,FeesAmount,Sem_Year,PLD.ListName as programName');
|
||||
$this->db->order_by('ID','ASC');
|
||||
$this->db->where('CourseID',$courseID);
|
||||
$this->db->from(COURSE_FEES.' as CF');
|
||||
$this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = CF.ProgramType');
|
||||
$feesDetails = $this->db->get();
|
||||
return $feesDetails->result();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user