diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 9cbacc52..5c8f614e 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -4003,7 +4003,6 @@ 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'; @@ -4023,8 +4022,9 @@ class PD_Controller extends REST_Controller //$pd_form_raw_data_with_score = $this->calculatePDScore($pd_form_raw_data); $transformed_data = $this->transformKeyPairToQuestionAnswers($pd_form_raw_data, $template_form_detail['form_id']); - + if($final_data_to_response['fk_pd_type'] != 4){ $final_data_to_response['question_answers']['form_details'][] = array('name' => [$template_form_detail['pd_form_name']], 'details' => $transformed_data); + }else{$final_data_to_response['question_answers']['form_details'] = array(); } //$final_data_to_response['question_answers']['form_details'] = array_merge($final_data_to_response['question_answers']['form_details'],array('name' =>[$template_form_detail['pd_form_name']],'details' => $transformed_data)); @@ -4040,7 +4040,6 @@ 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; @@ -4769,7 +4768,7 @@ class PD_Controller extends REST_Controller $pd_report_time = date('Y-m-d-H-i-s'); $pd_report_store = $this->external_path . '/pd_reports/' . $pdid . '/' . $pd_report_time . '.html'; $is_write_done = file_put_contents($pd_report_store, $t); -die; + if ($is_write_done) { //$update = $this->PD_Model->updateRecords(array('pd_report_html_filename' => $pd_report_time),PDTRIGGER,array('pd_id' => $pdid)); diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index 92c63246..0abf2431 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -1935,6 +1935,7 @@ class PD_Model extends SPARQ_Model { // echo $pd_form_id; $pd_master_detials = $this->getPDMasterDetails($pd_id); + if(!empty($pd_master_detials[0]['fk_pd_template_id'])){ $this->db->SELECT('PDFORMDETAILS.fk_pd_id,PDFORMDETAILS.fk_form_id,PDFORMDETAILS.iter_column_name,PDFORMDETAILS.iter_sub_column_name,PDFORMDETAILS.iteration, PDFORMDETAILS.column_name, PDFORMDETAILS.column_id, PDFORMDETAILS.column_value,TEMPLATECATEGORYWEIGHTAGE.weightage as category_weightage,TEMPLATECATEGORYWEIGHTAGE.fk_question_category_id,QUESTIONKEYMAPPING.fk_category_id,QUESTIONCATEGORY.category_name,SCORECARDQUESTIONS.score_question_id,SCORECARDQUESTIONS.weightage as question_weightage,SCORECARDQUESTIONS.calc_type,SCORECARDANSWERS.score'); $this->db->FROM(PDFORMDETAILS.' as PDFORMDETAILS'); $this->db->JOIN(TEMPLATECATEGORYWEIGHTAGE.' as TEMPLATECATEGORYWEIGHTAGE','TEMPLATECATEGORYWEIGHTAGE.fk_template_id ='.$pd_master_detials[0]['fk_pd_template_id']); @@ -1983,7 +1984,7 @@ class PD_Model extends SPARQ_Model { } } - return $form_details; + return $form_details;}else{ return array();} } 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 dede4999..39dfca55 100644 --- a/api/application/views/report_templates/JSONTOREPORT_FI_OV_DI.php +++ b/api/application/views/report_templates/JSONTOREPORT_FI_OV_DI.php @@ -419,7 +419,7 @@ defined('BASEPATH') or exit('No direct script access allowed'); $value = $general_form['json']; $all_applicant_details = $applicants_details; if ($value['is_person_met'] == 'yes') { - echo '

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

'; + 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..' . '

'; } @@ -438,15 +438,15 @@ defined('BASEPATH') or exit('No direct script access allowed'); echo '

Address Details:

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

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

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

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

' . ' - 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'].'.

'; + 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. ' . '

'; + 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. ' . '

