CHANGE_DATE_DAYS_ISSUE&ADDTION_ENDORSEMENT

This commit is contained in:
velz 2024-06-03 13:56:47 +05:30
parent d238102462
commit 00dd88a6eb
3 changed files with 27 additions and 4 deletions

View File

@ -1372,7 +1372,7 @@ public function getAddOnPolicy()
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('client_branch_id',$this->request->getGet('client_branch_id'))->where('family_floater_key','self')->get()->getRow()->band;
$band = $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 = [];
foreach ($clientPolicy as $key => $array) {
$responce = [];

View File

@ -956,7 +956,19 @@ class EmployeeServiceController extends AdminController
$this->employeePolicyModel->save($policy_data);
$emp_policy_id = $this->employeePolicyModel->getInsertID();
if($emp_policy_id != 0){ $log_message .= ' with PK ' . $emp_policy_id; }
if($emp_policy_id != 0)//emp policy inserted
{
$log_message .= ' with PK ' . $emp_policy_id;
//make endorsement entry if action is addition OR Dependt addition
if(($file['action'] == 'dependent_addition' || $file['action'] == 'addition') && $value['temp']['source'] == 'excel')
{
$actions = ($file['action'] == 'dependent_addition' ? 'da' : ($file['action'] == 'addition' ? 'a' : NULL));
$addition_endorse_data = ['pk' => $emp_policy_id,'group_key' => rand(100000, 999999),'emp_cdoe' => $value['emp_code'],'table_name' => 'employee_polices','actions' => $actions,'field_name' => 'basic_cover_si','old_value' => NULL,'new_value' => $policy_data['basic_cover_si'],'remarks' => 'addition endorsement','file_id' => $file['id'],'created_by' => $file['created_by']];
$this->employeeEndorsementforAddtionAndDependentAddition($addition_endorse_data);
}
}
else{ $emp_policy_id = $employee_policy[0]['id']; }
$this->myLogger->logme('error',$log_message);
@ -965,6 +977,12 @@ class EmployeeServiceController extends AdminController
}// for end
}//function end
public function employeeEndorsementforAddtionAndDependentAddition($employee)
{
$this->empEndorsementModel->save($employee);
}
// $employee -> holds existing emp model obj and $policy_data holds new policy changes as array
public function employeesSIEnhanceProcessWhileOnbboard(array $employee,array $policy_data,array $file)
{

View File

@ -7,14 +7,19 @@ use Kint\Kint;
if(!function_exists('calculate_days_bw_dates'))
{
function calculate_days_bw_dates(string $from_date = "", string $to_date ="")
function calculate_days_bw_dates(string $from_date = "", string $to_date ="",bool $include_start_date = true)
{
if($to_date == ""){ $currentDateTime = new DateTime(); }
else{ $currentDateTime = new DateTime($to_date); }
if($from_date == ""){ $passedDateTime = new DateTime(); }
else{ $passedDateTime = new DateTime($from_date); }
return $interval = $currentDateTime->diff($passedDateTime);
$interval = $currentDateTime->diff($passedDateTime);
if ($include_start_date) {
$interval->days += 1;
}
return $interval;
}
}