From e74837bdb60fa6d7d4bd2d6bceedbe8f0a89c869 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Fri, 29 Nov 2024 13:33:56 +0530 Subject: [PATCH 1/3] CHANGES_DELETION_CLAIM_STATUS_QUERY_CHANGES : RV --- app/Controllers/EmployeeController.php | 6 ++--- app/Models/EmployeePolicyModel.php | 36 +++++++++++++++++++++++--- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index 9afb44b2..02c01d34 100755 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -1798,9 +1798,9 @@ class EmployeeController extends AdminController public function checkDeletionGetDataFunction() { // $batch_data = [ - // 'client_id' => 77, - // 'client_policy_id' => 203, - // 'client_branch_id' => 53, + // 'client_id' => 159, + // 'client_policy_id' => 336, + // 'client_branch_id' => 126, // ]; // $batch_data['insurer_or_tpa'] = 'insurer'; diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php index abbba1e4..2d285bb6 100755 --- a/app/Models/EmployeePolicyModel.php +++ b/app/Models/EmployeePolicyModel.php @@ -32,6 +32,7 @@ class EmployeePolicyModel extends Model "updated_at", "rand_string", "is_active", + "claim_status", ]; // Callbacks @@ -617,6 +618,7 @@ class EmployeePolicyModel extends Model employee_polices.policy_end_date, employee_polices.premium, employee_polices.rata_premimum as pro_rata_premium, + employee_polices.claim_status, batch_data.emp_policy_id AS emp_policy_id, batch_data.bl AS batch_list_batch_code, @@ -629,9 +631,37 @@ class EmployeePolicyModel extends Model deletiondata.status, DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + '$add_one_day' AS no_of_days, - ROUND((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365, 2) AS pro_rata_premium, - ROUND(((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365) * 0.18, 2) AS gst, - ROUND(((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365) + (((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365) * 0.18), 2) AS total + + + CASE + WHEN employee_polices.claim_status = 0 THEN + ROUND((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365, 2) + ELSE + 0 + END AS pro_rata_premium, + + CASE + WHEN employee_polices.claim_status = 0 THEN + ROUND(((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365) * 0.18, 2) + ELSE + 0 + END AS gst, + + CASE + WHEN employee_polices.claim_status = 0 THEN + ROUND(((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365) + + (((employee_polices.rata_premimum * (DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) + $add_one_day)) / 365) * 0.18), 2) + ELSE + 0 + END AS total, + + CASE + WHEN employee_polices.claim_status = 0 THEN + 'No claim' + ELSE + 'Claim' + END AS claim_status + FROM emp_endorsement a LEFT JOIN From fb4b24cc79c030119748eac1bbaf61f2e6ae025d Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Mon, 2 Dec 2024 09:37:06 +0530 Subject: [PATCH 2/3] CHANGE_HANDLE_MULTIPLE_REMAINDER_DATE_AND_OTHERS : RV --- app/Config/Routes.php | 2 + app/Controllers/ClientController.php | 36 ++++- app/Controllers/DashboardController.php | 160 ++++++++----------- app/Controllers/EmpDataServiceController.php | 2 +- app/Helpers/sendMailNotification.php | 149 ++++++++++------- app/Models/ClientPolicyModel.php | 1 + app/Views/client_policy.php | 53 ++++-- app/Views/notification.php | 8 +- 8 files changed, 235 insertions(+), 176 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index a6472417..62155a0f 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -22,6 +22,8 @@ $routes->get("view", "EmployeeController::viewECard/$1"); $routes->get("smapletest", "ClientController::smapletest"); $routes->get("testMailAttachments", "ClientController::testMailAttachments"); $routes->get("updatePolicyTermsKey", "ClientController::updatePolicyTermsKey"); +$routes->get("updateRemainderDate", "ClientController::updateRemainderDate"); +$routes->get("sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail"); $routes->post("add_advertise_image", "AppContentManagementController::add_advertise_image"); $routes->get("add_image_index", "AppContentManagementController::add_image_index"); diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 7b8e9cf8..447c293a 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -584,7 +584,7 @@ class ClientController extends AdminController $editData['client_policy'] = $clientPoliceData; $editData['client_policy']['role'] = get_role_id(); $editData['notification'] = $this->notificationModel->select('template_name,enabled')->where('client_id', $id)->findAll(); - $editData['placeHolders'] = ['member_name', 'nhance_logo', 'tpa_id', 'ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'post_enrollment_app_link', 'client_name']; + $editData['placeHolders'] = ['member_name', 'member_mobile', 'nhance_logo', 'tpa_id', 'ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'post_enrollment_app_link', 'client_name']; // dd($editData); echo view('layout/header', $headerData); @@ -1033,6 +1033,9 @@ class ClientController extends AdminController $data['cd_ac_no'] = $this->request->getPost('cd_ac_no'); $data['gst'] = $this->request->getPost('gst'); $data['disclaimer'] = $this->request->getPost('disclaimer'); + $data['is_member_modify_allowed'] = $this->request->getPost('is_member_modify_allowed') ? 1 : 0; + $data['enrolment_visibility'] = $this->request->getPost('enrolment_visibility') ? 1 : 0; + if ($policy_type_id == 1 || $policy_type_id == 2 || $policy_type_id == 6 || $policy_type_id == 7) { @@ -1059,7 +1062,8 @@ class ClientController extends AdminController if ($data['inception_type'] == 2) { $data['open_date'] = change_date_format($this->request->getPost('open_date'), 'd-m-Y', 'Y-m-d'); $data['close_date'] = change_date_format($this->request->getPost('close_date'), 'd-m-Y', 'Y-m-d'); - $data['reminder_date'] = change_date_format($this->request->getPost('reminder_date'), 'd-m-Y', 'Y-m-d'); + // $data['reminder_date'] = change_date_format($this->request->getPost('reminder_date'), 'd-m-Y', 'Y-m-d'); + $data['reminder_date'] = $this->request->getPost('reminder_date'); } else { $data['open_date'] = null; $data['closedate'] = null; @@ -1162,11 +1166,13 @@ class ClientController extends AdminController $data['disclaimer'] = $this->request->getPost('disclaimer'); $data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d'); $data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd-m-Y', 'Y-m-d'); + $data['is_member_modify_allowed'] = $this->request->getPost('is_member_modify_allowed') ? 1 : 0; if ($data['inception_type'] == 2) { $data['open_date'] = change_date_format($this->request->getPost('open_date'), 'd-m-Y', 'Y-m-d'); $data['close_date'] = change_date_format($this->request->getPost('close_date'), 'd-m-Y', 'Y-m-d'); - $data['reminder_date'] = change_date_format($this->request->getPost('reminder_date'), 'd-m-Y', 'Y-m-d'); + // $data['reminder_date'] = change_date_format($this->request->getPost('reminder_date'), 'd-m-Y', 'Y-m-d'); + $data['reminder_date'] = $this->request->getPost('reminder_date'); } else { $data['open_date'] = null; $data['close_date'] = null; @@ -3659,4 +3665,28 @@ class ClientController extends AdminController } } + public function updateRemainderDate() + { + // Connect to the database and fetch the data + $data = db_connect()->table('client_policy') + ->where("reminder_date IS NOT NULL AND reminder_date <> ''") + ->where('is_active', 1) + ->get() + ->getResultArray(); + + $days = []; + foreach ($data as $value) { + + $reminderDate = strtotime($value['reminder_date']); + if ($reminderDate) { + $date_of_date = date('d', $reminderDate); + $days[] = $date_of_date; + $days[] = $value['reminder_date']; + db_connect()->table('client_policy')->where('id', $value['id'])->set('reminder_date', $date_of_date)->update(); + } + } + + dd($days); + } + } diff --git a/app/Controllers/DashboardController.php b/app/Controllers/DashboardController.php index dfa0841a..b1bc3200 100755 --- a/app/Controllers/DashboardController.php +++ b/app/Controllers/DashboardController.php @@ -362,16 +362,14 @@ class DashboardController extends AdminController // dd($client_policy_data, $send_mail_for_manual_or_crone); $reminder_whole_mail = []; - + foreach ($client_policy_data as $client_policy) { - if(empty($send_mail_for_manual_or_crone)){ - - // echo '1'; + if (empty($send_mail_for_manual_or_crone)) { // Fetch client data $client_data = $this->clientModel->find($client_policy['client_id']); - + // Fetch notification settings $notification_data = $this->notificationModel ->where('client_id', $client_policy['client_id']) @@ -379,11 +377,11 @@ class DashboardController extends AdminController ->first(); // $this->myLogger->logme('error', 'Notification data fetched: ' . json_encode($notification_data)); - + // Check if notification should be sent if ($notification_data && $notification_data['enabled'] == 1 && !empty($notification_data['mail_content'])) { $this->myLogger->logme('error', 'Notification should be sent for client policy ID: ' . $client_policy['id']); - + // Fetch all employees related to the client policy $employees = $this->employeePolicyModel ->select('employees.*') @@ -395,18 +393,18 @@ class DashboardController extends AdminController ->where('employee_polices.is_active', 1) ->where('employees.relationship', 'Self') ->findAll(); - + // Process each employee foreach ($employees as $employee) { - + if ($employee['emp_status'] == 'draft' && $employee['relationship'] == 'Self') { $this->myLogger->logme('error', 'Employee status and relationship check passed for employee ID: ' . $employee['id']); - + // Mail params $params['emp_data'] = $employee; $params['client_data'] = $client_data; $params['notification_data'] = $notification_data; - + // Send the mail notification $mail_result = sendMailNotification::sendMailNotification('member_reminder_mail', $params); // $this->myLogger->logme('error', 'Mail sent result: ' . json_encode($mail_result)); @@ -414,66 +412,66 @@ class DashboardController extends AdminController } } } else { - $this->myLogger->logme('error', 'Notification not sent for client policy ID: ' . $client_policy['id']); + $this->myLogger->logme('error', 'Notification was not sent for Client Policy ID: ' . $client_policy['id']); + $this->myLogger->logme('error', 'Notification setup not found or not enabled'); } - } else { - // echo '2'; + $currentDate = date('d'); + $remainder_dates = explode(",", $client_policy['reminder_date']); - $currentDate = date('d-m-Y'); + foreach ($remainder_dates as $date) { - if($currentDate == date('d-m-Y', strtotime($client_policy['reminder_date']))){ + if ($currentDate == $date) { - // echo '3'; + $client_data = $this->clientModel->find($client_policy['client_id']); - $client_data = $this->clientModel->find($client_policy['client_id']); + // Fetch notification settings + $notification_data = $this->notificationModel + ->where('client_id', $client_policy['client_id']) + ->where('template_name', 'member_reminder_mail') + ->first(); - // Fetch notification settings - $notification_data = $this->notificationModel - ->where('client_id', $client_policy['client_id']) - ->where('template_name', 'member_reminder_mail') - ->first(); - - // Check if notification should be sent - if ($notification_data && $notification_data['enabled'] == 1 && !empty($notification_data['mail_content'])) { + // Check if notification should be sent + if ($notification_data && $notification_data['enabled'] == 1 && !empty($notification_data['mail_content'])) { - // echo '4'; + // echo '4'; - $this->myLogger->logme('error', 'Notification should be sent for client policy ID: ' . $client_policy['id']); - - // Fetch all employees related to the client policy - $employees = $this->employeePolicyModel - ->select('employees.*') - ->join('employees', 'employee_polices.employee_id = employees.id', 'left') - ->where('employee_polices.client_policy_id', $client_policy['id']) - ->where('employees.emp_status', 'draft') - ->where('employees.is_active', 1) - ->where('employee_polices.status', 'draft') - ->where('employee_polices.is_active', 1) - ->where('employees.relationship', 'Self') - ->findAll(); - - // Process each employee - foreach ($employees as $employee) { - - if ($employee['emp_status'] == 'draft' && $employee['relationship'] == 'Self') { - $this->myLogger->logme('error', 'Employee status and relationship check passed for employee ID: ' . $employee['id']); - - // Mail params - $params['emp_data'] = $employee; - $params['client_data'] = $client_data; - $params['notification_data'] = $notification_data; - - // Send the mail notification - $mail_result = sendMailNotification::sendMailNotification('member_reminder_mail', $params); - // $this->myLogger->logme('error', 'Mail sent result: ' . json_encode($mail_result)); - $reminder_whole_mail[] = $mail_result; + $this->myLogger->logme('error', 'Notification should be sent for client policy ID: ' . $client_policy['id']); + + // Fetch all employees related to the client policy + $employees = $this->employeePolicyModel + ->select('employees.*') + ->join('employees', 'employee_polices.employee_id = employees.id', 'left') + ->where('employee_polices.client_policy_id', $client_policy['id']) + ->where('employees.emp_status', 'draft') + ->where('employees.is_active', 1) + ->where('employee_polices.status', 'draft') + ->where('employee_polices.is_active', 1) + ->where('employees.relationship', 'Self') + ->findAll(); + + // Process each employee + foreach ($employees as $employee) { + + if ($employee['emp_status'] == 'draft' && $employee['relationship'] == 'Self') { + $this->myLogger->logme('error', 'Employee status and relationship check passed for employee ID: ' . $employee['id']); + + // Mail params + $params['emp_data'] = $employee; + $params['client_data'] = $client_data; + $params['notification_data'] = $notification_data; + + // Send the mail notification + $mail_result = sendMailNotification::sendMailNotification('member_reminder_mail', $params); + // $this->myLogger->logme('error', 'Mail sent result: ' . json_encode($mail_result)); + $reminder_whole_mail[] = $mail_result; + } } + } else { + // echo '5'; + $this->myLogger->logme('error', 'Notification not sent for client policy ID: ' . $client_policy['id']); } - } else { - // echo '5'; - $this->myLogger->logme('error', 'Notification not sent for client policy ID: ' . $client_policy['id']); } } } @@ -481,41 +479,22 @@ class DashboardController extends AdminController // dd($reminder_whole_mail); - // $this->myLogger->logme('error', 'Whole email, count: ' . $reminder_whole_mail); - // Process and queue bulk emails - $temp_whole_data = []; - $count = 0; - - foreach ($reminder_whole_mail as $whole_index => $values) { - foreach ($values as $index => $value) { - $temp_whole_data[] = $value; - $count++; - $this->myLogger->logme('error', 'Queueing email, count: ' . $count); - - if ($count == 20 || ($whole_index == count($reminder_whole_mail) - 1 && $index == count($values) - 1)) { - if (!empty($temp_whole_data)) { - Jobs::addJob(['job_name' => 'bulk_mail', 'payload' => $temp_whole_data]); - $this->myLogger->logme('error', 'Added bulk mail job: ' . json_encode($temp_whole_data)); - $temp_whole_data = []; - $count = 0; - } - } + if (!empty($reminder_whole_mail) && count($reminder_whole_mail) > 0) { + + $reminder_whole_mail = array_chunk($reminder_whole_mail, 20); + + foreach ($reminder_whole_mail as $key => $value) { + $job_details = new Jobs(); + $r = Jobs::addJob(['job_name' => 'bulk_mail', 'payload' => $value]); } } - - if (count($temp_whole_data) > 0) { - Jobs::addJob(['job_name' => 'bulk_mail', 'payload' => $temp_whole_data]); - $this->myLogger->logme('error', 'Added final bulk mail job: ' . json_encode($temp_whole_data)); + + if (count($reminder_whole_mail) > 0) { return true; - } - - if(count($reminder_whole_mail) > 0){ - return true; - }else{ + } else { return false; } - } public function sendManualReminder($client_id, $client_branch_id) @@ -545,7 +524,7 @@ class DashboardController extends AdminController } } - public function sendManualEcard($client_id, $client_branch_id, $policy_id) + public function sendManualEcard($client_id, $client_branch_id, $policy_id) { $this->myLogger->logme('error', "sendManualEcard called with client_id: {$client_id}, client_branch_id: {$client_branch_id}, policy id : {$policy_id}"); @@ -574,7 +553,8 @@ class DashboardController extends AdminController } - public function data_construct_for_bds($data){ + public function data_construct_for_bds($data) + { $groupedData = [ 'under_process' => [], diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php index 9ae9e2d1..4330dd4b 100755 --- a/app/Controllers/EmpDataServiceController.php +++ b/app/Controllers/EmpDataServiceController.php @@ -4353,7 +4353,7 @@ class EmpDataServiceController extends BaseController foreach ($ids as $id) { $emp_details = $this->employeePolicyModel - ->select('employee_polices.client_policy_id, employees.relationship, employees.emp_code, employees.email_corporate, employees.client_id, employees.name, employee_polices.rand_string, employee_polices.tpa_id') + ->select('employee_polices.client_policy_id, employees.relationship, employees.emp_code, employees.email_corporate, employees.client_id, employees.name, employees.mobile, employee_polices.rand_string, employee_polices.tpa_id') ->join('employees', 'employees.id = employee_polices.employee_id') ->where('employees.emp_status', 'active') ->where('employees.is_active', '1') diff --git a/app/Helpers/sendMailNotification.php b/app/Helpers/sendMailNotification.php index fbc374a8..df94db40 100755 --- a/app/Helpers/sendMailNotification.php +++ b/app/Helpers/sendMailNotification.php @@ -17,6 +17,7 @@ class sendMailNotification public static function sendMailNotification($action, $params) { $wholeData =[]; + if ($action == 'member_welcome_mail') { $dataToInsert = $params['dataToInsert']; @@ -42,6 +43,7 @@ class sendMailNotification $subject = $notification['subject']; $app_link = $_ENV['App_Url']; $employee_name =$dataToInsert['name']; + $employee_mobile_no =$dataToInsert['mobile']; $mail_content = $notification['mail_content']; $nhance_logo = $_ENV['NHANCE_LOGO']; $client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo']; @@ -49,6 +51,7 @@ class sendMailNotification $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("[[member_mobile]]", $employee_mobile_no, $mail_content); $mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content); $mail_content = str_replace("[[app_link]]", "Review Details", $mail_content); @@ -83,7 +86,9 @@ class sendMailNotification $mail =''; if ($emp_data['relationship'] == 'Self') { $employee_name =$emp_data['name']; + $employee_mobile_no =$emp_data['mobile']; $mail_content = str_replace("[[member_name]]", $employee_name, $mail_content); + $mail_content = str_replace("[[member_mobile]]", $employee_mobile_no, $mail_content); $mail = $emp_data['email_corporate']; } } @@ -93,7 +98,9 @@ class sendMailNotification }else{ $employee_name =$emp_data['name']; + $employee_mobile_no =$emp_data['mobile']; $mail_content = str_replace("[[member_name]]", $employee_name, $mail_content); + $mail_content = str_replace("[[member_mobile]]", $employee_mobile_no, $mail_content); $mail = $emp_data['email_corporate']; } @@ -111,7 +118,9 @@ class sendMailNotification foreach ($emp_data as $key => $values) { if ($value['relationship'] == 'Self') { $employee_name =$values['name']; + $employee_mobile_no =$values['mobile']; $mail_content = str_replace("[[member_name]]", $employee_name, $mail_content); + $mail_content = str_replace("[[member_mobile]]", $employee_mobile_no, $mail_content); $mail = $values['email_corporate']; } } @@ -120,7 +129,9 @@ class sendMailNotification } }else{ $employee_name =$value['name']; + $employee_mobile_no =$value['mobile']; $mail_content = str_replace("[[member_name]]", $employee_name, $mail_content); + $mail_content = str_replace("[[member_mobile]]", $employee_mobile_no, $mail_content); $mail = $value['email_corporate']; } if (isset($mail) && !empty($mail)) { @@ -161,6 +172,7 @@ class sendMailNotification $app_link = $_ENV['App_Url']; $name = $get_emp_email_and_other_details['name']; + $employee_mobile_no = $get_emp_email_and_other_details['mobile']; $mail_content = $notification['mail_content']; $nhance_logo = $_ENV['NHANCE_LOGO']; @@ -175,6 +187,7 @@ class sendMailNotification $mail_content = str_replace("[[client_logo]]", "Client Logo", $mail_content); $mail_content = str_replace("[[member_name]]", $name, $mail_content); + $mail_content = str_replace("[[member_mobile]]", $employee_mobile_no, $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); @@ -226,6 +239,7 @@ class sendMailNotification $gst = 0; $Addon_list = []; $name = ''; + $employee_mobile_no = ''; $emp_code = ''; // echo '
';
@@ -258,6 +272,7 @@ class sendMailNotification
                                 $emp_code = '(' . $inner_item['emp_code'] . ')';
                                 $mail = $inner_item['email_corporate'];
                                 $name = $inner_item['name'];
+                                $employee_mobile_no = $inner_item['mobile'];
                             } 
 
                             $si = '';
