Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
velz 2024-10-26 17:51:20 +05:30
commit 1aad3b59cc
4 changed files with 49 additions and 21 deletions

View File

@ -1125,6 +1125,7 @@ class EmployeeController extends AdminController
'{FRONT_CARD}' => base_url() . 'public/uploads/template_bg/' . $value['front_card'],
'{BACK_CARD}' => base_url() . 'public/uploads/template_bg/' . $value['back_card'],
'{EMP_ID}' => $value['emp_code'],
'{SI_AMT}' => $value['basic_cover_si'],
'{CORPORATE_NAME}' => $value['client_name'],
'{AGE}' => $value['emp_age'],
'{TPA_NAME}' => $value['tpa_name'],
@ -1306,10 +1307,9 @@ class EmployeeController extends AdminController
}
}
// Preview E-Card Template function
public function previewTemplate($id = null)
{
$value = [
'tpa_id' => 'TPA12345',
'name' => 'John Doe',
@ -1326,10 +1326,10 @@ class EmployeeController extends AdminController
'emp_age' => 39,
'tpa_name' => 'Example TPA',
'insurer_branch_city' => 'New York',
'relationship' => 'Self'
'relationship' => 'Self',
'basic_cover_si' => '5,00,000',
];
$tpa_id = $this->TPAModel->where('id', $id)->first();
$template_data_path = WRITEPATH . 'e_card_template/';
@ -1356,6 +1356,7 @@ class EmployeeController extends AdminController
'{POLICY_NO}' => $value['policy_no'],
'{INSURER_NAME}' => strtoupper($value['insurer_name']),
'{EMP_ID}' => $value['emp_code'],
'{SI_AMT}' => $value['basic_cover_si'],
'{CORPORATE_NAME}' => $value['client_name'],
'{AGE}' => $value['emp_age'],
'{TPA_NAME}' => $value['tpa_name'],

View File

@ -309,6 +309,7 @@ class EmployeeRestController extends AdminController
$data['client_policy_id']= $client_policy_id;
$data['basic_cover_si']= $basic_cover_si;
$data['status']= 'draft';
$data['date_coverage'] = $this->getEmployeeCoverageDate($emp_code, $client_policy_id);
$this->employeePolicyModel->insert($data);
@ -320,10 +321,7 @@ class EmployeeRestController extends AdminController
public function updatePremiumAmount($client_policy_id , $emp_code , $client_branch_id)
{
$response = $this->calculatePremium($client_policy_id , $emp_code , null , $client_branch_id);
// echo '<pre>';
// print_r($response);
// echo '</pre>';
// die();
if(count($response[$emp_code]))
{
@ -354,6 +352,45 @@ class EmployeeRestController extends AdminController
}
}
public function getEmployeeCoverageDate($emp_code, $client_policy_id)
{
$empData = $this->employeeModel->where('emp_code',$emp_code)->where('relationship', 'self')->where('is_active',1)->first();;
if($empData)
{
$empPolicyData = $this->employeePolicyModel->select('employee_polices.employee_id,employee_polices.client_policy_id,employee_polices.date_coverage,client_policy.policy_type_id,client_policy.base_policy')
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id', 'left')
->where('employee_polices.employee_id' , $empData['id'] )
->where('employee_polices.is_active' , 1 )
->findAll();
if(count($empPolicyData))
{
// find same policy 'self' date of coverage
$filterSelfPolicy = array_filter($empPolicyData, function($row) use ($client_policy_id) {
return $row['client_policy_id'] == $client_policy_id;
});
$filterSelfPolicy = array_values($filterSelfPolicy); // Reset the index of the filtered result
if(count($filterSelfPolicy)){
return $filterSelfPolicy[0]['date_coverage'];
}else{
// find base policy 'self' date of coverage
$basePolicy = $this->clientPolicyModel->where('id',$client_policy_id)->get()->getRow()->base_policy;
$filterSelfBasePolicy = array_filter($empPolicyData, function($row) use ($basePolicy) {
return $row['client_policy_id'] == $basePolicy;
});
$filterSelfBasePolicy = array_values($filterSelfBasePolicy); // Reset the index of the filtered result
if(count($filterSelfBasePolicy)){
return $filterSelfBasePolicy[0]['date_coverage'];
}else{ return null; }
}
}else{ return null; }
}else{ return null; }
}
public function RelationshipMap($value){
@ -432,7 +469,6 @@ class EmployeeRestController extends AdminController
}
// Get the RelationShip list
public function createOrUpdateEmployeePolicySiAmount()
{
@ -632,11 +668,6 @@ class EmployeeRestController extends AdminController
}
// Upload the Employee Detail in DB by Sheet Data
public function employeeUpload()
{

View File

@ -851,6 +851,7 @@ class EmployeePolicyModel extends Model
ep.tpa_id,
ep.uhid,
ep.policy_end_date,
ep.basic_cover_si,
clients.client_name,
clients.short_name AS client_short_name,
@ -858,8 +859,6 @@ class EmployeePolicyModel extends Model
cp.policy_start_date,
cp.policy_no,
policies.name AS policy_name,
insurers.name AS insurer_name,
insurers.short_name AS insurer_short_name,
insurers.insurer_logo,
@ -878,7 +877,6 @@ class EmployeePolicyModel extends Model
->join('employee_polices ep', 'ep.employee_id = e.id')
->join('client_policy cp', 'cp.id = ep.client_policy_id')
->join('clients', 'clients.id = cp.client_id')
->join('policies', 'policies.id = cp.policy_id')
->join('insurers', 'insurers.id = cp.insurer_id')
->join('insurer_branch', 'insurer_branch.id = cp.insurer_branch_id')
->join('tpa', 'tpa.id = cp.tpa_id')
@ -918,6 +916,7 @@ class EmployeePolicyModel extends Model
ep.tpa_id,
ep.uhid,
ep.policy_end_date,
ep.basic_cover_si,
clients.client_name,
clients.short_name AS client_short_name,
@ -925,8 +924,6 @@ class EmployeePolicyModel extends Model
cp.policy_start_date,
cp.policy_no,
policies.name AS policy_name,
insurers.name AS insurer_name,
insurers.short_name AS insurer_short_name,
insurers.insurer_logo,
@ -945,7 +942,6 @@ class EmployeePolicyModel extends Model
->join('employee_polices ep', 'ep.employee_id = e.id')
->join('client_policy cp', 'cp.id = ep.client_policy_id')
->join('clients', 'clients.id = cp.client_id')
->join('policies', 'policies.id = cp.policy_id')
->join('insurers', 'insurers.id = cp.insurer_id')
->join('insurer_branch', 'insurer_branch.id = cp.insurer_branch_id')
->join('tpa', 'tpa.id = cp.tpa_id')

View File

@ -663,7 +663,7 @@
</a>
</li> -->
<?php if((get_role_id() == 1 || get_role_id() == 5) && (in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()))) { ?>
<?php if((get_role_id() == 1 || get_role_id() == 5) && (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()))) { ?>
<li>
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">