SMC STATE RCM PHOTO KEY ADDED

This commit is contained in:
Velz2020 2021-03-11 12:43:06 +05:30
parent 914785f102
commit dd6c024b6a
4 changed files with 80 additions and 40 deletions

View File

@ -7572,7 +7572,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200)
{
log_message('ERROR','###PDIMAGE stored in S3'.$pd_id.' - '.$form_id);
$record_data = array('fk_pd_id' => $pd_id,'pd_document_title'=>$title,'pd_document_name'=>$tempdocname,'fk_form_id'=>$form_id,'is_show_report' =>$is_show_report,'rental_count_id' => $rental_count_id,'location' => isset($doc['link']) ? $doc['link'] : null,'co_applicant_id' => $co_applicant_id,'img_type' => $img_type);
$record_data = array('fk_pd_id' => $pd_id,'pd_document_title'=>$title,'pd_document_name'=>$tempdocname,'fk_form_id'=>$form_id,'is_show_report' =>$is_show_report,'rental_count_id' => $rental_count_id,'location' => isset($doc['link']) ? $doc['link'] : null,'co_applicant_id' => $co_applicant_id,'img_type' => $img_type,'image_key' => (isset($doc['image_key']) ? $doc['image_key'] : null));
$record_data['company_id'] = $company_id ? $company_id : null;
$id = $this->PD_Model->saveRecords($record_data,PDDOCUMENTS);
if($id != null || $id != "") { $count++; $pks[] = $id;}
@ -9183,7 +9183,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
else if($records['image_key'] == 'person_met_id')
{
$img_array['img_type'] = 2;
$img_array['co_applicant_id'] = $main_applicant_name[0]['pd_co_applicant_id'].'-id_proof';
$img_array['co_applicant_id'] = $main_applicant_name[0]['pd_co_applicant_id'];
$img_array['image'] = $records['image'];
$img_array['Name'] = $main_applicant_name[0]['applicant_name'].'-id_proof';
$current_doc_title = $main_applicant_name[0]['applicant_name'].'-id_proof';
@ -9236,6 +9236,8 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
$current_doc_title = $records['image_key'];
}
$img_array['image_key'] = $records['image_key'];
$img_array['link'] = isset($records['link']) ? $records['link'] : null;
//set company id for business related forms
$business_forms = array(1,2,13,14,11,16,21,22,23);
if(in_array($records['fk_form_id'], $business_forms))
@ -11096,7 +11098,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
// echo !$is_mwise_lender;
if($is_mwise_lender && (($pd_details['pd_status'] == TRIGGERED) || ($pd_details['pd_status'] == ALLOCATED)))
{
$regional_credit_manager = $this->PD_Model->getRCM($pd_details['fk_city']);//pass pd address city as param
$regional_credit_manager = $this->PD_Model->getRCM($pd_details['fk_state']);//pass pd address city as param
if(count($regional_credit_manager))
{
$pd_details['fk_pd_allocated_to'] = $regional_credit_manager[0]['userid'];
@ -11105,7 +11107,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
}
else
{
log_message('ERROR',('### Couldnot find RCM users - '.$pd_details['fk_city']));
log_message('ERROR',('### Couldnot find RCM users - '.$pd_details['fk_state']));
}

View File

@ -1009,40 +1009,78 @@ class SMC_Credit_PD_Controller extends REST_Controller {
$to_date = $this->post('to_date');
$columns = array('PDTRIGGER.pd_id','PDTRIGGER.pd_sno','PDTRIGGER.lender_applicant_id','PDTRIGGER.fk_product_id','PRODUCT.abbr','PDTRIGGER.pd_status','PDTRIGGER.pd_status as officer_name','PDAPPLICANTSDETAILS.applicant_name','COMMONMASTER.createdon',('(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'));
$table = PDTRIGGER.' as PDTRIGGER';
$joins = array(
array('table' => PRODUCTS. ' as PRODUCT',
'condition' =>'PDTRIGGER.fk_product_id = PRODUCT.product_id',
'jointype' => 'INNER'),
array('table' => PDAPPLICANTSDETAILS. ' as PDAPPLICANTSDETAILS',
'condition' =>'PDTRIGGER.pd_id = PDAPPLICANTSDETAILS.fk_pd_id and applicant_type = 1',
'jointype' => 'LEFT'),
array('table' => COMMONMASTER. ' as COMMONMASTER',
'condition' =>'PDTRIGGER.pd_id = COMMONMASTER.primary_key and COMMONMASTER.table_name = "'.PDTRIGGER.'" and COMMONMASTER.field_name = "pd_status" and COMMONMASTER.new_value = "COMPLETED"',
'jointype' => 'LEFT'),
);
// $columns = array('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','COMMONMASTER.createdon',('(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 m_user_profile.first_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'));
// $table = PDTRIGGER.' as PDTRIGGER';
// $joins = array(
// array('table' => PRODUCTS. ' as PRODUCT',
// 'condition' =>'PDTRIGGER.fk_product_id = PRODUCT.product_id',
// 'jointype' => 'INNER'),
// // array('table' => USERPROFILE. ' as CMUSERPROFILE',
// // 'condition' =>'cmofficer = USERPROFILE.user_id',
// // 'jointype' => 'LEFT'),
// array('table' => PDTYPE. ' as PDTYPE',
// 'condition' =>'PDTRIGGER.fk_pd_type = PDTYPE.pd_type_id',
// 'jointype' => 'INNER'),
// array('table' => PDAPPLICANTSDETAILS. ' as PDAPPLICANTSDETAILS',
// 'condition' =>'PDTRIGGER.pd_id = PDAPPLICANTSDETAILS.fk_pd_id and applicant_type = 1',
// 'jointype' => 'LEFT'),
// array('table' => COMMONMASTER. ' as COMMONMASTER',
// 'condition' =>'PDTRIGGER.pd_id = COMMONMASTER.primary_key and COMMONMASTER.table_name = "'.PDTRIGGER.'" and COMMONMASTER.field_name = "pd_status" and COMMONMASTER.new_value = "COMPLETED"',
// 'jointype' => 'LEFT'),
// );
$where_condition_array = array('PDTRIGGER.pd_status' => 'COMPLETED');
if($officer_name)
{
//$where_condition_array[] = array('SMC_CREDIT_PD.officer_name like' => '%'.$officer_name.'%');
//$where_condition_array['PDTRIGGER.officer_name like'] = '%'.$officer_name.'%';
}
if($from_date)
{
// $where_condition_array = array('PDTRIGGER.pd_status' => 'COMPLETED');
// if($officer_name)
// {
// //$where_condition_array[] = array('SMC_CREDIT_PD.officer_name like' => '%'.$officer_name.'%');
// // $where_condition_array['officer_name like'] = '%'.$officer_name.'%';
// }
// if($from_date)
// {
$where_condition_array['date(PDTRIGGER.createdon) >='] = $from_date;
}
if($to_date)
{
// $where_condition_array['date(PDTRIGGER.createdon) >='] = $from_date;
// }
// if($to_date)
// {
$where_condition_array['date(PDTRIGGER.createdon) <='] = $to_date;
}
// $where_condition_array['date(PDTRIGGER.createdon) <='] = $to_date;
// }
$order_by = 'PDTRIGGER.pd_id';
$SMC_CREDIT_PD = $this->SMC_Credit_PD_Model->getJoinRecords($columns,$table,$joins,$where_condition_array,$order_by,'DESC');
//print_r($this->db->last_query());
// $order_by = 'PDTRIGGER.pd_id';
//$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 m_user_profile.first_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');
$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(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');
$this->db->WHERE('PDTRIGGER.fk_lender_id',(ENVIRONMENT == 'production' ? 7 : 35));
if($from_date)
{
$this->db->WHERE('date(PDTRIGGER.createdon) >=',$from_date);
}
if($to_date)
{
$this->db->WHERE('date(PDTRIGGER.createdon) <=',$to_date);
}
if($officer_name)
{
$this->db->HAVING('officer_name like',"%$officer_name%");
}
// AND date(PDTRIGGER.createdon) >= '2021-02-16'
// AND date(PDTRIGGER.createdon) <= '2021-02-19'
$this->db->ORDER_BY('PDTRIGGER.pd_id DESC');
$SMC_CREDIT_PD = $this->db->GET()->result_array();
//print_r($this->db->last_query());die();
if(count($SMC_CREDIT_PD))
{
$data['dataStatus'] = true;
@ -1615,11 +1653,11 @@ public function filterSalesPDList_post() {
//get List of credit managers list for allocation
public function getCMUsers_get()
{
$city = $this->get('city_id');
$state = $this->get('state_id');
$usertype = $this->get('usertype');
$role = '';
if($usertype == 'RCM') { $role = 27; } else if($usertype == 'CM') { $role = 26; }
$users = $this->SMC_Credit_PD_Model->getSMCFlowUsers($city,$role);
$users = $this->SMC_Credit_PD_Model->getSMCFlowUsers($state,$role);
if(count($users))
{
$data['dataStatus'] = true;

View File

@ -2203,11 +2203,11 @@ class PD_Model extends SPARQ_Model {
return $data = $this->db->select('fk_form_id, company_id, json, processed_json,rental_count_id')->from(PDFORMDETAILSJSON)->where('fk_pd_id',$pdid)->where('isactive',1)->get()->result_array();
}
function getRCM($city)
function getRCM($state)
{
$fields = array('USERPROFILE.userid','USERPROFILE.first_name','USERPROFILE.last_name','USERPROFILEROLES.user_role');
$table = USERPROFILE.' as USERPROFILE';
$where_condition_array = array('USERPROFILE.fk_city' => $city);
$where_condition_array = array('USERPROFILE.fk_state' => $state);
$joins = array(
array('table'=>USERPROFILEROLES.' as USERPROFILEROLES','condition'=>'USERPROFILE.userid = USERPROFILEROLES.fk_userid and USERPROFILEROLES.user_role = 27 and USERPROFILEROLES.isactive = 1' ,'jointype'=>'INNER JOIN')
);

View File

@ -96,11 +96,11 @@ class SMC_Credit_PD_Model extends SPARQ_Model {
// print_r($this->db->last_query());die();
}
function getSMCFlowUsers($city,$role)
function getSMCFlowUsers($state,$role)
{
$fields = array('USERPROFILE.userid','USERPROFILE.first_name','USERPROFILE.last_name','USERPROFILEROLES.user_role');
$table = USERPROFILE.' as USERPROFILE';
$where_condition_array = array('USERPROFILE.fk_city' => $city);
$where_condition_array = array('USERPROFILE.fk_state' => $state);
$joins = array(
array('table'=>USERPROFILEROLES.' as USERPROFILEROLES','condition'=>"USERPROFILE.userid = USERPROFILEROLES.fk_userid and USERPROFILEROLES.user_role = $role and USERPROFILEROLES.isactive = 1" ,'jointype'=>'INNER JOIN')
);