GET BUSI ACTIVITY
This commit is contained in:
parent
53ba26d8ef
commit
5ec2cdc718
@ -3117,12 +3117,12 @@ class PD_Controller extends REST_Controller {
|
||||
$this->db->WHERE('fk_form_id',13);
|
||||
$this->db->WHERE('fk_pd_id',$pdid);
|
||||
$this->db->GROUP_START();
|
||||
$this->db->OR_WHERE('column_name','type_of_activity');
|
||||
$this->db->OR_WHERE('column_name','type_of_activity_id');
|
||||
$this->db->OR_WHERE('column_name','profession_name');
|
||||
$this->db->GROUP_END();
|
||||
$result_array = $this->db->GET()->result_array();
|
||||
|
||||
//print_r($this->db->last_query());
|
||||
//print_r($result_array);die();
|
||||
|
||||
if(count($result_array))
|
||||
{
|
||||
@ -3135,23 +3135,92 @@ class PD_Controller extends REST_Controller {
|
||||
}
|
||||
else
|
||||
{
|
||||
$final_data['type_of_activity'][] = $res['column_value'];
|
||||
if(count($result_array > 0)){
|
||||
$final_data['type_of_activity'][] = $res['column_value'];}
|
||||
}
|
||||
}
|
||||
//print_r($final_data);
|
||||
|
||||
if(array_key_exists('type_of_activity',$final_data))
|
||||
{
|
||||
foreach($final_data['type_of_activity'] as $f_key => $f_value)
|
||||
{
|
||||
$fields = array('name');
|
||||
$where_condition_array = array('type_of_activity_id'=>$f_value,'isactive'=>1);
|
||||
$result = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,TYPEOFACTIVITY);
|
||||
$final_data['type_of_activity'][$f_key] = array('type_of_activity_id' => $f_value,'name' =>$result[0]['name']);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(count($final_data))
|
||||
{
|
||||
|
||||
|
||||
{
|
||||
//Get Products from Business Form
|
||||
$fields_pro = array('iter_column_name','column_value');
|
||||
$where_condition_array_pro = array('column_name'=>'main_products','isactive'=>1,'fk_pd_id' => $pdid, 'fk_form_id'=> 13);
|
||||
$prodcuts = $this->PD_Model->selectCustomRecords($fields_pro,$where_condition_array_pro,PDFORMDETAILS);
|
||||
//print_r($prodcuts);die();
|
||||
if(array_key_exists('type_of_activity',$final_data))
|
||||
{
|
||||
foreach($final_data['type_of_activity'] as $activity_key => $activity)
|
||||
{
|
||||
//print_r($activity);
|
||||
if($activity['type_of_activity_id'] == 1)
|
||||
{
|
||||
$temp = array();
|
||||
foreach($prodcuts as $product_key => $product)
|
||||
{
|
||||
|
||||
if($product['iter_column_name'] == 'manufacturing_activity_details')
|
||||
{
|
||||
$temp[] = array('id' => $product_key,'name' => $product['column_value']);
|
||||
}
|
||||
}
|
||||
$final_data['type_of_activity'][$activity_key]['prodcuts'] =$temp;
|
||||
}
|
||||
else if($activity['type_of_activity_id'] == 2)//Retail trading
|
||||
{
|
||||
$temp = array();
|
||||
foreach($prodcuts as $product_key => $product)
|
||||
{
|
||||
|
||||
if($product['iter_column_name'] == 'retail_trading__activity_details')
|
||||
{
|
||||
$temp[] = array('id' => $product_key,'name' => $product['column_value']);
|
||||
}
|
||||
}
|
||||
$final_data['type_of_activity'][$activity_key]['prodcuts'] =$temp;
|
||||
}
|
||||
else if($activity['type_of_activity_id'] == 3)//Wholesale Trade wholesale_trading_activity_details
|
||||
{
|
||||
$temp = array();
|
||||
foreach($prodcuts as $product_key => $product)
|
||||
{
|
||||
|
||||
if($product['iter_column_name'] == 'wholesale_trading_activity_details')
|
||||
{
|
||||
$temp[] = array('id' => $product_key,'name' => $product['column_value']);
|
||||
}
|
||||
}
|
||||
$final_data['type_of_activity'][$activity_key]['prodcuts'] =$temp;
|
||||
}
|
||||
else//Service Provider
|
||||
{
|
||||
$temp = array();
|
||||
foreach($prodcuts as $product_key => $product)
|
||||
{
|
||||
|
||||
if($product['iter_column_name'] == 'wholesale_trading_activity_details')
|
||||
{
|
||||
$temp[] = array('id' => $product_key,'name' => $product['column_value']);
|
||||
}
|
||||
}
|
||||
$final_data['type_of_activity'][$activity_key]['prodcuts'] =$temp;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//Response
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $final_data;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user