CHANGE_ENROLLMENT_STATUS_COORECT THE CODE : AADHAVAN
This commit is contained in:
parent
a8f0a34762
commit
04e3e0f23a
@ -194,20 +194,19 @@ class DashboardController extends AdminController
|
|||||||
$employeePolicyModel = new EmployeePolicyModel();
|
$employeePolicyModel = new EmployeePolicyModel();
|
||||||
$myLogger = \Config\Services::mylogger();
|
$myLogger = \Config\Services::mylogger();
|
||||||
|
|
||||||
$client_policy_data = $clientPolicyModel
|
$client_policy_data = $clientPolicyModel->findAll();
|
||||||
->where('id', 21)
|
$currentDate = date('d');
|
||||||
->findAll();
|
|
||||||
$currentDate = date('Y-m-d');
|
|
||||||
|
|
||||||
// Update policy status based on start and end dates
|
// Update policy status based on start and end dates
|
||||||
foreach ($client_policy_data as $client_policy) {
|
foreach ($client_policy_data as $client_policy) {
|
||||||
$id = $client_policy['id'];
|
$id = $client_policy['id'];
|
||||||
|
$openDate = date('d', strtotime($client_policy['open_date']));
|
||||||
if ($currentDate == $client_policy['open_date']) {
|
$closeDate = date('d', strtotime($client_policy['close_date']));
|
||||||
|
if ($currentDate == $openDate) {
|
||||||
$clientPolicyModel->update($id, ['open_for_enrollment' => 1]);
|
$clientPolicyModel->update($id, ['open_for_enrollment' => 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($client_policy['close_date'] < $currentDate) {
|
if ($closeDate < $currentDate) {
|
||||||
$clientPolicyModel->update($id, ['open_for_enrollment' => 0]);
|
$clientPolicyModel->update($id, ['open_for_enrollment' => 0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -224,13 +223,15 @@ class DashboardController extends AdminController
|
|||||||
->first();
|
->first();
|
||||||
|
|
||||||
// Check if notification should be sent
|
// Check if notification should be sent
|
||||||
if ($notification_data && $notification_data['enabled'] == 1 && $currentDate == $client_policy['reminder_date']) {
|
if ($notification_data && $notification_data['enabled'] == 1 && $currentDate == date('d', strtotime($client_policy['reminder_date'])) ) {
|
||||||
// Fetch all employees related to the client policy
|
// Fetch all employees related to the client policy
|
||||||
$employees = $employeePolicyModel->select('employees.*')
|
$employees = $employeePolicyModel->select('employees.*')
|
||||||
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
|
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
|
||||||
->where('employee_polices.client_policy_id', $client_policy['id'])
|
->where('employee_polices.client_policy_id', $client_policy['id'])
|
||||||
|
->where('employees.emp_status', 'draft')
|
||||||
|
->where('employee_polices.status', 'draft')
|
||||||
|
->where('employees.relationship', 'Self')
|
||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
// Process each employee
|
// Process each employee
|
||||||
foreach ($employees as $employee) {
|
foreach ($employees as $employee) {
|
||||||
if($employee['emp_status'] == 'draft' && $employee['relationship'] == 'Self'){
|
if($employee['emp_status'] == 'draft' && $employee['relationship'] == 'Self'){
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user