diff --git a/api/application/config/api_user_auth_config.php b/api/application/config/api_user_auth_config.php index 56188f73..36d0ab7c 100644 --- a/api/application/config/api_user_auth_config.php +++ b/api/application/config/api_user_auth_config.php @@ -36,7 +36,7 @@ $config['api_user_auth_info'] = array( //'updatePDMaster' => array(1,2,3,10,11,12,13,1,15,16,17,18,19,20), 'updatePDDocs' => array(1,2,3,10,11,12,13,1,15,16,17,18,19,20), 'updatePDApplicants' => array(1,2,3,10,11,12,13,1,15,16,17,18,19,20), -'allocatePD' => array(2,3,4,5,10,21,22,25,26,20), +'allocatePD' => array(2,3,4,5,10,21,22,25,26,20,27), 'schdulePD' => array(2,3,4,5,21,10,22,21), 'generatePDReport' => array(3,6,7,10), 'savePDPhotos' => array(3,4,5,6,7,10,21,22), diff --git a/api/application/controllers/Common_Masters_Controller.php b/api/application/controllers/Common_Masters_Controller.php index b6842911..39eef175 100644 --- a/api/application/controllers/Common_Masters_Controller.php +++ b/api/application/controllers/Common_Masters_Controller.php @@ -1337,13 +1337,13 @@ class Common_Masters_Controller extends REST_Controller { 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'], + $fields_to_insert['fk_pd_id'] = $records['fk_pd_id']; } $is_bucket_upload_sucess = 1; $id = $this->Common_Masters_Model->saveRecords($fields_to_insert,SMC_EXCEL_FILELIST); - if( !isset($records['fk_pd_id'])) + if(!isset($records['fk_pd_id'])) { //read excel file get trigger data $result_data = readexceldata::getExcelSectionData($sourcefile); @@ -1360,7 +1360,7 @@ class Common_Masters_Controller extends REST_Controller { $data['status'] = REST_Controller::HTTP_OK; $data['msg'] = 'File Uploaded Successfully'; $data['excel_file_id'] = $id; - $data['records'] = $result_data; + $data['records'] = isset($result_data) ? $result_data : array(); $this->response($data,REST_Controller::HTTP_OK); } else diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 730d9c37..c1a2606e 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -2060,18 +2060,41 @@ public function assignPDTempalate($data) if($this->get('pdofficerid')) { $pdofficerid = $this->get('pdofficerid'); } if($this->get('pdagencyid')) { $pdagencyid = $this->get('pdagencyid'); } if($this->get('vendor_pdofficer')) { $vendor_pdofficer = $this->get('vendor_pdofficer'); } - if($this->get('createdby')) { $createdby = $this->get('createdby'); } - if($this->get('lenderid')) - { - $lenderid = $this->get('lenderid'); - // $lender_details = $this->getLenderHierarchyForPDListing($lenderid); - $lender_details = array(); - } if($this->get('datetype')) { $datetype = $this->get('datetype'); } if($this->get('fdate')) { $fdate = $this->get('fdate'); } if($this->get('tdate')) { $tdate = $this->get('tdate'); } if($this->get('status')) { $status = $this->get('status'); } if($this->get('user_type')) { $user_type = $this->get('user_type'); } + + + //if lender id exists, then make custom filter for only SMC usage + if($this->get('createdby')) { $createdby = $this->get('createdby'); } + if($this->get('lenderid')) + { + $lenderid = $this->get('lenderid'); + $smc_lender_id = ENVIRONMENT == 'production' ? 7 : 35; //pk id of SMC in live and demo + if($lenderid = $smc_lender_id) + { + $this->load->model('User_Management_Model'); + $user_details = $this->User_Management_Model->getUserDetails($createdby); + if($user_details['data'][0]['user_role'] == 26)//Credit Manager + { + $pdofficerid = $createdby; + $createdby = ''; + } + else if($user_details['data'][0]['user_role'] == 27)//Reg Credit Manager + { + $lender_details = array('city' => $user_details['data'][0]['fk_city']); + $createdby = ''; + } + + + } + + // $lender_details = $this->getLenderHierarchyForPDListing($lenderid); + + } + // die(); $result_data = $this->PD_Model->listLessPDDetails($page,$limit,$sort,$pdofficerid,$datetype,$fdate,$tdate,$lenderid,$status,$lender_details,$pdagencyid,$vendor_pdofficer,$user_type,$createdby); if($result_data['data_status'] == true) diff --git a/api/application/controllers/SMC_Credit_PD_Controller.php b/api/application/controllers/SMC_Credit_PD_Controller.php index 71c3baaf..48f3ec2a 100644 --- a/api/application/controllers/SMC_Credit_PD_Controller.php +++ b/api/application/controllers/SMC_Credit_PD_Controller.php @@ -1308,17 +1308,18 @@ public function filterSalesPDList_post() { $records = $this->post('records'); $pd_master_data = $this->PD_Model->getPDMasterDetails($records['pd_id'],$records['random_string']); $cur_section_data = array(); - // print_r($pd_master_data);die(); + // print_r( $pd_master_data);die(); // echo $records['form_id'];die(); //check excel file in local, otherwise get it from s3 and store locallly - $filename = XLPATH.'/tmp/'.$pd_master_data[0]['modified_fname']; + $filename = (!$pd_master_data[0]['re_uploaded'] ? XLPATH.'/tmp/'.$pd_master_data[0]['re_uploaded_file_name'] : XLPATH.'/tmp/'.$pd_master_data[0]['modified_fname']); + // $filename = XLPATH.'/tmp/mySMCPD_client_working.xlsx'; // $filename = 'C:\Users\Venba\Downloads\Kathir Info Pvt.xlsx'; - // echo $filename;//die(); + //echo $filename;die(); if(!file_exists($filename)) { - //echo 'getting it from s3'; + // echo 'getting it from s3'; $bucket_name = LENDER_BUCKET_NAME_PREFIX.$pd_master_data[0]['fk_lender_id']; $key = 'tmp/'. $pd_master_data[0]['modified_fname']; $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'+5 minutes'); diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index 42ffe51a..644439eb 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -85,10 +85,10 @@ class PD_Model extends SPARQ_Model { // $this->db->WHERE('PDTRIGGER.fk_state',$lender_details['state']); // } - // if(isset($lender_details['city'])) - // { - // $this->db->WHERE('PDTRIGGER.fk_city',$lender_details['city']); - // } + if(isset($lender_details['city'])) + { + $this->db->WHERE('PDTRIGGER.fk_city',$lender_details['city']); + } // if(isset($lender_details['branch'])) // { @@ -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,if(SMC_EXCEL_FILELIST_RE_UPLOAD.fk_pd_id != null,"1","0") as re_uploaded'); + $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 is not null,"1","0") as re_uploaded,SMC_EXCEL_FILELIST_RE_UPLOAD.file_name as re_uploaded_fine_name'); $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'); diff --git a/api/application/models/SMC_Credit_PD_Model.php b/api/application/models/SMC_Credit_PD_Model.php index c5ba588a..a0c52026 100644 --- a/api/application/models/SMC_Credit_PD_Model.php +++ b/api/application/models/SMC_Credit_PD_Model.php @@ -60,7 +60,7 @@ class SMC_Credit_PD_Model extends SPARQ_Model { // print_r($master_forms); $table = CREDITPDTEMPLATE.' as CREDITPDTEMPLATE'; // $table = SMC_CREDIT_PD_FORMS.' as SMC_CREDIT_PD_FORMS'; - $fields = array('SMC_CREDIT_PD_FORMS.form_name','CREDITPDTEMPLATE.pd_form_id as fk_form_id','CREDITPDTEMPLATE.fk_product_id','SMC_CREDIT_PD_SECTION_DATA.fk_pd_id','if(SMC_CREDIT_PD_SECTION_DATA.json is not null,true,false) as is_answered'); + $fields = array('SMC_CREDIT_PD_FORMS.form_name','CREDITPDTEMPLATE.pd_form_id as fk_form_id','CREDITPDTEMPLATE.fk_product_id','SMC_CREDIT_PD_SECTION_DATA.fk_pd_id','if(SMC_CREDIT_PD_SECTION_DATA.json is not null,true,false) as is_answered','SMC_CREDIT_PD_SECTION_DATA.is_reupload_data_fetched'); $joins = array( array('table'=>SMC_CREDIT_PD_SECTION_DATA." as SMC_CREDIT_PD_SECTION_DATA",'condition'=>"SMC_CREDIT_PD_SECTION_DATA.fk_form_id = CREDITPDTEMPLATE.pd_form_id AND CREDITPDTEMPLATE.fk_product_id = $product_id AND SMC_CREDIT_PD_SECTION_DATA.fk_pd_id = $pd_id and SMC_CREDIT_PD_SECTION_DATA.isactive = 1 " ,'jointype'=>'LEFT'), array('table'=>SMC_CREDIT_PD_FORMS." as SMC_CREDIT_PD_FORMS",'condition'=>"CREDITPDTEMPLATE.pd_form_id = SMC_CREDIT_PD_FORMS.form_id" ,'jointype'=>'INNER JOIN')