Buiness Group Info api : ps

This commit is contained in:
sanjeev 2022-01-06 19:38:36 +05:30
parent 78ec761c88
commit e61a932bb0
6 changed files with 183 additions and 61 deletions

View File

@ -341,6 +341,9 @@ $route['deleteTemplateV2'] = 'Template_Management_Controller/deleteTemplateV2';
$route['loadFullTemplateV2'] = 'Template_Management_Controller/loadFullTemplateV2';
$route['formWiseJSONTemplateV2'] = 'Template_Management_Controller/formWiseJSONTemplateV2';
$route['disableformV2'] = 'Template_Management_Controller/disableformV2';
// $route['questionsV2'] = 'Template_Management_Controller/JSONquestionFilterV2';
$route['getBuinessGroupForms'] = 'Template_Management_Controller/getBuinessGroupForms';
$route['PDjson'] = 'PD_Controller/PDjson';
$route['regenerateSatelliteImg'] = 'Sales_PD_Controller/regenerateSatelliteImg';

View File

@ -1654,8 +1654,8 @@ public function assignPDTempalate($data)
$records['vendor_status'] = isset($records['pd_status']) ? $records['pd_status'] : ALLOCATED ; //Here vendor_status is dynamic (ALLOCATED,SCHEDULED,COMPLETED like that)
//Mail - SMC Vendor.
if($records['vendor_status'] == ALLOCATED){
PDALERTS::sendMWcreditPDMail($this,$records['pd_id'],1);
PDALERTS::sendMWcreditPDMail($this,$records['pd_id'],2);
PDALERTS::sendMWcreditPDMail($this,$records,1);
PDALERTS::sendMWcreditPDMail($this,$records,2);
$records['pd_status'] = ALLOCATED_TO_FIA;
}
}
@ -2985,7 +2985,7 @@ public function assignPDTempalate($data)
public function getPDFormDetailsJSON_post()
{
$pd_form_id = "";
$pd_id = $this->post('pd_id');
$pd_form_id = $this->post('pd_form_id');
$parent_pd_id = $this->post('parent_pdid');// ? $this->post('parent_pd_id') : null;
@ -3020,7 +3020,6 @@ public function getPDFormDetailsJSON_post()
$where_condition_array = array('fk_pd_id' => $pd_id,'fk_form_id' =>$pd_form_id , 'isactive' => 1);
$form_count = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON);
//print_r($form_count);
$rec = array();
if(!count($form_count))
{
//echo "dsjsbsdj";
@ -11302,7 +11301,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
{
$pd_details['pd_status'] = ALLOCATED_TO_FIA;
$pd_details['vendor_status'] = ALLOCATED;
PDALERTS::sendMWcreditPDMail($this,$pd_details['pd_id'],3);
PDALERTS::sendMWcreditPDMail($this,$pd_details,3);
}
else if(count($regional_credit_manager))
{

View File

@ -946,8 +946,10 @@ class Template_Management_Controller extends REST_Controller {
}else{
$result_array[$inx]["forms"] = array();
}
$buiness_arr = array("form_id"=> "13","form_name"=> "Business Information","json"=> "","is_form_disabled"=> "0","is_business_form"=> "1","is_group_form"=> "1");
array_push($result_array[$inx]["forms"],$buiness_arr);
}
if(count($result_array))
if(count($result_array)>0)
{
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
@ -1041,7 +1043,7 @@ class Template_Management_Controller extends REST_Controller {
// $this->db->set('isactive',0);
// $this->db->update(TEMPLATE_MAP_V2);
$map_pk_id = (int)$map_table[0]['id'];
$msg = "Entry Alredy Available For Given Params";
$msg = "Data Already Available For Given Params";
}else{
$map_pk_id = $this->Template_Management_Model->saveTemplateMapping($records,TEMPLATE_MAP_V2);
$msg = "Sucessfully Inserted";
@ -1162,7 +1164,7 @@ class Template_Management_Controller extends REST_Controller {
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
$data['msg'] = 'Template Not for PD ID'.$pd_id;
$data['msg'] = 'There is no Template for Given PD-ID'.$pd_id;
$this->response($data,REST_Controller::HTTP_OK);
}
}
@ -1181,7 +1183,7 @@ class Template_Management_Controller extends REST_Controller {
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NOT_FOUND;
$data['msg'] = 'Key Missing! Please Check again map-id and form-id';
$data['msg'] = 'Key Missing! Please Check again both map-id and form-id';
$this->response($data,REST_Controller::HTTP_OK);
}else{
@ -1200,7 +1202,7 @@ class Template_Management_Controller extends REST_Controller {
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NOT_MODIFIED;
$data['msg'] = 'Something Went Wrong! Try again Later';
$data['msg'] = 'JSON Not Available! Try again Later';
$this->response($data,REST_Controller::HTTP_OK);
}
}
@ -1211,7 +1213,7 @@ class Template_Management_Controller extends REST_Controller {
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NOT_FOUND;
$data['msg'] = 'Key Missing! Please Check again map-id and form-id';
$data['msg'] = 'Key Missing! Please Check again both map-id and form-id';
$this->response($data,REST_Controller::HTTP_OK);
} else{
$map_id = $_GET['map_id'];
@ -1241,9 +1243,98 @@ class Template_Management_Controller extends REST_Controller {
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NOT_FOUND;
$data['msg'] = 'No Data Found Given Map-id and Form-id';
$data['msg'] = 'No Data Found for Given Map-id and Form-id';
$this->response($data,REST_Controller::HTTP_OK);
}
}
}
public function getBuinessGroupForms_get(){
// if((!isset($_GET['map_id'])))
// {
// $data['dataStatus'] = false;
// $data['status'] = REST_Controller::HTTP_NOT_FOUND;
// $data['msg'] = 'Key Missing! Please Check again both map-id and form-id';
// $this->response($data,REST_Controller::HTTP_OK);
// }
// else{
if(isset($_GET['map_id']))
{
$records['map_id'] = $this->get("map_id");}
if(isset($_GET['entity_id']))
{
$records['entity_id'] = $this->get("entity_id");}
if(isset($_GET['product_id']))
{
$records['product_id'] = $this->get("product_id");}
if(isset($_GET['customer_segment_id']))
{
$records['customer_segment_id'] = $this->get("customer_segment_id");}
$result_array = $this->Template_Management_Model->getTemplateMappingDetailsV2($records);
if(!empty($result_array))
foreach($result_array as $inx => $arr)
{
if($arr['map_id'] != null || $arr['map_id'] != ""){
$result_array[$inx]["forms"] = $this->Template_Management_Model->getBuinessGroupForms($arr['map_id']);
}else{
$result_array[$inx]["forms"] = array();
}
}
if(count($result_array)>0)
{
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = $result_array;
$this->response($data,REST_Controller::HTTP_OK);
}
else
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
$data['msg'] = 'No Data Available';
$this->response($data,REST_Controller::HTTP_OK);
}
}
public function JSONquestionFilterV2_get(){
if( (!isset($_GET['map_id'])) && (!isset($_GET['form_id'])) )
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NOT_FOUND;
$data['msg'] = 'Key Missing! Please Check again both map-id and form-id';
$this->response($data,REST_Controller::HTTP_OK);
}else{
$map_id = $_GET['map_id'];
$form_id = $_GET['form_id'];
$fields = array('json');
$where_condition_array = array('map_id'=>$map_id,"form_id"=>$form_id,"isactive"=>1);
$json_table = $this->Template_Management_Model->selectCustomRecords($fields,$where_condition_array,TEMPLATE_JSON_V2);
if(count($json_table)>0){
$json = json_decode($json_table[0]['json'],true);
print_r($json['questions']);die();
if($res){
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['question'] = '';
$data['json'] = $json_table;
$this->response($data,REST_Controller::HTTP_OK);
}else{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NOT_MODIFIED;
$data['msg'] = 'Something Went Wrong! Try again Later';
$this->response($data,REST_Controller::HTTP_OK);
}
}
else
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NOT_FOUND;
$data['msg'] = 'No Data Found Given Map-id and Form-id';
$this->response($data,REST_Controller::HTTP_OK);
}
}
}
}

