diff --git a/api/application/helpers/pdalerts_helper.php b/api/application/helpers/pdalerts_helper.php index af69fd26..366a7bc7 100644 --- a/api/application/helpers/pdalerts_helper.php +++ b/api/application/helpers/pdalerts_helper.php @@ -697,20 +697,42 @@ class PDALERTS if($pd_id != "" || $pd_id != null) { // $CI->db->SELECT("PDTRIGGER.pd_id,PDTRIGGER.pd_sno,ENTITY.short_name,PRODUCT.abbr,'concat(USERPROFILE.first_name,' ',USERPROFILE.last_name)' as officer_name,AGENCYLIST.agency_name,USERPROFILE.vendor_status,AGENCYLIST.mail_id,USERPROFILE.email"); - $CI->db->SELECT("PDTRIGGER.pd_id,PDTRIGGER.pd_sno,concat(USERPROFILE.first_name,'',USERPROFILE.last_name) as officer_name,AGENCYLIST.agency_name,PDTRIGGER.vendor_status,AGENCYLIST.mail_id,USERPROFILE.email"); - $CI->db->FROM(PDTRIGGER.' as PDTRIGGER'); - $CI->db->JOIN(AGENCYLIST. ' as AGENCYLIST','PDTRIGGER.pd_agency_id = AGENCYLIST.agency_id'); - $CI->db->JOIN(USERPROFILE. ' as USERPROFILE','PDTRIGGER.fk_pd_allocated_to = USERPROFILE.userid'); - $CI->db->WHERE('PDTRIGGER.pd_id',$pd_id); - $pd_data = $CI->db->GET()->result_array(); - - if(count($pd_data)) + // $CI->db->SELECT("PDTRIGGER.pd_id,PDTRIGGER.pd_sno,concat(USERPROFILE.first_name,'',USERPROFILE.last_name) as officer_name,AGENCYLIST.agency_name,PDTRIGGER.vendor_status,AGENCYLIST.mail_id,USERPROFILE.email"); + // $CI->db->FROM(PDTRIGGER.' as PDTRIGGER'); + // $CI->db->JOIN(AGENCYLIST. ' as AGENCYLIST','PDTRIGGER.pd_agency_id = AGENCYLIST.agency_id'); + // $CI->db->JOIN(USERPROFILE. ' as USERPROFILE','PDTRIGGER.fk_pd_allocated_to = USERPROFILE.userid'); + // $CI->db->WHERE('PDTRIGGER.pd_id',$pd_id); + // $pd_data = $CI->db->GET()->result_array(); + $CI->db->SELECT("PDTRIGGER.pd_id,PDTRIGGER.pd_sno,PDTRIGGER.fk_lender_id,ENTITY.short_name, + PDTRIGGER.scheduled_on,PDTRIGGER.pd_date_of_initiation,PDTRIGGER.updatedon,PDTRIGGER.encrypted_url, + PDTRIGGER.lender_applicant_id,PDTRIGGER.fk_pd_type,PDTRIGGER.pd_status,PDTRIGGER.vendor_status, + PDTRIGGER.fk_pd_allocated_to,ALLOCATED.email as allocated_email,PDAPPLICANTSDETAILS.applicant_name, + concat(ALLOCATED.first_name,' ',ALLOCATED.last_name) as pdofficer_name, + PDTRIGGER.pd_agency_id,AGENCYLIST.agency_name,AGENCYLIST.mail_id as agency_mail"); + $CI->db->FROM(PDTRIGGER." as PDTRIGGER"); + $CI->db->JOIN(ENTITY." as ENTITY","PDTRIGGER.fk_lender_id = ENTITY.entity_id",'LEFT'); + $CI->db->JOIN(AGENCYLIST. ' as AGENCYLIST','PDTRIGGER.pd_agency_id = AGENCYLIST.agency_id','LEFT'); + $CI->db->JOIN(USERPROFILE." as ALLOCATED","PDTRIGGER.fk_pd_allocated_to = ALLOCATED.userid",'LEFT'); + $CI->db->JOIN(PDAPPLICANTSDETAILS." as PDAPPLICANTSDETAILS","PDTRIGGER.pd_id = PDAPPLICANTSDETAILS.fk_pd_id AND PDAPPLICANTSDETAILS.applicant_type = 1",'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(); - $content = "Hi ".$pd_data[0]['officer_name'].",

MW-credit PD (".$pd_data[0]['pd_sno'].") is Allocated to You"; + // $content = "Hi Sir/Mam".$pd_data[0]['officer_name'].",

MW-credit PD (".$pd_data[0]['officer_name'].") is Allocated to You"; + $CI->db->SELECT("*"); + $CI->db->FROM(PDNOTIFICATIONMSG." as PDNOTIFICATIONMSG"); + $CI->db->WHERE("PDNOTIFICATIONMSG.pd_status",ALLOCATED); + $CI->db->WHERE("PDNOTIFICATIONMSG.isactive",1); + $pd_notification_msg = $CI->db->GET()->result_array(); + // print_r($pd_notification_msg);die(); + $msg = $pd_notification_msg[0]['lender']; + $msg = self::stringReplace($msg,$core_details,'MAIL'); + $mail->IsSMTP(); // Telling the class to use SMTP - $mail_id1 = $pd_data[0]['email']; - $mail_id2 = $pd_data[0]['mail_id']; + $mail_id1 = $core_details[0]['allocated_email']; $mail->SMTPAuth = true; $mail->SMTPDebug = 0; $mail->SMTPSecure = "ssl"; @@ -718,39 +740,34 @@ class PDALERTS $mail->Username = "noreply@ssa.sineedge.com"; // "The account" $mail->Password = "noreply@ssa"; // "The password" $mail->Port = 465; // "The port" - if(ENVIRONMENT == 'testing'){ $mail->addBCC("venkiraj0@gmail.com");$mail->addBCC("venbalap08@gmail.com");} - $mail->addAddress($mail_id1); // - $mail->addBCC($mail_id2); // $mail->From = 'noreply@pdgenie.com'; - $fromName = 'PD Genie'; if(ENVIRONMENT == 'testing' || ENVIRONMENT == 'development') { $fromName .= ' ( TEST ENV ) '; } + $fromName = 'PD Genie'; + $subject = 'PD Allocated For Application ID -'.$core_details[0]['lender_applicant_id']; + $mail->addAddress($mail_id1); + if(ENVIRONMENT == 'testing' || ENVIRONMENT == 'development') { + $fromName .= ' ( TEST ENV ) '; + $subject .= ' ( TEST ENV ) '; + $mail->addBCC("venkiraj0@gmail.com");$mail->addBCC("venbalap08@gmail.com"); + } $mail->FromName = $fromName; - $mail->isHTML(true); // Set email format to HTML - $mail->Subject = "Mwise-credit PD Allocation"; - $mail->Body = $content; - $mail->AltBody = $content; - - // $try = 1; - // sendMailAgain: - // if(!$mail->send()) { - // //$logger->error("Mailer Error:" ,array($mail->ErrorInfo)); - // //echo 'not send'; - // log_message('ERROR','###MWISE-CREDITPD MAIL NOT SEND'.$content[1].'- mail Error - '.$mail->ErrorInfo); - // if($try == 4) - // { - // goto stopSendAttempt; - // } - // $try++; - // log_message('ERROR','###MWISE-CREDITPD MAIL attempt'.$try.' '.$content[1].'- mail Error - '.$mail->ErrorInfo); - // goto sendMailAgain; - - // } else { - // //$logger->info("Mailer Send:" ,array('mail_ID' => $lender_email,'Status' => 'SEND')); - // log_message('ERROR','####MWISE-CREDITPD MAIL SEND'.$content[1]); - // } - // stopSendAttempt: + $mail->isHTML(true); + $mail->Subject = $subject; + $mail->Body = 'Dear Team

'.$msg; + $mail->AltBody = $msg; + if(!$mail->send()) { + // $logger->error("Mailer Error:" ,array($mail->ErrorInfo)); + log_message('ERROR','### MWISE-CREDITPD(AGENCY) MAIL NOT SEND'.$subject.'- mail Error - '.$mail->ErrorInfo); + } + else{ + // log_message('INFO','### MWISE-CREDITPD(AGENCY) MAIL SENDED SUCESSFULLY'.$subject); + } + }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. } diff --git a/api/application/views/report_templates/JSONTOREPORT_SAL.php b/api/application/views/report_templates/JSONTOREPORT_SAL.php index 7a3ce959..51d9bcdb 100644 --- a/api/application/views/report_templates/JSONTOREPORT_SAL.php +++ b/api/application/views/report_templates/JSONTOREPORT_SAL.php @@ -1258,6 +1258,16 @@ defined('BASEPATH') OR exit('No direct script access allowed'); echo $employeement_data['total_business_previous_experience'] ? ("

Previously, applicant ".$employeement_data['total_business_previous_experience']) : ''; + if(isset($employeement_data['employer_applicant_relation']) && $employeement_data['employer_applicant_relation'] == 'yes'){ + echo '

Employer and applicant are relatives. Employer is ( '.$employeement_data['employer_applicant_relation_type'].' ) of applicant.

'; + }else if(isset($employeement_data['employer_applicant_relation']) && $employeement_data['employer_applicant_relation'] == 'no'){ + echo '

There is no relationship between employer and applicant.

'; + } + + if(isset($employeement_data['no_of_employee_in_firm'])){ + echo '

Number of employees working in firm '.$employeement_data['no_of_employee_in_firm'].'

'; + } + // echo $employeement_data['was_met'] == 'no'? "

No one was met at the visited premises who could confirm the employment details of loan applicant.

":"

During PD visit, ".$employeement_data['name_person_met'].' ( '. ($employeement_data['others_person_met'] ? $employeement_data['others_person_met'] : $employeement_data['designation_person_met_master']) .' ) was met at the visited premises.'; // echo ($employeement_data['confirm_salary'] == 'no'? '

Salary amount was not confirmed person met/contacted because '.$employeement_data['sal_amount_was_not_confirmed'].'

' : '

Salary amount confirmed by person met/contacted is '.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($employeement_data['confirm_salary_amount']).'.

'); diff --git a/api/application/views/report_templates/JSONTOREPORT_SAL_SMARTPD.php b/api/application/views/report_templates/JSONTOREPORT_SAL_SMARTPD.php index 6ec5581c..de1ca7b5 100644 --- a/api/application/views/report_templates/JSONTOREPORT_SAL_SMARTPD.php +++ b/api/application/views/report_templates/JSONTOREPORT_SAL_SMARTPD.php @@ -1183,6 +1183,16 @@ font-weight: bolder;; echo $employeement_data['total_business_previous_experience'] ? ("

Previously, applicant ".$employeement_data['total_business_previous_experience']) : ''; + if(isset($employeement_data['employer_applicant_relation']) && $employeement_data['employer_applicant_relation'] == 'yes'){ + echo '

Employer and applicant are relatives. Employer is ( '.$employeement_data['employer_applicant_relation_type'].' ) of applicant.

'; + }else if(isset($employeement_data['employer_applicant_relation']) && $employeement_data['employer_applicant_relation'] == 'no'){ + echo '

There is no relationship between employer and applicant.

'; + } + + if(isset($employeement_data['no_of_employee_in_firm'])){ + echo '

Number of employees working in firm '.$employeement_data['no_of_employee_in_firm'].'

'; + } + // echo $employeement_data['was_met'] == 'no'? "

No one was met at the visited premises who could confirm the employment details of loan applicant.

":"

During PD visit, ".$employeement_data['name_person_met'].' ( '. ($employeement_data['others_person_met'] ? $employeement_data['others_person_met'] : $employeement_data['designation_person_met_master']) .' ) was met at the visited premises.'; // echo ($employeement_data['confirm_salary'] == 'no'? '

Salary amount was not confirmed person met/contacted because '.$employeement_data['sal_amount_was_not_confirmed'].'

' : '

Salary amount confirmed by person met/contacted is '.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($employeement_data['confirm_salary_amount']).'.

'); @@ -1238,7 +1248,7 @@ font-weight: bolder;; // echo $employeement_data['bonus_incentive'] ? "

The applicant receives a bonus ( ".($employeement_data['bonus_type'] == 'others' ? $employeement_data['bonus_type_other']: $employeement_data['bonus_type']).") of ".$rupee_symbol." ".MYUTIL::customIndianNumberFormat($employeement_data['bonus_incentive'])." ".$employeement_data['bonus_frequency_master'].'.

': '

Applicant does not get any Bonus amount or Incentives.

'; - echo $employeement_data['id_card_issued_company'] == 'yes' ? '

ID card issued by employer was seen by PD officer and same is available in zipped file enclosed with report.

' : '

ID card issued by employer was not seen because, '.$employeement_data['why_company_id_proof_not_available'].'

'; + echo $employeement_data['id_card_issued_company'] == 'yes' ? '

ID card issued by employer was seen by PD officer and same is available in zipped file enclosed with report.

' : '

ID card issued by employer was not seen because, '.$employeement_data['why_company_id_proof_not_available'].'

'; //echo "
***********************************"; echo $employeement_data['employment_remarks'] != "" ? "

".$employeement_data['employment_remarks']."

": ""; diff --git a/api/application/views/report_templates/JSONTOREPORT_SAL_TELE_PD.php b/api/application/views/report_templates/JSONTOREPORT_SAL_TELE_PD.php index 7c0470b6..5908fe27 100644 --- a/api/application/views/report_templates/JSONTOREPORT_SAL_TELE_PD.php +++ b/api/application/views/report_templates/JSONTOREPORT_SAL_TELE_PD.php @@ -1158,6 +1158,16 @@ defined('BASEPATH') OR exit('No direct script access allowed'); echo $employeement_data['total_business_previous_experience'] ? ("

Previously, applicant ".$employeement_data['total_business_previous_experience']) : ''; + if(isset($employeement_data['employer_applicant_relation']) && $employeement_data['employer_applicant_relation'] == 'yes'){ + echo '

Employer and applicant are relatives. Employer is ( '.$employeement_data['employer_applicant_relation_type'].' ) of applicant.

'; + }else if(isset($employeement_data['employer_applicant_relation']) && $employeement_data['employer_applicant_relation'] == 'no'){ + echo '

There is no relationship between employer and applicant.

'; + } + + if(isset($employeement_data['no_of_employee_in_firm'])){ + echo '

Number of employees working in firm '.$employeement_data['no_of_employee_in_firm'].'

'; + } + echo $employeement_data['was_met'] == 'no'? "

No one was met at the visited premises who could confirm the employment details of loan applicant.

":"

During PD, ".$employeement_data['name_person_met'].' ( '. ($employeement_data['others_person_met'] ? $employeement_data['others_person_met'] : $employeement_data['designation_person_met_master']) .' ) was contacted for Tele PD.'; echo ($employeement_data['confirm_salary'] == 'no'? '

Salary amount was not confirmed because '.$employeement_data['sal_amount_was_not_confirmed'].'

' : '

Salary amount confirmed by person contacted is '.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($employeement_data['confirm_salary_amount']).'.

');