@@ -378,6 +393,7 @@ class sendMailNotification
                 // print_r($table_content); die;
 
                 $mail_content = str_replace("[[member_name]]", $name . ' (' . $emp_code . ')' , $mail_content);
+                $mail_content = str_replace("[[member_mobile]]", $employee_mobile_no, $mail_content);
                 $mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
 
                 // print_r($mail_content); die;
@@ -841,6 +857,7 @@ class sendMailNotification
             // print_r($attachments); die;
 
             $employee_name = 'John Doe';
+            $mobile = 9080706050;
 
             $app_link = $_ENV['App_Url'];
             $nhance_logo = $_ENV['NHANCE_LOGO'];
@@ -850,6 +867,7 @@ class sendMailNotification
             $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("[[member_mobile]]", $mobile, $mail_content);
             $mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
 
             $mail_content = str_replace("[[app_link]]", "Review Details", $mail_content);
@@ -873,6 +891,7 @@ class sendMailNotification
             $app_link = $_ENV['App_Url'];
 
             $employee_name = 'John Doe';
+            $mobile = 9080706050;
 
             $client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
 
@@ -880,6 +899,7 @@ class sendMailNotification
             $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);
+            $mail_content = str_replace("[[member_mobile]]", $mobile, $mail_content);
 
             if ((isset($notification_data) && $notification_data['enabled'] == 1)) {
 
@@ -905,6 +925,7 @@ class sendMailNotification
             $link = generate_download_link($rand_string);
 
             $name = 'John Doe';
+            $mobile = 9080706050;
 
             $nhance_logo = $_ENV['NHANCE_LOGO'];
             $app_link = $_ENV['App_Url'];
@@ -916,6 +937,7 @@ class sendMailNotification
             $mail_content = str_replace("[[client_logo]]", "Client Logo", $mail_content);
 
             $mail_content = str_replace("[[member_name]]", $name, $mail_content);
+            $mail_content = str_replace("[[member_mobile]]", $mobile, $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);
@@ -937,7 +959,8 @@ class sendMailNotification
                     'premium' => 12000,
                     'gst' => 2160,
                     'rata_premimum' => 12000,
-                    'is_addon' => 2
+                    'is_addon' => 2,
+                    'mobile' => 9080706050
             ];
             
 
