CHANGE_EMP_ADD_OR_REMOVE

This commit is contained in:
VENKATESHWARAN 2026-03-20 11:39:12 +05:30
parent dbd6167382
commit 7aa4e8fb98
4 changed files with 24 additions and 20 deletions

View File

@ -284,6 +284,7 @@ class EmployeeRestController extends AdminController
$item->gender = $this->GenderMap($item->relationship , $item->emp_code); $item->gender = $this->GenderMap($item->relationship , $item->emp_code);
$item->dob = $this->convertDateFormatYMD($item->dob); $item->dob = $this->convertDateFormatYMD($item->dob);
$item->emp_status = 'draft'; $item->emp_status = 'draft';
$item->is_dependent_modified = 1;
$item->band = $this->getSelfBand($item->emp_code,$item->client_id,$item->client_branch_id); $item->band = $this->getSelfBand($item->emp_code,$item->client_id,$item->client_branch_id);
// dd($item); // dd($item);
$employee = $this->employeeModel->insert($item); $employee = $this->employeeModel->insert($item);
@ -564,7 +565,7 @@ class EmployeeRestController extends AdminController
$this->employeeModel->where('id', $this->request->getGet('id') ) $this->employeeModel->where('id', $this->request->getGet('id') )
->where('is_active', 1 ) ->where('is_active', 1 )
->set(['emp_status' => 'truncated', 'is_active' => 0]) ->set(['emp_status' => 'truncated', 'is_active' => 0, 'is_dependent_modified' => 0])
->update(); ->update();
} }

View File

@ -46,6 +46,7 @@ class EmployeeModel extends Model
"is_mpin_skipped", "is_mpin_skipped",
"is_biometric_enabled", "is_biometric_enabled",
"password", "password",
"is_dependent_modified",
]; ];
// Callbacks // Callbacks

View File

@ -154,27 +154,29 @@ class EmployeePolicyModel extends Model
FROM employees e FROM employees e
JOIN employee_polices ep ON e.id = ep.employee_id JOIN employee_polices ep ON e.id = ep.employee_id
WHERE e.emp_code = emp.emp_code WHERE e.emp_code = emp.emp_code
AND e.is_active = 0 AND (e.is_dependent_modified = 0 OR (e.is_active = 0 AND e.emp_status != 'truncated'))
AND e.emp_status != 'truncated'
AND ep.client_policy_id = employee_polices.client_policy_id AND ep.client_policy_id = employee_polices.client_policy_id
) )
ELSE NULL ELSE NULL
END) AS removed_summary", END) AS removed_summary",
"(CASE "(IF(COALESCE(emp.is_dependent_modified, 0) = 1, 'Newly Added, ',
WHEN emp.relationship != 'Self' CASE
AND emp.created_at > ( WHEN emp.relationship != 'Self'
SELECT MIN(e_sub.created_at) AND emp.created_by = (
FROM employees e_sub SELECT e_sub.id
INNER JOIN employee_polices ep_sub ON e_sub.id = ep_sub.employee_id FROM employees e_sub
WHERE e_sub.emp_code = emp.emp_code INNER JOIN employee_polices ep_sub ON e_sub.id = ep_sub.employee_id
AND e_sub.relationship = 'Self' WHERE e_sub.emp_code = emp.emp_code
AND e_sub.is_active = 1 AND e_sub.relationship = 'Self'
AND ep_sub.client_policy_id = employee_polices.client_policy_id AND e_sub.is_active = 1
) AND ep_sub.client_policy_id = employee_polices.client_policy_id
THEN 'Newly Added' LIMIT 1
ELSE NULL )
END) AS newly_added", THEN 'Newly Added, '
ELSE NULL
END
)) AS newly_added",
$status_query $status_query
], false) ], false)

View File

@ -200,6 +200,9 @@
</td> </td>
<td> <td>
<?php <?php
if(!empty($employee['newly_added'])){
echo "<p>" . $employee['newly_added'] . "</p>";
}
if(!empty($employee['name_first_old']) ){ if(!empty($employee['name_first_old']) ){
echo "<p> Name : " . $employee['name_first_old'] . ' => ' . $employee['name_last_new'] . "</p>"; echo "<p> Name : " . $employee['name_first_old'] . ' => ' . $employee['name_last_new'] . "</p>";
} }
@ -209,9 +212,6 @@
if(!empty($employee['gender_first_old'])){ if(!empty($employee['gender_first_old'])){
echo "<p> Gender : " . $employee['gender_first_old'] . ' => ' . $employee['gender_last_new'] . "</p>"; echo "<p> Gender : " . $employee['gender_first_old'] . ' => ' . $employee['gender_last_new'] . "</p>";
} }
if(!empty($employee['newly_added'])){
echo "<p>" . $employee['newly_added'] . "</p>";
}
// if(!empty($employee['removed_count'])){ // if(!empty($employee['removed_count'])){
// echo "<p>" . $employee['removed_count'] . " People removed </p>"; // echo "<p>" . $employee['removed_count'] . " People removed </p>";
// } // }