", $mail_content); $mail_content = str_replace("[[nhance_logo]]", "Nhance Logo", $mail_content); $mail_content = str_replace("[[member_name]]", $employee_name, $mail_content); $mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content); $mail_content = str_replace("[[app_link]]", "Review Details", $mail_content); if ($dataToInsert['relationship'] == 'Self' && $mail != null || $mail != '') { $wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to']]; } return $wholeData; } else if($action == 'member_reminder_mail'){ $EmployeeModel = new EmployeeModel(); $emp_data = $params['emp_data']; $notification_data = $params['notification_data']; $client_data = $params['client_data']; $subject = $notification_data['subject']; $app_link = $_ENV['App_Url']; $mail_content = $notification_data['mail_content']; $nhance_logo = $_ENV['NHANCE_LOGO']; $client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo']; $mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content); $mail_content = str_replace("[[nhance_logo]]", "Nhance Logo", $mail_content); $mail_content = str_replace("[[client_logo]]", "Client Logo", $mail_content); $mail_content = str_replace("[[app_link]]", "Review Details", $mail_content); if ($emp_data && (isset($notification_data) && $notification_data['enabled'] == 1)) { if(isset($emp_data['relationship'])){ if ($emp_data['relationship'] == 'Self') { if(count($emp_data) > 0){ $mail =''; if ($emp_data['relationship'] == 'Self') { $employee_name =$emp_data['name']; $mail_content = str_replace("[[member_name]]", $employee_name, $mail_content); $mail = $emp_data['email_corporate']; } } }else{ $mail =''; } }else{ $employee_name =$emp_data['name']; $mail_content = str_replace("[[member_name]]", $employee_name, $mail_content); $mail = $emp_data['email_corporate']; } if (isset($mail) && !empty($mail)) { $wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to']]; } }else{ foreach ($emp_data as $key => $value) { if ($value['relationship'] != 'Self') { $emp_data = $EmployeeModel->where('client_id', $client_data['id'])->where('emp_code', $value['emp_code'])->where('is_active',1)->findAll(); if(count($emp_data) > 1){ $mail =''; foreach ($emp_data as $key => $values) { if ($value['relationship'] == 'Self') { $employee_name =$values['name']; $mail_content = str_replace("[[member_name]]", $employee_name, $mail_content); $mail = $values['email_corporate']; } } }else{ $mail =''; } }else{ $employee_name =$value['name']; $mail_content = str_replace("[[member_name]]", $employee_name, $mail_content); $mail = $value['email_corporate']; } if (isset($mail) && !empty($mail)) { $wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to']]; } } } if (count($wholeData) < 1) { $wholeData = []; } return $wholeData; // }else{ // return "false"; // } } else if($action == 'member_ecard_mail'){ $notification = $params['notification']; $get_emp_email_and_other_details = $params['get_emp_email_and_other_details']; $rand_string = $params['rand_string']; $client_data = $params['client_data']; $tpa_id = $params['tpa_id']; $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']; // $client_logo = $nhance_logo; $mail_content = str_replace("[[nhance_logo]]", "Nhance Logo", $mail_content); $mail_content = str_replace("[[client_logo]]", "Client Logo", $mail_content); $mail_content = str_replace("[[member_name]]", $name, $mail_content); $mail_content = str_replace("[[app_link]]", "Review Details", $mail_content); $mail_content = str_replace("[[post_enrollment_app_link]]", "Review Details", $mail_content); // $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'], 'reply_to' => $client_data['reply_to']]; return $wholeData; } else if($action == 'member_review_and_summary_mail'){ $array_list = $params['array_list'];//employeee lst $client_policy_id = $params['client_policy_id']; $emp_code = $params['emp_code']; $client_id = $params['client_id']; $clientModel = new ClientModel(); $notificationModel = new NotificationModel(); $client_data =$clientModel->where('id', $client_id)->first(); $notification_data = $notificationModel->where('client_id' ,$client_id)->where('template_name', $action)->first(); // dd($notification_data); if (isset($notification_data) && $notification_data['enabled'] == 1) { $mail_content = $notification_data['mail_content']; $subject = $notification_data['subject']; $app_link = $_ENV['App_Url']; $nhance_logo = $_ENV['NHANCE_LOGO']; $client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo']; // $client_logo = $nhance_logo; $mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content); $mail_content = str_replace("[[nhance_logo]]", "Nhance Logo", $mail_content); $mail_content = str_replace("[[client_logo]]", "Client Logo", $mail_content); $mail_content = str_replace("[[app_link]]", "Review Details", $mail_content); // Step 1: Replace the placeholder with an HTML table structure $mail = ''; $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 : '; $temp_data = ''; $policy_name = ''; $is_addon = ''; foreach ($item as $inner_item) { $policy_name = $inner_item['policy_name']; if ($inner_item['relationship'] == 'Self') { $emp_code = ' (' . $inner_item['emp_code'] . ')'; } else { $emp_code = ''; } $temp_data .= ''; $temp_data .= '' . $inner_item['name'] . $emp_code . ''; $temp_data .= '' . $inner_item['relationship'] . ''; $temp_data .= '' . \DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y') . ''; $temp_data .= '₹' . format_indian_number($inner_item['basic_cover_si']) . ''; // Only Display SI Topup and Dependent Addon if ($inner_item['is_addon'] == 2 || $inner_item['is_addon'] == 3) { $temp_data .= '₹' . format_indian_number(round($inner_item['premium'])) . ''; $temp_data .= '₹' . format_indian_number(round($inner_item['gst'])) . ''; } $temp_data .= ''; $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 . '

