getCompanyListForSMCList : ps

This commit is contained in:
Sanjeev 2021-04-13 19:01:00 +05:30
parent 487b68d082
commit 1ac062333f
2 changed files with 97 additions and 1 deletions

View File

@ -1347,7 +1347,7 @@ public function filterSalesPDList_post() {
$pd_master_data = $this->PD_Model->getPDMasterDetails($records['pd_id'],$records['random_string']);
// $cur_section_data = array();
$cur_section_data = $this->loadDataFromExcelBusiProcess($pd_master_data,(isset($records['form_id']) && $records['form_id'] ? $records['form_id'] : null));
// print_r($pd_master_data);die();
// print_r($pd_master_data);die();
// echo $records['form_id'];die();
//check excel file in local, otherwise get it from s3 and store locallly
@ -1680,6 +1680,41 @@ public function filterSalesPDList_post() {
// print_r($this->db->last_query());
}
function getCompanyListForSMCList_post()
{
$records = $this->post('records');
$pd_master_data = $this->PD_Model->getPDMasterDetails($records['pd_id'],$records['random_string']);
$filename = ($pd_master_data[0]['re_uploaded'] ? XLPATH.'/tmp/'.$pd_master_data[0]['re_uploaded_file_name'] : XLPATH.'/tmp/'.$pd_master_data[0]['modified_fname']);
// $filename = '/home/VenbaLap08/Downloads/Test Demo17_dev.xlsx';
if(!file_exists($filename))
{
$bucket_name = LENDER_BUCKET_NAME_PREFIX.$pd_master_data[0]['fk_lender_id'];
$key = 'tmp/'. ($pd_master_data[0]['re_uploaded'] ? $pd_master_data[0]['re_uploaded_file_name'] : $pd_master_data[0]['modified_fname']);
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'+5 minutes');
$sucess = file_put_contents($filename, file_get_contents($singed_uri));
}
$cur_section_data = readexceldata::getCompanyListForSMCList($filename,$pd_master_data[0]['pd_id']);
if(count($cur_section_data))
{
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = $cur_section_data;
$this->response($data,REST_Controller::HTTP_OK);
}
else
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NOT_FOUND;
$data['msg'] = 'No Data Available!';
$this->response($data,REST_Controller::HTTP_OK);
}
}
}

View File

@ -400,5 +400,66 @@ class readexceldata
// return date('m/d/Y',mktime(0,0,0,1,($excel_date-1),1900));
//gmdate("d-m-Y H:i:s", $UNIX_DATE);
}
public static function getCompanyListForSMCList($file_path_withname,$pd_id = null,$excel_file_id = null)
{
$CI =&get_instance();
$CI->load->library('myspreadsheet');
$CI->load->model('PD_Model');
$section_id = 1;
SELF::$current_section_id = $section_id;
SELF::$current_excel_file_id = $excel_file_id;
$spreadsheet_io_fact = $CI->myspreadsheet->getIOFactory($file_path_withname);
$spreadsheet_io_fact->setActiveSheetIndex(0);
$sheetData = $spreadsheet_io_fact->getActiveSheet()->toArray(null, true, false, true);
$where_condition_array = array('isactive' => 1,'section_id' => $section_id);
$section_ref_data = $CI->PD_Model->selectCustomRecords(array('*'),$where_condition_array,EXCEL_COLUMN_REF_NAME);
$return_data = array();
$keys = array();
$company = array();
foreach ($sheetData as $key => $value)
{
$tmp = SELF::returnMatchedData($section_ref_data,$value);//print_r($tmp);
if(is_array($tmp))
{
if(isset($tmp['parent_key']))
{
$trimedData = SELF::trimExcelEmptyCells($value);
$temp[$tmp['parent_key']][$tmp['key_name']] = SELF::getMultipleCellValues($trimedData,$tmp['key_name']);
$keys[$tmp['parent_key']][] = $tmp['key_name'];
$return_data = $temp;
}
else
{
$temp[$tmp['key_name']] = $value['C'];
$return_data = $temp;
}
}
}
$return_data = SELF::transformRowColumsForMultipleData($return_data,$keys);
if(!empty($return_data['borrower_details'])){
$cid=0;//for company ID
for($i=0;$i<count($return_data['borrower_details']);$i++){
$entity_type = $return_data['borrower_details'][$i]['entity_type'];;
if($entity_type != "Individual"){
$cid++;//for company ID
$return_data['borrower_details'][$i]['company_id'] = $cid;
array_push($company,$return_data['borrower_details'][$i]);
}
}
}
return $company;
}
}
?>