FIX_UNIT_HANDLED_IN_ENROLLMENT_UPLOAD_VIA_CRM

This commit is contained in:
velz 2024-11-20 12:16:19 +05:30
parent 44c22310db
commit f60a900dee
2 changed files with 14 additions and 2 deletions

View File

@ -1966,7 +1966,8 @@ public function employeesEnrollmentInsert($params)
$allowedHighestColumn = end($columns_to_check); $allowedHighestColumn = end($columns_to_check);
$excel_data = $sheet->rangeToArray('A1:' . $allowedHighestColumn['col_cell_name'] . $highestRowAndColumn['row']); $excel_data = $sheet->rangeToArray('A1:' . $allowedHighestColumn['col_cell_name'] . $highestRowAndColumn['row']);
// print_r($keys);die(); // print_r($keys);die();
//get existing units in the current branch
$existing_units = $this->clientBranchModel->getExisitingUnits(client_id: $file['client_id'],client_branch_id: $file['client_branch_id']);
//remove header //remove header
unset($excel_data[0]); unset($excel_data[0]);
// dd($excel_data); // dd($excel_data);
@ -1982,6 +1983,11 @@ public function employeesEnrollmentInsert($params)
// dd($key.'-'.count($excel_data)); // dd($key.'-'.count($excel_data));
$value = []; $value = [];
$policy_data = []; $policy_data = [];
$temp_unit = '';
if(empty($row[12]))
{
$temp_unit = $existing_units[0];
}
$value['emp_code'] = $row[1]; $value['emp_code'] = $row[1];
$value['name'] = $row[2]; $value['name'] = $row[2];
@ -1993,7 +1999,7 @@ public function employeesEnrollmentInsert($params)
$value['mobile'] = $row[8]; $value['mobile'] = $row[8];
$value['band'] = $row[10]; $value['band'] = $row[10];
$value['basic_pay'] = $row[11]; $value['basic_pay'] = $row[11];
$value['unit'] = $row[12]; $value['unit'] = $temp_unit;
$value['family_floater_key'] = null; $value['family_floater_key'] = null;
$value['client_id'] = $file['client_id']; $value['client_id'] = $file['client_id'];
$value['client_branch_id'] = $file['client_branch_id']; $value['client_branch_id'] = $file['client_branch_id'];

View File

@ -2021,6 +2021,12 @@ if(!function_exists('check_unit'))
{ {
return array('status' => true); return array('status' => true);
} }
else if($temp != $existing_units[0])
{
return array('status' => false,'error' => 'wrong unit name');
}
} }
if(strtolower($row[5]) == 'self') if(strtolower($row[5]) == 'self')