db->select('USERPROFILE.userid, USERPROFILE.aws_name, USERPROFILE.first_name as user_first_name, USERPROFILE.last_name as user_last_name, USERPROFILE.email, USERPROFILE.mobile_no, USERPROFILE.profilepic, USERPROFILE.createdon, USERPROFILE.fk_createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as created_full_name, USERPROFILE.updatedon, USERPROFILE.fk_updatedby,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name)as update_full_name, USERPROFILE.fk_entity_id,ENTITY.full_name, USERPROFILE.isactive, USERPROFILE.fk_city,CITY.name as city_name, USERPROFILE.fk_state,STATE.name as state_name, PDOFFICIERSDETAILS.fk_pd_type_id,PDOFFICIERSDETAILS.fk_team_id,USERPROFILEROLES.user_role,USERPROFILE.fk_entity_type_id,ENTITYTYPE.name as entitytypename,ROLES.role_name,DESIGNATION.designation as designation_name,USERPROFILE.designation,USERPROFILE.fk_lender_branch_id,USERPROFILE.user_type,USERPROFILE.smc_emp_code,USERPROFILE.smc_emp_code,USERPROFILE.smc_agency_id,AGENCYLIST.agency_name as smc_agency_name'); $this->db->from(USERPROFILE.' as USERPROFILE'); $this->db->join(ENTITY.' as ENTITY','USERPROFILE.fk_entity_id = ENTITY.entity_id and ENTITY.isactive = 1','LEFT'); $this->db->join(STATE.' as STATE','USERPROFILE.fk_state = STATE.state_id and STATE.isactive = 1','LEFT'); $this->db->join(CITY.' as CITY','USERPROFILE.fk_city = CITY.city_id and CITY.isactive = 1','LEFT'); $this->db->join(USERPROFILE.' as USERPROFILE1','USERPROFILE.fk_createdby = USERPROFILE1.userid and USERPROFILE1.isactive = 1','LEFT'); $this->db->join(USERPROFILE.' as USERPROFILE2','USERPROFILE.fk_updatedby = USERPROFILE2.userid and USERPROFILE2.isactive = 1','LEFT'); $this->db->join(USERPROFILEROLES. ' as USERPROFILEROLES','USERPROFILEROLES.fk_userid = USERPROFILE.userid and USERPROFILEROLES.isactive =1'); $this->db->join(ENTITYTYPE.' as ENTITYTYPE','USERPROFILE.fk_entity_type_id = ENTITYTYPE.entity_type_id and ENTITYTYPE.isactive = 1','LEFT'); $this->db->join(PDOFFICIERSDETAILS.' as PDOFFICIERSDETAILS','PDOFFICIERSDETAILS.fk_user_id = USERPROFILE.userid and PDOFFICIERSDETAILS.isactive = 1','LEFT'); $this->db->join(DESIGNATION.' as DESIGNATION','USERPROFILE.designation = DESIGNATION.designation_id','LEFT'); $this->db->join(ROLES.' as ROLES','ROLES.role_id = USERPROFILEROLES.user_role'); $this->db->join(AGENCYLIST.' as AGENCYLIST','AGENCYLIST.agency_id = USERPROFILE.smc_agency_id','LEFT'); if($entityid) { $this->db->where('USERPROFILE.fk_entity_id',$entityid); } if($user_type == 'SMC') { $current_smc_lender_id = ENVIRONMENT == 'production' ? 7 : 35; //pk id of SMC in live and demo $this->db->where('USERPROFILE.fk_entity_id',$current_smc_lender_id); } $result = $this->db->get()->result_array(); // print_r($result);die; if(count($result) > 0 ) { foreach ($result as $key => $value) { $result[$key]['user_config'] = $this->getUserConfigDetails($value['userid']); } $result_data['data_status'] = true; $result_data['data'] = $result; return $result_data; } else { $result_data['data_status'] = false; $result_data['data'] = null; return $result_data; } } public function getUserDetails($userid){ $this->db->select('USERPROFILE.userid, USERPROFILE.aws_name, USERPROFILE.first_name as user_first_name, USERPROFILE.last_name as user_last_name, USERPROFILE.email, USERPROFILE.mobile_no, USERPROFILE.profilepic, USERPROFILE.createdon, USERPROFILE.fk_createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as created_full_name, USERPROFILE.updatedon, USERPROFILE.fk_updatedby,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name)as update_full_name, USERPROFILE.fk_entity_id,ENTITY.full_name,ENTITY.short_name,USERPROFILE.isactive, USERPROFILE.fk_city,CITY.name as city_name, USERPROFILE.fk_state,STATE.name as state_name, PDOFFICIERSDETAILS.fk_pd_type_id,PDOFFICIERSDETAILS.fk_team_id,USERPROFILE.fk_entity_type_id,USERPROFILEROLES.user_role,ENTITYTYPE.name as entitytypename,ROLES.role_name,USERPROFILE.mpin,DESIGNATION.designation as designation_name,USERPROFILE.designation,USERPROFILE.fk_lender_branch_id,USERPROFILE.user_type,USERPROFILE.smc_emp_code,USERPROFILE.smc_agency_id,AGENCYLIST.agency_name as smc_agency_name'); $this->db->from(USERPROFILE.' as USERPROFILE'); $this->db->join(ENTITY.' as ENTITY','USERPROFILE.fk_entity_id = ENTITY.entity_id and ENTITY.isactive = 1','LEFT'); $this->db->join(STATE.' as STATE','USERPROFILE.fk_state = STATE.state_id and STATE.isactive = 1','LEFT'); $this->db->join(CITY.' as CITY','USERPROFILE.fk_city = CITY.city_id and CITY.isactive = 1','LEFT'); $this->db->join(USERPROFILE.' as USERPROFILE1','USERPROFILE.fk_createdby = USERPROFILE1.userid and USERPROFILE1.isactive = 1','LEFT'); $this->db->join(USERPROFILE.' as USERPROFILE2','USERPROFILE.fk_updatedby = USERPROFILE2.userid and USERPROFILE2.isactive = 1','LEFT'); $this->db->join(USERPROFILEROLES. ' as USERPROFILEROLES','USERPROFILEROLES.fk_userid = USERPROFILE.userid and USERPROFILEROLES.isactive =1'); $this->db->join(ENTITYTYPE.' as ENTITYTYPE','ENTITY.fk_entity_type_id = ENTITYTYPE.entity_type_id and ENTITYTYPE.isactive = 1','LEFT'); $this->db->join(PDOFFICIERSDETAILS.' as PDOFFICIERSDETAILS','PDOFFICIERSDETAILS.fk_user_id = USERPROFILE.userid and PDOFFICIERSDETAILS.isactive = 1','LEFT'); $this->db->join(ROLES.' as ROLES','ROLES.role_id = USERPROFILEROLES.user_role'); $this->db->join(DESIGNATION.' as DESIGNATION','USERPROFILE.designation = DESIGNATION.designation_id','LEFT'); $this->db->join(AGENCYLIST.' as AGENCYLIST','AGENCYLIST.agency_id = USERPROFILE.smc_agency_id','LEFT'); $this->db->where('USERPROFILE.userid',$userid); $result = $this->db->get()->result_array(); if(count($result) != 0 ) { $result_data['data_status'] = true; $result_data['data'] = $result; return $result_data; } else { $result_data['data_status'] = false; $result_data['data'] = null; return $result_data; } } function getUserConfigDetails($userid) { $return_data = array(); $this->db->select('*'); $this->db->where('USERCONFIG.fk_user_id',$userid); $this->db->where('USERCONFIG.isactive',1); $result = $this->db->get(USERCONFIG.' as USERCONFIG')->result_array(); // print_r($result);die(); if(count($result) !=0) { foreach ($result as $key => $value) { if($value['config_type'] == 1)//sales pd products { $return_data['salespd_products'] = (explode(",",$value['data'])); } } } /** FOR GETTING THE RCM STATE MAPPING DATA BY ACTIVE USER ID */ $this->db->select('*'); $this->db->where('RCM_STATE_MAPPING.fk_user_id',$userid); $this->db->where('RCM_STATE_MAPPING.isactive',1); $state_mapping_result = $this->db->get(RCM_STATE_MAPPING.' as RCM_STATE_MAPPING')->result_array(); // print_r($state_mapping_result); // die(); if(count($state_mapping_result) != 0) { $return_data['rcm_state_mapping'] = array(); foreach($state_mapping_result as $key => $value) { array_push($return_data['rcm_state_mapping'],$value['fk_state_id']); } } /** END OF GETTING THE RCM STATE MAPPING DATA BY ACTIVE USER ID */ return $return_data; } public function pinDetails($records) { $this->db->select('*'); $this->db->where('USERPROFILE.userid',$records['userid']); $this->db->where('USERPROFILE.mpin',$records['mpin']); $result = $this->db->get(USERPROFILE.' as USERPROFILE')->first_row(); if(count($result) !=0) { $result_data['data_status'] = true; $result_data['data'] = true; return $result_data; }else { $result_data['data_status'] = false; $result_data['data'] = false; return $result_data; } } public function deactivateDataOnRcmStateMapping($userid,$data_arr) { // echo "inside function"; foreach($data_arr as $key => $value) { $this->db->set(array('isactive' => 0)); $this->db->where('fk_user_id',$userid); $this->db->where('fk_state_id',$value); $this->db->update(RCM_STATE_MAPPING); } } public function generateAndVerifyOTP($arg) { $this->db->select('USERPROFILE.userid, USERPROFILE.first_name as user_first_name, USERPROFILE.last_name as user_last_name, USERPROFILE.email, USERPROFILE.mobile_no,concat(USERPROFILE.first_name," ",USERPROFILE.last_name)as full_name,USERPROFILE.fk_entity_type_id'); $this->db->from(USERPROFILE.' as USERPROFILE'); $this->db->where('USERPROFILE.email',$arg['email']); if(isset($arg['OTP'])) $this->db->where('USERPROFILE.OTP',$arg['OTP']); $this->db->where('USERPROFILE.isactive',1); // return $this->db->get()->row()->column_list; $query = $this->db->get(); return $query->result_array(); } }