diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php
index b8064410..de6f9b17 100644
--- a/api/application/controllers/PD_Controller.php
+++ b/api/application/controllers/PD_Controller.php
@@ -5007,11 +5007,12 @@ public function getPDFormDetailsJSON_post()
$pd_type = $data['pd_master_details'][0]['fk_pd_type'] == 3 ? 3 : 1;
$data['lender_disclaimer'] = $this->PD_Model->selectRecords(ENTITYDISCLAIMER,array('fk_entity_id' => ($data['pd_master_details'][0]['sub_entity_id'] ? $data['pd_master_details'][0]['sub_entity_id'] : $data['pd_master_details'][0]['fk_lender_id']),'fk_pd_type' => $pd_type));
//}
- if($data['pd_master_details'][0]['lender_short_name'] == 'CSLFL'){
- $entity_geo_location = $this->PD_Model->getEntityAddr($data['pd_master_details'][0]['fk_lender_id']);
+ $entity_geo_location = $this->PD_Model->getEntityAddr($data['pd_master_details'][0]['fk_lender_id']);
+ print_r($entity_geo_location);die();
+ if($entity_geo_location != 0){
$pd_location = $data['pd_master_details'][0]['start_location'];
$data['distances'] = satellite_image::getdistancematrix($entity_geo_location,$pd_location);
- }
+ }else{ $data['distances'] = ""; }
//$data['lender_disclaimer'] = $this->PD_Model->selectRecords(ENTITYDISCLAIMER,array('fk_entity_id' => $data['pd_master_details'][0]['fk_lender_id']));
$data['applicants_details'] = $this->PD_Model->getApplicantsDetails($pdid);
$data['pd_additional_requirements'] = $this->PD_Model->getPDAdditionalRequirements($pdid);
@@ -6272,11 +6273,11 @@ public function getPDFormDetailsJSON_post()
// {
// echo 'NOR';
// print_r($data['pd_master_details']);die();
- if($data['pd_master_details'][0]['lender_short_name'] == 'CSLFL'){
- $entity_geo_location = $this->PD_Model->getEntityAddr($data['pd_master_details'][0]['fk_lender_id']);
+ $entity_geo_location = $this->PD_Model->getEntityAddr($data['pd_master_details'][0]['fk_lender_id']);
+ if($entity_geo_location != 0){
$pd_location = $data['pd_master_details'][0]['start_location'];
$data['distances'] = satellite_image::getdistancematrix($entity_geo_location,$pd_location);
- }
+ }else{ $data['distances'] = ""; }
$pd_type = $data['pd_master_details'][0]['fk_pd_type'] == 3 ? 3 : 1;
$data['lender_disclaimer'] = $this->PD_Model->selectRecords(ENTITYDISCLAIMER,array('fk_entity_id' => ($data['pd_master_details'][0]['sub_entity_id'] ? $data['pd_master_details'][0]['sub_entity_id'] : $data['pd_master_details'][0]['fk_lender_id']),'fk_pd_type' => $pd_type));
//}
diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php
index 9fe550cc..a91130ac 100644
--- a/api/application/models/PD_Model.php
+++ b/api/application/models/PD_Model.php
@@ -2255,16 +2255,23 @@ class PD_Model extends SPARQ_Model {
}
function getEntityAddr($Eid){
- $this->db->select('geo_loc');
- $this->db->from(ENTITYBILLING.' as ENTITYBILLING');
- $this->db->where('fk_entity_id',$Eid);
+ $this->db->select('is_dist_cal_enabled');
+ $this->db->from(ENTITY.' as ENTITY');
+ $this->db->where('entity_id',$Eid);
$this->db->where('isactive',1);
- $this->db->where('is_dist_cal_enable',1);
$query = $this->db->get();
- if ($query->num_rows() > 0) {
- $result = $query->row()->geo_loc;
+ if ($query->num_rows() > 0 && $query->row()->is_dist_cal_enabled == 1 ) {
+ $this->db->select('geo_loc');
+ $this->db->from(ENTITYBILLING.' as ENTITYBILLING');
+ $this->db->where('fk_entity_id',$Eid);
+ $this->db->where('isactive',1);
+ $this->db->where('is_dist_cal_enabled',1);
+ $query = $this->db->get();
+ if ($query->num_rows() > 0) {
+ $result = $query->row()->geo_loc;
+ }else{ $result = 0; }
}else{ $result = 0; }
- return $result;
+ return $result;
}
// SELECT as full_address FROM sineedgedemo.m_entity_billing where fk_entity_id = 43 and isactive = 1 and is_dist_cal_enable = 1;
diff --git a/api/application/views/report_templates/JSONTOREPORT_CLIX.php b/api/application/views/report_templates/JSONTOREPORT_CLIX.php
index 90909bf4..c73a6016 100644
--- a/api/application/views/report_templates/JSONTOREPORT_CLIX.php
+++ b/api/application/views/report_templates/JSONTOREPORT_CLIX.php
@@ -1056,7 +1056,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
echo 'PD Location Address : '.$pd_address['address'].', '.$pd_address['city_master'].', '.$pd_address['state_master'].' - '.$pincode.'.';
}
- if($pd_master_details[0]['lender_short_name'] == 'CSLFL'){
+ if(!empty($distances['distance'])){
echo '
Distance to PD location : '.$distances['distance'];
}
echo '
GPS Coordinates of location where PD Visit was done : '.$pd_master_details[0]['start_location'];
diff --git a/api/application/views/report_templates/JSONTOREPORT_CLIX_SMARTPD.php b/api/application/views/report_templates/JSONTOREPORT_CLIX_SMARTPD.php
index a50fcc0a..b6293925 100644
--- a/api/application/views/report_templates/JSONTOREPORT_CLIX_SMARTPD.php
+++ b/api/application/views/report_templates/JSONTOREPORT_CLIX_SMARTPD.php
@@ -1062,7 +1062,7 @@ font-weight: bolder;;
echo 'PD Location Address : '.$pd_address['address'].', '.$pd_address['city_master'].', '.$pd_address['state_master'].' - '.$pincode.'.';
}
- if($pd_master_details[0]['lender_short_name'] == 'CSLFL'){
+ if(!empty($distances['distance'])){
echo '
Distance to PD location : '.$distances['distance'];
}
echo '
GPS Coordinates of location where PD Visit was done : '.$pd_master_details[0]['start_location'];
diff --git a/api/application/views/report_templates/JSONTOREPORT_DI_AI.php b/api/application/views/report_templates/JSONTOREPORT_DI_AI.php
index f4301e2c..2baf82d1 100644
--- a/api/application/views/report_templates/JSONTOREPORT_DI_AI.php
+++ b/api/application/views/report_templates/JSONTOREPORT_DI_AI.php
@@ -1080,7 +1080,7 @@ if ( isset($pdf) ) {
echo 'PD Location Address : '.$pd_address['address'].', '.$pd_address['city_master'].', '.$pd_address['state_master'].' - '.$pincode.'.';
}
- if($pd_master_details[0]['lender_short_name'] == 'CSLFL'){
+ if(!empty($distances['distance'])){
echo '
Distance to PD location : '.$distances['distance'];
}
echo '
GPS Coordinates of location where PD Visit was done : '.$pd_master_details[0]['start_location'];
diff --git a/api/application/views/report_templates/JSONTOREPORT_DI_AI_ADDON.php b/api/application/views/report_templates/JSONTOREPORT_DI_AI_ADDON.php
index 77589789..07eb3048 100644
--- a/api/application/views/report_templates/JSONTOREPORT_DI_AI_ADDON.php
+++ b/api/application/views/report_templates/JSONTOREPORT_DI_AI_ADDON.php
@@ -1304,7 +1304,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
echo 'PD Location Address : '.$pd_address['address'].', '.$pd_address['city_master'].', '.$pd_address['state_master'].' - '.$pincode.'.';
}
- if($pd_master_details[0]['lender_short_name'] == 'CSLFL'){
+ if(!empty($distances['distance'])){
echo '
Distance to PD location : '.$distances['distance'];
}
echo '
GPS Coordinates of location where PD Visit was done : '.$pd_master_details[0]['start_location'];
diff --git a/api/application/views/report_templates/JSONTOREPORT_DI_AI_SMARTPD.php b/api/application/views/report_templates/JSONTOREPORT_DI_AI_SMARTPD.php
index ecc7319c..2b2ae9a4 100644
--- a/api/application/views/report_templates/JSONTOREPORT_DI_AI_SMARTPD.php
+++ b/api/application/views/report_templates/JSONTOREPORT_DI_AI_SMARTPD.php
@@ -1073,7 +1073,7 @@ if ( isset($pdf) ) {
echo 'PD Location Address : '.$pd_address['address'].', '.$pd_address['city_master'].', '.$pd_address['state_master'].' - '.$pincode.'.';
}
- if($pd_master_details[0]['lender_short_name'] == 'CSLFL'){
+ if(!empty($distances['distance'])){
echo '
Distance to PD location : '.$distances['distance'];
}
echo '
GPS Coordinates of location where PD Visit was done : '.$pd_master_details[0]['start_location'];
diff --git a/api/application/views/report_templates/JSONTOREPORT_RI.php b/api/application/views/report_templates/JSONTOREPORT_RI.php
index 26932325..5882d180 100644
--- a/api/application/views/report_templates/JSONTOREPORT_RI.php
+++ b/api/application/views/report_templates/JSONTOREPORT_RI.php
@@ -851,7 +851,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
echo 'PD Location Address : '.$pd_address['address'].', '.$pd_address['city_master'].', '.$pd_address['state_master'].' - '.$pincode.'.';
}
- if($pd_master_details[0]['lender_short_name'] == 'CSLFL'){
+ if(!empty($distances['distance'])){
echo '
Distance to PD location : '.$distances['distance'];
}
echo '
GPS Coordinates of location where PD Visit was done : '.$pd_master_details[0]['start_location'];
diff --git a/api/application/views/report_templates/JSONTOREPORT_RI_SMARTPD.php b/api/application/views/report_templates/JSONTOREPORT_RI_SMARTPD.php
index 26932325..5882d180 100644
--- a/api/application/views/report_templates/JSONTOREPORT_RI_SMARTPD.php
+++ b/api/application/views/report_templates/JSONTOREPORT_RI_SMARTPD.php
@@ -851,7 +851,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
echo 'PD Location Address : '.$pd_address['address'].', '.$pd_address['city_master'].', '.$pd_address['state_master'].' - '.$pincode.'.';
}
- if($pd_master_details[0]['lender_short_name'] == 'CSLFL'){
+ if(!empty($distances['distance'])){
echo '
Distance to PD location : '.$distances['distance'];
}
echo '
GPS Coordinates of location where PD Visit was done : '.$pd_master_details[0]['start_location'];
diff --git a/api/application/views/report_templates/JSONTOREPORT_SAL.php b/api/application/views/report_templates/JSONTOREPORT_SAL.php
index 240dbfce..7a3ce959 100644
--- a/api/application/views/report_templates/JSONTOREPORT_SAL.php
+++ b/api/application/views/report_templates/JSONTOREPORT_SAL.php
@@ -854,7 +854,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
echo 'PD Location Address : '.$pd_address['address'].', '.$pd_address['city_master'].', '.$pd_address['state_master'].' - '.$pincode.'.';
}
- if($pd_master_details[0]['lender_short_name'] == 'CSLFL'){
+ if(!empty($distances['distance'])){
echo '
Distance to PD location : '.$distances['distance'];
}
echo '
GPS Coordinates of location where PD Visit was done : '.$pd_master_details[0]['start_location'];
diff --git a/api/application/views/report_templates/JSONTOREPORT_SAL_SMARTPD.php b/api/application/views/report_templates/JSONTOREPORT_SAL_SMARTPD.php
index 73490ed3..6ec5581c 100644
--- a/api/application/views/report_templates/JSONTOREPORT_SAL_SMARTPD.php
+++ b/api/application/views/report_templates/JSONTOREPORT_SAL_SMARTPD.php
@@ -861,7 +861,7 @@ font-weight: bolder;;
echo 'PD Location Address : '.$pd_address['address'].', '.$pd_address['city_master'].', '.$pd_address['state_master'].' - '.$pincode.'.';
}
- if($pd_master_details[0]['lender_short_name'] == 'CSLFL'){
+ if(!empty($distances['distance'])){
echo '
Distance to PD location : '.$distances['distance'];
}
echo '
GPS Coordinates of location where PD Visit was done : '.$pd_master_details[0]['start_location'];