View File

@ -545,7 +545,7 @@ class PDALERTS
$mail->Port = 465; // "The port"
$mail_id = 'ssa@venbainfotech.com';
// $mail_id = 'sanjeev.p@venbainfotech.com';
if(ENVIRONMENT == 'testing' && in_array((string)$city,$city_arg)){ $mail->addBCC("venkiraj0@gmail.com");$mail->addBCC("venbalap08@gmail.com");}
if(ENVIRONMENT == 'testing' && in_array((string)$city,$city_arg)){ $mail->addBCC("venkiraj0@gmail.com");}
if(ENVIRONMENT == 'production')
{
$mail_id = 'cpa@smcfinance.com';
@ -694,9 +694,10 @@ class PDALERTS
//echo $d;
}
public static function sendMWcreditPDMail($CI,$pd_id,$flag)
public static function sendMWcreditPDMail($CI,$arr,$flag)
{
// $pd_id = $arr['pd_id'];
$pd_id = $arr['pd_id'];
$RCM_or_CM = $arr['fk_updatedby'];
log_message('ERROR','#### MW AGENCY-MAIL CALLED'.$pd_id);
if($pd_id != "" || $pd_id != null)
{
@ -723,35 +724,34 @@ class PDALERTS
$CI->db->JOIN(STATE.' as STATE','PDTRIGGER.fk_state = STATE.state_id ','LEFT');
$CI->db->JOIN(CITY.' as CITY','PDTRIGGER.fk_city = CITY.city_id','LEFT');
$CI->db->JOIN(PINCODE.' as PINCODE','PDTRIGGER.pincode = PINCODE.pincode_id','LEFT');
$CI->db->WHERE("PDTRIGGER.pd_id",$pd_id);
$core_details = $CI->db->GET()->result_array();
// echo count($core_details);
// die();
if(count($core_details))
{
$mail = $CI->phpmailer_library->load();
$CI->db->SELECT("USERPROFILE.email");
$CI->db->FROM(USERPROFILE." as USERPROFILE");
$CI->db->JOIN(USERPROFILEROLES." as USERPROFILEROLES", "USERPROFILEROLES.isactive = 1 and USERPROFILEROLES.fk_userid = USERPROFILE.userid");
$CI->db->WHERE("USERPROFILE.userid",$RCM_or_CM);
$CI->db->WHERE_IN("USERPROFILEROLES.user_role",[26,27]);
$get_details = $CI->db->GET()->result_array();
$rcm_mail_id = (count($get_details)>0) ? $get_details[0]['email'] : "";
if(count($core_details)){
$msg = "" ; $subject = "" ;
if($flag == 2){
// Mail - RCM
log_message('ERROR','#### MW AGENCY-MAIL CALLED TYPE 2 RCM '.$pd_id);
$mail_id = $core_details[0]['allocated_email'];
if($flag == 2){ // Mail Content For - RCM and CM ONLY.
log_message('ERROR','#### MW AGENCY-MAIL CALLED TYPE 2(RCM and CM)'.$pd_id);
$mail_id = $rcm_mail_id;
$msg = "PD for Loan Application ID-".$core_details[0]['pd_sno']." (".$core_details[0]['applicant_name'].") have been triggered to the vendor. ";
$subject = "PD allocated to vendor for application ID - ".$core_details[0]['pd_sno'] ." & ".$core_details[0]['applicant_name'];
// $mail->addBCC("ps9064515@gmail.com");
// $mail_id = 'ps9064515@gmail.com';
$ref_str = "vendor email id";
}else if($flag == 1){
// mail - Agency
// $mail_id = "venbalap08@gmail.com";
log_message('ERROR','#### MW AGENCY-MAIL CALLED TYPE 1 AGENCY '.$pd_id);
}
if($flag == 1){ // Mail Content For - Agency ONLY
log_message('ERROR','#### MW AGENCY-MAIL CALLED TYPE 1(AGENCY)'.$pd_id);
$mail_id = $core_details[0]['agency_mail'];
$msg = "PD for Loan Application ID - ".$core_details[0]['pd_sno'] ." & ". $core_details[0]['applicant_name']." have been allocated to you. ";
$subject = "PD allocated for application ID - ".$core_details[0]['pd_sno'] ." & ". $core_details[0]['applicant_name'];
$ref_str = "client email id";
// $mail->addBCC("venbalap08@gmail.com");
}else if($flag == 3){
log_message('ERROR','#### MW-AGENCY MAIL CALLED TYPE 3 TRIGGER '.$pd_id);
}
if($flag == 3){ // Mail Conent For - Allocated Person ONLY
log_message('ERROR','#### MW-AGENCY MAIL CALLED TYPE 3(Normal Allocated Person) '.$pd_id);
$mail_id = $core_details[0]['allocated_email'];
$CI->db->SELECT("*");
$CI->db->FROM(PDNOTIFICATIONMSG." as PDNOTIFICATIONMSG");
@ -773,8 +773,24 @@ class PDALERTS
if(!empty($ref_str)){
$msg .= "<br><br><br> This is an automatically generated notification mail. Please contact on ".$ref_str." for any
queries/update. ";
if(!empty($mail_id)){
$arg = array('mail'=>$mail_id,'pd_id'=>$pd_id,'msg'=>$msg,'subject'=>$subject);
SELF::send_smcagencymail($CI,$arg);
}else{
log_message('ERROR','#### MW AGENCY-MAIL NOT CALLED - NO Email');
}
}
}else{
// log_message('INFO','### MWISE-CREDITPD(AGENCY) MAIL NOT SEND BCOZ '.count($core_details).' core_details');
}
}else{
// log_message('INFO','### MWISE-CREDITPD(AGENCY) MAIL NOT SEND BCOZ THERE IS NO PDID');
}
}//function closed here.
public static function send_smcagencymail($CI,$arg){
log_message('ERROR','#### MW AGENCY-MAIL CONTENT CALLED');
$mail = $CI->phpmailer_library->load();
$mail->IsSMTP(); // Telling the class to use SMTP
$mail->SMTPAuth = true;
$mail->SMTPDebug = 0;
@ -785,35 +801,28 @@ class PDALERTS
$mail->Port = 465; // "The port"
$mail->From = 'noreply@pdgenie.com';
$fromName = 'PD Genie';
$mail->addAddress($mail_id);
$mail->addAddress($arg["mail"]);
$subject = $arg["subject"];
if(ENVIRONMENT == 'testing' || ENVIRONMENT == 'development') {
$fromName .= ' ( TEST ENV- check ) ';
$subject .= ' ( TEST ENV- check ) ';
// $mail->addBCC("sanjeev.p@venbainfotech.com");
$mail->addBCC("ssa@venbainfotech.com");
// $mail->addBCC("venbalap08@gmail.com");
}
$mail->FromName = $fromName;
$mail->isHTML(true);
$mail->Subject = $subject;
$mail->Body = 'Dear Team ,<br><br> '.$msg;
$mail->AltBody = $msg;
// print_r($mail);die();
$mail->Body = 'Dear Team ,<br><br> '.$arg["msg"];
$mail->AltBody = $arg["msg"];
if(!$mail->send()) {
// $logger->error("Mailer Error:" ,array($mail->ErrorInfo));
log_message('ERROR','#### MW AGENCY-MAIL NOT SEND '.$pd_id.' - ERR - '.$mail->ErrorInfo);
log_message('ERROR','#### MW AGENCY-MAIL NOT SEND '.$arg["pd_id"].' - ERR - '.$mail->ErrorInfo);
}
else{
log_message('ERROR','#### MW AGENCY-MAIL SENDED SUCESSFULLY'.$subject);
log_message('ERROR','#### MW AGENCY-MAIL SENDED SUCESSFULLY'.$arg["subject"]);
}
$mail->SmtpClose();
}else{
// log_message('INFO','### MWISE-CREDITPD(AGENCY) MAIL NOT SEND BCOZ '.count($core_details).' core_details');
}
}else{
// log_message('INFO','### MWISE-CREDITPD(AGENCY) MAIL NOT SEND BCOZ THERE IS NO PDID');
}
}//function closed here.
$mail->SmtpClose();
}
}

