CHANGE _ adding branch_id : GWM
This commit is contained in:
parent
a173d50c8f
commit
127a12d235
@ -84,10 +84,12 @@ class EmployeeRestController extends AdminController
|
|||||||
try {
|
try {
|
||||||
$emp_code = $this->request->getGet('emp_code');
|
$emp_code = $this->request->getGet('emp_code');
|
||||||
$client_id = $this->request->getGet('client_id');
|
$client_id = $this->request->getGet('client_id');
|
||||||
|
$client_branch_id = $this->request->getGet('client_branch_id');
|
||||||
if ($emp_code) {
|
if ($emp_code) {
|
||||||
$relationship = 'self';
|
$relationship = 'self';
|
||||||
$employee = $this->employeeModel->where('emp_code', $emp_code)
|
$employee = $this->employeeModel->where('emp_code', $emp_code)
|
||||||
->where('client_id', $client_id)
|
->where('client_id', $client_id)
|
||||||
|
->where('client_branch_id', $client_branch_id)
|
||||||
->where('is_active', 1 )
|
->where('is_active', 1 )
|
||||||
->where('relationship', $relationship)
|
->where('relationship', $relationship)
|
||||||
->first();
|
->first();
|
||||||
@ -102,7 +104,7 @@ class EmployeeRestController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//not in use
|
||||||
public function editEmployeeProfile()
|
public function editEmployeeProfile()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -125,7 +127,7 @@ class EmployeeRestController extends AdminController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//not in use
|
||||||
public function getEmployeeAndDependence()
|
public function getEmployeeAndDependence()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -152,7 +154,7 @@ class EmployeeRestController extends AdminController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//not in use
|
||||||
public function editEmployeeAndDependence()
|
public function editEmployeeAndDependence()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -372,6 +374,7 @@ class EmployeeRestController extends AdminController
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteDependence()
|
public function deleteDependence()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -404,7 +407,7 @@ class EmployeeRestController extends AdminController
|
|||||||
public function getEmployeeAndDependenceByClientId()
|
public function getEmployeeAndDependenceByClientId()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$empData = $this->employeePolicyModel->getEmployeePolicy( client_id:$this->request->getGet('client_id'),policy_id: $this->request->getGet('client_policy_id'),status:0);
|
$empData = $this->employeePolicyModel->getEmployeePolicy( client_id:$this->request->getGet('client_id'),policy_id: $this->request->getGet('client_policy_id'),status:0,client_branch_id:$this->request->getGet('client_branch_id'));
|
||||||
|
|
||||||
if ($empData) {
|
if ($empData) {
|
||||||
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $empData], 200);
|
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $empData], 200);
|
||||||
@ -935,6 +938,7 @@ public function getEmployeePolicy()
|
|||||||
$id = $this->request->getGet('id');
|
$id = $this->request->getGet('id');
|
||||||
$emp_code = $this->request->getGet('emp_code');
|
$emp_code = $this->request->getGet('emp_code');
|
||||||
$client_id = $this->request->getGet('client_id');
|
$client_id = $this->request->getGet('client_id');
|
||||||
|
$client_branch_id = $this->request->getGet('client_branch_id');
|
||||||
|
|
||||||
// This is an array containing keys to be removed from the terms and conditions array
|
// This is an array containing keys to be removed from the terms and conditions array
|
||||||
$keysToRemove = ["removable_keys"];
|
$keysToRemove = ["removable_keys"];
|
||||||
@ -942,8 +946,11 @@ public function getEmployeePolicy()
|
|||||||
$empPolicy = $this->employeeModel->getEmployeePolicy($id);
|
$empPolicy = $this->employeeModel->getEmployeePolicy($id);
|
||||||
|
|
||||||
// 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',$emp_code)->where('client_id',$client_id)
|
$employeeData = $this->employeeModel->where('emp_code',$emp_code)
|
||||||
->where('is_active', 1 )->where('is_addon_value',0)->findAll();
|
->where('client_id',$client_id)
|
||||||
|
->where('client_branch_id',$client_branch_id)
|
||||||
|
->where('is_active', 1 )
|
||||||
|
->where('is_addon_value',0)->findAll();
|
||||||
|
|
||||||
|
|
||||||
if ($empPolicy) {
|
if ($empPolicy) {
|
||||||
@ -1091,12 +1098,13 @@ public function getEmployeePolicy()
|
|||||||
->where('client_policy.policy_type_id', 3 )
|
->where('client_policy.policy_type_id', 3 )
|
||||||
->where('client_policy.is_addon', 1 )
|
->where('client_policy.is_addon', 1 )
|
||||||
->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.is_active', 1 )
|
->where('client_policy.is_active', 1 )
|
||||||
->get()
|
->get()
|
||||||
->getResult();
|
->getResult();
|
||||||
if($checkGmcParentsPolicyExist)
|
if($checkGmcParentsPolicyExist)
|
||||||
{
|
{
|
||||||
$GmcParrentsData = $this->getGmcParrentsPolicy($checkGmcParentsPolicyExist,$emp_code,$client_id);
|
$GmcParrentsData = $this->getGmcParrentsPolicy($checkGmcParentsPolicyExist,$emp_code,$client_id,$client_branch_id);
|
||||||
return $this->respond(['status' => 'success','code' => 200,'data' => [$array,$GmcParrentsData]], 200);
|
return $this->respond(['status' => 'success','code' => 200,'data' => [$array,$GmcParrentsData]], 200);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1122,11 +1130,14 @@ public function getEmployeePolicy()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id)
|
public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id,$client_branch_id)
|
||||||
{
|
{
|
||||||
|
|
||||||
$employeeData = $this->employeeModel->where('emp_code',$emp_code)->where('client_id',$client_id)
|
$employeeData = $this->employeeModel->where('emp_code',$emp_code)
|
||||||
->where('is_active', 1 )->where('is_addon_value',0)->findAll();
|
->where('client_id',$client_id)
|
||||||
|
->where('client_branch_id',$client_branch_id)
|
||||||
|
->where('is_active', 1 )
|
||||||
|
->where('is_addon_value',0)->findAll();
|
||||||
foreach ($GmcParrentsPolicy as $key => $array) {
|
foreach ($GmcParrentsPolicy as $key => $array) {
|
||||||
|
|
||||||
|
|
||||||
@ -1163,9 +1174,7 @@ public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id)
|
|||||||
$array->eCardDownload = null;
|
$array->eCardDownload = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if($array->tpa_id != null){
|
|
||||||
// $array->eCardDownload = base_url('download-e-card/') . $array->rand_string;
|
|
||||||
// }else{ $array->eCardDownload = null; }
|
|
||||||
$array->eCardDownload = null;
|
$array->eCardDownload = null;
|
||||||
|
|
||||||
// Map family floaters that already exist in the employee table
|
// Map family floaters that already exist in the employee table
|
||||||
@ -1320,7 +1329,8 @@ public function getClientDetails()
|
|||||||
$client = $this->clientModel->where('id',$this->request->getGet('client_id'))->first();
|
$client = $this->clientModel->where('id',$this->request->getGet('client_id'))->first();
|
||||||
if($client) {
|
if($client) {
|
||||||
$client['client_logo'] = base_url().'public/uploads/logo/'.$client['client_logo'];
|
$client['client_logo'] = base_url().'public/uploads/logo/'.$client['client_logo'];
|
||||||
$clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id'))->findAll();
|
$clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id'))
|
||||||
|
->where('client_branch_id',$this->request->getGet('client_branch_id'))->findAll();
|
||||||
return $this->respond(['status' => 'success','code' => 200,'data' => ['client'=>$client,'client_policy'=>$clientPolicy]], 200);
|
return $this->respond(['status' => 'success','code' => 200,'data' => ['client'=>$client,'client_policy'=>$clientPolicy]], 200);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
@ -1335,17 +1345,22 @@ public function getAddOnPolicy()
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$addOnEmployeeData = $this->employeeModel->where('is_active', 1 )->where('emp_code',$this->request->getGet('emp_code'))->where('client_id',$this->request->getGet('client_id'))->where('is_addon_value',1)->findAll();
|
$addOnEmployeeData = $this->employeeModel->where('is_active', 1 )
|
||||||
|
->where('emp_code',$this->request->getGet('emp_code'))
|
||||||
|
->where('client_id',$this->request->getGet('client_id'))
|
||||||
|
->where('client_branch_id',$this->request->getGet('client_branch_id'))
|
||||||
|
->where('is_addon_value',1)->findAll();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id'))
|
$clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id'))
|
||||||
|
->where('client_branch_id',$this->request->getGet('client_branch_id'))
|
||||||
->where('policy_status', 1)
|
->where('policy_status', 1)
|
||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
if(count($clientPolicy))
|
if(count($clientPolicy))
|
||||||
{
|
{
|
||||||
$band = $addOnEmployeeData = $this->employeeModel->where('is_active', 1 )->where('emp_code',$this->request->getGet('emp_code'))->where('client_id',$this->request->getGet('client_id'))->where('family_floater_key','self')->get()->getRow()->band;
|
$band = $addOnEmployeeData = $this->employeeModel->where('is_active', 1 )->where('emp_code',$this->request->getGet('emp_code'))->where('client_id',$this->request->getGet('client_id'))->where('client_branch_id',$this->request->getGet('client_branch_id'))->where('family_floater_key','self')->get()->getRow()->band;
|
||||||
$PolicyData = [];
|
$PolicyData = [];
|
||||||
foreach ($clientPolicy as $key => $array) {
|
foreach ($clientPolicy as $key => $array) {
|
||||||
$responce = [];
|
$responce = [];
|
||||||
@ -1970,83 +1985,6 @@ public function removeEmpAndEmpPolicyData()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function getEmployeeOldPolicy()
|
|
||||||
{
|
|
||||||
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.* , policies.name as policy_name , policy_type.policy_type as policy_type')
|
|
||||||
->join('policies', 'client_policy.policy_id = policies.id', 'left')
|
|
||||||
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
|
|
||||||
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
|
||||||
->where('client_policy.is_active', 1 )
|
|
||||||
->where('client_policy.policy_status', 0)
|
|
||||||
->orderby('client_policy.id' , 'ASC')
|
|
||||||
->findAll();
|
|
||||||
|
|
||||||
// Retrieve employee and dependents data by passing the employee code
|
|
||||||
$employeeData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))
|
|
||||||
->where('client_id',$this->request->getGet('client_id'))
|
|
||||||
->where('is_active', 1 )->findAll();
|
|
||||||
$whereArrayForId = [];
|
|
||||||
foreach ( $employeeData as $key => $value) { array_push($whereArrayForId, $value['id']); }
|
|
||||||
|
|
||||||
if(count($ClientPolicyData) > 0 && count($employeeData) > 0)
|
|
||||||
{
|
|
||||||
$result = [];
|
|
||||||
foreach ($ClientPolicyData as $key => $ClientPolicyValue) {
|
|
||||||
|
|
||||||
$terms = json_decode($ClientPolicyValue['policy_terms']);
|
|
||||||
// dd($terms);
|
|
||||||
$data['client_id'] = $ClientPolicyValue['client_id'];
|
|
||||||
$data['client_policy_id'] = $ClientPolicyValue['id'];
|
|
||||||
$data['policy_name'] = $ClientPolicyValue['policy_name'];
|
|
||||||
$data['policy_type'] = $ClientPolicyValue['policy_type'];
|
|
||||||
$data['policy_type'] = $ClientPolicyValue['policy_type'];
|
|
||||||
$data['policy_start_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_start_date']);
|
|
||||||
$data['policy_end_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_end_date']);
|
|
||||||
|
|
||||||
if($ClientPolicyValue['policy_type_id'] == 1){ $data['heading'] = 'Group Personal Accident Coverage'; }else
|
|
||||||
if($ClientPolicyValue['policy_type_id'] == 2){ $data['heading'] = 'Group Medical Coverage'; }else
|
|
||||||
if($ClientPolicyValue['policy_type_id'] == 3){ $data['heading'] = 'Group Medical Coverage - Parents'; }else
|
|
||||||
if($ClientPolicyValue['policy_type_id'] == 4){ $data['heading'] = 'Group Medical Coverage - Top Up'; }else
|
|
||||||
if($ClientPolicyValue['policy_type_id'] == 5){ $data['heading'] = 'Group Medical Coverage - Parents (Top Up)'; }
|
|
||||||
|
|
||||||
if($ClientPolicyValue['policy_type_id'] == 1){ $data['floter_text_heading'] = 'Sum Insured'; }
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if($terms->family_floater == 1){ $data['floter_text_heading'] = 'Floter Sum Insured'; }else{ $data['floter_text_heading'] = 'Sum Insured'; }
|
|
||||||
}
|
|
||||||
|
|
||||||
$employee_policy = $this->employeePolicyModel->select('employees.*,employee_polices.employee_id , employee_polices.basic_cover_si , employee_polices.premium , employee_polices.gst , employee_polices.tpa_id , employee_polices.rand_string')
|
|
||||||
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
|
|
||||||
->whereIn('employee_polices.employee_id',$whereArrayForId)
|
|
||||||
->where('employee_polices.client_policy_id',$ClientPolicyValue['id'])
|
|
||||||
->where('employee_polices.is_active', 1 )->findAll();
|
|
||||||
$si_value = 0;
|
|
||||||
$si_premium_value = 0;
|
|
||||||
$si_gst_value = 0;
|
|
||||||
foreach ($employee_policy as $key => $value) {
|
|
||||||
if(isset($value['basic_cover_si'])){ $si_value = $value['basic_cover_si']; }
|
|
||||||
if(isset($value['premium'])){ $si_premium_value = $si_premium_value + $value['premium'];}
|
|
||||||
if(isset($value['gst'])){ $si_gst_value = $si_gst_value + $value['gst'];}
|
|
||||||
}
|
|
||||||
|
|
||||||
$data['si_value'] = $si_value;
|
|
||||||
$data['si_premium_value'] = ($ClientPolicyValue['policy_type_id'] == 1 || $ClientPolicyValue['policy_type_id'] == 2) ? 0 : $si_premium_value;
|
|
||||||
$data['si_gst_value'] = ($ClientPolicyValue['policy_type_id'] == 1 || $ClientPolicyValue['policy_type_id'] == 2) ? 0 : $si_gst_value;
|
|
||||||
|
|
||||||
$data['EmployeePolicy'] = $employee_policy;
|
|
||||||
array_push($result, $data);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result ], 200);
|
|
||||||
|
|
||||||
}else{
|
|
||||||
return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 200);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function getEmployeeActiveOrInactivePolicy()
|
function getEmployeeActiveOrInactivePolicy()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -2055,6 +1993,7 @@ function getEmployeeActiveOrInactivePolicy()
|
|||||||
->join('policies', 'client_policy.policy_id = policies.id', 'left')
|
->join('policies', 'client_policy.policy_id = policies.id', 'left')
|
||||||
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
|
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
|
||||||
->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.is_active', 1 )
|
->where('client_policy.is_active', 1 )
|
||||||
->where('client_policy.policy_status', $policy_status)
|
->where('client_policy.policy_status', $policy_status)
|
||||||
->orderby('client_policy.id' , 'ASC')
|
->orderby('client_policy.id' , 'ASC')
|
||||||
@ -2063,9 +2002,11 @@ function getEmployeeActiveOrInactivePolicy()
|
|||||||
// 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'))
|
||||||
|
->where('client_branch_id',$this->request->getGet('client_branch_id'))
|
||||||
->where('is_active', 1 )->findAll();
|
->where('is_active', 1 )->findAll();
|
||||||
$employeeName = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))
|
$employeeName = $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'))
|
||||||
|
->where('client_branch_id',$this->request->getGet('client_branch_id'))
|
||||||
->where('family_floater_key','self')->where('is_active', 1 )
|
->where('family_floater_key','self')->where('is_active', 1 )
|
||||||
->get()->getRow()->name;
|
->get()->getRow()->name;
|
||||||
$whereArrayForId = [];
|
$whereArrayForId = [];
|
||||||
|
|||||||
@ -101,7 +101,7 @@ class RestAuthenticationController extends AdminController
|
|||||||
$auth = HttpRequestHelper::getRequestInfo();
|
$auth = HttpRequestHelper::getRequestInfo();
|
||||||
if ($auth) {
|
if ($auth) {
|
||||||
$data = [
|
$data = [
|
||||||
'user_id' => $employeeData['id'],
|
'user_id' => $employeeData['id'],
|
||||||
'user_type' => 'employee',
|
'user_type' => 'employee',
|
||||||
'ip' => $auth['ip'],
|
'ip' => $auth['ip'],
|
||||||
'platform' => $auth['platform'],
|
'platform' => $auth['platform'],
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user