course details changes done

This commit is contained in:
gandhimathi 2017-12-22 13:48:36 +05:30
parent 211a05f0e3
commit ddea4b3b20

View File

@ -83,56 +83,70 @@ class Employee_model extends CI_Model
// get single employee details // get single employee details
public function get_emp_detail($empLoginID = null) public function get_emp_detail($empLoginID = null)
{ {
$this->db->select('StaffID'); $this->db->select('StaffID,ListCode');
$this->db->from(LOGIN); $this->db->from(LOGIN);
$this->db->where('ID', $empLoginID); $this->db->where('ID', $empLoginID);
$loginEmpDetail = $this->db->get()->first_row(); $loginEmpDetail = $this->db->get()->first_row();
if ($loginEmpDetail) { if ($loginEmpDetail) {
$EmpId = $loginEmpDetail->StaffID; $EmpId = $loginEmpDetail->StaffID;
$this->db->select('t1.*'); if($loginEmpDetail->ListCode != STUDENT){
$this->db->from('' . STAFF . ' as t1'); $this->db->select('t1.*');
$this->db->where('t1.StaffID', $EmpId); $this->db->from('' . STAFF . ' as t1');
// $this->db->join('T_StaffDetails as t2', 't1.StaffID = t2.StaffID', 'LEFT'); $this->db->where('t1.StaffID', $EmpId);
$responseDetails = $this->db->get()->first_row();
$result['empStatus'] = true;
// print_r($result['details']);exit();
if ($responseDetails->ListCode == SUPER_ADMIN) {
// print_r($result['details']->ListCode);exit();
// get branch details for super admin
$responseDetails->BranchCode = 'All';
$result['details'] = $responseDetails;
// print_r($result['details']);exit();
$this->db->select('t3.BranchCode, t3.BranchName');
$this->db->from('' . STAFF_BRANCH . ' as t2');
$this->db->where('t2.StaffID', $EmpId);
$this->db->where('t2.IsActive', 1);
$this->db->join('' . BRANCH . ' as t3', 't2.BranchCode = t3.BranchCode', 'LEFT');
$this->db->where('t3.IsActive', 1);
// $this->db->join('T_StaffDetails as t2', 't1.StaffID = t2.StaffID', 'LEFT'); // $this->db->join('T_StaffDetails as t2', 't1.StaffID = t2.StaffID', 'LEFT');
$branchDetails = $this->db->get(); $responseDetails = $this->db->get()->first_row();
$getArrs = $branchDetails->result(); $result['empStatus'] = true;
$SS['BranchCode'] = 'All'; // print_r($result['details']);exit();
$SS['BranchName'] = 'All';
array_push($getArrs, $SS); if ($responseDetails->ListCode == SUPER_ADMIN) {
// print_r($getArrs);exit(); // print_r($result['details']->ListCode);exit();
$result['branchStatus'] = true; // get branch details for super admin
$result['branch_details'] = $getArrs; $responseDetails->BranchCode = 'All';
$result['details'] = $responseDetails;
} else { // print_r($result['details']);exit();
// get branch details for admin & staff $this->db->select('t3.BranchCode, t3.BranchName');
$result['details'] = $responseDetails; $this->db->from('' . STAFF_BRANCH . ' as t2');
$this->db->select('t3.BranchCode, t3.BranchName'); $this->db->where('t2.StaffID', $EmpId);
$this->db->from('' . STAFF_BRANCH . ' as t2'); $this->db->where('t2.IsActive', 1);
$this->db->where('t2.StaffID', $EmpId); $this->db->join('' . BRANCH . ' as t3', 't2.BranchCode = t3.BranchCode', 'LEFT');
$this->db->where('t2.IsActive', 1); $this->db->where('t3.IsActive', 1);
$this->db->join('' . BRANCH . ' as t3', 't2.BranchCode = t3.BranchCode', 'LEFT'); // $this->db->join('T_StaffDetails as t2', 't1.StaffID = t2.StaffID', 'LEFT');
$this->db->where('t3.IsActive', 1); $branchDetails = $this->db->get();
// $this->db->join('T_StaffDetails as t2', 't1.StaffID = t2.StaffID', 'LEFT'); $getArrs = $branchDetails->result();
$branchDetails = $this->db->get(); $SS['BranchCode'] = 'All';
$result['branchStatus'] = true; $SS['BranchName'] = 'All';
$result['branch_details'] = $branchDetails->result(); array_push($getArrs, $SS);
// print_r($getArrs);exit();
$result['branchStatus'] = true;
$result['branch_details'] = $getArrs;
} else {
// get branch details for admin & staff
$result['details'] = $responseDetails;
$this->db->select('t3.BranchCode, t3.BranchName');
$this->db->from('' . STAFF_BRANCH . ' as t2');
$this->db->where('t2.StaffID', $EmpId);
$this->db->where('t2.IsActive', 1);
$this->db->join('' . BRANCH . ' as t3', 't2.BranchCode = t3.BranchCode', 'LEFT');
$this->db->where('t3.IsActive', 1);
// $this->db->join('T_StaffDetails as t2', 't1.StaffID = t2.StaffID', 'LEFT');
$branchDetails = $this->db->get();
$result['branchStatus'] = true;
$result['branch_details'] = $branchDetails->result();
}
} }
elseif ($loginEmpDetail->ListCode == STUDENT){
$this->db->select('ST.*');
$this->db->from('' . STUDENTS . ' as ST');
$this->db->where('ST.StudentID', $EmpId);
// $this->db->join('T_StaffDetails as t2', 't1.StaffID = t2.StaffID', 'LEFT');
$responseDetails = $this->db->get()->first_row();
$result['empStatus'] = true;
$result['details'] = $responseDetails;
$result['branch_details'] = "";
}
} else { } else {
$result['empStatus'] = false; $result['empStatus'] = false;
$result['message'] = "Something Went Wrong, Please try Again !!"; $result['message'] = "Something Went Wrong, Please try Again !!";