diff --git a/api/application/config/routes.php b/api/application/config/routes.php index d08b73a0..0f159838 100644 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -209,6 +209,7 @@ $route['(getPDReportHTML/:any)'] = 'PD_Controller/getPDReportHTML'; $route['smartyTestFunction'] = 'PD_Controller/smartyTestFunction'; $route['codeigniterViewTest'] = 'PD_Controller/codeigniterViewTest'; $route['archivePDImages'] = 'PD_Controller/archivePDImages'; +$route['pdFormsCompletenessCheck'] = 'PD_Controller/pdFormsCompletenessCheck'; //PD Form Related $route['getPDFormDetails'] = 'PD_Controller/getPDFormDetailsJSON'; diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index fbd29dac..45fb7268 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -4104,7 +4104,7 @@ class PD_Controller extends REST_Controller { //GET ALL PROCESSED JSON - for($i = 1;$i<=25;$i++) + for($i = 1;$i<=30;$i++) { $fields = array('processed_json'); $where_condition_array = array('isactive' => 1,'fk_pd_id'=>$pdid,'fk_form_id' => $i); @@ -5108,7 +5108,7 @@ class PD_Controller extends REST_Controller { } //die(); //GET ALL PROCESSED JSON - for($i = 1;$i<=25;$i++) + for($i = 1;$i<=30;$i++) { $fields = array('processed_json'); $where_condition_array = array('isactive' => 1,'fk_pd_id'=>$pdid,'fk_form_id' => $i); @@ -6095,7 +6095,9 @@ class PD_Controller extends REST_Controller { $records = $this->post('records'); $company_id = isset($records['company_id']) && $records['company_id']? $records['company_id'] : null; - $rental_count_id = isset($records['company_id']) && $records['company_id'] ? $records['company_id'] : null; + $rental_count_id = isset($records['rental_count_id']) && $records['rental_count_id'] ? $records['rental_count_id'] : null; + //$location = isset($records['link']) ? $records['link'] : null; + //echo $rental_count_id;die(); $res = $this->saveBase64Images($records['pd_id'],$records['formid'],$company_id,$rental_count_id,$records['images']); if(count($res)) @@ -6119,7 +6121,7 @@ class PD_Controller extends REST_Controller { public function getPDImages_post() { $records = $this->post('records'); - $result_data = $this->PD_Model->getSignedPDDocsURL($records['pd_id'],isset($records['form_id']) ? $records['form_id']: null ,isset($records['company_id']) ? $records['company_id'] : null,isset($records['is_common']) ? $records['is_common'] : null,$records['rental_count_id']); + $result_data = $this->PD_Model->getSignedPDDocsURL($records['pd_id'],isset($records['form_id']) ? $records['form_id']: null ,isset($records['company_id']) ? $records['company_id'] : null,isset($records['is_common']) ? $records['is_common'] : null,isset($records['rental_count_id']) ? $records['rental_count_id'] : null); if(count($result_data)) { $data['dataStatus'] = true; @@ -6137,7 +6139,7 @@ class PD_Controller extends REST_Controller { } - public function saveBase64Images($pd_id,$form_id = null,$company_id = null,$rental_count_id = null;$data) + public function saveBase64Images($pd_id,$form_id = null,$company_id = null,$rental_count_id = null,$data) { @@ -6183,7 +6185,7 @@ class PD_Controller extends REST_Controller { if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200) { - $record_data = array('fk_pd_id' => $pd_id,'pd_document_title'=>$title,'pd_document_name'=>$tempdocname,'fk_form_id'=>$form_id,'is_show_report' =>$is_show_report,'rental_count_id' => $rental_count_id); + $record_data = array('fk_pd_id' => $pd_id,'pd_document_title'=>$title,'pd_document_name'=>$tempdocname,'fk_form_id'=>$form_id,'is_show_report' =>$is_show_report,'rental_count_id' => $rental_count_id,'location' => $doc['link']); $record_data['company_id'] = $company_id ? $company_id : null; $id = $this->PD_Model->saveRecords($record_data,PDDOCUMENTS); if($id != null || $id != "") { $count++;} @@ -6447,7 +6449,14 @@ class PD_Controller extends REST_Controller { if(isset($supplier_form['manufacturing_details'][0]['main_raw_materials'])) { - $supplier_count += count($supplier_form['manufacturing_details'][0]['main_raw_materials']) ? count($supplier_form['manufacturing_details'][0]['main_raw_materials']) : 0; + + foreach ($supplier_form['manufacturing_details'][0]['main_raw_materials'] as $manu_key => $manu_value) + { + if($manu_value['manufacturing_raw_material_name'] != "" && $manu_value['manufacturing_supplier_name'] != "" && $manu_value['manufacturing_contact_person_name'] != "" && ($manu_value['manufacturing_contact_person_mobile_number'] != "" || $manu_value['person_landline'] != "")) + { + $supplier_count ++; + } + } } @@ -6460,7 +6469,14 @@ class PD_Controller extends REST_Controller { if(isset($supplier_form['trade_details'][0]['trading_products'])) { - $supplier_count += count($supplier_form['trade_details'][0]['trading_products']) ? count($supplier_form['trade_details'][0]['trading_products']): 0; + foreach ($supplier_form['trade_details'][0]['trading_products'] as $trading_key => $trading_value) + { + if($trading_value['trade_product_name'] != "" && $trading_value['trade_supplier_name'] != "" && $trading_value['trade_product_contact_person_name'] != "" && ($trading_value['trade_product_contact_person_mobile_number'] != "" || $trading_value['person_landline'] != "")) + { + $supplier_count ++; + } + } + } //echo 'IN trade-'.$supplier_count; @@ -6492,8 +6508,13 @@ class PD_Controller extends REST_Controller { if(isset($client_form['manufacturing_details'][0]['main_raw_materials'])) { - $client_count += count($client_form['manufacturing_details'][0]['main_raw_materials']) ? count($client_form['manufacturing_details'][0]['main_raw_materials']): 0; - + foreach ($client_form['manufacturing_details'][0]['main_raw_materials'] as $key => $value) + { + if($value['manufacturing_product_name'] != "" && $value['manufacturing_client_name'] != "" && $value['manufacturing_contact_person_name'] != "" && ($value['manufacturing_contact_person_mobile_number'] != "" || $value['person_landline'] != "")) + { + $client_count++; + } + } } } @@ -6503,7 +6524,13 @@ class PD_Controller extends REST_Controller { if(isset($client_form['trade_details'][0]['trading_products'])) { - $client_count += count($client_form['trade_details'][0]['trading_products']) ? count($client_form['trade_details'][0]['trading_products']): 0; + foreach ($client_form['trade_details'][0]['trading_products'] as $key => $value) + { + if($value['trade_product_name'] != "" && $value['trade_supplier_name'] != "" && $value['trade_product_contact_person_name'] != "" && ($value['trade_product_contact_person_mobile_number'] != "" || $value['person_landline'] != "")) + { + $client_count++; + } + } } } @@ -6512,8 +6539,13 @@ class PD_Controller extends REST_Controller { { if(isset($client_form['service_provider_details'][0]['service_products'])) { - //print_r(count($client_form['service_provider_details'][0]['service_products'])); - $client_count += count($client_form['service_provider_details'][0]['service_products']) ? count($client_form['service_provider_details'][0]['service_products']) : 0; + foreach ($client_form['service_provider_details'][0]['service_products'] as $key => $value) + { + if($value['service_provider_product_name'] != "" && $value['service_provider_client_name'] != "" && $value['service_provider_product_contact_person_name'] != "" && ($value['service_provider_product_contact_person_mobile_number'] != "" || $value['person_landline'] != "")) + { + $client_count++; + } + } } } @@ -6783,5 +6815,53 @@ class PD_Controller extends REST_Controller { } } - + public function pdFormsCompletenessCheck_post() + { + $pdid = $this->post('pd_id'); + + $business_captions = array("no_of_years_business_run" => "Business Vintage >>", "location_suited_for_busienss" => "Business Location suitability >>", "business_seasonality" => "Seasonality >>", "employees_total" => "Employee Strength >>", "cerificates" => "Business Certifications Sighted >>","owned_property" => "Business Premise Ownership >>", "owned_vechile" => "Vehicle Ownership >>", "business_activity_has_seen" => "Business Activity Observed >>", "minimum_supplier_info" => "Supplier Information Provided >>", "minimum_client_info" => "Client Information Provided >>","stock_raw_material_enough" => "Raw Materials Stock Sufficiency >>", "stock_finished_goods_enough" => "Finished/Traded Stock Sufficiency >>", "vintage_of_business_account" => "Main Business Banking Account Vintage >>"); + + $general_captions = array("otp_done" => "OTP authentication done >>","person_met_is_applicant" => "Is person Met, a loan applicant >>","qualification" => "Qualification of Loan Applicants >>","comment_locality" => "Comment on Locality >>","pd_location_approach" => "Approach to PD location >>","customer_behaviour" => "Customer Behaviour >>","neibourhood_check_as_per_pd_officer" => "Neighbourhood check >>","was_the_company_name_board_sighted" => "Business Board Sighted >>","value_of_other_assets" => "Asset Value by Loan Amount % >>"); + + $incomplete_details = array(); + //$form_data = array(); + // for($i = 1;$i<=30;$i++) + // { + // $fields = array('json'); + // $where_condition_array = array('isactive' => 1,'fk_pd_id'=>$pd_id,'fk_form_id' => $i); + // $data['pd_processed_forms'][$i] = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON,array(),'','company_id','ASC'); + + // $data['pd_images'][$i] = $this->PD_Model->getSignedPDDocsURL($pd_id,$i); + + // } + + //check General form questions + $pd_master_details = $this->PD_Model->getPDMasterDetails($pdid); + $form_data = $this->PD_Model->getScorablePDFormDetailsJSON($pdid); + $score_questions = $this->seperateScoreQuestions($form_data,$pd_master_details[0]['is_otp_done']); + print_r($score_questions);die(); + + foreach ($score_questions['general'] as $g_key => $g_value) { + + //if($g_key != 'value_of_other_assets' && ($g_value == '' || $g_value == null)) + if(($g_value == '' || $g_value == null)) + { + $incomplete_details[] = $general_captions[$g_key]; + } + } + + foreach ($score_questions['business'] as $b_key => $b_value) { + + if($g_key != 'value_of_other_assets' && ($g_value == '' || $g_value == null)) + { + $incomplete_details[] = $general_captions[$g_key]; + } + } + + + print_r($incomplete_details);die(); + + + + } } \ No newline at end of file diff --git a/api/application/docs/sample.pdf b/api/application/docs/sample.pdf index 4be58394..275db0a2 100644 Binary files a/api/application/docs/sample.pdf and b/api/application/docs/sample.pdf differ diff --git a/api/application/views/report_templates/JSONTOREPORT.php b/api/application/views/report_templates/JSONTOREPORT.php index 970c14a2..9289d047 100644 --- a/api/application/views/report_templates/JSONTOREPORT.php +++ b/api/application/views/report_templates/JSONTOREPORT.php @@ -561,24 +561,26 @@ defined('BASEPATH') OR exit('No direct script access allowed'); foreach($person_met_data as $pk => $person) { $display_for_person_met =$person['relations'] != "" ? substr_replace($person['relations'],'.',strrpos($person['relations'],','),1) : ''; - //echo '
'.$person['name'].' - '.$display_for_person_met.'
'; - //echo ''.$display_for_person_met.'
'; - if($display_for_person_met != "" || $display_for_person_met != null){ + + $person_met_details = $person['name']; + $person_met_details .= ($display_for_person_met != "" ? ' - ' . $display_for_person_met :''); + echo ''.$person_met_details.'
'; + + //if($display_for_person_met != "" || $display_for_person_met != null){ echo '