bankmerge t1 - save : ps

This commit is contained in:
sanjeev.p 2021-11-09 18:49:29 +05:30
parent 1fc61bff1a
commit 4836d7d981
4 changed files with 90 additions and 22 deletions

View File

@ -2853,9 +2853,9 @@ public function assignPDTempalate($data)
$processed_json = GETPROCESSEDJSON::convertFinalRemarksForm($records,$formid);
break;
case 21:
$processed_json = GETPROCESSEDJSON::convertBankingInfoDetailsForm($records,$formid);
break;
// case 21:
// $processed_json = GETPROCESSEDJSON::convertBankingInfoDetailsForm($records,$formid);
// break;
case 22:
$processed_json = GETPROCESSEDJSON::convertBusinessAssetsForm($records,$formid);
@ -2947,6 +2947,7 @@ public function getPDFormDetailsJSON_post()
$additional_pd_id = null;
$custom_log_info = '###getPDFormDetailsJSON Function Executed PDID - ('. $pd_id.' - '. $pd_form_id.') - ' . date('Y-m-d H:i:s A');
// echo "getPDFormDetails".$custom_log_info;die();
log_message('ERROR',$custom_log_info);
if($pd_id != $parent_pd_id)
@ -3047,14 +3048,14 @@ public function getPDFormDetailsJSON_post()
$fields = array('json');
$where_condition_array = array('isactive' => 1,'fk_form_id'=>$pd_form_id,'fk_pd_id'=>$pd_id);
$where_condition_array = array('isactive' => 1,'fk_form_id'=>$pd_form_id,'fk_pd_id'=>$pd_id);print_r($where_condition_array);
if($company_id != null)
{
$where_condition_array = array('fk_form_id'=>$pd_form_id,'fk_pd_id'=>$pd_id,'company_id' => $company_id,'isactive' => 1);
}
$rec = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON);
//print_r($rec);die();
echo "I have";
print_r($rec);die();
if(isset($rec[0]['json']))
{
@ -6665,7 +6666,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
$form_array[] = array('form_id' => 22,'form_name' => 'Business Assets');
$form_array[] = array('form_id' => 21,'form_name' => 'Business Banking');
$form_array[] = array('form_id' => 14,'form_name' => 'Financial Information');
$form_array[] = array('form_id' => 1,'form_name' => 'Supplier Details');
$form_array[] = array('form_id' => 2,'form_name' => 'Client Details');
@ -6681,7 +6682,6 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
$form_array[] = array('form_id' => 13,'form_name' => 'About Business');
$form_array[] = array('form_id' => 22,'form_name' => 'Business Assets');
$form_array[] = array('form_id' => 21,'form_name' => 'Business Banking');
$form_array[] = array('form_id' => 14,'form_name' => 'Financial Information');
$form_array[] = array('form_id' => 1,'form_name' => 'Supplier Details');
$form_array[] = array('form_id' => 2,'form_name' => 'Client Details');
@ -8230,13 +8230,14 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
#####End of Other Assest Form Questions########
######Business Banking ##############
$business_bank_form = (json_decode($form_data[21][0]['processed_json'],true));
$business_bank_form = (json_decode($form_data[7][0]['processed_json'],true));
// here i am changed to 21 form-id to 7 form-id
//print_r($business_bank_form);
$vintage = array();
if(array_key_exists('banking_details',$business_bank_form))
if(array_key_exists('business_details',$business_bank_form))
{
foreach($business_bank_form['banking_details'] as $banking)
foreach($business_bank_form['business_details'] as $banking)
{
$year = $banking['vintage_year'] ? $banking['vintage_year'] : 0 ;
$month = $banking['vintage_month'] ? $banking['vintage_month'] : 0;

View File

@ -694,19 +694,23 @@ class Sales_PD_Controller extends REST_Controller {
log_message('ERROR','####SALESPD AFTER 10 PREPARED REPORT'.$records['sales_pd_id']);
//echo 'afetr 10';
//trigger mail function
$state = '';
$city = '';
$form = $this->Sales_PD_Model->selectCustomRecords(array(),array('isactive' => 1,'sales_pd_id' => $records['sales_pd_id'],'section_id' => 1,'status' => 1),SALESPD_SECTION_DATA);
$gen_form = json_decode($form[0]['section_data'],true);
if(!empty($gen_form)){
foreach ($gen_form['questions'] as $g_key => $g_value)
{
if($g_value['question_key'] == 'state')
// if($g_value['question_key'] == 'state')
// {
// $ids_to_send_mail['state'] = $g_value['answer_value'];
// }
if($g_value['question_key'] == 'city')
{
$state = $g_value['answer_value'];
$city = $g_value['answer_value'];
}
}
}//gen_form closed here.
PDALERTS::sendSalesPDMail($this,$records['sales_pd_id'],$state);
PDALERTS::sendSalesPDMail($this,$records['sales_pd_id'],$city);
}
}
@ -1253,6 +1257,10 @@ public function filterSalesPDList_post() {
// CAMUNDA::completeSalesPDTask(1);
//CAMUNDA::startSalesPDInstance(1);
}
public function testSaleSection_get(){
$data = $this->Sales_PD_Model->testmydata();
$this->response($data,REST_Controller::HTTP_OK);
}
}

View File

@ -267,23 +267,40 @@ class GETPROCESSEDJSON
}
/*****************########## END EXISTING LOAN DETAILS FORM ##########**************/
/*****************########## BANKING AND BUINESS DETAILS FORM ##########**************/
// public static function convertBankingDetailsForm($raw_json,$formid){
// if(!empty($raw_json)){
// if(!empty($raw_json['banking_details']) && $raw_json['bank_info_available'] == 1){
// unset($raw_json['business_details']);
// $personalBanking = self::convertBankingInfoDetailsForm($raw_json,$formid);
// }
// if(!empty($raw_json['business_details'])){
// unset($raw_json['bank_info_available']);
// unset($raw_json['banking_details']);
// $raw_json['formid'] = 22;
// $businessBanking = self::convertBankingInfoDetailsForm($raw_json,22);
// }
// }
// }
/*****************########## END BANKING INFO DETAILS FORM ##########**************/
/*****************########## BANKING INFO DETAILS FORM ##########**************/
public static function convertBankingInfoDetailsForm($raw_json,$formid)
{
$CI =& get_instance();
$master_tables_field_names = $CI->config->item('master_tables_field_names');
$master_tables_pkid = $CI->config->item('master_tables_pkid');
//print_r($raw_json);
// echo "i am in helper and i have below data";
// print_r($raw_json);
// echo "******************************************************************";
// die();
// GET KEYS FROM MASTER TABLE FOR SUPPLIER FORM
$fields = array('question', 'key', 'ismaster', 'master_name');
$where_condition_array = array('fk_form_id' => $formid,'isactive' => 1);
$master_keys = $CI->PD_Model->selectCustomRecords($fields,$where_condition_array,QUESTIONKEYMAPPING);
//print_r($master_keys);
// print_r($master_keys);die();
if(!empty($raw_json) && !empty($master_keys))
{
foreach($raw_json['banking_details'] as $bank_key => $bank_info)
@ -326,8 +343,44 @@ class GETPROCESSEDJSON
// print_r($loan);
}
if(!empty($raw_json['business_details'])){
foreach($raw_json['business_details'] as $bank_key => $buiness_bank_info)
{
foreach($buiness_bank_info as $key => $value)
{
if($value != "" || $value != null)
{
//compare with master_keys array
foreach($master_keys as $master_key => $master_value)
{
if(!strcmp($key,$master_value['key']) && $master_value['ismaster'] == 1)
{
$table = constant($master_value['master_name']);
$temp_fields = array($master_tables_field_names[$master_value['master_name']].' as name');
$where_condition_array = array($master_tables_pkid[$master_value['master_name']] => $value);
if($key == 'applicant_name_business')
{
$where_condition_array = array($master_tables_pkid[$master_value['master_name']] => $value['id']);
}
$result_data = $CI->PD_Model->selectCustomRecords($temp_fields,$where_condition_array,$table);
if(count($result_data))
{
//print_r($result_data[0]['name']);
$key = $key . '_master';
$raw_json['business_details'][$bank_key][$key] = $result_data[0]['name'];
}
}
}
}
}
}
}// buiness banking.....
}
return ($raw_json);
}
/*****************########## END BANKING INFO DETAILS FORM ##########**************/

View File

@ -80,6 +80,12 @@ class Sales_PD_Model extends SPARQ_Model {
//echo $this->db->last_query();die();
return $result;
}
public function testmydata(){
$this->db->SELECT('*')->FROM("t_salespd_section_data")->WHERE('sales_pd_id',455)->WHERE('isactive',1)->WHERE('section_id',1);
$query = $this->db->get();
return $query->result();
// $sql = 'insert into sineedgeprod.t_salespd_section_data(sales_pd_id, section_id, status, section_data, createdby, isactive) select sales_pd_id, section_id, status, section_data, createdby, isactive from sineedgeprod.t_salespd_section_data WHERE sales_pd_id = 1768 and section_id = 1 and isactive = 1;';
// $modified = $this->db->query($sql);
}
}