FIX_LIVE_ISSUES

This commit is contained in:
velz 2024-11-19 14:09:25 +05:30
parent a6ab231c08
commit 98cadc7f73
4 changed files with 36 additions and 16 deletions

View File

@ -212,6 +212,7 @@ class EmployeeController extends AdminController
//validate uploaded file
$filename = '';
$fileSize = '';
$validated = $this->validate([
'emplist' => [
'uploaded[emplist]',
@ -231,6 +232,8 @@ class EmployeeController extends AdminController
$is_moved = $avatar->move(WRITEPATH . 'uploads/excel/');
if ($is_moved) {
$filename = $avatar->getName();
$fileSize = $avatar->getSize(); // File size in bytes
$fileSize = $fileSize / (1024 * 1024); // Convert to MB
// Handle successful upload, e.g., log success or further processing
$this->myLogger->logme("error", 'File move successful');
@ -258,12 +261,19 @@ class EmployeeController extends AdminController
$this->myLogger->logme("error", '{file_id} uploaded success', ['file_id' => $file_id]);
//start validation process
$empServiceController = new EmployeeServiceController();
$result = $empServiceController->excelFileFormatValidation(['file_id' => $file_id]);
//endof validation process
if (isset($result['error_summary']) && count($result['error_summary'])) {
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'file rejected with errors'], 200);
if($fileSize < 1) // if file size less than 1
{
$empServiceController = new EmployeeServiceController();
$result = $empServiceController->excelFileFormatValidation(['file_id' => $file_id]);
//endof validation process
if (isset($result['error_summary']) && count($result['error_summary'])) {
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'file rejected with errors'], 200);
}
}
else //if file size greater than 1 add the file as job
{
$job_details = new Jobs();
$r = Jobs::addJob(['job_name' => 'excelFileFormatValidation','payload' => ['file_id' => $file_id]]);
}
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => 'file upload success'], 200);
@ -825,18 +835,18 @@ class EmployeeController extends AdminController
// client_policy_id pull draft and enrolled status employees and proceed to calculatin and make entry in DB
public function initiateManualEmployeesOnboardProcess($client_policy_id)
{
$client_data = $this->clientPolicyModel->select('clients.client_name as client_name, policies.name as policy_name,client_branch_id')
$client_data = $this->clientPolicyModel->select('clients.client_name as client_name,client_branch_id')
->join('clients', 'clients.id = client_policy.client_id')
->join('policies', 'policies.id = client_policy.policy_id')
// ->join('policies', 'policies.id = client_policy.policy_id')
->where('client_policy.id', $client_policy_id)
->first();
// dd($client_data);
$empServiceController = new EmployeeServiceController();
$res = $empServiceController->employeesOnboardPreprocess(['client_policy_id' => $client_policy_id,'client_branch_id' => $client_data['client_branch_id']]);
// dd($res);
$count = ($res);
$message = $count . ' Employees are Initiate Onboard Process againts Client ' . $client_data['client_name'] . ' and the Policy is ' . $client_data['policy_name'];
$message = $count . ' Employees are Initiate Onboard Process againts Client ' . $client_data['client_name'] . ' and the Policy is ' .$client_policy_id;
session()->setFlashdata('success1', $message);
return redirect()->to(base_url('/employee/upload'));
}

View File

@ -1444,7 +1444,14 @@ 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'])->where('client_branch_id',$file['client_branch_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'])
->where('emp_status','active')
->where('is_active',1)
->first();
$existing_endorsements = $this->empEndorsementModel->where('actions','c')
->where('table_name','employees')
->where('endorsement_id is null')

View File

@ -861,21 +861,24 @@ class EmployeePolicyModel extends Model
public function getEmployeePolicyForFileList($client_id, $policy_id)
{
$result = $this->select(['employee_polices.*','pm.name as policy_name','im.short_name as insurer_short_name','ib.branch_name as insurer_branch_name','ib.branch_code as insurer_branch_code','tpam.name as tpa_name','tpam.short_name as tpa_short_name','tpab.branch_code as tpa_branch_code','cm.client_name','cm.short_name as client_short_name','emp.relationship','emp.relationship_code','emp.change_event','emp.emp_code','emp.name','emp.email_corporate','emp.dob','emp.gender','emp.emp_status','emp.is_active as emp_is_active','emp.mobile as mobile'])
$result = $this->select(['employee_polices.*','pt.policy_type','im.short_name as insurer_short_name','ib.branch_name as insurer_branch_name','ib.branch_code as insurer_branch_code','tpam.name as tpa_name','tpam.short_name as tpa_short_name','tpab.branch_code as tpa_branch_code','cm.client_name','cm.short_name as client_short_name','emp.relationship','emp.relationship_code','emp.change_event','emp.emp_code','emp.name','emp.email_corporate','emp.dob','emp.gender','emp.emp_status','emp.is_active as emp_is_active','emp.mobile as mobile'])
->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 pt', 'cp.policy_type_id = pt.id') //pm - policy master
->join('insurers im', 'cp.insurer_id = im.id') //im - insurar master
->join('insurer_branch ib', 'cp.insurer_branch_id = ib.id') //ib - insurar branch
->join('tpa tpam', 'cp.tpa_id = tpam.id') //tpam - tpa master
->join('tpa_branch tpab', 'cp.tpa_branch_id = tpab.id') //tpab - tpa brach
->join('clients cm', 'cp.client_id = cm.id') //cm - client master
->where('emp.client_id',$client_id)
->where('employee_polices.client_policy_id',$policy_id);
->where('employee_polices.client_policy_id',$policy_id)
->where('employee_polices.is_active',1)
->where('emp.is_active',1);
$result->whereIn('employee_polices.status', ['enrolled']);
$result->whereIn('emp.emp_status', ['enrolled']);
$result = $result->findAll();
$result = $result->findAll();
// print_r($this->db->getLastQuery());
return ($result);
}

View File

@ -142,7 +142,7 @@
<div class="dropdown-menu dropdown-menu-right">
<?php if(($employee['emp_status'] == 'draft' || $employee['emp_status'] == 'enrolled') && ($employee['status'] == 'draft' || $employee['status'] == 'enrolled')) { ?>
<a class="dropdown-item" onclick="get_emp_master_data_for_update(this, '<?= $employee['employee_primary_id'];?>')" ><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
<a class="dropdown-item" onclick="get_emp_master_data_for_update(this, '<?= $employee['employee_id'];?>')" ><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
<?php } ?>
<?php if($employee['policy_type'] == 'GMC' && $employee['emp_status'] == 'active' && $employee['status'] == 'active' && !empty($employee['tpa_id'])) { ?>