RCM Query changes : ps
This commit is contained in:
parent
0d0ea8edc2
commit
ff5c0a6649
@ -668,5 +668,7 @@ defined('USERCONFIG') OR define('USERCONFIG','m_user_config');
|
|||||||
defined('SMC_TEMP_ADDRESS') OR define('SMC_TEMP_ADDRESS','t_smc_temp_address');
|
defined('SMC_TEMP_ADDRESS') OR define('SMC_TEMP_ADDRESS','t_smc_temp_address');
|
||||||
defined('SMC_PRODUCT_WISE_FORM_MAPPING') OR define('SMC_PRODUCT_WISE_FORM_MAPPING','t_smc_credit_pd_product_form_mapping');
|
defined('SMC_PRODUCT_WISE_FORM_MAPPING') OR define('SMC_PRODUCT_WISE_FORM_MAPPING','t_smc_credit_pd_product_form_mapping');
|
||||||
|
|
||||||
|
defined('RCM_STATE_MAPPING') OR define('RCM_STATE_MAPPING','t_rcm_state_mapping');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -11085,6 +11085,8 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
|
|||||||
|
|
||||||
public function smcStuffs($pd_details,$existing_pd_details = array())
|
public function smcStuffs($pd_details,$existing_pd_details = array())
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// echo "i am here";exit();
|
||||||
//if is this MWISE (SMC Credit PD) lender then auto allocate to RCM users and make pd status as allocated
|
//if is this MWISE (SMC Credit PD) lender then auto allocate to RCM users and make pd status as allocated
|
||||||
|
|
||||||
//get RCM user for auto allocation based on pd address
|
//get RCM user for auto allocation based on pd address
|
||||||
|
|||||||
@ -2205,16 +2205,24 @@ class PD_Model extends SPARQ_Model {
|
|||||||
|
|
||||||
function getRCM($state)
|
function getRCM($state)
|
||||||
{
|
{
|
||||||
$fields = array('USERPROFILE.userid','USERPROFILE.first_name','USERPROFILE.last_name','USERPROFILEROLES.user_role');
|
// $fields = array('USERPROFILE.userid','USERPROFILE.first_name','USERPROFILE.last_name','USERPROFILEROLES.user_role');
|
||||||
$table = USERPROFILE.' as USERPROFILE';
|
// $table = USERPROFILE.' as USERPROFILE';
|
||||||
$where_condition_array = array('USERPROFILE.fk_state' => $state);
|
// $where_condition_array = array('USERPROFILE.fk_state' => $state);
|
||||||
|
// $joins = array(
|
||||||
|
// array('table'=>USERPROFILEROLES.' as USERPROFILEROLES','condition'=>'USERPROFILE.userid = USERPROFILEROLES.fk_userid and USERPROFILEROLES.user_role = 27 and USERPROFILEROLES.isactive = 1' ,'jointype'=>'INNER JOIN')
|
||||||
|
// );
|
||||||
|
|
||||||
|
$fields = array('RCM_STATE_MAPPING.fk_user_id as userid','USERPROFILE.first_name','USERPROFILE.last_name','USERPROFILEROLES.user_role');
|
||||||
|
$table = RCM_STATE_MAPPING.' as RCM_STATE_MAPPING';
|
||||||
|
$where_condition_array = array('RCM_STATE_MAPPING.isactive '=>1,'RCM_STATE_MAPPING.fk_state_id' => $state);
|
||||||
$joins = array(
|
$joins = array(
|
||||||
array('table'=>USERPROFILEROLES.' as USERPROFILEROLES','condition'=>'USERPROFILE.userid = USERPROFILEROLES.fk_userid and USERPROFILEROLES.user_role = 27 and USERPROFILEROLES.isactive = 1' ,'jointype'=>'INNER JOIN')
|
array('table'=>USERPROFILE." as USERPROFILE",'condition'=>"USERPROFILE.userid = RCM_STATE_MAPPING.fk_user_id " ,'jointype'=>'INNER JOIN'),
|
||||||
|
array('table'=>USERPROFILEROLES.' as USERPROFILEROLES','condition'=>'RCM_STATE_MAPPING.fk_user_id = USERPROFILEROLES.fk_userid and USERPROFILEROLES.user_role = 27 and USERPROFILEROLES.isactive = 1' ,'jointype'=>'INNER JOIN')
|
||||||
);
|
);
|
||||||
|
|
||||||
return
|
return
|
||||||
$this->getJoinRecords($fields,$table,$joins,$where_condition_array);
|
$this->getJoinRecords($fields,$table,$joins,$where_condition_array);
|
||||||
print_r($this->db->last_query());
|
// print_r($this->db->last_query());exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -98,17 +98,55 @@ class SMC_Credit_PD_Model extends SPARQ_Model {
|
|||||||
|
|
||||||
function getSMCFlowUsers($state,$role)
|
function getSMCFlowUsers($state,$role)
|
||||||
{
|
{
|
||||||
$fields = array('USERPROFILE.userid','USERPROFILE.first_name','USERPROFILE.last_name','USERPROFILEROLES.user_role');
|
|
||||||
$table = USERPROFILE.' as USERPROFILE';
|
|
||||||
$where_condition_array = array('USERPROFILE.fk_state' => $state);
|
$fields = array('RCM_STATE_MAPPING.fk_user_id as userid','USERPROFILE.first_name','USERPROFILE.last_name','USERPROFILEROLES.user_role');
|
||||||
$joins = array(
|
$table = RCM_STATE_MAPPING.' as RCM_STATE_MAPPING';
|
||||||
array('table'=>USERPROFILEROLES.' as USERPROFILEROLES','condition'=>"USERPROFILE.userid = USERPROFILEROLES.fk_userid and USERPROFILEROLES.user_role = $role and USERPROFILEROLES.isactive = 1" ,'jointype'=>'INNER JOIN')
|
$where_condition_array = array('RCM_STATE_MAPPING.isactive '=>1,'RCM_STATE_MAPPING.fk_state_id' => $state);
|
||||||
);
|
$joins = array(
|
||||||
|
array('table'=>USERPROFILE." as USERPROFILE",'condition'=>"USERPROFILE.userid = RCM_STATE_MAPPING.fk_user_id " ,'jointype'=>'INNER JOIN'),
|
||||||
|
array('table'=>USERPROFILEROLES.' as USERPROFILEROLES','condition'=>"RCM_STATE_MAPPING.fk_user_id = USERPROFILEROLES.fk_userid and USERPROFILEROLES.user_role = 27 and USERPROFILEROLES.isactive = 1" ,'jointype'=>'INNER JOIN')
|
||||||
|
);
|
||||||
|
$RCMusers = $this->SMC_Credit_PD_Model->getJoinRecords($fields,$table,$joins,$where_condition_array);
|
||||||
|
// print_r($this->db->last_query());exit();
|
||||||
|
|
||||||
|
$result = array();
|
||||||
|
|
||||||
|
if($role == 26){
|
||||||
$users = $this->SMC_Credit_PD_Model->getJoinRecords($fields,$table,$joins,$where_condition_array);
|
if(!empty($RCMusers)){
|
||||||
// print_r($this->db->last_query());
|
|
||||||
return $users;
|
$temp1 = array(); // to filter RCM user's id we using Temp1 array.
|
||||||
|
foreach($RCMusers as $rcm){array_push($temp1,$rcm['userid']);}
|
||||||
|
$this->db->select('RCM_STATE_MAPPING.fk_state_id');
|
||||||
|
$this->db->from(RCM_STATE_MAPPING.' as RCM_STATE_MAPPING');
|
||||||
|
$this->db->where_in('RCM_STATE_MAPPING.fk_user_id',$temp1);
|
||||||
|
$this->db->group_by('RCM_STATE_MAPPING.fk_state_id');
|
||||||
|
$RCMUsersStateId = $this->db->get()->result_array();
|
||||||
|
|
||||||
|
$temp2 = array(); // to filter RCM user's state id we using Temp2 array.
|
||||||
|
foreach($RCMUsersStateId as $stid){array_push($temp2,$stid['fk_state_id']);}
|
||||||
|
$this->db->select('USERPROFILE.userid,USERPROFILE.first_name,USERPROFILE.last_name,USERPROFILEROLES.user_role');
|
||||||
|
$this->db->from(USERPROFILE.' as USERPROFILE');
|
||||||
|
$this->db->join(USERPROFILEROLES.' as USERPROFILEROLES',"USERPROFILE.userid = USERPROFILEROLES.fk_userid and USERPROFILEROLES.user_role = $role and USERPROFILEROLES.isactive = 1",'INNER');
|
||||||
|
$this->db->where_in('USERPROFILE.fk_state',$temp2);
|
||||||
|
$CMusers = $this->db->get()->result_array();
|
||||||
|
|
||||||
|
$result = $CMusers;
|
||||||
|
}
|
||||||
|
}else if($role == 27){
|
||||||
|
$result = $RCMusers;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
// Don't Remove Existing Query.
|
||||||
|
// $fields = array('USERPROFILE.userid','USERPROFILE.first_name','USERPROFILE.last_name','USERPROFILEROLES.user_role');
|
||||||
|
// $table = USERPROFILE.' as USERPROFILE';
|
||||||
|
// $where_condition_array = array('USERPROFILE.fk_state' => $state);
|
||||||
|
// $joins = array(
|
||||||
|
// array('table'=>USERPROFILEROLES.' as USERPROFILEROLES','condition'=>"USERPROFILE.userid = USERPROFILEROLES.fk_userid and USERPROFILEROLES.user_role = $role and USERPROFILEROLES.isactive = 1" ,'jointype'=>'INNER JOIN')
|
||||||
|
// );
|
||||||
|
// $users = $this->SMC_Credit_PD_Model->getJoinRecords($fields,$table,$joins,$where_condition_array);
|
||||||
|
// return $users;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user