key stakeholders changes for LFMP Product : ps

This commit is contained in:
sanjeev.p 2021-08-10 17:00:54 +05:30
parent 6332fc4513
commit a525e8e2d6

View File

@ -48,6 +48,7 @@ class readexceldata
$where_condition_array = array('isactive' => 1,'section_id' => $section_id);
//if($section_id == null){ $where_condition_array = array('isactive' => 1,'section_id in ' => '(null,1)'); }
$section_ref_data = $CI->PD_Model->selectCustomRecords(array('*'),$where_condition_array,EXCEL_COLUMN_REF_NAME);
$company_data = $CI->PD_Model->selectCustomRecords(array('*'),array('isactive' => 1,'section_id' =>1),EXCEL_COLUMN_REF_NAME);
// print_r($section_ref_data);die();
$return_data = array();
// $section_id = is_null($section_id) ? '' : $section_id;
@ -96,47 +97,70 @@ class readexceldata
}
else if($section_id == 5) //handle multiple stake holders data
{
// echo 'ajjnjk';
// print_r($return_data);//die();
$re_arranged_stake_holders_details = array();
if(isset($return_data['key_stakeholders']))
{
// $i =0 ;
foreach ($return_data['key_stakeholders'] as $key => $value)
{
for($i = 0;$i <= 2; $i++)
{ $pd_master = $CI->PD_Model->getPDMasterDetails($pd_id);
$product_abbr = $pd_master[0]['product_abbr'];
if($product_abbr == "LFMP"){ // ### LFMP Started Here.
$LFMP_company_data = SELF::getIndividualSectionData($sheetData,$company_data);
$LFMP_companies = array();
if(!empty($LFMP_company_data['borrower_details'])){
$cid=0;//for company ID
for($i=0;$i<count($LFMP_company_data['borrower_details']);$i++){
$entity_type = $LFMP_company_data['borrower_details'][$i]['entity_type'];
if($entity_type != "Individual"){
$cid++;//for company ID
$LFMP_companies[$i]['company_id'] = $cid;
$LFMP_companies[$i]['company_name'] = $LFMP_company_data['borrower_details'][$i]['borrower_name'];
}
}
}
$companycount = (count($LFMP_companies)>0) ? count($LFMP_companies) : 1;
for($i = 0;$i <= $companycount; $i++)
{
$dynamic_share_key = ('share_holding#'.($i + 1));
$dynamic_vintage_key = ('vintage_in_current_biz#'.($i + 1));
$dynamic_work_exp_key = ('total_work_exp#'.($i + 1));
if((array_key_exists( $dynamic_share_key, $value)) && (array_key_exists( $dynamic_vintage_key, $value)) && (array_key_exists( $dynamic_work_exp_key, $value)))
{
$temp['stakeholder_name'] = $value['stakeholder_name'];
$temp['share_holding'] = $value[ $dynamic_share_key ];
$temp['company_id'] = ($i + 1);
$temp['vintage_in_current_biz'] = $value[ $dynamic_vintage_key ];
$temp['total_work_exp'] = $value[ $dynamic_work_exp_key ];
$re_arranged_stake_holders_details[] = $temp;
}
// if()
// {
// }
// if(array_key_exists( $dynamic_work_exp_key, $value))
// {
// }
}
// $i++;
}
}
// print_r($re_arranged_stake_holders_details);
// die();
$j =0 ; //### temp inx (bcoz maran asked)
foreach ($return_data['key_stakeholders'] as $key => $value)
{
$dynamic_share_key = ('share_holding#'.($i + 1));
$dynamic_vintage_key = ('vintage_in_current_biz#'.($i + 1));
$dynamic_work_exp_key = ('total_work_exp#'.($i + 1));
if((array_key_exists( $dynamic_share_key, $value)) && (array_key_exists( $dynamic_vintage_key, $value)) && (array_key_exists( $dynamic_work_exp_key, $value)))
{
$temp['company_id'] = isset($LFMP_companies[$i]['company_id'])?$LFMP_companies[$i]['company_id']:0;
$temp['company_name'] = isset($LFMP_companies[$i]['company_name'])?$LFMP_companies[$i]['company_name']:"";
$temp['started_biz'] = "NO";
$temp['stakeholder_name'.$j] = $value['stakeholder_name'];
$temp['share_holding'.$j] = $value[$dynamic_share_key];
$temp['vintage_in_current_biz'.$j] = $value[$dynamic_vintage_key];
$temp['total_work_exp'.$j] = $value[ $dynamic_work_exp_key ];
$re_arranged_stake_holders_details[$i] = $temp;
}
$j++;
}
}
}//###LFMP Flow Closed Here
else{
foreach ($return_data['key_stakeholders'] as $key => $value)
{
for($i = 0;$i <= 2; $i++)
{
$dynamic_share_key = ('share_holding#'.($i + 1));
$dynamic_vintage_key = ('vintage_in_current_biz#'.($i + 1));
$dynamic_work_exp_key = ('total_work_exp#'.($i + 1));
if((array_key_exists( $dynamic_share_key, $value)) && (array_key_exists( $dynamic_vintage_key, $value)) && (array_key_exists( $dynamic_work_exp_key, $value)))
{
$temp['stakeholder_name'] = $value['stakeholder_name'];
$temp['share_holding'] = $value[ $dynamic_share_key ];
$temp['company_id'] = ($i + 1);
$temp['vintage_in_current_biz'] = $value[ $dynamic_vintage_key ];
$temp['total_work_exp'] = $value[ $dynamic_work_exp_key ];
$re_arranged_stake_holders_details[] = $temp;
}
}// ### default for loop closed here
}// ### foreach closed here
}//### normal flow closed here
}//### isset if closed here
$return_data['key_stakeholders'] = $re_arranged_stake_holders_details;
}