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
public function get_emp_detail($empLoginID = null)
{
$this->db->select('StaffID');
$this->db->select('StaffID,ListCode');
$this->db->from(LOGIN);
$this->db->where('ID', $empLoginID);
$loginEmpDetail = $this->db->get()->first_row();
if ($loginEmpDetail) {
$EmpId = $loginEmpDetail->StaffID;
$this->db->select('t1.*');
$this->db->from('' . STAFF . ' as t1');
$this->db->where('t1.StaffID', $EmpId);
// $this->db->join('T_StaffDetails as t2', 't1.StaffID = t2.StaffID', 'LEFT');
$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);
if($loginEmpDetail->ListCode != STUDENT){
$this->db->select('t1.*');
$this->db->from('' . STAFF . ' as t1');
$this->db->where('t1.StaffID', $EmpId);
// $this->db->join('T_StaffDetails as t2', 't1.StaffID = t2.StaffID', 'LEFT');
$branchDetails = $this->db->get();
$getArrs = $branchDetails->result();
$SS['BranchCode'] = 'All';
$SS['BranchName'] = 'All';
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();
$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');
$branchDetails = $this->db->get();
$getArrs = $branchDetails->result();
$SS['BranchCode'] = 'All';
$SS['BranchName'] = 'All';
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 {
$result['empStatus'] = false;
$result['message'] = "Something Went Wrong, Please try Again !!";