CHANGE_IAGREEADDON_ISSUE : AADHAVAN

This commit is contained in:
aadhavan valli 2024-07-11 09:18:16 +05:30
parent fa90cc3043
commit 8f57f3e8b1
2 changed files with 32 additions and 16 deletions

View File

@ -1753,10 +1753,10 @@ public function getAddOnPolicy()
public function iAgreeForAddOn()
{
$postData = json_decode($this->request->getBody(), true);
$client_policy_id = $postData['client_policy_id'];
// Alternatively, you can use echo to see the type
$emp_code = $postData['emp_code'];
$client_id = $postData['client_id'];
@ -1765,7 +1765,7 @@ public function iAgreeForAddOn()
->where('is_active', 1 )
->set(array('emp_status'=>'enrolled'))
->update();
if (!is_null($client_policy_id) && is_array($client_policy_id))
{
$array_list = [];
@ -1776,9 +1776,10 @@ public function iAgreeForAddOn()
->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']);
$array_list[] = $find;
if(count($find) > 0){
$array_list[] = $find;
}
}
$notification = $this->notificationModel->where('client_id' ,$client_id)->where('template_name', 'member_review_and_summary_mail')->first();

View File

@ -158,8 +158,11 @@ class sendMailNotification
$addtional_premium = 0;
$gst = 0;
foreach ($array_list as $item) {
$table_content .= '<div style="text-align: left;"><div style="text-align:left;"><h4>Policy Name : ';
if(count($item) != 0){
$table_content .= '<div style="text-align: left;"><div style="text-align:left;"><h4>Policy Name : ';
$temp_data ='';
$policy_name ='';
$is_addon ='';
foreach ($item as $inner_item) {
$policy_name = $inner_item['policy_name'];
$temp_data .= '<tr ><td style="width:20%">' . $inner_item['name'] . '</td><td style="width:20%">'.$inner_item['mobile'].'</td><td style="width:20%">₹'.number_format($inner_item['basic_cover_si'], 2, '.', ',').'</td><td style="width:20%">'.\DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y').'</tr>';
@ -175,6 +178,7 @@ class sendMailNotification
$gst = $inner_item['gst'] + $gst;
}
}
// echo $policy_name;die;
$table_content .= $policy_name.'</h4></div><table style="width:60%"><thead style="background-color: #02a8b5;"><tr><th style="width:20%">Name</th><th>Mobile Number</th><th>Sum Insure</th><th style="width:15%">Date Of Birth</th></tr></thead><tbody>';
$table_content .= $temp_data;
$table_content .= '</tbody></table></div>';
@ -193,6 +197,8 @@ class sendMailNotification
$temp_data = '';
$addtional_premium = 0;
$gst = 0;
}
}
$table_content .='<br><table style="width:60%"><thead style="background-color: #e26828;"><tr><th>Policy Name</th><th> Additional Premium</th><th>GST</th><th>Total</th></tr></thead><tbody>';
@ -220,11 +226,11 @@ class sendMailNotification
$client_id = $params['client_id'];
$clientModel = new ClientModel();
$notificationModel = new NotificationModel();
$clientRMModel =new ClientRMModel();
$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 ($notification_data['enabled'] == 1) {
$client_rm_data= $clientRMModel->where('client_id', $client_id)->where('is_active',1)->findAll();
@ -236,6 +242,7 @@ class sendMailNotification
$user_list[]=$user_data;
}
}
// print_r($client_rm_data);die;
@ -262,8 +269,11 @@ class sendMailNotification
$array_list = $params['array_list'];
foreach ($array_list as $item) {
$table_content .= '<div style="text-align: left;"><div style="text-align:left;"><h4>Policy Name : ';
if(count($item) != 0){
$table_content .= '<div style="text-align: left;"><div style="text-align:left;"><h4>Policy Name : ';
$temp_data ='';
$policy_name ='';
$is_addon ='';
foreach ($item as $inner_item) {
$policy_name = $inner_item['policy_name'];
$temp_data .= '<tr ><td style="width:20%">' . $inner_item['name'] . '</td><td style="width:20%">'.$inner_item['mobile'].'</td><td style="width:20%">₹'.number_format($inner_item['basic_cover_si'], 2, '.', ',').'</td><td style="width:20%">'.\DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y').'</tr>';
@ -293,6 +303,8 @@ class sendMailNotification
$temp_data = '';
$addtional_premium = 0;
$gst = 0;
}
}
@ -308,14 +320,17 @@ class sendMailNotification
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
$account_manager_mail_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);
// print_r($user_list);die;
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];
// $wholeData[] = ['mail' => $value['email'], 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
$wholeData[] = ['mail' => $value['email'], 'subject' => $subject,'message'=> $mail_content];
// $wholeData[] = ['mail' => $value['email'], 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
}
return $wholeData;
}
return $wholeData;
}
} else if($action == 'client_hr_summary_mail'){
@ -413,7 +428,7 @@ class sendMailNotification
$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];
// $wholeData[] = ['mail' => $value, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];