diff --git a/app/Helpers/sendMailNotification.php b/app/Helpers/sendMailNotification.php index bea00db..743ca23 100755 --- a/app/Helpers/sendMailNotification.php +++ b/app/Helpers/sendMailNotification.php @@ -239,22 +239,22 @@ class sendMailNotification $premium = ''; $gst_forself = ''; - // if(checkFamilyFloaters($policy_premium_data, $client_policy_data, $inner_item)){ - - if($policy_premium_data['premium_type'] == 2){ - $si = '₹ ' .format_indian_number($inner_item['basic_cover_si']); - }else{ - if ($inner_item['relationship'] == 'Self') { - $payable_employee_array['si_amount'] = $inner_item['basic_cover_si']; - $payable_employee_array['self_premium'] = $inner_item['rata_premimum']; - $payable_employee_array['self_gst'] = $inner_item['gst']; - } - empty($inner_item['basic_cover_si']) ? $si = 0 : $si = '₹ ' .format_indian_number($inner_item['basic_cover_si']); + if($policy_premium_data['premium_type'] == 2){ + $si = '₹ ' .format_indian_number($inner_item['basic_cover_si']); + }else{ + if ($inner_item['relationship'] == 'Self') { + $payable_employee_array['si_amount'] = $inner_item['basic_cover_si']; + $payable_employee_array['self_premium'] = $inner_item['rata_premimum']; + $payable_employee_array['self_gst'] = $inner_item['gst']; } + empty($inner_item['basic_cover_si']) ? $si = 0 : $si = '₹ ' .format_indian_number($inner_item['basic_cover_si']); + } + // Premium summery for show and hide the Additional premium data + if($client_policy_data['is_premium_summery'] == 1){ $premium = '₹ ' .format_indian_number(round($inner_item['rata_premimum'])); - $gst_forself = '₹ ' .format_indian_number(round($inner_item['gst'])); - // } + $gst_forself = '₹ ' .format_indian_number(round($inner_item['gst'])); + } $temp_data .= ''; $temp_data .= '' . $inner_item['name'] . ($inner_item['relationship'] == 'Self' ? ' (' . $inner_item['emp_code'] . ')' : '') . ''; @@ -268,7 +268,7 @@ class sendMailNotification if ($si != 0 && count($item) != 1 && $is_si_set == 0) { - $temp_data .= '' . $si . ''; + $temp_data .= '' . $si . ''; $is_si_set = 1; } else { @@ -284,7 +284,7 @@ class sendMailNotification } // Only Display SI Topup and Dependent Addon - if ($inner_item['is_addon'] == 2 || $inner_item['is_addon'] == 3) { + if (($inner_item['is_addon'] == 2 || $inner_item['is_addon'] == 3) && $client_policy_data['is_premium_summery'] == 1) { $temp_data .= '' . $premium . ''; $temp_data .= '' . $gst_forself . ''; } @@ -316,7 +316,7 @@ class sendMailNotification $table_content .= 'Sum Insured'; // Only Display SI Topup and Dependent Addon - if ($is_addon == 2 || $is_addon == 3) { + if (($is_addon == 2 || $is_addon == 3) && $client_policy_data['is_premium_summery'] == 1) { $table_content .= 'Premium'; $table_content .= 'GST'; } @@ -328,7 +328,7 @@ class sendMailNotification $table_content .= '' . $temp_data . ''; $table_content .= ''; - if ($is_addon == 2 || $is_addon == 3) { + if (($is_addon == 2 || $is_addon == 3) && $client_policy_data['is_premium_summery'] == 1) { $addon_list_array = [ 'policy_name' => $policy_name_for_policy_type, 'addtional_premium' => round($addtional_premium), @@ -345,7 +345,7 @@ class sendMailNotification // dd($payable_employee_array); // dd(count($payable_employee_array['emp_data'])); - if(isset($payable_employee_array['emp_data']) && count($payable_employee_array['emp_data']) > 0){ + if(isset($payable_employee_array['emp_data']) && count($payable_employee_array['emp_data']) > 0 && $client_policy_data['is_premium_summery'] == 1){ $table_content .= '

