CHANGE_VIEW_ENROLLMENT_FAMILY_FILTER_AND_POLICY_TERMS_SCRIPT : RV
This commit is contained in:
parent
97a6cd6512
commit
038475ae0f
@ -3599,80 +3599,63 @@ class ClientController extends AdminController
|
|||||||
// Set default value of copayzonewisecopay to "empty"
|
// Set default value of copayzonewisecopay to "empty"
|
||||||
$ans = isset($policyTerms['copayzonewisecopay']) ? $policyTerms['copayzonewisecopay'] : 'empty';
|
$ans = isset($policyTerms['copayzonewisecopay']) ? $policyTerms['copayzonewisecopay'] : 'empty';
|
||||||
|
|
||||||
|
|
||||||
// Initialize an empty array for the ordered policy terms
|
// Initialize an empty array for the ordered policy terms
|
||||||
$orderedPolicyTerms = [];
|
$orderedPolicyTerms = [];
|
||||||
|
|
||||||
// Add copayzonewisecopay and copayzonewisecopaydata if they exist_
|
// Add copayzonewisecopay and copayzonewisecopaydata if they exist_
|
||||||
if (isset($policyTerms['copayzonewisecopay'])) {
|
if (isset($policyTerms['copayzonewisecopay'])) {
|
||||||
|
|
||||||
$orderedPolicyTerms['copayzonewisecopay'] = $policyTerms['copayzonewisecopay'];
|
if(!isset($policyTerms['co_pay_details'])){
|
||||||
$orderedPolicyTerms['co_pay_details'] = isset($policyTerms['co_pay_details']) ? $policyTerms['co_pay_details'] : '';
|
|
||||||
|
$co_pay_details_value = "";
|
||||||
|
if (strtolower($ans) == "nil" || $ans == 0) {
|
||||||
|
$policyTerms['copayzonewisecopay'] = 0;
|
||||||
|
$co_pay_details_value = "";
|
||||||
|
} elseif ($ans != 'empty' && $ans !== 'Nil' && $ans !== null && $ans != '' && $ans != 0) {
|
||||||
|
$policyTerms['copayzonewisecopay'] = 1;
|
||||||
|
$co_pay_details_value = $ans;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$co_pay_index = array_search('copayzonewisecopay', array_keys($policyTerms));
|
||||||
|
$orderedPolicyTerms[] = [
|
||||||
|
"key" => "co_pay_details",
|
||||||
|
"value" => $co_pay_details_value,
|
||||||
|
"position" => $co_pay_index + 1,
|
||||||
|
];
|
||||||
|
|
||||||
|
unset($policyTerms['optionalparentalcopay']);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add ailmentcapping and ailmentcappingdata if they exist_
|
// Add ailmentcapping and ailmentcappingdata if they exist_
|
||||||
if (isset($policyTerms['ailmentcapping'])) {
|
if (isset($policyTerms['ailmentcapping'])) {
|
||||||
$orderedPolicyTerms['ailmentcapping'] = $policyTerms['ailmentcapping'];
|
if(!isset($policyTerms['ailment_capping_details'])){
|
||||||
$orderedPolicyTerms['ailment_capping_details'] = isset($policyTerms['ailment_capping_details']) ? $policyTerms['ailment_capping_details'] : '';
|
$aliment_index = array_search('ailmentcapping', array_keys($policyTerms));
|
||||||
}
|
$orderedPolicyTerms[] = [
|
||||||
|
"key" => "ailment_capping_details",
|
||||||
|
"value" => "",
|
||||||
// Now add the rest of the policy terms that are not copayzonewisecopay, copayzonewisecopaydata, ailmentcapping, or ailmentcapping_data_
|
"position" => $aliment_index + 2,
|
||||||
foreach ($policyTerms as $key => $value) {
|
];
|
||||||
if (!in_array($key, ['copayzonewisecopay', 'co_pay_details', 'ailmentcapping', 'ailment_capping_details'])) {
|
|
||||||
$orderedPolicyTerms[$key] = $value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($orderedPolicyTerms as $term) {
|
||||||
|
$position = $term['position'];
|
||||||
|
$key = $term['key'];
|
||||||
|
$value = $term['value']; // Insert the key-value pair at the specified index
|
||||||
|
$policyTerms = array_merge(
|
||||||
|
array_slice($policyTerms, 0, $position, true),
|
||||||
|
[$key => $value],
|
||||||
|
array_slice($policyTerms, $position, null, true)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Re-encode the ordered policy terms
|
// Re-encode the ordered policy terms
|
||||||
$updatedPolicyTerms = json_encode($orderedPolicyTerms);
|
$updatedPolicyTerms = json_encode($policyTerms);
|
||||||
|
|
||||||
|
// dd($orderedPolicyTerms, $updatedPolicyTerms);
|
||||||
// Update the policyterms in the database_
|
|
||||||
$this->clientPolicyModel->update($data[$i]['id'], ['policy_terms' => $updatedPolicyTerms]);
|
$this->clientPolicyModel->update($data[$i]['id'], ['policy_terms' => $updatedPolicyTerms]);
|
||||||
|
|
||||||
|
|
||||||
// Handle different conditions for copayzonewisecopay
|
|
||||||
if (strtolower($ans) == "nil" || $ans == 0) {
|
|
||||||
// If copayzonewisecopay is "nil" or 0, reset it to 0 and add copayzonewisecopaydata as empty_
|
|
||||||
if (isset($orderedPolicyTerms['copayzonewisecopay'])) {
|
|
||||||
$orderedPolicyTerms['copayzonewisecopay'] = 0;
|
|
||||||
$orderedPolicyTerms['co_pay_details'] = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Rebuild the array after modification
|
|
||||||
foreach ($policyTerms as $key => $value) {
|
|
||||||
if (!in_array($key, ['copayzonewisecopay', 'co_pay_details'])) {
|
|
||||||
$orderedPolicyTerms[$key] = $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$updatedPolicyTerms = json_encode($orderedPolicyTerms);
|
|
||||||
$this->clientPolicyModel->update($data[$i]['id'], ['policy_terms' => $updatedPolicyTerms]);
|
|
||||||
continue;
|
|
||||||
} elseif ($ans != 'empty' && $ans !== 'Nil' && $ans !== null && $ans != '' && $ans != 0) {
|
|
||||||
// If copayzonewisecopay has a valid value, update it
|
|
||||||
if (isset($orderedPolicyTerms['copayzonewisecopay'])) {
|
|
||||||
$orderedPolicyTerms['copayzonewisecopay'] = 1;
|
|
||||||
$orderedPolicyTerms['co_pay_details'] = $ans;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Rebuild the array after modification
|
|
||||||
foreach ($policyTerms as $key => $value) {
|
|
||||||
if (!in_array($key, ['copayzonewisecopay', 'co_pay_details'])) {
|
|
||||||
$orderedPolicyTerms[$key] = $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$updatedPolicyTerms = json_encode($orderedPolicyTerms);
|
|
||||||
$this->clientPolicyModel->update($data[$i]['id'], ['policy_terms' => $updatedPolicyTerms]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -734,11 +734,16 @@ class EmployeeController extends AdminController
|
|||||||
employees.emp_status, auth_history.user_type')
|
employees.emp_status, auth_history.user_type')
|
||||||
->join('employees', $client_id .'= employees.client_id AND ' . $branch_id . '= employees.client_branch_id', 'left')
|
->join('employees', $client_id .'= employees.client_id AND ' . $branch_id . '= employees.client_branch_id', 'left')
|
||||||
->join('auth_history', 'employees.id = auth_history.user_id AND "employee" = auth_history.user_type', 'left')
|
->join('auth_history', 'employees.id = auth_history.user_id AND "employee" = auth_history.user_type', 'left')
|
||||||
|
->where('employees.is_active', 1)
|
||||||
|
->where('employees.emp_status !=', 'truncated')
|
||||||
|
->groupBy('employees.id')
|
||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
$groupedData = [];
|
$groupedData = [];
|
||||||
$employeeId = '';
|
$employeeId = '';
|
||||||
|
|
||||||
foreach ($results as $row) {
|
foreach ($results as $row) {
|
||||||
|
|
||||||
if($employeeId != $row['employee_id']){
|
if($employeeId != $row['employee_id']){
|
||||||
$employeeId = $row['employee_id'];
|
$employeeId = $row['employee_id'];
|
||||||
}else{
|
}else{
|
||||||
@ -751,7 +756,8 @@ class EmployeeController extends AdminController
|
|||||||
$employeeUserType = $row['user_type'];
|
$employeeUserType = $row['user_type'];
|
||||||
|
|
||||||
|
|
||||||
if ($employeeId !== null && $employeeRelationship == 'Self') {
|
// if ($employeeId !== null && $employeeRelationship == 'Self') {
|
||||||
|
if ($employeeId !== null) {
|
||||||
// Append employee info to the branch's employees list
|
// Append employee info to the branch's employees list
|
||||||
$groupedData[] = [
|
$groupedData[] = [
|
||||||
'employee_id' => $employeeId,
|
'employee_id' => $employeeId,
|
||||||
|
|||||||
@ -180,6 +180,7 @@
|
|||||||
<th class="font-weight-medium">SNO</th>
|
<th class="font-weight-medium">SNO</th>
|
||||||
<th class="font-weight-medium">Name</th>
|
<th class="font-weight-medium">Name</th>
|
||||||
<th class="font-weight-medium">Emp Code</th>
|
<th class="font-weight-medium">Emp Code</th>
|
||||||
|
<th class="font-weight-medium">Relationship</th>
|
||||||
<th class="font-weight-medium">Enroled</th>
|
<th class="font-weight-medium">Enroled</th>
|
||||||
<th class="font-weight-medium">Logged-In</th>
|
<th class="font-weight-medium">Logged-In</th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -336,6 +337,7 @@
|
|||||||
index + 1,
|
index + 1,
|
||||||
employee.employee_name,
|
employee.employee_name,
|
||||||
employee.emp_code,
|
employee.emp_code,
|
||||||
|
employee.relationship,
|
||||||
enrolled,
|
enrolled,
|
||||||
loggedIn
|
loggedIn
|
||||||
]);
|
]);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user