CHANGE_ adding branch_id : GWM

This commit is contained in:
bitbucket 2024-05-29 13:27:34 +05:30
parent d16c0799bb
commit 0d17c1692b

View File

@ -403,6 +403,73 @@ class EmployeeRestController extends AdminController
}
// Get the RelationShip list
public function createOrUpdateEmployeePolicySiAmount()
{
try {
$requestData = $this->request->getJSON();
foreach ($requestData as $key => $value) {
$checkIfExist = $this->employeePolicyModel->where('employee_id', $value->employee_id)
->where('client_policy_id', $value->client_policy_id)
->where('is_active', 1 )
->findAll();
// dd($checkIfExist);
if ($checkIfExist) {
$empPolicy = $this->employeePolicyModel->updateSiAndPremium($value->client_policy_id, $value->employee_id, $value->basic_cover_si);
}else{
$data['employee_id']= $value->employee_id;
$data['client_policy_id']= $value->client_policy_id;
$data['basic_cover_si']= $value->basic_cover_si;
$data['status'] = 'draft';
$this->employeePolicyModel->insert($data);
}
}
$this->updatePremiumAmount($requestData[0]->client_policy_id , $requestData[0]->emp_code);
return $this->respond(['status' => 'success','code' => 200,'data' => []], 200);
} catch (\Exception $e) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
}
}
public function findPremiumAmount($slabArray,$siAmount)
{
foreach ($slabArray as $key => $value) {
if($value['si'] == $siAmount){
return $value['premium'];
break;
}
}
}
public function relationshipList()
{
try {
$relation_ships= $this->relationshipModel->findAll();
if(count($relation_ships) > 0){
return $this->respond(['status' => 'success','code' => 200,'data' => $relation_ships], 200);
}else{
return $this->respond(['status' => 'success','code' => 200,'data' => "No Data..!"], 200);
}
} catch (\Exception $e) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
}
}
public function getEmployeeAndDependenceByClientId()
{
@ -422,7 +489,6 @@ class EmployeeRestController extends AdminController
}
public function exportDataByClientPolicyId()
{
try {
@ -500,6 +566,7 @@ class EmployeeRestController extends AdminController
}
//not in use
public function getClientPolicy()
{
try {
@ -538,73 +605,7 @@ class EmployeeRestController extends AdminController
// Get the RelationShip list
public function createOrUpdateEmployeePolicySiAmount()
{
try {
$requestData = $this->request->getJSON();
foreach ($requestData as $key => $value) {
$checkIfExist = $this->employeePolicyModel->where('employee_id', $value->employee_id)
->where('client_policy_id', $value->client_policy_id)
->where('is_active', 1 )
->findAll();
// dd($checkIfExist);
if ($checkIfExist) {
$empPolicy = $this->employeePolicyModel->updateSiAndPremium($value->client_policy_id, $value->employee_id, $value->basic_cover_si);
}else{
$data['employee_id']= $value->employee_id;
$data['client_policy_id']= $value->client_policy_id;
$data['basic_cover_si']= $value->basic_cover_si;
$data['status'] = 'draft';
$this->employeePolicyModel->insert($data);
}
}
$this->updatePremiumAmount($requestData[0]->client_policy_id , $requestData[0]->emp_code);
return $this->respond(['status' => 'success','code' => 200,'data' => []], 200);
} catch (\Exception $e) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
}
}
public function findPremiumAmount($slabArray,$siAmount)
{
foreach ($slabArray as $key => $value) {
if($value['si'] == $siAmount){
return $value['premium'];
break;
}
}
}
public function relationshipList()
{
try {
$relation_ships= $this->relationshipModel->findAll();
if(count($relation_ships) > 0){
return $this->respond(['status' => 'success','code' => 200,'data' => $relation_ships], 200);
}else{
return $this->respond(['status' => 'success','code' => 200,'data' => "No Data..!"], 200);
}
} catch (\Exception $e) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
}
}
// Upload the Employee Detail in DB by Sheet Data
public function employeeUpload()
@ -618,6 +619,7 @@ class EmployeeRestController extends AdminController
// die;
$file = $this->request->getFile('file');
$client_id = $this->request->getPost('client_id');
$client_branch_id = $this->request->getPost('client_branch_id');
$policy_id = $this->request->getPost('policy_id');
$client_data = $this->clientModel->where('id', $client_id)->first();
@ -636,7 +638,7 @@ class EmployeeRestController extends AdminController
$client_policy = $this->clientPolicyModel->where('id', $policy_id)->where('client_id', $client_id)->first();
$client_policy = $this->clientPolicyModel->where('id', $policy_id)->where('client_id', $client_id)->where('client_branch_id', $client_branch_id)->first();
if ($client_policy) {
$policy = $this->policesModel->where('id', $client_policy['policy_id'])->first();
$policy_permium_1 = $this->policyPremium1Model->where(['client_id' => $client_id , 'client_policy_id' => $policy_id,'is_active' =>1])-> first();
@ -670,6 +672,7 @@ class EmployeeRestController extends AdminController
$extractData['file_name']= $filename;
$extractData['client_id']= $client_id;
$extractData['client_branch_id']= $client_branch_id;
$extractData['status']= 'success';
$extractData['policy_id']= $policy_id;
$extractData['action']= 'enrollment';
@ -932,6 +935,7 @@ public function getAgeRange($terms,$familyFloatesValue)
}
public function getEmployeePolicy()
{
try {
@ -1266,6 +1270,7 @@ public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id,$cl
}
}
public function FloterConvertion($array){
$result = [];
@ -1806,6 +1811,7 @@ public function getCashDepositData()
->join('policies', 'client_policy.policy_id = policies.id', 'left')
->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();