Policy Type :'; $temp_data = ''; @@ -401,30 +401,35 @@ class sendMailNotification // dd($si); - if($policy_premium_data['premium_type'] == 2){ + // Premium summery for show and hide the Additional premium data + if($client_policy_data['is_premium_summery'] == 1){ + if($policy_premium_data['premium_type'] == 2){ - $temp_data .= '' . $si . ''; - $temp_data .= '' . $premium . ''; - $temp_data .= '' . $gst_forself . ''; + $temp_data .= '' . $si . ''; + $temp_data .= '' . $premium . ''; + $temp_data .= '' . $gst_forself . ''; - }else{ - - if($policy_premium_data['premium_type'] == 1){ - - $temp_data .= (($si != 0 && count($item) != 1) ? ('' . $si . '') : ($si == 0 ? "" : '' . $si . '') ); - $temp_data .= (($premium != 0 && count($item) != 1) ? ('' . $premium . '') : ($premium == 0 ? "" : '' . $premium . '') ); - $temp_data .= (($gst_forself != 0 && count($item) != 1) ? ('' . $gst_forself . '') : ($gst_forself == 0 ? "" : '' . $gst_forself . '') ); - }else{ - $temp_data .= (($si != 0 && count($item) != 1) ? ('' . $si . '') : ($si == 0 ? "" : '' . $si . '') ); - $temp_data .= '' . $premium . ''; - $temp_data .= '' . $gst_forself . ''; - } + if($policy_premium_data['premium_type'] == 1){ - $self_si_amount = 0; - $self_premium = 0; - $self_gst = 0; + $temp_data .= (($si != 0 && count($item) != 1) ? ('' . $si . '') : ($si == 0 ? "" : '' . $si . '') ); + $temp_data .= (($premium != 0 && count($item) != 1) ? ('' . $premium . '') : ($premium == 0 ? "" : '' . $premium . '') ); + $temp_data .= (($gst_forself != 0 && count($item) != 1) ? ('' . $gst_forself . '') : ($gst_forself == 0 ? "" : '' . $gst_forself . '') ); + + }else{ + + $temp_data .= (($si != 0 && count($item) != 1) ? ('' . $si . '') : ($si == 0 ? "" : '' . $si . '') ); + $temp_data .= '' . $premium . ''; + $temp_data .= '' . $gst_forself . ''; + } + + $self_si_amount = 0; + $self_premium = 0; + $self_gst = 0; + } + }else{ + $temp_data .= '' . $si . ''; } @@ -451,8 +456,12 @@ class sendMailNotification $table_content .= 'Relation'; $table_content .= 'Date Of Birth'; $table_content .= 'Sum Insured'; - $table_content .= 'Premium'; - $table_content .= 'GST'; + + // Premium summery for show and hide the Additional premium data + if($client_policy_data['is_premium_summery'] == 1){ + $table_content .= 'Premium'; + $table_content .= 'GST'; + } $table_content .= ''; $table_content .= ''; @@ -461,13 +470,15 @@ class sendMailNotification $table_content .= '' . $temp_data . ''; $table_content .= '

'; - - $addon_list_array = [ - 'policy_name' => $policy_name_for_policy_type . '( Payable By Employee )', - 'addtional_premium' => round($addtional_premium), - 'gst' => round($gst) - ]; - $Addon_list[] = $addon_list_array; + // Premium summery for show and hide the Additional premium data + if($client_policy_data['is_premium_summery'] == 1){ + $addon_list_array = [ + 'policy_name' => $policy_name_for_policy_type . '( Payable By Employee )', + 'addtional_premium' => round($addtional_premium), + 'gst' => round($gst) + ]; + $Addon_list[] = $addon_list_array; + } $temp_data = ''; @@ -525,10 +536,7 @@ class sendMailNotification // 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'], 'common' => $common]; - // } + $wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'common' => $common]; return $wholeData;