Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev

This commit is contained in:
bitbucket 2024-04-06 09:09:56 +05:30
commit 3db264e78b
8 changed files with 248 additions and 87 deletions

View File

@ -936,26 +936,41 @@ class ClientController extends AdminController
$data = $this->policesModel->getPolicyPremium($record['policy_id']); $data = $this->policesModel->getPolicyPremium($record['policy_id']);
$policy_name = $data[0]->policy_name; $policy_name = $data[0]->policy_name;
$pattern = '/gmc/i'; $gmc_pattern = '/gmc/i';
$gpa_pattern = '/gpa/i';
$subject = $data[0]->policy_type; $subject = $data[0]->policy_type;
if (preg_match($pattern, $subject)) { if (preg_match($gmc_pattern, $subject)) {
$search_term = 'GMC'; $search_term = 'GMC';
} else { } else if (preg_match($gpa_pattern, $subject)){
$search_term = 'GPA'; $search_term = 'GPA';
}else{
$search_term = "";
} }
$results = $this->policyGridModel->like('policy_type', $search_term)->findAll(); $results = $this->policyGridModel->like('policy_type', $search_term)->findAll();
if($search_term === 'GPA'){ if($search_term === 'GPA'){
$premiumData = $this->policyPremium1Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll(); $premiumData = $this->policyPremium1Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll();
}else{ }else if($search_term === 'GMC'){
$premiumData = $this->policyPremium2Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll(); $premiumData = $this->policyPremium2Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll();
}else{
$premiumData = "";
} }
// echo $record['client_id']; // echo $record['client_id'];
// echo "-----"; // echo "-----";
// echo $client_policy_id; // echo $client_policy_id;
// print_r($premiumData);die; // print_r($premiumData);die;
// echo '<pre>'; // echo '<pre>';
// echo $family_floater; // echo $family_floater;
if($search_term === 'GMC'){
$resultss = []; $resultss = [];
if ($family_floater == 1) { if ($family_floater == 1) {
@ -996,13 +1011,27 @@ class ClientController extends AdminController
$premiumDataa = $premiumData; $premiumDataa = $premiumData;
} }
if($premiumDataa == ""){
$premiumDataa = $premiumData;
}
// print_r($premiumData);die; // print_r($premiumData);die;
// print_r($data[0]->policy_type); die; // print_r($data[0]->policy_type); die;
// echo "hello"; // echo "hello";
// return json_encode($premiumData); // return json_encode($premiumData);
return $this->respond(['status' => true,'code' => 200,'data' => $resultss, 'premiumData' => json_encode($premiumDataa), 'count' => $emp_count, 'policy_name' => $policy_name,], 200); return $this->respond(['status' => true,'code' => 200,'data' => $resultss, 'premiumData' => json_encode($premiumDataa), 'count' => $emp_count, 'policy_name' => $policy_name,], 200);
}else if($search_term === 'GPA'){
return $this->respond(['status' => true,'code' => 200,'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name,], 200);
}else{
return $this->respond(['status' => false,'code' => 200,'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name,], 200);
}
} }
public function policyGMCTerms() public function policyGMCTerms()

View File

@ -127,7 +127,7 @@ class EmployeeController extends AdminController
// print_r($this->request->getPost('upload-action-type')); // print_r($this->request->getPost('upload-action-type'));
// die(); // die();
// $empServiceController = new EmployeeServiceController(); // $empServiceController = new EmployeeServiceController();
// $res = $empServiceController->excelFileFormatValidation(['file_id' => '38']); // $res = $empServiceController->excelFileFormatValidation(['file_id' => '42']);
// dd($res); // dd($res);
// $empServiceController = new EmployeeServiceController(); // $empServiceController = new EmployeeServiceController();
@ -197,7 +197,7 @@ class EmployeeController extends AdminController
//start validation process //start validation process
$empServiceController = new EmployeeServiceController(); $empServiceController = new EmployeeServiceController();
$result = $empServiceController->excelFileFormatValidation($file_id); $result = $empServiceController->excelFileFormatValidation(['file_id' => $file_id]);
//endof validation process //endof validation process
if(isset($result['error_summary']) && count($result['error_summary'])) if(isset($result['error_summary']) && count($result['error_summary']))
{ {
@ -219,9 +219,9 @@ class EmployeeController extends AdminController
$data['fileList'] = $this->fileModel $data['fileList'] = $this->fileModel
->select(['files.*','up.emp_code','up.first_name','pm.name as policy_name','c.short_name']) ->select(['files.*','up.emp_code','up.first_name','pm.name as policy_name','c.short_name'])
->join('user_profiles up','files.created_by = up.id') ->join('user_profiles up','files.created_by = up.id')
->join('client_policy cp','files.policy_id = cp.id') ->join('client_policy cp','files.policy_id = cp.id','left')
->join('policies pm','cp.policy_id = pm.id') ->join('policies pm','cp.policy_id = pm.id','left')
->join('clients c','files.client_id = c.id and files.client_id = cp.client_id') ->join('clients c','files.client_id = c.id and files.client_id = cp.client_id','left')
->where('files.created_by',get_session_userid())->orderBy('files.created_at','desc')->findAll(); ->where('files.created_by',get_session_userid())->orderBy('files.created_at','desc')->findAll();
$data['batch_list'] = $this->batchFileModel->select('batch_files.*, policies.name as policy_name, clients.short_name as client_short_name') $data['batch_list'] = $this->batchFileModel->select('batch_files.*, policies.name as policy_name, clients.short_name as client_short_name')

View File

@ -89,9 +89,8 @@ class EmployeeServiceController extends AdminController
$sheet = $spreadsheet->getActiveSheet(); $sheet = $spreadsheet->getActiveSheet();
$highestRowAndColumn = $sheet->getHighestRowAndColumn(); $highestRowAndColumn = $sheet->getHighestRowAndColumn();
// dd($highestRowAndColumn);
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
// dd($this->si_enhance_excel_columns);
$columns_to_check = []; $columns_to_check = [];
if($file['action'] == 'inception'){ $columns_to_check = $this->inception_excel_columns; } if($file['action'] == 'inception'){ $columns_to_check = $this->inception_excel_columns; }
if($file['action'] == 'addition'){ $columns_to_check = $this->inception_excel_columns; } if($file['action'] == 'addition'){ $columns_to_check = $this->inception_excel_columns; }
@ -100,6 +99,15 @@ class EmployeeServiceController extends AdminController
if($file['action'] == 'correction'){ $columns_to_check = $this->correction_excel_columns; } if($file['action'] == 'correction'){ $columns_to_check = $this->correction_excel_columns; }
if($file['action'] == 'si_enhancement'){ $columns_to_check = $this->si_enhance_excel_columns; } if($file['action'] == 'si_enhancement'){ $columns_to_check = $this->si_enhance_excel_columns; }
$result = ['error_type' => 1,'error_summary' => [], 'error_data' => [] ];
$keys = array_keys($columns_to_check);
$allowedHighestColumn = end($columns_to_check);
// dd($allowedHighestColumn);
$excel_data = $sheet->rangeToArray('A1:' . $allowedHighestColumn['col_cell_name'] . $highestRowAndColumn['row']);
// !dd(array_chunk($excel_data,20)[0]);
//check no of columns in excel //check no of columns in excel
$total_defined_columns = count($columns_to_check); $total_defined_columns = count($columns_to_check);
$excel_columns = ($excel_data[0]); $excel_columns = ($excel_data[0]);
@ -129,9 +137,7 @@ class EmployeeServiceController extends AdminController
return array('error_summary' => [6], 'error_data' => $message); return array('error_summary' => [6], 'error_data' => $message);
} }
//start other checks
$result = ['error_type' => 1,'error_summary' => [], 'error_data' => [] ];
$keys = array_keys($columns_to_check);
// dd($columns_to_check);die(); // dd($columns_to_check);die();
// get policy and rack details // get policy and rack details
@ -268,8 +274,8 @@ class EmployeeServiceController extends AdminController
//proceed next data level validation in JOB queue //proceed next data level validation in JOB queue
$job_details = new Jobs(); $job_details = new Jobs();
$r = Jobs::addJob(['job_name' => 'excelFileDataValidation','payload' => ['file_id' => $file_id]]); $r = Jobs::addJob(['job_name' => 'excelFileDataValidation','payload' => ['file_id' => $file_id]]);
$jobWorker = new JobWorker(); // $jobWorker = new JobWorker();
JobWorker::processJob($r); // JobWorker::processJob($r);
} }
return $result; return $result;
@ -321,10 +327,11 @@ class EmployeeServiceController extends AdminController
$sheet = $spreadsheet->getActiveSheet(); $sheet = $spreadsheet->getActiveSheet();
$highestRowAndColumn = $sheet->getHighestRowAndColumn(); $highestRowAndColumn = $sheet->getHighestRowAndColumn();
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
// dd($excel_data);
$result = ['error_type' => 2,'error_summary' => [], 'error_data' => [] ]; $result = ['error_type' => 2,'error_summary' => [], 'error_data' => [] ];
$keys = array_keys($columns_to_check); $keys = array_keys($columns_to_check);
$allowedHighestColumn = end($columns_to_check);
$excel_data = $sheet->rangeToArray('A1:' . $allowedHighestColumn['col_cell_name'] . $highestRowAndColumn['row']);
// print_r($keys);die(); // print_r($keys);die();
//remove header //remove header
@ -493,7 +500,8 @@ class EmployeeServiceController extends AdminController
$sheet = $spreadsheet->getActiveSheet(); $sheet = $spreadsheet->getActiveSheet();
$highestRowAndColumn = $sheet->getHighestRowAndColumn(); $highestRowAndColumn = $sheet->getHighestRowAndColumn();
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']); $allowedHighestColumn = end($columns_to_check);
$excel_data = $sheet->rangeToArray('A1:' . $allowedHighestColumn['col_cell_name'] . $highestRowAndColumn['row']);
unset($excel_data[0]); unset($excel_data[0]);
@ -578,8 +586,9 @@ class EmployeeServiceController extends AdminController
$sheet = $spreadsheet->getActiveSheet(); $sheet = $spreadsheet->getActiveSheet();
$highestRowAndColumn = $sheet->getHighestRowAndColumn(); $highestRowAndColumn = $sheet->getHighestRowAndColumn();
$allowedHighestColumn = end($this->deletion_excel_columns);
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']); $excel_data = $sheet->rangeToArray('A1:' . $allowedHighestColumn['col_cell_name'] . $highestRowAndColumn['row']);
// $excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
unset($excel_data[0]); unset($excel_data[0]);
// dd($excel_data); // dd($excel_data);
@ -589,15 +598,16 @@ class EmployeeServiceController extends AdminController
//make closure funciton which is going to use only by this method //make closure funciton which is going to use only by this method
$endorsement = function($data,$file,$row){ $endorsement = function($data,$file,$row){
$group_key = rand(100000, 999999);
//for emp table //for emp table
$this->empEndorsementModel->save(['pk' => (int)$data['emp_id'],'emp_code' => $data['emp_code'],'table_name' => 'employees','actions' => 'd','name' => $data['name'],'field_name' => 'emp_status','old_value' => $data['emp_status'],'new_value' => 'deactivate','created_by' => $file['created_by'],'remarks' => 'general deletion']); $this->empEndorsementModel->save(['pk' => (int)$data['emp_id'],'emp_code' => $data['emp_code'],'table_name' => 'employees','actions' => 'd','name' => $data['name'],'field_name' => 'emp_status','old_value' => $data['emp_status'],'new_value' => 'deactivate','created_by' => $file['created_by'],'remarks' => 'general deletion','group_key' => $group_key]);
// dd( $this->empEndorsementModel->getLastQuery()); // dd( $this->empEndorsementModel->getLastQuery());
// $this->empEndorsementModel->save(['pk' => (int)$data['emp_id'],'emp_code' => $data['emp_code'],'table_name' => 'employees','actions' => 'd','name' => $data['name'],'field_name' => 'change_event','old_value' => $data['change_event'],'new_value' => 'deletion','created_by' => $file['created_by'],'remarks' => 'general deletion']); // $this->empEndorsementModel->save(['pk' => (int)$data['emp_id'],'emp_code' => $data['emp_code'],'table_name' => 'employees','actions' => 'd','name' => $data['name'],'field_name' => 'change_event','old_value' => $data['change_event'],'new_value' => 'deletion','created_by' => $file['created_by'],'remarks' => 'general deletion']);
// for employee policy table // for employee policy table
$this->empEndorsementModel->save(['pk' => (int)$data['emp_policy_id'],'emp_code' => $data['emp_code'],'table_name' => 'employee_polices','actions' => 'd','name' => $data['name'],'field_name' => 'date_of_exit','old_value' => $data['date_of_exit'],'new_value' => change_date_format($row[4],'d-M-Y','Y-m-d'),'created_by' => $file['created_by'],'remarks' => 'general deletion']); $this->empEndorsementModel->save(['pk' => (int)$data['emp_policy_id'],'emp_code' => $data['emp_code'],'table_name' => 'employee_polices','actions' => 'd','name' => $data['name'],'field_name' => 'date_of_exit','old_value' => $data['date_of_exit'],'new_value' => change_date_format($row[4],'d-M-Y','Y-m-d'),'created_by' => $file['created_by'],'remarks' => 'general deletion','group_key' => $group_key]);
$this->empEndorsementModel->save(['pk' => (int)$data['emp_policy_id'],'emp_code' => $data['emp_code'],'table_name' => 'employee_polices','actions' => 'd','name' => $data['name'],'field_name' => 'reason_for_exit','old_value' => $data['reason_for_exit'],'new_value' => $row[5],'created_by' => $file['created_by'],'remarks' => 'general deletion']); $this->empEndorsementModel->save(['pk' => (int)$data['emp_policy_id'],'emp_code' => $data['emp_code'],'table_name' => 'employee_polices','actions' => 'd','name' => $data['name'],'field_name' => 'reason_for_exit','old_value' => $data['reason_for_exit'],'new_value' => $row[5],'created_by' => $file['created_by'],'remarks' => 'general deletion','group_key' => $group_key]);
$this->empEndorsementModel->save(['pk' => (int)$data['emp_policy_id'],'emp_code' => $data['emp_code'],'table_name' => 'employee_polices','actions' => 'd','name' => $data['name'],'field_name' => 'status','old_value' => $data['status'],'new_value' => 'deactivate','created_by' => $file['created_by'],'remarks' => 'general deletion']); $this->empEndorsementModel->save(['pk' => (int)$data['emp_policy_id'],'emp_code' => $data['emp_code'],'table_name' => 'employee_polices','actions' => 'd','name' => $data['name'],'field_name' => 'status','old_value' => $data['status'],'new_value' => 'deactivate','created_by' => $file['created_by'],'remarks' => 'general deletion','group_key' => $group_key]);
}; };
//iterate each row //iterate each row
foreach ($excel_data as $col_key => $row) foreach ($excel_data as $col_key => $row)
@ -671,8 +681,9 @@ class EmployeeServiceController extends AdminController
$sheet = $spreadsheet->getActiveSheet(); $sheet = $spreadsheet->getActiveSheet();
$highestRowAndColumn = $sheet->getHighestRowAndColumn(); $highestRowAndColumn = $sheet->getHighestRowAndColumn();
$allowedHighestColumn = end($this->correction_excel_columns);
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']); $excel_data = $sheet->rangeToArray('A1:' . $allowedHighestColumn['col_cell_name'] . $highestRowAndColumn['row']);
// $excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
unset($excel_data[0]); unset($excel_data[0]);
// dd($excel_data); // dd($excel_data);
@ -702,7 +713,8 @@ class EmployeeServiceController extends AdminController
//make entry in endorsement table //make entry in endorsement table
if(!count($existing_endorsements)) if(!count($existing_endorsements))
{ {
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employees','actions' => 'c','name' => $employee['name'],'field_name' => $field_name,'old_value' => $employee[ $field_name ],'new_value' => $field_value,'created_by' => $file['created_by'],'remarks' => $row[7],'date_of_correction' => change_date_format($row[5],'d-M-Y','Y-m-d')]); $group_key = rand(100000, 999999);
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employees','actions' => 'c','name' => $employee['name'],'field_name' => $field_name,'old_value' => $employee[ $field_name ],'new_value' => $field_value,'created_by' => $file['created_by'],'remarks' => $row[7],'date_of_correction' => change_date_format($row[5],'d-M-Y','Y-m-d'),'group_key' => $group_key]);
} }
@ -727,8 +739,9 @@ class EmployeeServiceController extends AdminController
$sheet = $spreadsheet->getActiveSheet(); $sheet = $spreadsheet->getActiveSheet();
$highestRowAndColumn = $sheet->getHighestRowAndColumn(); $highestRowAndColumn = $sheet->getHighestRowAndColumn();
$allowedHighestColumn = end($this->si_enhance_excel_columns);
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']); $excel_data = $sheet->rangeToArray('A1:' . $allowedHighestColumn['col_cell_name'] . $highestRowAndColumn['row']);
// $excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
unset($excel_data[0]); unset($excel_data[0]);
// dd($excel_data); // dd($excel_data);
@ -763,9 +776,10 @@ class EmployeeServiceController extends AdminController
{ {
if($slab_value['si'] == $row[3]) if($slab_value['si'] == $row[3])
{ {
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'basic_cover_si','old_value' => $employee_policy['basic_cover_si'],'new_value' => $row[3],'created_by' => $file['created_by'],'remarks' => 'general si enhancement']); $group_key = rand(100000, 999999);
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'premium','old_value' => $employee_policy['premium'],'new_value' => $slab_value['premium'],'created_by' => $file['created_by'],'remarks' => 'general si enhancement']); $this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'basic_cover_si','old_value' => $employee_policy['basic_cover_si'],'new_value' => $row[3],'created_by' => $file['created_by'],'remarks' => 'general si enhancement','group_key' => $group_key]);
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'si_enhancement_date','old_value' => null,'new_value' => change_date_format($row[4],'d-M-Y','Y-m-d'),'created_by' => $file['created_by'],'remarks' => 'general si enhancement']); $this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'premium','old_value' => $employee_policy['premium'],'new_value' => $slab_value['premium'],'created_by' => $file['created_by'],'remarks' => 'general si enhancement','group_key' => $group_key]);
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'si_enhancement_date','old_value' => null,'new_value' => change_date_format($row[4],'d-M-Y','Y-m-d'),'created_by' => $file['created_by'],'remarks' => 'general si enhancement','group_key' => $group_key]);
break; break;
} }
} }
@ -797,10 +811,11 @@ class EmployeeServiceController extends AdminController
$employee = $this->employeeModel->checkExistingEmp($value); $employee = $this->employeeModel->checkExistingEmp($value);
$policy_data = $value['policy_details']; $policy_data = $value['policy_details'];
$temp = $value['temp'];
unset($value['policy_details']); unset($value['policy_details']);
unset($value['temp']); unset($value['temp']);
if($file['id'] == null && (strtolower($value['relationship']) == 'self' && $value['temp']['source'] == 'db' && $value['temp']['emp_id'] != null && $value['temp']['emp_policy_id'] != null)) if($file['id'] == null && (strtolower($value['relationship']) == 'self' && $temp['source'] == 'db' && $temp['emp_id'] != null && $temp['emp_policy_id'] != null))
{ {
//check existing si and new si //check existing si and new si
$employee_policy = $this->employeePolicyModel->where('employee_id',$employee['id'])->where('client_policy_id',$file['policy_id'])->first(); $employee_policy = $this->employeePolicyModel->where('employee_id',$employee['id'])->where('client_policy_id',$file['policy_id'])->first();
@ -824,10 +839,11 @@ class EmployeeServiceController extends AdminController
{ {
if($slab_value['si'] == $policy_data['si']) if($slab_value['si'] == $policy_data['si'])
{ {
$group_key = rand(100000, 999999);
//add new premimum details in endorsement table //add new premimum details in endorsement table
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'basic_cover_si','old_value' => $employee_policy['basic_cover_si'],'new_value' => $policy_data['premium'],'created_by' => $file['created_by'],'remarks' => 'da auto si enhancement']); $this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'basic_cover_si','old_value' => $employee_policy['basic_cover_si'],'new_value' => $policy_data['premium'],'created_by' => $file['created_by'],'remarks' => 'da auto si enhancement','group_key' => $group_key]);
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'premium','old_value' => $employee_policy['premium'],'new_value' => $slab_value['premium'],'created_by' => $file['created_by'],'remarks' => 'da auto si enhancement']); $this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'premium','old_value' => $employee_policy['premium'],'new_value' => $slab_value['premium'],'created_by' => $file['created_by'],'remarks' => 'da auto si enhancement','group_key' => $group_key]);
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'si_enhancement_date','old_value' => null,'new_value' => ($policy_data['date_coverage']),'created_by' => $file['created_by'],'remarks' => 'da auto si enhancement']); $this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'si_enhancement_date','old_value' => null,'new_value' => ($policy_data['date_coverage']),'created_by' => $file['created_by'],'remarks' => 'da auto si enhancement','group_key' => $group_key]);
break; break;
} }
} }

