branch access

This commit is contained in:
venbatechnologies@gmail.com 2018-05-02 18:29:32 +05:30
parent 541e146eb8
commit 3bb2ab7f66
2 changed files with 13 additions and 6 deletions

View File

@ -276,6 +276,8 @@ class Employee_model extends CI_Model
// get branch details based on login user
public function get_req_master_branch_detail($reqRoleId, $reqUserID,$branchId)
{
$listcode="R003";
if ($reqRoleId == SUPER_ADMIN) {
// res for SuperAdmin
$this->db->select('BranchCode, BranchName');
@ -290,10 +292,11 @@ class Employee_model extends CI_Model
$subQuery = "SELECT t1.BranchCode, t1.BranchName
FROM T_BranchMaster as t1
LEFT JOIN T_Staff_BranchAccess as t2 ON t2.StaffID = '$staffId'
WHERE t1.BranchCode='$branchId' and t2.ListCode='$listcode'
WHERE t2.BranchCode = t1.BranchCode
WHERE t1.BranchCode='$branchId' and t2.ListCode='$listcode'
AND t1.IsActive = 1
AND t2.IsActive = 1";
AND t2.IsActive = 1
group by t1.BranchCode";
$mBranchDetails = $this->db->query($subQuery);
$results['MeasterBranchDetailStatus'] = true;
$results['branch_details'] = $mBranchDetails->result();

View File

@ -25,13 +25,17 @@ class Login_model extends CI_Model
$this->db->select('t1.MobileNumber, t1.Password,t1.ListCode');
$this->db->from('' . LOGIN . ' as t1');
$this->db->where('t1.MobileNumber', $mobile);
$this->db->or_where('t1.StaffID', $mobile);
// $this->db->join('' . STAFF . ' as t2', 't1.StaffID = t2.StaffID', 'LEFT');
$this->db->where('t1.IsActive', 1);
//$this->db->where('t2.IsActive', 1);
$loginDetails = $this->db->get(LOGIN)->first_row();
// print_r($loginDetails);exit();
if ($loginDetails) {
if ($mobile == $loginDetails->MobileNumber) {
$mobileno= $loginDetails->MobileNumber;
// print_r($loginDetails);
if($loginDetails) {
if ($mobile == $loginDetails->MobileNumber || $mobile == $loginDetails->StaffID) {
if ($password == $loginDetails->Password) {
if($loginDetails->ListCode == SUPER_ADMIN){