diff --git a/app/Helpers/sendMailNotification.php b/app/Helpers/sendMailNotification.php
index 84c8a13d..d5f6e885 100644
--- a/app/Helpers/sendMailNotification.php
+++ b/app/Helpers/sendMailNotification.php
@@ -165,7 +165,7 @@ 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'];
@@ -179,10 +179,10 @@ 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,
@@ -200,17 +200,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_summary]]", $table_content , $mail_content);
// $mail = "aadhavanvalli@gmail.com";
// if (isset($mail) && !empty($mail)) {
@@ -276,7 +279,7 @@ 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['mobile'].' | ₹'.format_indian_number($inner_item['basic_cover_si']).' | '.\DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y').' |
';
// print_r($inner_item);die;
$is_addon = $inner_item['is_addon'];
@@ -288,7 +291,7 @@ class sendMailNotification
$table_content .= $policy_name.'| Name | Mobile Number | Sum Insure | Date Of Birth |
';
$table_content .= $temp_data;
$table_content .= '
';
-
+ $Addon_list = [];
if ($is_addon == 2 || $is_addon == 3) {
$addon_list_array = [
'policy_name'=>$policy_name,
@@ -307,16 +310,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_summary]]", $table_content , $mail_content);
$account_manager_mail_list = [];
@@ -383,7 +390,7 @@ class sendMailNotification
$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').' |
';
+ $temp_data .= '| ' . $inner_item['name'] . ' | '.$inner_item['mobile'].' | ₹'.format_indian_number($inner_item['basic_cover_si']).' | '.\DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y').' |
';
// print_r($inner_item);die;
$is_addon = $inner_item['is_addon'];
@@ -395,6 +402,7 @@ class sendMailNotification
$table_content .= $policy_name.'| Name | Mobile Number | Sum Insure | Date Of Birth |
';
$table_content .= $temp_data;
$table_content .= '
';
+ $Addon_list = [];
if ($is_addon == 2 || $is_addon == 3) {
$addon_list_array = [
@@ -412,16 +420,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);
@@ -439,4 +449,6 @@ 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
+}