FIX_DELETION_RELATED_ISSUE : RV
This commit is contained in:
parent
c240840b38
commit
a00a0b25d8
@ -1816,7 +1816,6 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
|
||||
//Endorsement Correction
|
||||
|
||||
public function importCorrectionValidation($params)
|
||||
{
|
||||
|
||||
@ -2232,7 +2231,6 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
|
||||
//Endorsement SIEnhancement
|
||||
|
||||
public function importSIEnhancementValidation($params)
|
||||
{
|
||||
$file_id = $params['file_id'];
|
||||
@ -2844,12 +2842,14 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
|
||||
//Endorsement Deletion
|
||||
|
||||
public function importDeletionValidation($params)
|
||||
{
|
||||
{
|
||||
|
||||
$file_id = $params['file_id'];
|
||||
$file = $this->batchFileModel->where('id', $file_id)->first();
|
||||
|
||||
// dd($file);
|
||||
|
||||
$client_id = $file['client_id'];
|
||||
$client_policy_id = $file['client_policy_id'];
|
||||
$client_branch_id = $file['client_branch_id'];
|
||||
@ -2954,6 +2954,7 @@ class EmpDataServiceController extends BaseController
|
||||
$query = $db->query($sql);
|
||||
$endorsement_data = $query->getResultArray();
|
||||
|
||||
// dd($endorsement_data);
|
||||
|
||||
if ($endorsement_data == null || empty($endorsement_data)) {
|
||||
|
||||
@ -3255,7 +3256,7 @@ class EmpDataServiceController extends BaseController
|
||||
$file_name_with_path = WRITEPATH . "/uploads/import_excel/" . $file['file_name'];
|
||||
$excel_data = $this->readExcelFileToArray($file_name_with_path);
|
||||
unset($excel_data[0]);
|
||||
array_pop($excel_data);
|
||||
// array_pop($excel_data);
|
||||
|
||||
$emp_count = count($excel_data); //excel file count
|
||||
|
||||
@ -3279,6 +3280,7 @@ class EmpDataServiceController extends BaseController
|
||||
$fetch_data = [
|
||||
'client_policy_id' => $client_policy_id,
|
||||
'client_branch_id' => $client_branch_id,
|
||||
'client_id' => $client_id,
|
||||
'emp_name' => $emp_name,
|
||||
'emp_code' => $emp_code
|
||||
];
|
||||
@ -3289,8 +3291,8 @@ class EmpDataServiceController extends BaseController
|
||||
if (isset($result['emp_endorsement_primarykey']) && $result['emp_endorsement_primarykey'] !== null) {
|
||||
|
||||
$employee_policy_table_primaryKey[] = $result['emp_policy_primarykey']; //for cash deposite
|
||||
$employee_policy_table_data[] = array('id' => $result['emp_policy_primarykey'], 'date_of_exit' => $result['date_of_exit'], 'reason_for_exit' => $result['reason_for_exit'], 'status' => $result['status'], 'is_active' => 0);
|
||||
$employees_table_data[] = array('id' => $result['employees_primarykey'], 'emp_status' => $result['status'], 'is_active' => 0);
|
||||
$employee_policy_table_data[] = array('id' => $result['emp_policy_primarykey'], 'date_of_exit' => $result['date_of_exit'], 'reason_for_exit' => $result['reason_for_exit'], 'status' => $result['status']);
|
||||
$employees_table_data[] = array('id' => $result['employees_id'], 'emp_status' => $result['status']);
|
||||
$emp_endorsement_table_data[] = array('id' => $result['emp_endorsement_primarykey'], 'group_key' => $result['group_key'], 'endorsement_id' => $value[15], 'status' => 'complete');
|
||||
}
|
||||
|
||||
@ -3843,7 +3845,7 @@ class EmpDataServiceController extends BaseController
|
||||
FROM employee_polices
|
||||
JOIN employees ON employees.id = employee_polices.employee_id
|
||||
WHERE employees.unit = '$unit'
|
||||
AND id IN (" . implode(',', $arrayData['employeeIds']) . ")
|
||||
AND employee_polices.id IN (" . implode(',', $arrayData['employeeIds']) . ")
|
||||
")->getRow();
|
||||
|
||||
if($amount){
|
||||
@ -3903,7 +3905,7 @@ class EmpDataServiceController extends BaseController
|
||||
FROM employee_polices
|
||||
JOIN employees ON employees.id = employee_polices.employee_id
|
||||
WHERE employees.unit = '$unit'
|
||||
AND id IN (" . implode(',', $arrayData['employeeIds']) . ")
|
||||
AND employee_polices.id IN (" . implode(',', $arrayData['employeeIds']) . ")
|
||||
")->getRow();
|
||||
|
||||
if($amount){
|
||||
|
||||
@ -98,6 +98,7 @@ class EmployeeController extends AdminController
|
||||
emp_name : $filterData['emp_name'],
|
||||
status : $filterData['status'],
|
||||
);
|
||||
// dd($this->employeePolicyModel->getLastQuery());
|
||||
|
||||
$data['getData'] = $filterData;
|
||||
}
|
||||
@ -162,7 +163,7 @@ class EmployeeController extends AdminController
|
||||
// dd($res);
|
||||
|
||||
// $empServiceController = new EmployeeServiceController();
|
||||
// $res = $empServiceController->excelFileDataValidation(['file_id' => '38']);
|
||||
// $res = $empServiceController->employeeDisembark(['file_id' => '586']);
|
||||
// dd($res);
|
||||
// $existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(client_policy_id: '2');
|
||||
// dd($existing_famility_details);
|
||||
@ -1163,21 +1164,8 @@ class EmployeeController extends AdminController
|
||||
|
||||
// $this->loadLayout('ecard_template/default_ecard');
|
||||
|
||||
$data = [
|
||||
'employeeIds' => [6,8,10],
|
||||
'client_id' => 12,
|
||||
'client_policy_id' => 12,
|
||||
'client_branch_id' => 1,
|
||||
'cd_ac_no' => '34567834567892',
|
||||
'endorsement_no' => null,
|
||||
'count' => 3,
|
||||
'event_name' =>'inception',
|
||||
'policy_name' => 'new policy',
|
||||
'user_id' => 1,
|
||||
];
|
||||
|
||||
$empDataServiceController = new EmpDataServiceController();
|
||||
$empData= $empDataServiceController->cashDepositCalculationForInception($data);
|
||||
$empDataServiceController = new EmpDataServiceController();
|
||||
$return = $empDataServiceController->importDeletionValidation(['file_id' => 130]);
|
||||
|
||||
}
|
||||
|
||||
@ -1557,13 +1545,14 @@ class EmployeeController extends AdminController
|
||||
}
|
||||
|
||||
// print_r($family_details);
|
||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => $family_details], 200);
|
||||
//get policy details
|
||||
$policy_details = $this->clientPolicyModel->getPolicyDetails($file['client_id'],$file['policy_id']);
|
||||
//get rack rates
|
||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($file['policy_id'],$file['client_id']);
|
||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => $family_details], 200);
|
||||
//get file array or construnct dummy file array here
|
||||
$file = ['id' => null,'client_id' => 10,'policy_id' => 10,'action' => 'inception','client_branch_id' => 1,'created_by' => 1];
|
||||
//get policy details
|
||||
$policy_details = $this->clientPolicyModel->getPolicyDetails($file['client_id'],$file['policy_id']);
|
||||
//get rack rates
|
||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($file['policy_id'],$file['client_id']);
|
||||
|
||||
//get familiy details in inception file format array from post method
|
||||
$family_details = [
|
||||
[2,'TEST001','John Doe', '01-Jan-1988', 'M', 'Self', '5000000', NULL, '', '', 'G', '', '', '', '', '', '',''],
|
||||
@ -1576,7 +1565,7 @@ class EmployeeController extends AdminController
|
||||
[7,'TEST001','Alice Doe', '01-Jan-1990', 'F', 'Daughter', 5000000, '01-Jan-2024', '01-Jan-2024', 40000, 'B', 'Supervisor', '9876543210', '', '', '', '',''],
|
||||
[6,'TEST001','Bob Doe', '01-Jan-1993', 'M', 'son', '50000', NULL, '', '', '', '', '', '', '', '', '',''],
|
||||
];
|
||||
$data = calculate_premimum_new($family_details,$policy_details,$all_rack_rates,$file);
|
||||
// $data = calculate_premimum_new($family_details,$policy_details,$all_rack_rates,$file);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -906,8 +906,8 @@ class EmployeeServiceController extends AdminController
|
||||
}
|
||||
|
||||
//proceed next data level validation in JOB queue
|
||||
// $job_details = new Jobs();
|
||||
// $r = Jobs::addJob(['job_name' => 'excelFileDataValidation','payload' => ['file_id' => $file_id]]);
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'excelFileDataValidation','payload' => ['file_id' => $file_id]]);
|
||||
// $jobWorker = new JobWorker();
|
||||
// JobWorker::processJob($r);
|
||||
|
||||
@ -1024,7 +1024,7 @@ class EmployeeServiceController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
if(($policy_details['base_policy'] == null || $policy_details['base_policy'] == 0 && ($file['action'] == 'inception' || $file['action'] == 'missed_inception' || $file['action'] == 'addition' || $file['action'] == 'enrollment')) || ($policy_details['policy_type_id'] == 3 && $is_self_available_in_policy_terms)) // 3 is GMC parents dep addon)
|
||||
if(($file['action'] == 'inception' || $file['action'] == 'missed_inception' || $file['action'] == 'addition' || $file['action'] == 'enrollment') || ($policy_details['policy_type_id'] == 3 && $is_self_available_in_policy_terms) && ($policy_details['base_policy'] == null || $policy_details['base_policy'] == 0)) // 3 is GMC parents dep addon)
|
||||
{
|
||||
$res = check_self_available_in_family($family,$file['action']);
|
||||
if(!$res['is_self_found'])
|
||||
@ -1248,12 +1248,11 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(client_id: $client_id,client_policy_id: $client_policy_id,emp_status: ['enrolled','draft'],policy_status:['enrolled','draft']);
|
||||
|
||||
//get existing units in the current branch
|
||||
$existing_units = $this->clientBranchModel->getExisitingUnits(client_id: $file['client_id'],client_branch_id: $file['client_branch_id']);
|
||||
|
||||
|
||||
// $file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception'];
|
||||
$file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception','created_by' => get_session_userid(),'client_branch_id' => $params['client_branch_id']];
|
||||
|
||||
//get existing units in the current branch
|
||||
$existing_units = $this->clientBranchModel->getExisitingUnits(client_id: $file['client_id'],client_branch_id: $file['client_branch_id']);
|
||||
// dd($this->employeeModel->getLastQuery());
|
||||
// Kint::dump($existing_famility_details);die();
|
||||
$employee_data_group_by_family = data_group_by_family($existing_famility_details,$data_source = 'db');
|
||||
@ -1500,14 +1499,14 @@ class EmployeeServiceController extends AdminController
|
||||
//get applicable slab rate for current member relation
|
||||
$pre_rack_rate_name = '';
|
||||
$applicable_rack_rate_name = '';
|
||||
$applicable_rack_rate_master = '';
|
||||
$applicable_rack_rate_master = [];
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
{
|
||||
if($pre_rack_rate_name != $slab_value['rack_rate_name'])
|
||||
{
|
||||
$pre_rack_rate_name = $slab_value['rack_rate_name'];
|
||||
$rack_rate_json = json_decode($slab_value['additional_relationship']);
|
||||
if(in_array(strtolower($employee['relationship']), $rack_rate_json) && $rack_rate_json[ strtolower($employee['relationship']) ] != 0 && $rack_rate_json[ strtolower($employee['relationship']) ] != NA)
|
||||
if(in_array(strtolower($employee['relationship']), $rack_rate_json) && $rack_rate_json[ strtolower($employee['relationship']) ] != 0 && $rack_rate_json[ strtolower($employee['relationship']) ] != 'NA')
|
||||
{
|
||||
$applicable_rack_rate_name = $slab_value['rack_rate_name'];
|
||||
$applicable_rack_rate_master = $slab_value['grid_master'];
|
||||
|
||||
@ -227,11 +227,14 @@ if(!function_exists('check_si'))
|
||||
{
|
||||
function check_si($row,$policy_details,$slab_details)
|
||||
{
|
||||
// Kint::dump($policy_details);
|
||||
$policy_details = (array)$policy_details[0];
|
||||
// dd($policy_details);
|
||||
$return_array = array('status' => true,'error' => '');
|
||||
$is_si_found = false;
|
||||
$is_age_slab_found = false;
|
||||
|
||||
if($policy_details[0]['policy_type_id'] == 1 && $slab_details[0]['policy_grid_id'] == 1 && $slab_details[0]['si_or_bp'] == 2) // GPA && grid type 1 for GPA && sub type is basic pay
|
||||
if($policy_details['policy_type_id'] == 1 && $slab_details[0]['policy_grid_id'] == 1 && $slab_details[0]['si_or_bp'] == 2) // GPA && grid type 1 for GPA && sub type is basic pay
|
||||
{
|
||||
$is_si_found = true;
|
||||
$is_age_slab_found = true;
|
||||
@ -1986,13 +1989,14 @@ if(!function_exists('check_unit'))
|
||||
{
|
||||
function check_unit($row,$existing_units)
|
||||
{
|
||||
|
||||
$temp = $row[18];
|
||||
$temp = empty($row[18]) ? $row[18] : trim($row[18]);
|
||||
|
||||
if(in_array($row['current_action'], ['I','A','MI']) )
|
||||
{
|
||||
if(count($existing_units) == 1)
|
||||
{
|
||||
if(empty(trim($row[18])))
|
||||
if(empty($temp))
|
||||
{
|
||||
return array('status' => true);
|
||||
}
|
||||
@ -2000,11 +2004,11 @@ if(!function_exists('check_unit'))
|
||||
|
||||
if(strtolower($row[5]) == 'self')
|
||||
{
|
||||
if(in_array(trim($row[18]),$existing_units)) //18 is unit name
|
||||
if(in_array($temp,$existing_units)) //18 is unit name
|
||||
{
|
||||
return array('status' => true);
|
||||
}
|
||||
else if(!empty(trim($row[18])))
|
||||
else if(!empty($temp))
|
||||
{
|
||||
return array('status' => false,'error' => 'wrong unit name');
|
||||
}
|
||||
@ -2015,13 +2019,13 @@ if(!function_exists('check_unit'))
|
||||
}
|
||||
else
|
||||
{
|
||||
if(empty(trim($row[18])))
|
||||
if(empty($temp))
|
||||
{
|
||||
return array('status' => true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(in_array(trim($row[18]),$existing_units)) //18 is unit name
|
||||
if(in_array($temp,$existing_units)) //18 is unit name
|
||||
{
|
||||
return array('status' => true);
|
||||
}
|
||||
|
||||
@ -109,7 +109,7 @@ class EmployeeModel extends Model
|
||||
$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','employees.unit','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')
|
||||
->join('policies', 'policies.id = client_policy.policy_id','left')
|
||||
->where('employees.is_active',1)
|
||||
->when($client_policy_id, function($query) use ($client_policy_id){
|
||||
return $query->where('employee_polices.client_policy_id',$client_policy_id);
|
||||
|
||||
@ -81,7 +81,7 @@ class EmployeePolicyModel extends Model
|
||||
|
||||
$result = $this->select([
|
||||
'employee_polices.*',
|
||||
'pm.name as policy_name',
|
||||
'policy_type.policy_type as policy_name',
|
||||
'im.short_name as insurer_short_name',
|
||||
'ib.branch_name as insurer_branch_name',
|
||||
'ib.branch_code as insurer_branch_code',
|
||||
@ -109,8 +109,8 @@ class EmployeePolicyModel extends Model
|
||||
])
|
||||
->join('employees emp', 'employee_polices.employee_id = emp.id')
|
||||
->join('client_policy cp', 'employee_polices.client_policy_id = cp.id') //cp - client policy
|
||||
->join('policies pm', 'cp.policy_id = pm.id') //pm - policy master
|
||||
->join('policy_type', 'policy_type.id = pm.policy_type_id')
|
||||
->join('policies pm', 'cp.policy_id = pm.id', 'left') //pm - policy master
|
||||
->join('policy_type', 'policy_type.id = cp.policy_type_id')
|
||||
->join('insurers im', 'cp.insurer_id = im.id') //im - insurer master
|
||||
->join('insurer_branch ib', 'cp.insurer_branch_id = ib.id') //ib - insurer branch
|
||||
->join('tpa tpam', 'cp.tpa_id = tpam.id', 'left') //tpam - tpa master
|
||||
@ -511,6 +511,7 @@ class EmployeePolicyModel extends Model
|
||||
employees.relationship_code AS emp_relationship_code,
|
||||
employees.emp_type as emp_type,
|
||||
'D' as event_type_data,
|
||||
TIMESTAMPDIFF(YEAR, employees.dob, CURDATE()) AS emp_age,
|
||||
|
||||
employees.doj AS emp_doj,
|
||||
employees.mobile AS emp_mobile,
|
||||
@ -604,6 +605,7 @@ class EmployeePolicyModel extends Model
|
||||
|
||||
$client_policy_id = $fetch_data['client_policy_id'];
|
||||
$client_branch_id = $fetch_data['client_branch_id'];
|
||||
$client_id = $fetch_data['client_id'];
|
||||
$emp_name = $fetch_data['emp_name'];
|
||||
$emp_code = $fetch_data['emp_code'];
|
||||
|
||||
@ -614,6 +616,18 @@ class EmployeePolicyModel extends Model
|
||||
ep.id as emp_policy_primarykey,
|
||||
e.id as employees_primarykey,
|
||||
ee.group_key,
|
||||
(
|
||||
SELECT employees.id
|
||||
FROM employees
|
||||
WHERE client_id = '$client_id'
|
||||
AND client_branch_id = '$client_branch_id'
|
||||
AND is_active = 1
|
||||
AND emp_status = 'active'
|
||||
AND emp_code = '$emp_code'
|
||||
AND name = '$emp_name'
|
||||
LIMIT 1
|
||||
) AS employees_id,
|
||||
|
||||
MAX(
|
||||
CASE
|
||||
WHEN ee.field_name = 'date_of_exit' THEN ee.new_value
|
||||
|
||||
@ -140,7 +140,7 @@
|
||||
|
||||
<script>
|
||||
toastr.options = {
|
||||
"timeOut": 2000,
|
||||
"timeOut": 5000,
|
||||
"closeButton": true,
|
||||
};
|
||||
</script>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user