GET LENDER LIST API

This commit is contained in:
Velz2020 2019-08-22 14:59:53 +05:30
parent 70b4451381
commit 55d3ac65f9
3 changed files with 23 additions and 3 deletions

View File

@ -8347,6 +8347,8 @@ class PD_Controller extends REST_Controller {
public function getLenderContactPersons_post()
{
$records = $this->post('records');
print_r($records);
$lender_contact_persons = $this->PD_Model->getLenderContactPersons($records['fk_lender_id'],$records['pd_branch_id']);
print_r($lender_contact_persons);
}
}

View File

@ -1844,5 +1844,23 @@ class PD_Model extends SPARQ_Model {
// $this->db->LIMIT($limit,$page);
return $result_array = $this->db->GET()->result_array();
}
function getLenderContactPersons($lender_id,$pd_branch_id)
{
$this->db->select('USERPROFILE.userid, concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as user_name,USERPROFILE.fk_entity_id,USERPROFILE.fk_city,USERPROFILEROLES.user_role,USERPROFILE.fk_entity_type_id,ROLES.role_name,if( POSITION("credit" IN ROLES.role_name),"CREDIT","SALES") as role_type');
$this->db->from(USERPROFILE.' as USERPROFILE');
$this->db->join(ENTITYLENDERBRANCH.' as ENTITYLENDERBRANCH',"USERPROFILE.fk_entity_id = ENTITYLENDERBRANCH.fk_entity_id and ENTITYLENDERBRANCH.isactive = 1 and ENTITYLENDERBRANCH.fk_city_id = USERPROFILE.fk_city and ENTITYLENDERBRANCH.entity_lender_branch_id = $pd_branch_id");
//$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(CITY.' as CITY','USERPROFILE.fk_city = CITY.city_id and CITY.isactive = 1','LEFT');
$this->db->join(USERPROFILEROLES. ' as USERPROFILEROLES','USERPROFILEROLES.fk_userid = USERPROFILE.userid and USERPROFILEROLES.isactive =1');
$this->db->join(ROLES.' as ROLES','ROLES.role_id = USERPROFILEROLES.user_role');
//$this->db->where('USERPROFILE.fk_city',$pd_branch_id);
$this->db->where('USERPROFILE.fk_entity_id',$lender_id);
$this->db->where('USERPROFILE.isactive',1);
$result = $this->db->get()->result_array();
//print_r($this->db->last_query());
return $result;
}
}

View File

@ -67,9 +67,9 @@
{
define('ENVIRONMENT','sparqprod');
}
else
else if(isset($_SERVER['HTTP_HOST']) && !strcasecmp($_SERVER['HTTP_HOST'],'localhost') && isset($_SERVER['REQUEST_URI']) && substr_count($_SERVER['REQUEST_URI'], 'sparqapi') == 1)
{
define('ENVIRONMENT','development');
define('ENVIRONMENT','testing');
}