@@ -967,6 +990,7 @@ class sendMailNotification
                 $gst = 0;
                 $Addon_list = [];
                 $name =  $array_list['name'];
+                $mobile =  $array_list['mobile'];
                 $emp_code = '';
                 
                 if (!empty($array_list)) {
@@ -987,9 +1011,9 @@ class sendMailNotification
                     $table_content .= '';
                     $table_content .= '';
                     $table_content .= 'Name';
-                    $table_content .= 'Relation';
-                    $table_content .= 'Date Of Birth';
-                    $table_content .= 'Sum Insured';
+                    $table_content .= 'Relation';
+                    $table_content .= 'Date Of Birth';
+                    $table_content .= 'Sum Insured';
                 
                     // Only Display SI Topup and Dependent Addon 
                     if ($array_list['is_addon'] == 2 || $array_list['is_addon'] == 3) {
@@ -1003,14 +1027,14 @@ class sendMailNotification
                     // Table body with details
                     $table_content .= '';
                     $table_content .= '';
-                    $table_content .= '' . $array_list['name'] . $emp_code . '';
-                    $table_content .= '' . $array_list['relationship'] . '';
-                    $table_content .= '' . \DateTime::createFromFormat('Y-m-d', $array_list['dob'])->format('d-m-Y') . '';
-                    $table_content .= '₹' . format_indian_number($array_list['basic_cover_si']) . '';
+                    $table_content .= '' . nl2br(wordwrap($array_list['name'] . $emp_code, 11, "\n", true)) . '';
+                    $table_content .= '' . $array_list['relationship'] . '';
+                    $table_content .= '' . \DateTime::createFromFormat('Y-m-d', $array_list['dob'])->format('d-m-Y') . '';
+                    $table_content .= '₹' . format_indian_number($array_list['basic_cover_si']) . '';
                 
                     if ($array_list['is_addon'] == 2 || $array_list['is_addon'] == 3) {
-                        $table_content .= '₹' . format_indian_number(round($array_list['premium'])) . '';
-                        $table_content .= '₹' . format_indian_number(round($array_list['gst'])) . '';
+                        $table_content .= '₹' . format_indian_number(round($array_list['premium'])) . '';
+                        $table_content .= '₹' . format_indian_number(round($array_list['gst'])) . '';
                     }
                 
                     $table_content .= '';
@@ -1039,10 +1063,10 @@ class sendMailNotification
                         
                         $table_content .= '';
                         $table_content .= '';
-                        $table_content .= 'Policy Name';
-                        $table_content .= 'Additional Premium';
-                        $table_content .= 'GST';
-                        $table_content .= 'Total';
+                        $table_content .= 'Policy Name';
+                        $table_content .= 'Additional Premium';
+                        $table_content .= 'GST';
+                        $table_content .= 'Total';
                         $table_content .= '';
                         $table_content .= '';
                         
@@ -1050,16 +1074,16 @@ class sendMailNotification
                         
                         $total_addon = $Addon_list[0]['gst'] + $Addon_list[0]['addtional_premium'];
                         $table_content .= '';
-                        $table_content .= '' . $Addon_list[0]['policy_name'] . '';
-                        $table_content .= '₹' . format_indian_number($Addon_list[0]['addtional_premium']) . '';
-                        $table_content .= '₹' . format_indian_number($Addon_list[0]['gst']) . '';
-                        $table_content .= '₹' . format_indian_number($total_addon) . '';
+                        $table_content .= '' . $Addon_list[0]['policy_name'] . '';
+                        $table_content .= '₹' . format_indian_number($Addon_list[0]['addtional_premium']) . '';
+                        $table_content .= '₹' . format_indian_number($Addon_list[0]['gst']) . '';
+                        $table_content .= '₹' . format_indian_number($total_addon) . '';
                         $table_content .= '';
                 
                         $sum_total_words = numberToWords($total_addon);
                         $table_content .= '';
                         $table_content .= 'Total';
-                        $table_content .= '₹' . format_indian_number($total_addon) . '';
+                        $table_content .= '₹' . format_indian_number($total_addon) . '';
                         $table_content .= '';
                         $table_content .= '';
                         $table_content .= '';
@@ -1067,6 +1091,7 @@ class sendMailNotification
                 }            
                 
                 $mail_content = str_replace("[[member_name]]", $name . ' (' . $emp_code . ')' , $mail_content);
+                $mail_content = str_replace("[[member_mobile]]", $mobile, $mail_content);
                 $mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
 
 
@@ -1136,14 +1161,14 @@ class sendMailNotification
                     $table_content .= '';
                     $table_content .= '';
                     $table_content .= 'Name';
-                    $table_content .= 'Relation';
-                    $table_content .= 'Date Of Birth';
-                    $table_content .= 'Sum Insured';
+                    $table_content .= 'Relation';
+                    $table_content .= 'Date Of Birth';
+                    $table_content .= 'Sum Insured';
                 
                     // Only Display SI Topup and Dependent Addon 
                     if ($array_list['is_addon'] == 2 || $array_list['is_addon'] == 3) {
-                        $table_content .= 'Premium';
-                        $table_content .= 'GST';
+                        $table_content .= 'Premium';
+                        $table_content .= 'GST';
                     }
                 
                     $table_content .= '';
@@ -1152,14 +1177,14 @@ class sendMailNotification
                     // Table body with details
                     $table_content .= '';
                     $table_content .= '';
-                    $table_content .= '' . $array_list['name'] . $emp_code . '';
-                    $table_content .= '' . $array_list['relationship'] . '';
-                    $table_content .= '' . \DateTime::createFromFormat('Y-m-d', $array_list['dob'])->format('d-m-Y') . '';
-                    $table_content .= '₹' . format_indian_number($array_list['basic_cover_si']) . '';
+                    $table_content .= '' . nl2br(wordwrap($array_list['name'] . $emp_code, 11, "\n", true)) . '';
+                    $table_content .= '' . $array_list['relationship'] . '';
+                    $table_content .= '' . \DateTime::createFromFormat('Y-m-d', $array_list['dob'])->format('d-m-Y') . '';
+                    $table_content .= '₹' . format_indian_number($array_list['basic_cover_si']) . '';
                 
                     if ($array_list['is_addon'] == 2 || $array_list['is_addon'] == 3) {
-                        $table_content .= '₹' . format_indian_number(round($array_list['premium'])) . '';
-                        $table_content .= '₹' . format_indian_number(round($array_list['gst'])) . '';
+                        $table_content .= '₹' . format_indian_number(round($array_list['premium'])) . '';
+                        $table_content .= '₹' . format_indian_number(round($array_list['gst'])) . '';
                     }
                 
                     $table_content .= '';
@@ -1188,10 +1213,10 @@ class sendMailNotification
                         
                         $table_content .= '';
                         $table_content .= '';
-                        $table_content .= 'Policy Name';
-                        $table_content .= 'Additional Premium';
-                        $table_content .= 'GST';
-                        $table_content .= 'Total';
+                        $table_content .= 'Policy Name';
+                        $table_content .= 'Additional Premium';
+                        $table_content .= 'GST';
+                        $table_content .= 'Total';
                         $table_content .= '';
                         $table_content .= '';
                         
@@ -1199,17 +1224,17 @@ class sendMailNotification
                         
                         $total_addon = $Addon_list[0]['gst'] + $Addon_list[0]['addtional_premium'];
                         $table_content .= '';
-                        $table_content .= '' . $Addon_list[0]['policy_name'] . '';
-                        $table_content .= '₹' . format_indian_number($Addon_list[0]['addtional_premium']) . '';
-                        $table_content .= '₹' . format_indian_number($Addon_list[0]['gst']) . '';
-                        $table_content .= '₹' . format_indian_number($total_addon) . '';
+                        $table_content .= '' . $Addon_list[0]['policy_name'] . '';
+                        $table_content .= '₹' . format_indian_number($Addon_list[0]['addtional_premium']) . '';
+                        $table_content .= '₹' . format_indian_number($Addon_list[0]['gst']) . '';
+                        $table_content .= '₹' . format_indian_number($total_addon) . '';
                         $table_content .= '';
                 
                         $sum_total_words = numberToWords($total_addon);
                         $table_content .= '';
                         $table_content .= 'Total';
-                        $table_content .= '₹' . format_indian_number($total_addon) . '';
-                        $table_content .= '';
+                        $table_content .= '₹' . format_indian_number($total_addon) . '';
+                        $table_content .= '';
                         $table_content .= '';
                         $table_content .= '';
                     }
