MULTIPLE ADDRESS PD , AI WEB REVIEW

This commit is contained in:
velz 2019-03-29 16:17:41 +05:30
parent 6c431c9262
commit f1ff065395
4 changed files with 242 additions and 89 deletions

View File

@ -95,20 +95,22 @@ if(ENVIRONMENT == 'development')
{
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);
}
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',1);
}
/*********************END of AWS resources Constants*************************************************/
defined('LOGTOBOT') OR define('LOGTOBOT',1);
defined('LOGTOSYS') OR define('LOGTOSYS',1);
defined('PROCESSJSON') OR define('PROCESSJSON',1);
//defined('BOTURL') OR define('BOTURL','https://cliq.zoho.com/api/v2/bots/sample/incoming?authtoken=467975ee8e33abf1549803925eaace0f');
defined('BOTURL') OR define('BOTURL','https://cliq.zoho.com/api/v2/bots/sample/incoming?authtoken=4eb460042d45d28a898b5ea11b5b103e');
defined('BOTURL') OR define('BOTURLVENBA','https://cliq.zoho.com/api/v2/bots/sample/incoming?authtoken=4eb460042d45d28a898b5ea11b5b103e');
/*******************Constants PD status*********************************/
defined('TRIGGERED') OR define('TRIGGERED','TRIGGERED'); //First time PD Trigger.

View File

