diff --git a/api/application/helpers/readexceldata_helper.php b/api/application/helpers/readexceldata_helper.php index a007819b..ad8d5d28 100644 --- a/api/application/helpers/readexceldata_helper.php +++ b/api/application/helpers/readexceldata_helper.php @@ -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;$i0) ? 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; }