View File

@ -2351,13 +2351,14 @@ class PD_Model extends SPARQ_Model {
$map_id = "";
}
}
$this->db->SELECT('TEMPLATE_JSON_V2.map_id,TEMPLATE_JSON_V2.form_id,PDFORMS.pd_form_order,PDFORMS.pd_form_level_order,PDFORMS.pd_form_name as form_name,TEMPLATE_JSON_V2.is_form_disabled');
$this->db->SELECT('TEMPLATE_JSON_V2.map_id,TEMPLATE_JSON_V2.form_id,PDFORMS.pd_form_order,PDFORMS.pd_form_level_order,PDFORMS.pd_form_name as form_name,TEMPLATE_JSON_V2.is_form_disabled,PDFORMS.is_business_form,TEMPLATE_JSON_V2.is_group_form');
$this->db->FROM(TEMPLATE_JSON_V2.' as TEMPLATE_JSON_V2');
$this->db->JOIN(PDFORMS.' as PDFORMS','TEMPLATE_JSON_V2.form_id = PDFORMS.pd_form_id','LEFT');
$this->db->WHERE('TEMPLATE_JSON_V2.isactive',1);
$this->db->WHERE('TEMPLATE_JSON_V2.map_id',$map_id);
$this->db->ORDER_BY('PDFORMS.pd_form_order');
$template_forms = $this->db->GET()->result_array();
//here Hard-coded
if(count($template_forms) > 0){
array_push($template_forms,Array('map_id'=>$map_id,'form_id' => '18','pd_form_order' => '2','pd_form_level_order' => '1','form_name' => 'General Information','is_form_disabled'=>0));
array_push($template_forms,Array('map_id'=>$map_id,'form_id' => '26','pd_form_order' => '24','pd_form_level_order' => '1','form_name' => 'Photograph','is_form_disabled'=>0));
@ -2372,13 +2373,13 @@ class PD_Model extends SPARQ_Model {
if(!strcasecmp($pd_master_detials[0]['customer_segment_abbr'], 'SE-AI')){
array_push($buiness_related_form,16);//Assessed Income form id pushed for filter.
}
for($i=0;$i<count($template_forms);$i++){
if($template_forms[$i]['form_id'] == 13){
$template_forms[$i]['is_group_form'] = 1;
}else{
$template_forms[$i]['is_group_form'] = 0;
}
}
// for($i=0;$i<count($template_forms);$i++){
// if($template_forms[$i]['form_id'] == 13){
// $template_forms[$i]['is_group_form'] = 1;
// }else{
// $template_forms[$i]['is_group_form'] = 0;
// }
// }
for($j=0;$j<count($buiness_related_form);$j++){
$keyValue = $buiness_related_form[$j];
$key = 'form_id';

View File

@ -314,11 +314,12 @@ class Template_Management_Model extends SPARQ_Model {
}
public function getTemplateFormsV2($value){
$this->db->SELECT('TEMPLATE_JSON_V2.form_id,PDFORMS.pd_form_name as form_name,TEMPLATE_JSON_V2.json,TEMPLATE_JSON_V2.is_form_disabled');
$this->db->SELECT('TEMPLATE_JSON_V2.form_id,PDFORMS.pd_form_name as form_name,TEMPLATE_JSON_V2.json,TEMPLATE_JSON_V2.is_form_disabled,PDFORMS.is_business_form,TEMPLATE_JSON_V2.is_group_form');
$this->db->FROM(TEMPLATE_JSON_V2.' as TEMPLATE_JSON_V2');
$this->db->JOIN(PDFORMS.' as PDFORMS','TEMPLATE_JSON_V2.form_id = PDFORMS.pd_form_id','LEFT');
$this->db->WHERE('TEMPLATE_JSON_V2.isactive',1);
$this->db->WHERE('TEMPLATE_JSON_V2.map_id',$value);
$this->db->WHERE('PDFORMS.is_business_form',0);
$result = $this->db->GET()->result_array();
return $result;
}
@ -343,4 +344,22 @@ class Template_Management_Model extends SPARQ_Model {
return count($afftectedRows)>0 ? true: false;
}
public function getBuinessGroupForms($map_id){
$this->db->SELECT('TEMPLATE_JSON_V2.form_id,PDFORMS.pd_form_order,PDFORMS.pd_form_level_order,PDFORMS.pd_form_name as form_name,TEMPLATE_JSON_V2.is_form_disabled,PDFORMS.is_business_form,TEMPLATE_JSON_V2.is_group_form');
if(!empty($map_id)){
$this->db->SELECT('TEMPLATE_JSON_V2.map_id');
$this->db->FROM(TEMPLATE_JSON_V2.' as TEMPLATE_JSON_V2');
$this->db->JOIN(PDFORMS.' as PDFORMS','TEMPLATE_JSON_V2.form_id = PDFORMS.pd_form_id','LEFT');
$this->db->WHERE('TEMPLATE_JSON_V2.map_id',$map_id);
}else{
$this->db->FROM(PDFORMS.' as PDFORMS');
$this->db->JOIN(TEMPLATE_JSON_V2.' as TEMPLATE_JSON_V2','TEMPLATE_JSON_V2.form_id = PDFORMS.pd_form_id','LEFT');
}
$this->db->WHERE('TEMPLATE_JSON_V2.isactive',1);
$this->db->WHERE('PDFORMS.is_business_form',1);
$result = $this->db->GET()->result_array();
return $result;
}
}