@ -546,9 +546,11 @@ class PD_Controller extends REST_Controller {
if(count($addresses))
{
foreach($addresses as $address_key => $address)
{
$address['fk_pd_id'] = $pd_id;
$address['is_primary'] = count($addresses) == 1 ? 1:0;
$this->PD_Model->saveRecords($address,PDADDRESS);
}
}
@ -634,10 +636,9 @@ class PD_Controller extends REST_Controller {
{
$pd_details = $this->post('records');
// $l = MYLOG::logFunction("GENERIC TEMPLATE CHOOSED",array('PDID' => $pd_details['pd_id']),'INFO');
// $l->info("GENERIC TEMPLATE CHOOSED",array('PDID' => $pd_details['pd_id']));
// die();
// OTP Generate Condition
if(isset($pd_details['pd_id']))
{
if($pd_details['pd_status'] == INITIATED)
{
@ -679,7 +680,7 @@ class PD_Controller extends REST_Controller {
unset($pd_details['link']);
$string2 = str_shuffle('1234567890');
$OTP = substr($string2,0,6);
$msg = "Code for starting your personal discussions with the verification officer is ".$OTP .". Pls share this only when the officer has reached your place in person";
$msg = "Code for starting your personal discussions with the verification officer is ".$OTP .". Pls share this only when the officer has reached your place in person";
$no = (string)$pd_details['mobile_no'];
unset($pd_details['mobile_no']);
//$pd_details['OTP'] = $OTP;
@ -704,84 +705,18 @@ class PD_Controller extends REST_Controller {
if($pd_details['pd_status'] == TRIGGERED || $pd_details['pd_status'] == INITIATED)
{
// Template Re assign Functionality
$fields = array('fk_lender_id','fk_product_id','fk_customer_segment','pd_status');
$where_condition_array = array('pd_id'=>$pd_details['pd_id']);
$res_array = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDTRIGGER);
/***********************CHOOSE PD TEMPALATE*********************/
$pd_details['fk_pd_template_id'] = $this->assignPDTempalate($pd_details['pd_id']);
if(count($res_array))
if($pd_details['fk_pd_template_id'] != "" || $pd_details['fk_pd_template_id'] != null)
{
// if($res_array[0]['pd_status'] == TRIGGERED || $res_array[0]['pd_status'] == DRAFT || $pd_details['pd_status'] == INITIATED )
// {
$fields = array('fk_template_id');
$where_condition_array = array('fk_lender_id'=>$res_array[0]['fk_lender_id'] ,'fk_product_id'=> $res_array[0]['fk_product_id'],'fk_customer_segment'=> $res_array[0]['fk_customer_segment'],'isactive' => 1);
// print_r($res_array);
$table = LENDERTEMPLATE;
$choosed_template_id = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,$table);
// print_r($this->db->last_query());
// print_r($choosed_template_id);die();
if(count($choosed_template_id))// CHOOSE FILTERED TEMPLATE//
{
$pd_details['fk_pd_template_id'] = $choosed_template_id[0]['fk_template_id'];
$logger = MYLOG::logFunction();
$logger->info("CUSTOM SPECIFIC TEMPLATE ".$pd_details['fk_pd_template_id']." CHOOSED",array('ENV'=>ENVIRONMENT,'PDID' => $pd_details['pd_id'],'Pre-Status' => $res_array[0]['pd_status'],'Current_status' => $pd_details['pd_status']));
$logger->info("TEMPLATE ASSIGN FUNCTIONALTIY".$pd_details['fk_pd_template_id']." CHOOSED",array('ENV'=>ENVIRONMENT,'PDID' => $pd_details['pd_id'],'Pre-Status' => $res_array[0]['pd_status'],'Current_status' => $pd_details['pd_status']));
$dataToBot = array('ENV'=>ENVIRONMENT,'Task Name'=>'PD Template Assign','Template Catagory'=>'SPECIFIC Template - '.$choosed_template_id[0]['fk_template_id'] ,'PDID'=> $pd_details['pd_id'],'Method' => 'UpdatePDMaster','Pre-Status' => $res_array[0]['pd_status'],'Current_status' => $pd_details['pd_status']);
$dataToBot = array('ENV'=>ENVIRONMENT,'Task Name'=>'PD Template Assign','Template ID'=>$choosed_template_id[0]['fk_template_id'] ,'PDID'=> $pd_details['pd_id'],'Method' => 'UpdatePDMaster','Pre-Status' => $res_array[0]['pd_status'],'Current_status' => $pd_details['pd_status']);
MYHTTPCLIENT::sendPOST($dataToBot);
}
else // CHOOSE GENERIC TEMPLATE//
{
// echo "CHOOSE GENERIC ";
if($res_array[0]['fk_customer_segment'] == 1 || $res_array[0]['fk_customer_segment'] == 2)
{
//SAL - (CASH/CHQ)
$pd_details['fk_pd_template_id'] = 1;
}
else if($res_array[0]['fk_customer_segment'] == 3 || $res_array[0]['fk_customer_segment'] == 5)
{
//* SENP/SEP - (DI)
$pd_details['fk_pd_template_id'] = 2;
}
else if($res_array[0]['fk_customer_segment'] == 4 || $res_array[0]['fk_customer_segment'] == 6)
{
//* SENP/SEP - (AI)
$pd_details['fk_pd_template_id'] = 3;
}
else if($res_array[0]['fk_customer_segment'] == 8)
{
//* SENP/SEP - (RI)
$pd_details['fk_pd_template_id'] = 4;
}
$logger = MYLOG::logFunction();
$logger->info("GENERIC TEMPLATE ".$pd_details['fk_pd_template_id']." CHOOSED",array('ENV'=>ENVIRONMENT,'PDID' => $pd_details['pd_id'],'Pre-Status' => $res_array[0]['pd_status'],'Current_status' => $pd_details['pd_status']));
$dataToBot = array('ENV'=>ENVIRONMENT,'Task Name'=>'PD Template Assign','Template Catagory'=>'GENERIC TEMPLATE ID - '.$pd_details['fk_pd_template_id'] ,'PDID'=> $pd_details['pd_id'],'Method' => 'UpdatePDMaster','Pre-Status' => $res_array[0]['pd_status'],'Current_status' => $pd_details['pd_status']);
MYHTTPCLIENT::sendPOST($dataToBot);
}
// }
// else
// {
// unset($pd_details['pd_status']);
// }
}
}
@ -789,6 +724,16 @@ class PD_Controller extends REST_Controller {
$where_condition_array = array('pd_id' => $pd_details['pd_id']);
$pd_id_modified = $this->PD_Model->updateRecords($pd_details,PDTRIGGER,$where_condition_array);
//Update Address table,if primary address choosed
$primary_address_id = isset($pd_details['fk_primary_address_id'])?$pd_details['fk_primary_address_id']:null;
if($primary_address_id != null)
{
$where_condition_array = array('pd_address_id' => primary_address_id);
$temp_data = array('is_primary' => 1);
$id = $this->PD_Model->updateRecords($temp_data,PDADDRESS,$where_condition_array);
}
if($pd_id_modified != null || $pd_id_modified != '' && $count != 0)
{
PDALERTS::pdnotification($pd_details['pd_id']);
@ -804,6 +749,154 @@ class PD_Controller extends REST_Controller {
$this->response($data,REST_Controller::HTTP_OK);
}
}//end of normal PD
else//#################### Handle Addtional PD
{
if(($pd_details['parent_pd_id'] != "" || $pd_details['parent_pd_id'] != null) &&
(($pd_details['fk_customer_segment'] != "" || $pd_details['fk_customer_segment'] != null)) &&
(($pd_details['fk_address_id'] != "" || $pd_details['fk_address_id'] != null)) &&
(($pd_details['pd_status'] != "" || $pd_details['pd_status'] != null)) &&
(($pd_details['fk_createdby'] != "" || $pd_details['fk_createdby'] != null)) )
{
//GET PArent PD Details
$parent_pd_details = $this->PD_Model->getPDMasterDetails($pd_details['parent_pd_id']);
if(count($parent_pd_details))
{
$newpd['fk_lender_id'] = $parent_pd_details[0]['fk_lender_id'];
$newpd['fk_entity_billing_id'] = $parent_pd_details[0]['fk_entity_billing_id'];
$newpd['lender_applicant_id'] = $parent_pd_details[0]['lender_applicant_id'];
$newpd['fk_product_id'] = $parent_pd_details[0]['fk_product_id'];
$newpd['fk_subproduct_id'] = $parent_pd_details[0]['fk_subproduct_id'];
$newpd['fk_pd_type'] = $parent_pd_details[0]['fk_pd_type'];
$newpd['pd_branch_id'] = $parent_pd_details[0]['pd_branch_id'];
$newpd['is_child'] = 1;
$newpd['pd_status'] = $pd_details['pd_status'];
$newpd['fk_createdby'] = $pd_details['fk_createdby'];
$newpd['fk_customer_segment'] = $pd_details['fk_customer_segment'];
$newpd['fk_address_id'] = $pd_details['fk_address_id'];
$newpd['parent_pd_id'] = $pd_details['parent_pd_id'];
$newpd['fk_pd_allocated_to'] = $pd_details['fk_pd_allocated_to'] ? $pd_details['fk_pd_allocated_to'] : null;
$newpd['scheduled_on'] = $pd_details['scheduled_on'] ? $pd_details['scheduled_on'] : null;
$newpd['fk_pd_template_id'] = $this->assignPDTempalate(array('lender' => $newpd['fk_lender_id'],'product' => $newpd['fk_product_id'],'customer_segment' => $newpd['fk_customer_segment']));
if($newpd['fk_pd_template_id'] != "" || $newpd['fk_pd_template_id'] != null)
{
$logger = MYLOG::logFunction();
$logger->info("TEMPLATE ASSIGN FUNCTIONALTIY".$newpd['fk_pd_template_id']." CHOOSED",array('ENV'=>ENVIRONMENT,'PDID' => 'Addtional PD','Pre-Status' => null,'Current_status' => $newpd['pd_status']));
$dataToBot = array('ENV'=>ENVIRONMENT,'Task Name'=>'PD Template Assign','Template ID'=>$newpd['fk_pd_template_id'] ,'PDID'=> 'Addtional PD','Method' => 'UpdatePDMaster - Addtional PD Creation','Pre-Status' => null,'Current_status' => $newpd['pd_status']);
MYHTTPCLIENT::sendPOST($dataToBot);
}
$pd_id = $this->PD_Model->saveRecords($newpd,PDTRIGGER);
if($pd_id != "" || $pd_id != null)
{
//PDALERTS::pdnotification($newpd['pd_id']);
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = pd_id;
$data['msg'] = "Addtional PD Created!";
$this->response($data,REST_Controller::HTTP_OK);
}
else
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NOT_MODIFIED;
$data['msg'] = 'Something went wrong. Try later!';
$this->response($data,REST_Controller::HTTP_OK);
}
}
else
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
$data['msg'] = 'Parent PD Details Not available!';
$this->response($data,REST_Controller::HTTP_OK);
}
}
else
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
$data['msg'] = 'Addtional PD :- ParentPD ID,Customer Segment, Address,, PD Status, Created by Required!';
$this->response($data,REST_Controller::HTTP_OK);
}
}
}
public function assignPDTempalate($data)
{
// Template Re assign Functionality
$res_array = array();
if(!is_array($data))
{
$fields = array('fk_lender_id','fk_product_id','fk_customer_segment','pd_status');
$where_condition_array = array('pd_id'=>$data);
$res_array = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDTRIGGER);
}
$templateid = null;
$fields = array('fk_template_id');
$where_condition_array = array();
if(!is_array($data))
{
$where_condition_array = array('fk_lender_id'=>$res_array[0]['fk_lender_id'] ,'fk_product_id'=> $res_array[0]['fk_product_id'],'fk_customer_segment'=> $res_array[0]['fk_customer_segment'],'isactive' => 1);
}
else
{
$where_condition_array = array('fk_lender_id'=>$data['lender'] ,'fk_product_id'=> $data['product'],'fk_customer_segment'=> $data['customer_segment'],'isactive' => 1);
}
$table = LENDERTEMPLATE;
$choosed_template_id = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,$table);
if(count($choosed_template_id))// CHOOSE FILTERED TEMPLATE//
{
$templateid = $choosed_template_id[0]['fk_template_id'];
}
else // CHOOSE GENERIC TEMPLATE//
{
// echo "CHOOSE GENERIC ";
if($res_array[0]['fk_customer_segment'] == 1 || $res_array[0]['fk_customer_segment'] == 2)
{
//SAL - (CASH/CHQ)
$templateid = 1;
}
else if($res_array[0]['fk_customer_segment'] == 3 || $res_array[0]['fk_customer_segment'] == 5)
{
//* SENP/SEP - (DI)
$templateid = 2;
}
else if($res_array[0]['fk_customer_segment'] == 4 || $res_array[0]['fk_customer_segment'] == 6)
{
//* SENP/SEP - (AI)
$templateid = 3;
}
else if($res_array[0]['fk_customer_segment'] == 8)
{
//* SENP/SEP - (RI)
$templateid = 4;
}
}
return $templateid;
}
@ -813,6 +906,7 @@ class PD_Controller extends REST_Controller {
$count = 0;
foreach($records as $key => $value)
{
$value['is_primary'] = count($records) == 1 ? 1:0;
if($value['pd_address_id'] != "" || $value['pd_address_id'] != null)
{
$where_condition_array = array('pd_address_id' => $value['pd_address_id']);
@ -3425,8 +3519,9 @@ class PD_Controller extends REST_Controller {
}
else
{
$temp_grossprofit = $temp_netprofit + $overall_business_expenses_total;
$temp_grossprofit = $temp_netprofit ;//+ $overall_business_expenses_total;
$temp_purchases = $total_sales_monthwise - $temp_grossprofit;
$temp_netprofit = $temp_grossprofit - $overall_business_expenses_total;
$temp_netmargin = ($temp_netprofit/$total_sales_monthwise) * 100;
}
@ -3489,13 +3584,15 @@ class PD_Controller extends REST_Controller {
$temp_netmargin_array = array();
if(isset($overall_summary_report['sales_declared_by_customer']['netmargin'])){ $temp_netmargin_array = array_merge($temp_netmargin_array,array($overall_summary_report['sales_declared_by_customer']['netmargin'])); }
if(isset($overall_summary_report['sales_calculated_by_monthwise']['netmargin'])){ $temp_netmargin_array = array_merge($temp_netmargin_array,array($overall_summary_report['sales_calculated_by_monthwise']['netmargin'])); }
if(isset($overall_summary_report['sales_calculated_by_itemwise']['netmargin'])){ $temp_netmargin_array = array_merge($temp_netmargin_array,array($overall_summary_report['sales_calculated_by_itemwise']['netmargin'])); }
if(isset($overall_summary_report['sales_declared_by_customer']['netprofit'])){ $temp_netmargin_array = array_merge($temp_netmargin_array,array($overall_summary_report['sales_declared_by_customer']['netprofit'])); }
if(isset($overall_summary_report['sales_calculated_by_monthwise']['netprofit'])){ $temp_netmargin_array = array_merge($temp_netmargin_array,array($overall_summary_report['sales_calculated_by_monthwise']['netprofit'])); }
if(isset($overall_summary_report['sales_calculated_by_itemwise']['netprofit'])){ $temp_netmargin_array = array_merge($temp_netmargin_array,array($overall_summary_report['sales_calculated_by_itemwise']['netprofit'])); }
$overall_summary_report['consolidated_report']['consolidated_sales_revenue'] = round(array_sum($temp_sales_array) / count($temp_sales_array));
$overall_summary_report['consolidated_report']['consolidated_nermagin'] = round(array_sum($temp_netmargin_array) / count($temp_netmargin_array),2);
$overall_summary_report['consolidated_report']['consolidated_nerprofit'] = round($overall_summary_report['consolidated_report']['consolidated_sales_revenue'] * ($overall_summary_report['consolidated_report']['consolidated_nermagin'] / 100 ));
$overall_summary_report['consolidated_report']['consolidated_sales_revenue'] = round(array_sum($temp_sales_array) / count($temp_sales_array),2);
$overall_summary_report['consolidated_report']['consolidated_nerprofit'] = round(array_sum($temp_netmargin_array) / count($temp_netmargin_array),2);
$overall_summary_report['consolidated_report'][' consolidated_nermagin'] = round((($overall_summary_report['consolidated_report']['consolidated_nerprofit']/$overall_summary_report['consolidated_report']['consolidated_sales_revenue'])*100) ,2);
return ($overall_summary_report);

View File

@ -13,7 +13,7 @@ class MYHTTPCLIENT
if(LOGTOBOT == true)
{
$client = new \GuzzleHttp\Client();
$response = $client->post( BOTURL, [
$response = $client->post( BOTURLVENBA, [
'headers' => ['Content-Type' => 'application/json'],
'body' => json_encode($dataToBot)
]);

View File

@ -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');
$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->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');
@ -37,6 +37,7 @@ 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(PDAPPLICANTSDETAILS.' as PDAPPLICANTSDETAILS','PDTRIGGER.pd_id = PDAPPLICANTSDETAILS.fk_pd_id AND PDAPPLICANTSDETAILS.applicant_type = 1','LEFT');
$this->db->WHERE('PDTRIGGER.pd_status !=',ARCHIVED);
$this->db->WHERE('PDTRIGGER.is_child !=',1);
if($pdofficerid != "" || $pdofficerid != null)
{
@ -288,7 +289,7 @@ class PD_Model extends SPARQ_Model {
public function getPDAddress($pdid)
{
$this->db->SELECT('PDADDRESS.pd_address_id, PDADDRESS.addressline1, PDADDRESS.fk_city, PDADDRESS.fk_state,PDADDRESS.pincode as pincode_id,PINCODE.pincode,PDADDRESS.other_pincode,PDADDRESS.isactive,PDADDRESS.createdon,PDADDRESS.updatedon,PDADDRESS.is_visited,CITY.name as city_name,STATE.name as state_name');
$this->db->SELECT('PDADDRESS.pd_address_id, PDADDRESS.addressline1, PDADDRESS.fk_city, PDADDRESS.fk_state,PDADDRESS.pincode as pincode_id,PINCODE.pincode,PDADDRESS.other_pincode,PDADDRESS.isactive,PDADDRESS.createdon,PDADDRESS.updatedon,PDADDRESS.is_visited,CITY.name as city_name,STATE.name as state_name,PDADDRESS.is_primary');
$this->db->FROM(PDADDRESS.' as PDADDRESS');
$this->db->JOIN(STATE.' as STATE','PDADDRESS.fk_state = STATE.state_id','LEFT');
$this->db->JOIN(CITY.' as CITY','PDADDRESS.fk_city = CITY.city_id','LEFT');
@ -299,6 +300,14 @@ class PD_Model extends SPARQ_Model {
if(count($result_child_array) != 0)
{
foreach($result_child_array as $key => $single_address)
{
$result_child_array[$key]['addtional_pd_data'] = array();
if($single_address['is_primary'] != 0)
{
$result_child_array[$key]['addtional_pd_data'] = $this->getAddtionalPDInformations($single_address['pd_address_id']);
}
}
return $result_child_array;
}
else
@ -336,7 +345,7 @@ class PD_Model extends SPARQ_Model {
//get pd Master Details
$pd_master_detials = $this->getPDMasterDetails($pdid);
$arrayForText = array("fk_lender_id" => "Lender", "fk_entity_billing_id" => "Billing ID", "lender_applicant_id" => "Applicant Ref ID", "pd_date_of_initiation" => "PD Date of Initiation", "fk_product_id" => "Product", "fk_subproduct_id" => "Sub Product","fk_pd_type" => "PD Type", "pd_status" => "PD Status", "pd_specific_clarification"=> "PD Specific Clarification","fk_pd_allocation_type" => "Allocation Type", "fk_pd_allocated_to" => "Allocated Person", "fk_pd_template_id" => "PD Tempale", "fk_customer_segment" => "Customer Segment", "pd_officier_final_judgement" => "PD Officer Finale Judgement", "pd_agency_id" => "PD Agency", "loan_amount" => "Loan Amount", "addressline1" => "Addressline1", "addressline2" => "Addressline1", "addressline3" => "Addressline1", "fk_city" => "City", "fk_state" => "State", "pincode" => "Pincode", "bounce_reason" => "Bounce Reason", "executive_id" => "PD Executive","central_pd_officer_id"=>"Central PD Officer","pd_contact_person" => "Lender Contact Person", "pd_contact_mobileno" => "Lender Contact Mobile Number", "scheduled_on" => "Scheduled On", "completed_on" => "Completed On");
$arrayForText = array("fk_lender_id" => "Lender", "fk_entity_billing_id" => "Billing ID", "lender_applicant_id" => "Applicant Ref ID", "pd_date_of_initiation" => "PD Date of Initiation", "fk_product_id" => "Product", "fk_subproduct_id" => "Sub Product","fk_pd_type" => "PD Type", "pd_status" => "PD Status", "pd_specific_clarification"=> "PD Specific Clarification","fk_pd_allocation_type" => "Allocation Type", "fk_pd_allocated_to" => "Allocated Person", "fk_pd_template_id" => "PD Tempale", "fk_customer_segment" => "Customer Segment", "pd_officier_final_judgement" => "PD Officer Finale Judgement", "pd_agency_id" => "PD Agency", "loan_amount" => "Loan Amount", "addressline1" => "Addressline1", "addressline2" => "Addressline1", "addressline3" => "Addressline1", "fk_city" => "City", "fk_state" => "State", "pincode" => "Pincode", "bounce_reason" => "Bounce Reason", "executive_id" => "PD Executive","central_pd_officer_id"=>"Central PD Officer","pd_contact_person" => "Lender Contact Person", "pd_contact_mobileno" => "Lender Contact Mobile Number", "scheduled_on" => "Scheduled On", "completed_on" => "Completed On",'fk_address_id' => 'PD Address Map','fk_primary_address_id' => 'Primary Address');
$this->db->SELECT('COMMONMASTER.log_id, COMMONMASTER.primary_key, COMMONMASTER.table_name, COMMONMASTER.field_name, COMMONMASTER.old_value, COMMONMASTER.new_value, COMMONMASTER.fk_createdby, DATE_FORMAT(COMMONMASTER.createdon,"%dth %b %Y at %h:%i:%s %p") as createdon,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,ENTITYBILLINGOLD.billing_name as old_billing_name,ENTITYBILLINGNEW.billing_name as new_billing_name,ENTITYOLD.full_name as old_entity_name,ENTITYNEW.full_name as new_entity_name,PRODUCTSOLD.abbr as old_product,PRODUCTSNEW.abbr as new_product,SUBPRODUCTSOLD.abbr as old_sub_product,SUBPRODUCTSNEW.abbr as new_sub_product,PDTYPEOLD.type_name as old_type_name,PDTYPENEW.type_name as new_type_name,concat(ALLOCATEDOLD.first_name," ",ALLOCATEDOLD.last_name) as old_allocated_to,concat(ALLOCATEDNEW.first_name," ",ALLOCATEDNEW.last_name) as new_allocated_to,TEMPLATEOLD.template_name as old_template_name,TEMPLATENEW.template_name as new_template_name,CUSTOMERSEGMENTOLD.name as old_cs_name,CUSTOMERSEGMENTNEW.name as new_cs_name,AGENCYOLD.full_name as old_agencyname,AGENCYNEW.full_name as new_agencyname,CITYOLD.name as old_city,CITYNEW.name as new_city,STATEOLD.name as old_state,STATENEW.name as new_state,concat(EXECUTIVEOLD.first_name," ",EXECUTIVEOLD.last_name) as old_executive,concat(EXECUTIVENEW.first_name," ",EXECUTIVENEW.last_name) as new_executive,concat(CENTRALPDOLD.first_name," ",CENTRALPDOLD.last_name) as old_central_pd_officer_id,concat(CENTRALPDNEW.first_name," ",CENTRALPDNEW.last_name) as new_central_pd_officer_id,ALLOCATIONOLD.pd_allocation_type_name as old_allocation_type,ALLOCATIONNEW.pd_allocation_type_name as new_allocation_type,BOUNCEMASTEROLD.bounce_reason_name as old_bounce_reason,BOUNCEMASTERNEW.bounce_reason_name as new_bounce_reason,PINCODEOLD.pincode as old_pincode,PINCODENEW.pincode as new_pincode,PDTRIGGER.other_pincode');
$this->db->FROM(COMMONMASTER.' as COMMONMASTER');
@ -685,7 +694,7 @@ class PD_Model extends SPARQ_Model {
*/
public function getPDMasterDetails($pdid)
{
$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,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');
$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,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');
$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');
@ -763,6 +772,19 @@ class PD_Model extends SPARQ_Model {
}
if($result_array[0]['fk_address_id'] == "" || $result_array[0]['fk_address_id'] == null)
{
$mandatory_fields[] = 'fk_address_id';
}
if($result_array[0]['is_child'] == 0)
{
if($result_array[0]['fk_primary_address_id'] == "" || $result_array[0]['fk_primary_address_id'] == null)
{
$mandatory_fields[] = 'fk_primary_address_id';
}
}
}
$result_array[]['mandatory_fields'] = $mandatory_fields;
@ -1410,5 +1432,37 @@ class PD_Model extends SPARQ_Model {
//$this->PD_Model->selectCustomRecords(array('question,key'),array('fk_form_id' =>'is null'),QUESTIONKEYMAPPING);
}
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->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');
$this->db->JOIN(PRODUCTS.' as PRODUCTS','PDTRIGGER.fk_product_id = PRODUCTS.product_id','LEFT');
$this->db->JOIN(SUBPRODUCTS.' as SUBPRODUCTS','PDTRIGGER.fk_subproduct_id = SUBPRODUCTS.subproduct_id','LEFT');
$this->db->JOIN(PDTYPE.' as PDTYPE','PDTRIGGER.fk_pd_type = PDTYPE.pd_type_id','LEFT');
//$this->db->JOIN(PDSTATUS.' as PDSTATUS','PDTRIGGER.pd_status = PDSTATUS.pd_status_id','LEFT');
$this->db->JOIN(USERPROFILE.' as USERPROFILE','PDTRIGGER.fk_createdby = USERPROFILE.userid','LEFT');
$this->db->JOIN(USERPROFILE.' as USERPROFILE1','PDTRIGGER.fk_updatedby = USERPROFILE1.userid','LEFT');
$this->db->JOIN(PDALLOCATIONTYPE.' as PDALLOCATIONTYPE','PDTRIGGER.fk_pd_allocation_type = PDALLOCATIONTYPE.pd_allocation_type_id','LEFT');
$this->db->JOIN(USERPROFILE.' as USERPROFILE2','PDTRIGGER.fk_pd_allocated_to = USERPROFILE2.userid','LEFT');
$this->db->JOIN(USERPROFILE.' as USERPROFILE3','PDTRIGGER.executive_id = USERPROFILE3.userid','LEFT');
$this->db->JOIN(USERPROFILE.' as EXECUTIVE','PDTRIGGER.executive_id = EXECUTIVE.userid','LEFT');
$this->db->JOIN(USERPROFILE.' as CENTRALOFFICER','PDTRIGGER.central_pd_officer_id = CENTRALOFFICER.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');
$this->db->JOIN(STATE.' as STATE','PDTRIGGER.fk_state = STATE.state_id ','LEFT');
$this->db->JOIN(CITY.' as CITY','PDTRIGGER.fk_city = CITY.city_id','LEFT');
$this->db->JOIN(PINCODE.' as PINCODE','PDTRIGGER.pincode = PINCODE.pincode_id','LEFT');
$this->db->JOIN(BOUNCEMASTER.' as BOUNCEMASTER','PDTRIGGER.bounce_reason = BOUNCEMASTER.bounce_id','LEFT');
$this->db->JOIN(ENTITYLENDERBRANCH.' as ENTITYLENDERBRANCH','PDTRIGGER.pd_branch_id = ENTITYLENDERBRANCH.entity_lender_branch_id','LEFT');
$this->db->WHERE('PDTRIGGER.fk_address_id',$addressid);
// $this->db->ORDER_BY('PDTRIGGER.pd_id',$sort);
// $this->db->LIMIT($limit,$page);
return $result_array = $this->db->GET()->result_array();
}
}