diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 620a982f..1f45409e 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -619,8 +619,11 @@ class PD_Controller extends REST_Controller { { foreach($pd_addtional_requirements as $pd_addtional_requirement_key => $pd_addtional_requirement) { - $pd_addtional_requirement['fk_pd_id'] = $pd_id; - $this->PD_Model->saveRecords($pd_addtional_requirement,PDADDTIONALREQUIREMENTS); + if($pd_addtional_requirement['add_requirement'] != null) + { + $pd_addtional_requirement['fk_pd_id'] = $pd_id; + $this->PD_Model->saveRecords($pd_addtional_requirement,PDADDTIONALREQUIREMENTS); + } } } @@ -708,7 +711,7 @@ class PD_Controller extends REST_Controller { { foreach($pd_addtional_requirements as $requirement_key => $pd_addtional_requirement) { - if($pd_addtional_requirement['add_req_id'] != null || $pd_addtional_requirement['add_req_id'] != "") + if($pd_addtional_requirement['add_req_id'] != null || $pd_addtional_requirement['add_req_id'] != "" && ($pd_addtional_requirement['add_requirement'] != null) ) { $where_condition_array = array('add_req_id' => $pd_addtional_requirement['add_req_id']); $pk_id = $this->PD_Model->updateRecords($pd_addtional_requirement,PDADDTIONALREQUIREMENTS,$where_condition_array); @@ -716,9 +719,12 @@ class PD_Controller extends REST_Controller { } else { - $pd_addtional_requirement['fk_pd_id'] = $records['pdid']; - $pk_id = $this->PD_Model->saveRecords($pd_addtional_requirement,PDADDTIONALREQUIREMENTS); - if($pk_id != "" || $pk_id != null){ $count++; } + if( $pd_addtional_requirement['add_requirement'] != null || $pd_addtional_requirement['add_requirement'] != "") + { + $pd_addtional_requirement['fk_pd_id'] = $records['pdid']; + $pk_id = $this->PD_Model->saveRecords($pd_addtional_requirement,PDADDTIONALREQUIREMENTS); + if($pk_id != "" || $pk_id != null){ $count++; } + } } } } @@ -2457,14 +2463,21 @@ class PD_Controller extends REST_Controller { break; case 23: $processed_json = $records; - break; + break; + + case 24: + $processed_json = GETPROCESSEDJSON::convertCreditManagerQueriesForm($records,$formid); + $records['docs_to_be_sighted'] = $processed_json['docs_to_be_sighted']; + unset($processed_json['docs_to_be_sighted']); + //default: //echo "Something Wrong! Form ID did not match, Contact System Administrator"; } } - // die(); + + /*****End of Form Specific funcitons to convert RAW JSON Data to Processed JSON DATA*******/ unset($records['pdid']); @@ -2529,6 +2542,7 @@ class PD_Controller extends REST_Controller { } //echo $pd_id;echo $pd_form_id; + if($pd_form_id == 18) { @@ -2641,6 +2655,10 @@ class PD_Controller extends REST_Controller { $json[] = json_decode($r['json'],true); } } + else if($pd_form_id == 24) //// common form credit managers specific queries + { + $json = $this->getDocsToBeSightedImagesS3URL( json_decode($rec[0]['json'],true),$pd_id ); + } else { $json = json_decode($rec[0]['json']); @@ -2661,6 +2679,35 @@ class PD_Controller extends REST_Controller { } + + //get documents to be sight form images S3 url's and fetch it to frond end form + function getDocsToBeSightedImagesS3URL( $credit_manager_form_data,$pd_id ) + { + $pd_documnets = $this->PD_Model->selectCustomRecords(array('*'),array('fk_pd_id' => $pd_id,'fk_form_id' => 24),PDDOCUMENTS); + $pd_master_details = $this->PD_Model->getPDMasterDetails($pd_id); + if(count($pd_documnets)) + { + $bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_master_details[0]['fk_lender_id']; + //echo $bucketname; + + foreach ($pd_documnets as $doc_key => $doc_value) { + + foreach ($credit_manager_form_data['docs_to_be_sighted'] as $docs_to_be_sighted_key => $docs_to_be_sighted_value) + { + if(isset($docs_to_be_sighted_value['img']) && $docs_to_be_sighted_value['img'] == $doc_value['pd_document_id']) + { + $key = 'pd'.$pd_id.'/'.$doc_value['pd_document_name']; + //echo $key;die(); + $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+30 minutes'); + //echo $doc_value['pd_document_id'] .'********'.$singed_uri.'*******'; + $credit_manager_form_data['docs_to_be_sighted'][$docs_to_be_sighted_key]['img'] = $singed_uri; + + } + } + } + } + return $credit_manager_form_data; + } public function getAddtionalPDAssetsWithLoanFromBusinessAndOtherAssets($parentpd_existing_loan_details,$pd_id,$additional_pd_id,$company_id = null) @@ -5465,11 +5512,11 @@ class PD_Controller extends REST_Controller { $data['applicants_details'] = $this->PD_Model->getApplicantsDetails($pdid); //print_r($data['applicants_details']);die(); $data['pd_additional_requirements'] = $this->PD_Model->getPDAdditionalRequirements($pdid); - $data['score_questions_display'] = $this->PD_Model->getScoreableQuestionToDispaly(); - $data['pd_score'] = $this->calculateScore($pdid); + //$data['score_questions_display'] = $this->PD_Model->getScoreableQuestionToDispaly(); + //$data['pd_score'] = $this->calculateScore($pdid); //print_r($data['pd_score']); //die(); - $data['assessed_income_details'] = $this->getAssessedIncomeForPDReport($pdid); + //$data['assessed_income_details'] = $this->getAssessedIncomeForPDReport($pdid); // print_r($data['assessed_income_details']); // echo "**************************"; @@ -5526,7 +5573,7 @@ class PD_Controller extends REST_Controller { // $this->getPDImages_post``($fields2,array('fk_pd_id'=>$pdid,'fk_form_id' => $i),PDDOCUMENTS,array(),'','company_id','ASC'); // print_r($this->db->last_query()); } - //print_r($data['pd_processed_forms']);die(); + //print_r($data['pd_processed_forms'][24]);die(); //print_r($data['pd_images']);die(); //print_r(json_decode($data['pd_processed_forms'][14][0]['processed_json'],true)); //die(); @@ -6565,6 +6612,7 @@ class PD_Controller extends REST_Controller { $count = 0; $result = array(); + $pks = array(); $pd_details = $this->PD_Model->getPDMasterDetails($pd_id); //print_r($data);die(); EXTERNAL_DIR_CHECK::checkExternalDirectory($pd_id); @@ -6638,7 +6686,7 @@ class PD_Controller extends REST_Controller { $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++;} + if($id != null || $id != "") { $count++; $pks[] = $id;} } } @@ -6648,6 +6696,7 @@ class PD_Controller extends REST_Controller { //$logger->info('All Images Saved Sucessfully',array($pd_id,$form_id,$company_id)); $result['status'] = true; $result['count'] = $count; + $result['pks'] = $pks; $result['msg'] = "All Images Saved Successfully"; } else @@ -6655,6 +6704,7 @@ class PD_Controller extends REST_Controller { //$logger->info('Some Images Not Saved',array($pd_id,$form_id,$company_id)); $result['status'] = true; $result['count'] = $count; + $result['pks'] = $pks; $result['msg'] = "Some Images Not Saved!"; } return $result; diff --git a/api/application/helpers/getprocessedjson_helper.php b/api/application/helpers/getprocessedjson_helper.php index bcfb03f7..17449a67 100644 --- a/api/application/helpers/getprocessedjson_helper.php +++ b/api/application/helpers/getprocessedjson_helper.php @@ -2519,6 +2519,79 @@ class GETPROCESSEDJSON return ($raw_json); } /************************########### END OF RENTAL INCOME #################****************************/ + + + + /************************###########CREDIT MANAGER QUERIES FORM #################****************************/ + + public static function convertCreditManagerQueriesForm($records,$formid) + { + $CI =& get_instance(); + $additional_requirements = $CI->PD_Model->getPDAdditionalRequirements($records['pdid']); + $docs_to_collected = $CI->PD_Model->getDocsToBeCollected($records['pdid']); + //print_r($records); + // print_r($docs_to_collected); + if(isset($records['addtional_requirements'][0]) && count($records['addtional_requirements'][0]) ) + { + foreach ($records['addtional_requirements'][0] as $add_key => $add_value) + { + foreach ($additional_requirements as $key => $value) + { + if($add_key == $value['add_req_id']) + { + + $records['additional_requirements_processed'][] = array('question' => $value['add_requirement'],'answer' => $add_value); + break; + } + } + + } + } + unset($records['addtional_requirements']); + + if(isset($records['docs_to_be_sighted']) && count($records['docs_to_be_sighted']) ) + { + foreach ($records['docs_to_be_sighted'] as $doc_key => $doc_value) + { + foreach ($docs_to_collected as $key => $value) + { + if(key($doc_value) == $value['pd_doc_to_be_collect_id']) + { + // $temp['pk'] = key($doc_value); + // $temp['key_index'] = $doc_key; + $temp['doc_name'] = $value['doc_name']; + $temp['ans'] = $doc_value[ key($doc_value) ]; + $temp['img'] = array_key_exists('img',$doc_value) ? $doc_value['img']: null; + if(array_key_exists('img',$doc_value) && $doc_value['is_new'] == 1) + { + $return_data = $CI->saveBase64Images($records['pdid'],$records['formid'],$company_id = null,$rental_count_id = null,array(array('image' => $doc_value['img'],'Name' => $value['doc_name'],'link' => $records['link']))); + if(count($return_data) && isset($return_data['pks']) ) + { + $records['docs_to_be_sighted'][$doc_key]['img'] = $return_data['pks'][0]; + $temp['img'] = $return_data['pks'][0]; + $records['docs_to_be_sighted'][$doc_key]['is_new'] = 0; + } + } + + //$temp['is_new'] = array_key_exists('is_new',$doc_value) ? $doc_value['is_new']: 0; + $temp['reason'] = array_key_exists('reason',$doc_value) ? $doc_value['reason']: null; + $records['docs_to_be_sighted_processed'][] = $temp; + + + break; + } + } + + } + } + //unset($records['docs_to_be_sighted']); + // print_r($records); + // die(); + return $records; + } + /************************########### END OF CREDIT MANAGER QUERIES FORM #################****************************/ + + } diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index 2c85fa0d..44badec7 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -891,7 +891,8 @@ class PD_Model extends SPARQ_Model { // $overall_question_count = 0; //Get PD Master Details including Template id @param $pd_id $pd_master_detials = $this->getPDMasterDetails($pdid,$random_string); - + $pd_additional_requirements = $this->getPDAdditionalRequirements($pdid); + $docs_to_be_collected = $this->getPDAdditionalRequirements($pdid); // $addtional_pd_ids = $this->PD_Model->getAddtioonalPDIDs($pdid); // $addtional_pd_ids_string = null; @@ -1008,13 +1009,18 @@ class PD_Model extends SPARQ_Model { //Get Forms details - $this->db->SELECT('TEMPLATEFORMS.form_id,PDFORMS.pd_form_order,PDFORMS .pd_form_level_order,PDFORMS.pd_form_name as form_name'); + $this->db->SELECT('TEMPLATEFORMS.form_id,PDFORMS.pd_form_order,PDFORMS.pd_form_level_order,PDFORMS.pd_form_name as form_name'); $this->db->FROM(TEMPLATEFORMS.' as TEMPLATEFORMS'); $this->db->JOIN(PDFORMS.' as PDFORMS','TEMPLATEFORMS.form_id = PDFORMS.pd_form_id'); $this->db->WHERE('TEMPLATEFORMS.fk_template_id',$template_id); $this->db->WHERE('TEMPLATEFORMS.isactive',1); + if( !(count($docs_to_be_collected) || count($pd_additional_requirements)) ) + { + $this->db->WHERE('TEMPLATEFORMS.form_id != ',24); //credit managers specific queries form + } $this->db->ORDER_BY('PDFORMS.pd_form_order'); $template_forms = $this->db->GET()->result_array(); + //print_r($this->db->last_query());die(); $level_one_status = 0; $level_one_total = 0; $level_two_status = 0; diff --git a/api/application/models/User_Management_Model.php b/api/application/models/User_Management_Model.php index abdb56db..a320c89c 100644 --- a/api/application/models/User_Management_Model.php +++ b/api/application/models/User_Management_Model.php @@ -53,7 +53,7 @@ class User_Management_Model extends SPARQ_Model { public function getUserDetails($userid){ - $this->db->select('USERPROFILE.userid, USERPROFILE.aws_name, USERPROFILE.first_name as user_first_name, USERPROFILE.last_name as user_last_name, USERPROFILE.email, USERPROFILE.mobile_no, USERPROFILE.profilepic, USERPROFILE.createdon, USERPROFILE.fk_createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as created_full_name, USERPROFILE.updatedon, USERPROFILE.fk_updatedby,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name)as update_full_name, USERPROFILE.fk_entity_id,ENTITY.full_name, USERPROFILE.isactive, USERPROFILE.fk_city,CITY.name as city_name, USERPROFILE.fk_state,STATE.name as state_name, PDOFFICIERSDETAILS.fk_pd_type_id,PDOFFICIERSDETAILS.fk_team_id,USERPROFILE.fk_entity_type_id,USERPROFILEROLES.user_role,ENTITYTYPE.name as entitytypename,ROLES.role_name,USERPROFILE.mpin'); + $this->db->select('USERPROFILE.userid, USERPROFILE.aws_name, USERPROFILE.first_name as user_first_name, USERPROFILE.last_name as user_last_name, USERPROFILE.email, USERPROFILE.mobile_no, USERPROFILE.profilepic, USERPROFILE.createdon, USERPROFILE.fk_createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as created_full_name, USERPROFILE.updatedon, USERPROFILE.fk_updatedby,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name)as update_full_name, USERPROFILE.fk_entity_id,ENTITY.full_name,ENTITY.short_name,USERPROFILE.isactive, USERPROFILE.fk_city,CITY.name as city_name, USERPROFILE.fk_state,STATE.name as state_name, PDOFFICIERSDETAILS.fk_pd_type_id,PDOFFICIERSDETAILS.fk_team_id,USERPROFILE.fk_entity_type_id,USERPROFILEROLES.user_role,ENTITYTYPE.name as entitytypename,ROLES.role_name,USERPROFILE.mpin'); $this->db->from(USERPROFILE.' as USERPROFILE'); $this->db->join(ENTITY.' as ENTITY','USERPROFILE.fk_entity_id = ENTITY.entity_id and ENTITY.isactive = 1','LEFT'); $this->db->join(STATE.' as STATE','USERPROFILE.fk_state = STATE.state_id and STATE.isactive = 1','LEFT'); diff --git a/api/application/views/report_templates/JSONTOREPORT.php b/api/application/views/report_templates/JSONTOREPORT.php index b86b8823..3754388a 100644 --- a/api/application/views/report_templates/JSONTOREPORT.php +++ b/api/application/views/report_templates/JSONTOREPORT.php @@ -1370,7 +1370,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); } else{ - $bindEachResult['officer_visit_company_employees']='At the time of PD visit, PD officer could not able to see any of employees at the business premises.'; + $bindEachResult['officer_visit_company_employees']='At the time of PD visit, no employees seen at the business premises.'; } //this is documents visited $getDocuments=array(); @@ -1917,7 +1917,8 @@ defined('BASEPATH') OR exit('No direct script access allowed');
↑ /↓'; if(isset($pd_processed_forms[14][$business_count])) @@ -2160,6 +2161,21 @@ defined('BASEPATH') OR exit('No direct script access allowed'); + + Validation of Customer Declared Financials :'; + echo 'Kuccha Record Seen (Yes/No) : ';echo $financialsncial_kuccha_info['kuccha_records_shown'] == 'yes' ? '' : 'No Kuccha Records made available to PD officer and therefore validation of customer declared financials was not possible.'; + + if($financialsncial_kuccha_info['kuccha_records_shown'] == 'yes') + { + echo 'Photograph of Kuchha Bills Allowed (Yes/No) : '. $financialsncial_kuccha_info['kuccha_bill_allowed'] == 'yes' ? 'Yes, enclosed with report': 'No'; + + echo 'Number of Kuccha Bills and Values therein, justifies the customer declared turnover (Yes / No): '. $financialsncial_kuccha_info['customer_declared_turnover'] == 'yes' ? 'Yes': 'No'; + } + } + ?>Working Capital Cycle:
| S.No | Particulars | Days |
|---|