diff --git a/api/application/composer.json b/api/application/composer.json index 124d12c7..5590ac69 100644 --- a/api/application/composer.json +++ b/api/application/composer.json @@ -23,7 +23,8 @@ "phpmailer/phpmailer": "^6.0", "php-curl-class/php-curl-class": "^8.5", "guzzlehttp/guzzle": "^6.3", - "twilio/sdk": "^6.10" + "twilio/sdk": "^6.10", + "phpoffice/phpspreadsheet": "^1.15" }, "suggest": { diff --git a/api/application/config/constants.php b/api/application/config/constants.php index 5bf8920f..3b01aa13 100644 --- a/api/application/config/constants.php +++ b/api/application/config/constants.php @@ -653,6 +653,7 @@ defined('SMC_CREDIT_PD') OR define('SMC_CREDIT_PD','t_smc_credit_pd'); defined('SMC_CREDIT_PD_DOCS') OR define('SMC_CREDIT_PD_DOCS','t_smc_credit_pd_docs'); defined('SMC_CREDIT_PD_SECTION_DATA') OR define('SMC_CREDIT_PD_SECTION_DATA','t_smc_credit_pd_section_data'); defined('VIDEO_ROOM_INFO') OR define('VIDEO_ROOM_INFO','t_video_room_info'); +defined('SMC_EXCEL_FILELIST') OR define('SMC_EXCEL_FILELIST','t_smc_excel_filelist'); diff --git a/api/application/config/routes.php b/api/application/config/routes.php index 8cb8388f..13afb5c0 100644 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -87,6 +87,7 @@ $route['(checkAppVersion/:any)'] = 'Common_Masters_Controller/checkAppVersion'; $route['getCommonConfig'] = 'Common_Masters_Controller/getCommonConfig'; $route['getServerInfo'] = 'Common_Masters_Controller/getServerInfo'; $route['getVideoChatAccessKey'] = 'Common_Masters_Controller/getVideoChatAccessKey'; +$route['uploadSMCDataFile'] = 'Common_Masters_Controller/uploadSMCDataFile'; diff --git a/api/application/controllers/Common_Masters_Controller.php b/api/application/controllers/Common_Masters_Controller.php index 5e096ef2..3dd530a4 100644 --- a/api/application/controllers/Common_Masters_Controller.php +++ b/api/application/controllers/Common_Masters_Controller.php @@ -965,7 +965,7 @@ class Common_Masters_Controller extends REST_Controller { $bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$sourcefile); $s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data); - print_r($s3result); + // print_r($s3result); if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200) { $records['logo'] = $logoname; @@ -1290,4 +1290,71 @@ class Common_Masters_Controller extends REST_Controller { // } } + + + public function uploadSMCDataFile_post() + { + $records = json_decode($this->post('records'),true); + //print_r($records); + $is_bucket_upload_sucess = false; + $id = null; + //die(); + if(!empty($_FILES['pd_excel_data'])) + { + $folder_to_check = XLPATH.'/tmp'; + $modified_fname = $records['rand_key'].'~'.str_replace(' ','_',($_FILES['pd_excel_data']['name'])); + // var_dump($_FILES['pd_excel_data']);die(); + $config = array('upload_path' => $folder_to_check,'overwrite' => TRUE,'allowed_types' => '*','file_name' => $modified_fname); + $this->load->library('upload', $config); + if($this->upload->do_upload('pd_excel_data')) + { + // print_r($_FILES['pd_excel_data']);//SMC_EXCEL_FILELIST + // die(); + $lender_id = ENVIRONMENT == 'production' ? 7 : 35; + + $sourcefile = $folder_to_check.'/'.$modified_fname; + // echo $sourcefile; + $key = 'tmp/'.$sourcefile; + $bucket_name = LENDER_BUCKET_NAME_PREFIX.$lender_id; + + //echo $modified_fname;die(); + + $bucket_data = array('bucket_name'=>$bucket_name,'key'=>$key,'sourcefile'=>$sourcefile); + $s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data); + // print_r($s3result); + if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200) + { + $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); + unlink($sourcefile); + } + } + + + if($is_bucket_upload_sucess && $id) + { + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['msg'] = 'File Uploaded Successfully'; + $data['records'] = $id; + $this->response($data,REST_Controller::HTTP_OK); + } + else + { + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NOT_FOUND; + $data['msg'] = 'Something Wrong. Try Later!'; + $this->response($data,REST_Controller::HTTP_OK); + } + } + else + { + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NOT_FOUND; + $data['msg'] = 'No Data File Found!'; + $this->response($data,REST_Controller::HTTP_OK); + } + } + + } \ No newline at end of file diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 69a6ba0a..5ad714c5 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -6065,6 +6065,16 @@ public function getPDFormDetailsJSON_post() public function codeigniterViewTest_post() { +// $this->load->library('myspreadsheet'); +// //print_r($myspreadsheet);die(); +// $spreadsheet = $this->myspreadsheet->getMySpreadSheet(); +// // print_r($sheet);die(); +// $sheet = $spreadsheet->getActiveSheet(); +// $sheet->setCellValue('A1', 'Hello World !'); + +// $writer = $this->myspreadsheet->getXlsx($spreadsheet); +// $writer->save('hello world.xlsx'); +// die(); // echo 'HI'; // die(); // $records = $this->post('records'); diff --git a/api/application/helpers/external_dir_check_helper.php b/api/application/helpers/external_dir_check_helper.php index 1f12e39c..fdc2ab57 100644 --- a/api/application/helpers/external_dir_check_helper.php +++ b/api/application/helpers/external_dir_check_helper.php @@ -28,7 +28,7 @@ class EXTERNAL_DIR_CHECK // mkdir($path,0761); // } - $array = array($path.'/ci_logs',$path.'/api_request_logs',$path.'/app_logs',$path.'/pd_reports',$path.'/sales_pd',$path.'/sales_pd_logs'); + $array = array($path.'/ci_logs',$path.'/api_request_logs',$path.'/app_logs',$path.'/pd_reports',$path.'/sales_pd',$path.'/sales_pd_logs',$path.'/tmp'); foreach ($array as $key => $value) { if(!file_exists($value)) diff --git a/api/application/libraries/REST_Controller.php b/api/application/libraries/REST_Controller.php index f919513d..9b47575b 100644 --- a/api/application/libraries/REST_Controller.php +++ b/api/application/libraries/REST_Controller.php @@ -371,25 +371,25 @@ abstract class REST_Controller extends CI_Controller { EXTERNAL_DIR_CHECK::checkExternalDirectory(); // die(); - $this->load->library('user_agent'); - if ($this->agent->is_browser()) - { - $agent = $this->agent->browser().' '.$this->agent->version(); - } - elseif ($this->agent->is_robot()) - { - $agent = $this->agent->robot(); - } - elseif ($this->agent->is_mobile()) - { - $agent = $this->agent->mobile(); - } - else - { - $agent = 'Unidentified User Agent'; - } - $logger = MYLOG::logFunction('request_logger'); - $logger->info('REQUEST_INFO',array('ip' => $this->input->ip_address(),'platform' => $this->agent->platform(),'browser' => $agent)); + // $this->load->library('user_agent'); + // if ($this->agent->is_browser()) + // { + // $agent = $this->agent->browser().' '.$this->agent->version(); + // } + // elseif ($this->agent->is_robot()) + // { + // $agent = $this->agent->robot(); + // } + // elseif ($this->agent->is_mobile()) + // { + // $agent = $this->agent->mobile(); + // } + // else + // { + // $agent = 'Unidentified User Agent'; + // } + // $logger = MYLOG::logFunction('request_logger'); + // $logger->info('REQUEST_INFO',array('ip' => $this->input->ip_address(),'platform' => $this->agent->platform(),'browser' => $agent)); } /** diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index 0081d4a0..d1338431 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -980,7 +980,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, 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,ENTITY.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'); + $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, 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'); $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/views/report_templates/JSONTOREPORT_DI_AI_SMARTPD.php b/api/application/views/report_templates/JSONTOREPORT_DI_AI_SMARTPD.php index 62665908..9a7f5368 100644 --- a/api/application/views/report_templates/JSONTOREPORT_DI_AI_SMARTPD.php +++ b/api/application/views/report_templates/JSONTOREPORT_DI_AI_SMARTPD.php @@ -1496,7 +1496,7 @@ if($total_no_of_business > 0) { $bindEachResult['company_employees']= 'As per loan applicant met, there are no permanent or temporary employees with the company.'; } - if(isset($businessRow['employees_appx_salary']) && $businessRow['employees_appx_salary'] != "") + if(isset($businessRow['employees_appx_salary']) && is_numeric($businessRow['employees_appx_salary'])) { $bindEachResult['employees_appx_salary'] = 'Approximately '.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($businessRow['employees_appx_salary']). ' is being paid as salary to employees'; }