FLYHI Save Api Chnaged to new format :ps
This commit is contained in:
parent
b6754ed404
commit
4c56e8e182
@ -1224,7 +1224,7 @@ class Flyhi_Controller extends REST_Controller {
|
||||
|
||||
}
|
||||
|
||||
public function saveFlyhiPDsection_post()
|
||||
public function saveFlyhiPDsection_Aspersalespdtype_post()
|
||||
{
|
||||
$records = $this->post('records');
|
||||
$sales_pd_id = $records['sales_pd_id'];
|
||||
@ -1365,6 +1365,132 @@ class Flyhi_Controller extends REST_Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function saveFlyhiPDsection_post()
|
||||
{
|
||||
$records = $this->post('records');
|
||||
$sales_pd_id = $records['sales_pd_id'];
|
||||
$section_id = $records['section_id'];
|
||||
$fk_createdby = $records['fk_createdby'];
|
||||
$status = $records['is_complete'];
|
||||
$section_data = json_encode($records);
|
||||
|
||||
//Get Sales PD master Data
|
||||
|
||||
$columns = array('SALES_PD_DATA.*','ENTITY.short_name','PRODUCT.abbr');
|
||||
$table = SALES_PD_DATA.' as SALES_PD_DATA';
|
||||
$joins = array(
|
||||
array('table' => ENTITY. ' as ENTITY',
|
||||
'condition' =>'SALES_PD_DATA.lender_id = ENTITY.entity_id',
|
||||
'jointype' => 'INNER'),
|
||||
array('table' => PRODUCTS. ' as PRODUCT',
|
||||
'condition' =>'SALES_PD_DATA.product_id = PRODUCT.product_id',
|
||||
'jointype' => 'INNER')
|
||||
);
|
||||
|
||||
$where_condition_array = array('SALES_PD_DATA.sales_pd_id' => $sales_pd_id);
|
||||
$sales_pd_master_data = $this->Flyhi_Model->getJoinRecords($columns,$table,$joins,$where_condition_array);
|
||||
// print_r($records['json']);
|
||||
//pre process works
|
||||
switch($section_id)
|
||||
{
|
||||
case 1: //General section
|
||||
//update Applicant ID and applicant Name to sales pD master Table
|
||||
$applicant_id = null ; $city = null; $lender_id= null;$loan_amount = null;
|
||||
$pd_branch_id = null ; $lender_sales_person =null; $lender_credit_person =null;
|
||||
$flyhi_pd_type = null; $applicant_name =null;$current_resd_addr_check = 0 ;
|
||||
if($records['json'])
|
||||
{
|
||||
foreach ($records['json'] as $g_key => $g_value)
|
||||
{
|
||||
|
||||
if($g_key == 'loan_application_id'){
|
||||
$applicant_id = (!empty($g_value)) ? $g_value : 'Not Provided';
|
||||
}
|
||||
if($g_key == 'lender_name'){
|
||||
$lender_id = (!empty($g_value)) ? $g_value : null ;
|
||||
}
|
||||
if($g_key == 'loan_amount'){
|
||||
$loan_amount = (!empty($g_value)) ? $g_value : null ;
|
||||
}
|
||||
if($g_key == 'branch'){
|
||||
$pd_branch_id = (!empty($g_value)) ? $g_value : null ;
|
||||
}
|
||||
if($g_key == 'lender_sales_person'){
|
||||
$lender_sales_person = (!empty($g_value)) ? $g_value : null ;
|
||||
}
|
||||
if($g_key == 'lender_credit_person'){
|
||||
$lender_credit_person = (!empty($g_value)) ? $g_value : null ;
|
||||
}
|
||||
if($g_key == 'product_name'){
|
||||
$product_id = (!empty($g_value)) ? $g_value : null ;
|
||||
}
|
||||
if($g_key == 'applicant_name'){
|
||||
$applicant_name = (!empty($g_value)) ? $g_value : null ;
|
||||
}
|
||||
if($g_key == 'verification_type' && $g_value == 'Residence verification'){
|
||||
$flyhi_pd_type = 4;
|
||||
}
|
||||
if($g_key == 'verification_type' && $g_value == 'Office verification'){
|
||||
$flyhi_pd_type = 3;
|
||||
}
|
||||
if($g_key == 'Same_as_current_residence_address' && $g_value == 'NO'){
|
||||
$current_resd_addr_check = 1;
|
||||
}
|
||||
if($current_resd_addr_check && $g_key == 'permanent_city'){
|
||||
$city = $g_value;
|
||||
}else if($g_key == 'residence_details'){
|
||||
$city = $g_value[0]['residence_city'];
|
||||
}
|
||||
if($g_key == 'officer_city'){
|
||||
$city = $g_value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
$FLYHI_PD['applicant_name'] = $applicant_name;
|
||||
$FLYHI_PD['applicant_id'] = $applicant_id;
|
||||
$FLYHI_PD['city_id']=$city;
|
||||
$FLYHI_PD['loan_amount'] = $loan_amount;
|
||||
$FLYHI_PD['lender_sales_person'] = $lender_sales_person ;
|
||||
$FLYHI_PD['lender_credit_person'] = $lender_credit_person ;
|
||||
$FLYHI_PD['pd_branch_id'] = $pd_branch_id;
|
||||
$FLYHI_PD['lender_id'] = $lender_id;
|
||||
$FLYHI_PD['sales_pd_type'] = $flyhi_pd_type;
|
||||
$FLYHI_PD['product_id'] = $product_id ? $product_id : (ENVIRONMENT == 'production' ? 27 : 26);
|
||||
$this->Flyhi_Model->updateRecords($FLYHI_PD,SALES_PD_DATA,array('sales_pd_id' => $sales_pd_id));
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case 9: //photosection
|
||||
break;
|
||||
|
||||
default:
|
||||
}
|
||||
|
||||
//make inactive previous records
|
||||
$this->Flyhi_Model->updateRecords(array('isactive' => 0),SALESPD_SECTION_DATA,array('sales_pd_id' =>$sales_pd_id,'section_id' => $section_id ));
|
||||
|
||||
//insert new record
|
||||
$fields = array('sales_pd_id' => $sales_pd_id, 'section_id' => $section_id, 'status' =>$status ,'section_data' => $section_data,'createdby' => $fk_createdby);
|
||||
$is_entry_created = $this->Flyhi_Model->saveRecords($fields,SALESPD_SECTION_DATA);
|
||||
if($is_entry_created)
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $is_entry_created;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||
$data['msg'] = 'Something went wrong! Try Later';
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
}
|
||||
|
||||
public function saveCusFlyhiVideo_post()
|
||||
{
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user