diff --git a/app/Config/Email.php b/app/Config/Email.php
index f7e3ae01..0876c49e 100644
--- a/app/Config/Email.php
+++ b/app/Config/Email.php
@@ -28,17 +28,17 @@ class Email extends BaseConfig
/**
* SMTP Server Hostname
*/
- public string $SMTPHost = 'mail.venbait.in';
+ public string $SMTPHost = 'smtp.gmail.com';
/**
* SMTP Username
*/
- public string $SMTPUser = 'bbone@venbait.in';
+ public string $SMTPUser = 'venbatechnologies@gmail.com';
/**
* SMTP Password
*/
- public string $SMTPPass = 'xk!L(N_-R#};';
+ public string $SMTPPass = 'dsfllmxdzxxkcxgz';
/**
* SMTP Port
diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index f4df6e62..4778427f 100644
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -272,6 +272,7 @@ $routes->get("processjob", "JobWorker::processJob");
$routes->post("/employeeRest/verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber");
$routes->post("/employeeRest/getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData");
$routes->post("/employeeRest/verifyMpin", "RestAuthenticationController::verifyMpin");
+$routes->post("/employeeRest/checkMpin", "RestAuthenticationController::checkMpin");
//HR login api's
$routes->post("/employeeRest/verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber");
$routes->post("/employeeRest/getVerifiedHrData", "RestAuthenticationController::getVerifiedHrData");
diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php
index 96537b76..f1d6f143 100644
--- a/app/Controllers/EmpDataServiceController.php
+++ b/app/Controllers/EmpDataServiceController.php
@@ -3600,6 +3600,7 @@ class EmpDataServiceController extends BaseController
public function sendMailForDownloadingECard(array $ids)
{
+
$this->myLogger->logme('error', 'sendMailForDownloadingECard - function called');
if (count($ids) > 0) {
@@ -3655,14 +3656,15 @@ class EmpDataServiceController extends BaseController
$params['get_emp_email_and_other_details'] = $get_emp_email_and_other_details;
// $this->myLogger->logme('error', 'sendMailForDownloadingECard - Send Bulk Mail function end ',);
- if (isset($get_emp_email_and_other_details['email_corporate']) && !empty($get_emp_email_and_other_details['email_corporate']) && $get_emp_email_and_other_details['relationship'] === 'Self') {
+ if (isset($get_emp_email_and_other_details['email_corporate']) && !empty($get_emp_email_and_other_details['email_corporate']) && $get_emp_email_and_other_details['relationship'] == 'Self') {
$wholeData[] = sendMailNotification::sendMailNotification('member_ecard_mail', $params);
+ // print_r($wholeData);die;
$count++;
}
+
$counts++;
-
if ($count == 20 || $counts == count($ids) - 1) {
if(count($wholeData) > 0){
diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php
index 6dcd79c2..d7ba79f2 100644
--- a/app/Controllers/EmployeeRestController.php
+++ b/app/Controllers/EmployeeRestController.php
@@ -661,7 +661,6 @@ class EmployeeRestController extends AdminController
$empServiceController = new EmployeeServiceController();
$result = $empServiceController->excelFileFormatValidation(['file_id' => $file_id]);
-
if(isset($result['error_summary']) && count($result['error_summary']))
{
$result = $empServiceController->getExcelErrorData($file_id);
@@ -1755,7 +1754,7 @@ public function iAgreeForAddOn()
{
$postData = json_decode($this->request->getBody(), true);
$client_policy_id = $postData['client_policy_id'];
-
+ sort($client_policy_id);
// Alternatively, you can use echo to see the type
$emp_code = $postData['emp_code'];
$client_id = $postData['client_id'];
@@ -1765,21 +1764,29 @@ public function iAgreeForAddOn()
->where('is_active', 1 )
->set(array('emp_status'=>'enrolled'))
->update();
+
+ $empData = $this->employeeModel->where('emp_code', $emp_code )->where('client_id', $client_id ) ->where('is_active', 1 )->findAll();
if (!is_null($client_policy_id) && is_array($client_policy_id))
{
$array_list = [];
foreach ($client_policy_id as $key => $value)
{
- $this->employeePolicyModel->where('client_policy_id', $value )
+ foreach ($empData as $empDataKey => $empDataValue)
+ {
+ $this->employeePolicyModel->where('client_policy_id', $value )
->where('is_active', 1 )
+ ->where('employee_id', $empDataValue['id'] )
->set(array('status'=>'enrolled'))
->update();
+ }
+
$find = $this->employeeModel->getEmpFamilybyEmpCode(client_policy_id: $value,emp_code: $emp_code,client_id: $client_id,emp_status:['draft','enrolled'],policy_status:['draft','enrolled']);
if(count($find) > 0){
$array_list[] = $find;
}
}
+
$notification = $this->notificationModel->where('client_id' ,$client_id)->where('template_name', 'member_review_and_summary_mail')->first();
@@ -1789,22 +1796,25 @@ public function iAgreeForAddOn()
$params ['emp_code'] = $emp_code;
$params ['client_id'] = $client_id;
$params ['notification'] = $notification;
-
+ // print_r($params);die;
$wholeData =sendMailNotification::sendMailNotification('member_review_and_summary_mail', $params);
- MailHelper::send_email($wholeData[0]);
+ $mail_send_return = MailHelper::send_email($wholeData[0]);
+ $this->myLogger->logme("info", $mail_send_return);
if (isset($wholeData[0])) {
$account_manager_wholeData =sendMailNotification::sendMailNotification('account_maneger_summary_mail', $params);
foreach ($account_manager_wholeData as $key => $value) {
- MailHelper::send_email($value);
+ $mail_send_return1 = MailHelper::send_email($value);
+ $this->myLogger->logme("info", $mail_send_return1);
}
$client_hr_wholeData =sendMailNotification::sendMailNotification('client_hr_summary_mail', $params);
foreach ($client_hr_wholeData as $key => $value) {
- MailHelper::send_email($value);
+ $mail_send_return2 = MailHelper::send_email($value);
+ $this->myLogger->logme("info", $mail_send_return2);
}
}
}
diff --git a/app/Controllers/RestAuthenticationController.php b/app/Controllers/RestAuthenticationController.php
index 4e5cf279..6efaa163 100644
--- a/app/Controllers/RestAuthenticationController.php
+++ b/app/Controllers/RestAuthenticationController.php
@@ -310,6 +310,25 @@ class RestAuthenticationController extends AdminController
}
}
+ public function checkMpin()
+ {
+ try {
+ $mobile_number = $this->request->getJSON()->mobile_number;
+
+
+ $employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first();
+
+ if ($employeeData && $employeeData["mpin"] != null) {
+
+ return $this->respond(['status' => 'success','code' => 200,'data' => "Mpin - exist" , 'Mpin' =>$employeeData["mpin"]],200);
+ } else {
+ return $this->respond(['status' => 'failed','code' => 404,'data' => "Mpin - not found", 'Mpin' =>null],200);
+ }
+ } catch (\Exception $e) {
+ return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()],500);
+ }
+ }
+
}
\ No newline at end of file
diff --git a/app/Helpers/sendMailNotification.php b/app/Helpers/sendMailNotification.php
index 91bd81d9..5a35ccd2 100644
--- a/app/Helpers/sendMailNotification.php
+++ b/app/Helpers/sendMailNotification.php
@@ -12,6 +12,7 @@ class sendMailNotification
{
public static function sendMailNotification($action, $params)
{
+ print_r($params);die;
if ($action == 'member_welcome_mail') {
$dataToInsert = $params['dataToInsert'];
$notification = $params['notification'];
@@ -37,7 +38,6 @@ class sendMailNotification
return $wholeData;
} else if($action == 'member_reminder_mail'){
- // print_r($params);die;
$EmployeeModel = new EmployeeModel();
$emp_data = $params['emp_data'];
$notification_data = $params['notification_data'];
@@ -100,11 +100,16 @@ class sendMailNotification
$mail_content = $notification['mail_content'];
$mail = $get_emp_email_and_other_details['email_corporate'];
$subject = $notification['subject'];
+
$link = generate_download_link($rand_string);
+
$app_link = $_ENV['App_Url'];
$name = $get_emp_email_and_other_details['name'];
$mail_content = $notification['mail_content'];
+
$nhance_logo = $_ENV['NHANCE_LOGO'];
+ // dd("3333333333333");
+
$post_enrollment_app_link = $_ENV['POST_ENROLLMENT_APP_LINK'];
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
@@ -119,7 +124,6 @@ class sendMailNotification
// $mail_content = str_replace("[[tpa_id]]", $tpa_id, $mail_content);
$mail_content = str_replace("[[ecard_download_link]]", "Download Insurance Card", $mail_content);
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
-
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails']];
return $wholeData;
@@ -153,10 +157,12 @@ class sendMailNotification
// Step 1: Replace the placeholder with an HTML table structure
$mail = '';
- // print_r($array_list);die;
$table_content = '';
$addtional_premium = 0;
$gst = 0;
+ $Addon_list = [];
+ $name = '';
+ $emp_code = '';
foreach ($array_list as $item) {
if(count($item) != 0){
$table_content .= '
Policy Name : ';
@@ -165,12 +171,12 @@ class sendMailNotification
$is_addon ='';
foreach ($item as $inner_item) {
$policy_name = $inner_item['policy_name'];
- $temp_data .= '| ' . $inner_item['name'] . ' | '.$inner_item['mobile'].' | ₹'.number_format($inner_item['basic_cover_si'], 2, '.', ',').' | '.\DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y').' |
';
+ $temp_data .= '| ' . $inner_item['name'] . ' | '.$inner_item['relationship'].' | '. \DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y') .' | ₹'.format_indian_number($inner_item['basic_cover_si']).' | ₹'.format_indian_number($inner_item['premium']).' | ₹'. format_indian_number($inner_item['gst']) .' |
';
if($inner_item['relationship'] == 'Self' || $inner_item['relationship'] == 'self'){
$mail = $inner_item['email_corporate'];
$name = $inner_item['name'];
+ $emp_code = $inner_item['emp_code'];
}
- // print_r($inner_item);die;
$is_addon = $inner_item['is_addon'];
if($inner_item['is_addon'] == 2 || $inner_item['is_addon'] == 3){
@@ -179,10 +185,9 @@ class sendMailNotification
}
}
// echo $policy_name;die;
- $table_content .= $policy_name.'| Name | Mobile Number | Sum Insure | Date Of Birth |
';
+ $table_content .= $policy_name.'| Name | Relation | Date Of Birth | Sum Insure | Premium | GST
';
$table_content .= $temp_data;
$table_content .= '
';
- $Addon_list = [];
if ($is_addon == 2 || $is_addon == 3) {
$addon_list_array = [
'policy_name'=>$policy_name,
@@ -190,7 +195,7 @@ class sendMailNotification
'gst'=>$gst
];
$Addon_list[]= $addon_list_array;
-
+
}
@@ -200,17 +205,20 @@ class sendMailNotification
}
}
+ if(count($Addon_list) != 0 && count($Addon_list) > 0){
+ $table_content .='
| Policy Name | Additional Premium | GST | Total |
';
+ $sum_tolal = 0;
+ foreach ($Addon_list as $key => $value) {
+ $sum_tolal = $value['gst'] + $value['addtional_premium'] + $sum_tolal;
+ $table_content .= '| '.$value['policy_name'].' | ₹'.$value['addtional_premium'].' | '.$value['gst'].' | '.$value['gst'] + $value['addtional_premium'] .' |
';
+ }
+ $sum_total_words = numberToWords($sum_tolal);
+ $table_content .= ' | | Total | '.format_indian_number($sum_tolal).' |
';
+ $table_content .= '
';
+ $table_content .= ''. $sum_total_words .'
';
- $table_content .='
| Policy Name | Additional Premium | GST | Total |
';
- $sum_tolal = 0;
- foreach ($Addon_list as $key => $value) {
- $sum_tolal = $value['gst'] + $value['addtional_premium'] + $sum_tolal;
- $table_content .= '| '.$value['policy_name'].' | ₹'.$value['addtional_premium'].' | '.$value['gst'].' | '.$value['gst'] + $value['addtional_premium'] .' |
';
}
- $table_content .= ' | | Total | '.$sum_tolal.' |
';
- $table_content .= '
';
- $mail_content = str_replace("[[member_name]]", $name, $mail_content);
-
+ $mail_content = str_replace("[[member_name]]", $name . ' (' . $emp_code . ')' , $mail_content);
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
// $mail = "aadhavanvalli@gmail.com";
// if (isset($mail) && !empty($mail)) {
@@ -220,7 +228,6 @@ class sendMailNotification
return $wholeData;
}
- // print_r($wholeData);die;
} else if($action == 'account_maneger_summary_mail'){
$client_id = $params['client_id'];
@@ -242,7 +249,6 @@ class sendMailNotification
$user_list[]=$user_data;
}
}
- // print_r($client_rm_data);die;
@@ -262,12 +268,11 @@ class sendMailNotification
// Step 1: Replace the placeholder with an HTML table structure
$mail = '';
- // print_r($array_list);die;
$table_content = '';
$addtional_premium = 0;
$gst = 0;
$array_list = $params['array_list'];
-
+ $Addon_list = [];
foreach ($array_list as $item) {
if(count($item) != 0){
$table_content .= 'Policy Name : ';
@@ -276,19 +281,24 @@ class sendMailNotification
$is_addon ='';
foreach ($item as $inner_item) {
$policy_name = $inner_item['policy_name'];
- $temp_data .= '| ' . $inner_item['name'] . ' | '.$inner_item['mobile'].' | ₹'.number_format($inner_item['basic_cover_si'], 2, '.', ',').' | '.\DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y').' |
';
- // print_r($inner_item);die;
+ if($inner_item['relationship'] == 'Self'){
+ $emp_code = ' ('. $inner_item['emp_code'] . ')';
+ }else{
+ $emp_code ='';
+ }
+ $temp_data .= '| ' . $inner_item['name'] . $emp_code . ' | '.$inner_item['relationship'].' | '. \DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y') .' | ₹'.format_indian_number($inner_item['basic_cover_si']).' | ₹'.format_indian_number($inner_item['premium']).' | ₹'. format_indian_number($inner_item['gst']) .' |
';
$is_addon = $inner_item['is_addon'];
if($inner_item['is_addon'] == 2 || $inner_item['is_addon'] == 3){
+
+
$addtional_premium = $inner_item['rata_premimum'] + $addtional_premium;
$gst = $inner_item['gst'] + $gst;
}
}
- $table_content .= $policy_name.'| Name | Mobile Number | Sum Insure | Date Of Birth |
';
+ $table_content .= $policy_name.'| Name | Relation | Date Of Birth | Sum Insure | Premium | GST
';
$table_content .= $temp_data;
$table_content .= '
';
- $Addon_list = [];
if ($is_addon == 2 || $is_addon == 3) {
$addon_list_array = [
'policy_name'=>$policy_name,
@@ -307,20 +317,23 @@ class sendMailNotification
}
+ if(count($Addon_list) != 0 && count($Addon_list) > 0){
+
+ $table_content .='
| Policy Name | Additional Premium | GST | Total |
';
+ $sum_tolal = 0;
+ foreach ($Addon_list as $key => $value) {
+ $sum_tolal = $value['gst'] + $value['addtional_premium'] + $sum_tolal;
+ $table_content .= '| '.$value['policy_name'].' | ₹'.$value['addtional_premium'].' | '.$value['gst'].' | '.$value['gst'] + $value['addtional_premium'] .' |
';
+ }
+ $sum_total_words = numberToWords($sum_tolal);
+ $table_content .= ' | | Total | '.format_indian_number($sum_tolal).' |
';
+ $table_content .= '
';
+ $table_content .= ''. $sum_total_words .'
';
- $table_content .='
| Policy Name | Additional Premium | GST | Total |
';
- $sum_tolal = 0;
- foreach ($Addon_list as $key => $value) {
- $sum_tolal = $value['gst'] + $value['addtional_premium'] + $sum_tolal;
- $table_content .= '| '.$value['policy_name'].' | ₹'.$value['addtional_premium'].' | '.$value['gst'].' | '.$value['gst'] + $value['addtional_premium'] .' |
';
}
- $table_content .= ' | | Total | '.$sum_tolal.' |
';
- $table_content .= '
';
-
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
$account_manager_mail_list = [];
- // print_r($user_list);die;
if(isset($user_list)){
foreach ($user_list as $key => $value) {
$full_name = $value['first_name'] .' ' .$value['last_name'];
@@ -372,19 +385,23 @@ class sendMailNotification
// Step 1: Replace the placeholder with an HTML table structure
$mail = '';
- // print_r($array_list);die;
$table_content = '';
$addtional_premium = 0;
$gst = 0;
$array_list = $params['array_list'];
+ $Addon_list = [];
foreach ($array_list as $item) {
$table_content .= 'Policy Name : ';
$temp_data ='';
foreach ($item as $inner_item) {
$policy_name = $inner_item['policy_name'];
- $temp_data .= '| ' . $inner_item['name'] . ' | '.$inner_item['mobile'].' | ₹'.number_format($inner_item['basic_cover_si'], 2, '.', ',').' | '.\DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y').' |
';
- // print_r($inner_item);die;
+ if($inner_item['relationship'] == 'Self'){
+ $emp_code = ' ('. $inner_item['emp_code'] . ')';
+ }else{
+ $emp_code ='';
+ }
+ $temp_data .= '| ' . $inner_item['name'] . $emp_code . ' | '.$inner_item['relationship'].' | '. \DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y') .' | ₹'.format_indian_number($inner_item['basic_cover_si']).' | ₹'.format_indian_number($inner_item['premium']).' | ₹'. format_indian_number($inner_item['gst']) .' |
';
$is_addon = $inner_item['is_addon'];
if($inner_item['is_addon'] == 2 || $inner_item['is_addon'] == 3){
@@ -392,10 +409,10 @@ class sendMailNotification
$gst = $inner_item['gst'] + $gst;
}
}
- $table_content .= $policy_name.'| Name | Mobile Number | Sum Insure | Date Of Birth |
';
+ $table_content .= $policy_name.'| Name | Relation | Date Of Birth | Sum Insure | Premium | GST
';
$table_content .= $temp_data;
$table_content .= '
';
- $Addon_list = [];
+
if ($is_addon == 2 || $is_addon == 3) {
$addon_list_array = [
'policy_name'=>$policy_name,
@@ -412,16 +429,18 @@ class sendMailNotification
$gst = 0;
}
-
- $table_content .='
| Policy Name | Additional Premium | GST | Total |
';
- $sum_tolal = 0;
- foreach ($Addon_list as $key => $value) {
- $sum_tolal = $value['gst'] + $value['addtional_premium'] + $sum_tolal;
- $table_content .= '| '.$value['policy_name'].' | ₹'.$value['addtional_premium'].' | '.$value['gst'].' | '.$value['gst'] + $value['addtional_premium'] .' |
';
+ if(count($Addon_list) != 0 && count($Addon_list) > 0){
+ $table_content .='
| Policy Name | Additional Premium | GST | Total |
';
+ $sum_tolal = 0;
+ foreach ($Addon_list as $key => $value) {
+ $sum_tolal = $value['gst'] + $value['addtional_premium'] + $sum_tolal;
+ $table_content .= '| '.$value['policy_name'].' | ₹'.$value['addtional_premium'].' | '.$value['gst'].' | '.$value['gst'] + $value['addtional_premium'] .' |
';
+ }
+ $sum_total_words = numberToWords($sum_tolal);
+ $table_content .= ' | | Total | '.format_indian_number($sum_tolal).' |
';
+ $table_content .= '
';
+ $table_content .= ''. $sum_total_words .'
';
}
- $table_content .= ' | | Total | '.$sum_tolal.' |
';
- $table_content .= '
';
-
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
@@ -438,5 +457,5 @@ class sendMailNotification
}
}
- }
+ }
}
\ No newline at end of file
diff --git a/app/Helpers/session_helper.php b/app/Helpers/session_helper.php
index ce6a0f56..92f443d2 100644
--- a/app/Helpers/session_helper.php
+++ b/app/Helpers/session_helper.php
@@ -139,3 +139,9 @@ if (!function_exists('get_session_context')) {
return $session->get('context');
}
}
+
+
+
+
+
+
diff --git a/app/Helpers/utility_helper.php b/app/Helpers/utility_helper.php
index 87945e48..da3f5f4c 100644
--- a/app/Helpers/utility_helper.php
+++ b/app/Helpers/utility_helper.php
@@ -248,3 +248,64 @@ if (!function_exists('get_role_id')) {
}
+function numberToWords($number)
+{
+ $words = array(
+ '0' => 'Zero',
+ '1' => 'One',
+ '2' => 'Two',
+ '3' => 'Three',
+ '4' => 'Four',
+ '5' => 'Five',
+ '6' => 'Six',
+ '7' => 'Seven',
+ '8' => 'Eight',
+ '9' => 'Nine',
+ '10' => 'Ten',
+ '11' => 'Eleven',
+ '12' => 'Twelve',
+ '13' => 'Thirteen',
+ '14' => 'Fourteen',
+ '15' => 'Fifteen',
+ '16' => 'Sixteen',
+ '17' => 'Seventeen',
+ '18' => 'Eighteen',
+ '19' => 'Nineteen',
+ '20' => 'Twenty',
+ '30' => 'Thirty',
+ '40' => 'Forty',
+ '50' => 'Fifty',
+ '60' => 'Sixty',
+ '70' => 'Seventy',
+ '80' => 'Eighty',
+ '90' => 'Ninety'
+ );
+
+ if ($number < 21) {
+ return $words[$number];
+ }
+
+ if ($number < 100) {
+ $tens = (int)($number / 10) * 10;
+ $units = $number % 10;
+ return $words[$tens] . ($units ? ' ' . $words[$units] : '');
+ }
+
+ if ($number < 1000) {
+ $hundreds = (int)($number / 100);
+ $remainder = $number % 100;
+ return $words[$hundreds] . ' Hundred' . ($remainder ? ' and ' . numberToWords($remainder) : '');
+ }
+
+ $levels = array('', ' Thousand', ' Million', ' Billion', ' Trillion', ' Quadrillion', ' Quintillion');
+
+ for ($i = 0, $unit = 1; $i < count($levels); $i++, $unit *= 1000) {
+ if ($number < $unit * 1000) {
+ $current = (int)($number / $unit);
+ $remainder = $number % $unit;
+ return numberToWords($current) . $levels[$i] . ($remainder ? ' ' . numberToWords($remainder) : '');
+ }
+ }
+
+ return $number; // Fallback for numbers beyond the supported range
+}
diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php
index a94410f5..3dfe16ec 100644
--- a/app/Models/EmployeePolicyModel.php
+++ b/app/Models/EmployeePolicyModel.php
@@ -101,6 +101,9 @@ class EmployeePolicyModel extends Model
'emp.emp_status',
'emp.is_active as emp_is_active',
'emp.mobile as mobile',
+ 'emp.doj',
+ 'emp.basic_pay',
+ 'emp.band as grade',
'policy_type.policy_type',
'cp.policy_no',
])