diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 845011d3..444ef7d3 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -10378,7 +10378,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() public function updateVendorStatus_post() { $records = $this->post('records'); - + //print_r($records); $fields_to_update = array('vendor_status' => $records['vendor_status'],'fk_updatedby' => $records['fk_updatedby']); if(isset($records['vendor_pdofficer'])) @@ -10389,16 +10389,44 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() // { // $fields_to_update['start_location'] = $records['link']; // } + if(isset($records['vendor_status']) && ($records['vendor_status'] == BOUNCED)) + { + unset($records['bounce_reason']); + unset($records['bounce_reason_others']); + } - if(isset($records['vendor_status']) && $records['vendor_status'] == COMPLETED) + if(isset($records['vendor_status']) && ($records['vendor_status'] == COMPLETED || $records['vendor_status'] == QC_COMPLETED)) { + + $vendor_form = $this->PD_Model->selectCustomRecords(array('json'),array('isactive' => 1,'fk_form_id' => 25,'fk_pd_id' => $records['pd_id']) + ,PDFORMDETAILSJSON); + if(count($vendor_form)) + { + $vendor_form = json_decode($vendor_form[0]['json'],true); + if(isset($vendor_form['is_form_validated']) && !$vendor_form['is_form_validated']) + { + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_NOT_MODIFIED; + $data['msg'] = 'Form Saved as Draft! Please Fill and submit the form'; + $this->response($data,REST_Controller::HTTP_OK); + } + } + else + { + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_NOT_MODIFIED; + $data['msg'] = 'Form Not filled !'; + $this->response($data,REST_Controller::HTTP_OK); + } + + // print_r($vendor_form); + if($records['vendor_status'] == COMPLETED) + { $fields_to_update['pd_visit_date'] = date('Y-m-d H:i:s'); - if(isset($records['is_form_validated'])) - { - $fields_to_update['is_video_merged'] = $records['is_form_validated']; - unset($records['is_form_validated']); } + } + // die(); $id = $this->PD_Model->updateRecords($fields_to_update,PDTRIGGER,array('pd_id' => $records['pd_id'])); if($id) diff --git a/api/application/helpers/vendor_form_helper.php b/api/application/helpers/vendor_form_helper.php index 63b3c74e..8d98bd61 100644 --- a/api/application/helpers/vendor_form_helper.php +++ b/api/application/helpers/vendor_form_helper.php @@ -7,16 +7,16 @@ class vendor_form { $CI =&get_instance(); $CI->load->model('PD_Model'); - $return_data = 'During FI visit, No one met at the visited premises.'; + $return_data = 'During Field Visit, No one met at the visited premises.'; if($cus_type == 2) { - $return_data .= 'FI officer clicked Office/Name Board/Entrance photographs and same is available in zipped folder attached with report.'; + $return_data .= 'Field Visit officer clicked Office/Name Board/Entrance photographs and same is available in zipped folder attached with report.'; } if($vendor_gen_section['person_met_entered']) { - $return_data = ($cus_type == 1 ? $vendor_gen_section['person_met_entered']." ".$vendor_gen_section['designation_entered'] ." met at the visited address during FI." : $vendor_gen_section['person_met_entered']. " met at the visited address during FI."); + $return_data = ($cus_type == 1 ? $vendor_gen_section['person_met_entered']." ( ".$vendor_gen_section['designation_entered'] ." ) met at the visited address during Field Visit." : $vendor_gen_section['person_met_entered']. " met at the visited address during Field Visit."); } else { @@ -24,7 +24,7 @@ class vendor_form { if($ind_value['is_person_met']) { - $return_data = "Applicant ".$ind_value['applicant_name']." was met at the visited address during FI."; + $return_data = "Applicant ".$ind_value['applicant_name']." was met at the visited address during Field Visit."; break; } } diff --git a/api/application/models/Common_Masters_Model.php b/api/application/models/Common_Masters_Model.php index 224babe4..9b558804 100644 --- a/api/application/models/Common_Masters_Model.php +++ b/api/application/models/Common_Masters_Model.php @@ -24,14 +24,15 @@ class Common_Masters_Model extends SPARQ_Model { if($table_constant == 'PDLOCATIONAPPROACH' || $table_constant == 'PDOFFICERRECOMMENDATIONS') { $order = $master_tables_pkid[$table_constant]; - $master_data = $this->db->SELECT('*')->FROM(constant($table_constant))->ORDER_BY('is_others')->ORDER_BY($order)->GET()->result_array(); + $master_data = $this->db->SELECT('*')->FROM(constant($table_constant))->WHERE('isactive',1)->ORDER_BY('is_others')->ORDER_BY($order)->GET()->result_array(); return $master_data; } else { $order = $master_tables_field_names[$table_constant]; - $master_data = $this->db->SELECT('*')->FROM(constant($table_constant))->ORDER_BY('is_others')->ORDER_BY($order)->GET()->result_array(); + $master_data = $this->db->SELECT('*')->FROM(constant($table_constant))->WHERE('isactive',1)->ORDER_BY('is_others')->ORDER_BY($order)->GET()->result_array(); + //echo count($master_data);die(); return $master_data; } // print_r($this->db->last_query()); diff --git a/api/application/views/report_templates/JSONTOREPORT_DI_AI_SMARTPD.php b/api/application/views/report_templates/JSONTOREPORT_DI_AI_SMARTPD.php index b25a03ad..687eedb1 100644 --- a/api/application/views/report_templates/JSONTOREPORT_DI_AI_SMARTPD.php +++ b/api/application/views/report_templates/JSONTOREPORT_DI_AI_SMARTPD.php @@ -4762,31 +4762,32 @@ if($total_no_of_business > 0) {
General Section
'; + echo ''; + $vendor_form_json = json_decode($pd_processed_forms[25][0]['json'],true); + echo "$vendor_gen_section_text
"; + echo "$vendor_gen_section_text
"; - echo 'Address Section
'; + echo 'FI Initiated Address: ".$vendor_address_section['address'].", ". $address_content['initiated_address']['city_name'] .", ".$address_content['initiated_address']['state_name']." - ".$address_content['initiated_address']['pincode']."
"; + echo "Field Visit Initiated Address: ".$vendor_address_section['address'].", ". $address_content['initiated_address']['city_name'] .", ".$address_content['initiated_address']['state_name']." - ".$address_content['initiated_address']['pincode']."
"; if(!$vendor_address_section['is_pd_done_on_initiated_address']) { - echo "FI Actual Visited Address: ".$vendor_address_section['alternative_addresses'][0]['alternative_address'].", ". $address_content['actual_address']['city_name'] .", ".$address_content['actual_address']['state_name']." - ".$address_content['actual_address']['pincode']."
"; + echo "Field Visit Actual Visited Address: ".$vendor_address_section['alternative_addresses'][0]['alternative_address'].", ". $address_content['actual_address']['city_name'] .", ".$address_content['actual_address']['state_name']." - ".$address_content['actual_address']['pincode']."
"; echo "Reasaon: ".$vendor_address_section['alternative_addresses'][0]['reason_for_alternative_address']."
"; } $locality = preg_match("/^[aeiouAEIOU]/U", $address_content['comment_locality']) ? 'an '.$address_content['comment_locality'] : 'a '.$address_content['comment_locality']; - echo "The FI visit was done at ".$address_content['address_type']." of the loan applicants. The ".$address_content['address_type']." is located in a ".$address_content['address_locality']." and the estimated area of the ".$address_content['address_type']." is ".$vendor_address_section['estimated_area']." ". $address_content['uom'].". The PD location was ".$address_content['pd_location_approach'].". As Per FI Officer, the ".$address_content['address_type']." is situated in $locality Locality.
"; + echo "The Field Visit was done at ".$address_content['address_type']." of the loan applicants. The ".$address_content['address_type']." is located in a ".$address_content['address_locality']." and the estimated area of the ".$address_content['address_type']." is ".$vendor_address_section['estimated_area']." ". $address_content['uom'].". The location was ".$address_content['pd_location_approach'].". As Per Officer, the ".$address_content['address_type']." is situated in $locality Locality.
"; - echo 'Busienss information
'; + echo 'At the time of FI visit, ".$vendor_business_info['officer_total']." employees sighted at the visited premises.
" : "At the time of FI visit, no employees sighted at the visited premises.
"; + echo $emp = $vendor_business_info['officer_total'] > 0 ? "At the time of Field Visit , ".$vendor_business_info['officer_total']." employees sighted at the visited premises.
" : "At the time of Field Visit visit, no employees sighted at the visited premises.
"; - echo $name_board = $vendor_business_info['was_the_company_name_board_sighted'] == 'yes' ? "The Business Name board was seen at the visited premises.
" : "The Business Name board was not seen at the visited premises.
"; + echo $name_board = $vendor_business_info['was_the_company_name_board_sighted'] == 'yes' ? "The Business Name board was seen at the visited premises.
" : "The Business Name board was not seen at the visited premises.
"; if(($vendor_business_info['documents_sighted'] == 'yes')) { @@ -4796,25 +4797,26 @@ if($total_no_of_business > 0) { { $doc_names .= $photo_names [ $doc_value['document_name'] ].', '; } - + $were = count($vendor_business_info['documents_info']) == 1 ? 'was' : 'were'; $doc_names = substr_replace($doc_names,' ',-2); - echo "$doc_names were sighted during FI visit and photographs available in zipped file enclosed with report."; + echo "$doc_names $were sighted during Field Visit visit and photographs available in zipped file enclosed with report.
"; } else { - echo 'No Documents were sighted during FI visit.
'; + echo 'No Documents were sighted during Field Visit visit.
'; } $vendor_business_asset_info = $vendor_form_json['questions'][2]['business_group'][1]; - echo $vendor_business_asset_info['business_is_pd_visited'] == 'yes' ? 'Business Activity was seen during FI visit
': 'Business Activity was not seen during FI visit.
'; + echo $vendor_business_asset_info['business_is_pd_visited'] == 'yes' ? 'Business Activity was seen during Field visit
': 'Business Activity was not seen during Field Visit visit.
'; $vendor_stock_info = $vendor_form_json['questions'][2]['business_group'][2]; - echo $vendor_stock_info['is_stock_photo'] == 'yes' ? 'Stock was observed during FI visit and photographs available in zipped file enclosed with report.
': 'No Stock was observed during FI visit.
'; + echo $vendor_stock_info['is_stock_photo'] == 'yes' ? 'Stock was observed during Field visit and photographs available in zipped file enclosed with report.
': 'No Stock was observed during Field Visit visit.
'; - echo $vendor_business_asset_info['business_asset_sight'] == 'yes' ? 'Business Assets were sighted during FI visit and photographs available in zipped file enclosed with report.
': 'No Business Assets were sighted during FI visit.
'; - - echo 'Credit Manager Special Requests:
'; + echo $vendor_business_asset_info['business_asset_sight'] == 'yes' ? 'Business Assets were sighted during Field visit and photographs available in zipped file enclosed with report.
': 'No Business Assets were sighted during Field Visit visit.
'; + echo "During Field visit, officer clicked office/Name board/Entrance photographs and same is available in + zipped folder attached with report.
"; + echo 'Neighbourhood Check Details
'; + echo 'Final Status of FI visit:'. $vendoe_final_remars['final_visit_status'] .'
'; - echo 'Comments Entered:'. $vendoe_final_remars['final_comments'] .'
'; + echo 'Final Status of Field Visit:'. $vendoe_final_remars['final_visit_status'] .'
'; + echo 'Remarks:'. $vendoe_final_remars['final_comments'] .'
'; echo 'Name of the FI Officer visited:'.$pd_master_details[0]['vendor_pdofficer_name'].'
'; - echo 'Name of the FI Agency visited:'.$pd_master_details[0]['agency_name'].'
'; - echo 'Date & Time of FI visit:'.$pd_master_details[0]['pd_visit_date'].'
'; + echo 'Name of the Officer visited:'.$pd_master_details[0]['vendor_pdofficer_name'].'
'; + echo 'Name of the Agency visited:'.$pd_master_details[0]['agency_name'].'
'; + echo 'Date & Time of visit:'.$pd_master_details[0]['pd_visit_date'].'
'; echo '
Registered / Corporate Office: SineEdge Consulting Private Limited. A-211, Pioneer Urban Square, Golf Course Extension Road, Sector 62, Gurgaon, Haryana - 122002
'; ?> - - -General Section
'; - $vendor_gen_section_text = vendor_form::getVendorGeneralSectionContent($vendor_form_json['questions'][0],2); - echo "$vendor_gen_section_text
"; - - echo 'Employer information
'; - $vendor_employer_info = $vendor_form_json['questions'][2]; - - if(array_key_exists('employer_details',$vendor_employer_info)) - { - $employer_details = $vendor_employer_info['employer_details']; - $vendor_emp_master = vendor_form::getVendorEmpSectionContent($vendor_employer_info); - echo 'During FI visit,'. $employer_details['name_person_met'] .' '.substr_replace($vendor_emp_master,'',-3) .'was met at the visited premises.
'; - echo 'Employer’s/Manager’s Company ID card / Visiting Card was photographed during FI visit.
'; - echo 'Salary amount was confirmed by person met during FI visit. Applicant gets monthly gross salary of ₹ '.$employer_details['gross_monthly_salary'].' and net monthly salary of ₹'.$employer_details['net_monthly_salary'].'.
'; - echo 'Salary paid to the applicant between '.$employer_details['from_date_the_salary_is_rcv'].' to ' .$employer_details['to_date_the_salary_is_rcv'].' of every month via '.$salary_mode_text [ $employer_details['mode_of_getting_salary'] ].'.
'; - $time = $employer_details['how_long_year'].' year(s)'; $time .= ($employer_details['how_long_year'] ? ' and '.$employer_details['how_long_year'] .' month(s)': ''); - echo 'During FI visit, Employer confirmed that the applicant has served '.$time.' an employee in this firm / company.
'; - } - else - { - echo 'During FI visit, employer/manager was not met at the visited premises.
'; - echo 'Employer’s/Manager’s Company ID card / Visiting Card was not photographed during FI visit.
'; - echo 'Salary amount was not confirmed
'; - } - - if(isset($vendor_employer_info['docs_sighted'])) - { - //print_r($vendor_employer_info['docs_sighted']['sal_reg_seen'] == 'yes' ? 'Salary Register': '');die(); - echo 'Documents Sighted of applicant employment During FI:
'; - $document_name = ''; - $document_name .= ($vendor_employer_info['docs_sighted']['sal_reg_seen'] == 'yes' ? 'Salary Register, ': ''); - $document_name .= ($vendor_employer_info['docs_sighted']['attendance_seen'] == 'yes' ? 'Attendance Register, ' : ''); - $document_name .= ($vendor_employer_info['docs_sighted']['cash_voucher'] == 'yes'? 'Cash Vouche, r' : ''); - $document_name .= ($vendor_employer_info['docs_sighted']['sal_certificate'] == 'yes' ? 'Salary Certificate, ' : ''); - $document_name .= ($vendor_employer_info['docs_sighted']['sal_slip'] == 'yes' ? 'Salary Slip, ': ''); - $document_name .= ($vendor_employer_info['docs_sighted']['other_doc'] == 'yes' ? $vendor_employer_info['docs_sighted']['other_doc_name'].', ' : ''); - - if($document_name != '') - { - $document_name = substr_replace($document_name,'', -2); - echo "$document_name was seen during FI visit and photographs of same is available in zipped file enclosed with report.
"; - } - else - { - echo 'Applicant’s employment documents were not seen during FI visit because (reason entered).
'; - } - - } - - - $vendor_credit_manager_info = $vendor_form_json['questions'][6]; - if(count($vendor_credit_manager_info['docs_to_be_sighted'])) - { - echo 'Credit Manager Special Requests:
'; - foreach ($vendor_credit_manager_info['docs_to_be_sighted'] as $cm_key => $cm_value) - { - echo 'Document Required:'.$cm_value['placeholder'].'Address Section
'; - $vendor_address_section = $vendor_form_json['questions'][1]; - $address_content = vendor_form::getVendoraddressSectionContent($vendor_address_section); - - echo "FI Initiated Address: ".$vendor_address_section['address'].", ". $address_content['initiated_address']['city_name'] .", ".$address_content['initiated_address']['state_name']." - ".$address_content['initiated_address']['pincode']."
"; - if(!$vendor_address_section['is_pd_done_on_initiated_address']) - { - echo "FI Actual Visited Address: ".$vendor_address_section['alternative_addresses'][0]['alternative_address'].", ". $address_content['actual_address']['city_name'] .", ".$address_content['actual_address']['state_name']." - ".$address_content['actual_address']['pincode']."
"; - echo "Reasaon: ".$vendor_address_section['alternative_addresses'][0]['reason_for_alternative_address']."
"; - } - - $locality = preg_match("/^[aeiouAEIOU]/U", $address_content['comment_locality']) ? 'an '.$address_content['comment_locality'] : 'a '.$address_content['comment_locality']; - echo "The FI visit was done at ".$address_content['address_type']." of the loan applicants. The ".$address_content['address_type']." is located in a ".$address_content['address_locality'].". The PD location was ".$address_content['pd_location_approach'].". As Per FI Officer, the ".$address_content['address_type']." is situated in $locality Locality.
"; - - echo 'Submit:
'; - $vendoe_final_remars = $vendor_form_json['questions'][5]; - echo 'Final Status of FI visit:'. $vendoe_final_remars['final_visit_status'] .'
'; - echo 'Comments Entered:'. $vendoe_final_remars['final_comments'] .'
'; - echo 'Neighbourhood check:
'; - echo 'Existence of organization/office confirmed by neighbour:'. ucfirst($vendoe_final_remars['company_existence_neighbour_confirmed']) .'
'; - if($vendoe_final_remars['company_existence_neighbour_confirmed'] == 'yes') - { - $time = 'Existence of organization/office confirmed by neighbour and is in existence for '.$vendoe_final_remars['company_existence_years'].' year(s).
'; - $time .= ( $vendoe_final_remars['company_existence_months'] ? $vendoe_final_remars['company_existence_months'].' month(s)' : ''); - echo $time; - } - - - echo 'Name of the FI Officer visited:'.$pd_master_details[0]['vendor_pdofficer_name'].'
'; - echo 'Name of the FI Agency visited:'.$pd_master_details[0]['agency_name'].'
'; - echo 'Date & Time of FI visit:'.$pd_master_details[0]['pd_visit_date'].'
'; - echo '
$vendor_gen_section_text
"; + + echo 'Employer information
'; + $vendor_employer_info = $vendor_form_json['questions'][2]; + + if(array_key_exists('employer_details',$vendor_employer_info)) + { + $employer_details = $vendor_employer_info['employer_details']; + $vendor_emp_master = vendor_form::getVendorEmpSectionContent($vendor_employer_info); + echo 'During Field visit,'. $employer_details['name_person_met'] .' ( '.substr_replace($vendor_emp_master,'',-3) .' ) was met at the visited premises.
'; + echo 'Employer’s/Manager’s Company ID card / Visiting Card was photographed during Field Visit visit.
'; + echo 'Salary amount was confirmed by person met during Field Visit visit. Applicant gets monthly gross salary of ₹ '.$employer_details['gross_monthly_salary'].' and net monthly salary of ₹'.$employer_details['net_monthly_salary'].'.
'; + echo 'Salary paid to the applicant between '. MYUTIL::addOrdinalNumberSuffix($employer_details['from_date_the_salary_is_rcv']).' to ' . MYUTIL::addOrdinalNumberSuffix($employer_details['to_date_the_salary_is_rcv']).' of every month via '.$salary_mode_text [ $employer_details['mode_of_getting_salary'] ].'.
'; + $time = $employer_details['how_long_year'].' year(s)'; $time .= ($employer_details['how_long_year'] ? ' and '.$employer_details['how_long_year'] .' month(s)': ''); + echo 'During Field Visit, Employer confirmed that the applicant has served '.$time.' an employee in this firm / company.
'; + } + else + { + echo 'During Field visit, employer/manager was not met at the visited premises.
'; + echo 'Employer’s/Manager’s Company ID card / Visiting Card was not photographed during Field visit.
'; + echo 'Salary amount was not confirmed
'; + } + + if(isset($vendor_employer_info['docs_sighted'])) + { + //print_r($vendor_employer_info['docs_sighted']['sal_reg_seen'] == 'yes' ? 'Salary Register': '');die(); + echo 'Documents Sighted of applicant employment During Field:
'; + $document_name = ''; + $document_name .= ($vendor_employer_info['docs_sighted']['sal_reg_seen'] == 'yes' ? 'Salary Register, ': ''); + $document_name .= ($vendor_employer_info['docs_sighted']['attendance_seen'] == 'yes' ? 'Attendance Register, ' : ''); + $document_name .= ($vendor_employer_info['docs_sighted']['cash_voucher'] == 'yes'? 'Cash Vouche, r' : ''); + $document_name .= ($vendor_employer_info['docs_sighted']['sal_certificate'] == 'yes' ? 'Salary Certificate, ' : ''); + $document_name .= ($vendor_employer_info['docs_sighted']['sal_slip'] == 'yes' ? 'Salary Slip, ': ''); + $document_name .= ($vendor_employer_info['docs_sighted']['other_doc'] == 'yes' ? $vendor_employer_info['docs_sighted']['other_doc_name'].', ' : ''); + + if($document_name != '') + { + $document_name = substr_replace($document_name,'', -2); + echo "$document_name were seen during Field visit and photographs of same is available in zipped file enclosed with report.
"; + } + else + { + echo 'Applicant’s employment documents were not seen during Field visit because (reason entered).
'; + } + + } + + + $vendor_credit_manager_info = $vendor_form_json['questions'][6]; + if(count($vendor_credit_manager_info['docs_to_be_sighted'])) + { + echo 'Credit Manager Special Requests:
'; + foreach ($vendor_credit_manager_info['docs_to_be_sighted'] as $cm_key => $cm_value) + { + echo 'Document Required:'.$cm_value['placeholder'].'Field Visit Initiated Address: ".$vendor_address_section['address'].", ". $address_content['initiated_address']['city_name'] .", ".$address_content['initiated_address']['state_name']." - ".$address_content['initiated_address']['pincode']."
"; + if(!$vendor_address_section['is_pd_done_on_initiated_address']) + { + echo "Field Visit Actual Visited Address: ".$vendor_address_section['alternative_addresses'][0]['alternative_address'].", ". $address_content['actual_address']['city_name'] .", ".$address_content['actual_address']['state_name']." - ".$address_content['actual_address']['pincode']."
"; + echo "Reasaon: ".$vendor_address_section['alternative_addresses'][0]['reason_for_alternative_address']."
"; + } + + $locality = preg_match("/^[aeiouAEIOU]/U", $address_content['comment_locality']) ? 'an '.$address_content['comment_locality'] : 'a '.$address_content['comment_locality']; + echo "The Field Visit was done at ".$address_content['address_type']." of the loan applicants. The ".$address_content['address_type']." is located in a ".$address_content['address_locality'].".The location was ".$address_content['pd_location_approach'].". As Per Officer, the ".$address_content['address_type']." is situated in $locality Locality.
"; + + // echo 'Submit:
'; + $vendoe_final_remars = $vendor_form_json['questions'][5]; + echo 'Final Status of Field visit:'. $vendoe_final_remars['final_visit_status'] .'
'; + echo 'Remarks:'. $vendoe_final_remars['final_comments'] .'
'; + echo 'Neighbourhood check:
'; + echo 'Existence of organization/office confirmed by neighbour:'. ucfirst($vendoe_final_remars['company_existence_neighbour_confirmed']) .'
'; + if($vendoe_final_remars['company_existence_neighbour_confirmed'] == 'yes') + { + $time = 'Existence of organization/office confirmed by neighbour and is in existence for '.$vendoe_final_remars['company_existence_years'].' year(s).
'; + $time .= ( $vendoe_final_remars['company_existence_months'] ? $vendoe_final_remars['company_existence_months'].' month(s)' : ''); + echo $time; + } + + + echo 'Name of the Officer visited:'.$pd_master_details[0]['vendor_pdofficer_name'].'
'; + echo 'Name of the Agency visited:'.$pd_master_details[0]['agency_name'].'
'; + echo 'Date & Time of visit:'.$pd_master_details[0]['pd_visit_date'].'
'; + echo '