'; $table_content .= ''; // Add text-align: center to the table head $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; // Only Display SI Topup and Dependent Addon if ($is_addon == 2 || $is_addon == 3) { $table_content .= ''; $table_content .= ''; } $table_content .= ''; $table_content .= ''; // Add text-align: center to the table body $table_content .= '' . $temp_data . ''; $table_content .= '
NameRelationDate Of BirthSum InsuredPremiumGST
'; if ($is_addon == 2 || $is_addon == 3) { $addon_list_array = [ 'policy_name' => $policy_name, 'addtional_premium' => round($addtional_premium), 'gst' => round($gst) ]; $Addon_list[] = $addon_list_array; } $temp_data = ''; $addtional_premium = 0; $gst = 0; } } if (count($Addon_list) > 0) { $table_content .= '
'; $table_content .= ''; // Center align for table header and body $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $sum_total = 0; foreach ($Addon_list as $key => $value) { $total_addon = $value['gst'] + $value['addtional_premium']; $sum_total += $total_addon; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; } $sum_total_words = numberToWords($sum_total); $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= '
Policy NameAdditional PremiumGSTTotal
' . $value['policy_name'] . '₹' . format_indian_number($value['addtional_premium']) . '₹' . format_indian_number($value['gst']) . '₹' . format_indian_number($total_addon) . '
Total₹' . format_indian_number($sum_total) . '
'; // $table_content .= '
' . $sum_total_words . '
'; } // print_r($table_content); die; $mail_content = str_replace("[[member_name]]", $name . ' (' . $emp_code . ')' , $mail_content); $mail_content = str_replace("[[member_summary]]", $table_content , $mail_content); // print_r($mail_content); die; // $mail = "aadhavanvalli@gmail.com"; // if (isset($mail) && !empty($mail)) { $wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to']]; // } return $wholeData; } } else if($action == 'account_maneger_summary_mail'){ $client_id = $params['client_id']; $clientModel = new ClientModel(); $notificationModel = new NotificationModel(); $clientRMModel =new ClientRMModel(); $client_data =$clientModel->where('id', $client_id)->first(); $notification_data = $notificationModel->where('client_id' ,$client_id)->where('template_name', $action)->first(); if (isset($notification_data) && $notification_data['enabled'] == 1) { $client_rm_data= $clientRMModel->where('client_id', $client_id)->where('is_active',1)->findAll(); $user_list= []; foreach ($client_rm_data as $key => $value) { if($value['level'] == 3){ $userModel = new UserModel(); $user_data = $userModel->where('id', $value['user_id'])->first(); $user_list[]=$user_data; } } $mail_content = $notification_data['mail_content']; $subject = $notification_data['subject']; $app_link = $_ENV['App_Url']; $nhance_logo = $_ENV['NHANCE_LOGO']; $client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo']; // $client_logo = $nhance_logo; $mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content); $mail_content = str_replace("[[nhance_logo]]", "Nhance Logo", $mail_content); $mail_content = str_replace("[[client_logo]]", "Client Logo", $mail_content); $mail_content = str_replace("[[app_link]]", "Review Details", $mail_content); // Step 1: Replace the placeholder with an HTML table structure $mail = ''; $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 : '; $temp_data = ''; $policy_name = ''; $is_addon = ''; foreach ($item as $inner_item) { $policy_name = $inner_item['policy_name']; if ($inner_item['relationship'] == 'Self') { $emp_code = ' (' . $inner_item['emp_code'] . ')'; } else { $emp_code = ''; } $temp_data .= ''; $temp_data .= '' . $inner_item['name'] . $emp_code . ''; $temp_data .= '' . $inner_item['relationship'] . ''; $temp_data .= '' . \DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y') . ''; $temp_data .= '₹' . format_indian_number($inner_item['basic_cover_si']) . ''; // Only Display SI Topup and Dependent Addon if ($inner_item['is_addon'] == 2 || $inner_item['is_addon'] == 3) { $temp_data .= '₹' . format_indian_number(round($inner_item['premium'])) . ''; $temp_data .= '₹' . format_indian_number(round($inner_item['gst'])) . ''; } $temp_data .= ''; $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 . '

