CHANGE_create date_coverage filed value while dependent creation : GWM
This commit is contained in:
parent
4392468481
commit
32b64d236d
@ -309,6 +309,7 @@ class EmployeeRestController extends AdminController
|
|||||||
$data['client_policy_id']= $client_policy_id;
|
$data['client_policy_id']= $client_policy_id;
|
||||||
$data['basic_cover_si']= $basic_cover_si;
|
$data['basic_cover_si']= $basic_cover_si;
|
||||||
$data['status']= 'draft';
|
$data['status']= 'draft';
|
||||||
|
$data['date_coverage'] = $this->getEmployeeCoverageDate($emp_code, $client_policy_id);
|
||||||
|
|
||||||
$this->employeePolicyModel->insert($data);
|
$this->employeePolicyModel->insert($data);
|
||||||
|
|
||||||
@ -320,10 +321,7 @@ class EmployeeRestController extends AdminController
|
|||||||
public function updatePremiumAmount($client_policy_id , $emp_code , $client_branch_id)
|
public function updatePremiumAmount($client_policy_id , $emp_code , $client_branch_id)
|
||||||
{
|
{
|
||||||
$response = $this->calculatePremium($client_policy_id , $emp_code , null , $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]))
|
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){
|
public function RelationshipMap($value){
|
||||||
|
|
||||||
@ -432,7 +469,6 @@ class EmployeeRestController extends AdminController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the RelationShip list
|
|
||||||
public function createOrUpdateEmployeePolicySiAmount()
|
public function createOrUpdateEmployeePolicySiAmount()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -632,11 +668,6 @@ class EmployeeRestController extends AdminController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Upload the Employee Detail in DB by Sheet Data
|
// Upload the Employee Detail in DB by Sheet Data
|
||||||
public function employeeUpload()
|
public function employeeUpload()
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user