SAVE CO APPLICANT
This commit is contained in:
parent
55b3a375b4
commit
41c74b5ed6
@ -610,6 +610,7 @@ class Entity_Management_Controller extends REST_Controller {
|
||||
//echo "dssd";
|
||||
$records = $this->post('records');
|
||||
$entity_id = $records['fk_entity_id'];
|
||||
$entity_tat_master_id = $records['entity_tat_master_id'];
|
||||
//print_r($this->post('records'));
|
||||
$fields = array('entity_tat_master_id', 'fk_entity_id', 'tat1', 'tat2');
|
||||
$where_condition_array = array('fk_entity_id' => $entity_id,'isactive'=>1);
|
||||
@ -642,7 +643,7 @@ class Entity_Management_Controller extends REST_Controller {
|
||||
$temp = array();
|
||||
$temp['entity_tat_child_id'] = $child['entity_tat_child_id'];
|
||||
$temp['city'] = array('id' => $child['fk_city_id'],'name' => $child['city_name']);
|
||||
$temp['prodcut'] = array('id' => $child['fk_product_id'],'name' => $child['prodcut_name']);
|
||||
$temp['product'] = array('id' => $child['fk_product_id'],'name' => $child['prodcut_name']);
|
||||
$temp['pd_type'] = array('id' => $child['fk_pd_type_id'],'name' => $child['pd_type_name']);
|
||||
$final_child[] = $temp;
|
||||
}
|
||||
@ -652,7 +653,7 @@ class Entity_Management_Controller extends REST_Controller {
|
||||
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $tat_master_reco5444rds;
|
||||
$data['records'] = $tat_master_records;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
|
||||
}
|
||||
|
||||
@ -1734,305 +1734,305 @@ class PD_Controller extends REST_Controller {
|
||||
|
||||
|
||||
/********* Save Form Informations @param pd_id and pd_form_id ******/
|
||||
public function savePDFormDetails_post()
|
||||
{
|
||||
$records = $this->post('records');
|
||||
// public function savePDFormDetails_post()
|
||||
// {
|
||||
// $records = $this->post('records');
|
||||
|
||||
//print_r($records);echo '****************************';
|
||||
$pd_id = $records['pdid'];
|
||||
//print_r($records);die();
|
||||
//Get Pd masters etails usng PD ID
|
||||
$pd_details = $this->PD_Model->getPDMasterDetails($pd_id);
|
||||
// //print_r($records);echo '****************************';
|
||||
// $pd_id = $records['pdid'];
|
||||
// //print_r($records);die();
|
||||
// //Get Pd masters etails usng PD ID
|
||||
// $pd_details = $this->PD_Model->getPDMasterDetails($pd_id);
|
||||
|
||||
|
||||
$pd_form_id = $records['formid'];
|
||||
$fk_createdby = $records['fk_createdby'];
|
||||
$i = 0;
|
||||
$base64images = array();
|
||||
//seperate base64 images from records array
|
||||
if(array_key_exists('base64images',$records))
|
||||
{
|
||||
$base64images = $records['base64images'];
|
||||
unset($records['base64images']);
|
||||
}
|
||||
|
||||
//If It is General Informatin Form Save New Co Applcants details
|
||||
// by Passing records form to another(saveCoApplicantsFromGeneralInfoForm) internl function
|
||||
if($records['formid'] == 18)
|
||||
{
|
||||
$this->saveCoApplicantsFromGeneralInfoForm($records);
|
||||
}
|
||||
|
||||
// if($pd_form_id == 6)
|
||||
// {
|
||||
// if(array_key_exists('family_details',$records))
|
||||
// $pd_form_id = $records['formid'];
|
||||
// $fk_createdby = $records['fk_createdby'];
|
||||
// $i = 0;
|
||||
// $base64images = array();
|
||||
// //seperate base64 images from records array
|
||||
// if(array_key_exists('base64images',$records))
|
||||
// {
|
||||
// $records = $records['family_details'];
|
||||
// unset($records['family_details']);
|
||||
|
||||
// $base64images = $records['base64images'];
|
||||
// unset($records['base64images']);
|
||||
// }
|
||||
// }
|
||||
|
||||
if($pd_form_id == 1)// If formis supplier then omit parent level array keys
|
||||
{
|
||||
if(array_key_exists('manufacturing_details',$records))
|
||||
{
|
||||
$records['main_raw_materials'] = $records['manufacturing_details'][0]['main_raw_materials'];
|
||||
$records['main_raw_materials_total_payments_percent_on_credit'] = $records['manufacturing_details'][0]['main_raw_materials_total_payments_percent_on_credit'];
|
||||
unset($records['manufacturing_details']);
|
||||
}
|
||||
|
||||
if(array_key_exists('trade_details',$records))
|
||||
{
|
||||
$records['trading_products'] = $records['trade_details'][0]['trading_products'];
|
||||
$records['trading_products_total_payments_percent_on_credit'] = $records['trade_details'][0]['trading_products_total_payments_percent_on_credit'];
|
||||
unset($records['trade_details']);
|
||||
}
|
||||
}
|
||||
// //If It is General Informatin Form Save New Co Applcants details
|
||||
// // by Passing records form to another(saveCoApplicantsFromGeneralInfoForm) internl function
|
||||
// if($records['formid'] == 18)
|
||||
// {
|
||||
// $this->saveCoApplicantsFromGeneralInfoForm($records);
|
||||
// }
|
||||
|
||||
if($pd_form_id == 2)// If formis client then omit parent level array keys
|
||||
{
|
||||
if(array_key_exists('manufacturing_details',$records))
|
||||
{
|
||||
$records['main_raw_materials'] = $records['manufacturing_details'][0]['main_raw_materials'];
|
||||
$records['main_raw_materials_total_payments_percent_on_credit'] = $records['manufacturing_details'][0]['main_raw_materials_total_payments_percent_on_credit'];
|
||||
unset($records['manufacturing_details']);
|
||||
}
|
||||
// // if($pd_form_id == 6)
|
||||
// // {
|
||||
// // if(array_key_exists('family_details',$records))
|
||||
// // {
|
||||
// // $records = $records['family_details'];
|
||||
// // unset($records['family_details']);
|
||||
|
||||
// // }
|
||||
// // }
|
||||
|
||||
// if($pd_form_id == 1)// If formis supplier then omit parent level array keys
|
||||
// {
|
||||
// if(array_key_exists('manufacturing_details',$records))
|
||||
// {
|
||||
// $records['main_raw_materials'] = $records['manufacturing_details'][0]['main_raw_materials'];
|
||||
// $records['main_raw_materials_total_payments_percent_on_credit'] = $records['manufacturing_details'][0]['main_raw_materials_total_payments_percent_on_credit'];
|
||||
// unset($records['manufacturing_details']);
|
||||
// }
|
||||
|
||||
if(array_key_exists('trade_details',$records))
|
||||
{
|
||||
$records['trading_products'] = $records['trade_details'][0]['trading_products'];
|
||||
$records['trading_products_total_payments_percent_on_credit'] = $records['trade_details'][0]['trading_products_total_payments_percent_on_credit'];
|
||||
unset($records['trade_details']);
|
||||
}
|
||||
|
||||
// if(array_key_exists('service_provider_details',$records))
|
||||
// if(array_key_exists('trade_details',$records))
|
||||
// {
|
||||
// $records['trading_products'] = $records['trade_details'][0]['trading_products'];
|
||||
// $records['trading_products_total_payments_percent_on_credit'] = $records['trade_details'][0]['trading_products_total_payments_percent_on_credit'];
|
||||
// unset($records['trade_details']);
|
||||
// }
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
if($pd_form_id == 11)// If formis supplier then omit parent level array keys
|
||||
{
|
||||
if(array_key_exists('manufacturing_details',$records))
|
||||
{
|
||||
$records['manufacturing_raw_materials'] = $records['manufacturing_details'][0]['manufacturing_raw_materials'];
|
||||
$records['manufacturing_finished_goods'] = $records['manufacturing_details'][0]['manufacturing_finished_goods'];
|
||||
$records['manufacturing_traded_goods'] = $records['manufacturing_details'][0]['manufacturing_traded_goods'];
|
||||
// $records['main_raw_materials_total_payments_percent_on_credit'] = $records['manufacturing_details'][0]['main_raw_materials_total_payments_percent_on_credit'];
|
||||
unset($records['manufacturing_details']);
|
||||
}
|
||||
// if($pd_form_id == 2)// If formis client then omit parent level array keys
|
||||
// {
|
||||
// if(array_key_exists('manufacturing_details',$records))
|
||||
// {
|
||||
// $records['main_raw_materials'] = $records['manufacturing_details'][0]['main_raw_materials'];
|
||||
// $records['main_raw_materials_total_payments_percent_on_credit'] = $records['manufacturing_details'][0]['main_raw_materials_total_payments_percent_on_credit'];
|
||||
// unset($records['manufacturing_details']);
|
||||
// }
|
||||
|
||||
if(array_key_exists('trade_details',$records))
|
||||
{
|
||||
$records['trading_finished_goods'] = $records['trade_details'][0]['trading_finished_goods'];
|
||||
$records['trading_traded_goods'] = $records['trade_details'][0]['trading_traded_goods'];
|
||||
// $records['trading_products_total_payments_percent_on_credit'] = $records['trade_details'][0]['trading_products_total_payments_percent_on_credit'];
|
||||
unset($records['trade_details']);
|
||||
}
|
||||
// if(array_key_exists('trade_details',$records))
|
||||
// {
|
||||
// $records['trading_products'] = $records['trade_details'][0]['trading_products'];
|
||||
// $records['trading_products_total_payments_percent_on_credit'] = $records['trade_details'][0]['trading_products_total_payments_percent_on_credit'];
|
||||
// unset($records['trade_details']);
|
||||
// }
|
||||
|
||||
if(array_key_exists('retail_details',$records))
|
||||
{
|
||||
$records['retail_finished_goods'] = $records['retail_details'][0]['retail_finished_goods'];
|
||||
$records['retail_traded_goods'] = $records['retail_details'][0]['retail_traded_goods'];
|
||||
// $records['trading_products_total_payments_percent_on_credit'] = $records['trade_details'][0]['trading_products_total_payments_percent_on_credit'];
|
||||
unset($records['retail_details']);
|
||||
}
|
||||
}
|
||||
// // if(array_key_exists('service_provider_details',$records))
|
||||
// // {
|
||||
// // $records['trading_products'] = $records['trade_details'][0]['trading_products'];
|
||||
// // $records['trading_products_total_payments_percent_on_credit'] = $records['trade_details'][0]['trading_products_total_payments_percent_on_credit'];
|
||||
// // unset($records['trade_details']);
|
||||
// // }
|
||||
// }
|
||||
|
||||
//print_r($records);
|
||||
|
||||
// if($pd_form_id == 11)// If formis supplier then omit parent level array keys
|
||||
// {
|
||||
// if(array_key_exists('manufacturing_details',$records))
|
||||
// {
|
||||
// $records['manufacturing_raw_materials'] = $records['manufacturing_details'][0]['manufacturing_raw_materials'];
|
||||
// $records['manufacturing_finished_goods'] = $records['manufacturing_details'][0]['manufacturing_finished_goods'];
|
||||
// $records['manufacturing_traded_goods'] = $records['manufacturing_details'][0]['manufacturing_traded_goods'];
|
||||
// // $records['main_raw_materials_total_payments_percent_on_credit'] = $records['manufacturing_details'][0]['main_raw_materials_total_payments_percent_on_credit'];
|
||||
// unset($records['manufacturing_details']);
|
||||
// }
|
||||
|
||||
// if(array_key_exists('trade_details',$records))
|
||||
// {
|
||||
// $records['trading_finished_goods'] = $records['trade_details'][0]['trading_finished_goods'];
|
||||
// $records['trading_traded_goods'] = $records['trade_details'][0]['trading_traded_goods'];
|
||||
// // $records['trading_products_total_payments_percent_on_credit'] = $records['trade_details'][0]['trading_products_total_payments_percent_on_credit'];
|
||||
// unset($records['trade_details']);
|
||||
// }
|
||||
|
||||
// if(array_key_exists('retail_details',$records))
|
||||
// {
|
||||
// $records['retail_finished_goods'] = $records['retail_details'][0]['retail_finished_goods'];
|
||||
// $records['retail_traded_goods'] = $records['retail_details'][0]['retail_traded_goods'];
|
||||
// // $records['trading_products_total_payments_percent_on_credit'] = $records['trade_details'][0]['trading_products_total_payments_percent_on_credit'];
|
||||
// unset($records['retail_details']);
|
||||
// }
|
||||
// }
|
||||
|
||||
// //print_r($records);
|
||||
|
||||
|
||||
|
||||
//Deactivate Old rec
|
||||
$where_condition_array = array('fk_pd_id' => $pd_id,"fk_form_id"=>$pd_form_id);
|
||||
$array = array('isactive'=>0);
|
||||
$pd_id_modified = $this->PD_Model->updateRecords($array,PDFORMDETAILS,$where_condition_array);
|
||||
// //Deactivate Old rec
|
||||
// $where_condition_array = array('fk_pd_id' => $pd_id,"fk_form_id"=>$pd_form_id);
|
||||
// $array = array('isactive'=>0);
|
||||
// $pd_id_modified = $this->PD_Model->updateRecords($array,PDFORMDETAILS,$where_condition_array);
|
||||
|
||||
|
||||
foreach($records as $rec_key => $record)
|
||||
{
|
||||
$i++;
|
||||
// foreach($records as $rec_key => $record)
|
||||
// {
|
||||
// $i++;
|
||||
|
||||
if($rec_key !='pdid' && $rec_key != 'formid' && $rec_key != 'fk_createdby')
|
||||
{
|
||||
// if($rec_key !='pdid' && $rec_key != 'formid' && $rec_key != 'fk_createdby')
|
||||
// {
|
||||
|
||||
if(!is_array($record))//check key and value pair is not an array
|
||||
{
|
||||
if($rec_key == 'selected_person')
|
||||
{
|
||||
echo "selected_person-".$record;
|
||||
}
|
||||
$temp_array = array('fk_pd_id'=>$pd_id,'fk_form_id'=>$pd_form_id,'column_name'=>$rec_key,'column_value'=>$record,'fk_createdby'=>$fk_createdby);
|
||||
$id = $this->PD_Model->saveRecords($temp_array,PDFORMDETAILS);
|
||||
// if(!is_array($record))//check key and value pair is not an array
|
||||
// {
|
||||
// if($rec_key == 'selected_person')
|
||||
// {
|
||||
// echo "selected_person-".$record;
|
||||
// }
|
||||
// $temp_array = array('fk_pd_id'=>$pd_id,'fk_form_id'=>$pd_form_id,'column_name'=>$rec_key,'column_value'=>$record,'fk_createdby'=>$fk_createdby);
|
||||
// $id = $this->PD_Model->saveRecords($temp_array,PDFORMDETAILS);
|
||||
|
||||
}
|
||||
else // array of key value pairs
|
||||
{
|
||||
$iter=0;
|
||||
foreach($record as $mkey => $rec)
|
||||
{
|
||||
//print_r($rec);
|
||||
$iter++;
|
||||
if(!is_array($rec))
|
||||
{
|
||||
// }
|
||||
// else // array of key value pairs
|
||||
// {
|
||||
// $iter=0;
|
||||
// foreach($record as $mkey => $rec)
|
||||
// {
|
||||
// //print_r($rec);
|
||||
// $iter++;
|
||||
// if(!is_array($rec))
|
||||
// {
|
||||
|
||||
foreach($rec as $rkey => $r)
|
||||
{
|
||||
$temp_array = array('');
|
||||
if($r != "" && $r != null)
|
||||
{
|
||||
// foreach($rec as $rkey => $r)
|
||||
// {
|
||||
// $temp_array = array('');
|
||||
// if($r != "" && $r != null)
|
||||
// {
|
||||
|
||||
$temp_array = array('fk_pd_id'=>$pd_id,'fk_form_id'=>$pd_form_id,'iter_column_name'=>$rec_key,'column_name'=>$rkey,'column_value'=>$r,'fk_createdby'=>$fk_createdby,'iteration'=>$iter);
|
||||
$id = $this->PD_Model->saveRecords($temp_array,PDFORMDETAILS);
|
||||
}
|
||||
// $temp_array = array('fk_pd_id'=>$pd_id,'fk_form_id'=>$pd_form_id,'iter_column_name'=>$rec_key,'column_name'=>$rkey,'column_value'=>$r,'fk_createdby'=>$fk_createdby,'iteration'=>$iter);
|
||||
// $id = $this->PD_Model->saveRecords($temp_array,PDFORMDETAILS);
|
||||
// }
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($rec as $child_key => $child_data)
|
||||
{
|
||||
//print_r($child_data);
|
||||
// echo "$child_key-\n\n\n";
|
||||
if(!is_array($child_data))
|
||||
{
|
||||
//echo "not array\n\n";
|
||||
//print_r($child_data);
|
||||
$temp_array = array('fk_pd_id'=>$pd_id,'fk_form_id'=>$pd_form_id,'column_name'=>$child_key,'column_value'=>$child_data,'iter_column_name'=>$rec_key,'fk_createdby'=>$fk_createdby,'iteration'=>$iter);
|
||||
//print_r($temp_array);
|
||||
$id = $this->PD_Model->saveRecords($temp_array,PDFORMDETAILS);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// foreach($rec as $child_key => $child_data)
|
||||
// {
|
||||
// //print_r($child_data);
|
||||
// // echo "$child_key-\n\n\n";
|
||||
// if(!is_array($child_data))
|
||||
// {
|
||||
// //echo "not array\n\n";
|
||||
// //print_r($child_data);
|
||||
// $temp_array = array('fk_pd_id'=>$pd_id,'fk_form_id'=>$pd_form_id,'column_name'=>$child_key,'column_value'=>$child_data,'iter_column_name'=>$rec_key,'fk_createdby'=>$fk_createdby,'iteration'=>$iter);
|
||||
// //print_r($temp_array);
|
||||
// $id = $this->PD_Model->saveRecords($temp_array,PDFORMDETAILS);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// echo "array";
|
||||
//print_r($child_data);
|
||||
foreach($child_data as $business_key => $business_child)
|
||||
{
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // echo "array";
|
||||
// //print_r($child_data);
|
||||
// foreach($child_data as $business_key => $business_child)
|
||||
// {
|
||||
|
||||
//print_r($business_child);
|
||||
if(!is_array($business_child))
|
||||
{
|
||||
//print_r($business_child);
|
||||
foreach($business_child as $last_key_s => $last_data)
|
||||
{
|
||||
// //print_r($business_child);
|
||||
// if(!is_array($business_child))
|
||||
// {
|
||||
// //print_r($business_child);
|
||||
// foreach($business_child as $last_key_s => $last_data)
|
||||
// {
|
||||
|
||||
// foreach($last_data as $final_key => $final_data)
|
||||
// // foreach($last_data as $final_key => $final_data)
|
||||
// // {
|
||||
// // $temp_array = array('fk_pd_id'=>$pd_id,'fk_form_id'=>$pd_form_id,'column_name'=>$final_key,'column_value'=>$final_data,'iter_column_name'=>$rec_key,'iter_sub_column_name'=>$child_key,'fk_createdby'=>$fk_createdby,'iteration'=>$iter);
|
||||
// // //print_r($temp_array);
|
||||
// // $id = $this->PD_Model->saveRecords($temp_array,PDFORMDETAILS);
|
||||
// // }
|
||||
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// foreach($business_child as $last_key_a => $last_data)
|
||||
// {
|
||||
// //print_r($last_data);
|
||||
// if(!is_array($last_data))
|
||||
// {
|
||||
// $temp_array = array('fk_pd_id'=>$pd_id,'fk_form_id'=>$pd_form_id,'column_name'=>$final_key,'column_value'=>$final_data,'iter_column_name'=>$rec_key,'iter_sub_column_name'=>$child_key,'fk_createdby'=>$fk_createdby,'iteration'=>$iter);
|
||||
// //print_r($temp_array);
|
||||
// $id = $this->PD_Model->saveRecords($temp_array,PDFORMDETAILS);
|
||||
// $temp_array = array('fk_pd_id'=>$pd_id,'fk_form_id'=>$pd_form_id,'column_name'=>$last_key_a,'column_value'=>$last_data,'iter_column_name'=>$rec_key,'iter_sub_column_name'=>$child_key,'fk_createdby'=>$fk_createdby,'iteration'=>$iter);
|
||||
// $id = $this->PD_Model->saveRecords($temp_array,PDFORMDETAILS);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //$current_temp_array = array_values($last_data[0]);
|
||||
// //print_r($last_data);
|
||||
// foreach($last_data as $l_key => $l_data)
|
||||
// {
|
||||
// // foreach($l_data as $k => $v)
|
||||
// // {
|
||||
// // $temp_array = array('fk_pd_id'=>$pd_id,'fk_form_id'=>$pd_form_id,'column_name'=>$k,'column_value'=>$v,'iter_column_name'=>$rec_key,'iter_sub_column_name'=>$child_key,'fk_createdby'=>$fk_createdby,'iteration'=>$iter,'column_id' => $last_key_a);
|
||||
// // $id = $this->PD_Model->saveRecords($temp_array,PDFORMDETAILS);
|
||||
// // }
|
||||
|
||||
// $temp_array = array('fk_pd_id'=>$pd_id,'fk_form_id'=>$pd_form_id,'column_name'=>$l_key,'column_value'=>$l_data,'iter_column_name'=>$rec_key,'iter_sub_column_name'=>$child_key,'fk_createdby'=>$fk_createdby,'iteration'=>$iter,'column_id' => $last_key_a);
|
||||
// $id = $this->PD_Model->saveRecords($temp_array,PDFORMDETAILS);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($business_child as $last_key_a => $last_data)
|
||||
{
|
||||
//print_r($last_data);
|
||||
if(!is_array($last_data))
|
||||
{
|
||||
$temp_array = array('fk_pd_id'=>$pd_id,'fk_form_id'=>$pd_form_id,'column_name'=>$last_key_a,'column_value'=>$last_data,'iter_column_name'=>$rec_key,'iter_sub_column_name'=>$child_key,'fk_createdby'=>$fk_createdby,'iteration'=>$iter);
|
||||
$id = $this->PD_Model->saveRecords($temp_array,PDFORMDETAILS);
|
||||
}
|
||||
else
|
||||
{
|
||||
//$current_temp_array = array_values($last_data[0]);
|
||||
//print_r($last_data);
|
||||
foreach($last_data as $l_key => $l_data)
|
||||
{
|
||||
// foreach($l_data as $k => $v)
|
||||
// {
|
||||
// $temp_array = array('fk_pd_id'=>$pd_id,'fk_form_id'=>$pd_form_id,'column_name'=>$k,'column_value'=>$v,'iter_column_name'=>$rec_key,'iter_sub_column_name'=>$child_key,'fk_createdby'=>$fk_createdby,'iteration'=>$iter,'column_id' => $last_key_a);
|
||||
// $id = $this->PD_Model->saveRecords($temp_array,PDFORMDETAILS);
|
||||
// }
|
||||
|
||||
$temp_array = array('fk_pd_id'=>$pd_id,'fk_form_id'=>$pd_form_id,'column_name'=>$l_key,'column_value'=>$l_data,'iter_column_name'=>$rec_key,'iter_sub_column_name'=>$child_key,'fk_createdby'=>$fk_createdby,'iteration'=>$iter,'column_id' => $last_key_a);
|
||||
$id = $this->PD_Model->saveRecords($temp_array,PDFORMDETAILS);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
}
|
||||
}// end of array of key value pairs
|
||||
}
|
||||
//}
|
||||
//**************** End of handle form details logic***************//
|
||||
// }
|
||||
// }// end of array of key value pairs
|
||||
// }
|
||||
// //}
|
||||
// //**************** End of handle form details logic***************//
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
//*****************************upload base64 images
|
||||
if(count($base64images))
|
||||
{
|
||||
// //*****************************upload base64 images
|
||||
// if(count($base64images))
|
||||
// {
|
||||
|
||||
foreach($base64images as $iter => $doc)
|
||||
{
|
||||
$temp_base64_string = $doc['image'];
|
||||
$title = $doc['Name'];
|
||||
$output_file = APPPATH."/docs/temp_base64_image.png";
|
||||
// foreach($base64images as $iter => $doc)
|
||||
// {
|
||||
// $temp_base64_string = $doc['image'];
|
||||
// $title = $doc['Name'];
|
||||
// $output_file = APPPATH."/docs/temp_base64_image.png";
|
||||
|
||||
//Generate Random File Name
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$charactersLength = strlen($characters);
|
||||
$randomString = '';
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||
}
|
||||
$temp_file_name = $randomString.date('Y-m-d-H:m:s').'.png';
|
||||
// //Generate Random File Name
|
||||
// $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
// $charactersLength = strlen($characters);
|
||||
// $randomString = '';
|
||||
// for ($i = 0; $i < 5; $i++) {
|
||||
// $randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||
// }
|
||||
// $temp_file_name = $randomString.date('Y-m-d-H:m:s').'.png';
|
||||
|
||||
|
||||
$ifp = fopen( $output_file, 'wb' );
|
||||
$temp_data = explode( ',', $temp_base64_string );
|
||||
fwrite( $ifp, base64_decode( $temp_data[ 1 ] ) );
|
||||
fclose( $ifp );
|
||||
$tempdoc = $output_file;
|
||||
$tempdocname = $temp_file_name;
|
||||
$bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_details['fk_lender_id'];
|
||||
$key = 'pd'.$pd_id.'/'.$tempdocname ;
|
||||
$sourcefile = $tempdoc;
|
||||
// $ifp = fopen( $output_file, 'wb' );
|
||||
// $temp_data = explode( ',', $temp_base64_string );
|
||||
// fwrite( $ifp, base64_decode( $temp_data[ 1 ] ) );
|
||||
// fclose( $ifp );
|
||||
// $tempdoc = $output_file;
|
||||
// $tempdocname = $temp_file_name;
|
||||
// $bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_details['fk_lender_id'];
|
||||
// $key = 'pd'.$pd_id.'/'.$tempdocname ;
|
||||
// $sourcefile = $tempdoc;
|
||||
|
||||
$bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$sourcefile);
|
||||
$s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data);
|
||||
// $bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$sourcefile);
|
||||
// $s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data);
|
||||
|
||||
if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200)
|
||||
{
|
||||
$record_data = array('fk_pd_id' => $pd_id,'fk_form_id'=>$pd_form_id,'pd_document_title'=>$title,'pd_document_name'=>$tempdocname);
|
||||
$this->PD_Model->saveRecords($record_data,PDDOCUMENTS);
|
||||
}
|
||||
// if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200)
|
||||
// {
|
||||
// $record_data = array('fk_pd_id' => $pd_id,'fk_form_id'=>$pd_form_id,'pd_document_title'=>$title,'pd_document_name'=>$tempdocname);
|
||||
// $this->PD_Model->saveRecords($record_data,PDDOCUMENTS);
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
//*******************************upload base64 images
|
||||
// }
|
||||
// }
|
||||
// //*******************************upload base64 images
|
||||
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
//$data['records'] = $result_array;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
// $data['dataStatus'] = true;
|
||||
// $data['status'] = REST_Controller::HTTP_OK;
|
||||
// //$data['records'] = $result_array;
|
||||
// $this->response($data,REST_Controller::HTTP_OK);
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
public function savePDFormDetailsJSON_post()
|
||||
{
|
||||
$records = $this->post('records');
|
||||
|
||||
//echo "dnkd";
|
||||
$pdid = $records['pdid'];
|
||||
$formid = $records['formid'];
|
||||
$createdby = $records['fk_createdby'];
|
||||
@ -2042,6 +2042,16 @@ class PD_Controller extends REST_Controller {
|
||||
$company_id = $records['company_id'];
|
||||
}
|
||||
|
||||
//print_r($records);echo "\n\n\n";
|
||||
//Save Any New Applicants Details From General Form
|
||||
if($records['formid'] == 18)
|
||||
{
|
||||
|
||||
$records = $this->saveCoApplicantsFromGeneralInfoForm($records);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$fields = array('isactive' => 0);
|
||||
$where_condition_array = array('fk_form_id'=>$formid,'fk_pd_id'=>$pdid);
|
||||
if($company_id != null)
|
||||
@ -2050,11 +2060,7 @@ class PD_Controller extends REST_Controller {
|
||||
}
|
||||
$id = $this->PD_Model->updateRecords($fields,PDFORMDETAILSJSON,$where_condition_array);
|
||||
|
||||
//Save Any New Applicants Details From General Form
|
||||
// if($records['formid'] == 18)
|
||||
// {
|
||||
// $this->saveCoApplicantsFromGeneralInfoForm($records);
|
||||
// }
|
||||
|
||||
unset($records['pdid']);
|
||||
unset($records['formid']);
|
||||
unset($records['fk_createdby']);
|
||||
@ -2135,42 +2141,44 @@ class PD_Controller extends REST_Controller {
|
||||
public function saveCoApplicantsFromGeneralInfoForm($records)
|
||||
{
|
||||
|
||||
if(count($records['applicant_relation']))
|
||||
if(count($records['individuals']))
|
||||
{
|
||||
//echo 'saveCoApplicantsFromGeneralInfoForm';
|
||||
$exist_applicants = $this->PD_Model->getApplicantsDetails($records['pdid']);
|
||||
//print_r($exist_applicants);
|
||||
//echo "Yes";
|
||||
$index_of_new_applicants = array();
|
||||
foreach($records['applicant_relation'] as $applicant_key => $new_applicant)
|
||||
foreach($records['individuals'] as $applicant_key => $new_applicant)
|
||||
{
|
||||
$count = 0;
|
||||
|
||||
foreach($exist_applicants as $exist_key => $exist_applicant)//,
|
||||
{
|
||||
if($exist_applicant['applicant_type'] != 1)
|
||||
|
||||
if($new_applicant['is_new'] == true && $new_applicant['is_applicant'] == true)
|
||||
{
|
||||
if(!strcmp($new_applicant['applicant_name'],$exist_applicant['applicant_name']))
|
||||
{
|
||||
$count++;
|
||||
$temp_array = array('fk_pd_id'=>$records['pdid'],'applicant_name'=>$new_applicant['applicant_name'],'applicant_type'=>0,'relation'=>$new_applicant['relationship']);
|
||||
$where_condition_array = array('fk_pd_id'=>$records['pdid'],'applicant_name'=>$exist_applicant['applicant_name']);
|
||||
$this->PD_Model->updateRecords($temp_array,PDAPPLICANTSDETAILS,$where_condition_array);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if($count == 0)
|
||||
{
|
||||
$temp_array = array('fk_pd_id'=>$records['pdid'],'applicant_name'=>$new_applicant['applicant_name'],'applicant_type'=>0,'relation'=>$new_applicant['relationship']);
|
||||
$this->PD_Model->saveRecords($temp_array,PDAPPLICANTSDETAILS);
|
||||
|
||||
}
|
||||
$temp_array = array('fk_pd_id'=>$records['pdid'],'applicant_name'=>$new_applicant['applicant_name'],'applicant_type'=>0);
|
||||
$co_appliacant_id = $this->PD_Model->saveRecords($temp_array,PDAPPLICANTSDETAILS);
|
||||
|
||||
if($co_appliacant_id != null || $co_appliacant_id != "")
|
||||
{
|
||||
$records['individuals'][$applicant_key]['pd_co_applicant_id'] = $co_appliacant_id;
|
||||
$records['individuals'][$applicant_key]['is_new'] = false;
|
||||
|
||||
|
||||
// Replace Funciton Have to Do it.
|
||||
//FOr Personal Relationship and Company Relationship
|
||||
// Set Is_new to false
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $records;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -3768,7 +3776,8 @@ class PD_Controller extends REST_Controller {
|
||||
|
||||
public function codeigniterViewTest_post()
|
||||
{
|
||||
|
||||
$CI =& get_instance();
|
||||
print_r($CI);die();
|
||||
/* $data['pdid'] = '1256';
|
||||
$data['main_applicant_name'] = 'Mr.Ram Kumar';
|
||||
$data['cus_seg'] = 'SENP-AI';
|
||||
@ -3902,11 +3911,11 @@ class PD_Controller extends REST_Controller {
|
||||
foreach($company_list as $list_key => $company)
|
||||
{
|
||||
$form_array = array(
|
||||
array('form_id' => 13,'form_name' => 'Business Informations'),
|
||||
array('form_id' => 14,'form_name' => 'Financial Information'),
|
||||
array('form_id' => 1,'form_name' => 'Supplier Details'),
|
||||
array('form_id' => 2,'form_name' => 'Client Details'),
|
||||
array('form_id' => 11,'form_name' => 'Stock Details'),
|
||||
array('form_id' => 13,'form_name' => 'Business Informations'),
|
||||
array('form_id' => 14,'form_name' => 'Financial Information')
|
||||
|
||||
);
|
||||
$temp = array();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user