FLYHI master : ps

This commit is contained in:
VE10-Sanjeev 2022-06-15 13:15:27 +05:30
parent cbf401e483
commit 269c0441e3
2 changed files with 47 additions and 0 deletions

View File

@ -380,5 +380,6 @@ $route['listFlyhiPD'] = 'Flyhi_Controller/listFlyhiPD';
$route['getFlyhiPD'] = 'Flyhi_Controller/getFlyhiPD';
$route['loadFlyhiPDTemplate'] = 'Flyhi_Controller/loadFlyhiPDTemplate';
$route['(downloadFlyhiPDReport/:any)'] = 'Flyhi_Controller/getFlyhiPDReport';
$route['getMasterForFlyhiPD'] = 'Flyhi_Controller/getMasterForFlyhiPD';

View File

@ -19,6 +19,52 @@ class Flyhi_Controller extends REST_Controller {
}
public function getMasterForFlyhiPD_get(){
$FHFSL_lender = (ENVIRONMENT == 'production' ? 19 : 49);
$FHFSL_product = (ENVIRONMENT == 'production' ? 27 : 26);
$default_product = $FHFSL_product;
$default_lender = $FHFSL_lender;
$lender_fields = array('entity_id','full_name','short_name');
$lender_where_condition_array = array('isactive' => 1,'entity_id' => $FHFSL_lender);
$result_data = $this->Flyhi_Model->selectCustomRecords($lender_fields,$lender_where_condition_array,ENTITY,array(),'','full_name');
if(count($result_data))
{
foreach($result_data as $key => $value)
{
$fields = array('*');
$where_condition_array = array('isactive' => 1,'fk_entity_id' => $value['entity_id']);
$result_data[$key]['billing_address'] = $this->Flyhi_Model->selectCustomRecords($fields,$where_condition_array,ENTITYBILLING);
$branch_fields = array('entity_lender_branch_id', 'branch_name');
$branch_where_condition_array = array('fk_entity_id' => $value['entity_id'],'isactive'=>1);
$result_data[$key]['branches'] = $this->Flyhi_Model->selectCustomRecords($branch_fields,$branch_where_condition_array,ENTITYLENDERBRANCH);
}
}
$product = $this->Flyhi_Model->selectCustomRecords(array('product_id','name as product_name','abbr as product_abbr','prod_catagory'),array('product_id' => $FHFSL_product),PRODUCTS);
$product = count($product)>0 ? $product : 'product was not found?. Create Product in Lender profile';
$columns = array('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');
$table = USERPROFILE.' as USERPROFILE';
$joins = array(array('table' => USERPROFILEROLES. ' as USERPROFILEROLES',
'condition' =>'USERPROFILEROLES.fk_userid = USERPROFILE.userid and USERPROFILEROLES.isactive =1',
'jointype' => 'INNER'),
array('table' => ROLES.' as ROLES',
'condition' =>'ROLES.role_id = USERPROFILEROLES.user_role',
'jointype' => 'INNER'));
$order_by = 'USERPROFILE.userid';
$or_where = array();
$lender_contact_persons = $this->Flyhi_Model->getJoinRecords($columns,$table,$joins,array('USERPROFILE.fk_entity_id' => $FHFSL_lender),$order_by,'DESC','',$or_where);
$lender_contact_persons = count($lender_contact_persons)>0 ? $lender_contact_persons : 'Credit Person Lender Profile was not found?. Create Credit Person Lender profile';
// isset($records['pd_branch_id']) ? $records['pd_branch_id'] : null
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = array('lender'=> $result_data,'products' =>$product,'lender_contact_persons'=>$lender_contact_persons,'default_lender' =>$FHFSL_lender,'default_product' =>$FHFSL_product);
$this->response($data,REST_Controller::HTTP_OK);
}
public function listFlyhiPD_get(){