'; $table_content .= ''; // Add text-align: center to the table head $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; // Only Display SI Topup and Dependent Addon if ($is_addon == 2 || $is_addon == 3) { $table_content .= ''; $table_content .= ''; } $table_content .= ''; $table_content .= ''; // Add text-align: center to the table body $table_content .= '' . $temp_data . ''; $table_content .= '
NameRelationDate Of BirthSum InsuredPremiumGST
'; if ($is_addon == 2 || $is_addon == 3) { $addon_list_array = [ 'policy_name' => $policy_name, 'addtional_premium' => round($addtional_premium), 'gst' => round($gst) ]; $Addon_list[] = $addon_list_array; } $temp_data = ''; $addtional_premium = 0; $gst = 0; } } if (count($Addon_list) > 0) { $table_content .= '
'; $table_content .= ''; // Center align for table header and body $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $sum_total = 0; foreach ($Addon_list as $key => $value) { $total_addon = $value['gst'] + $value['addtional_premium']; $sum_total += $total_addon; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; } $sum_total_words = numberToWords($sum_total); $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= '
Policy NameAdditional PremiumGSTTotal
' . $value['policy_name'] . '₹' . format_indian_number($value['addtional_premium']) . '₹' . format_indian_number($value['gst']) . '₹' . format_indian_number($total_addon) . '
Total₹' . format_indian_number($sum_total) . '
'; // $table_content .= '
' . $sum_total_words . '
'; } $mail_content = str_replace("[[member_summary]]", $table_content , $mail_content); $account_manager_mail_list = []; if(isset($user_list)){ foreach ($user_list as $key => $value) { $full_name = $value['first_name'] .' ' .$value['last_name']; $mail_content = str_replace("[[member_name]]", $full_name , $mail_content); $wholeData[] = ['mail' => $value['email'], 'subject' => $subject,'message'=> $mail_content, 'reply_to' => $client_data['reply_to']]; // $wholeData[] = ['mail' => $value['email'], 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']]; } return $wholeData; } } } else if($action == 'client_hr_summary_mail'){ $client_id = $params['client_id']; $clientModel = new ClientModel(); $client_data =$clientModel->where('id', $client_id)->first(); $notificationModel = new NotificationModel(); $notification_data = $notificationModel->where('client_id' ,$client_id)->where('template_name', $action)->first(); $clientRMModel =new ClientRMModel(); if (isset($notification_data['enabled']) && $notification_data['enabled'] == 1) { $client_rm_data= $clientRMModel->where('client_id', $client_id)->where('is_active',1)->findAll(); $user_list= []; foreach ($client_rm_data as $key => $value) { if($value['level'] == 3){ $userModel = new UserModel(); $user_data = $userModel->where('id', $value['user_id'])->first(); $user_list[]=$user_data; } } $mail_content = $notification_data['mail_content']; $subject = $notification_data['subject']; $app_link = $_ENV['App_Url']; $nhance_logo = $_ENV['NHANCE_LOGO']; $client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo']; // $client_logo = $nhance_logo; $mail_content = str_replace("[[nhance_logo]]", "Nhance Logo", $mail_content); $mail_content = str_replace("[[client_logo]]", "Client Logo", $mail_content); $mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content); $mail_content = str_replace("[[app_link]]", "Review Details", $mail_content); // Step 1: Replace the placeholder with an HTML table structure $mail = ''; $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 : '; $temp_data = ''; $policy_name = ''; $is_addon = ''; foreach ($item as $inner_item) { $policy_name = $inner_item['policy_name']; if ($inner_item['relationship'] == 'Self') { $emp_code = ' (' . $inner_item['emp_code'] . ')'; } else { $emp_code = ''; } $temp_data .= ''; $temp_data .= '' . $inner_item['name'] . $emp_code . ''; $temp_data .= '' . $inner_item['relationship'] . ''; $temp_data .= '' . \DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y') . ''; $temp_data .= '₹' . format_indian_number($inner_item['basic_cover_si']) . ''; // Only Display SI Topup and Dependent Addon if ($inner_item['is_addon'] == 2 || $inner_item['is_addon'] == 3) { $temp_data .= '₹' . format_indian_number(round($inner_item['premium'])) . ''; $temp_data .= '₹' . format_indian_number(round($inner_item['gst'])) . ''; } $temp_data .= ''; $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 . '

'; $table_content .= ''; // Add text-align: center to the table head $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; // Only Display SI Topup and Dependent Addon if ($is_addon == 2 || $is_addon == 3) { $table_content .= ''; $table_content .= ''; } $table_content .= ''; $table_content .= ''; // Add text-align: center to the table body $table_content .= '' . $temp_data . ''; $table_content .= '
NameRelationDate Of BirthSum InsuredPremiumGST
'; if ($is_addon == 2 || $is_addon == 3) { $addon_list_array = [ 'policy_name' => $policy_name, 'addtional_premium' => round($addtional_premium), 'gst' => round($gst) ]; $Addon_list[] = $addon_list_array; } $temp_data = ''; $addtional_premium = 0; $gst = 0; } } if (count($Addon_list) > 0) { $table_content .= '
'; $table_content .= ''; // Center align for table header and body $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $sum_total = 0; foreach ($Addon_list as $key => $value) { $total_addon = $value['gst'] + $value['addtional_premium']; $sum_total += $total_addon; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; } $sum_total_words = numberToWords($sum_total); $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= '
Policy NameAdditional PremiumGSTTotal
' . $value['policy_name'] . '₹' . format_indian_number($value['addtional_premium']) . '₹' . format_indian_number($value['gst']) . '₹' . format_indian_number($total_addon) . '
Total₹' . format_indian_number($sum_total) . '
'; // $table_content .= '
' . $sum_total_words . '
'; } $mail_content = str_replace("[[member_summary]]", $table_content , $mail_content); $hr_mails = $client_data['hr_mails']; $mail_array = explode(',', $hr_mails); $mail_array = array_map('trim', $mail_array); $wholeData = []; foreach ($mail_array as $key => $value) { $wholeData[] = ['mail' => $value, 'subject' => $subject,'message'=> $mail_content, 'reply_to' => $client_data['reply_to']]; // $wholeData[] = ['mail' => $value, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']]; } return $wholeData; } } } public static function sendMailNotificationForTesting($action, $params) { $wholeData =[]; if ($action == 'member_welcome_mail') { $clientModel = new ClientModel(); $notification = $params['notification_data']; $client_data = $params['client_data']; $mail = $params['test_mail']; $mail_content = $notification['mail_content']; $subject = $notification['subject']; $employee_name = 'John Doe'; $app_link = $_ENV['App_Url']; $nhance_logo = $_ENV['NHANCE_LOGO']; $client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo']; $mail_content = str_replace("[[client_logo]]", "Client Logo", $mail_content); $mail_content = str_replace("[[nhance_logo]]", "Nhance Logo", $mail_content); $mail_content = str_replace("[[member_name]]", $employee_name, $mail_content); $mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content); $mail_content = str_replace("[[app_link]]", "Review Details", $mail_content); if ($mail != null || $mail != '') { $wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to']]; } return $wholeData; } else if($action == 'member_reminder_mail'){ $notification_data = $params['notification_data']; $client_data = $params['client_data']; $mail = $params['test_mail']; $mail_content = $notification_data['mail_content']; $subject = $notification_data['subject']; $nhance_logo = $_ENV['NHANCE_LOGO']; $app_link = $_ENV['App_Url']; $employee_name = 'John Doe'; $client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo']; $mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content); $mail_content = str_replace("[[nhance_logo]]", "Nhance Logo", $mail_content); $mail_content = str_replace("[[client_logo]]", "Client Logo", $mail_content); $mail_content = str_replace("[[app_link]]", "Review Details", $mail_content); if ((isset($notification_data) && $notification_data['enabled'] == 1)) { if (isset($mail) && !empty($mail)) { $wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to']]; } } return $wholeData; } else if($action == 'member_ecard_mail'){ $notification = $params['notification_data']; $client_data = $params['client_data']; $mail = $params['test_mail']; $mail_content = $notification['mail_content']; $subject = $notification['subject']; $rand_string = 'HX3kUh'; $link = generate_download_link($rand_string); $name = 'John Doe'; $nhance_logo = $_ENV['NHANCE_LOGO']; $app_link = $_ENV['App_Url']; $post_enrollment_app_link = $_ENV['POST_ENROLLMENT_APP_LINK']; $client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo']; $mail_content = str_replace("[[nhance_logo]]", "Nhance Logo", $mail_content); $mail_content = str_replace("[[client_logo]]", "Client Logo", $mail_content); $mail_content = str_replace("[[member_name]]", $name, $mail_content); $mail_content = str_replace("[[app_link]]", "Review Details", $mail_content); $mail_content = str_replace("[[post_enrollment_app_link]]", "Review Details", $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'], 'reply_to' => $client_data['reply_to']]; return $wholeData; } else if($action == 'member_review_and_summary_mail'){ $array_list = [ 'policy_name' => 'Health Insurance Plan', 'emp_code' => 'E12345', 'name' => 'John Doe', 'relationship' => 'Self', 'dob' => '1985-05-15', 'basic_cover_si' => 500000, 'premium' => 12000, 'gst' => 2160, 'rata_premimum' => 12000, 'is_addon' => 2 ]; $notification_data = $params['notification_data']; $client_data = $params['client_data']; $mail = $params['test_mail']; if (isset($notification_data) && $notification_data['enabled'] == 1) { $mail_content = $notification_data['mail_content']; $subject = $notification_data['subject']; $app_link = $_ENV['App_Url']; $nhance_logo = $_ENV['NHANCE_LOGO']; $client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo']; $mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content); $mail_content = str_replace("[[nhance_logo]]", "Nhance Logo", $mail_content); $mail_content = str_replace("[[client_logo]]", "Client Logo", $mail_content); $mail_content = str_replace("[[app_link]]", "Review Details", $mail_content); // Step 1: Replace the placeholder with an HTML table structure $table_content = ''; $addtional_premium = 0; $gst = 0; $Addon_list = []; $name = $array_list['name']; $emp_code = ''; if (!empty($array_list)) { $table_content .= '

Policy Name : '; $policy_name = $array_list['policy_name']; if ($array_list['relationship'] == 'Self') { $emp_code = ' (' . $array_list['emp_code'] . ')'; } else { $emp_code = ''; } // Start table row $table_content .= $policy_name . '

'; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; // Only Display SI Topup and Dependent Addon if ($array_list['is_addon'] == 2 || $array_list['is_addon'] == 3) { $table_content .= ''; $table_content .= ''; } $table_content .= ''; $table_content .= ''; // Table body with details $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; if ($array_list['is_addon'] == 2 || $array_list['is_addon'] == 3) { $table_content .= ''; $table_content .= ''; } $table_content .= ''; $table_content .= ''; $table_content .= '
NameRelationDate Of BirthSum InsuredPremiumGST
' . $array_list['name'] . $emp_code . '' . $array_list['relationship'] . '' . \DateTime::createFromFormat('Y-m-d', $array_list['dob'])->format('d-m-Y') . '₹' . format_indian_number($array_list['basic_cover_si']) . '₹' . format_indian_number(round($array_list['premium'])) . '₹' . format_indian_number(round($array_list['gst'])) . '
'; // Calculate additional premium and GST if applicable if ($array_list['is_addon'] == 2 || $array_list['is_addon'] == 3) { $addtional_premium = $array_list['rata_premimum']; $gst = $array_list['gst']; // Prepare addon summary $addon_list_array = [ 'policy_name' => $policy_name, 'addtional_premium' => round($addtional_premium), 'gst' => round($gst) ]; $Addon_list[] = $addon_list_array; } // Generate summary table for addon if applicable if (count($Addon_list) > 0) { $table_content .= '
'; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $total_addon = $Addon_list[0]['gst'] + $Addon_list[0]['addtional_premium']; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $sum_total_words = numberToWords($total_addon); $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= '
Policy NameAdditional PremiumGSTTotal
' . $Addon_list[0]['policy_name'] . '₹' . format_indian_number($Addon_list[0]['addtional_premium']) . '₹' . format_indian_number($Addon_list[0]['gst']) . '₹' . format_indian_number($total_addon) . '
Total₹' . format_indian_number($total_addon) . '
'; } } $mail_content = str_replace("[[member_name]]", $name . ' (' . $emp_code . ')' , $mail_content); $mail_content = str_replace("[[member_summary]]", $table_content , $mail_content); $wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to']]; return $wholeData; } } else if($action == 'account_maneger_summary_mail'){ $array_list = [ 'policy_name' => 'Health Insurance Plan', 'emp_code' => 'E12345', 'name' => 'John Doe', 'relationship' => 'Self', 'dob' => '1985-05-15', 'basic_cover_si' => 500000, 'premium' => 12000, 'gst' => 2160, 'rata_premimum' => 12000, 'is_addon' => 2 ]; $notification_data = $params['notification_data']; $client_data = $params['client_data']; $mail = $params['test_mail']; if (isset($notification_data) && $notification_data['enabled'] == 1) { $mail_content = $notification_data['mail_content']; $subject = $notification_data['subject']; $app_link = $_ENV['App_Url']; $nhance_logo = $_ENV['NHANCE_LOGO']; $client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo']; $mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content); $mail_content = str_replace("[[nhance_logo]]", "Nhance Logo", $mail_content); $mail_content = str_replace("[[client_logo]]", "Client Logo", $mail_content); $mail_content = str_replace("[[app_link]]", "Review Details", $mail_content); // Step 1: Replace the placeholder with an HTML table structure $table_content = ''; $addtional_premium = 0; $gst = 0; $Addon_list = []; $name = $array_list['name']; $emp_code = ''; if (!empty($array_list)) { $table_content .= '

Policy Name : '; $policy_name = $array_list['policy_name']; if ($array_list['relationship'] == 'Self') { $emp_code = ' (' . $array_list['emp_code'] . ')'; } else { $emp_code = ''; } // Start table row $table_content .= $policy_name . '

'; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; // Only Display SI Topup and Dependent Addon if ($array_list['is_addon'] == 2 || $array_list['is_addon'] == 3) { $table_content .= ''; $table_content .= ''; } $table_content .= ''; $table_content .= ''; // Table body with details $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; if ($array_list['is_addon'] == 2 || $array_list['is_addon'] == 3) { $table_content .= ''; $table_content .= ''; } $table_content .= ''; $table_content .= ''; $table_content .= '
NameRelationDate Of BirthSum InsuredPremiumGST
' . $array_list['name'] . $emp_code . '' . $array_list['relationship'] . '' . \DateTime::createFromFormat('Y-m-d', $array_list['dob'])->format('d-m-Y') . '₹' . format_indian_number($array_list['basic_cover_si']) . '₹' . format_indian_number(round($array_list['premium'])) . '₹' . format_indian_number(round($array_list['gst'])) . '
'; // Calculate additional premium and GST if applicable if ($array_list['is_addon'] == 2 || $array_list['is_addon'] == 3) { $addtional_premium = $array_list['rata_premimum']; $gst = $array_list['gst']; // Prepare addon summary $addon_list_array = [ 'policy_name' => $policy_name, 'addtional_premium' => round($addtional_premium), 'gst' => round($gst) ]; $Addon_list[] = $addon_list_array; } // Generate summary table for addon if applicable if (count($Addon_list) > 0) { $table_content .= '
'; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $total_addon = $Addon_list[0]['gst'] + $Addon_list[0]['addtional_premium']; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $sum_total_words = numberToWords($total_addon); $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= '
Policy NameAdditional PremiumGSTTotal
' . $Addon_list[0]['policy_name'] . '₹' . format_indian_number($Addon_list[0]['addtional_premium']) . '₹' . format_indian_number($Addon_list[0]['gst']) . '₹' . format_indian_number($total_addon) . '
Total₹' . format_indian_number($total_addon) . '
'; } } $mail_content = str_replace("[[member_name]]", $name . ' (' . $emp_code . ')' , $mail_content); $mail_content = str_replace("[[member_summary]]", $table_content , $mail_content); $wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'reply_to' => $client_data['reply_to']]; return $wholeData; } } else if($action == 'client_hr_summary_mail'){ $array_list = [ 'policy_name' => 'Health Insurance Plan', 'emp_code' => 'E12345', 'name' => 'John Doe', 'relationship' => 'Self', 'dob' => '1985-05-15', 'basic_cover_si' => 500000, 'premium' => 12000, 'gst' => 2160, 'rata_premimum' => 12000, 'is_addon' => 2 ]; $notification_data = $params['notification_data']; $client_data = $params['client_data']; $mail = $params['test_mail']; if (isset($notification_data['enabled']) && $notification_data['enabled'] == 1) { $mail_content = $notification_data['mail_content']; $subject = $notification_data['subject']; $app_link = $_ENV['App_Url']; $nhance_logo = $_ENV['NHANCE_LOGO']; $client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo']; $mail_content = str_replace("[[nhance_logo]]", "Nhance Logo", $mail_content); $mail_content = str_replace("[[client_logo]]", "Client Logo", $mail_content); $mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content); $mail_content = str_replace("[[app_link]]", "Review Details", $mail_content); // Step 1: Replace the placeholder with an HTML table structure $table_content = ''; $addtional_premium = 0; $gst = 0; $Addon_list = []; $name = $array_list['name']; $emp_code = ''; if (!empty($array_list)) { $table_content .= '