View File

@ -57,7 +57,7 @@ class JobWorker extends AdminController
//sleep(1); //sleep(1);
SELF::processjob(['id' => $job->id,'uuid' => $job->uuid]); SELF::processjob(['id' => $job->id,'uuid' => $job->uuid]);
usleep( 500000 ); // usleep( 500000 );
} }
} }
} }

View File

@ -87,9 +87,9 @@ if (!function_exists('generate_excel')) {
try { try {
// Save Excel file to the specified path // Save Excel file to the specified path
// $writer->save($filename); $writer->save($filename);
$filePath = WRITEPATH."/uploads/import_excel/" . $filename; // $filePath = WRITEPATH."/uploads/import_excel/" . $filename;
$writer->save($filePath); // $writer->save($filePath);
return true; // Return true if file was successfully saved return true; // Return true if file was successfully saved
} catch (\Exception $e) { } catch (\Exception $e) {
// Log or handle the exception // Log or handle the exception
@ -418,3 +418,102 @@ if (!function_exists('formatDateOrReturn')) {
} }
} }
} }
if (!function_exists('format_Excel_BasedOn_Client'))
{
function format_Excel_BasedOn_Client($objects, $client_excel_header)
{
$data = [];
// Initialize serial number
$serialNumber = 1;
// Iterate through each object
foreach ($objects as $obj)
{
// Extract all values for the object based on the header order
$rowData = [];
foreach ($client_excel_header as $header) {
$normalizedHeader = strtolower(str_replace(' ', '', $header));
switch ($normalizedHeader) {
case 's.no':
$rowData[] = $serialNumber++; // Serial Number
break;
case 'empid':
$rowData[] = $obj->emp_code; // Employee Code
break;
case 'nameofemp/dep':
$rowData[] = $obj->emp_name; // Employee Name
break;
case 'emp/deptype':
$rowData[] = $obj->emp_type; // Employee Type
break;
case 'relation':
$rowData[] = $obj->emp_relationship_code; // RELATION
break;
case 'dob':
$rowData[] = $obj->emp_dob; // Employee DOB
break;
case 'gender':
$rowData[] = $obj->emp_gender; //Employee GENDER
break;
case 'preexistingailments':
$rowData[] = $obj->pre_existing_alignments; // PRE EXISTING AILMENTS
break;
case 'basiccoversi':
$rowData[] = $obj->basic_cover_si; // Employee BASIC COVER SI
break;
case 'dateofcoverage':
$rowData[] = $obj->date_coverage; // DATE OF COVERAGE
break;
case 'age':
$rowData[] = $obj->emp_age; // Employee AGE
break;
case 'relationship':
$rowData[] = $obj->emp_relationship; // Employee RELATIONSHIP
break;
case 'remarks':
$rowData[] = $obj->change_event; // REMARKS
break;
case 'policyenddate':
$rowData[] = $obj->policy_end_date; // POLICY END DATE
break;
case 'noofdays':
$rowData[] = $obj->days; // NO OF DAYS
break;
case 'tpaid':
$rowData[] = ''; // TPA ID
break;
case 'uhid':
$rowData[] = ''; // UHID
break;
case 'premium':
$rowData[] = $obj->premium; // PREMIUM
break;
case 'proratapremium':
$rowData[] = $obj->rata_premimum; // PR0 RATA PREMIUM
break;
case 'gst':
$rowData[] = $obj->gst; // GST
break;
case 'total':
$rowData[] = $obj->total; // TOTAL
break;
default:
// If the header doesn't match any property, add an empty string
$rowData[] = '';
break;
}
}
// Append the row data to the main data array
$data[] = $rowData;
}
return $data;
}
}

