CHNAGE_IMPLEMENT_CLIENT_BRANCH_ID_IN_ALL_UPLOAD,FIX_ALLOWED_VALUES_FOR_GENDER
This commit is contained in:
parent
f286f2bb86
commit
d93dc8ecdc
@ -229,12 +229,13 @@ class EmployeeServiceController extends AdminController
|
||||
$result['error_data'][$row_key][$keys[$col_key]]['error'][] = $format_error['error'];
|
||||
}
|
||||
}
|
||||
|
||||
// Kint::dump($is_mandatory);
|
||||
//allowed values check
|
||||
if($is_mandatory === true && isset($allowed_values) && is_array($allowed_values))
|
||||
if(($is_mandatory === true && isset($allowed_values) && is_array($allowed_values)) || (is_array($is_mandatory) && (isset($allowed_values) && is_array($allowed_values))))
|
||||
{
|
||||
|
||||
if(!in_array(strtolower(trim($col)),$allowed_values))
|
||||
// print_r($allowed_values);
|
||||
// dd($col);
|
||||
if(!in_array((trim($col)),$allowed_values))
|
||||
{
|
||||
array_push($result['error_summary'],3);
|
||||
$result['error_data'][$row_key][$keys[$col_key]]['col_name'] = $column_dispaly_name; //push column name
|
||||
@ -263,9 +264,9 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}//col foreach
|
||||
// break;
|
||||
}//row foreach
|
||||
|
||||
if(isset($result['error_summary']) && count($result['error_summary']))
|
||||
{
|
||||
@ -349,6 +350,14 @@ class EmployeeServiceController extends AdminController
|
||||
$relationship = $this->general_relationships;
|
||||
|
||||
$employee_data_group_by_family = data_group_by_family($excel_data);
|
||||
|
||||
$is_self_available_in_policy_terms = false;
|
||||
if($policy_details['policy_type_id'] == 3) // GMC parents
|
||||
{
|
||||
$temp = $policy_terms['family_floaters'];
|
||||
$temp = is_array($temp) ? $temp : (is_object($temp) ? (array)$temp : []);
|
||||
$is_self_available_in_policy_terms = isset($temp['self']) ? true : false;
|
||||
}
|
||||
// dd($employee_data_group_by_family);
|
||||
foreach ($employee_data_group_by_family as $emp_id => $family)
|
||||
{
|
||||
@ -356,7 +365,7 @@ class EmployeeServiceController extends AdminController
|
||||
//if action is DA then get all familiy members,transfrom them into excel array, addd data source as db or excel
|
||||
if($file['action'] == 'dependent_addition')
|
||||
{
|
||||
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(emp_code: $emp_id,client_id: $file['client_id'],client_policy_id: $file ['policy_id'],emp_status: ['active'],policy_status:['active']);
|
||||
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(emp_code: $emp_id,client_id: $file['client_id'],client_policy_id: $file ['policy_id'],emp_status: ['active'],policy_status:['active'],client_branch_id:[ $file['client_branch_id'] ]);
|
||||
// dd(($existing_famility_details));
|
||||
//transsform familiy details from db columns to exxcel row with column indexs for checking remaining functionalitites
|
||||
$existing_famility_details = transform_db_data_to_excel($existing_famility_details,$file);
|
||||
@ -370,7 +379,7 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
if($file['action'] == 'inception' || $file['action'] == 'addition' || $file['action'] == 'dependent_addition')
|
||||
{
|
||||
$res = name_dup_check_within_family($family,$file['action']);
|
||||
$res = name_dup_check_within_family($family,$file['action']);//in both file data & DB data
|
||||
// dd($res);
|
||||
if(count($res))
|
||||
{
|
||||
@ -383,7 +392,7 @@ class EmployeeServiceController extends AdminController
|
||||
}
|
||||
|
||||
//check self availbale in uploaded file
|
||||
if(($file['action'] == 'inception' || $file['action'] == 'addition') && ($policy_details['policy_type_id'] == 3 && $policy_details['base_policy'] == null)) // 3 is GMC parents dep addon)
|
||||
if(($file['action'] == 'inception' || $file['action'] == 'addition') && ($policy_details['policy_type_id'] == 3 && $is_self_available_in_policy_terms)) // 3 is GMC parents dep addon)
|
||||
{
|
||||
// dd('file check');
|
||||
$res = check_self_available_in_family($family,$file['action']);
|
||||
@ -395,10 +404,10 @@ class EmployeeServiceController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
//check self avaialbe where self data is not available either same policy (i.e.) gMC parents
|
||||
if($file['action'] == 'dependent_addition' || ($policy_details['policy_type_id'] == 3 && $policy_details['base_policy'] == null)) // 3 is GMC parents as base policy not as dep addon)
|
||||
//check self avaialbe either same policy DB level(i.e.) gMC parents
|
||||
if($file['action'] == 'dependent_addition' || ($policy_details['policy_type_id'] == 3 && !$is_self_available_in_policy_terms)) // 3 is GMC parents as base policy not as dep addon)
|
||||
{
|
||||
$self_details = $this->employeeModel->getEmpFamilybyEmpCode(emp_code: $emp_id,client_id: $file['client_id'],emp_status: ['active'],policy_status:['active']);
|
||||
$self_details = $this->employeeModel->getEmpFamilybyEmpCode(emp_code: $emp_id,client_id: $file['client_id'],emp_status: ['active'],policy_status:['active'],client_branch_id:[ $file['client_branch_id'] ]);
|
||||
// dd($self_details);
|
||||
if(!count($self_details))
|
||||
{
|
||||
@ -559,7 +568,7 @@ class EmployeeServiceController extends AdminController
|
||||
//if action is DA then get all familiy members,transfrom them into excel array, addd data source as db or excel
|
||||
if($file['action'] == 'dependent_addition')
|
||||
{
|
||||
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(emp_code: $emp_id,client_id: $file['client_id'],client_policy_id: $file ['policy_id'],emp_status: ['active'],policy_status:['active']);
|
||||
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(emp_code: $emp_id,client_id: $file['client_id'],client_policy_id: $file ['policy_id'],emp_status: ['active'],policy_status:['active'],client_branch_id: [ $file['client_branch_id'] ]);
|
||||
// dd($existing_famility_details);
|
||||
//transsform familiy details from db columns to exxcel row with column indexs for checking remaining functionalitites
|
||||
$existing_famility_details = transform_db_data_to_excel($existing_famility_details,$file);
|
||||
@ -669,7 +678,7 @@ class EmployeeServiceController extends AdminController
|
||||
break;
|
||||
}
|
||||
// echo '<br>START- ' . $row[2];
|
||||
$employee = $this->employeeModel->where('emp_code', $row[1])->where('name',$row[2])->where('client_id',$file['client_id'])->first();
|
||||
$employee = $this->employeeModel->where('emp_code', $row[1])->where('name',$row[2])->where('client_id',$file['client_id'])->where('client_branch_id',$file['client_branch_id'])->first();
|
||||
|
||||
$existing_endorsements = $this->empEndorsementModel->where('actions','d')
|
||||
->where('table_name','employees')
|
||||
@ -759,7 +768,7 @@ class EmployeeServiceController extends AdminController
|
||||
$field_value = ($field_name == 'dob' ? change_date_format($row[4],'d-M-Y','Y-m-d') : $row[4] );
|
||||
|
||||
|
||||
$employee = $this->employeeModel->where('emp_code', $row[1])->where('name',$row[2])->where('client_id',$file['client_id'])->first();
|
||||
$employee = $this->employeeModel->where('emp_code', $row[1])->where('name',$row[2])->where('client_id',$file['client_id'])->where('client_branch_id',$file['client_branch_id'])->first();
|
||||
$existing_endorsements = $this->empEndorsementModel->where('actions','c')
|
||||
->where('table_name','employees')
|
||||
->where('endorsement_id is null')
|
||||
@ -819,7 +828,7 @@ class EmployeeServiceController extends AdminController
|
||||
break;
|
||||
}
|
||||
// echo '<br>START- ' . $row[2];
|
||||
$employee = $this->employeeModel->where('emp_code', $row[1])->where('name',$row[2])->where('client_id',$file['client_id'])->first();
|
||||
$employee = $this->employeeModel->where('emp_code', $row[1])->where('name',$row[2])->where('client_id',$file['client_id'])->where('client_branch_id',$file['client_branch_id']->first();
|
||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$employee['id'])->where('client_policy_id',$file['policy_id'])->first();
|
||||
|
||||
$existing_endorsements = $this->empEndorsementModel->where('actions','si')
|
||||
@ -870,7 +879,7 @@ class EmployeeServiceController extends AdminController
|
||||
if($file['id'] == null || $value['temp']['source'] == 'excel' || (($file['action'] == 'dependent_addition' && in_array($value['temp']['source'],[10,11]) && ($slab_details['slab_rates'][0]['premium_type'] == 1 && strtolower($value['relationship']) == 'self') || ($slab_details['slab_rates'][0]['premium_type'] == 1 || $slab_details['slab_rates'][0]['premium_type'] == null)))) //insert data come from excel and from db i.e. ( $file['id'] == null for enrollment data)
|
||||
{
|
||||
|
||||
$employee = $this->employeeModel->checkExistingEmp($value);
|
||||
$employee = $this->employeeModel->checkExistingEmp($value,$file['client_branch_id']);
|
||||
$policy_data = $value['policy_details'];
|
||||
$temp = $value['temp'];
|
||||
unset($value['policy_details']);
|
||||
@ -895,6 +904,7 @@ class EmployeeServiceController extends AdminController
|
||||
$value['updated_by'] = $file['created_by'];
|
||||
$value['id'] = $employee[0]['id'];
|
||||
$value['emp_status'] = 'active';
|
||||
$value['client_branch_id'] = $file['client_branch_id'];
|
||||
$log_message = 'Update Employee - '.$employee[0]['name'].'('.$employee[0]['emp_code'].') with PK '.$employee[0]['id'];
|
||||
// $this->myLogger->logme('error',('Update - ' . $employee[0]['id'].' - '. $employee[0]['emp_code'] .' - '.$employee[0]['name']));
|
||||
}
|
||||
@ -902,6 +912,7 @@ class EmployeeServiceController extends AdminController
|
||||
{
|
||||
$value['emp_status'] = 'active';
|
||||
$value['created_by'] = $file['created_by'];
|
||||
$value['client_branch_id'] = $file['client_branch_id'];
|
||||
$log_message = 'Insert Employee- '.$value['name'] .'('.$value['emp_code'] .') with PK ';
|
||||
// $this->myLogger->logme('error',('Insert - ' . $value['emp_code'] .' - '. $value['name']));
|
||||
}
|
||||
@ -946,7 +957,7 @@ class EmployeeServiceController extends AdminController
|
||||
// $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)
|
||||
{
|
||||
$employee = $this->employeeModel->where('emp_code', $employee['emp_code'])->where('name',$employee['name'])->where('client_id',$employee['client_id'])->where('is_active',1)->first();
|
||||
$employee = $this->employeeModel->where('emp_code', $employee['emp_code'])->where('name',$employee['name'])->where('client_id',$employee['client_id'])->where('client_branch_id',$file['client_id'])->where('is_active',1)->first();
|
||||
|
||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$employee['id'])->where('client_policy_id',$file['policy_id'])->first();
|
||||
// dd($employee_policy);
|
||||
|
||||
@ -77,7 +77,7 @@ class EmployeeModel extends Model
|
||||
|
||||
|
||||
// for emp onboard process do not change
|
||||
public function checkExistingEmp($arr)
|
||||
public function checkExistingEmp($arr,$client_branch_id)
|
||||
{
|
||||
|
||||
if($arr['temp']['emp_id'] == null)
|
||||
@ -85,9 +85,12 @@ class EmployeeModel extends Model
|
||||
return $this->where('emp_code',$arr['emp_code'])
|
||||
->where('name',$arr['name'])
|
||||
->where('client_id',$arr['client_id'])
|
||||
->where('client_branch_id',$client_branch_id)
|
||||
->where('is_active',1)
|
||||
->where('gender',$arr['gender'])
|
||||
->where('dob',$arr['dob'])
|
||||
->where('is_active',1)
|
||||
->where('emp_status','active')
|
||||
->find();
|
||||
}
|
||||
else
|
||||
@ -97,9 +100,9 @@ class EmployeeModel extends Model
|
||||
}
|
||||
|
||||
|
||||
public function getEmpFamilybyEmpCode(string $client_policy_id = null,string $emp_code = null,string $client_id = null,array $emp_status = [],array $policy_status = [],array $relationship = [])
|
||||
public function getEmpFamilybyEmpCode(string $client_policy_id = null,string $emp_code = null,string $client_id = null,array $emp_status = [],array $policy_status = [],array $relationship = [],array $client_branch_id = [])
|
||||
{
|
||||
$result = $this->select(['employees.id as emp_id', 'employees.client_id', 'employees.relationship', 'employees.relationship_code', 'employees.change_event', 'employees.emp_code', 'employees.name', 'employees.email_personal', 'employees.email_corporate', 'employees.mobile', 'employees.gender', 'employees.dob', 'employees.doj', 'employees.basic_pay', 'employees.band', 'employees.designation', 'employees.emp_status','employee_polices.id as emp_policy_id', 'employee_polices.employee_id', 'employee_polices.client_policy_id', 'employee_polices.tpa_id', 'employee_polices.uhid', 'employee_polices.batch_code', 'employee_polices.status', 'employee_polices.pre_existing_alignments', 'employee_polices.basic_cover_si', 'employee_polices.date_coverage', 'employee_polices.policy_end_date', 'employee_polices.days', 'employee_polices.premium', 'employee_polices.rata_premimum', 'employee_polices.gst', 'employee_polices.date_of_exit', 'employee_polices.reason_for_exit','policies.name as policy_name','client_policy.is_addon'])
|
||||
$result = $this->select(['employees.id as emp_id', 'employees.client_id','employees.client_branch_id', 'employees.relationship', 'employees.relationship_code', 'employees.change_event', 'employees.emp_code', 'employees.name', 'employees.email_personal', 'employees.email_corporate', 'employees.mobile', 'employees.gender', 'employees.dob', 'employees.doj', 'employees.basic_pay', 'employees.band', 'employees.designation', 'employees.emp_status','employee_polices.id as emp_policy_id', 'employee_polices.employee_id', 'employee_polices.client_policy_id', 'employee_polices.tpa_id', 'employee_polices.uhid', 'employee_polices.batch_code', 'employee_polices.status', 'employee_polices.pre_existing_alignments', 'employee_polices.basic_cover_si', 'employee_polices.date_coverage', 'employee_polices.policy_end_date', 'employee_polices.days', 'employee_polices.premium', 'employee_polices.rata_premimum', 'employee_polices.gst', 'employee_polices.date_of_exit', 'employee_polices.reason_for_exit','policies.name as policy_name','client_policy.is_addon'])
|
||||
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
||||
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
|
||||
->join('policies', 'policies.id = client_policy.policy_id')
|
||||
@ -117,6 +120,9 @@ class EmployeeModel extends Model
|
||||
})
|
||||
->when(count($emp_status), function($query) use ($emp_status){
|
||||
return $query->whereIn('employees.emp_status', $emp_status);
|
||||
})
|
||||
->when(count($client_branch_id), function($query) use ($client_branch_id){
|
||||
return $query->whereIn('employees.client_branch_id', $client_branch_id);
|
||||
})
|
||||
->when(count($relationship), function($query) use ($relationship){
|
||||
return $query->whereIn('employees.relationship', $relationship);
|
||||
|
||||
@ -38,7 +38,7 @@ option:disabled {
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label>Branch</label> <br />
|
||||
<select name="branch_id" class="form-control" id="branch_id" onchange="checkPolicyTermsAndRackRatesHasDefiend(event)">
|
||||
<select name="branch_id" class="form-control" id="branch_id">
|
||||
<option value="0">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
@ -888,6 +888,8 @@ function checkPolicyTermsAndRackRatesHasDefiend(event)
|
||||
// console.log(event.target.id);
|
||||
var policy_id = (event.target.value);
|
||||
// console.log('checkPolicyTermsAndRackRatesHasDefiend called ' + policy_id);
|
||||
if(policy_id != 0 && policy_id != " " && policy_id != undefined)
|
||||
{
|
||||
var apiURL = '<?php echo base_url();?>' + 'util/has_policy_config_completed/' + policy_id;
|
||||
// console.log(apiURL);
|
||||
|
||||
@ -938,6 +940,7 @@ function checkPolicyTermsAndRackRatesHasDefiend(event)
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user