Policy Name : '; $policy_name = $array_list['policy_name']; if ($array_list['relationship'] == 'Self') { $emp_code = ' (' . $array_list['emp_code'] . ')'; } else { $emp_code = ''; } // Start table row $table_content .= $policy_name . '

'; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; // Only Display SI Topup and Dependent Addon if ($array_list['is_addon'] == 2 || $array_list['is_addon'] == 3) { $table_content .= ''; $table_content .= ''; } $table_content .= ''; $table_content .= ''; // Table body with details $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; if ($array_list['is_addon'] == 2 || $array_list['is_addon'] == 3) { $table_content .= ''; $table_content .= ''; } $table_content .= ''; $table_content .= ''; $table_content .= '
NameRelationDate Of BirthSum InsuredPremiumGST
' . $array_list['name'] . $emp_code . '' . $array_list['relationship'] . '' . \DateTime::createFromFormat('Y-m-d', $array_list['dob'])->format('d-m-Y') . '₹' . format_indian_number($array_list['basic_cover_si']) . '₹' . format_indian_number(round($array_list['premium'])) . '₹' . format_indian_number(round($array_list['gst'])) . '
'; // Calculate additional premium and GST if applicable if ($array_list['is_addon'] == 2 || $array_list['is_addon'] == 3) { $addtional_premium = $array_list['rata_premimum']; $gst = $array_list['gst']; // Prepare addon summary $addon_list_array = [ 'policy_name' => $policy_name, 'addtional_premium' => round($addtional_premium), 'gst' => round($gst) ]; $Addon_list[] = $addon_list_array; } // Generate summary table for addon if applicable if (count($Addon_list) > 0) { $table_content .= '
'; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $total_addon = $Addon_list[0]['gst'] + $Addon_list[0]['addtional_premium']; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $sum_total_words = numberToWords($total_addon); $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= '
Policy NameAdditional PremiumGSTTotal
' . $Addon_list[0]['policy_name'] . '₹' . format_indian_number($Addon_list[0]['addtional_premium']) . '₹' . format_indian_number($Addon_list[0]['gst']) . '₹' . format_indian_number($total_addon) . '
Total₹' . format_indian_number($total_addon) . '
'; } } $mail_content = str_replace("[[member_name]]", $name . ' (' . $emp_code . ')' , $mail_content); $mail_content = str_replace("[[member_summary]]", $table_content , $mail_content); $wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'reply_to' => $client_data['reply_to']]; return $wholeData; } } } }