CHANGES_ in hr api's : GWM

This commit is contained in:
Gowtham M 2025-06-16 17:27:57 +05:30
parent b0de0e9d84
commit fb0426a308
2 changed files with 35 additions and 60 deletions

View File

@ -477,7 +477,8 @@ $routes->post("calculatePremium", "EmployeeRestController::calculatePremium");
$routes->post("iAgreeForAddOn", "EmployeeRestController::iAgreeForAddOn"); $routes->post("iAgreeForAddOn", "EmployeeRestController::iAgreeForAddOn");
$routes->get("exportDataByClientPolicyId", "EmployeeRestController::exportDataByClientPolicyId"); $routes->get("exportDataByClientPolicyId", "EmployeeRestController::exportDataByClientPolicyId");
$routes->get("getCashDepositData", "EmployeeRestController::getCashDepositData");
$routes->get("getPolicyLevelEmployeeSummaryData", "EmployeeRestController::getPolicyLevelEmployeeSummaryData");
$routes->get("exportCashDepositData", "EmployeeRestController::exportCashDepositData"); $routes->get("exportCashDepositData", "EmployeeRestController::exportCashDepositData");
$routes->get("removeEmpAndEmpPolicyData", "EmployeeRestController::removeEmpAndEmpPolicyData"); $routes->get("removeEmpAndEmpPolicyData", "EmployeeRestController::removeEmpAndEmpPolicyData");

View File

@ -2487,72 +2487,46 @@ class EmployeeRestController extends AdminController
} }
public function getCashDepositData() public function getPolicyLevelEmployeeSummaryData()
{ {
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.client_id as clientId , client_policy.insurer_id as insurerId,insurers.name as insurer_name')
->join('insurers', 'client_policy.insurer_id = insurers.id', 'left') $ClientPolicyData = $this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id, client_policy.policy_type_id as policy_type_id, client_policy.is_addon as is_addon , client_policy.open_for_enrollment as OpenForEnrollment , client_policy.inception_type as inception_type ')
->where('client_policy.client_id', $this->request->getGet('client_id') ) ->where('client_policy.client_id', $this->request->getGet('client_id') )
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') ) ->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') )
->where('client_policy.is_active', 1 ) ->where('client_policy.is_active', 1 )
->where('client_policy.policy_status', 1) ->where('client_policy.policy_status', 1)
->groupBy('client_policy.insurer_id') ->findAll();
->findAll(); $result = [];
$result = []; // dd( $ClientPolicyData);
foreach ($ClientPolicyData as $key => $value)
if(count($ClientPolicyData)) {
{ $policyTypeData = $this->policyTypeModel->where('id',$value['policy_type_id'])->get()->getRow();
foreach ($ClientPolicyData as $key => $value) { $value['type'] = $policyTypeData->policy_type;
$value['policy_name'] = $policyTypeData->long_name;
$data['clientId'] = $value['clientId']; $employeeDetails = $this->employeePolicyModel->getEmployeePolicy( client_id:$value['client_id'],policy_id: $value['client_policy_id'],status:0,branch_id:$this->request->getGet('client_branch_id'));
$data['insurerId'] = $value['insurerId']; $enrolledCount = 0;
$data['insurerName'] = $value['insurer_name']; $draftCount = 0;
$data['depositData'] = $this->clientPolicyModel->getdepositData($value['clientId'],$value['insurerId']); if(count($employeeDetails))
$data['balance'] = count($data['depositData']) ? $data['depositData'][0]->balance : 0;
$data['policyDetails'] = [];
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id, client_policy.policy_type_id as policy_type_id, client_policy.is_addon as is_addon , client_policy.open_for_enrollment as OpenForEnrollment , client_policy.inception_type as inception_type ')
->where('client_policy.insurer_id', $value['insurerId'] )
->where('client_policy.client_id', $this->request->getGet('client_id') )
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') )
->where('client_policy.is_active', 1 )
->where('client_policy.policy_status', 1)
->findAll();
// dd( $ClientPolicyData);
foreach ($ClientPolicyData as $key => $value)
{ {
$policyTypeData = $this->policyTypeModel->where('id',$value['policy_type_id'])->get()->getRow(); foreach ($employeeDetails as $item) {
$value['type'] = $policyTypeData->policy_type; if ($item['emp_status'] === 'enrolled') {
$value['policy_name'] = $policyTypeData->long_name; $enrolledCount++;
$employeeDetails = $this->employeePolicyModel->getEmployeePolicy( client_id:$value['client_id'],policy_id: $value['client_policy_id'],status:0,branch_id:$this->request->getGet('client_branch_id')); } elseif ($item['emp_status'] === 'draft') {
$enrolledCount = 0; $draftCount++;
$draftCount = 0;
if(count($employeeDetails))
{
foreach ($employeeDetails as $item) {
if ($item['emp_status'] === 'enrolled') {
$enrolledCount++;
} elseif ($item['emp_status'] === 'draft') {
$draftCount++;
}
} }
} }
$value['totalMembersCount'] = count($employeeDetails);
$value['membersCountOfEnrolled'] = $enrolledCount;
$value['membersCountOfDraft'] = $draftCount;
array_push($data['policyDetails'],$value);
} }
array_push($result,$data);
} $value['totalMembersCount'] = count($employeeDetails);
} $value['membersCountOfEnrolled'] = $enrolledCount;
$value['membersCountOfDraft'] = $draftCount;
array_push($result,$value);
}
if($result) if($result)
{ {
@ -2724,7 +2698,7 @@ class EmployeeRestController extends AdminController
->where('client_policy.enrolment_visibility', 1 ) ->where('client_policy.enrolment_visibility', 1 )
->orderby('client_policy.id' , 'ASC') ->orderby('client_policy.id' , 'ASC')
->findAll(); ->findAll();
dd( $ClientPolicyData);
// Retrieve employee and dependents data by passing the employee code // Retrieve employee and dependents data by passing the employee code
$employeeData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code')) $employeeData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))
->where('client_id',$this->request->getGet('client_id')) ->where('client_id',$this->request->getGet('client_id'))