diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 345f9168..a52e71a2 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -562,6 +562,18 @@ class PD_Controller extends REST_Controller ? (!is_null($pd_details['is_notify_enabled']) ? $pd_details['is_notify_enabled'] : 1 ) : ($lender_short_name == 'IIB' ? 0 : 1 ); + if($lender_short_name == 'IIB'){ + // IIB means 0 + $pd_details['is_notify_enabled'] = 0; + }else{ + if(isset($pd_details['is_notify_enabled']) && (!is_null($pd_details['is_notify_enabled']))){ + $pd_details['is_notify_enabled'] = $pd_details['is_notify_enabled']; + } + else{ + // Default 1 + $pd_details['is_notify_enabled'] = 1; + } + } $pd_id = $this->PD_Model->saveRecords($pd_details, PDTRIGGER); @@ -2726,9 +2738,17 @@ class PD_Controller extends REST_Controller $processed_json = GETPROCESSEDJSON::convertFIAddressForm($records, $formid); break; case 29: + $processed_json = $records; + break; case 30: + $processed_json = $records; + break; case 31: + $processed_json = $records; + break; case 32: + $processed_json = $records; + break; case 33: $processed_json = $records; break; @@ -3983,6 +4003,7 @@ class PD_Controller extends REST_Controller } // Get all assigned pd forms associated with this pd from template_forms table + // pdtype 4 is template_id ella. if ($template_id == null) { $columns = array('TEMPLATEFORMS.form_id', 'PDFORMS.pd_form_name'); $table = TEMPLATEFORMS . ' as TEMPLATEFORMS'; @@ -4019,6 +4040,7 @@ class PD_Controller extends REST_Controller foreach ($final_data_to_response as $key => $value) { $object->$key = $value; } + if($final_data_to_response['fk_pd_type'] == 4){ $final_data_to_response = 1; } if (count($final_data_to_response)) { $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; @@ -5747,6 +5769,8 @@ class PD_Controller extends REST_Controller if ($data['pd_master_details'][0]['is_score_card_enabled'] == 1 && ($data['pd_master_details'][0]['customer_segment_abbr'] != "SAL" && $data['pd_master_details'][0]['customer_segment_abbr'] != "SE-RI")) // && $data['pd_master_details'][0]['customer_segment_abbr'] != "SAL-CHQ")) //&& ($data['pd_master_details'][0]['customer_segment_abbr'] != '')) { //echo $data['pd_master_details'][0]['is_score_card_enabled'].'-'.$data['pd_master_details'][0]['customer_segment_abbr'];die(); + + if ($data['pd_master_details'][0]['fk_pd_type'] != 4) { $data['pd_score'] = $this->calculateScore($pdid); $score_for_chart = $data['pd_score']['score_summary']['overall_score']['final_score'] ? round($data['pd_score']['score_summary']['overall_score']['final_score'], 1) : 0; //echo $score_for_chart;die(); @@ -5778,12 +5802,12 @@ class PD_Controller extends REST_Controller $base64_pdscore_chart_url = 'data:image/' . $type . ';base64,' . base64_encode($chart_img_content); $data['base64_pdscore_chart_url'] = $base64_pdscore_chart_url; //echo $data['base64_pdscore_chart_url']; - + } //GENERATE CHART PART } //die(); //GET ALL PROCESSED JSON - for ($i = 1; $i <= 30; $i++) { + for ($i = 1; $i <= 35; $i++) { $fields = array('processed_json'); if ($i == 25) { $fields = array('json'); @@ -5855,7 +5879,7 @@ class PD_Controller extends REST_Controller // print_r($data['add_on_pd_images']); // die(); - +// print_r($data);die(); $t = ""; if (!count($add_on_pd)) { @@ -10708,4 +10732,6 @@ class PD_Controller extends REST_Controller unlink($destination_path.$dbfile); } } + + } diff --git a/api/application/helpers/getprocessedjson_helper.php b/api/application/helpers/getprocessedjson_helper.php index b7001bd7..e8428e0e 100644 --- a/api/application/helpers/getprocessedjson_helper.php +++ b/api/application/helpers/getprocessedjson_helper.php @@ -2730,7 +2730,7 @@ class GETPROCESSEDJSON foreach($raw_json['json'] as $raw_json_key => $address) { - if(array_key_exists('address_type',$address)) + if(array_key_exists('Address_Type',$address)) { $CI->db->SELECT( $master_tables_field_names['ADDRESSTYPE'] ); $CI->db->FROM(ADDRESSTYPE); @@ -2849,143 +2849,56 @@ class GETPROCESSEDJSON { $raw_json['json'][$raw_json_key]['uom_master'] = $uom[0][$master_tables_field_names['UOM']]; } - } - + } } - - if(isset($raw_json['json']['is_pd_done_on_initiated_address']) && ($raw_json['json']['is_pd_done_on_initiated_address'] == "") ) - { - foreach($raw_json['json'] as $raw_json_key => $address) - { - // 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); - - if(array_key_exists('Address_Type',$address)) - { - $CI->db->SELECT( $master_tables_field_names['ADDRESSTYPE'] ); - $CI->db->FROM(ADDRESSTYPE); - $CI->db->WHERE('isactive',1); - $CI->db->WHERE($master_tables_pkid['ADDRESSTYPE'] ,$address['Address_Type']); - $adress_type_name= $CI->db->GET()->result_array(); - //print_r($CI->db->last_query()); - if(count($adress_type_name)) - { - $raw_json['json'][$raw_json_key]['address_type_master'] = $adress_type_name[0][$master_tables_field_names['ADDRESSTYPE']]; - } - } - - - if(array_key_exists('Locality',$address)) - { - $CI->db->SELECT( $master_tables_field_names['LOCALITY'] ); - $CI->db->FROM(LOCALITY); - $CI->db->WHERE('isactive',1); - $CI->db->WHERE($master_tables_pkid['LOCALITY'] ,$address['Locality']); - $locality_name= $CI->db->GET()->result_array(); - //print_r($CI->db->last_query()); - if(count($locality_name)) - { - $raw_json['json'][$raw_json_key]['locality_master'] = $locality_name[0][$master_tables_field_names['LOCALITY']]; - } - } - - - if(array_key_exists('Approach_to_PD_location',$address)) - { - $CI->db->SELECT( $master_tables_field_names['PDLOCATIONAPPROACH'] ); - $CI->db->FROM(PDLOCATIONAPPROACH); - $CI->db->WHERE('isactive',1); - $CI->db->WHERE($master_tables_pkid['PDLOCATIONAPPROACH'] ,$address['Approach_to_PD_location']); - $pd_location_approach= $CI->db->GET()->result_array(); - //print_r($CI->db->last_query()); - if(count($pd_location_approach)) - { - $raw_json['json'][$raw_json_key]['pd_location_master'] = $pd_location_approach[0][$master_tables_field_names['PDLOCATIONAPPROACH']]; - } - } - - - if(array_key_exists('Comment_on_Locality',$address)) - { - $CI->db->SELECT( $master_tables_field_names['COMMENTSONLOCALITY'] ); - $CI->db->FROM(COMMENTSONLOCALITY); - $CI->db->WHERE('isactive',1); - $CI->db->WHERE($master_tables_pkid['COMMENTSONLOCALITY'] ,$address['Comment_on_Locality']); - $comments_on_locality= $CI->db->GET()->result_array(); - //print_r($CI->db->last_query()); - if(count($comments_on_locality)) - { - $raw_json['json'][$raw_json_key]['comment_locality_master'] = $comments_on_locality[0][$master_tables_field_names['COMMENTSONLOCALITY']]; - } - } - - if(array_key_exists('state',$address)) + if(isset($raw_json['json']['is_pd_done_on_initiated_address']) && ($raw_json['json']['is_pd_done_on_initiated_address'] == "no") ) + { + if(array_key_exists('State_list',$address)) { //print_r($address); $CI->db->SELECT( $master_tables_field_names['STATE'] ); $CI->db->FROM(STATE); $CI->db->WHERE('isactive',1); - $CI->db->WHERE($master_tables_pkid['STATE'] ,$address['state']); + $CI->db->WHERE($master_tables_pkid['STATE'] ,$address['State_list']); $adress_type_name= $CI->db->GET()->result_array(); //print_r($CI->db->last_query()); if(count($adress_type_name)) { - $raw_json['json'][$raw_json_key]['state_master'] = $adress_type_name[0][$master_tables_field_names['STATE']]; + $raw_json['json'][$raw_json_key]['state2_master'] = $adress_type_name[0][$master_tables_field_names['STATE']]; } } - if(array_key_exists('city',$address)) + if(array_key_exists('city2',$address)) { //print_r($address); $CI->db->SELECT( $master_tables_field_names['CITY'] ); $CI->db->FROM(CITY); $CI->db->WHERE('isactive',1); - $CI->db->WHERE($master_tables_pkid['CITY'] ,$address['city']); + $CI->db->WHERE($master_tables_pkid['CITY'] ,$address['city2']); $city= $CI->db->GET()->result_array(); //print_r($CI->db->last_query()); if(count($city)) { - $raw_json['json'][$raw_json_key]['city_master'] = $city[0][$master_tables_field_names['CITY']]; + $raw_json['json'][$raw_json_key]['city2_master'] = $city[0][$master_tables_field_names['CITY']]; } } - if(array_key_exists('pincode',$address)) + if(array_key_exists('pincode2',$address)) { //print_r($address); $CI->db->SELECT( $master_tables_field_names['PINCODE'] ); $CI->db->FROM(PINCODE); $CI->db->WHERE('isactive',1); - $CI->db->WHERE($master_tables_pkid['PINCODE'] ,$address['pincode']); + $CI->db->WHERE($master_tables_pkid['PINCODE'] ,$address['pincode2']); $pincode= $CI->db->GET()->result_array(); //print_r($CI->db->last_query()); if(count($pincode)) { - $raw_json['json'][$raw_json_key]['pincode_master'] = $pincode[0][$master_tables_field_names['PINCODE']]; + $raw_json['json'][$raw_json_key]['pincode2_master'] = $pincode[0][$master_tables_field_names['PINCODE']]; } } - - if(array_key_exists('Unit_of_Measurement',$address)) - { - //print_r($address); - $CI->db->SELECT( $master_tables_field_names['UOM'] ); - $CI->db->FROM(UOM); - $CI->db->WHERE('isactive',1); - $CI->db->WHERE($master_tables_pkid['UOM'] ,$address['Unit_of_Measurement']); - $uom= $CI->db->GET()->result_array(); - //print_r($CI->db->last_query()); - if(count($uom)) - { - $raw_json['json'][$raw_json_key]['uom_master'] = $uom[0][$master_tables_field_names['UOM']]; - } - } - - } } - - return ($raw_json); - + return ($raw_json); } /*****************########## END OF FI-ADDRESS FORM DETAILS ##########**************/ } diff --git a/api/application/views/report_templates/JSONTOREPORT_FI_OV_DI.php b/api/application/views/report_templates/JSONTOREPORT_FI_OV_DI.php index ab917918..dede4999 100644 --- a/api/application/views/report_templates/JSONTOREPORT_FI_OV_DI.php +++ b/api/application/views/report_templates/JSONTOREPORT_FI_OV_DI.php @@ -416,48 +416,37 @@ defined('BASEPATH') or exit('No direct script access allowed'); echo '
'; echo '

General Information:

'; $general_form = json_decode($pd_processed_forms[27][0]['processed_json'], true); + $value = $general_form['json']; $all_applicant_details = $applicants_details; - foreach ($general_form as $key => $value) - { - ?> -
- ` ' . 'Applicant ('.$value['Name_of_the_Person_met'].') was met at the visited address.' . '

'; - }else if ($value['is_person_met'] == 'no') { - echo '

' . '('.$value['Name_of_the_Person_met'].') ('.$value['designation_person_met_master'].') was met at the visited address during visit..' . '

'; - } - if ($general_form['general_remark'] != "") { - echo '

' . $general_form['general_remark'] . '

'; - }} - ?>` + if ($value['is_person_met'] == 'yes') { + echo '

' . 'Applicant ('.$value['Name_of_the_Person_met'].') was met at the visited address.' . '

'; + }else if ($value['is_person_met'] == 'no') { + echo '

' . '('.$value['Name_of_the_Person_met'].') ('.$value['designation_person_met_master'].') was met at the visited address during visit..' . '

'; + } + if (isset($general_form['general_remark']) && $general_form['general_remark'] != "") { + echo '

' . $general_form['general_remark'] . '

'; + } + ?> '; - echo '

Address Details:

'; $address_form = json_decode($pd_processed_forms[28][0]['processed_json'], true); - print_r($address_form); - - $final_remark_data = json_decode($pd_processed_forms[33][0]['processed_json'], true); - - - $address_images = $pd_images[5]; - foreach ($address_form as $key => $value) - { - if ($value['is_pd_done_on_initiated_address'] == 'yes') { + $address_value = $address_form['json']; + if(!empty($address_value)){ + echo '

Address Details:

'; + if ($address_value['is_pd_done_on_initiated_address'] == 'yes') { echo '

' . ' - Visit Initiated Address: '.$value['initiated_address'].' , '.$value['city_master'].' , '.$value['state_master'].' , '.$value['pincode_master'].'.

'; + Visit Initiated Address: '.$address_value['initiated_address'].' , '.$address_value['city_master'].' , '.$address_value['state_master'].' , '.$address_value['pincode_master'].'.

'; } - if ($value['is_pd_done_on_initiated_address'] == 'no') { + if ($address_value['is_pd_done_on_initiated_address'] == 'no') { echo '

' . ' - Address Where Visit is Initiated: '.$value['initiated_address'].' , '.$value['city_master'].' , '.$value['state_master'].' , '.$value['pincode_master'].'. - Address Where Visit was actually done: '.$value['initiated_address'].' , '.$value['city_master'].' , '.$value['state_master'].' , '.$value['pincode_master'].'. - Reason for change in Visit address: (Entered reason for change in address should appear here). - - The Field Visit was done at Residence/Office/Shop of the loan applicants. The Residence/Shop/Office is located in a Residential/Industrial Area and the estimated area of the Residence/Shop/Office is 700 Square Feet. The location was Very Easy to locate & Reach. As Per Officer, the Residence/Shop/Office is situated in a Good/Poor Locality. ' . '

'; + Address Where Visit is Initiated: '.$address_value['initiated_address'].' , '.$address_value['city_master'].' , '.$address_value['state_master'].' , '.$address_value['pincode_master'].'. + Address Where Visit was actually done: '.$address_value['actual_pd_address'].' , '.$address_value['city2_master'].' , '.$address_value['state2_master'].' , '.$address_value['pincode2_master'].'. + Reason for change in Visit address: '.$address_value['end_use'].'.

'; } + echo '

' . 'The Field Visit was done at '.$address_value['address_type_master'].' of the loan applicants. The '.$address_value['address_type_master'].' is located in a '.$address_value['locality_master'].' and the estimated area of the '.$address_value['address_type_master'].' is '.$address_value['uom_master'].'. The location was '.$address_value['Approach_to_PD_location'].'. As Per Officer, the '.$address_value['address_type_master'].' is situated in a '.$address_value['comment_locality_master'].' Locality. ' . '

'; } ?>
@@ -466,109 +455,156 @@ defined('BASEPATH') or exit('No direct script access allowed'); '; - echo '

VISIT DETAILS:

'; - - + echo '

Visit Details:

'; $Office_visit_data = json_decode($pd_processed_forms[29][0]['processed_json'], true); + $ov_value = $Office_visit_data['json']; + + $business_activities_during_visit = implode(', ', $ov_value['Was_any_business_activities_observed_during_visit']); + $company_name_sighted = $ov_value['was_the_company_name_board_sighted'] == 'Yes' ? 'seen' : 'not seen'; - echo '

' . ' - • Brief of the Business / Service Model: (Entered details about business in Free text field should appear here). - • Visited address is of a Godown/Office/Factory. - • At the time of visit, the officer sighted 10 employees at the business premises. - • The Business Name board was seen/not seen at the visited address. - • (Name of business documents selected/Entered) was sighted during visit and pictures are enclosed with the Report. - • The Godown/Office/Factory is Rented/Owned. - (If Not Disclosed is selected then), - • The Godown/Office/Factory is Rented or Owned is Not Disclosed by the person met. - • Business Activity was seen/ was not seen and (Selected dropdowns or entered remarks) - • Stock was seen during visit and pictures are enclosed with the Report. - (If No is selected then) - • Stock was not seen during visit because (Entered reason in remark).' . '

'; + echo '

Brief of the Business / Service Model: '.$ov_value['business_brief'].'.

+

Visited address is of a '.$ov_value['visited_address_is'].'.

+

At the time of visit, the officer sighted '.$ov_value['no_of_employees_sighted_by_PD_officer_during_visit'].' employees at the business premises.

+

The Business Name board was .'.$company_name_sighted.'.at the visited address.

'; + if($ov_value['do_you_want_to_add_other_documents'] == 'Yes'){ + echo '

'.$ov_value['remarks_others'].'was sighted during visit and pictures are enclosed with the Report.

'; + } + if($ov_value['Visited_address_is_rented'] != 'not disclosed '){ + echo '

The '.$ov_value['visited_address_is'].' is '.$ov_value['Visited_address_is_rented'].'.

'; + } + if($ov_value['Visited_address_is_rented'] == 'not disclosed '){ + echo '

The '.$ov_value['visited_address_is'].' is Rented or Owned is Not Disclosed by the person met.

'; + } + echo '

Business Activity was '.$company_name_sighted.' and '.$business_activities_during_visit.'

'; + if($ov_value['stock_photograph'] == 'Yes'){ + echo '

Stock was seen during visit and pictures are enclosed with the Report.

'; + } + if($ov_value['stock_photograph'] == 'No'){ + echo '

Stock was not seen during visit because '.$ov_value['reason_of_stock_non_availability'].' .

'; + } ?>
- - +

Status of the check: could not verify.

- ' . $neighbourhood_form_common_remarks . '

'; + '. $neighbourhood_form_common_remarks.'

';} ?> - --> '; echo '

Credit Manager`s Specific Queries:

'; - //echo '
'; + if (isset($credit_officier_specific_queries['additional_requirements_processed']) && count($credit_officier_specific_queries['additional_requirements_processed'])) { @@ -583,7 +619,7 @@ defined('BASEPATH') or exit('No direct script access allowed'); echo '
'; echo '

Document to be photographed/scanned:

'; - // + if (isset($credit_officier_specific_queries['docs_to_be_sighted_processed']) && count($credit_officier_specific_queries['docs_to_be_sighted_processed'])) { @@ -621,10 +657,7 @@ defined('BASEPATH') or exit('No direct script access allowed'); } } - //} - ?> -