SMART PD FINAL FEEDBACKS 1
This commit is contained in:
parent
c69f3d9068
commit
e6e3bdd25f
@ -147,6 +147,8 @@ else if(ENVIRONMENT == 'production')
|
||||
|
||||
defined('TWLIO_SID') OR define('TWLIO_SID','AC01bf87391506e1df7e05cbe3d015bf81');
|
||||
defined('TWLIO_AUTH_TOKEN') OR define('TWLIO_AUTH_TOKEN','470de1016b533c390703c40c7fea474b');
|
||||
defined('TWILIO_API_KEY') OR define('TWILIO_API_KEY','SKfe779102ec62104c91e04b430152c612');
|
||||
defined('TWILIO_API_KEY_SECRET') OR define('TWILIO_API_KEY_SECRET','D3GxJVFSuapFazTxU3P966ArukRQPVjY');
|
||||
/*************************END OF TWILO CONSTANTS************************************************************/
|
||||
|
||||
|
||||
|
||||
@ -260,6 +260,7 @@ $route['getVendorAnswers'] = 'PD_Controller/getVendorAnswers';
|
||||
$route['auditSmartPDImages'] = 'PD_Controller/auditSmartPDImages';
|
||||
$route['getAuditedImages'] = 'PD_Controller/getAuditedImages';
|
||||
$route['updateVendorFormStatus'] = 'PD_Controller/updateVendorFormStatus';
|
||||
$route['getBusinessDocsToVendorForm'] = 'PD_Controller/getBusinessDocsToVendorForm';
|
||||
//$route['getTypeOfActivetyFromBusinessJSON'] = 'PD_Controller/getTypeOfActivetyFromBusinessJSON';
|
||||
|
||||
//Dashboard and Reports Related routes
|
||||
|
||||
@ -1232,21 +1232,27 @@ class Common_Masters_Controller extends REST_Controller {
|
||||
|
||||
public function getVideoChatAccessKey_post()
|
||||
{
|
||||
|
||||
$pd_id = $this->post('pd_id');
|
||||
$random_key = $this->post('random_key');
|
||||
$user_type = $this->post('user_type');
|
||||
|
||||
//echo $pd_id,$random_key,$user_type;
|
||||
$this->load->library('Twlio');
|
||||
$apiKeySecret = $this->twlio->getAPIKey();
|
||||
//echo $d;
|
||||
//$this->load->library('Twlio');
|
||||
// $this->twlio->listOfRoomsByRoomName($roomName = 'Vp9F4o3thl2ZA9361233');
|
||||
// $this->twlio->getRoomDataByRoomID($roomID = 'RM23b8d502434e46e696d1fbd5d64c59c8');
|
||||
//$this->twlio->startComposistion($roomID = 'RM23b8d502434e46e696d1fbd5d64c59c8');
|
||||
|
||||
//die();
|
||||
// $apiKeySecret = $this->twlio->getAPIKey();
|
||||
// echo $apiKeySecret;die();
|
||||
//if get API key sucessfully from twlio
|
||||
if($apiKeySecret)
|
||||
{
|
||||
// if($apiKeySecret && is_array($apiKeySecret))
|
||||
// {
|
||||
|
||||
$roomName = $random_key.$pd_id;
|
||||
$officerName = $user_type == 'PDOFFICER' ? 'PDOFFICER' : 'CUTOMER';
|
||||
$videoAccessToken = $this->twlio->getVideoAccessJWTToken($apiKeySecret,$roomName,$officerName);
|
||||
$officerName = $user_type == 'PDOFFICER' ? 'PDOFFICER' : 'CUSTOMER';
|
||||
$videoAccessToken = $this->twlio->getVideoAccessJWTToken(TWILIO_API_KEY,TWILIO_API_KEY_SECRET,$roomName,$officerName);
|
||||
|
||||
if($videoAccessToken)
|
||||
{
|
||||
@ -1262,14 +1268,14 @@ class Common_Masters_Controller extends REST_Controller {
|
||||
$data['msg'] = 'Couldn`t get access Token from Twlio ';
|
||||
$this->response($data,REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_INTERNAL_SERVER_ERROR;
|
||||
$data['msg'] = ' Couldn`t get API secret Key from Twlio ';
|
||||
$this->response($data,REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $data['dataStatus'] = false;
|
||||
// $data['status'] = REST_Controller::HTTP_INTERNAL_SERVER_ERROR;
|
||||
// $data['msg'] = ' Couldn`t get API secret Key from Twlio ';
|
||||
// $this->response($data,REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
@ -952,14 +952,18 @@ class PD_Controller extends REST_Controller {
|
||||
$pd_details['complete_location'] = isset($pd_details['link']) ? $pd_details['link'] : null;
|
||||
unset($pd_details['link']);
|
||||
}
|
||||
if(!isset($pd_details['is_revert_status']))
|
||||
|
||||
if($exist_pd_details[0]['fk_pd_type'] != 2 && (!isset($pd_details['is_revert_status']) || $exist_pd_details[0]['pd_status'] != COMPLETED))
|
||||
{
|
||||
$pd_details['pd_visit_date'] = date('Y-m-d H:i:s');
|
||||
}
|
||||
unset($pd_details['is_revert_status']);
|
||||
//get satellite image blob and store it in DB
|
||||
//$pd_details['satellite_image_base64_blob'] = $this->getSatelliteImage($pd_details['pd_id']);
|
||||
$pd_details['satellite_image_base64_blob'] = satellite_image::getSatelliteImage($pd_details['pd_id']);
|
||||
if($exist_pd_details[0]['fk_pd_type'] == 1)
|
||||
{
|
||||
$pd_details['satellite_image_base64_blob'] = satellite_image::getSatelliteImage($pd_details['pd_id']);
|
||||
}
|
||||
//die();
|
||||
//If it is Addtional PD ,then update 'COMPLETE' status for primary and all other addtional PD's
|
||||
if($exist_pd_details[0]['is_child'] == 1)
|
||||
@ -1028,6 +1032,12 @@ class PD_Controller extends REST_Controller {
|
||||
}
|
||||
}
|
||||
|
||||
// Before update if this is ssmart pd, then when vevndor status is completed but still pd status changing between to allocated or scheduling then keep
|
||||
//main pd status as in progress
|
||||
if($exist_pd_details[0]['fk_pd_type'] == 2 && $exist_pd_details[0]['pd_status'] == INPROGRESS && $exist_pd_details[0]['vendor_status'] == COMPLETED && isset($pd_details['pd_status']) && ($pd_details['pd_status'] == ALLOCATED || $pd_details['pd_status'] == SCHEDULED))
|
||||
{
|
||||
$pd_details['pd_status'] == INPROGRESS;
|
||||
}
|
||||
|
||||
$where_condition_array = array('pd_id' => $pd_details['pd_id'],'random_string' => $pd_details['random_string']);
|
||||
$pd_id_modified = $this->PD_Model->updateRecords($pd_details,PDTRIGGER,$where_condition_array);
|
||||
@ -6029,11 +6039,11 @@ public function getPDFormDetailsJSON_post()
|
||||
{
|
||||
|
||||
|
||||
// $records = $this->post('records');
|
||||
// $pd_master_details = $this->PD_Model->getPDMasterDetails($records['pd_id']);
|
||||
// $video_key = '9dBgX9Lg';
|
||||
// $final_video_name = $records['pd_id'].'-'.$video_key;
|
||||
// $this->mergeVideo($records['pd_id'],$pd_master_details,$final_video_name,$video_key);die();
|
||||
$records = $this->post('records');
|
||||
$pd_master_details = $this->PD_Model->getPDMasterDetails($records['pd_id']);
|
||||
$video_key = 'DOW8jDJ9';
|
||||
$final_video_name = $records['pd_id'].'-'.$video_key;
|
||||
$this->mergeVideo($records['pd_id'],$pd_master_details,$final_video_name,$video_key);die();
|
||||
// $msg = "OTP for starting your personal discussions with the verification officer is 999999.Pls share this only when the officer has reached your place in person.";
|
||||
// $res = SMS_GUPSHUP::sendSMS($msg,9715454901 ,array(),true);
|
||||
//print_r($res);
|
||||
@ -7678,10 +7688,11 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
|
||||
switch($pd_master_details[0]['fk_pd_type'])
|
||||
{
|
||||
case 1://FULL PD
|
||||
case 2:
|
||||
$score_questions = PDSCORE::genericDIPDScoreCalculate($score_questions,$loan_amt_from_loam_form,$personal_asset_grid,$pd_master_details);
|
||||
break;
|
||||
|
||||
case 2://SMART PD
|
||||
$score_questions = PDSCORE::genericDISmartPDScoreCalculate($score_questions,$loan_amt_from_loam_form,$personal_asset_grid,$pd_master_details);
|
||||
|
||||
|
||||
|
||||
case 3://tele PD
|
||||
@ -8431,12 +8442,9 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
|
||||
switch($pd_master_details[0]['fk_pd_type'])
|
||||
{
|
||||
case 1://FUll PD
|
||||
case 2://smartPD
|
||||
$res_array = pdcompletenesscheck::fullPDCompletenessCheck($pdid,$pd_master_details,$client);
|
||||
break;
|
||||
|
||||
case 2://smartPD
|
||||
break;
|
||||
|
||||
case 3://tele PD
|
||||
$res_array = pdcompletenesscheck::telePDCompletenessCheck($pdid,$pd_master_details,$client);
|
||||
break;
|
||||
@ -9540,7 +9548,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
|
||||
//die();
|
||||
$config = array('upload_path' => $folder_to_check,'overwrite' => TRUE,'allowed_types' => '*','file_name' => $file_name_wo_extension.'.'.$file_type);
|
||||
$this->load->library('upload', $config);
|
||||
if($this->upload->do_upload('video_file'))
|
||||
if($this->upload->do_upload('video_file'))
|
||||
{
|
||||
$upload_data = $this->upload->data();
|
||||
//$this->load->view('upload_success',$data);
|
||||
@ -9682,7 +9690,10 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
|
||||
$final_key = 'pd'.$pd_master_details[0]['pd_id'].'/video/'.$final_video_name.'.mp4';
|
||||
|
||||
//Get all video info
|
||||
$video_info = $this->PD_Model->selectCustomRecords(array('*'),array('fk_pd_id' => $pd_id,'is_active' => 1,'video_key' => $video_key),CUS_VIDEO);
|
||||
$qu = "SELECT *,convert(substr(substring_index(video_part_name,'-',1),6),UNSIGNED INTEGER) as sno FROM sineedgedemo.t_cus_video
|
||||
where fk_pd_id = $pd_id and video_key = '$video_key' and is_active = 1 order by sno";
|
||||
|
||||
$video_info = $this->db->query($qu)->result_array();
|
||||
$folder_to_check = XLPATH.'/pd_reports/'.$pd_id.'/videos';
|
||||
$file_list = $folder_to_check.'/filelist.txt';
|
||||
|
||||
@ -10330,21 +10341,25 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
|
||||
$fields_to_update = array('vendor_status' => $records['vendor_status'],'fk_updatedby' => $records['fk_updatedby']);
|
||||
if(isset($records['fk_pd_allocated_to']))
|
||||
{
|
||||
$fields_to_update['fk_pd_allocated_to'] = $records['fk_pd_allocated_to'];
|
||||
}
|
||||
if(isset($records['vendor_status']) && $records['vendor_status'] == STARTED)
|
||||
{
|
||||
$fields_to_update['start_location'] = $records['link'];
|
||||
|
||||
$fields_to_update['vendor_pdofficer'] = $records['vendor_pdofficer'];
|
||||
}
|
||||
// if(isset($records['vendor_status']) && $records['vendor_status'] == STARTED)
|
||||
// {
|
||||
// $fields_to_update['start_location'] = $records['link'];
|
||||
// }
|
||||
|
||||
if(isset($records['vendor_status']) && $records['vendor_status'] == COMPLETED)
|
||||
{
|
||||
$fields_to_update['pd_visit_date'] = date('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
$id = $this->PD_Model->updateRecords($fields_to_update,PDTRIGGER,array('pd_id' => $records['pd_id']));
|
||||
if($id)
|
||||
{
|
||||
if(isset($records['vendor_status']) && $records['vendor_status'] == STARTED)
|
||||
{
|
||||
satellite_image::getSatelliteImage($records['fk_pd_id']);
|
||||
}
|
||||
// if(isset($records['vendor_status']) && $records['vendor_status'] == STARTED)
|
||||
// {
|
||||
// satellite_image::getSatelliteImage($records['fk_pd_id']);
|
||||
// }
|
||||
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
@ -10606,6 +10621,74 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
|
||||
$data['records'] = $id;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
|
||||
function getBusinessDocsToVendorForm_get()
|
||||
{
|
||||
$pd_id = $this->get('pdid') ;
|
||||
|
||||
$business_form = $this->PD_Model->selectCustomRecords(array('json'),array('fk_pd_id' => $pd_id,'fk_form_id' => 13,'isactive' => 1,'company_id' => 1),PDFORMDETAILSJSON);
|
||||
if(count($business_form))
|
||||
{
|
||||
$records = array();
|
||||
$business_form = json_decode($business_form[0]['json'],true);
|
||||
//print_r($business_form);
|
||||
if(isset($business_form['shop_eat_act_cert']) && strtoupper($business_form['shop_eat_act_cert'])=='YES')
|
||||
{
|
||||
$records[] = 'shop_eat_act_cert';
|
||||
}
|
||||
if(isset($business_form['gst_Regn_cert']) && strtoupper($business_form['gst_Regn_cert'])=='YES')
|
||||
{
|
||||
$records[] = 'gst_Regn_cert';
|
||||
}
|
||||
if(isset($business_form['pf_regn']) && strtoupper($business_form['pf_regn'])=='YES')
|
||||
{
|
||||
$records[] = 'pf_regn';
|
||||
}
|
||||
if(isset($business_form['esic_regn']) && strtoupper($business_form['esic_regn'])=='YES')
|
||||
{
|
||||
$records[] = 'esic_regn';
|
||||
}
|
||||
if(isset($business_form['factory_cert']) && strtoupper($business_form['factory_cert'])=='YES')
|
||||
{
|
||||
$records[] = 'factory_cert';
|
||||
}
|
||||
if(isset($business_form['export_import_cert']) && strtoupper($business_form['export_import_cert'])=='YES')
|
||||
{
|
||||
$records[] = 'export_import_cert';
|
||||
}
|
||||
if(isset($business_form['practice_cert']) && strtoupper($business_form['practice_cert'])=='YES')
|
||||
{
|
||||
$records[] = 'practice_cert';
|
||||
}
|
||||
|
||||
if(count($records))
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $records;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NOT_FOUND;
|
||||
$data['msg'] = 'No Records Found!';
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NOT_FOUND;
|
||||
$data['msg'] = 'No Records Found!';
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ class pdcompletenesscheck
|
||||
#####General Form Questions########
|
||||
$general_form = (json_decode($form_data[18][0]['json'],true));
|
||||
// echo "seperateScoreQuestions";
|
||||
//print_r($form_data[18]);die();
|
||||
|
||||
|
||||
|
||||
$person_met_is_applicant_count = 0;
|
||||
@ -77,7 +77,15 @@ class pdcompletenesscheck
|
||||
$sal_check = $CI->PD_Model->selectCustomRecords(array('*'),array('fk_pd_id' => $pdid),XTRA_CHECK);
|
||||
$sal_check = count($sal_check) ? $sal_check[0]['flag'] : null;
|
||||
}
|
||||
|
||||
if($pd_master_details[0]['fk_pd_type'] == 2 && $pd_master_details[0]['vendor_status'] != COMPLETED)
|
||||
{
|
||||
$incomplete_details[] = 'Vendor yet to be complete the PD';
|
||||
}
|
||||
//kyc
|
||||
if(array_key_exists('is_kyc', $general_form) && !isset($general_form['is_kyc']))
|
||||
{
|
||||
$incomplete_details[] = 'General Section - Applicant KYC not answered';
|
||||
}
|
||||
//if(!$person_met_is_applicant_count && $sal_check == null){ $incomplete_details[] = 'General Section - Person met is not an applicant'; }
|
||||
if($person_met_selfie_count && $sal_check == null){ $incomplete_details[] = 'General Section - Person met selfie image with PD officer not captured'; }
|
||||
if($person_met_id_proof_count && $sal_check == null ){ $incomplete_details[] = 'General Section - Person met ID proof image not captured'; }
|
||||
|
||||
@ -586,7 +586,586 @@ class PDSCORE
|
||||
}
|
||||
|
||||
|
||||
//SMART PD SCORE CALCULATIONS
|
||||
public static function genericDISmartPDScoreCalculate($score_questions,$loan_amt_from_loam_form,$personal_asset_grid,$pd_master_details)
|
||||
{
|
||||
//echo 'RRRRR';die();
|
||||
//print_r($personal_asset_grid);die();echo "###################";
|
||||
############ GENERIC SE-DI CASES #######################
|
||||
############ SCROE VARIABLES DECLERATIONS ##############
|
||||
|
||||
// LEVEL 1 WEIGHTAGES
|
||||
$l1_general = 25;
|
||||
$l1_business = 50;
|
||||
$l1_final = 25;
|
||||
|
||||
// LEVEL2 WEIGHTAGES - Questions Weightages
|
||||
|
||||
/*-------- GENERAL --------------*/
|
||||
$person_met_is_applicant_L2 = 15;
|
||||
$pd_location_approach_L2 = 10;
|
||||
$comment_locality_L2 = 10;
|
||||
$customer_behaviour_L2 = 10;
|
||||
$neibourhood_check_as_per_pd_officer_L2 = 10;
|
||||
$was_the_company_name_board_sighted_L2 = 10;
|
||||
$otp_done_L2 = 10;
|
||||
$qualification_L2 = 10;
|
||||
$value_of_other_assets_L2 = 15;
|
||||
|
||||
/*-------- BUSNIESS --------------*/
|
||||
|
||||
// $location_suited_for_busienss_L2 = 10; not for smart pd
|
||||
|
||||
$no_of_years_business_run_L2 = 11.1111111;
|
||||
$business_seasonality_L2 = 11.1111111;
|
||||
$employees_total_L2 = 11.1111111;
|
||||
$cerificates_L2 = 11.1111111;
|
||||
$owned_property_L2 = 7.777777;
|
||||
$owned_vechile_L2 = 3.3333333;
|
||||
$minimum_supplier_info_L2 = 5.555555;
|
||||
$minimum_client_info_L2 = 5.555555;
|
||||
$stock_raw_material_enough_L2 = 5.555555;
|
||||
$stock_finished_goods_enough_L2 = 5.555555;
|
||||
|
||||
$business_activity_has_seen_L2 = 11.1111111;
|
||||
$vintage_of_business_account_L2 = 11.1111111;
|
||||
|
||||
/*-------- FINAL --------------*/
|
||||
$pd_officer_recommadations_L2 = 100;
|
||||
|
||||
//LEVEL3 SCORES - ANSWER SCORES
|
||||
/*-------- GENERAL --------------*/
|
||||
$person_met_is_applicant = array('yes' => 10, 'no' => 0);
|
||||
$pd_location_approach = array('Very Easy to locate & Reach' => 10,'Easy to locate & Reach' => 7,'Difficult to locate & Reach' => 4,'Very Difficult to locate & Reach' => 2);
|
||||
$comment_locality = array('Excellent' => 10,'Good' => 7,'Poor' => 5,'Very Poor' => 2);
|
||||
$customer_behaviour = array('Rude' => 0,'Polite' => 10,'Others' => 0);
|
||||
$neibourhood_check_as_per_pd_officer = array( 'Positive' => 10, 'Negative' => 0,'Could not verify' => 0);
|
||||
$was_the_company_name_board_sighted = array('yes' => 10, 'no' => 0);
|
||||
$supplir_client_answer_scores = array('Provided' => 10, 'Not Provided' => 0,'Not Applicable' => 0);
|
||||
|
||||
$otp_done = array('Yes' => 10, 'No' => 0);
|
||||
$qualification = array( 'name_score' => array('Completed Professional Course' => 10,'Completed Post Graduation' => 8, 'Completed Graduation' => 6,'Completed Schooling' => 4,'Not Completed Schooling' => 2,'No Formal Education' => 0),
|
||||
'id_score' => array('1' => 10,'2' => 8,'3' => 6,'4' => 4,'5' => 2,'6' => 0));
|
||||
|
||||
/*-------- BUSNIESS --------------*/
|
||||
$no_of_years_business_run = array('100> to >=10' => 10,'5<= to <10' => 8,'3<= to <5' => 6,'1<= to <3' => 4,' 1> to >0' => 2);
|
||||
$business_seasonality = array('yes' => 5, 'no major changes in sales' => 10);
|
||||
$employees_total = array('1000> to >50' => 10,'21<= to <=50' => 8, '11<= to <=20' => 6, '6<= to <10' =>4,'5>= to >0' => 2) ;
|
||||
$cerificates = array('yes' => 10,'no' => 0, 'not applicable' => 0);
|
||||
$owned_property = array('yes' => 10, 'no' => 0);
|
||||
$owned_vechile = array('yes' => 10, 'no' => 0);
|
||||
$minimum_supplier_info = array('Provided' => 10, 'Not Provided' => 0,'Not Applicable' => 0);
|
||||
$minimum_client_info = array('Provided' => 10, 'Not Provided' => 0,'Not Applicable' => 0);
|
||||
$stock_answer_scores = array('yes' => 10, 'no' => 0,'not applicable' => 0);
|
||||
$stock_raw_material_enough = array('Provided' => 10, 'Not Provided' => 0,'Not Applicable' => 0);
|
||||
$stock_finished_goods_enough = array('Provided' => 10, 'Not Provided' => 0,'Not Applicable' => 0);
|
||||
$location_suited_for_busienss = array('well_suited' => 10 ,'fairly_suited' => 6,'not_suited' => 0);
|
||||
$business_activity_has_seen = array('yes' => 10, 'no' => 0);
|
||||
$vintage_of_business_account = array('100> to >=10' => 10,'7<= to <10' => 8,'5<= to <7' => 6,'3<= to <5' => 4,'3> to >0' => 2);
|
||||
/*-------- FINAL --------------*/
|
||||
$pd_officer_recommandations = array('Positive' => 10,'Negative' => 0,'Refer to Credit' => 5,'Others' => 0);
|
||||
|
||||
|
||||
/*-----------CALCULATION PART -----------*/
|
||||
/*-----------GENERAL SECTION -----------*/
|
||||
//echo "##################################################";
|
||||
|
||||
$over_all_general_l2 = 0;
|
||||
$over_all_general_round_l2 = 0;
|
||||
$general_distribute_level_weightage = 0;
|
||||
|
||||
//General Section L2 Weightage Distribution section
|
||||
if($pd_master_details[0]['is_otp_enabled'] != 1)
|
||||
{
|
||||
$general_distribute_level_weightage += $otp_done_L2;
|
||||
}
|
||||
|
||||
if(!strcmp($score_questions['general']['neibourhood_check_as_per_pd_officer'],'Could not verify'))
|
||||
{
|
||||
//echo "Yes could not";
|
||||
$general_distribute_level_weightage += $neibourhood_check_as_per_pd_officer_L2;
|
||||
}
|
||||
|
||||
//End of General Section L2 Weightage Distribution section
|
||||
|
||||
|
||||
//######1.7 otp_done
|
||||
if($pd_master_details[0]['is_otp_enabled'] == 1)
|
||||
{
|
||||
$otp_done_L2 = $general_distribute_level_weightage ? ($otp_done_L2 + ($otp_done_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $otp_done_L2;
|
||||
|
||||
$otp_done_actual_score = ($l1_general/100) * ($otp_done_L2/100) * $otp_done[$score_questions['general']['otp_done']];
|
||||
|
||||
$otp_done_max_score = ($l1_general/100) * ($otp_done_L2/100) * max($otp_done);
|
||||
|
||||
$score_questions['general']['otp_done'] = array('l1_weightage' => $l1_general,'l2_weightage' => ($otp_done_L2),'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['otp_done'],'attributed_score' => ($otp_done_actual_score), 'max_score' => ($otp_done_max_score),'score_band'=>$otp_done[$score_questions['general']['otp_done']],'max_score_band' => max($otp_done));
|
||||
}
|
||||
else
|
||||
{
|
||||
$score_questions['general']['otp_done'] = array('l1_weightage' => $l1_general,'l2_weightage' => 0,'distributed_weightage' => $general_distribute_level_weightage,'answer' => 'Not Applicable','attributed_score' => 0.00, 'max_score' => 0.00,'score_band'=>$otp_done[ $score_questions['general']['otp_done'] != "" || $score_questions['general']['otp_done'] != null ?$score_questions['general']['otp_done']: "No" ],'max_score_band' => 0);
|
||||
}
|
||||
|
||||
//######1.5 neibourhood_check_as_per_pd_officer
|
||||
if(!strcmp($score_questions['general']['neibourhood_check_as_per_pd_officer'],'Could not verify'))
|
||||
{
|
||||
$score_questions['general']['neibourhood_check_as_per_pd_officer'] = array('l1_weightage' => $l1_general,'l2_weightage' => 0,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['neibourhood_check_as_per_pd_officer'],'attributed_score' => 0.00, 'max_score' => 0.00,'score_band'=>$neibourhood_check_as_per_pd_officer[$score_questions['general']['neibourhood_check_as_per_pd_officer'] != "" || $score_questions['general']['neibourhood_check_as_per_pd_officer'] != null ?$score_questions['general']['neibourhood_check_as_per_pd_officer']: "Negative" ],'max_score_band' => 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
$neibourhood_check_as_per_pd_officer_L2 = $general_distribute_level_weightage ? ($neibourhood_check_as_per_pd_officer_L2 + ($neibourhood_check_as_per_pd_officer_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $neibourhood_check_as_per_pd_officer_L2;
|
||||
|
||||
$neibourhood_check_as_per_pd_officer_actual_score = ($l1_general/100) * ($neibourhood_check_as_per_pd_officer_L2/100) * $neibourhood_check_as_per_pd_officer[$score_questions['general']['neibourhood_check_as_per_pd_officer'] != "" || $score_questions['general']['neibourhood_check_as_per_pd_officer'] != null ?$score_questions['general']['neibourhood_check_as_per_pd_officer']: "Negative" ];
|
||||
|
||||
$neibourhood_check_as_per_pd_officer_max_score = ($l1_general/100) * ($neibourhood_check_as_per_pd_officer_L2/100) * max($neibourhood_check_as_per_pd_officer);
|
||||
|
||||
$score_questions['general']['neibourhood_check_as_per_pd_officer'] = array('l1_weightage' => $l1_general,'l2_weightage' => $neibourhood_check_as_per_pd_officer_L2,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['neibourhood_check_as_per_pd_officer'],'attributed_score' => ($neibourhood_check_as_per_pd_officer_actual_score), 'max_score' => ($neibourhood_check_as_per_pd_officer_max_score),'score_band'=>$neibourhood_check_as_per_pd_officer[$score_questions['general']['neibourhood_check_as_per_pd_officer'] != "" || $score_questions['general']['neibourhood_check_as_per_pd_officer'] != null ?$score_questions['general']['neibourhood_check_as_per_pd_officer']: "Negative" ],'max_score_band' => max($neibourhood_check_as_per_pd_officer));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//echo $general_distribute_level_weightage = round($general_distribute_level_weightage,2);die();
|
||||
|
||||
//echo $general_distribute_level_weightage;
|
||||
|
||||
|
||||
|
||||
//#######1.1 person_met_is_applicant
|
||||
|
||||
$person_met_is_applicant_L2 = $general_distribute_level_weightage ? ($person_met_is_applicant_L2 + ($person_met_is_applicant_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $person_met_is_applicant_L2 ;
|
||||
|
||||
|
||||
$person_met_is_applicant_actual_score = ($l1_general/100) * ($person_met_is_applicant_L2/100) * $person_met_is_applicant[$score_questions['general']['person_met_is_applicant']];
|
||||
|
||||
$person_met_is_applicant_max_score = ($l1_general/100) * ($person_met_is_applicant_L2/100) * max($person_met_is_applicant);
|
||||
//echo $person_met_is_applicant_L2;
|
||||
//echo $person_met_is_applicant_max_score;
|
||||
|
||||
$score_questions['general']['person_met_is_applicant'] = array('l1_weightage' => $l1_general,'l2_weightage' => ($person_met_is_applicant_L2),'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['person_met_is_applicant'],'attributed_score' => ($person_met_is_applicant_actual_score), 'max_score' => ($person_met_is_applicant_max_score),'score_band'=>($person_met_is_applicant[$score_questions['general']['person_met_is_applicant']]),'max_score_band' => max($person_met_is_applicant));
|
||||
|
||||
//######1.2 pd_location_approach
|
||||
|
||||
$pd_location_approach_L2 = $general_distribute_level_weightage ? ($pd_location_approach_L2 + ($pd_location_approach_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $pd_location_approach_L2 ;
|
||||
|
||||
$pd_location_approach_actual_score = ($l1_general/100) * ($pd_location_approach_L2/100) * $pd_location_approach[$score_questions['general']['pd_location_approach']];
|
||||
|
||||
$pd_location_approach_max_score = ($l1_general/100) * ($pd_location_approach_L2/100) * max($pd_location_approach);
|
||||
|
||||
$score_questions['general']['pd_location_approach'] = array('l1_weightage' => $l1_general,'l2_weightage' => ($pd_location_approach_L2),'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['pd_location_approach'],'attributed_score' => ($pd_location_approach_actual_score), 'max_score' => ($pd_location_approach_max_score),'score_band'=>$pd_location_approach[$score_questions['general']['pd_location_approach']],'max_score_band' => max($pd_location_approach));
|
||||
|
||||
//######1.3 comment_locality
|
||||
|
||||
$comment_locality_L2 = $general_distribute_level_weightage ? ($comment_locality_L2 + ($comment_locality_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $comment_locality_L2;
|
||||
|
||||
$comment_locality_actual_score = ($l1_general/100) * ($comment_locality_L2/100) * $comment_locality[$score_questions['general']['comment_locality']];
|
||||
|
||||
$comment_locality_max_score = ($l1_general/100) * ($comment_locality_L2/100) * max($comment_locality);
|
||||
|
||||
$score_questions['general']['comment_locality'] = array('l1_weightage' => $l1_general,'l2_weightage' => ($comment_locality_L2),'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['comment_locality'],'attributed_score' => ($comment_locality_actual_score), 'max_score' => ($comment_locality_max_score),'score_band'=>$comment_locality[$score_questions['general']['comment_locality']],'max_score_band' => max($comment_locality));
|
||||
|
||||
//######1.4 customer_behaviour
|
||||
|
||||
$customer_behaviour_L2 = $general_distribute_level_weightage ? ($customer_behaviour_L2 + ($customer_behaviour_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $customer_behaviour_L2;
|
||||
|
||||
$customer_behaviour_actual_score = ($l1_general/100) * ($customer_behaviour_L2/100) * $customer_behaviour[$score_questions['general']['customer_behaviour']];
|
||||
|
||||
$customer_behaviour_max_score = ($l1_general/100) * ($customer_behaviour_L2/100) * max($customer_behaviour);
|
||||
|
||||
$score_questions['general']['customer_behaviour'] = array('l1_weightage' => $l1_general,'l2_weightage' => ($customer_behaviour_L2),'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['customer_behaviour'],'attributed_score' => ($customer_behaviour_actual_score), 'max_score' => ($customer_behaviour_max_score),'score_band'=>$customer_behaviour[$score_questions['general']['customer_behaviour']],'max_score_band' => max($customer_behaviour));
|
||||
|
||||
//######1.6 was_the_company_name_board_sighted
|
||||
|
||||
$was_the_company_name_board_sighted_L2 = $general_distribute_level_weightage ? ($was_the_company_name_board_sighted_L2 + ($was_the_company_name_board_sighted_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $was_the_company_name_board_sighted_L2;
|
||||
|
||||
$was_the_company_name_board_sighted_actual_score = ($l1_general/100) * ($was_the_company_name_board_sighted_L2/100) * $was_the_company_name_board_sighted[$score_questions['general']['was_the_company_name_board_sighted']];
|
||||
|
||||
$was_the_company_name_board_sighted_max_score = ($l1_general/100) * ($was_the_company_name_board_sighted_L2/100) * max($was_the_company_name_board_sighted);
|
||||
|
||||
$score_questions['general']['was_the_company_name_board_sighted'] = array('l1_weightage' => $l1_general,'l2_weightage' => ($was_the_company_name_board_sighted_L2),'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['was_the_company_name_board_sighted'],'attributed_score' => ($was_the_company_name_board_sighted_actual_score), 'max_score' => ($was_the_company_name_board_sighted_max_score),'score_band'=>$was_the_company_name_board_sighted[$score_questions['general']['was_the_company_name_board_sighted']],'max_score_band' => max($was_the_company_name_board_sighted));
|
||||
|
||||
|
||||
|
||||
//######1.8 qualification
|
||||
|
||||
$qualification_L2 = $general_distribute_level_weightage ? ($qualification_L2 + ($qualification_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $qualification_L2;
|
||||
|
||||
$qualification_actual_score = ($l1_general/100) * ($qualification_L2/100) * $qualification['id_score'][$score_questions['general']['qualification']];
|
||||
|
||||
$qualification_max_score = ($l1_general/100) * ($qualification_L2/100) * max($qualification['id_score']);
|
||||
$keys = array_keys($qualification['name_score']);
|
||||
|
||||
$score_questions['general']['qualification'] = array('l1_weightage' => $l1_general,'l2_weightage' => ($qualification_L2),'distributed_weightage' => $general_distribute_level_weightage,'answer' => $keys[($score_questions['general']['qualification']-1)],'attributed_score' => ($qualification_actual_score), 'max_score' => ($qualification_max_score),'score_band'=>$qualification['id_score'][$score_questions['general']['qualification']],'max_score_band' => max($qualification['id_score']));
|
||||
|
||||
//######1.9 value of assets as a % of Loan Amount
|
||||
//print_r($personal_asset_grid);
|
||||
|
||||
$value_of_other_assets_L2 = $general_distribute_level_weightage ? ($value_of_other_assets_L2 + ($value_of_other_assets_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $value_of_other_assets_L2;
|
||||
|
||||
$asset_calculation_details = array();
|
||||
|
||||
$actual_value_of_assets = $score_questions['general']['value_of_other_assets'];
|
||||
$asset_calculation_details['actual_value_of_assets'] = round($actual_value_of_assets,2);
|
||||
//echo 'actual_value_of_assets -'.$actual_value_of_assets;die();
|
||||
//print_r($loan_amt_from_loam_form);die();
|
||||
$loan_amount = (int)$loan_amt_from_loam_form;
|
||||
$asset_calculation_details['loan_amount'] = $loan_amount;
|
||||
//echo 'loan_amount - '.$loan_amount;
|
||||
|
||||
$avg_expected_value_of_assets = $personal_asset_grid['master_grid'][0]['avg_expected_value_assets'];
|
||||
//print_r($personal_asset_grid);
|
||||
//echo $avg_expected_value_of_assets;
|
||||
$asset_calculation_details['avg_expected_value_of_assets'] = round($avg_expected_value_of_assets,2);
|
||||
//echo "avg_expected_value_of_assets - ".$avg_expected_value_of_assets;
|
||||
//$expected_value_of_assets = ($avg_expected_value_of_assets / 100 ) * $personal_asset_grid['master_grid'][0]['loan_amount_to'];
|
||||
|
||||
$expected_value_of_assets = ($avg_expected_value_of_assets / 100 ) * $loan_amount;
|
||||
$asset_calculation_details['expected_value_of_assets'] = round($expected_value_of_assets,2);
|
||||
//echo 'expected_value_of_assets--'.$expected_value_of_assets;
|
||||
|
||||
|
||||
|
||||
$actual_value_of_assets_percentage = ($actual_value_of_assets / $loan_amount) * 100;
|
||||
$asset_calculation_details['actual_value_of_assets_percentage'] =
|
||||
round($actual_value_of_assets_percentage,2);
|
||||
//echo 'actual_value_of_assets_percentage--'.$actual_value_of_assets_percentage;
|
||||
|
||||
$variance = (($actual_value_of_assets_percentage - $avg_expected_value_of_assets)/$avg_expected_value_of_assets )* 100 ;
|
||||
|
||||
|
||||
//echo 'varience--'.$variance;
|
||||
//die();
|
||||
$asset_calculation_details['variance'] = round($variance,2);
|
||||
|
||||
$final_asset_attributed_score = 0;
|
||||
$final_asset_score = 0;
|
||||
if($actual_value_of_assets > 0 )
|
||||
{
|
||||
foreach($personal_asset_grid['variance_grid'] as $grid)
|
||||
{
|
||||
//print_r($grid['score']);
|
||||
if($grid['variance_ ratio_from'] <= $variance && $grid['variance_ration_to'] > $variance)
|
||||
{
|
||||
$final_asset_score = $grid['score'];
|
||||
$final_asset_attributed_score = ($l1_general/100 ) * ($value_of_other_assets_L2/100)* $final_asset_score;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
$asset_calculation_details['score'] = $final_asset_score;
|
||||
// echo "final_asset_score--".$final_asset_score;
|
||||
// die();
|
||||
$score_questions['general']['value_of_other_assets'] = array('l1_weightage' => $l1_general,'l2_weightage' => ($value_of_other_assets_L2),'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['value_of_other_assets'],'attributed_score' => ($final_asset_attributed_score), 'max_score' => ((($l1_general/100 ) * ($value_of_other_assets_L2/100) * 10)),'score_band'=> $final_asset_score,'max_score_band' => 10);
|
||||
|
||||
|
||||
/*-----------END OF GENERAL SECTION -----------*/
|
||||
|
||||
/*-----------FINAL REMARKS SECTION -----------*/
|
||||
//###### 3.1 PD Officer Recommandation
|
||||
|
||||
$pd_officer_recommandations_actual_score = ($l1_final/100) * ($pd_officer_recommadations_L2/100) * $pd_officer_recommandations[ $score_questions['final_remarks']['pd_officer_recommandations'] ];
|
||||
|
||||
$pd_officer_recommandations_max_score = ($l1_final/100) * ($pd_officer_recommadations_L2/100) * max($pd_officer_recommandations);
|
||||
|
||||
$score_questions['final_remarks']['pd_officer_recommandations'] = array('l1_weightage' => $l1_final,'l2_weightage' => $pd_officer_recommadations_L2,'distributed_weightage' => 0,'answer' => $score_questions['final_remarks']['pd_officer_recommandations'],'attributed_score' => round($pd_officer_recommandations_actual_score,2), 'max_score' => $pd_officer_recommandations_max_score,'score_band'=>$pd_officer_recommandations[ $score_questions['final_remarks']['pd_officer_recommandations'] ],'max_score_band' => max($pd_officer_recommandations));
|
||||
/*-----------END OF FINAL REMARKS SECTION -----------*/
|
||||
|
||||
|
||||
/*-----------BUSINESS SECTION -----------*/
|
||||
|
||||
|
||||
/* First Calculate Shortfall Type Questions to get distribute level
|
||||
From 2.7 to 2.10 Questions are shortfall type questions (REF :- SSA_ScoreCard_Ver_090219(2))
|
||||
*/
|
||||
|
||||
$business_distribute_level_weightage = 0;
|
||||
|
||||
//echo $score_questions['business']['minimum_supplier_info'];die();
|
||||
if(!strcasecmp($score_questions['business']['minimum_supplier_info'],'Not Applicable'))
|
||||
{
|
||||
$business_distribute_level_weightage += $minimum_supplier_info_L2;
|
||||
$minimum_supplier_info_L2 = 0;
|
||||
}
|
||||
if(!strcasecmp($score_questions['business']['minimum_client_info'],'Not Applicable'))
|
||||
{
|
||||
$business_distribute_level_weightage += $minimum_client_info_L2;
|
||||
$minimum_client_info_L2 = 0;
|
||||
}
|
||||
if(!strcasecmp($score_questions['business']['stock_raw_material_enough'],'Not Applicable'))
|
||||
{
|
||||
$business_distribute_level_weightage += $stock_raw_material_enough_L2;
|
||||
$stock_raw_material_enough_L2 = 0;
|
||||
}
|
||||
if(!strcasecmp($score_questions['business']['stock_finished_goods_enough'],'Not Applicable'))
|
||||
{
|
||||
$business_distribute_level_weightage += $stock_finished_goods_enough_L2;$stock_finished_goods_enough_L2 = 0;
|
||||
}
|
||||
//echo $business_distribute_level_weightage;
|
||||
|
||||
//######2.7 atleast one supplier info provided
|
||||
$minimum_supplier_info_L2 = $business_distribute_level_weightage ? ($minimum_supplier_info_L2 + ($minimum_supplier_info_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $minimum_supplier_info_L2 ;
|
||||
|
||||
$minimum_supplier_info_actual_score = ($l1_business/100) * ($minimum_supplier_info_L2/100) * $minimum_supplier_info [ $score_questions['business']['minimum_supplier_info'] ];
|
||||
|
||||
$minimum_supplier_info_max_score = strcasecmp($score_questions['business']['minimum_supplier_info'],'Not Applicable') ? ($l1_business/100) * ($minimum_supplier_info_L2/100) * max($minimum_supplier_info) : 0;
|
||||
|
||||
$score_questions['business']['minimum_supplier_info'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($minimum_supplier_info_L2),'answer' => $score_questions['business']['minimum_supplier_info'],'attributed_score' => ($minimum_supplier_info_actual_score), 'max_score' => ($minimum_supplier_info_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band'=>$minimum_supplier_info [ $score_questions['business']['minimum_supplier_info'] ],'max_score_band' => max($minimum_supplier_info));
|
||||
|
||||
//######2.8 atleast one client info provided
|
||||
$minimum_client_info_L2 = $business_distribute_level_weightage ? ($minimum_client_info_L2 + ($minimum_client_info_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $minimum_client_info_L2 ;
|
||||
|
||||
$minimum_client_info_actual_score = ($l1_business/100) * ($minimum_client_info_L2/100) * $minimum_client_info [ $score_questions['business']['minimum_client_info'] ];
|
||||
|
||||
$minimum_client_info_max_score = strcasecmp($score_questions['business']['minimum_client_info'],'Not Applicable') ? ($l1_business/100) * ($minimum_client_info_L2/100) * max($minimum_client_info) : 0;
|
||||
|
||||
$score_questions['business']['minimum_client_info'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($minimum_client_info_L2),'answer' => $score_questions['business']['minimum_client_info'],'attributed_score' => ($minimum_client_info_actual_score), 'max_score' => ($minimum_client_info_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band'=>$minimum_client_info [ $score_questions['business']['minimum_client_info'] ],'max_score_band' => max($minimum_client_info));
|
||||
|
||||
//######2.9 stock of raw material
|
||||
$stock_raw_material_enough_L2 = $business_distribute_level_weightage ? ($stock_raw_material_enough_L2 + ($stock_raw_material_enough_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $stock_raw_material_enough_L2 ;
|
||||
|
||||
$stock_raw_material_enough_actual_score = ($l1_business/100) * ($stock_raw_material_enough_L2/100) * $stock_answer_scores [ strtolower($score_questions['business']['stock_raw_material_enough']) ];
|
||||
|
||||
$stock_raw_material_enough_max_score = strcasecmp($score_questions['business']['stock_raw_material_enough'],'Not Applicable') ? ($l1_business/100) * ($stock_raw_material_enough_L2/100) * max($stock_answer_scores) : 0;
|
||||
|
||||
$score_questions['business']['stock_raw_material_enough'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($stock_raw_material_enough_L2),'answer' => $score_questions['business']['stock_raw_material_enough'],'attributed_score' => ($stock_raw_material_enough_actual_score), 'max_score' => ($stock_raw_material_enough_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $stock_answer_scores [ strtolower($score_questions['business']['stock_raw_material_enough']) ],'max_score_band' =>max($stock_answer_scores) );
|
||||
|
||||
//######2.10 stock_finished_goods_enough
|
||||
$stock_finished_goods_enough_L2 = $business_distribute_level_weightage ? ($stock_finished_goods_enough_L2 + ($stock_finished_goods_enough_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $stock_finished_goods_enough_L2 ;
|
||||
|
||||
$stock_finished_goods_enough_actual_score = ($l1_business/100) * ($stock_finished_goods_enough_L2/100) * $stock_answer_scores [ $score_questions['business']['stock_finished_goods_enough'] != "" || $score_questions['business']['stock_finished_goods_enough'] != null ? strtolower($score_questions['business']['stock_finished_goods_enough']) : "no" ];
|
||||
|
||||
$stock_finished_goods_enough_max_score = strcasecmp($score_questions['business']['stock_finished_goods_enough'],'Not Applicable') ? ($l1_business/100) * ($stock_finished_goods_enough_L2/100) * max($stock_answer_scores) : 0;
|
||||
|
||||
|
||||
$temp_stock_finished_goods_enough = strtolower($score_questions['business']['stock_finished_goods_enough']);
|
||||
$score_questions['business']['stock_finished_goods_enough'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($stock_finished_goods_enough_L2),'answer' => $score_questions['business']['stock_finished_goods_enough'],'attributed_score' => ($stock_finished_goods_enough_actual_score), 'max_score' => ($stock_finished_goods_enough_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $stock_answer_scores [ $temp_stock_finished_goods_enough != "" || $temp_stock_finished_goods_enough != null ? $temp_stock_finished_goods_enough : "no" ],'max_score_band' => max($stock_answer_scores));
|
||||
|
||||
|
||||
|
||||
//######2.1 Business Certificates
|
||||
|
||||
$cerificates_L2 = $business_distribute_level_weightage ? ($cerificates_L2 + ($cerificates_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $cerificates_L2;
|
||||
|
||||
//find out no of not applicable cases
|
||||
$business_certificates_distribution_count = 0;
|
||||
|
||||
foreach($score_questions['business']['cerificates'] as $value)
|
||||
{
|
||||
|
||||
if(strcasecmp($value,'not applicable'))
|
||||
{
|
||||
$business_certificates_distribution_count++;
|
||||
//echo $value;
|
||||
}
|
||||
}
|
||||
$business_certificates_distribution_count;
|
||||
$business_certificates_distribution = $cerificates_L2 / $business_certificates_distribution_count;
|
||||
|
||||
|
||||
|
||||
// echo $cerificates_L2.'---';echo $business_certificates_distribution_count;
|
||||
// echo $business_certificates_distribution;die();
|
||||
$certificate_actual_score = 0;
|
||||
$certificate_max_score = 0;
|
||||
//print_r($score_questions['business']['cerificates']);
|
||||
foreach($score_questions['business']['cerificates'] as $certificate_key => $certificate)
|
||||
{
|
||||
//print_r($certificate);
|
||||
$acutal_score = 0;
|
||||
$max_score = 0;
|
||||
if(strcasecmp($certificate,'not applicable'))
|
||||
{
|
||||
$acutal_score = ($l1_business/100) * ($business_certificates_distribution/100) * $cerificates[$certificate];
|
||||
$max_score = ($l1_business/100) * ($business_certificates_distribution/100) * max($cerificates);
|
||||
|
||||
}
|
||||
$score_questions['business']['cerificates'][$certificate_key] = array('answer' => $certificate,'attributed_score' => ($acutal_score), 'max_score' => ($max_score),'score_band' => $cerificates[$certificate],'max_score_band'=> max($cerificates),'l1_weightage' =>($l1_business),'l2_weightage'=> ($business_certificates_distribution));
|
||||
|
||||
$certificate_actual_score += $acutal_score;
|
||||
$certificate_max_score += $max_score;
|
||||
}
|
||||
|
||||
$score_questions['business']['cerificates']['l1_weightage'] = $l1_business;
|
||||
$score_questions['business']['cerificates']['l2_weightage'] = (($business_certificates_distribution * $business_certificates_distribution_count));
|
||||
$score_questions['business']['cerificates']['distributed_weightage'] = $business_distribute_level_weightage;
|
||||
$score_questions['business']['cerificates']['max_score'] = ($certificate_max_score);
|
||||
$score_questions['business']['cerificates']['attributed_score'] = ($certificate_actual_score);
|
||||
$score_questions['business']['cerificates']['score_band'] = 'Derived';
|
||||
$score_questions['business']['cerificates']['max_score_band'] = 'Derived';
|
||||
|
||||
//print_r($score_questions['business']['cerificates']);die();
|
||||
//######2.1 no_of_years_business_run
|
||||
|
||||
$no_of_years_business_run_actual_score = 0;
|
||||
$score_band = 0;
|
||||
foreach($no_of_years_business_run as $key => $value)
|
||||
{
|
||||
$exp = explode('to',$key);
|
||||
//print_r($exp);
|
||||
$left = $exp[0].$score_questions['business']['no_of_years_business_run'];
|
||||
$right = $score_questions['business']['no_of_years_business_run'].$exp[1];
|
||||
//echo $left.'````'.$right;echo "\n";
|
||||
eval( '$left_exp = ' . $left . ';');
|
||||
eval( '$right_exp = ' . $right . ';');
|
||||
if($left_exp && $right_exp)
|
||||
{
|
||||
|
||||
$no_of_years_business_run_L2 = $business_distribute_level_weightage ? ($no_of_years_business_run_L2 + ($no_of_years_business_run_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $no_of_years_business_run_L2 ;
|
||||
|
||||
$no_of_years_business_run_actual_score = ($l1_business/100) * ($no_of_years_business_run_L2/100) * $value;
|
||||
$score_band = $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$no_of_years_business_run_max_score = ($l1_business/100) * ($no_of_years_business_run_L2/100) * max($no_of_years_business_run);
|
||||
|
||||
$score_questions['business']['no_of_years_business_run'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($no_of_years_business_run_L2),'answer' => $score_questions['business']['no_of_years_business_run'],'attributed_score' => ($no_of_years_business_run_actual_score), 'max_score' => ($no_of_years_business_run_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $score_band,'max_score_band' => max($no_of_years_business_run));
|
||||
|
||||
|
||||
//######2.2 business seasonal
|
||||
|
||||
|
||||
$business_seasonality_L2 = $business_distribute_level_weightage ? ($business_seasonality_L2 + ($business_seasonality_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $business_seasonality_L2 ;
|
||||
|
||||
$business_seasonality_actual_score = ($l1_business/100) * ($business_seasonality_L2/100) * $business_seasonality[ $score_questions['business']['business_seasonality'] ];
|
||||
|
||||
$business_seasonality_max_score = ($l1_business/100) * ($business_seasonality_L2/100) * max($business_seasonality);
|
||||
|
||||
$score_questions['business']['business_seasonality'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($business_seasonality_L2),'answer' => $score_questions['business']['business_seasonality'],'attributed_score' => ($business_seasonality_actual_score), 'max_score' =>($business_seasonality_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $business_seasonality[ $score_questions['business']['business_seasonality'] ],'max_score_band' => max($business_seasonality));
|
||||
|
||||
//######2.3 employees_total
|
||||
$employees_total_actual_score = 0;
|
||||
|
||||
$employees_total_L2 = $business_distribute_level_weightage ? ($employees_total_L2 + ($employees_total_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $employees_total_L2 ;
|
||||
$score_band = 0;
|
||||
foreach($employees_total as $key => $value)
|
||||
{
|
||||
$exp = explode('to',$key);
|
||||
//print_r($exp);
|
||||
$left = $exp[0].$score_questions['business']['employees_total'];
|
||||
$right = $score_questions['business']['employees_total'].$exp[1];
|
||||
//echo $left.'````'.$right;echo "\n";
|
||||
eval( '$left_exp = ' . $left . ';');
|
||||
eval( '$right_exp = ' . $right . ';');
|
||||
if($left_exp && $right_exp)
|
||||
{
|
||||
$employees_total_actual_score = ($l1_business/100) * ($employees_total_L2/100) * $value;
|
||||
$score_band = $value;
|
||||
}
|
||||
|
||||
}
|
||||
// echo $score_band;
|
||||
// die();
|
||||
|
||||
|
||||
$employees_total_max_score = ($l1_business/100) * ($employees_total_L2/100) * max($employees_total);
|
||||
|
||||
$score_questions['business']['employees_total'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($employees_total_L2),'answer' => $score_questions['business']['employees_total'],'attributed_score' => ($employees_total_actual_score), 'max_score' => ($employees_total_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' =>$score_band,'max_score_band' => max($employees_total));
|
||||
|
||||
|
||||
//######2.5 owned_property
|
||||
|
||||
$owned_property_L2 = $business_distribute_level_weightage ? ($owned_property_L2 + ($owned_property_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $owned_property_L2 ;
|
||||
|
||||
$owned_property_actual_score = ($l1_business/100) * ($owned_property_L2/100) * $owned_property[ $score_questions['business']['owned_property'] ];
|
||||
$owned_property_max_score = ($l1_business/100) * ($owned_property_L2/100) * max($owned_property);
|
||||
|
||||
$score_questions['business']['owned_property'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($owned_property_L2),'answer' => $score_questions['business']['owned_property'],'attributed_score' => ($owned_property_actual_score), 'max_score' => ($owned_property_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $owned_property[ $score_questions['business']['owned_property'] ],'max_score_band' => max($owned_property));
|
||||
|
||||
//######2.6 owned_vechile
|
||||
$owned_vechile_L2 = $business_distribute_level_weightage ? ($owned_vechile_L2 + ($owned_vechile_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $owned_vechile_L2 ;
|
||||
|
||||
$owned_vechile_actual_score = ($l1_business/100) * ($owned_vechile_L2/100) * $owned_vechile[ $score_questions['business']['owned_vechile'] ];
|
||||
$owned_vechile_max_score = ($l1_business/100) * ($owned_vechile_L2/100) * max($owned_vechile);
|
||||
|
||||
$score_questions['business']['owned_vechile'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($owned_vechile_L2),'answer' => $score_questions['business']['owned_vechile'],'attributed_score' => ($owned_vechile_actual_score), 'max_score' => ($owned_vechile_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $owned_vechile[ $score_questions['business']['owned_vechile'] ],'max_score_band' => max($owned_vechile));
|
||||
|
||||
//######2.11 location_suited_for_busienss
|
||||
|
||||
$location_suited_for_busienss_L2 = $business_distribute_level_weightage ? ($location_suited_for_busienss_L2 + ($location_suited_for_busienss_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $location_suited_for_busienss_L2 ;
|
||||
|
||||
$location_suited_for_busienss_actual_score = ($l1_business/100) * ($location_suited_for_busienss_L2/100) * $location_suited_for_busienss[ $score_questions['business']['location_suited_for_busienss'] ];
|
||||
$location_suited_for_busienss_max_score = ($l1_business/100) * ($location_suited_for_busienss_L2/100) * max($location_suited_for_busienss);
|
||||
|
||||
$score_questions['business']['location_suited_for_busienss'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($location_suited_for_busienss_L2),'answer' => $score_questions['business']['location_suited_for_busienss'],'attributed_score' => ($location_suited_for_busienss_actual_score), 'max_score' => ($location_suited_for_busienss_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $location_suited_for_busienss[ $score_questions['business']['location_suited_for_busienss'] ],'max_score_band' => max($location_suited_for_busienss));
|
||||
|
||||
//######2.11 business_activity_has_seen
|
||||
|
||||
$business_activity_has_seen_L2 = $business_distribute_level_weightage ? ($business_activity_has_seen_L2 + ($business_activity_has_seen_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $business_activity_has_seen_L2 ;
|
||||
|
||||
$business_activity_has_seen_actual_score = ($l1_business/100) * ($business_activity_has_seen_L2/100) * $business_activity_has_seen[ $score_questions['business']['business_activity_has_seen'] ];
|
||||
$business_activity_has_seen_max_score = ($l1_business/100) * ($business_activity_has_seen_L2/100) * max($business_activity_has_seen);
|
||||
|
||||
$score_questions['business']['business_activity_has_seen'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($business_activity_has_seen_L2),'answer' => $score_questions['business']['business_activity_has_seen'],'attributed_score' => ($business_activity_has_seen_actual_score), 'max_score' => ($business_activity_has_seen_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $business_activity_has_seen[ $score_questions['business']['business_activity_has_seen'] ], 'max_score_band' => max($business_activity_has_seen));
|
||||
|
||||
//######2.13 vintage business banking
|
||||
|
||||
$vintage_of_business_account_L2 = $business_distribute_level_weightage ? ($vintage_of_business_account_L2 + ($vintage_of_business_account_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $vintage_of_business_account_L2 ;
|
||||
|
||||
$vintage_of_business_account_actual_score = 0;
|
||||
$score_band = 0;
|
||||
foreach($vintage_of_business_account as $key => $value)
|
||||
{
|
||||
$exp = explode('to',$key);
|
||||
//print_r($exp);
|
||||
$left = $exp[0].$score_questions['business']['vintage_of_business_account'];
|
||||
$right = $score_questions['business']['vintage_of_business_account'].$exp[1];
|
||||
//echo $left.'````'.$right;echo "\n";
|
||||
eval( '$left_exp = ' . $left . ';');
|
||||
eval( '$right_exp = ' . $right . ';');
|
||||
if($left_exp && $right_exp)
|
||||
{
|
||||
$vintage_of_business_account_actual_score = ($l1_business/100) * ($vintage_of_business_account_L2/100) * $value;
|
||||
$score_band = $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$vintage_of_business_account_max_score = ($l1_business/100) * ($vintage_of_business_account_L2/100) * max($vintage_of_business_account);
|
||||
|
||||
|
||||
$vintage_of_business_account_for_display = explode('.',($score_questions['business']['vintage_of_business_account']));
|
||||
$vintage_of_business_account_for_display = ($vintage_of_business_account_for_display[0] != 0 ? $vintage_of_business_account_for_display[0].' Yrs ' : '') . (isset($vintage_of_business_account_for_display[1]) && $vintage_of_business_account_for_display[1] != 0 ? $vintage_of_business_account_for_display[1].' Mns ' : '');
|
||||
|
||||
$score_questions['business']['vintage_of_business_account'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($vintage_of_business_account_L2),'answer' => $vintage_of_business_account_for_display,'attributed_score' => ($vintage_of_business_account_actual_score), 'max_score' => ($vintage_of_business_account_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $score_band,'max_score_band' => max($vintage_of_business_account));
|
||||
/*-----------END OF BUSINESS SECTION -----------*/
|
||||
|
||||
|
||||
|
||||
/* Calculate Overall Total*/
|
||||
$overall_max_score = 0;
|
||||
$overall_actual_score = 0;
|
||||
foreach($score_questions as $key => $value)
|
||||
{
|
||||
|
||||
$current_max_score = 0;
|
||||
$current_actual_score = 0;
|
||||
foreach($value as $v_key => $f_value)
|
||||
{
|
||||
$overall_max_score += $f_value['max_score'];
|
||||
$overall_actual_score += $f_value['attributed_score'];
|
||||
|
||||
$current_max_score += $f_value['max_score'];
|
||||
$current_actual_score += $f_value['attributed_score'];
|
||||
|
||||
}
|
||||
$score_questions['score_summary'][$key] = array('actual_score' => $current_actual_score,'max_score' => $current_max_score,'score_per' => (($current_actual_score/$current_max_score) * 100));
|
||||
|
||||
}
|
||||
$score_questions['score_summary']['overall_score'] = array('overall_actual_score' => $overall_actual_score, 'overall_max_score' => $overall_max_score,'final_score' => (($overall_actual_score/$overall_max_score) * 100));
|
||||
|
||||
$score_questions['score_summary']['asset_calculation_details'] = $asset_calculation_details;
|
||||
//print_r($score_questions);die();
|
||||
return ($score_questions);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// TELE PD SCORE CALCUALTIONS
|
||||
|
||||
@ -40,7 +40,8 @@ class Twlio
|
||||
$twilio = new Client(TWLIO_SID, TWLIO_AUTH_TOKEN);
|
||||
|
||||
$new_key = $twilio->newKeys->create();
|
||||
return $new_key->secret;
|
||||
|
||||
return array('apikey' => $new_key->sid,'apisecret' => $new_key->secret);
|
||||
|
||||
// print_r($new_key->dateCreated);
|
||||
// print_r($new_key->secret);
|
||||
@ -72,14 +73,14 @@ class Twlio
|
||||
}
|
||||
|
||||
|
||||
function getVideoAccessJWTToken($apiKeySecret,$roomName,$officerName)
|
||||
function getVideoAccessJWTToken($apiKey,$apiSecret,$roomName,$officerName)
|
||||
{
|
||||
|
||||
|
||||
// Required for all Twilio access tokens
|
||||
$twilioAccountSid = TWLIO_SID;
|
||||
$twilioApiKey = TWLIO_AUTH_TOKEN;
|
||||
$twilioApiSecret = $apiKeySecret;
|
||||
$twilioApiKey = $apiKey;
|
||||
$twilioApiSecret = $apiSecret;
|
||||
|
||||
// Required for Video grant
|
||||
$roomName = $roomName;
|
||||
@ -105,6 +106,81 @@ class Twlio
|
||||
// render token to string
|
||||
return $token->toJWT();
|
||||
}
|
||||
|
||||
function listOfRoomsByRoomName($roomName)
|
||||
{
|
||||
echo $roomName;
|
||||
$sid = TWLIO_SID;
|
||||
$token = TWLIO_AUTH_TOKEN;
|
||||
$twilio = new Client($sid, $token);
|
||||
|
||||
$rooms = $twilio->video->v1->rooms
|
||||
->read(["uniqueName" => $roomName,"status" => "completed"], 20);
|
||||
// print_r($rooms);die()
|
||||
foreach ($rooms as $record) {
|
||||
print($record);
|
||||
}
|
||||
}
|
||||
|
||||
function getRoomDataByRoomID($roomID)
|
||||
{
|
||||
//echo $roomName;
|
||||
$sid = TWLIO_SID;
|
||||
$token = TWLIO_AUTH_TOKEN;
|
||||
$twilio = new Client($sid, $token);
|
||||
|
||||
//$rooms = $twilio->video->v1->rooms
|
||||
// ->read(["uniqueName" => $roomName], 20);
|
||||
// print_r($rooms);
|
||||
$room = $twilio->video->v1->rooms($roomID)
|
||||
->fetch();
|
||||
print($room->uniqueName);
|
||||
print($room->accountSid);
|
||||
print($room->type);
|
||||
print($room->status);
|
||||
print($room->status);
|
||||
|
||||
// foreach ($rooms as $record) {
|
||||
// print($record->sid);
|
||||
// }
|
||||
}
|
||||
// 'sid
|
||||
// 'status
|
||||
// 'dateCreated
|
||||
// 'dateUpdated
|
||||
// 'accountSid
|
||||
// 'enableTurn
|
||||
// 'uniqueName
|
||||
// 'statusCallback
|
||||
// 'statusCallbackMethod
|
||||
// 'endTime
|
||||
// 'duration
|
||||
// 'type
|
||||
// 'maxParticipants
|
||||
// 'recordParticipantsOnConnect
|
||||
// 'videoCodecs
|
||||
// 'mediaRegion
|
||||
// 'url
|
||||
// 'links
|
||||
function startComposistion($roomID)
|
||||
{
|
||||
$apiKeySid = TWILIO_API_KEY;
|
||||
$apiKeySecret = TWILIO_API_KEY_SECRET;
|
||||
$client = new Client($apiKeySid, $apiKeySecret);
|
||||
|
||||
$composition = $client->video->compositions->create($roomID, [
|
||||
'audioSources' => '*',
|
||||
'videoLayout' => array(
|
||||
'grid' => array (
|
||||
'video_sources' => array('*')
|
||||
)
|
||||
),
|
||||
// 'statusCallback' => 'http://my.server.org/callbacks',
|
||||
'format' => 'mp4'
|
||||
]);
|
||||
print($composition);
|
||||
echo $composition->sid;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -14,7 +14,8 @@ class PD_Model extends SPARQ_Model {
|
||||
public function listLessPDDetails($page,$limit,$sort,$pdofficerid,$datetype,$fdate,$tdate,$lenderid,$status,$lender_details,$pdagencyid)// $page represents mysql offset
|
||||
{
|
||||
//echo $pd_agency_id;die();
|
||||
$this->db->SELECT('PDTRIGGER.pd_id,PDTRIGGER.imgc_fin_institute,PDTRIGGER.pd_sno,PDTRIGGER.fk_lender_id,PDTRIGGER.sub_entity_id,SUBENTITY.short_name as sub_entity_short_name,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name,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.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") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i:%s") as master_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.full_name as agency_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.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDTRIGGER.other_pincode,PDAPPLICANTSDETAILS.applicant_name,PDTRIGGER.is_otp_done,PDTRIGGER.is_child,PDTRIGGER.parent_pd_id,PDTRIGGER.fk_primary_address_id,PDTRIGGER.fk_address_id,PDTRIGGER.encrypted_url,PDTRIGGER.random_string,PDTRIGGER.pd_qc_note,ENTITY.is_sms_enabled,ENTITY.is_mail_enabled,ENTITY.is_app_notify_enabled,PDTRIGGER.is_notify_enabled,(SELECT DATE_FORMAT(createdon,"%d/%m/%Y") FROM h_common_masters where PDTRIGGER.pd_id = primary_key AND field_name = "pd_status" order by log_id DESC limit 1) as updatedon,ENTITYFININSTITUTION.institute_name as fin_institute_name,PDTRIGGER.is_video_merged,PDTRIGGER.vendor_status');
|
||||
$this->db->SELECT('PDTRIGGER.pd_id,PDTRIGGER.imgc_fin_institute,PDTRIGGER.pd_sno,PDTRIGGER.fk_lender_id,PDTRIGGER.sub_entity_id,SUBENTITY.short_name as sub_entity_short_name,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name,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.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") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i:%s") as master_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.full_name as agency_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.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDTRIGGER.other_pincode,PDAPPLICANTSDETAILS.applicant_name,PDTRIGGER.is_otp_done,PDTRIGGER.is_child,PDTRIGGER.parent_pd_id,PDTRIGGER.fk_primary_address_id,PDTRIGGER.fk_address_id,PDTRIGGER.encrypted_url,PDTRIGGER.random_string,PDTRIGGER.pd_qc_note,ENTITY.is_sms_enabled,ENTITY.is_mail_enabled,ENTITY.is_app_notify_enabled,PDTRIGGER.is_notify_enabled,(SELECT DATE_FORMAT(createdon,"%d/%m/%Y") FROM h_common_masters where PDTRIGGER.pd_id = primary_key AND field_name = "pd_status" order by log_id DESC limit 1) as updatedon,ENTITYFININSTITUTION.institute_name as fin_institute_name,PDTRIGGER.is_video_merged,PDTRIGGER.vendor_status');
|
||||
//$this->db->SELECT('pd_sno,fk_lender_id,pd_agency_id,pd_status,vendor_status');
|
||||
$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');
|
||||
@ -93,6 +94,8 @@ class PD_Model extends SPARQ_Model {
|
||||
if($pdagencyid != "" || $pdagencyid != null)
|
||||
{
|
||||
$this->db->WHERE('PDTRIGGER.pd_agency_id',$pdagencyid);
|
||||
//$this->db->WHERE('PDTRIGGER.vendor_status',TRIGGERED);
|
||||
$this->db->WHERE("if(vendor_status = 'TRIGGERED', if( pd_status in ('SCHEDULED','ALLOCATED','INPROGRESS','COMPLETED'),1,0),0)=0");
|
||||
}
|
||||
if($status != "" || $status != null)
|
||||
{
|
||||
@ -262,6 +265,7 @@ class PD_Model extends SPARQ_Model {
|
||||
if($pd_agency_id != "" || $pd_agency_id != null )
|
||||
{
|
||||
$this->db->LIKE('PDTRIGGER.pd_agency_id',$pd_agency_id);
|
||||
$this->db->WHERE("if(vendor_status = 'TRIGGERED', if( pd_status in ('SCHEDULED','ALLOCATED','INPROGRESS','COMPLETED'),1,0),0)=0");
|
||||
}
|
||||
if($pd_officer_id != "" || $pd_officer_id != null )
|
||||
{
|
||||
@ -953,7 +957,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.full_name as agency_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,PDTRIGGER.is_notify_enabled,ENTITYFININSTITUTION.institute_name as fin_institute_name,PDTRIGGER.is_img_pdf_created,PDTRIGGER.is_video_merged,PDTRIGGER.vendor_status');
|
||||
$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.full_name as agency_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,PDTRIGGER.is_notify_enabled,ENTITYFININSTITUTION.institute_name as fin_institute_name,PDTRIGGER.is_img_pdf_created,PDTRIGGER.is_video_merged,PDTRIGGER.vendor_status');
|
||||
$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');
|
||||
@ -971,6 +975,7 @@ class PD_Model extends SPARQ_Model {
|
||||
$this->db->JOIN(USERPROFILE.' as CENTRALOFFICER','PDTRIGGER.central_pd_officer_id = CENTRALOFFICER.userid','LEFT');
|
||||
$this->db->JOIN(USERPROFILE.' as LENDERSALESPERSON','PDTRIGGER.lender_sales_person = LENDERSALESPERSON.userid','LEFT');
|
||||
$this->db->JOIN(USERPROFILE.' as LENDERCREDITPERSON','PDTRIGGER.lender_credit_person = LENDERCREDITPERSON.userid','LEFT');
|
||||
$this->db->JOIN(USERPROFILE.' as VENDORPDOFFICER','PDTRIGGER.vendor_pdofficer = VENDORPDOFFICER.userid','LEFT');
|
||||
$this->db->JOIN(TEMPLATE.' as TEMPLATE','PDTRIGGER.fk_pd_template_id = TEMPLATE.template_id','LEFT');
|
||||
$this->db->JOIN(CUSTOMERSEGMENT.' as CUSTOMERSEGMENT','PDTRIGGER.fk_customer_segment = CUSTOMERSEGMENT.customer_segment_id','LEFT');
|
||||
$this->db->JOIN(ENTITY.' as AGENCY','PDTRIGGER.pd_agency_id = AGENCY.entity_id','LEFT');
|
||||
@ -993,7 +998,7 @@ class PD_Model extends SPARQ_Model {
|
||||
|
||||
// $this->db->LIMIT($limit,$page);
|
||||
$result_array = $this->db->GET()->result_array();
|
||||
//print_r($this->db->last_query());die();
|
||||
//print_r($result_array);die();
|
||||
$mandatory_fields = array();
|
||||
if(count($result_array))
|
||||
{
|
||||
@ -1093,7 +1098,7 @@ class PD_Model extends SPARQ_Model {
|
||||
else//18,5,13,11,19,20
|
||||
{
|
||||
//echo 'insert';
|
||||
$f_arr = array(18,5,13,19,20,24,22);
|
||||
$f_arr = array(18,5,13,19,20,24,22,12,11);
|
||||
foreach ($f_arr as $key => $value)
|
||||
{
|
||||
$this->saveRecords(array('fk_pd_id' => $pdid,'fk_form_id' => $value),VENDORFORMSTATUS);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user