MIS report officer name fixes : ps

This commit is contained in:
VE10-Sanjeev 2022-12-03 15:12:07 +05:30
parent 349b23e536
commit 0f152c9227

View File

@ -1132,6 +1132,7 @@ class SMC_Credit_PD_Controller extends REST_Controller {
public function smcCreditPDMisReport_post()
{
//echo "i am Here";die();
//$lender_id = $this->uri->segment(2);
$officer_name = $this->post('officer_name');
$from_date = $this->post('from_date');
@ -1179,13 +1180,18 @@ class SMC_Credit_PD_Controller extends REST_Controller {
//$SMC_CREDIT_PD = $this->SMC_Credit_PD_Model->getJoinRecords($columns,$table,$joins,$where_condition_array,$order_by,'DESC');
$this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.pd_sno, PDTYPE.type_name, PDTRIGGER.lender_applicant_id, PDTRIGGER.fk_product_id, PRODUCT.abbr, PDTRIGGER.pd_status, PDAPPLICANTSDETAILS.applicant_name, (SELECT createdon FROM h_common_masters where PDTRIGGER.pd_id = primary_key AND field_name = "pd_status" order by log_id DESC limit 1) as updatedon, (SELECT concat(m_user_profile.first_name," " ,m_user_profile.last_name) FROM h_common_masters JOIN m_user_profile on h_common_masters.new_value = m_user_profile.userid where PDTRIGGER.pd_id = primary_key AND field_name = "fk_pd_allocated_to" order by log_id DESC limit 1) as officer_name,PDTRIGGER.mis_report_remarks,PDTRIGGER.vendor_status,PDTRIGGER.fk_city,CITY.name as city_name');
//Dont Delete below Select Statement Because 3rd dec22 MIS Officer Name REPORTED by Venkat
//$this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.pd_sno, PDTYPE.type_name, PDTRIGGER.lender_applicant_id, PDTRIGGER.fk_product_id, PRODUCT.abbr, PDTRIGGER.pd_status, PDAPPLICANTSDETAILS.applicant_name, (SELECT createdon FROM h_common_masters where PDTRIGGER.pd_id = primary_key AND field_name = "pd_status" order by log_id DESC limit 1) as updatedon, (SELECT concat(m_user_profile.first_name," " ,m_user_profile.last_name) FROM h_common_masters JOIN m_user_profile on h_common_masters.new_value = m_user_profile.userid where PDTRIGGER.pd_id = primary_key AND field_name = "fk_pd_allocated_to" order by log_id DESC limit 1) as officer_name,PDTRIGGER.mis_report_remarks,PDTRIGGER.vendor_status,PDTRIGGER.fk_city,CITY.name as city_name');
$this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.pd_sno, PDTYPE.type_name, PDTRIGGER.lender_applicant_id, PDTRIGGER.fk_product_id, PRODUCT.abbr, PDTRIGGER.pd_status, PDAPPLICANTSDETAILS.applicant_name, (SELECT createdon FROM h_common_masters where PDTRIGGER.pd_id = primary_key AND field_name = "pd_status" order by log_id DESC limit 1) as updatedon,PDTRIGGER.mis_report_remarks,PDTRIGGER.vendor_status,PDTRIGGER.fk_city,CITY.name as city_name');
$this->db->SELECT('(SELECT GROUP_CONCAT(concat(m_user_profile.first_name, " ", m_user_profile.last_name,"(",DATE_FORMAT(h_common_masters.createdon, "%d-%m-%Y %r"),") ")) FROM h_common_masters JOIN m_user_profile on h_common_masters.fk_createdby = m_user_profile.userid where PDTRIGGER.pd_id = h_common_masters.primary_key and field_name = "video_call_initiate_user" order by log_id DESC) as video_call_initiate_user, (SELECT count(log_id) FROM h_common_masters where PDTRIGGER.pd_id = h_common_masters.primary_key and field_name = "video_call_initiate_user") as total_video');
$this->db->SELECT('concat(ifnull(mup.first_name, mup1.first_name)," ",ifnull(mup.last_name, mup1.last_name)) AS officer_name');
$this->db->FROM(PDTRIGGER.' as PDTRIGGER');
$this->db->JOIN(PRODUCTS.' as PRODUCT','PDTRIGGER.fk_product_id = PRODUCT.product_id','LEFT');
$this->db->JOIN(PDTYPE.' as PDTYPE','PDTRIGGER.fk_pd_type = PDTYPE.pd_type_id','LEFT');
$this->db->JOIN(PDAPPLICANTSDETAILS.' as PDAPPLICANTSDETAILS','PDTRIGGER.pd_id = PDAPPLICANTSDETAILS.fk_pd_id and and PDAPPLICANTSDETAILS.applicant_type = 1','LEFT');
$this->db->JOIN(CITY.' as CITY','PDTRIGGER.fk_city = CITY.city_id','LEFT');
$this->db->JOIN('m_user_profile AS mup','mup.userid = PDTRIGGER.fk_pd_allocated_to and PDTRIGGER.pd_status = "COMPLETED"','LEFT');
$this->db->JOIN('m_user_profile AS mup1','mup1.userid = PDTRIGGER.fk_updatedby and PDTRIGGER.pd_status = "COMPLETED"','LEFT');
//$this->db->JOIN(COMMONMASTER.' as COMMONMASTER','PDTRIGGER.pd_id = PDAPPLICANTSDETAILS.fk_pd_id and and PDAPPLICANTSDETAILS.applicant_type = 1 and COMMONMASTER.primary_key and COMMONMASTER.table_name = "t_pd_triggered" and COMMONMASTER.field_name = "pd_status" and COMMONMASTER.new_value = "COMPLETED"');
//$this->db->WHERE('PDTRIGGER.pd_status','COMPLETED');