@@ -1228,7 +1253,7 @@ class sendMailNotification
             $array_list = [
                 'policy_name' => 'Health Insurance Plan',
                 'emp_code' => 'E12345',
-                'name' => 'John Doe',
+                'name' => 'Ramakrishnaparamahamsar',
                 'relationship' => 'Self',
                 'dob' => '1985-05-15',
                 'basic_cover_si' => 500000,
@@ -1284,14 +1309,14 @@ class sendMailNotification
                     $table_content .= '';
                     $table_content .= '';
                     $table_content .= 'Name';
-                    $table_content .= 'Relation';
-                    $table_content .= 'Date Of Birth';
-                    $table_content .= 'Sum Insured';
+                    $table_content .= 'Relation';
+                    $table_content .= 'Date Of Birth';
+                    $table_content .= 'Sum Insured';
                 
                     // Only Display SI Topup and Dependent Addon 
                     if ($array_list['is_addon'] == 2 || $array_list['is_addon'] == 3) {
-                        $table_content .= 'Premium';
-                        $table_content .= 'GST';
+                        $table_content .= 'Premium';
+                        $table_content .= 'GST';
                     }
                 
                     $table_content .= '';
@@ -1300,14 +1325,14 @@ class sendMailNotification
                     // Table body with details
                     $table_content .= '';
                     $table_content .= '';
-                    $table_content .= '' . $array_list['name'] . $emp_code . '';
-                    $table_content .= '' . $array_list['relationship'] . '';
-                    $table_content .= '' . \DateTime::createFromFormat('Y-m-d', $array_list['dob'])->format('d-m-Y') . '';
-                    $table_content .= '₹' . format_indian_number($array_list['basic_cover_si']) . '';
+                    $table_content .= '' . nl2br(wordwrap($array_list['name'] . $emp_code, 11, "\n", true)) . '';
+                    $table_content .= '' . $array_list['relationship'] . '';
+                    $table_content .= '' . \DateTime::createFromFormat('Y-m-d', $array_list['dob'])->format('d-m-Y') . '';
+                    $table_content .= '₹' . format_indian_number($array_list['basic_cover_si']) . '';
                 
                     if ($array_list['is_addon'] == 2 || $array_list['is_addon'] == 3) {
-                        $table_content .= '₹' . format_indian_number(round($array_list['premium'])) . '';
-                        $table_content .= '₹' . format_indian_number(round($array_list['gst'])) . '';
+                        $table_content .= '₹' . format_indian_number(round($array_list['premium'])) . '';
+                        $table_content .= '₹' . format_indian_number(round($array_list['gst'])) . '';
                     }
                 
                     $table_content .= '';
@@ -1337,10 +1362,10 @@ class sendMailNotification
                         
                         $table_content .= '';
                         $table_content .= '';
-                        $table_content .= 'Policy Name';
-                        $table_content .= 'Additional Premium';
-                        $table_content .= 'GST';
-                        $table_content .= 'Total';
+                        $table_content .= 'Policy Name';
+                        $table_content .= 'Additional Premium';
+                        $table_content .= 'GST';
+                        $table_content .= 'Total';
                         $table_content .= '';
                         $table_content .= '';
                         
@@ -1348,16 +1373,16 @@ class sendMailNotification
                         
                         $total_addon = $Addon_list[0]['gst'] + $Addon_list[0]['addtional_premium'];
                         $table_content .= '';
-                        $table_content .= '' . $Addon_list[0]['policy_name'] . '';
-                        $table_content .= '₹' . format_indian_number($Addon_list[0]['addtional_premium']) . '';
-                        $table_content .= '₹' . format_indian_number($Addon_list[0]['gst']) . '';
-                        $table_content .= '₹' . format_indian_number($total_addon) . '';
+                        $table_content .= '' . $Addon_list[0]['policy_name'] . '';
+                        $table_content .= '₹' . format_indian_number($Addon_list[0]['addtional_premium']) . '';
+                        $table_content .= '₹' . format_indian_number($Addon_list[0]['gst']) . '';
+                        $table_content .= '₹' . format_indian_number($total_addon) . '';
                         $table_content .= '';
                 
                         $sum_total_words = numberToWords($total_addon);
                         $table_content .= '';
-                        $table_content .= 'Total';
-                        $table_content .= '₹' . format_indian_number($total_addon) . '';
+                        $table_content .= 'Total';
+                        $table_content .= '₹' . format_indian_number($total_addon) . '';
                         $table_content .= '';
                         $table_content .= '';
                         $table_content .= '';
diff --git a/app/Models/ClientPolicyModel.php b/app/Models/ClientPolicyModel.php
index 1aa5bf2d..aac8cd01 100755
--- a/app/Models/ClientPolicyModel.php
+++ b/app/Models/ClientPolicyModel.php
@@ -51,6 +51,7 @@ class ClientPolicyModel extends Model
         "enrolment_visibility",
         "disclaimer",
         "is_active",
+        "is_member_modify_allowed",
     ];
 
     public function getClientPolicyById($id){
diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php
index a0bb84b5..fd4a01a5 100755
--- a/app/Views/client_policy.php
+++ b/app/Views/client_policy.php
@@ -37,12 +37,14 @@
                 
+ +
@@ -56,7 +58,7 @@
- + @@ -77,7 +79,7 @@
@@ -301,11 +314,11 @@ allowInput: false }); - var reminderDatePicker = flatpickr("#reminder_date", { - dateFormat: "d-m-Y", - defaultDate: today, - allowInput: false - }); + // var reminderDatePicker = flatpickr("#reminder_date", { + // dateFormat: "d-m-Y", + // defaultDate: today, + // allowInput: false + // }); $('#add_form').hide(); @@ -784,13 +797,14 @@ $('#open_date').val(rearrangeDateFormat(res.data.open_date)); $('#end_date').val(rearrangeDateFormat(res.data.policy_end_date)); $('#close_date').val(rearrangeDateFormat(res.data.close_date)); - $('#reminder_date').val(rearrangeDateFormat(res.data.reminder_date)); + $('#reminder_date').val(res.data.reminder_date); $('#disclaimer').val(res.data.disclaimer); $('#gst_no').val(gst); $('#policy_status').val(checkDateStatus(res.data.policy_end_date)); $('#policy_status_field').show(); + //Open for enrollment yes or no if (res.data.inception_type == 2) { $('#inception_type').prop('checked', true); $('#open_date').parent().show(); @@ -805,13 +819,20 @@ $('.dateofdata').attr('required', false); } - + //Policy Visibility in Web App if (res.data.enrolment_visibility == 1) { $('#policy_visibility').prop('checked', true); } else { $('#policy_visibility').prop('checked', false); } + // Member Modify Data Enable or Disable + if (res.data.is_member_modify_allowed == 1) { + $('#is_member_modify_allowed').prop('checked', true); + } else { + $('#is_member_modify_allowed').prop('checked', false); + } + // if (res.data.is_addon != '1' && res.data.is_addon != '0') { // $('#base_policy_id').show(); diff --git a/app/Views/notification.php b/app/Views/notification.php index 543253b4..77aaf3c2 100755 --- a/app/Views/notification.php +++ b/app/Views/notification.php @@ -237,7 +237,7 @@ - + @@ -405,7 +405,7 @@ - + @@ -492,7 +492,7 @@