diff --git a/api/application/config/api_user_auth_config.php b/api/application/config/api_user_auth_config.php
index 879e27e8..e2bc5e50 100644
--- a/api/application/config/api_user_auth_config.php
+++ b/api/application/config/api_user_auth_config.php
@@ -33,7 +33,7 @@ $config['api_user_auth_info'] = array(
'updateExistUser' => array(10),
//'getUsersDetails' => array(),
'triggerNewPD' => array(1,2,3,10,11,12,13,1,15,16,17,18,19,20),
-'updatePDMaster' => array(1,2,3,10,11,12,13,1,15,16,17,18,19,20),
+//'updatePDMaster' => array(1,2,3,10,11,12,13,1,15,16,17,18,19,20),
'updatePDDocs' => array(1,2,3,10,11,12,13,1,15,16,17,18,19,20),
'updatePDApplicants' => array(1,2,3,10,11,12,13,1,15,16,17,18,19,20),
'allocatePD' => array(2,3,4,5,10,21,22),
diff --git a/api/application/config/constants.php b/api/application/config/constants.php
index 22791701..f252d37b 100644
--- a/api/application/config/constants.php
+++ b/api/application/config/constants.php
@@ -87,7 +87,7 @@ defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest auto
// define login route name for token verification
//defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(getPDReportHTML/:any)'); // no errors
defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'getPDOfficerCurrentLocation'); // no errors
-defined('ROUTE_LOGIN_X') OR define('ROUTE_LOGIN_X', '(getPDReportHTML/:any)'); // no errors
+defined('ROUTE_LOGIN_X') OR define('ROUTE_LOGIN_X', '(getPDReportHTML/:any/:any)'); // no errors
//defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN','getFullPDDetails'); // no errors
/*********************AWS resources Constants*************************************************/
@@ -99,7 +99,8 @@ defined('DETAILED_SCORE_CARD_IMAGE_LOCATION') OR define('DETAILED_SCORE_CARD_IMA
defined('LENDER_BUCKET_NAME_PREFIX') OR define('LENDER_BUCKET_NAME_PREFIX','lender');
defined('PHANTOMJSSCRIPT_LOCATION') OR define('PHANTOMJSSCRIPT_LOCATION','phantomjs_dev');
defined('LOGTOBOT') OR define('LOGTOBOT',0);
-defined('GOOGLE_STATIC_MAP_API_KEY') OR define('GOOGLE_STATIC_MAP_API_KEY','AIzaSyCXsHTus6hyIB8jYvt9ZEIbZve-2vWeQRg');
+defined('GOOGLE_STATIC_MAP_API_KEY') OR define('GOOGLE_STATIC_MAP_API_KEY','AIzaSyA3lYDYxwtn5vLSl45SOKbtK7G6cEyXGr0');
+defined('FIREBASE_PUSH_NOTIFICATION_SERVER_API_KEY') OR define('FIREBASE_PUSH_NOTIFICATION_SERVER_API_KEY','AAAA0yTIWHY:APA91bGuBHAEn1NcX95Uudm847Ez2AIbqqmi5698trFPx0cIs0OTXWUNu7c5DKDJlbxPBILytBGC5cEHqEy08AQZGu_rpCE4hyvoHyCDkOjuwhA3DFNMQDpMU6XxDDJXCI1zjhHRuEQr');
}
else if(ENVIRONMENT == 'testing')
{
@@ -108,7 +109,8 @@ else if(ENVIRONMENT == 'testing')
defined('LENDER_BUCKET_NAME_PREFIX') OR define('LENDER_BUCKET_NAME_PREFIX','len');
defined('PHANTOMJSSCRIPT_LOCATION') OR define('PHANTOMJSSCRIPT_LOCATION','phantomjs_test');
defined('LOGTOBOT') OR define('LOGTOBOT',0);
- defined('GOOGLE_STATIC_MAP_API_KEY') OR define('GOOGLE_STATIC_MAP_API_KEY','AIzaSyCXsHTus6hyIB8jYvt9ZEIbZve-2vWeQRg');
+ defined('GOOGLE_STATIC_MAP_API_KEY') OR define('GOOGLE_STATIC_MAP_API_KEY','AIzaSyA3lYDYxwtn5vLSl45SOKbtK7G6cEyXGr0');
+ defined('FIREBASE_PUSH_NOTIFICATION_SERVER_API_KEY') OR define('FIREBASE_PUSH_NOTIFICATION_SERVER_API_KEY','AAAA0yTIWHY:APA91bGuBHAEn1NcX95Uudm847Ez2AIbqqmi5698trFPx0cIs0OTXWUNu7c5DKDJlbxPBILytBGC5cEHqEy08AQZGu_rpCE4hyvoHyCDkOjuwhA3DFNMQDpMU6XxDDJXCI1zjhHRuEQr');
}
else if(ENVIRONMENT == 'prod')
{
@@ -117,7 +119,8 @@ else if(ENVIRONMENT == 'prod')
defined('LENDER_BUCKET_NAME_PREFIX') OR define('LENDER_BUCKET_NAME_PREFIX','lender');
defined('PHANTOMJSSCRIPT_LOCATION') OR define('PHANTOMJSSCRIPT_LOCATION','phantomjs_test');
defined('LOGTOBOT') OR define('LOGTOBOT',0);
- defined('GOOGLE_STATIC_MAP_API_KEY') OR define('GOOGLE_STATIC_MAP_API_KEY','AIzaSyCXsHTus6hyIB8jYvt9ZEIbZve-2vWeQRg');
+ defined('GOOGLE_STATIC_MAP_API_KEY') OR define('GOOGLE_STATIC_MAP_API_KEY','AIzaSyA3lYDYxwtn5vLSl45SOKbtK7G6cEyXGr0');
+ defined('FIREBASE_PUSH_NOTIFICATION_SERVER_API_KEY') OR define('FIREBASE_PUSH_NOTIFICATION_SERVER_API_KEY','AAAA0yTIWHY:APA91bGuBHAEn1NcX95Uudm847Ez2AIbqqmi5698trFPx0cIs0OTXWUNu7c5DKDJlbxPBILytBGC5cEHqEy08AQZGu_rpCE4hyvoHyCDkOjuwhA3DFNMQDpMU6XxDDJXCI1zjhHRuEQr');
}
/*********************END of AWS resources Constants*************************************************/
diff --git a/api/application/config/routes.php b/api/application/config/routes.php
index 01ce5500..4fba1808 100644
--- a/api/application/config/routes.php
+++ b/api/application/config/routes.php
@@ -203,7 +203,7 @@ $route['updatePDAddress'] = 'PD_Controller/updatePDAddress';
$route['getPDCompleteDetails'] = 'PD_Controller/getPDCompleteDetails';
$route['getStateCityNamesAndPincode'] = 'PD_Controller/getStateCityNamesAndPincode';
$route['saveHTMLReport'] = 'PD_Controller/saveHTMLReport';
-$route['(getPDReportHTML/:any)'] = 'PD_Controller/getPDReportHTML';
+$route['(getPDReportHTML/:any/:any)'] = 'PD_Controller/getPDReportHTML';
$route['convertBase64'] = 'PD_Controller/convertImgUrlToBase64';
$route['updateNotificationToken'] = 'PD_Controller/updateNotificationToken';
// $route['savePDFormDetailsJSON'] = 'PD_Controller/savePDFormDetailsJSON';
diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php
index 5e1f533f..15db7d77 100644
--- a/api/application/controllers/PD_Controller.php
+++ b/api/application/controllers/PD_Controller.php
@@ -716,7 +716,7 @@ class PD_Controller extends REST_Controller {
{
$pd_details = $this->post('records');
$logger = MYLOG::logFunction();
- if(isset($pd_details['pd_id']) && $pd_details['pd_id'] != "")
+ if((isset($pd_details['pd_id']) && $pd_details['pd_id'] != "" ) && (isset($pd_details['random_string']) && $pd_details['random_string'] != " "))
{
$exist_pd_details = $this->PD_Model->getPDMasterDetails($pd_details['pd_id']);
@@ -821,7 +821,7 @@ class PD_Controller extends REST_Controller {
}
- $where_condition_array = array('pd_id' => $pd_details['pd_id']);
+ $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);
//print_r($pd_details);
@@ -1812,9 +1812,9 @@ class PD_Controller extends REST_Controller {
public function getFullPDDetails_post()
{
$pdid = $this->post('pdid');
-
+ $random_string = $this->post('random_string');
// Get All PD Masters Details
- $result_data['pd_master_details'] = $this->PD_Model->getPDMasterDetails($pdid);
+ $result_data['pd_master_details'] = $this->PD_Model->getPDMasterDetails($pdid,$random_string);
// Get All Applicant's Details
$result_data['applicants_details'] = $this->PD_Model->getApplicantsDetails($pdid);
@@ -1877,13 +1877,16 @@ class PD_Controller extends REST_Controller {
{
$pd_id = "";
$client = "";
+ $random_string = "";
if($this->get('pd_id')) { $pd_id = $this->get('pd_id'); }
if($this->get('client')) { $client = $this->get('client'); }
+ if($this->get('random_string')) { $random_string = $this->get('random_string'); }
+
if($pd_id != "" || $pd_id != null)
{
- $template_details = $this->PD_Model->getTemplateForPD($pd_id,$client);
+ $template_details = $this->PD_Model->getTemplateForPD($pd_id,$client,$random_string);
if(count($template_details))
{
$data['dataStatus'] = true;
@@ -3383,11 +3386,12 @@ class PD_Controller extends REST_Controller {
public function getFinalPDReportQuestions_post()
{
$pd_id = $this->post('pd_id');
+ $random_string = $this->post('random_string');
$final_data_to_response = array();
$final_data_to_response['question_answers']['general_questions'] = "";
- $pd_master_details = $this->PD_Model->getPDMasterDetails($pd_id);
+ $pd_master_details = $this->PD_Model->getPDMasterDetails($pd_id,$random_string);
$final_data_to_response = $pd_master_details[0];
$final_data_to_response['pd_applicant_details'] = $this->PD_Model->getApplicantsDetails($pd_id);
@@ -3911,8 +3915,9 @@ class PD_Controller extends REST_Controller {
$pdid = $records['pd_id'];
$fk_createdby = $records['fk_createdby'];
$is_generate = isset($records['is_generate']) ? 1 : 0;
+ $random_string = $records['random_string'];
$is_qc_edited = 0;
- $pd_master_details = $this->PD_Model->getPDMasterDetails($pdid);
+ $pd_master_details = $this->PD_Model->getPDMasterDetails($pdid,$random_string);
$bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_master_details[0]['fk_lender_id'];
$main_applicant_name = $pd_master_details[0]['main_applicant'];
@@ -4037,8 +4042,9 @@ class PD_Controller extends REST_Controller {
$records = $this->post('records');
$pdid = $records['pd_id'];
$fk_createdby = $records['fk_createdby'];
+ $random_string = $records['random_string'];
- $data['pd_master_details'] = $this->PD_Model->getPDMasterDetails($pdid);
+ $data['pd_master_details'] = $this->PD_Model->getPDMasterDetails($pdid,$random_string);
$data['pd_master_details'][0]['pd_report_generated_date'] = date('d/m/Y g:i:s A');
$data['applicants_details'] = $this->PD_Model->getApplicantsDetails($pdid);
$data['pd_additional_requirements'] = $this->PD_Model->getPDAdditionalRequirements($pdid);
@@ -4133,7 +4139,8 @@ class PD_Controller extends REST_Controller {
{
$records = $this->post('records');
$pdid = $records['pd_id'];
- $pd_master_details = $this->PD_Model->getPDMasterDetails($pdid);
+ $random_string = $records['random_string'];
+ $pd_master_details = $this->PD_Model->getPDMasterDetails($pdid,$random_string);
$bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_master_details[0]['fk_lender_id'];
$main_applicant_name = $pd_master_details[0]['main_applicant'];
@@ -5029,7 +5036,7 @@ class PD_Controller extends REST_Controller {
$pdid = $records['pd_id'];
//ini_set('max_execution_time', 300);
- //PDALERTS::pdnotification($pdid);die();
+ PDALERTS::pdnotification(300);die();
$is_regenerate = 0;
if(isset($records['regenerate']))
{
@@ -6742,12 +6749,13 @@ class PD_Controller extends REST_Controller {
$pdid = $records['pdid'];
$content = $records['content'];
$fk_createdby = $records['fk_createdby'];
+ $random_string = $records['random_string'];
$pd_report_time = date('Y-m-d-h-i-s');
$pd_report_store = APPPATH.'views/pd_reports/'.$pdid.'/'.$pd_report_time.'.html';
file_put_contents($pd_report_store,$content);
//Update Latest File name and qc edited status into trigger table
- $update = $this->PD_Model->updateRecords(array('pd_report_html_filename' => $pd_report_time,'fk_createdby' => $fk_createdby,'is_qc_edited' => 1),PDTRIGGER,array('pd_id' => $pdid));
+ $update = $this->PD_Model->updateRecords(array('pd_report_html_filename' => $pd_report_time,'fk_createdby' => $fk_createdby,'is_qc_edited' => 1),PDTRIGGER,array('pd_id' => $pdid,'random_string' => $random_string));
//Update previous latest as 0
$update_reports_version_blob = $this->PD_Model->updateRecords(array('is_latest' => 0),PDREPORTSVERSIONBLOB,array('fk_pd_id' => $pdid,'is_latest' => 1));
@@ -6770,12 +6778,14 @@ class PD_Controller extends REST_Controller {
public function getPDReportHTML_get()
{
- $pdid = $this->uri->segment(2);
+ $pdid = $this->uri->segment(3);
+ $random_string = $this->uri->segment(2);
+
//date_default_timezone_set("Asia/Kolkata");
//echo date('Y-m-d h:i:s');die();
- if(($pdid != null || $pdid != "") && (strlen($pdid) == 16) &&(is_string($pdid)))
+ if(($pdid != null || $pdid != "")) //&& (strlen($pdid) == 16) &&(is_string($pdid)))
{
- $pd_data = $this->PD_Model->selectCustomRecords(array('pd_id','pd_report_html_filename'),array('random_string' => $pdid),PDTRIGGER);
+ $pd_data = $this->PD_Model->selectCustomRecords(array('pd_id','pd_report_html_filename'),array('random_string' => $random_string,'pd_id' => $pdid),PDTRIGGER);
if(count($pd_data))
{
$view_name = 'pd_reports/'.$pd_data[0]['pd_id'].'/'.$pd_data[0]['pd_report_html_filename'].'.html';
@@ -6797,8 +6807,9 @@ class PD_Controller extends REST_Controller {
public function pdFormsCompletenessCheck_post()
{
$pdid = $this->post('pd_id');
+ $pd_master_details = $this->PD_Model->getPDMasterDetails($pdid);
$client = $this->post('client') ? $this->post('client') : 'WEB';
-
+ //print_r($pd_master_details);die();
$business_captions = array("no_of_years_business_run" => "Business Vintage >>", "location_suited_for_busienss" => "Business Location suitability >>", "business_seasonality" => "Seasonality >>", "employees_total" => "Employee Strength >>", "cerificates" => "Business Certifications Sighted >>","owned_property" => "Business Premise Ownership >>", "owned_vechile" => "Vehicle Ownership >>", "business_activity_has_seen" => "Business Activity Observed >>", "minimum_supplier_info" => "Supplier Information Provided >>", "minimum_client_info" => "Client Information Provided >>","stock_raw_material_enough" => "Raw Materials Stock Sufficiency >>", "stock_finished_goods_enough" => "Finished/Traded Stock Sufficiency >>", "vintage_of_business_account" => "Main Business Banking Account Vintage >>");
$general_captions = array("otp_done" => "OTP authentication done >>","person_met_is_applicant" => "Is person Met, a loan applicant >>","qualification" => "Qualification of Loan Applicants >>","comment_locality" => "Comment on Locality >>","pd_location_approach" => "Approach to PD location >>","customer_behaviour" => "Customer Behaviour >>","neibourhood_check_as_per_pd_officer" => "Neighbourhood check >>","was_the_company_name_board_sighted" => "Business Board Sighted >>","value_of_other_assets" => "Asset Value by Loan Amount % >>");
@@ -6818,7 +6829,7 @@ class PD_Controller extends REST_Controller {
$incomplete_details = array();
// print_r($pd_images);die();
- $pd_master_details = $this->PD_Model->getPDMasterDetails($pdid);
+
#####General Form Questions########
@@ -6884,512 +6895,525 @@ class PD_Controller extends REST_Controller {
}
}
- #####Business Form Questions########
- $business_form = (json_decode($form_data[13][0]['processed_json'],true));
- //print_r($business_form);die();
- //print_r(($business_form['shop_eat_act_cert']));die();
- $is_manufacturing_selected = 0;
- $selected_type_of_activity = array();
- foreach ($business_form['select_business_activity_type'] as $key => $value) {
- if($value['type_of_activity_id'] == 2){ $is_manufacturing_selected = 1; }
- array_push($selected_type_of_activity,$value['type_of_activity_id']);
-
- }
- $is_name_board_seen = false;
- if($business_form['was_the_company_name_board_sighted'] == "")
- {
- $incomplete_details[] = 'Business Section - Name Board Seen Not answered';
-
- }
- else if($business_form['was_the_company_name_board_sighted'] == "yes")
- {
- $is_name_board_seen = true;
- }
- if( !is_numeric($business_form['employees_temporary']) || !is_numeric($business_form['employees_permanent']) || !is_numeric($business_form['employees_appx_salary']) || !is_numeric($business_form['officer_total']))
- {
- $incomplete_details[] = 'Business Section - Company Employees Details Not Filled';
- }
-
-
- if( $client != 'WEB')// if API came from web then ignore this check
- {
- $certificate_count = 0;
- $name_board_image_count = 0;
-
- if(count($pd_images[13]))
- {
- foreach ($pd_images[13] as $key => $value) {
- if(substr_count(strtolower($value['pd_document_title']),strtolower('Name board Seen')))
- {
- $name_board_image_count++;
- }
- }
- }
- if(!$name_board_image_count){ $incomplete_details[] = 'Busienss Section - Business Name Board Image not captured'; }
-
-
- if(isset($business_form['shop_eat_act_cert']))
- {
- if(strtoupper($business_form['shop_eat_act_cert'])=='YES' && $business_form['shop_eat_act_cert_pic'] == "")
- {
- $certificate_count++;
- }
- } else { $certificate_count++; }
-
- if(isset($business_form['gst_Regn_cert']))
- {
- if(strtoupper($business_form['gst_Regn_cert'])=='YES' && $business_form['gst_Regn_cert_pic'] == "")
- {
- $certificate_count++;
- }
- } else { $certificate_count++; }
-
-
- if(isset($business_form['pf_regn']))
- {
- if(strtoupper($business_form['pf_regn'])=='YES' && $business_form['pf_regn_pic'] == "")
- {
- $certificate_count++;
- }
- } else { $certificate_count++; }
-
- if(isset($business_form['esic_regn']))
- {
- if(strtoupper($business_form['esic_regn'])=='YES' && $business_form['esic_regn_pic'] == "")
- {
- $certificate_count++;
- }
- } else { $certificate_count++; }
-
-
-
- //If Business Type of activity is manufacturing then check these two certifications,
- if(in_array('2',$selected_type_of_activity))// || in_array('4',$selected_type_of_activity))
- {
- if(isset($business_form['factory_cert']))
- {
- if(strtoupper($business_form['factory_cert'])=='YES' && $business_form['factory_cert_pic'] == "")
- {
- $certificate_count++;
- }
- } //else { $certificate_count++; }
- }
-
- //If Business Type of activity is manufacturing,wholesale,retail then check
- if(in_array('2',$selected_type_of_activity) || in_array('4',$selected_type_of_activity) || in_array('3',$selected_type_of_activity))
+ if($pd_master_details[0]['customer_segment_abbr'] == 'SE-AI' || $pd_master_details[0]['customer_segment_abbr'] == 'SE-DI')
{
- if(isset($business_form['export_import_cert']))
- {
- if(strtoupper($business_form['export_import_cert'])=='YES' && $business_form['export_import_cert_pic'] == "")
- {
- $certificate_count++;
+ #####Business Form Questions########
+ $business_form = (json_decode($form_data[13][0]['processed_json'],true));
+ //print_r($business_form);die();
+ //print_r(($business_form['shop_eat_act_cert']));die();
+ $is_manufacturing_selected = 0;
+ $selected_type_of_activity = array();
+ foreach ($business_form['select_business_activity_type'] as $key => $value) {
+ if($value['type_of_activity_id'] == 2){ $is_manufacturing_selected = 1; }
+ array_push($selected_type_of_activity,$value['type_of_activity_id']);
+
}
- } else { $certificate_count++; }
- }
-
-
- //If Business Type of activity is service Provider then check practice_cert certification
- if(in_array('5',$selected_type_of_activity))
- {
- if(isset($business_form['practice_cert']))
- {
- if(strtoupper($business_form['practice_cert'])=='YES' && (!isset($business_form['practice_cert_pic']) || $business_form['practice_cert_pic']== ""))
+ $is_name_board_seen = false;
+ if($business_form['was_the_company_name_board_sighted'] == "")
{
- $certificate_count++;
+ $incomplete_details[] = 'Business Section - Name Board Seen Not answered';
+
+ }
+ else if($business_form['was_the_company_name_board_sighted'] == "yes")
+ {
+ $is_name_board_seen = true;
}
- } //else { $certificate_count++; }
- //echo $certificate_count;die();
- }
-
-
- if($certificate_count){ $incomplete_details[] = 'Business Section - Images for Document Sighted Not Sufficient'; }
-
- }
-
- #####End of Business Form Questions########
- ########## Finance Form Questions################
+ if( !is_numeric($business_form['employees_temporary']) || !is_numeric($business_form['employees_permanent']) || !is_numeric($business_form['employees_appx_salary']) || !is_numeric($business_form['officer_total']))
+ {
+ $incomplete_details[] = 'Business Section - Company Employees Details Not Filled';
+ }
- if( $client != 'WEB')// if API came from web then ignore this check
- {
- $finance_form = isset($form_data[14][0]['processed_json'])?(json_decode($form_data[14][0]['processed_json'],true)):array();
- $finance_form_photo_count = isset($pd_images[14]) ? count($pd_images[14]) : 0;
- //print_r($finance_form);die();
- //print_r($pd_images[14]);die();
- if(!strcasecmp($finance_form['is_financial_statements'],'yes') && !($finance_form_photo_count) )
- {
- $incomplete_details[] = 'Financial Section - Financial Images Not captured';
- }
- }
-
- #####End of Finance Form Questions########
-
-
- #####Business Assets Form Questions########
- if( $client != 'WEB')// if API came from web then ignore this check
- {
- $business_assest_form = (json_decode($form_data[22][0]['processed_json'],true));
- $businees_assest_images_count = isset($pd_images[22]) ? count($pd_images[22]) : 0;
- //print_r($business_assest_form);die();
- if(array_key_exists('business_assets_details',$business_assest_form))
- {
- foreach($business_assest_form['business_assets_details'] as $value)
+ if( $client != 'WEB')// if API came from web then ignore this check
{
- if(isset($value['business_assets_mode']) && $value['business_assets_mode'] == 4 && !($businees_assest_images_count))
+ $certificate_count = 0;
+ $name_board_image_count = 0;
+
+ if(count($pd_images[13]))
+ {
+ foreach ($pd_images[13] as $key => $value) {
+ if(substr_count(strtolower($value['pd_document_title']),strtolower('Name board Seen')))
+ {
+ $name_board_image_count++;
+ }
+ }
+ }
+ if(!$name_board_image_count){ $incomplete_details[] = 'Busienss Section - Business Name Board Image not captured'; }
+
+
+ if(isset($business_form['shop_eat_act_cert']))
+ {
+ if(strtoupper($business_form['shop_eat_act_cert'])=='YES' && $business_form['shop_eat_act_cert_pic'] == "")
{
- $incomplete_details[] = 'Business Assets Section - Machinery Image';
+ $certificate_count++;
}
+ } else { $certificate_count++; }
+
+ if(isset($business_form['gst_Regn_cert']))
+ {
+ if(strtoupper($business_form['gst_Regn_cert'])=='YES' && $business_form['gst_Regn_cert_pic'] == "")
+ {
+ $certificate_count++;
+ }
+ } else { $certificate_count++; }
+
+
+ if(isset($business_form['pf_regn']))
+ {
+ if(strtoupper($business_form['pf_regn'])=='YES' && $business_form['pf_regn_pic'] == "")
+ {
+ $certificate_count++;
+ }
+ } else { $certificate_count++; }
+
+ if(isset($business_form['esic_regn']))
+ {
+ if(strtoupper($business_form['esic_regn'])=='YES' && $business_form['esic_regn_pic'] == "")
+ {
+ $certificate_count++;
+ }
+ } else { $certificate_count++; }
+
+
+
+ //If Business Type of activity is manufacturing then check these two certifications,
+ if(in_array('2',$selected_type_of_activity))// || in_array('4',$selected_type_of_activity))
+ {
+ if(isset($business_form['factory_cert']))
+ {
+ if(strtoupper($business_form['factory_cert'])=='YES' && $business_form['factory_cert_pic'] == "")
+ {
+ $certificate_count++;
+ }
+ } //else { $certificate_count++; }
+ }
- }
- }
- }
- #####End of Business Assets Form Questions########
-
- if($client != 'WEB')
- {
-
- #####supplier Form Questions########
- $supplier_form = isset($form_data[1][0]['processed_json'])?(json_decode($form_data[1][0]['processed_json'],true)):array();
- //print_r($supplier_form);die();
- $supplier_count = 0;
- $supplier_images = isset($pd_images[1]) ? $pd_images[1] : array();
- //print_r($pd_images[1]);die();
- if(!((count($business_form['select_business_activity_type']) == 1) && ($business_form['select_business_activity_type'][0]['type_of_activity_id'] == 5)))
- {
- if(count($supplier_form))
- {
-
- if(array_key_exists('manufacturing_details',$supplier_form))
- {
- if(isset($supplier_form['manufacturing_details'][0]['main_raw_materials']))
+ //If Business Type of activity is manufacturing,wholesale,retail then check
+ if(in_array('2',$selected_type_of_activity) || in_array('4',$selected_type_of_activity) || in_array('3',$selected_type_of_activity))
+ {
+ if(isset($business_form['export_import_cert']))
{
-
-
- foreach ($supplier_form['manufacturing_details'][0]['main_raw_materials'] as $manu_key => $manu_value)
+ if(strtoupper($business_form['export_import_cert'])=='YES' && $business_form['export_import_cert_pic'] == "")
{
-
-
- if($manu_value['manufacturing_raw_material_name'] != "" && $manu_value['manufacturing_supplier_name'] != "" && $manu_value['manufacturing_contact_person_name'] != "" && ($manu_value['manufacturing_contact_person_mobile_number'] != "" || $manu_value['person_landline'] != ""))
- {
- $supplier_count ++;
- $cureent_supplier_images_count = 0 ;
-
- //Images name check
- $supplier_name = $manu_value['manufacturing_supplier_name'].' - Raw Material '.($manu_key+1);
-
- if(count($supplier_images))
- {
- foreach ($supplier_images as $key => $value)
- {
- if( !strcasecmp($supplier_name, $value['pd_document_title']))
- {
- $cureent_supplier_images_count++;
- }
-
-
- }
- if($cureent_supplier_images_count < 2){ $incomplete_details[] = 'Supplier Section - '.$supplier_name.' - Image Not Sufficient.';}
- }
- else
- {
- $incomplete_details[] = 'Supplier Section - '.$supplier_name.' - Images Not Found';
- }
- }
- else
- {
- $incomplete_details[] = 'Supplier Section - Supplier (Raw Material '.($key+1).') Details not sufficient';
- }
+ $certificate_count++;
}
-
-
- }
- //echo 'IN manu-'.$supplier_count;
+ } else { $certificate_count++; }
}
-
-
-
- if(array_key_exists('trade_details',$supplier_form))
+
+ //If Business Type of activity is service Provider then check practice_cert certification
+ if(in_array('5',$selected_type_of_activity))
{
-
- if(isset($supplier_form['trade_details'][0]['trading_products']))
+ if(isset($business_form['practice_cert']))
{
-
- foreach ($supplier_form['trade_details'][0]['trading_products'] as $trading_key => $trading_value)
+ if(strtoupper($business_form['practice_cert'])=='YES' && (!isset($business_form['practice_cert_pic']) || $business_form['practice_cert_pic']== ""))
{
- if($trading_value['trade_product_name'] != "" && $trading_value['trade_supplier_name'] != "" && $trading_value['trade_product_contact_person_name'] != "" && ($trading_value['trade_product_contact_person_mobile_number'] != "" || $trading_value['person_landline'] != ""))
- {
- $supplier_count ++;
-
- $cureent_supplier_images_count = 0 ;
-
- //Images name check
- $supplier_name = $trading_value['trade_supplier_name'].' - Trading Product '.($trading_key+1);
- if(count($supplier_images))
- {
- foreach ($supplier_images as $key => $value)
- {
- if( !strcasecmp($supplier_name, $value['pd_document_title']))
- {
- $cureent_supplier_images_count++;
- }
- }
- if($cureent_supplier_images_count < 2){ $incomplete_details[] = 'Supplier Section - '.$supplier_name.' - Image Not Sufficient';}
- }
- else
- {
- $incomplete_details[] = 'Supplier Section - '.$supplier_name.' - Images Not Found';
- }
- }
- else if($trading_value['trade_product_name'] == "" && $trading_value['trade_supplier_name'] == "" && $trading_value['trade_product_contact_person_name'] != "" && ($trading_value['trade_product_contact_person_mobile_number'] == "" || $trading_value['person_landline'] == ""))
- {
-
- }
- else
- {
- $incomplete_details[] = 'Supplier Section - Supplier (Trading Product '.($key+1).') Details not sufficient';
- }
+ $certificate_count++;
}
-
-
- }
- //echo 'IN trade-'.$supplier_count;
+ } //else { $certificate_count++; }
+ //echo $certificate_count;die();
}
-
-
- }
-
- if(!$supplier_count){ $incomplete_details[] = 'Supplier Section - supplier informations not Sufficient'; }
- }
-
- //echo $score_questions['business']['minimum_supplier_info'];die();
- #####End of supplier Form Questions########
-
-
- #####client Form Questions########
- $client_form = isset($form_data[2][0]['processed_json'])?(json_decode($form_data[2][0]['processed_json'],true)):array();
- //print_r($client_form);die();
- $client_images = isset($pd_images[2]) ? $pd_images[2] : array();
- $client_count = 0;
- if(count($client_form))
- {
-
+ if($certificate_count){ $incomplete_details[] = 'Business Section - Images for Document Sighted Not Sufficient'; }
- if(array_key_exists('manufacturing_details',$client_form))
+ }
+
+ #####End of Business Form Questions########
+
+
+ ########## Finance Form Questions################
+
+ if( $client != 'WEB')// if API came from web then ignore this check
{
- if(isset($client_form['manufacturing_details'][0]['main_raw_materials']))
+ $finance_form = isset($form_data[14][0]['processed_json'])?(json_decode($form_data[14][0]['processed_json'],true)):array();
+ $finance_form_photo_count = isset($pd_images[14]) ? count($pd_images[14]) : 0;
+ //print_r($finance_form);die();
+ //print_r($pd_images[14]);die();
+ if(!strcasecmp($finance_form['is_financial_statements'],'yes') && !($finance_form_photo_count) )
{
-
- foreach ($client_form['manufacturing_details'][0]['main_raw_materials'] as $key => $value)
- {
- if($value['manufacturing_product_name'] != "" && $value['manufacturing_client_name'] != "" && $value['manufacturing_contact_person_name'] != "" && ($value['manufacturing_contact_person_mobile_number'] != "" || $value['person_landline'] != ""))
- {
- $client_count++;
- $current_client_images_count = 0 ;
-
- //Images name check
- $client_name = $value['manufacturing_client_name'].' - Manufacturing Product '.($key+1);
-
- if(count($client_images))
- {
- foreach ($client_images as $key => $value)
- {
- if( !strcasecmp($client_name, $value['pd_document_title']))
- {
- $current_client_images_count++;
- }
- }
- if($current_client_images_count < 2){ $incomplete_details[] = 'Client Section - '.$client_name.' - Image Not Sufficient';}
- }
- else
- {
- $incomplete_details[] = 'Client Section - '.$client_name .'- Images Not Found';
- }
-
- }
- else if($value['manufacturing_product_name'] == "" && $value['manufacturing_client_name'] == "" && $value['manufacturing_contact_person_name'] == "" && ($value['manufacturing_contact_person_mobile_number'] == "" || $value['person_landline'] == ""))
- {
-
- }
- else
- {
- $incomplete_details[] = 'Client Section - Client (Manufacturing Product '.($key+1).') Details not sufficient';
- }
- }
+ $incomplete_details[] = 'Financial Section - Financial Images Not captured';
}
}
+
+ #####End of Finance Form Questions########
- if(array_key_exists('trade_details',$client_form))
+
+ #####Business Assets Form Questions########
+ if( $client != 'WEB')// if API came from web then ignore this check
{
-
- if(isset($client_form['trade_details'][0]['trading_products']))
+ $business_assest_form = (json_decode($form_data[22][0]['processed_json'],true));
+ $businees_assest_images_count = isset($pd_images[22]) ? count($pd_images[22]) : 0;
+ //print_r($business_assest_form);die();
+ if(array_key_exists('business_assets_details',$business_assest_form))
{
- foreach ($client_form['trade_details'][0]['trading_products'] as $key => $value)
+ foreach($business_assest_form['business_assets_details'] as $value)
{
- //print_r($value);die();
- if($value['trade_product_name'] != "" && (isset($value['trade_client_name'])) && $value['trade_client_name'] != "" && $value['trade_product_contact_person_name'] != "" && ($value['trade_product_contact_person_mobile_number'] != "" || $value['person_landline'] != ""))
+ if(isset($value['business_assets_mode']) && $value['business_assets_mode'] == 4 && !($businees_assest_images_count))
{
- $client_count++;
- $current_client_images_count = 0 ;
-
- //Images name check
- $client_name = $value['trade_client_name'].' - Trading Product '.($key+1);
-
- if(count($client_images))
- {
- foreach ($client_images as $key => $value)
- {
- if( !strcasecmp($client_name, $value['pd_document_title']))
- {
- $current_client_images_count++;
- }
- }
- if($current_client_images_count < 2){ $incomplete_details[] = 'Client Section - '.$client_name.' - Image Not Sufficient';}
- }
- else
- {
- $incomplete_details[] = 'Client Section - '.$client_name .'- Images Not Found';
- }
+ $incomplete_details[] = 'Business Assets Section - Machinery Image';
}
- else if($value['trade_product_name'] == "" && (isset($value['trade_client_name'])) && $value['trade_client_name'] == "" && $value['trade_product_contact_person_name'] == "" && ($value['trade_product_contact_person_mobile_number'] == "" || $value['person_landline'] == ""))
- {
-
- }
- else
- {
- $incomplete_details[] = 'Client Section - Client (Trading Product '.($key+1).') Details not sufficient';
- }
- }
-
- }
- }
-
- if(array_key_exists('service_provider_details',$client_form))
- {
- if(isset($client_form['service_provider_details'][0]['service_products']))
- {
- foreach ($client_form['service_provider_details'][0]['service_products'] as $key => $value)
- {
-
- if($value['service_provider_product_name'] != "" && $value['service_provider_client_name'] != "" && $value['service_provider_product_contact_person_name'] != "" && ($value['service_provider_product_contact_person_mobile_number'] != "" || $value['person_landline'] != ""))
- {
- $client_count++;
- $current_client_images_count = 0 ;
-
- //Images name check
- $client_name = $value['service_provider_client_name'].' - Service Provider '.($key+1);
-
- if(count($client_images))
- {
- foreach ($client_images as $key => $value)
- {
- if( !strcasecmp($client_name, $value['pd_document_title']))
- {
- $current_client_images_count++;
- }
- }
- if($current_client_images_count < 2){ $incomplete_details[] = 'Client Section - '.$client_name.' - Image Not Sufficient';}
- }
- else
- {
- $incomplete_details[] ='Client Section - ' .$client_name .'- Images Not Found';
- }
-
- }
- else if($value['service_provider_product_name'] == "" && $value['service_provider_client_name'] == "" && $value['service_provider_product_contact_person_name'] == "" && ($value['service_provider_product_contact_person_mobile_number'] == "" || $value['person_landline'] == ""))
- {
-
- }
- else
- {
- $incomplete_details[] = 'Client Section - Client (Service Provider '.($key+1).') Details not sufficient';
- }
- }
-
- }
- }
-
- }
-
- #####End of client Form Questions########
-
-
- #####Stock Form Questions########
- $stock_form = isset($form_data[11][0]['processed_json'])?(json_decode($form_data[11][0]['processed_json'],true)):array();
- //print_r($stock_form);
- if(count($stock_form))
- {
- //print_r($stock_form);die();
- if(isset($stock_form['manufacturing_details']) && ($stock_form['manufacturing_details'] != null || $stock_form['manufacturing_details'] != ""))
- {
-
- // if( strcasecmp($stock_form['manufacturing_details'][0]['is_sufficiant_raw'],'not applicable') && strcasecmp($stock_form['is_sufficiant_finished_and_traded_goods'],'not applicable'))
- // {
- // echo 'Yes';
- // // if( !(isset($pd_images[11][0]) ))//&& !count($pd_images[11][0])) )
- // // {
- // // $incomplete_details[] = 'Stock Form - Images not sufficient';
- // // }
- // }
- // else
- // {
- $total_stock_observed = 0;
-
- if( isset($stock_form['manufacturing_details'][0]['manufacturing_raw_materials']) && count($stock_form['manufacturing_details'][0]['manufacturing_raw_materials']))
- {
- foreach ($stock_form['manufacturing_details'][0]['manufacturing_raw_materials'] as $key => $value)
- {
- //echo strcasecmp($value['stock_observed'],'no');die();
-
- if((strcasecmp($value['stock_observed'],'no'))) { $total_stock_observed++; }
-
- }
- }
-
-
- if( isset($stock_form['manufacturing_details'][0]['manufacturing_finished_goods']) && count($stock_form['manufacturing_details'][0]['manufacturing_finished_goods']))
- {
- foreach ($stock_form['manufacturing_details'][0]['manufacturing_finished_goods'] as $key => $value)
- {
- if((strcasecmp($value['goods_observed'],'no'))) { $total_stock_observed++; }
-
- }
- }
-
-
- if( isset($stock_form['retail_details'][0]['retail_traded_goods']) && count($stock_form['retail_details'][0]['retail_traded_goods']))
- {
- foreach ($stock_form['retail_details'][0]['retail_traded_goods'] as $key => $value)
- {
- if((strcasecmp($value['traded_goods_observed'],'no'))) { $total_stock_observed++; }
-
- }
- }
-
- if( isset($stock_form['trade_details'][0]['trading_traded_goods']) && count($stock_form['trade_details'][0]['trading_traded_goods']))
- {
- foreach ($stock_form['trade_details'][0]['trading_traded_goods'] as $key => $value)
- {
- if((strcasecmp($value['traded_goods_observed'],'no'))) { $total_stock_observed++; }
-
- }
- }
-
- if( $total_stock_observed != 0 && !(count($pd_images[11])))//&& !count($pd_images[11][0])) )
- {
- $incomplete_details[] = 'Stock Section - Images not sufficient. Available Images - '.(count($pd_images[11]) ? count($pd_images[11]) : 0);
- }
- //}
+ }
}
+ }
+ #####End of Business Assets Form Questions########
+
+ if($client != 'WEB')
+ {
+
+ #####supplier Form Questions########
+ $supplier_form = isset($form_data[1][0]['processed_json'])?(json_decode($form_data[1][0]['processed_json'],true)):array();
+ //print_r($supplier_form);die();
+ $supplier_count = 0;
+ $supplier_images = isset($pd_images[1]) ? $pd_images[1] : array();
+ //print_r($pd_images[1]);die();
+ if(!((count($business_form['select_business_activity_type']) == 1) && ($business_form['select_business_activity_type'][0]['type_of_activity_id'] == 5)))
+ {
+ if(count($supplier_form))
+ {
+ if(array_key_exists('manufacturing_details',$supplier_form))
+ {
+ if(isset($supplier_form['manufacturing_details'][0]['main_raw_materials']))
+ {
+
+
+ foreach ($supplier_form['manufacturing_details'][0]['main_raw_materials'] as $manu_key => $manu_value)
+ {
+
+
+ if($manu_value['manufacturing_raw_material_name'] != "" && $manu_value['manufacturing_supplier_name'] != "" && $manu_value['manufacturing_contact_person_name'] != "" && ($manu_value['manufacturing_contact_person_mobile_number'] != "" || $manu_value['person_landline'] != ""))
+ {
+ $supplier_count ++;
+ $cureent_supplier_images_count = 0 ;
+
+ //Images name check
+ $supplier_name = $manu_value['manufacturing_supplier_name'].' - Raw Material '.($manu_key+1);
+
+ if(count($supplier_images))
+ {
+ foreach ($supplier_images as $key => $value)
+ {
+ if( !strcasecmp($supplier_name, $value['pd_document_title']))
+ {
+ $cureent_supplier_images_count++;
+ }
+
+
+ }
+ if($cureent_supplier_images_count < 2){ $incomplete_details[] = 'Supplier Section - '.$supplier_name.' - Image Not Sufficient.';}
+ }
+ else
+ {
+ $incomplete_details[] = 'Supplier Section - '.$supplier_name.' - Images Not Found';
+ }
+ }
+ else
+ {
+ $incomplete_details[] = 'Supplier Section - Supplier (Raw Material '.($key+1).') Details not sufficient';
+ }
+ }
+
+
+ }
+ //echo 'IN manu-'.$supplier_count;
+ }
+
+
+
+
+ if(array_key_exists('trade_details',$supplier_form))
+ {
+
+ if(isset($supplier_form['trade_details'][0]['trading_products']))
+ {
+
+ foreach ($supplier_form['trade_details'][0]['trading_products'] as $trading_key => $trading_value)
+ {
+ if($trading_value['trade_product_name'] != "" && $trading_value['trade_supplier_name'] != "" && $trading_value['trade_product_contact_person_name'] != "" && ($trading_value['trade_product_contact_person_mobile_number'] != "" || $trading_value['person_landline'] != ""))
+ {
+ $supplier_count ++;
+
+ $cureent_supplier_images_count = 0 ;
+
+ //Images name check
+ $supplier_name = $trading_value['trade_supplier_name'].' - Trading Product '.($trading_key+1);
+ if(count($supplier_images))
+ {
+ foreach ($supplier_images as $key => $value)
+ {
+ if( !strcasecmp($supplier_name, $value['pd_document_title']))
+ {
+ $cureent_supplier_images_count++;
+ }
+ }
+ if($cureent_supplier_images_count < 2){ $incomplete_details[] = 'Supplier Section - '.$supplier_name.' - Image Not Sufficient';}
+ }
+ else
+ {
+ $incomplete_details[] = 'Supplier Section - '.$supplier_name.' - Images Not Found';
+ }
+ }
+ else if($trading_value['trade_product_name'] == "" && $trading_value['trade_supplier_name'] == "" && $trading_value['trade_product_contact_person_name'] != "" && ($trading_value['trade_product_contact_person_mobile_number'] == "" || $trading_value['person_landline'] == ""))
+ {
+
+ }
+ else
+ {
+ $incomplete_details[] = 'Supplier Section - Supplier (Trading Product '.($key+1).') Details not sufficient';
+ }
+ }
+
+
+ }
+ //echo 'IN trade-'.$supplier_count;
+ }
+
+
+
+
+ }
+
+ if(!$supplier_count){ $incomplete_details[] = 'Supplier Section - supplier informations not Sufficient'; }
+ }
+
+ //echo $score_questions['business']['minimum_supplier_info'];die();
+ #####End of supplier Form Questions########
+
+
+ #####client Form Questions########
+ $client_form = isset($form_data[2][0]['processed_json'])?(json_decode($form_data[2][0]['processed_json'],true)):array();
+ //print_r($client_form);die();
+ $client_images = isset($pd_images[2]) ? $pd_images[2] : array();
+ $client_count = 0;
+ if(count($client_form))
+ {
+
+
+ if(array_key_exists('manufacturing_details',$client_form))
+ {
+ if(isset($client_form['manufacturing_details'][0]['main_raw_materials']))
+ {
+
+ foreach ($client_form['manufacturing_details'][0]['main_raw_materials'] as $key => $value)
+ {
+ if($value['manufacturing_product_name'] != "" && $value['manufacturing_client_name'] != "" && $value['manufacturing_contact_person_name'] != "" && ($value['manufacturing_contact_person_mobile_number'] != "" || $value['person_landline'] != ""))
+ {
+ $client_count++;
+ $current_client_images_count = 0 ;
+
+ //Images name check
+ $client_name = $value['manufacturing_client_name'].' - Manufacturing Product '.($key+1);
+
+ if(count($client_images))
+ {
+ foreach ($client_images as $key => $value)
+ {
+ if( !strcasecmp($client_name, $value['pd_document_title']))
+ {
+ $current_client_images_count++;
+ }
+ }
+ if($current_client_images_count < 2){ $incomplete_details[] = 'Client Section - '.$client_name.' - Image Not Sufficient';}
+ }
+ else
+ {
+ $incomplete_details[] = 'Client Section - '.$client_name .'- Images Not Found';
+ }
+
+ }
+ else if($value['manufacturing_product_name'] == "" && $value['manufacturing_client_name'] == "" && $value['manufacturing_contact_person_name'] == "" && ($value['manufacturing_contact_person_mobile_number'] == "" || $value['person_landline'] == ""))
+ {
+
+ }
+ else
+ {
+ $incomplete_details[] = 'Client Section - Client (Manufacturing Product '.($key+1).') Details not sufficient';
+ }
+ }
+ }
+ }
+
+ if(array_key_exists('trade_details',$client_form))
+ {
+
+ if(isset($client_form['trade_details'][0]['trading_products']))
+ {
+
+ foreach ($client_form['trade_details'][0]['trading_products'] as $key => $value)
+ {
+ //print_r($value);die();
+ if($value['trade_product_name'] != "" && (isset($value['trade_client_name'])) && $value['trade_client_name'] != "" && $value['trade_product_contact_person_name'] != "" && ($value['trade_product_contact_person_mobile_number'] != "" || $value['person_landline'] != ""))
+ {
+ $client_count++;
+ $current_client_images_count = 0 ;
+
+ //Images name check
+ $client_name = $value['trade_client_name'].' - Trading Product '.($key+1);
+
+ if(count($client_images))
+ {
+ foreach ($client_images as $key => $value)
+ {
+ if( !strcasecmp($client_name, $value['pd_document_title']))
+ {
+ $current_client_images_count++;
+ }
+ }
+ if($current_client_images_count < 2){ $incomplete_details[] = 'Client Section - '.$client_name.' - Image Not Sufficient';}
+ }
+ else
+ {
+ $incomplete_details[] = 'Client Section - '.$client_name .'- Images Not Found';
+ }
+ }
+ else if($value['trade_product_name'] == "" && (isset($value['trade_client_name'])) && $value['trade_client_name'] == "" && $value['trade_product_contact_person_name'] == "" && ($value['trade_product_contact_person_mobile_number'] == "" || $value['person_landline'] == ""))
+ {
+
+ }
+ else
+ {
+ $incomplete_details[] = 'Client Section - Client (Trading Product '.($key+1).') Details not sufficient';
+ }
+ }
+
+ }
+ }
+
+ if(array_key_exists('service_provider_details',$client_form))
+ {
+ if(isset($client_form['service_provider_details'][0]['service_products']))
+ {
+ foreach ($client_form['service_provider_details'][0]['service_products'] as $key => $value)
+ {
+
+ if($value['service_provider_product_name'] != "" && $value['service_provider_client_name'] != "" && $value['service_provider_product_contact_person_name'] != "" && ($value['service_provider_product_contact_person_mobile_number'] != "" || $value['person_landline'] != ""))
+ {
+ $client_count++;
+ $current_client_images_count = 0 ;
+
+ //Images name check
+ $client_name = $value['service_provider_client_name'].' - Service Provider '.($key+1);
+
+ if(count($client_images))
+ {
+ foreach ($client_images as $key => $value)
+ {
+ if( !strcasecmp($client_name, $value['pd_document_title']))
+ {
+ $current_client_images_count++;
+ }
+ }
+ if($current_client_images_count < 2){ $incomplete_details[] = 'Client Section - '.$client_name.' - Image Not Sufficient';}
+ }
+ else
+ {
+ $incomplete_details[] ='Client Section - ' .$client_name .'- Images Not Found';
+ }
+
+ }
+ else if($value['service_provider_product_name'] == "" && $value['service_provider_client_name'] == "" && $value['service_provider_product_contact_person_name'] == "" && ($value['service_provider_product_contact_person_mobile_number'] == "" || $value['person_landline'] == ""))
+ {
+
+ }
+ else
+ {
+ $incomplete_details[] = 'Client Section - Client (Service Provider '.($key+1).') Details not sufficient';
+ }
+ }
+
+ }
+ }
+
+ }
+
+ #####End of client Form Questions########
+
+
+ #####Stock Form Questions########
+ $stock_form = isset($form_data[11][0]['processed_json'])?(json_decode($form_data[11][0]['processed_json'],true)):array();
+ //print_r($stock_form);
+ if(count($stock_form))
+ {
+ //print_r($stock_form);die();
+ if(isset($stock_form['manufacturing_details']) && ($stock_form['manufacturing_details'] != null || $stock_form['manufacturing_details'] != ""))
+ {
+
+ // if( strcasecmp($stock_form['manufacturing_details'][0]['is_sufficiant_raw'],'not applicable') && strcasecmp($stock_form['is_sufficiant_finished_and_traded_goods'],'not applicable'))
+ // {
+ // echo 'Yes';
+ // // if( !(isset($pd_images[11][0]) ))//&& !count($pd_images[11][0])) )
+ // // {
+ // // $incomplete_details[] = 'Stock Form - Images not sufficient';
+ // // }
+ // }
+ // else
+ // {
+
+ $total_stock_observed = 0;
+
+ if( isset($stock_form['manufacturing_details'][0]['manufacturing_raw_materials']) && count($stock_form['manufacturing_details'][0]['manufacturing_raw_materials']))
+ {
+ foreach ($stock_form['manufacturing_details'][0]['manufacturing_raw_materials'] as $key => $value)
+ {
+ //echo strcasecmp($value['stock_observed'],'no');die();
+
+ if((strcasecmp($value['stock_observed'],'no'))) { $total_stock_observed++; }
+
+ }
+ }
+
+
+ if( isset($stock_form['manufacturing_details'][0]['manufacturing_finished_goods']) && count($stock_form['manufacturing_details'][0]['manufacturing_finished_goods']))
+ {
+ foreach ($stock_form['manufacturing_details'][0]['manufacturing_finished_goods'] as $key => $value)
+ {
+ if((strcasecmp($value['goods_observed'],'no'))) { $total_stock_observed++; }
+
+ }
+ }
+
+
+ if( isset($stock_form['retail_details'][0]['retail_traded_goods']) && count($stock_form['retail_details'][0]['retail_traded_goods']))
+ {
+ foreach ($stock_form['retail_details'][0]['retail_traded_goods'] as $key => $value)
+ {
+ if((strcasecmp($value['traded_goods_observed'],'no'))) { $total_stock_observed++; }
+
+ }
+ }
+
+ if( isset($stock_form['trade_details'][0]['trading_traded_goods']) && count($stock_form['trade_details'][0]['trading_traded_goods']))
+ {
+ foreach ($stock_form['trade_details'][0]['trading_traded_goods'] as $key => $value)
+ {
+ if((strcasecmp($value['traded_goods_observed'],'no'))) { $total_stock_observed++; }
+
+ }
+ }
+
+ if( $total_stock_observed != 0 && !(count($pd_images[11])))//&& !count($pd_images[11][0])) )
+ {
+ $incomplete_details[] = 'Stock Section - Images not sufficient. Available Images - '.(count($pd_images[11]) ? count($pd_images[11]) : 0);
+ }
+ //}
+ }
+
+ }
+ }// end of CS - SE
+ else if($pd_master_details[0]['customer_segment_abbr'] == 'SAL-CASH' || $pd_master_details[0]['customer_segment_abbr'] == 'SAL-CHQ')
+ {
+ //have to check salary information form
+ }
+ else if(($pd_master_details[0]['customer_segment_abbr'] == 'SE-RI')
+ {
+ //have to check rental information form
}
}
diff --git a/api/application/helpers/pdalerts_helper.php b/api/application/helpers/pdalerts_helper.php
index 90dc2e9c..fbc1b037 100644
--- a/api/application/helpers/pdalerts_helper.php
+++ b/api/application/helpers/pdalerts_helper.php
@@ -22,14 +22,14 @@ class PDALERTS
//echo $pdid;
$CI =&get_instance();
//$CI->load->library('AWS_SNS');
- //$CI->load->library('Phpmailer_library');
+ $CI->load->helper('push_notification');
$pd_notification_configs = array();
//die();
/*********************************************/
/*******Get PD Master Details*****************/
/*********************************************/
- $CI->db->SELECT("PDTRIGGER.fk_lender_id,ENTITY.short_name,PDTRIGGER.lender_applicant_id,PDTRIGGER.fk_pd_type,PDTRIGGER.pd_status,PDTRIGGER.pd_date_of_initiation,PDTRIGGER.scheduled_on,PDTRIGGER.updatedon,PDTRIGGER.fk_pd_allocated_to,ALLOCATED.email as allocated_email,ALLOCATED.mobile_no as allocated_mobile_no,concat(ALLOCATED.first_name,' ',ALLOCATED.last_name) as pdofficer_name,PDTRIGGER.executive_id,EXECUTIVE.email as executive_email,EXECUTIVE.mobile_no as executive_mobile_no,PDTRIGGER.central_pd_officer_id,CENTRALPDOFFICER.mobile_no as centralpdofficer_mobile_no,CENTRALPDOFFICER.email as centralpdofficer_mail,PDTRIGGER.pd_agency_id,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,CREATED.fk_entity_type_id,CREATED.email as created_email,PDTRIGGER.pd_contact_person_mail,PDAPPLICANTSDETAILS.applicant_name,PDAPPLICANTSDETAILS.mobile_no as customer_mobile_no,PDTRIGGER.encrypted_url,");
+ $CI->db->SELECT("PDTRIGGER.fk_lender_id,ENTITY.short_name,PDTRIGGER.lender_applicant_id,PDTRIGGER.fk_pd_type,PDTRIGGER.pd_status,PDTRIGGER.pd_date_of_initiation,PDTRIGGER.scheduled_on,PDTRIGGER.updatedon,PDTRIGGER.fk_pd_allocated_to,ALLOCATED.email as allocated_email,ALLOCATED.mobile_no as allocated_mobile_no,concat(ALLOCATED.first_name,' ',ALLOCATED.last_name) as pdofficer_name,PDTRIGGER.executive_id,EXECUTIVE.email as executive_email,EXECUTIVE.mobile_no as executive_mobile_no,PDTRIGGER.central_pd_officer_id,CENTRALPDOFFICER.mobile_no as centralpdofficer_mobile_no,CENTRALPDOFFICER.email as centralpdofficer_mail,PDTRIGGER.pd_agency_id,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,CREATED.fk_entity_type_id,CREATED.email as created_email,PDTRIGGER.pd_contact_person_mail,PDAPPLICANTSDETAILS.applicant_name,PDAPPLICANTSDETAILS.mobile_no as customer_mobile_no,PDTRIGGER.encrypted_url,PDOFFICER.web_token as pdofficer_webtoken,PDOFFICER.mob_token as pdofficer_mobtoken,PDEXECUTIVE.web_token as pdexecutive_webtoken,PDEXECUTIVE.mob_token as pdexecutive_mobtoken,CENTRALPDOFFICERTOKEN.web_token as centralpdofficer_webtoken,CENTRALPDOFFICERTOKEN.mob_token as centralpdofficer_mobtoken");
$CI->db->FROM(PDTRIGGER." as PDTRIGGER");
$CI->db->JOIN(USERPROFILE." as CREATED","PDTRIGGER.fk_createdby = CREATED.userid",'LEFT');
$CI->db->JOIN(ENTITY." as ENTITY","PDTRIGGER.fk_lender_id = ENTITY.entity_id",'LEFT');
@@ -37,12 +37,15 @@ class PDALERTS
$CI->db->JOIN(USERPROFILE." as EXECUTIVE","PDTRIGGER.executive_id = EXECUTIVE.userid",'LEFT');
$CI->db->JOIN(USERPROFILE." as CENTRALPDOFFICER","PDTRIGGER.central_pd_officer_id = CENTRALPDOFFICER.userid",'LEFT');
$CI->db->JOIN(PDAPPLICANTSDETAILS." as PDAPPLICANTSDETAILS","PDTRIGGER.pd_id = PDAPPLICANTSDETAILS.fk_pd_id AND PDAPPLICANTSDETAILS.applicant_type = 1",'LEFT');
+ $CI->db->JOIN(USERNOTIFICATIONTOKENS." as PDOFFICER","PDTRIGGER.fk_pd_allocated_to = PDOFFICER.fk_userid",'LEFT');
+ $CI->db->JOIN(USERNOTIFICATIONTOKENS." as PDEXECUTIVE","PDTRIGGER.executive_id = PDEXECUTIVE.fk_userid",'LEFT');
+ $CI->db->JOIN(USERNOTIFICATIONTOKENS." as CENTRALPDOFFICERTOKEN","PDTRIGGER.central_pd_officer_id = CENTRALPDOFFICERTOKEN.fk_userid",'LEFT');
$CI->db->WHERE("PDTRIGGER.pd_id",$pdid);
$core_details = $CI->db->GET()->result_array();
//print_r($core_details);
-
+ //die();
if(count($core_details))
{
@@ -147,6 +150,18 @@ class PDALERTS
self::sendMail($CI,$lender_email,$msg,$core_details);
}
}
+
+
+
+ /*********************************************/
+ /*******Send Push Notification to Lender(WEB/MOB)***** HOLDED TEMPORARY/
+ /*********************************************/
+ if($pd_notification_configs[0]['app_lender'] == 1)
+ {
+ $lender_web_token = (string)$core_details[0]['pd_contact_mobileno'];
+ $lender_mob_token = (string)$core_details[0]['pd_contact_mobileno'];
+ $pd_status = $core_details[0]['pd_status'];
+ }
@@ -173,6 +188,24 @@ class PDALERTS
+ }
+
+ /*********************************************/
+ /*******Send Push Notification to PD Officer*****/
+ /*********************************************/
+ if($pd_notification_configs[0]['app_pdofficer'] == 1)
+ {
+ $pd_status = $core_details[0]['pd_status'];
+ $pd_offcier_web_token = $core_details[0]['pdofficer_webtoken'];
+ $pd_offcier_mob_token = $core_details[0]['pdofficer_mobtoken'];
+ $pd_executive_mob_token = $core_details[0]['pdexecutive_mobtoken'];
+ $pd_executive_web_token = $core_details[0]['pdexecutive_webtoken'];
+ $msg = $pd_notification_msg[0]['pdofficer'];
+ $msg = self::stringReplace($msg,$core_details);
+
+ PUSH_NOTIFICATION::sendNotification($pd_offcier_mob_token,$pd_offcier_web_token,$pd_status,$msg);
+ PUSH_NOTIFICATION::sendNotification($pd_executive_mob_token,$pd_executive_web_token,$pd_status,$msg);
+
}
/*********************************************/
@@ -207,6 +240,18 @@ class PDALERTS
}
}
}
+
+
+ /*********************************************/
+ /**Send Push Notification to Central PD Officer**/
+ /*********************************************/
+ if($pd_notification_configs[0]['app_pdincharge'] == 1)
+ {
+ $pd_status = $core_details[0]['pd_status'];
+ $central_offcier_web_token = $core_details[0]['centralpdofficer_webtoken'];
+ $central_offcier_mob_token = $core_details[0]['centralpdofficer_mobtoken'];
+ PUSH_NOTIFICATION::sendNotification($central_offcier_mob_token,$central_offcier_web_token,$pd_status);
+ }
/*********************************************/
@@ -241,6 +286,51 @@ class PDALERTS
}
}
}
+
+
+ /*********************************************/
+ /**Send PUSH Notification to QC Team*****/
+ /*********************************************/
+ if($pd_notification_configs[0]['app_qcteam'] == 1)
+ {
+ $CI->db->DISTINCT();
+ $CI->db->SELECT("web_token,mob_token");
+ $CI->db->FROM(USERNOTIFICATIONTOKENS." as USERNOTIFICATIONTOKENS");
+ //$CI->db->FROM(USERPROFILE." as USERPROFILE");
+ $CI->db->JOIN(USERPROFILEROLES." as USERPROFILEROLES","USERPROFILEROLES.fk_userid = USERNOTIFICATIONTOKENS.fk_user_id AND USERPROFILEROLES.isactive = 1",'LEFT');
+ $CI->db->WHERE("USERPROFILEROLES.user_role",6);//QC Manager
+ $CI->db->OR_WHERE("USERPROFILEROLES.user_role",7);//QC Officer
+ $qcteam_push_tokens = $CI->db->GET()->result_array();
+
+ if(count($qcteam_push_tokens))
+ {
+ $qc_team_web_token = array();
+ $qc_team_mob_token = array();
+ $pd_status = $core_details[0]['pd_status'];
+ foreach($qcteam_push_tokens as $token)
+ {
+ if(isset($token['web_token']) && ($token['web_token'] != "" || $token['web_token'] != null))
+ {
+ array_push($qc_team_web_token,$token['web_token']);
+ }
+ if(isset($token['mob_token']) && ($token['mob_token'] != "" || $token['mob_token'] != null))
+ {
+ array_push($qc_team_mob_token,$token['mob_token']);
+ }
+
+ }
+
+ foreach ($qc_team_web_token as $key => $value) {
+ PUSH_NOTIFICATION::sendNotification($value,null,$pd_status);
+ }
+
+ foreach ($qc_team_mob_token as $key => $value) {
+ PUSH_NOTIFICATION::sendNotification(null,$value,$pd_status);
+ }
+
+
+ }
+ }
}
diff --git a/api/application/helpers/push_notification_helper.php b/api/application/helpers/push_notification_helper.php
new file mode 100644
index 00000000..52f320db
--- /dev/null
+++ b/api/application/helpers/push_notification_helper.php
@@ -0,0 +1,84 @@
+ $msg,
+ 'title'=> $msg,
+ 'subtitle'=> $msg,
+ 'tickerText'=> $msg,
+ 'vibrate'=>1,
+ 'sound'=>1,
+ 'largeIcon'=>'large_icon',
+ 'smallIcon'=>'small_icon'
+ );
+
+ self::dispatchNotification(array($web_token),$app_msg,1);
+ }
+
+ public static function notifyMob($mob_token,$pd_status,$msg)
+ {
+ $web_msg = array
+ (
+
+ 'title'=> $msg,
+ 'body'=> $msg,
+ 'icon' => 'https://ssa.sineedge.com/logo/sinelogo.png',
+ 'img' => ''
+ );
+
+ self::dispatchNotification(array($mob_token),$web_msg,2);
+
+ }
+
+ public static function dispatchNotification($token,$msg,$type)
+ {
+ $fields = array
+ ('registration_ids'=>$token,
+ //'data'=>$app_msg,
+ 'notification' => $msg
+ );
+
+ $headers = array
+ ('Authorization: key=' . FIREBASE_PUSH_NOTIFICATION_SERVER_API_KEY,
+ 'Content-Type: application/json'
+ );
+ $ch = curl_init();
+ curl_setopt( $ch,CURLOPT_URL, 'https://fcm.googleapis.com/fcm/send' );
+ curl_setopt( $ch,CURLOPT_POST, true );
+ curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
+ curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );
+ curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, true );
+ curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ));
+
+ $result = curl_exec($ch );
+ curl_close( $ch );
+ $CI =&get_instance();
+ MYLOG::logFunction()->info("PUSH NOTIFICATION ",$result);
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php
index ddb56641..8f17df10 100644
--- a/api/application/models/PD_Model.php
+++ b/api/application/models/PD_Model.php
@@ -14,7 +14,7 @@ class PD_Model extends SPARQ_Model {
public function listLessPDDetails($page,$limit,$sort,$pdofficerid,$datetype,$fdate,$tdate,$lenderid,$status)// $page represents mysql offset
{
//echo $status;die();
- $this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.fk_lender_id,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, 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 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');
+ $this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.fk_lender_id,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, 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 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');
$this->db->FROM(PDTRIGGER.' as PDTRIGGER');
$this->db->JOIN(ENTITY.' as ENTITY','PDTRIGGER.fk_lender_id = ENTITY.entity_id','LEFT');
$this->db->JOIN(ENTITYBILLING.' as ENTITYBILLING','PDTRIGGER.fk_entity_billing_id = ENTITYBILLING.entity_billing_id','LEFT');
@@ -753,7 +753,7 @@ class PD_Model extends SPARQ_Model {
/*
*Get PD Master Details.
*/
- public function getPDMasterDetails($pdid)
+ public function getPDMasterDetails($pdid,$random_string = null)
{
$this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.fk_lender_id,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.pd_date_of_initiation as pd_date_of_initiation_sqlformat, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, 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.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,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');
$this->db->FROM(PDTRIGGER.' as PDTRIGGER');
@@ -781,11 +781,16 @@ class PD_Model extends SPARQ_Model {
$this->db->JOIN(ENTITYLENDERBRANCH.' as ENTITYLENDERBRANCH','PDTRIGGER.pd_branch_id = ENTITYLENDERBRANCH.entity_lender_branch_id','LEFT');
$this->db->JOIN(TITLES.' as TITLES','PDAPPLICANTSDETAILS.applicant_title_name = TITLES.title_id','LEFT');
$this->db->WHERE('PDTRIGGER.pd_id',$pdid);
+ if($random_string != null)
+ {
+ $this->db->WHERE('PDTRIGGER.random_string',$random_string);
+ }
// $this->db->ORDER_BY('PDTRIGGER.pd_id',$sort);
// $this->db->LIMIT($limit,$page);
$result_array = $this->db->GET()->result_array();
+ //print_r($this->db->last_query());die();
$mandatory_fields = array();
if(count($result_array))
{
@@ -861,18 +866,18 @@ class PD_Model extends SPARQ_Model {
return $this->db->GET()->result_array();
}
- public function getTemplateForPD($pdid,$client)
+ public function getTemplateForPD($pdid,$client,$random_string)
{
-
+
$template_id = "";
// $categories = "";
// $overall_answered_count = 0;
// $overall_question_count = 0;
//Get PD Master Details including Template id @param $pd_id
- $pd_master_detials = $this->getPDMasterDetails($pdid);
-
+ $pd_master_detials = $this->getPDMasterDetails($pdid,$random_string);
+
// $addtional_pd_ids = $this->PD_Model->getAddtioonalPDIDs($pdid);
// $addtional_pd_ids_string = null;
@@ -1688,7 +1693,7 @@ class PD_Model extends SPARQ_Model {
public function getAddtionalPDInformations($addressid)
{
- $this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.fk_lender_id,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, 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 %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.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,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDTRIGGER.pd_contact_landline,PDTRIGGER.other_pincode,PDTRIGGER.is_otp_done,PDTRIGGER.encrypted_url,PDTRIGGER.is_child,PDTRIGGER.parent_pd_id,PDTRIGGER.fk_primary_address_id,PDTRIGGER.fk_address_id');
+ $this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.fk_lender_id,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, 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 %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.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,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDTRIGGER.pd_contact_landline,PDTRIGGER.other_pincode,PDTRIGGER.is_otp_done,PDTRIGGER.encrypted_url,PDTRIGGER.is_child,PDTRIGGER.parent_pd_id,PDTRIGGER.fk_primary_address_id,PDTRIGGER.fk_address_id,PDTRIGGER.random_string');
$this->db->FROM(PDTRIGGER.' as PDTRIGGER');
$this->db->JOIN(ENTITY.' as ENTITY','PDTRIGGER.fk_lender_id = ENTITY.entity_id ','LEFT');
$this->db->JOIN(ENTITYBILLING.' as ENTITYBILLING','PDTRIGGER.fk_entity_billing_id = ENTITYBILLING.entity_billing_id','LEFT');
diff --git a/api/application/views/report_templates/JSONTOREPORT.php b/api/application/views/report_templates/JSONTOREPORT.php
index a70adb40..fbd2349c 100644
--- a/api/application/views/report_templates/JSONTOREPORT.php
+++ b/api/application/views/report_templates/JSONTOREPORT.php
@@ -1270,7 +1270,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
if(($businessRow['employees_permanent'] != "" && $businessRow['employees_permanent'] == 0) && ($businessRow['employees_temporary'] != "" && $businessRow['employees_temporary'] == 0))
{
- $bindEachResult['company_employees']= 'There are no permanant and temporary employees with company.';
+ $bindEachResult['company_employees']= 'As per loan applicant met, there are no permanent or temporary employees with the company.';
}
if(isset($businessRow['officer_total']) && $businessRow['officer_total'] > 0)