From bb813588e24ff9e8c28ca69cb3618e11547f12c6 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Mon, 24 Oct 2022 22:37:10 +0530 Subject: [PATCH] FI report Fixes 1 : ps --- api/application/controllers/PD_Controller.php | 13 +- .../helpers/getprocessedjson_helper.php | 64 ++++--- .../JSONTOREPORT_FI_OV_DI.php | 179 ++++++----------- .../JSONTOREPORT_FI_OV_SAL.php | 162 +++++----------- .../report_templates/JSONTOREPORT_FI_RV.php | 180 ++++++------------ 5 files changed, 221 insertions(+), 377 deletions(-) diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 4088835b..50513a3b 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -874,7 +874,7 @@ class PD_Controller extends REST_Controller } if (isset($pd_details['pd_status']) && $pd_details['pd_status'] == STARTED) { // echo 'STARTED'; - if ($exist_pd_details[0]['fk_pd_type'] == 1) { + if ($exist_pd_details[0]['fk_pd_type'] == 1 || $exist_pd_details[0]['fk_pd_type'] == 4) { $pd_details['start_location'] = $pd_details['link']; } @@ -2633,7 +2633,7 @@ class PD_Controller extends REST_Controller $where_condition_array['rental_count_id'] = $rental_count_id; } - $id = $this->PD_Model->updateRecords($fields, PDFORMDETAILSJSON, $where_condition_array); + // $id = $this->PD_Model->updateRecords($fields, PDFORMDETAILSJSON, $where_condition_array); $custom_log_info = '###OLD Entries Deactivated PDID - (' . $pdid . ' - ' . $formid . ') - ' . date('Y-m-d H:i:s A'); log_message('ERROR', $custom_log_info); @@ -2753,6 +2753,7 @@ class PD_Controller extends REST_Controller break; case 33: $processed_json = GETPROCESSEDJSON::convertFinalRemarksForm($records, $formid); + print_r($processed_json); break; case 34: $processed_json = $records['photograph_details']; @@ -2760,7 +2761,7 @@ class PD_Controller extends REST_Controller //default: //echo "Something Wrong! Form ID did not match, Contact System Administrator"; } - } + }die; $custom_log_info = '###Processed JSON Function Executed PDID - (' . $pdid . ' - ' . $formid . ') - ' . date('Y-m-d H:i:s A'); log_message('ERROR', $custom_log_info); @@ -2779,10 +2780,10 @@ class PD_Controller extends REST_Controller } - $temp_array = array('fk_form_id' => $formid, 'company_id' => $company_id, 'fk_pd_id' => $pdid, 'fk_createdby' => $createdby, 'json' => $records, 'processed_json' => $processed_json, 'rental_count_id' => $rental_count_id, 'template_id' => $templateid); - // $temp_array = array('fk_form_id'=>$formid,'company_id' => $company_id,'fk_pd_id'=>$pdid,'fk_createdby'=>$createdby,'json'=>$records,'processed_json' => $processed_json,'rental_count_id' => $rental_count_id); + // $temp_array = array('fk_form_id' => $formid, 'company_id' => $company_id, 'fk_pd_id' => $pdid, 'fk_createdby' => $createdby, 'json' => $records, 'processed_json' => $processed_json, 'rental_count_id' => $rental_count_id, 'template_id' => $templateid); + // // $temp_array = array('fk_form_id'=>$formid,'company_id' => $company_id,'fk_pd_id'=>$pdid,'fk_createdby'=>$createdby,'json'=>$records,'processed_json' => $processed_json,'rental_count_id' => $rental_count_id); - $id = $this->PD_Model->saveRecords($temp_array, PDFORMDETAILSJSON); + // $id = $this->PD_Model->saveRecords($temp_array, PDFORMDETAILSJSON); $logger->info("SAVE FORM JSON FUNCTION RESPONSE - ENV (" . ENVIRONMENT . ")", $log_info_array); if ($id != "" || $id != null) { diff --git a/api/application/helpers/getprocessedjson_helper.php b/api/application/helpers/getprocessedjson_helper.php index e8428e0e..cf635b68 100644 --- a/api/application/helpers/getprocessedjson_helper.php +++ b/api/application/helpers/getprocessedjson_helper.php @@ -2501,7 +2501,8 @@ class GETPROCESSEDJSON public static function convertFinalRemarksForm($raw_json,$formid) { - //echo "FEPJ called"; + echo "FEPJ called"; + // print_r($raw_json);die; $CI =& get_instance(); $master_tables_field_names = $CI->config->item('master_tables_field_names'); $master_tables_pkid = $CI->config->item('master_tables_pkid'); @@ -2716,7 +2717,7 @@ class GETPROCESSEDJSON public static function convertFIAddressForm($raw_json,$formid) { - //echo "ADDRESS FORM CALLED"; + // echo "ADDRESS FORM CALLED"; $CI =& get_instance(); $master_tables_field_names = $CI->config->item('master_tables_field_names'); $master_tables_pkid = $CI->config->item('master_tables_pkid'); @@ -2726,11 +2727,10 @@ class GETPROCESSEDJSON $master_keys = $CI->PD_Model->selectCustomRecords($fields,$where_condition_array,QUESTIONKEYMAPPING); - //print_r($raw_json); - foreach($raw_json['json'] as $raw_json_key => $address) + foreach($raw_json as $raw_json_key => $address) { - if(array_key_exists('Address_Type',$address)) + if(isset($address['Address_Type'])) { $CI->db->SELECT( $master_tables_field_names['ADDRESSTYPE'] ); $CI->db->FROM(ADDRESSTYPE); @@ -2740,12 +2740,13 @@ class GETPROCESSEDJSON //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']]; + $raw_json[$raw_json_key]['address_type_master'] = $adress_type_name[0][$master_tables_field_names['ADDRESSTYPE']]; } } - if(array_key_exists('Locality',$address)) + // if(array_key_exists('Locality',$address)) + if(isset($address['Locality'])) { $CI->db->SELECT( $master_tables_field_names['LOCALITY'] ); $CI->db->FROM(LOCALITY); @@ -2755,12 +2756,13 @@ class GETPROCESSEDJSON //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']]; + $raw_json[$raw_json_key]['locality_master'] = $locality_name[0][$master_tables_field_names['LOCALITY']]; } } - if(array_key_exists('Approach_to_PD_location',$address)) + // if(array_key_exists('Approach_to_PD_location',$address)) + if(isset($address['Approach_to_PD_location'])) { $CI->db->SELECT( $master_tables_field_names['PDLOCATIONAPPROACH'] ); $CI->db->FROM(PDLOCATIONAPPROACH); @@ -2770,12 +2772,13 @@ class GETPROCESSEDJSON //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']]; + $raw_json[$raw_json_key]['pd_location_master'] = $pd_location_approach[0][$master_tables_field_names['PDLOCATIONAPPROACH']]; } } - if(array_key_exists('Comment_on_Locality',$address)) + // if(array_key_exists('Comment_on_Locality',$address)) + if(isset($address['Comment_on_Locality'])) { $CI->db->SELECT( $master_tables_field_names['COMMENTSONLOCALITY'] ); $CI->db->FROM(COMMENTSONLOCALITY); @@ -2785,13 +2788,14 @@ class GETPROCESSEDJSON //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']]; + $raw_json[$raw_json_key]['comment_locality_master'] = $comments_on_locality[0][$master_tables_field_names['COMMENTSONLOCALITY']]; } } - if(array_key_exists('state',$address)) + // if(array_key_exists('state',$address)) + if(isset($address['state'])) { //print_r($address); $CI->db->SELECT( $master_tables_field_names['STATE'] ); @@ -2802,11 +2806,12 @@ class GETPROCESSEDJSON //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[$raw_json_key]['state_master'] = $adress_type_name[0][$master_tables_field_names['STATE']]; } } - if(array_key_exists('city',$address)) + // if(array_key_exists('city',$address)) + if(isset($address['city'])) { //print_r($address); $CI->db->SELECT( $master_tables_field_names['CITY'] ); @@ -2817,11 +2822,12 @@ class GETPROCESSEDJSON //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[$raw_json_key]['city_master'] = $city[0][$master_tables_field_names['CITY']]; } } - if(array_key_exists('pincode',$address)) + // if(array_key_exists('pincode',$address)) + if(isset($address['pincode'])) { //print_r($address); $CI->db->SELECT( $master_tables_field_names['PINCODE'] ); @@ -2832,11 +2838,12 @@ class GETPROCESSEDJSON //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[$raw_json_key]['pincode_master'] = $pincode[0][$master_tables_field_names['PINCODE']]; } } - if(array_key_exists('Unit_of_Measurement',$address)) + // if(array_key_exists('Unit_of_Measurement',$address)) + if(isset($address['Unit_of_Measurement'])) { //print_r($address); $CI->db->SELECT( $master_tables_field_names['UOM'] ); @@ -2847,13 +2854,14 @@ class GETPROCESSEDJSON //print_r($CI->db->last_query()); if(count($uom)) { - $raw_json['json'][$raw_json_key]['uom_master'] = $uom[0][$master_tables_field_names['UOM']]; + $raw_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'] == "no") ) + if(isset($raw_json['is_pd_done_on_initiated_address']) && ($raw_json['is_pd_done_on_initiated_address'] == "no") ) { - if(array_key_exists('State_list',$address)) + // if(array_key_exists('State_list',$address)) + if(isset($address['State_list'])) { //print_r($address); $CI->db->SELECT( $master_tables_field_names['STATE'] ); @@ -2864,11 +2872,12 @@ class GETPROCESSEDJSON //print_r($CI->db->last_query()); if(count($adress_type_name)) { - $raw_json['json'][$raw_json_key]['state2_master'] = $adress_type_name[0][$master_tables_field_names['STATE']]; + $raw_json[$raw_json_key]['state2_master'] = $adress_type_name[0][$master_tables_field_names['STATE']]; } } - if(array_key_exists('city2',$address)) + // if(array_key_exists('city2',$address)) + if(isset($address['city2'])) { //print_r($address); $CI->db->SELECT( $master_tables_field_names['CITY'] ); @@ -2879,11 +2888,12 @@ class GETPROCESSEDJSON //print_r($CI->db->last_query()); if(count($city)) { - $raw_json['json'][$raw_json_key]['city2_master'] = $city[0][$master_tables_field_names['CITY']]; + $raw_json[$raw_json_key]['city2_master'] = $city[0][$master_tables_field_names['CITY']]; } } - if(array_key_exists('pincode2',$address)) + // if(array_key_exists('pincode2',$address)) + if(isset($address['pincode2'])) { //print_r($address); $CI->db->SELECT( $master_tables_field_names['PINCODE'] ); @@ -2894,7 +2904,7 @@ class GETPROCESSEDJSON //print_r($CI->db->last_query()); if(count($pincode)) { - $raw_json['json'][$raw_json_key]['pincode2_master'] = $pincode[0][$master_tables_field_names['PINCODE']]; + $raw_json[$raw_json_key]['pincode2_master'] = $pincode[0][$master_tables_field_names['PINCODE']]; } } } 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 0e993b21..2142e582 100644 --- a/api/application/views/report_templates/JSONTOREPORT_FI_OV_DI.php +++ b/api/application/views/report_templates/JSONTOREPORT_FI_OV_DI.php @@ -421,7 +421,7 @@ defined('BASEPATH') or exit('No direct script access allowed'); 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..' . '

'; + echo '

' . '('.$value['Name_of_the_Person'].') ('.$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'] . '

'; @@ -434,6 +434,7 @@ defined('BASEPATH') or exit('No direct script access allowed'); echo '
'; $address_form = json_decode($pd_processed_forms[28][0]['processed_json'], true); $address_value = $address_form['json']; + // print_r($address_value); if(!empty($address_value)){ echo '

ADDRESS DETAILS:

'; if ($address_value['is_pd_done_on_initiated_address'] == 'yes') { @@ -495,13 +496,13 @@ defined('BASEPATH') or exit('No direct script access allowed'); $pd_offiecer_status_about_neighbor = ""; $neighbour_details = json_decode($pd_processed_forms[32][0]['processed_json'], true); $neighbour_value = $neighbour_details['json']; - $neighbourhood_form_common_remarks = $neighbour_value['neighbour_reference_remark']; - if(strcasecmp($neighbour_value['neighbourhood_status'],'could not verify')){ - $pd_offiecer_status_about_neighbor = $neighbour_value['neighbourhood_status']; - if(isset($neighbour_value['neighbourhood_list']) && count($neighbour_value['neighbourhood_list'])>0){ - $company_name = MYUTIL::findCompanyName($all_company_details,1,1); - } - } + // print_r($neighbour_value); + $neighbourhood_form_common_remarks = $neighbour_value['neighbourhood_remarks']; + // if(strcasecmp($neighbour_value['neighbourhood_status'],'Could Not Verify')){ + $pd_offiecer_status_about_neighbor = $neighbour_value['neighbourhood_status']; + // } + $neighbourhood_form_common_remarks = isset($neighbour_value['neighbourhood_remarks']) ? $neighbour_value['neighbourhood_remarks'] : null; + ?>

NEIGHBOURHOOD / REFERENCE CHECK

1 ? 'owners': 'owner'; $ownership = 'As per '.$neighbour_value['neighbourhood_name'].' the '.$grammer2 .' of '.$company_name.$grammer1.$ownwers_list.'.'; - }else + }}else { $ownership = $neighbour_value['neighbourhood_name']." was not aware of the business ownership."; } @@ -608,8 +610,10 @@ defined('BASEPATH') or exit('No direct script access allowed');

VISITING OFFICER`S REMARKS

'; - echo '

Personal feedback or market intelligence on the case (if any):

'; - echo '

' . $final_remark_data['market_intelligence'] . '

'; - echo '
'; - //echo '
'; - } + // if (isset($final_remark_data['market_intelligence']) && $final_remark_data['market_intelligence'] != '') { + // echo '
'; + // echo '

Personal feedback or market intelligence on the case (if any):

'; + // echo '

' . $final_remark_data['market_intelligence'] . '

'; + // echo '
'; + // //echo '
'; + // } ?>