From 3ebc859692ecebdf86cada3b4fba3dd2bd19594a Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 10 Oct 2024 12:34:57 +0530 Subject: [PATCH] CHANGE_SENDMAIL_NOTIFICATION_TABLE_TEXT_CENTER_ALIGN : RV --- app/Helpers/sendMailNotification.php | 175 ++++++++++++++++----------- 1 file changed, 103 insertions(+), 72 deletions(-) diff --git a/app/Helpers/sendMailNotification.php b/app/Helpers/sendMailNotification.php index 0865865a..5779135f 100755 --- a/app/Helpers/sendMailNotification.php +++ b/app/Helpers/sendMailNotification.php @@ -189,64 +189,66 @@ class sendMailNotification foreach ($array_list as $item) { if (count($item) != 0) { - $table_content .= '
'; - $table_content .= '

Policy Name : '; + $table_content .= '

Policy Name : '; $temp_data = ''; $policy_name = ''; $is_addon = ''; - + foreach ($item as $inner_item) { $policy_name = $inner_item['policy_name']; - $temp_data .= ''; - $temp_data .= '' . $inner_item['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 + + // 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 .= ''; - - - - if ($inner_item['relationship'] == 'Self' || $inner_item['relationship'] == 'self') { - $mail = $inner_item['email_corporate']; - $name = $inner_item['name']; - $emp_code = $inner_item['emp_code']; - } - + $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 .= ''; - $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 + + // Only Display SI Topup and Dependent Addon if ($is_addon == 2 || $is_addon == 3) { $table_content .= ''; $table_content .= ''; } - + $table_content .= ''; $table_content .= ''; - $table_content .= '' . $temp_data . ''; + + // 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, @@ -255,36 +257,52 @@ class sendMailNotification ]; $Addon_list[] = $addon_list_array; } - + $temp_data = ''; $addtional_premium = 0; $gst = 0; } } - - if (count($Addon_list) != 0 && count($Addon_list) > 0) { - - $table_content .= '
'; - $table_content .= '
'; - $table_content .= ''; - $table_content .= ''; - $table_content .= ''; - $table_content .= ''; - $sum_tolal = 0; - + + if (count($Addon_list) > 0) { + $table_content .= '
'; + $table_content .= '
Policy NameAdditional PremiumGSTTotal
'; + + // 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) { - $sum_tolal = $value['gst'] + $value['addtional_premium'] + $sum_tolal; - $table_content .= ''; + $total_addon = $value['gst'] + $value['addtional_premium']; + $sum_total += $total_addon; + + $table_content .= ''; + $table_content .= ''; $table_content .= ''; $table_content .= ''; - $table_content .= ''; + $table_content .= ''; + $table_content .= ''; } - - $sum_total_words = numberToWords($sum_tolal); - $table_content .= ''; - $table_content .= '
Policy NameAdditional PremiumGSTTotal
' . $value['policy_name'] . '
' . $value['policy_name'] . '₹' . format_indian_number($value['addtional_premium']) . '₹' . format_indian_number($value['gst']) . '₹' . format_indian_number(($value['gst'] + $value['addtional_premium'])) . '
₹' . format_indian_number($total_addon) . '
Total₹' . format_indian_number($sum_tolal) . '
'; - // $table_content .= '
' . $sum_total_words . '
'; + + $sum_total_words = numberToWords($sum_total); + $table_content .= ''; + $table_content .= 'Total'; + $table_content .= '₹' . format_indian_number($sum_total) . ''; + $table_content .= ''; + $table_content .= ''; + $table_content .= '

'; + // $table_content .= '
' . $sum_total_words . '
'; } + // print_r($table_content); die; @@ -349,7 +367,6 @@ class sendMailNotification $Addon_list = []; foreach ($array_list as $item) { - if (count($item) != 0) { $table_content .= '

Policy Name : '; $temp_data = ''; @@ -364,19 +381,19 @@ class sendMailNotification } 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 + + // 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']; @@ -389,22 +406,26 @@ class sendMailNotification $table_content .= $policy_name . '

'; $table_content .= ''; - $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 + + // Only Display SI Topup and Dependent Addon if ($is_addon == 2 || $is_addon == 3) { $table_content .= ''; $table_content .= ''; } - + $table_content .= ''; $table_content .= ''; - $table_content .= '' . $temp_data . ''; + + // 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) { @@ -425,7 +446,9 @@ class sendMailNotification if (count($Addon_list) > 0) { $table_content .= '
'; $table_content .= ''; - $table_content .= ''; + + // Center align for table header and body + $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; @@ -433,8 +456,9 @@ class sendMailNotification $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']; @@ -457,6 +481,7 @@ class sendMailNotification $table_content .= '
Policy NameAdditional PremiumTotal
'; // $table_content .= '
' . $sum_total_words . '
'; } + $mail_content = str_replace("[[member_summary]]", $table_content , $mail_content); @@ -519,7 +544,6 @@ class sendMailNotification $Addon_list = []; foreach ($array_list as $item) { - if (count($item) != 0) { $table_content .= '

Policy Name : '; $temp_data = ''; @@ -534,19 +558,19 @@ class sendMailNotification } 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 + + // 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']; @@ -559,22 +583,26 @@ class sendMailNotification $table_content .= $policy_name . '

'; $table_content .= ''; - $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 + + // Only Display SI Topup and Dependent Addon if ($is_addon == 2 || $is_addon == 3) { $table_content .= ''; $table_content .= ''; } - + $table_content .= ''; $table_content .= ''; - $table_content .= '' . $temp_data . ''; + + // 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) { @@ -595,7 +623,9 @@ class sendMailNotification if (count($Addon_list) > 0) { $table_content .= '
'; $table_content .= ''; - $table_content .= ''; + + // Center align for table header and body + $table_content .= ''; $table_content .= ''; $table_content .= ''; $table_content .= ''; @@ -603,8 +633,9 @@ class sendMailNotification $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']; @@ -627,7 +658,7 @@ class sendMailNotification $table_content .= '
Policy NameAdditional PremiumTotal
'; // $table_content .= '
' . $sum_total_words . '
'; } - + $mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);