SMC RCM IMPLEMENTED
This commit is contained in:
parent
b387811321
commit
9ef45a0bfd
@ -311,4 +311,5 @@ $route['loadSMCPDTemplate'] = 'SMC_Credit_PD_Controller/loadSMCPDTemplate';
|
||||
$route['loadDataFromExcel'] = 'SMC_Credit_PD_Controller/loadDataFromExcel';
|
||||
$route['getSMCPDImgSectionData'] = 'SMC_Credit_PD_Controller/getSMCPDImgSectionData';
|
||||
$route['smcCreditPDReport'] = 'SMC_Credit_PD_Controller/smcCreditPDReport';
|
||||
$route['getCMUsers'] = 'SMC_Credit_PD_Controller/getCMUsers';
|
||||
|
||||
|
||||
@ -1333,13 +1333,23 @@ class Common_Masters_Controller extends REST_Controller {
|
||||
// print_r($s3result);
|
||||
if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200)
|
||||
{
|
||||
$fields_to_insert = array('file_name' => $_FILES['pd_excel_data']['name'],'modified_fname' => $modified_fname);
|
||||
if(isset($records['fk_pd_id']) && $records['fk_pd_id'] != '')
|
||||
{
|
||||
//update fk_pd_id in excel file list table
|
||||
$fields_to_insert['fk_pd_id'] = $records['fk_pd_id'],
|
||||
}
|
||||
$is_bucket_upload_sucess = 1;
|
||||
$id = $this->Common_Masters_Model->saveRecords(array('rand_key' =>$records['rand_key'],'file_name' => $_FILES['pd_excel_data']['name'],'modified_fname' => $modified_fname),SMC_EXCEL_FILELIST);
|
||||
$id = $this->Common_Masters_Model->saveRecords($fields_to_insert,SMC_EXCEL_FILELIST);
|
||||
|
||||
|
||||
if( !isset($records['fk_pd_id']))
|
||||
{
|
||||
//read excel file get trigger data
|
||||
$result_data = readexceldata::getExcelSectionData($sourcefile);
|
||||
// unlink($sourcefile);
|
||||
}
|
||||
|
||||
unlink($sourcefile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -584,6 +584,33 @@ class PD_Controller extends REST_Controller {
|
||||
|
||||
//End of Generate Random string
|
||||
|
||||
|
||||
|
||||
//if is this MWISE (SMC Credit PD) lender then auto allocate to RCM users and make pd status as allocated
|
||||
|
||||
//get RCM user for auto allocation based on pd address
|
||||
|
||||
// $pd_details['fk_lender_id'] = 35;
|
||||
// $addresses[0]['fk_city'] = 3374;
|
||||
$mwise_lender_id = (ENVIRONMENT == 'production' ? 7 : 35);
|
||||
|
||||
$is_mwise_lender = ( $pd_details['fk_lender_id'] == $mwise_lender_id ? true : false);
|
||||
// echo !$is_mwise_lender;
|
||||
if($is_mwise_lender)
|
||||
{
|
||||
$regional_credit_manager = $this->PD_Model->getRCM($addresses[0]['fk_city']);//pass pd address city as param
|
||||
if(count($regional_credit_manager))
|
||||
{
|
||||
$pd_details['fk_pd_allocated_to'] = $regional_credit_manager[0]['userid'];
|
||||
$pd_details['status'] = ALLOCATED;
|
||||
}
|
||||
else
|
||||
{
|
||||
log_message('ERROR',('### Couldnot find RCM users - '.$addresses[0]['fk_city']));
|
||||
}
|
||||
}
|
||||
// echo 'final';
|
||||
// die();
|
||||
$pd_details['parent_pd_id'] = isset($pd_details['parent_pd_id']) ? $pd_details['parent_pd_id'] : NULL;
|
||||
$pd_id = $this->PD_Model->saveRecords($pd_details,PDTRIGGER);
|
||||
|
||||
|
||||
@ -1585,6 +1585,38 @@ public function filterSalesPDList_post() {
|
||||
return ($score_card_questions);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//get List of credit managers list for allocation
|
||||
public function getCMUsers_get()
|
||||
{
|
||||
$city = $this->get('city_id');
|
||||
$fields = array('USERPROFILE.userid','USERPROFILE.first_name','USERPROFILE.last_name','USERPROFILEROLES.user_role');
|
||||
$table = USERPROFILE.' as USERPROFILE';
|
||||
$where_condition_array = array('USERPROFILE.fk_city' => $city);
|
||||
$joins = array(
|
||||
array('table'=>USERPROFILEROLES.' as USERPROFILEROLES','condition'=>'USERPROFILE.userid = USERPROFILEROLES.fk_userid and USERPROFILEROLES.user_role = 26 and USERPROFILEROLES.isactive = 1' ,'jointype'=>'INNER JOIN')
|
||||
);
|
||||
|
||||
|
||||
$users = $this->SMC_Credit_PD_Model->getJoinRecords($fields,$table,$joins,$where_condition_array);
|
||||
if(count($users))
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $users;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NOT_FOUND;
|
||||
$data['msg'] = 'Data Not Found!';
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
print_r($this->db->last_query());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -104,7 +104,7 @@ class PD_Model extends SPARQ_Model {
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->WHERE('PDTRIGGER.fk_lender_id != ',35);
|
||||
$this->db->WHERE('PDTRIGGER.fk_lender_id != ', (ENVIRONMENT == 'production' ? 7: 35) );
|
||||
}
|
||||
|
||||
if($pdagencyid != "" || $pdagencyid != null)
|
||||
@ -1001,7 +1001,7 @@ class PD_Model extends SPARQ_Model {
|
||||
*/
|
||||
public function getPDMasterDetails($pdid,$random_string = null)
|
||||
{
|
||||
$this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.pd_sno,PDTRIGGER.fk_lender_id,PDTRIGGER.sub_entity_id,SUBENTITY.short_name as sub_entity_short_name,PDTRIGGER.imgc_fin_institute,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name,ENTITY.is_score_card_enabled,ENTITY.is_otp_enabled, PDTRIGGER.fk_entity_billing_id,ENTITYBILLING.billing_name,PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation,PDTRIGGER.pd_date_of_initiation as pd_date_of_initiation_sqlformat, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PRODUCTS.prod_catagory,PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %h:%i:%s %p") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i %p") as updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby,DESIGNATION.designation as updatedby_designation,PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.executive_id,concat(EXECUTIVE.first_name," ",EXECUTIVE.last_name) as executive_name,PDTRIGGER.central_pd_officer_id,concat(CENTRALOFFICER.first_name," ",CENTRALOFFICER.last_name) as centralofficer,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.is_qc_enabled,AGENCY.full_name as agency_name,AGENCY.short_name as agency_short_name,PDTRIGGER.vendor_pdofficer,concat(VENDORPDOFFICER.first_name," ",VENDORPDOFFICER.last_name) as vendor_pdofficer_name,PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PINCODE.pincode,PDTRIGGER.pincode as pincode_id,PDTRIGGER.lender_sales_person,concat(LENDERSALESPERSON.first_name," ",LENDERSALESPERSON.last_name) as lender_sales_person_name,LENDERSALESPERSON.mobile_no as lender_sales_contact_mobileno,LENDERSALESPERSON.email as lender_sales_person_email,PDTRIGGER.lender_credit_person,concat(LENDERCREDITPERSON.first_name," ",LENDERCREDITPERSON.last_name) as lender_credit_person_name,LENDERCREDITPERSON.mobile_no as lender_credit_person_contact_mobileno,LENDERCREDITPERSON.email as lender_credit_person_email,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,PDTRIGGER.scheduled_on as scheduled_on_for_validation,DATE_FORMAT(PDTRIGGER.scheduled_on,"%dth %b %Y ") as scheduled_date_for_log,DATE_FORMAT(PDTRIGGER.scheduled_on,"%h:%i %p") as scheduled_time_for_log,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.bounce_reason,PDTRIGGER.bounce_reason_others,BOUNCEMASTER.bounce_reason_name,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDAPPLICANTSDETAILS.applicant_name as main_applicant,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDAPPLICANTSDETAILS.applicant_title_name,TITLES.name as title_name,PDTRIGGER.pd_contact_landline,PDTRIGGER.other_pincode,PDTRIGGER.is_otp_done,OTPREJECTION.rejection_reason,PDTRIGGER.otp_reject_other_reason,PDTRIGGER.encrypted_url,PDTRIGGER.is_child,PDTRIGGER.parent_pd_id,PDTRIGGER.fk_primary_address_id,PDTRIGGER.fk_address_id,PDTRIGGER.start_location,PDTRIGGER.satellite_image_base64_blob,DATE_FORMAT(PDTRIGGER.pd_report_generated_date,"%d/%m/%Y %h:%i:%s %p") as pd_report_generated_date,DATE_FORMAT(PDTRIGGER.pd_visit_date,"%d/%m/%Y %h:%i:%s %p") as pd_visit_date,PDTRIGGER.random_string,PDTRIGGER.pd_report_html_filename,PDTRIGGER.is_qc_edited,PDTRIGGER.is_zip_created,PDTRIGGER.pd_qc_note,ENTITY.is_sms_enabled,ENTITY.is_mail_enabled,ENTITY.is_app_notify_enabled,AGENCY.is_vendor_visit_disabled,PDTRIGGER.is_notify_enabled,ENTITYFININSTITUTION.institute_name as fin_institute_name,PDTRIGGER.is_img_pdf_created,PDTRIGGER.is_video_merged,PDTRIGGER.vendor_status,PDTRIGGER.vendor_scheduled_on as vendor_scheduled_on_validation,DATE_FORMAT(PDTRIGGER.vendor_scheduled_on,"%d/%m/%Y %h:%i %p") as vendor_scheduled_on,PDTRIGGER.complete_override_data,PDTRIGGER.excel_file_id,SMC_EXCEL_FILELIST.file_name,SMC_EXCEL_FILELIST.modified_fname,PDTRIGGER.mwise_sales_person,PDTRIGGER.is_field_visit_done,PDTRIGGER.cancel_pd_remark');
|
||||
$this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.pd_sno,PDTRIGGER.fk_lender_id,PDTRIGGER.sub_entity_id,SUBENTITY.short_name as sub_entity_short_name,PDTRIGGER.imgc_fin_institute,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name,ENTITY.is_score_card_enabled,ENTITY.is_otp_enabled, PDTRIGGER.fk_entity_billing_id,ENTITYBILLING.billing_name,PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation,PDTRIGGER.pd_date_of_initiation as pd_date_of_initiation_sqlformat, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PRODUCTS.prod_catagory,PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %h:%i:%s %p") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i %p") as updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby,DESIGNATION.designation as updatedby_designation,PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.executive_id,concat(EXECUTIVE.first_name," ",EXECUTIVE.last_name) as executive_name,PDTRIGGER.central_pd_officer_id,concat(CENTRALOFFICER.first_name," ",CENTRALOFFICER.last_name) as centralofficer,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.is_qc_enabled,AGENCY.full_name as agency_name,AGENCY.short_name as agency_short_name,PDTRIGGER.vendor_pdofficer,concat(VENDORPDOFFICER.first_name," ",VENDORPDOFFICER.last_name) as vendor_pdofficer_name,PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PINCODE.pincode,PDTRIGGER.pincode as pincode_id,PDTRIGGER.lender_sales_person,concat(LENDERSALESPERSON.first_name," ",LENDERSALESPERSON.last_name) as lender_sales_person_name,LENDERSALESPERSON.mobile_no as lender_sales_contact_mobileno,LENDERSALESPERSON.email as lender_sales_person_email,PDTRIGGER.lender_credit_person,concat(LENDERCREDITPERSON.first_name," ",LENDERCREDITPERSON.last_name) as lender_credit_person_name,LENDERCREDITPERSON.mobile_no as lender_credit_person_contact_mobileno,LENDERCREDITPERSON.email as lender_credit_person_email,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,PDTRIGGER.scheduled_on as scheduled_on_for_validation,DATE_FORMAT(PDTRIGGER.scheduled_on,"%dth %b %Y ") as scheduled_date_for_log,DATE_FORMAT(PDTRIGGER.scheduled_on,"%h:%i %p") as scheduled_time_for_log,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.bounce_reason,PDTRIGGER.bounce_reason_others,BOUNCEMASTER.bounce_reason_name,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDAPPLICANTSDETAILS.applicant_name as main_applicant,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDAPPLICANTSDETAILS.applicant_title_name,TITLES.name as title_name,PDTRIGGER.pd_contact_landline,PDTRIGGER.other_pincode,PDTRIGGER.is_otp_done,OTPREJECTION.rejection_reason,PDTRIGGER.otp_reject_other_reason,PDTRIGGER.encrypted_url,PDTRIGGER.is_child,PDTRIGGER.parent_pd_id,PDTRIGGER.fk_primary_address_id,PDTRIGGER.fk_address_id,PDTRIGGER.start_location,PDTRIGGER.satellite_image_base64_blob,DATE_FORMAT(PDTRIGGER.pd_report_generated_date,"%d/%m/%Y %h:%i:%s %p") as pd_report_generated_date,DATE_FORMAT(PDTRIGGER.pd_visit_date,"%d/%m/%Y %h:%i:%s %p") as pd_visit_date,PDTRIGGER.random_string,PDTRIGGER.pd_report_html_filename,PDTRIGGER.is_qc_edited,PDTRIGGER.is_zip_created,PDTRIGGER.pd_qc_note,ENTITY.is_sms_enabled,ENTITY.is_mail_enabled,ENTITY.is_app_notify_enabled,AGENCY.is_vendor_visit_disabled,PDTRIGGER.is_notify_enabled,ENTITYFININSTITUTION.institute_name as fin_institute_name,PDTRIGGER.is_img_pdf_created,PDTRIGGER.is_video_merged,PDTRIGGER.vendor_status,PDTRIGGER.vendor_scheduled_on as vendor_scheduled_on_validation,DATE_FORMAT(PDTRIGGER.vendor_scheduled_on,"%d/%m/%Y %h:%i %p") as vendor_scheduled_on,PDTRIGGER.complete_override_data,PDTRIGGER.excel_file_id,SMC_EXCEL_FILELIST.file_name,SMC_EXCEL_FILELIST.modified_fname,PDTRIGGER.mwise_sales_person,PDTRIGGER.is_field_visit_done,PDTRIGGER.cancel_pd_remark,if(SMC_EXCEL_FILELIST_RE_UPLOAD.fk_pd_id != null,"1","0") as re_uploaded');
|
||||
$this->db->FROM(PDTRIGGER.' as PDTRIGGER');
|
||||
$this->db->JOIN(ENTITY.' as ENTITY','PDTRIGGER.fk_lender_id = ENTITY.entity_id ','LEFT');
|
||||
$this->db->JOIN(ENTITY.' as SUBENTITY','PDTRIGGER.sub_entity_id = SUBENTITY.entity_id ','LEFT');
|
||||
@ -1033,6 +1033,7 @@ class PD_Model extends SPARQ_Model {
|
||||
$this->db->JOIN(TITLES.' as TITLES','PDAPPLICANTSDETAILS.applicant_title_name = TITLES.title_id','LEFT');
|
||||
$this->db->JOIN(OTPREJECTION.' as OTPREJECTION','PDTRIGGER.otp_reject_reason = OTPREJECTION.otp_rejection_id','LEFT');
|
||||
$this->db->JOIN(SMC_EXCEL_FILELIST.' as SMC_EXCEL_FILELIST','SMC_EXCEL_FILELIST.id = PDTRIGGER.excel_file_id','LEFT');
|
||||
$this->db->JOIN(SMC_EXCEL_FILELIST.' as SMC_EXCEL_FILELIST_RE_UPLOAD','PDTRIGGER.pd_id = SMC_EXCEL_FILELIST_RE_UPLOAD.fk_pd_id','LEFT');
|
||||
$this->db->JOIN(DESIGNATION.' as DESIGNATION','USERPROFILE1.designation = DESIGNATION.designation_id','LEFT');
|
||||
$this->db->WHERE('PDTRIGGER.pd_id',$pdid);
|
||||
if($random_string != null)
|
||||
@ -2186,5 +2187,19 @@ class PD_Model extends SPARQ_Model {
|
||||
return $data = $this->db->select('fk_form_id, company_id, json, processed_json,rental_count_id')->from(PDFORMDETAILSJSON)->where('fk_pd_id',$pdid)->where('isactive',1)->get()->result_array();
|
||||
}
|
||||
|
||||
function getRCM($city)
|
||||
{
|
||||
$fields = array('USERPROFILE.userid','USERPROFILE.first_name','USERPROFILE.last_name','USERPROFILEROLES.user_role');
|
||||
$table = USERPROFILE.' as USERPROFILE';
|
||||
$where_condition_array = array('USERPROFILE.fk_city' => $city);
|
||||
$joins = array(
|
||||
array('table'=>USERPROFILEROLES.' as USERPROFILEROLES','condition'=>'USERPROFILE.userid = USERPROFILEROLES.fk_userid and USERPROFILEROLES.user_role = 27 and USERPROFILEROLES.isactive = 1' ,'jointype'=>'INNER JOIN')
|
||||
);
|
||||
|
||||
return
|
||||
$this->getJoinRecords($fields,$table,$joins,$where_condition_array);
|
||||
print_r($this->db->last_query());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user