'; } ?>
@@ -460,28 +460,30 @@ defined('BASEPATH') or exit('No direct script access allowed'); $ov_value = $Office_visit_data['json']; $business_activities_during_visit = implode(', ', $ov_value['Was_any_business_activities_observed_during_visit']); + $business_activities_during_visit = preg_replace("/_/i", ' ', $business_activities_during_visit ); $company_name_sighted = $ov_value['was_the_company_name_board_sighted'] == 'Yes' ? 'seen' : 'not seen'; - 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.

'; + echo ''; ?>
@@ -500,67 +502,64 @@ defined('BASEPATH') or exit('No direct script access allowed'); if(count($neighbour_value)>0){ $neighbourhood_name='Neighbour Check was done with '; - $neighbourhood_name.= $neighbour_value['neighbourhood_name'].'.'; - $neighbourhood_do_know = null; - $neighbourhood_business_running_yr = null; - $ownership = null; - $neighbourhood_name_only = $neighbour_value['neighbourhood_name']; - if(strtoupper($neighbour_value['do_know'])=='YES'){ - - $neighbourhood_do_know = $neighbour_value['neighbourhood_name']." knows about applicants and their business."; - } else if(strtoupper($neighbour_value['do_know'])=='NO'){ - $neighbourhood_do_know = $neighbour_value['neighbourhood_name']." did not know about the applicant or their business."; - } - - if($neighbour_value['how_long_do_know_in_year'] || $neighbour_value['how_long_do_know_in_month']) - { - $neighbourhood_business_running_yr = $neighbour_value['neighbourhood_name']." confirmed that the business has been in operation for "; - $neighbourhood_business_running_yr .= ($neighbour_value['how_long_do_know_in_year'] == 1) ? $neighbour_value['how_long_do_know_in_year']." year" : (($neighbour_value['how_long_do_know_in_year'] > 1) ? $neighbour_value['how_long_do_know_in_year']." years" : ""); - $neighbour_value['how_long_do_know_in_year'] && $neighbour_value['how_long_do_know_in_month'] ? $neighbourhood_business_running_yr .= ' and ':''; - $neighbourhood_business_running_yr .= ($neighbour_value['how_long_do_know_in_month'] == 1) ? $neighbour_value['how_long_do_know_in_month']." month" : (($neighbour_value['how_long_do_know_in_month'] > 1) ? $neighbour_value['how_long_do_know_in_month']." months" : ""); - $neighbourhood_business_running_yr .= '.'; - } - else - { - $neighbourhood_business_running_yr = $neighbour_value['neighbourhood_name']." was not aware of how long the business is in operation."; - } - $ownwers_list = ''; - if($neighbour_value['organisation_owner']){ - foreach($neighbour_value['organisation_owner'] as $owner) - { - if($owner['id'] != 0) - { - $title = MYUTIL::applicantTitleName($applicants_details,$owner['id']); - $ownwers_list .= $title.' '.APPLICANTNAME_GRABBER::getApplicantsNameById($owner['id'],$applicants_details).' , '; - + $neighbourhood_name.= $neighbour_value['neighbourhood_name'].'.'; + $neighbourhood_do_know = null; + $neighbourhood_business_running_yr = null; + $ownership = null; + $neighbourhood_name_only = $neighbour_value['neighbourhood_name']; + if(strtoupper($neighbour_value['do_know'])=='YES'){ + $neighbourhood_do_know = $neighbour_value['neighbourhood_name']." knows about applicants and their business."; + } else if(strtoupper($neighbour_value['do_know'])=='NO'){ + $neighbourhood_do_know = $neighbour_value['neighbourhood_name']." did not know about the applicant or their business."; + } + if($neighbour_value['how_long_do_know_in_year'] || $neighbour_value['how_long_do_know_in_month']) + { + $neighbourhood_business_running_yr = $neighbour_value['neighbourhood_name']." confirmed that the business has been in operation for "; + $neighbourhood_business_running_yr .= ($neighbour_value['how_long_do_know_in_year'] == 1) ? $neighbour_value['how_long_do_know_in_year']." year" : (($neighbour_value['how_long_do_know_in_year'] > 1) ? $neighbour_value['how_long_do_know_in_year']." years" : ""); + $neighbour_value['how_long_do_know_in_year'] && $neighbour_value['how_long_do_know_in_month'] ? $neighbourhood_business_running_yr .= ' and ':''; + $neighbourhood_business_running_yr .= ($neighbour_value['how_long_do_know_in_month'] == 1) ? $neighbour_value['how_long_do_know_in_month']." month" : (($neighbour_value['how_long_do_know_in_month'] > 1) ? $neighbour_value['how_long_do_know_in_month']." months" : ""); + $neighbourhood_business_running_yr .= '.'; } else { - $ownwers_list .= ' '.$neighbour_value['other_organisation_owner'].' , '; + $neighbourhood_business_running_yr = $neighbour_value['neighbourhood_name']." was not aware of how long the business is in operation."; } - } - //echo $ownwers_list; - //$ownwers_list = substr_replace($ownwers_list,'', strrpos(-$ownwers_list,','),1); - //echo $ownwers_list; - //echo $ownwers_list;echo "**********"; - - $ownwers_list = substr_replace($ownwers_list,'', strrpos($ownwers_list,','),1); - if(strrpos($ownwers_list,',')) - { - $ownwers_list = substr_replace($ownwers_list,' and ', strrpos($ownwers_list,','),1); - } - - - $grammer1 = count($neighbour_value['organisation_owner']) > 1 ? ' are ': ' is '; - $grammer2 = count($neighbour_value['organisation_owner']) > 1 ? 'owners': 'owner'; - $ownership = 'As per '.$neighbour_value['neighbourhood_name'].' the '.$grammer2 .' of '.$company_name.$grammer1.$ownwers_list.'.'; - - }else - { - $ownership = $neighbour_value['neighbourhood_name']." was not aware of the business ownership."; - } - $existNeighRefCheck = array('neighbourhood_name_only' => $neighbourhood_name_only,'neighbourhood_name' => $neighbourhood_name,'neighbourhood_do_know' => $neighbourhood_do_know,'neighbourhood_business_running_yr' => $neighbourhood_business_running_yr,'ownership' => $ownership); - print_r($existNeighRefCheck);die(); + $ownwers_list = ''; + if($neighbour_value['organisation_owner']){ + foreach($neighbour_value['organisation_owner'] as $owner) + { + if($owner['id'] != 0) + { + $title = MYUTIL::applicantTitleName($applicants_details,$owner['id']); + $ownwers_list .= $title.' '.APPLICANTNAME_GRABBER::getApplicantsNameById($owner['id'],$applicants_details).' , '; + + } + else + { + $ownwers_list .= ' '.$neighbour_value['other_organisation_owner'].' , '; + } + } + //echo $ownwers_list; + //$ownwers_list = substr_replace($ownwers_list,'', strrpos(-$ownwers_list,','),1); + //echo $ownwers_list; + //echo $ownwers_list;echo "**********"; + + $ownwers_list = substr_replace($ownwers_list,'', strrpos($ownwers_list,','),1); + if(strrpos($ownwers_list,',')) + { + $ownwers_list = substr_replace($ownwers_list,' and ', strrpos($ownwers_list,','),1); + } + + + $grammer1 = count($neighbour_value['organisation_owner']) > 1 ? ' are ': ' is '; + $grammer2 = count($neighbour_value['organisation_owner']) > 1 ? 'owners': 'owner'; + $ownership = 'As per '.$neighbour_value['neighbourhood_name'].' the '.$grammer2 .' of '.$company_name.$grammer1.$ownwers_list.'.'; + + }else + { + $ownership = $neighbour_value['neighbourhood_name']." was not aware of the business ownership."; + } + $existNeighRefCheck = array('neighbourhood_name_only' => $neighbourhood_name_only,'neighbourhood_name' => $neighbourhood_name,'neighbourhood_do_know' => $neighbourhood_do_know,'neighbourhood_business_running_yr' => $neighbourhood_business_running_yr,'ownership' => $ownership); ?> $nfValue) {