View File

@ -347,6 +347,7 @@ if (!function_exists('check_dependent_conflict'))
// $temp_string = implode(" ",$policy_terms['family_floaters']); // $temp_string = implode(" ",$policy_terms['family_floaters']);
$temp = $policy_terms['family_floaters']; $temp = $policy_terms['family_floaters'];
$temp = is_array($temp) ? $temp : (is_object($temp) ? (array)$temp : []);
$allowed_child_count = $temp['childrens']; $allowed_child_count = $temp['childrens'];
$allowed_spouse_count = $temp['spouse']; $allowed_spouse_count = $temp['spouse'];
$allowed_adults = $temp['either-parents-pil']; $allowed_adults = $temp['either-parents-pil'];
@ -902,3 +903,18 @@ if (!function_exists('transform_db_data_to_excel'))
} }
} }
//comparre excel cell names and return range of chars between them
if (!function_exists('compare_excel_cell_range'))
{
function compare_excel_cell_range($highestColumnAllowed, $highestColumnReceivedInExcel) {
$highestColumnAllowed = strtoupper($highestColumnAllowed);
$highestColumnReceivedInExcel = strtoupper($highestColumnReceivedInExcel);
if ($highestColumnAllowed < $highestColumnReceivedInExcel) {
$range = range($highestColumnAllowed, $highestColumnReceivedInExcel);
return $range;
}
return [];
}
}

View File

@ -568,6 +568,7 @@
var client_policy_id = $(this).data('id'); var client_policy_id = $(this).data('id');
$('#client_policy_id').val(client_policy_id); $('#client_policy_id').val(client_policy_id);
console.log('client_policy_id',client_policy_id)
var policy_type_string = $(this).attr('id'); var policy_type_string = $(this).attr('id');
console.log('policy_type_string', policy_type_string) console.log('policy_type_string', policy_type_string)
@ -590,7 +591,7 @@
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
}, 1000); }, 1000);
console.log('res',res); console.log('policy grid responce',res);
var temp_for_premiumData = JSON.parse(res.premiumData); var temp_for_premiumData = JSON.parse(res.premiumData);
res.premiumData= JSON.parse(res.premiumData); res.premiumData= JSON.parse(res.premiumData);

View File

@ -50,10 +50,10 @@ class CheckDependentConflictTest extends CIUnitTestCase
$this->assertTrue($result['status']); $this->assertTrue($result['status']);
} }
public function testIsNull() // public function testIsNull()
{ // {
$i = null; // $i = null;
$this->assertTrue($i); // $this->assertTrue($i);
} // }
} }