diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index 6c454276..36bb3868 100644
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -16,6 +16,7 @@ $routes->get('/login', 'LoginController::index');///auth/google
$routes->get('/logout', 'LoginController::logout');
$routes->get('/oauth2callback', 'LoginController::receiveGoogleOAuthResponse');
$routes->get('/auth/google', 'LoginController::initiateGoogleOAuth');
+$routes->get('/update-emp-policy-status', 'ClientController::updateEmpAndPolicyStatus');
$routes->group("/user", ["filter" => "authMVC"], function($routes){
@@ -209,6 +210,11 @@ $routes->group("/util", ["filter" => "authMVC"], function($routes){
$routes->get("download-excel/(:any)", "EmployeeController::downloadSampleExcelFile/$1");
$routes->get("get-emp-endorsement/(:any)", "EmployeeController::getEmpEndoresmentEntry/$1");
$routes->post("import-export", "EmployeeController::importExport");
+ $routes->get("featch-client-policy-list/(:any)", "ClientController::getClientPolicyList/$1");
+ $routes->get("download-file-list/(:any)", "EmployeeController::downloadFileList/$1");
+ $routes->get("featch-emp-list", "EmployeeController::featchEmpList/$1");
+ $routes->get("view-success-emp-list", "EmployeeController::viewUploadedEmployeeList/$1");
+
});
$routes->cli('cli/processjob', 'JobWorker::processJob');
diff --git a/app/Config/Session.php b/app/Config/Session.php
index e077df64..591aefdc 100644
--- a/app/Config/Session.php
+++ b/app/Config/Session.php
@@ -40,7 +40,8 @@ class Session extends BaseConfig
* The number of SECONDS you want the session to last.
* Setting to 0 (zero) means expire when the browser is closed.
*/
- public int $expiration = 7200;
+ // public int $expiration = 7200;
+ public int $expiration = 86400; //24 Hours
/**
* --------------------------------------------------------------------------
diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php
index 44768c63..7a2b274e 100644
--- a/app/Controllers/ClientController.php
+++ b/app/Controllers/ClientController.php
@@ -29,6 +29,8 @@ use App\Models\PolicyGridModel;
use App\Models\PolicyPremium1Model;
use App\Models\PolicyPremium2Model;
use App\Models\EmployeeModel;
+use App\Models\EmployeePolicyModel;
+
@@ -57,6 +59,7 @@ class ClientController extends AdminController
protected $policyPremium2Model;
protected $clientDepositModel;
protected $employeeModel;
+ protected $employeePolicyModel;
public function __construct()
{
@@ -83,6 +86,9 @@ class ClientController extends AdminController
$this->policyPremium1Model = new PolicyPremium1Model();
$this->policyPremium2Model = new PolicyPremium2Model();
$this->employeeModel = new EmployeeModel();
+ $this->employeePolicyModel = new EmployeePolicyModel();
+
+
}
@@ -103,6 +109,14 @@ class ClientController extends AdminController
}
+ public function updateEmpAndPolicyStatus(){
+
+ $return = $this->clientPolicyModel->updateStatus();
+ $this->myLogger->logme('error', 'Client Policy Status Update Count: {data}', ['data' => $return['client']]);
+ $this->myLogger->logme('error', 'Employee Policy Status Update Count: {data}', ['data' => $return['emp']]);
+
+ }
+
public function removeClient($id = null)
{
@@ -248,10 +262,21 @@ class ClientController extends AdminController
$editData['client_kyc'] = $this->clientKYCDocsModel->where('client_id', $id)->findAll();
$editData['client_branch'] = $this->clientBranchModel->where(['client_id' => $id, 'is_active' => 1])->findAll();
$editData['client_relation'] = $this->clientRMModel->where(['client_id' => $id, 'is_active' => 1])->findAll();
- $editData['client_policy'] = $this->clientPolicyModel->getClientPolicyByClientId($id);
+
+ $clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($id);
+
+ foreach ($clientPoliceData as $key => $value) {
+
+ $clientPoliceData[$key]->policy_start_date = date('d-M-Y', strtotime($value->policy_start_date));
+ $clientPoliceData[$key]->policy_end_date = date('d-M-Y', strtotime($value->policy_end_date));
+ }
+
+ $editData['client_policy'] = $clientPoliceData;
+
+
// echo "
";
- // print_r($editData); die;
+ // print_r($clientPoliceData); die;
echo view('layout/header', $headerData);
echo view('client_onboarding', $editData);
@@ -577,6 +602,7 @@ class ClientController extends AdminController
$data['earned_premium_amount'] = $this->request->getPost('earned_premium_amount');
$data['claims_incurred_amount'] = $this->request->getPost('claims_incurred_amount');
$data['is_addon'] = $this->request->getPost('is_addon');
+ $data['base_policy'] = $this->request->getPost('base_policy');
if (!isset($data['is_addon'])) {
$data['is_addon'] = 0;
@@ -594,6 +620,11 @@ class ClientController extends AdminController
$insert = $this->clientPolicyModel->insert($data);
if($insert){
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($this->request->getPost('client_id'));
+ foreach ($clientPoliceData as $key => $value) {
+
+ $clientPoliceData[$key]->policy_start_date = date('d-M-Y', strtotime($value->policy_start_date));
+ $clientPoliceData[$key]->policy_end_date = date('d-M-Y', strtotime($value->policy_end_date));
+ }
return $this->respond(['status' => true,'code' => 200,'data' => $clientPoliceData, 'method' => 'CERATE'], 200);
}else{
return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200);
@@ -637,6 +668,8 @@ class ClientController extends AdminController
$data['earned_premium_amount'] = $this->request->getPost('earned_premium_amount');
$data['claims_incurred_amount'] = $this->request->getPost('claims_incurred_amount');
$data['is_addon'] = $this->request->getPost('is_addon');
+ $data['base_policy'] = $this->request->getPost('base_policy');
+
if (!isset($data['is_addon'])) {
@@ -654,6 +687,11 @@ class ClientController extends AdminController
if($insert){
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($client_id);
+ foreach ($clientPoliceData as $key => $value) {
+
+ $clientPoliceData[$key]->policy_start_date = date('d-M-Y', strtotime($value->policy_start_date));
+ $clientPoliceData[$key]->policy_end_date = date('d-M-Y', strtotime($value->policy_end_date));
+ }
return $this->respond(['status' => true,'code' => 200,'data' => $clientPoliceData, 'method' => 'EDIT'], 200);
}else{
return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200);
@@ -903,8 +941,13 @@ class ClientController extends AdminController
if($id){
$client_policy_data = $this->clientPolicyModel->where(['id' => $id, 'is_active' => 1])->first();
$insurer_id = $client_policy_data['insurer_id'];
+ $client_id = $client_policy_data['client_id'];
$polices = $this->policesModel->where(['insurer_id' => $insurer_id, 'is_active' => 1])->findAll();
- return $this->respond(['status' => true,'code' => 200,'data' => $client_policy_data, "insurer_id" => $client_policy_data['insurer_id'], 'policy' => $polices], 200);
+ $client_policy_list = $this->clientPolicyModel->select('policies.*')
+ ->join('policies', 'policies.id = client_policy.policy_id')
+ ->where('client_id', $client_id)
+ ->findAll();
+ return $this->respond(['status' => true,'code' => 200, 'client_policy_list' => $client_policy_list, 'data' => $client_policy_data, "insurer_id" => $client_policy_data['insurer_id'], 'policy' => $polices], 200);
}else{
return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200);
}
@@ -1393,4 +1436,19 @@ class ClientController extends AdminController
}
+
+ public function getClientPolicyList($client_id = null){
+
+ $record = $this->clientPolicyModel->select('policies.*')
+ ->join('policies', 'policies.id = client_policy.policy_id')
+ ->where('client_id', $client_id)
+ ->findAll();
+
+ if ($record) {
+ return $this->respond(['Status' => true,'code' => 200,'data' => $record], 200);
+ } else {
+ return $this->respond(['Status' => false,'code' => 200,'message' => 'Record not found.'], 200);
+ }
+
+ }
}
\ No newline at end of file
diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php
index ef969731..28566852 100644
--- a/app/Controllers/EmployeeController.php
+++ b/app/Controllers/EmployeeController.php
@@ -217,7 +217,7 @@ class EmployeeController extends AdminController
$data['insurer_or_tpa'] = ['insurer' => 'Insurer','tpa' =>'TPA'];
$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', 'cp.id as client_policy_id'])
->join('user_profiles up','files.created_by = up.id')
->join('client_policy cp','files.policy_id = cp.id','left')
->join('policies pm','cp.policy_id = pm.id','left')
@@ -250,7 +250,11 @@ class EmployeeController extends AdminController
// echo '';
// print_r($result); die;
- echo view('excel_errors', $result);
+ if($result){
+ echo view('excel_errors', $result);
+ }else{
+ echo view('errors/html/production');
+ }
}
@@ -272,13 +276,17 @@ class EmployeeController extends AdminController
$filePath = '';
// Path to your file
if($actionType == 'inception'){
- $filePath = ROOTPATH . 'public/sample_excel/inception.xls';
-
+ $filePath = ROOTPATH . 'public/sample_excel/sample_inception.xls';
}else if($actionType == 'correction'){
- $filePath = ROOTPATH . 'public/sample_excel/inception_1.xls';
-
+ $filePath = ROOTPATH . 'public/sample_excel/sample_correction .xls';
}else if($actionType == 'si_enhancement'){
- $filePath = ROOTPATH . 'public/sample_excel/inception_2.xls';
+ $filePath = ROOTPATH . 'public/sample_excel/sample_si_enhancement.xls';
+ }else if($actionType == 'dependent_addtion'){
+ $filePath = ROOTPATH . 'public/sample_excel/sample_dependent_addition.xls';
+ }else if($actionType == 'addition'){
+ $filePath = ROOTPATH . 'public/sample_excel/sample_addition.xls';
+ }else if($actionType == 'deletion'){
+ $filePath = ROOTPATH . 'public/sample_excel/sample_deletion.xls';
}
// Check if the file exists
@@ -291,7 +299,7 @@ class EmployeeController extends AdminController
return $this->response->download($filePath, null, $mimeType);
} else {
// File not found, show an error message or redirect
- return redirect()->back()->with('error', 'File not found.');
+ echo view('errors/html/production');
}
}
@@ -540,5 +548,90 @@ class EmployeeController extends AdminController
}
}
+
+ public function downloadFileList($fileName = null)
+ {
+ // $actionType = $this->request->getGet();
+ try {
+ $filePath = WRITEPATH . '/uploads/excel/' . $fileName;
+
+ // Check if the file exists
+ if (file_exists($filePath)) {
+ // Set the appropriate MIME type
+ $mimeType = mime_content_type($filePath);
+
+ // Send the file to the client for download
+ return $this->response->download($filePath, null, $mimeType);
+ } else {
+
+ throw new \CodeIgniter\Exceptions\PageNotFoundException();
+ }
+ } catch (\Exception $e) {
+ // Handle any exceptions
+ $errorMessage = $e->getMessage();
+ $this->myLogger->logme('error', $errorMessage);
+ // You can return an error response here
+ echo $errorMessage;
+ }
+
+ }
+
+
+ public function featchEmpList()
+ {
+ $client_id = $this->request->getGet('client_id');
+ $policy_id = $this->request->getGet('policy_id');
+
+ $emp_data['employees'] = $this->employeePolicyModel->getEmployeePolicyForFileList($client_id, $policy_id);
+ $html = view('employee_data_list', $emp_data);
+
+ return $this->respond(['dataStatus' => true,'code' => 200,'data' => $html], 200);
+
+ }
+
+
+ public function viewUploadedEmployeeList()
+ {
+ $file_id = $this->request->getGet('file_id');
+ // $emp_data['employees'] = $this->employeePolicyModel->getViewEmpSuccessList($file_id);
+ // $html = view('view_file_upload_emp_list', $emp_data);
+ $file_name = $this->fileModel
+ ->select(['files.*','up.emp_code','up.first_name','pm.name as policy_name','c.short_name', 'cp.id as client_policy_id'])
+ ->join('user_profiles up','files.created_by = up.id')
+ ->join('client_policy cp','files.policy_id = cp.id','left')
+ ->join('policies pm','cp.policy_id = pm.id','left')
+ ->join('clients c','files.client_id = c.id and files.client_id = cp.client_id','left')
+ ->where('files.id', $file_id)->first();
+
+ try {
+
+ $filePath = WRITEPATH . '/uploads/excel/' . $file_name['file_name'];
+
+ if (file_exists($filePath)) {
+ $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filePath);
+ $sheet = $spreadsheet->getActiveSheet();
+
+ $highestRowAndColumn = $sheet->getHighestRowAndColumn();
+ $excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
+ $emp_data['thead'] = $excel_data[0];
+ unset($excel_data[0]);
+ $emp_data['tbody'] = $excel_data;
+
+ $html = view('view_file_upload_emp_list', $emp_data);
+ } else {
+
+ $html = 'No Data Found
';
+ }
+
+ return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => $html, 'file_data' => $file_name], 200);
+
+ } catch (\Exception $e) {
+ // Handle exception
+ $errorMessage = 'Error occurred: ' . $e->getMessage();
+ $this->myLogger->logme('error', $errorMessage);
+ $html = 'No Data Found
';
+ return $this->respond(['dataStatus' => false, 'code' => 500, 'data' => $html, 'file_data' => $file_name], 500);
+ }
+ }
}
\ No newline at end of file
diff --git a/app/Controllers/EmployeeServiceController.php b/app/Controllers/EmployeeServiceController.php
index d3428448..ac99a890 100644
--- a/app/Controllers/EmployeeServiceController.php
+++ b/app/Controllers/EmployeeServiceController.php
@@ -35,7 +35,7 @@ class EmployeeServiceController extends AdminController
protected $empEndorsementModel;
protected $general_relationships = ['self' => ['name' => 'Self', 'gender' => 'M','age_min' => 18,'age_max' => null], 'spouse' => ['name' => 'Spouse', 'gender' => 'F','age_min' => 18,'age_max' => null], 'son' => ['name' => 'Son', 'gender' => 'M','age_min' => null,'age_max' => 25], 'daughter' => ['name' => 'Daughter', 'gender' => 'F','age_min' => null,'age_max' => 25], 'father' => ['name' => 'Father', 'gender' => 'M','age_min' => 18,'age_max' => null], 'mother' => ['name' => 'Mother', 'gender' => 'F','age_min' => 18,'age_max' => null], 'father-in-law' => ['name' => 'Father in Law', 'gender' => 'M','age_min' => 18,'age_max' => null], 'mother-in-law' => ['name' => 'Mother in Law', 'gender' => 'F','age_min' => 18,'age_max' => null]];
- protected $inception_excel_columns = ['sno'=>['col_idx'=>0,'col_cell_name'=>'A','col_name'=>'S.No','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'emp_id'=>['col_idx'=>1,'col_cell_name'=>'B','col_name'=>'EMP ID','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'name_of_emp_dep'=>['col_idx'=>2,'col_cell_name'=>'C','col_name'=>'NAME OF EMP/DEP','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'dob'=>['col_idx'=>3,'col_cell_name'=>'D','col_name'=>'DOB','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'custom'=>'check_dob_diff','params'=>['row','relationship']],'gender'=>['col_idx'=>4,'col_cell_name'=>'E','col_name'=>'Gender','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>['M','F']],'relationship'=>['col_idx'=>5,'col_cell_name'=>'F','col_name'=>'RELATIONSHIP','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_relationship','params'=>['row','relationship']],'basic_cover_si'=>['col_idx'=>6,'col_cell_name'=>'G','col_name'=>'BASIC COVER SI','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom' => 'check_si','params' => ['row','policy_terms','slab_details']],'doc'=>['col_idx'=>7,'col_cell_name'=>'H','col_name'=>'Date of Coverage','is_mandatory'=>['A','DA'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'params'=>['row']],'doj'=>['col_idx'=>8,'col_cell_name'=>'I','col_name'=>'DOJ','is_mandatory'=>false,'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'custom'=>'check_doj','params'=>['row']],'basic_pay'=>['col_idx'=>9,'col_cell_name'=>'J','col_name'=>'Basic Pay','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_basic_pay','params'=>['row','policy_terms','slab_details']],'band_grade'=>['col_idx'=>10,'col_cell_name'=>'K','col_name'=>'Band/Grade','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_employee_band','params'=>['row','policy_terms','slab_details']],'designation'=>['col_idx'=>11,'col_cell_name'=>'L','col_name'=>'Designation','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'phone'=>['col_idx'=>12,'col_cell_name'=>'M','col_name'=>'Phone','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'email'=>['col_idx'=>13,'col_cell_name'=>'N','col_name'=>'Email','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'pre_existing_ailments'=>['col_idx'=>14,'col_cell_name'=>'O','col_name'=>'PRE EXISTING AILMENTS','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>['0','1']],'change_event'=>['col_idx'=>15,'col_cell_name'=>'P','col_name'=>'Change event','is_mandatory'=>['A','DA','D'],'data_type'=>'str','format'=>null,'allowed_values'=>null],'date_of_exit'=>['col_idx'=>16,'col_cell_name'=>'Q','col_name'=>'Date of exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null],'reason_for_exit'=>['col_idx'=>17,'col_cell_name'=>'R','col_name'=>'Reason for exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>null,'allowed_values'=>null]];
+ protected $inception_excel_columns = ['sno'=>['col_idx'=>0,'col_cell_name'=>'A','col_name'=>'S.No','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'emp_id'=>['col_idx'=>1,'col_cell_name'=>'B','col_name'=>'EMP ID','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'name_of_emp_dep'=>['col_idx'=>2,'col_cell_name'=>'C','col_name'=>'NAME OF EMP/DEP','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'dob'=>['col_idx'=>3,'col_cell_name'=>'D','col_name'=>'DOB','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'custom'=>'check_dob_diff','params'=>['row','relationship']],'gender'=>['col_idx'=>4,'col_cell_name'=>'E','col_name'=>'Gender','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>['M','F']],'relationship'=>['col_idx'=>5,'col_cell_name'=>'F','col_name'=>'RELATIONSHIP','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_relationship','params'=>['row','relationship','policy_terms']],'basic_cover_si'=>['col_idx'=>6,'col_cell_name'=>'G','col_name'=>'BASIC COVER SI','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom' => 'check_si','params' => ['row','policy_terms','slab_details']],'doc'=>['col_idx'=>7,'col_cell_name'=>'H','col_name'=>'Date of Coverage','is_mandatory'=>['A','DA'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'params'=>['row']],'doj'=>['col_idx'=>8,'col_cell_name'=>'I','col_name'=>'DOJ','is_mandatory'=>false,'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'custom'=>'check_doj','params'=>['row']],'basic_pay'=>['col_idx'=>9,'col_cell_name'=>'J','col_name'=>'Basic Pay','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_basic_pay','params'=>['row','policy_terms','slab_details']],'band_grade'=>['col_idx'=>10,'col_cell_name'=>'K','col_name'=>'Band/Grade','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_employee_band','params'=>['row','policy_terms','slab_details']],'designation'=>['col_idx'=>11,'col_cell_name'=>'L','col_name'=>'Designation','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'phone'=>['col_idx'=>12,'col_cell_name'=>'M','col_name'=>'Phone','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'email'=>['col_idx'=>13,'col_cell_name'=>'N','col_name'=>'Email','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'pre_existing_ailments'=>['col_idx'=>14,'col_cell_name'=>'O','col_name'=>'PRE EXISTING AILMENTS','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>['0','1']],'change_event'=>['col_idx'=>15,'col_cell_name'=>'P','col_name'=>'Change event','is_mandatory'=>['A','DA','D'],'data_type'=>'str','format'=>null,'allowed_values'=>null],'date_of_exit'=>['col_idx'=>16,'col_cell_name'=>'Q','col_name'=>'Date of exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null],'reason_for_exit'=>['col_idx'=>17,'col_cell_name'=>'R','col_name'=>'Reason for exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>null,'allowed_values'=>null]];
protected $deletion_excel_columns = ['sno'=>['col_idx'=>0,'col_cell_name'=>'A','col_name'=>'S.No','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'emp_id'=>['col_idx'=>1,'col_cell_name'=>'B','col_name'=>'EMP ID','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'name_of_emp_dep'=>['col_idx'=>2,'col_cell_name'=>'C','col_name'=>'NAME OF EMP/DEP','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'change_event'=>['col_idx'=>3,'col_cell_name'=>'D','col_name'=>'Change event','is_mandatory'=>['D'],'data_type'=>'str','format'=>null,'allowed_values'=>null],'date_of_exit'=>['col_idx'=>4,'col_cell_name'=>'E','col_name'=>'Date of exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null],'reason_for_exit'=>['col_idx'=>5,'col_cell_name'=>'F','col_name'=>'Reason for exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>null,'allowed_values'=>null]];
@@ -142,7 +142,10 @@ class EmployeeServiceController extends AdminController
// get policy and rack details
$policy_terms = $this->clientPolicyModel->getPolicyDetails($file['client_id'],$file['policy_id']);
- $policy_terms = (array) $policy_terms[0];// convert obj to array
+ $policy_terms = json_decode($policy_terms[0]->policy_terms);
+ $policy_terms = (array) $policy_terms;// convert obj to array
+ //
+ // dd($policy_terms);
//get policy slab rates
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($file['policy_id'],$file['client_id']);
@@ -318,7 +321,7 @@ class EmployeeServiceController extends AdminController
// get policy and rack details
$policy_terms = $this->clientPolicyModel->getPolicyDetails($file['client_id'],$file['policy_id']);
- // dd($policy_terms);
+ // dd($this->clientPolicyModel->getLastQuery());
$policy_terms = json_decode($policy_terms[0]->policy_terms);
$policy_terms = (array) $policy_terms;// convert obj to array
// dd($policy_terms);
@@ -369,6 +372,17 @@ class EmployeeServiceController extends AdminController
}
}
}
+
+ if($file['action'] == 'inception')
+ {
+ $res = check_self_available_in_family($family,$file['action']);
+ // dd($res);
+ if(!$res['is_self_found'])
+ {
+ array_push($result['error_summary'],14); // Self not found
+ $result['error_data'][ $res['emp_code'] ]['name_of_emp_dep']['error'][] = "Self not found ";
+ }
+ }
if($file['action'] == 'dependent_addition' || $file['action'] == 'addition' || $file['action'] == 'inception')
@@ -387,7 +401,7 @@ class EmployeeServiceController extends AdminController
//check dup with empid and name with db
$res = name_and_empid_check_in_db($family,$file);
- // dd($file);
+ // dd($res);
// echo ' ';
// print_r($res);
if(count($res['del']))
@@ -447,8 +461,8 @@ class EmployeeServiceController extends AdminController
$job_details = new Jobs();
$r = Jobs::addJob(['job_name' => 'employeesOnboardPreprocess','payload' => ['file_id' => $file_id]]);
- $jobWorker = new JobWorker();
- JobWorker::processJob($r);
+ // $jobWorker = new JobWorker();
+ // JobWorker::processJob($r);
}
return $result;
@@ -530,8 +544,13 @@ class EmployeeServiceController extends AdminController
$data = calculate_premimum($family,$policy_terms,$slab_details,$file);
// dd($data);
$employee_data_group_by_family[$emp_id] = $data;
- //$this->employeesOnboardProcess(['familiy_data' => $data,'file' => $file]);
+ $this->employeesOnboardProcess(['familiy_data' => $data,'file' => $file]);
}
+
+ $this->fileModel->where('id', $file_id)->set(['status' => 'success','reason' => ''])->update();
+ $this->myLogger->logme("error",'{file_id} uploaded success',['file_id' => $file_id]);
+
+
}
else if(isset($params['client_policy_id']))//handle data from enrollment to inception
{
@@ -547,7 +566,7 @@ class EmployeeServiceController extends AdminController
//get policy slab rates
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($client_policy_id,$client_id);
- $existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(client_id: $client_id,client_policy_id: $client_policy_id,emp_status: 'draft');
+ $existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(client_id: $client_id,client_policy_id: $client_policy_id,emp_status: 'enrolled');
$file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception'];
// dd($this->employeeModel->getLastQuery());
@@ -663,6 +682,9 @@ class EmployeeServiceController extends AdminController
// print_r($endorsement_data);
}
+
+ $this->fileModel->where('id', $file_id)->set(['status' => 'success','reason' => ''])->update();
+ $this->myLogger->logme("error",'{file_id} uploaded success',['file_id' => $file_id]);
return $endorsement_data;
}
@@ -721,6 +743,8 @@ class EmployeeServiceController extends AdminController
}
+ $this->fileModel->where('id', $file_id)->set(['status' => 'success','reason' => ''])->update();
+ $this->myLogger->logme("error",'{file_id} uploaded success',['file_id' => $file_id]);
return true;
}
@@ -789,6 +813,8 @@ class EmployeeServiceController extends AdminController
}
+ $this->fileModel->where('id', $file_id)->set(['status' => 'success','reason' => ''])->update();
+ $this->myLogger->logme("error",'{file_id} uploaded success',['file_id' => $file_id]);
return true;
}
@@ -917,9 +943,10 @@ class EmployeeServiceController extends AdminController
public function getExcelErrorData($file_id){
+ try {
$file = $this->fileModel->find($file_id);
$error_data = json_decode($file['reason']);
-
+ // dd($error_data);
// return $error_data;
$file_name_with_path = WRITEPATH."/uploads/excel/".$file['file_name'];
@@ -939,7 +966,7 @@ class EmployeeServiceController extends AdminController
$excelErrorData['excel_header'] = $excel_data[0];
unset($excel_data[0]);
// echo '';
-
+ // Kint::dump($excel_data);
if($error_data->error_type == 1){
$finalArray = [];
@@ -982,13 +1009,24 @@ class EmployeeServiceController extends AdminController
}
}
-
+ // dd(array_keys($allErrors));
foreach ($allErrors as $key => $value){
- $data = ['value' => $excel_data[$key][1], 'error'=>$value,];
- $excel_data[$key][1] = $data;
- array_push($typeTowArray, $excel_data[$key]);
+ // echo $key;
+ // print_r($value);
+ foreach($excel_data as $excel_data_index => $excel_data_value)
+ {
+ if($excel_data_value[0] == $key)
+ {
+ $data = ['value' => $excel_data[$excel_data_index][1], 'error'=>$value,];
+ $excel_data[$excel_data_index][1] = $data;
+ array_push($typeTowArray, $excel_data[$excel_data_index]);
+ break;
+ }
+ }
+
+
}
-
+ // dd($data);
foreach ($typeTowArray as $fkey => $value){
foreach ($value as $vkey => $arrayData){
if(!is_array($arrayData)){
@@ -1003,6 +1041,13 @@ class EmployeeServiceController extends AdminController
}
+ }catch (\Exception $e) {
+ // Handle any exceptions
+ $errorMessage = $e->getMessage();//die();
+ $this->myLogger->logme('error', $errorMessage);
+ return false; // You can return an error response here
+ }
+
}
diff --git a/app/Controllers/JobWorker.php b/app/Controllers/JobWorker.php
index 6977a94b..00b060ae 100644
--- a/app/Controllers/JobWorker.php
+++ b/app/Controllers/JobWorker.php
@@ -14,7 +14,7 @@ class JobWorker extends AdminController
* Constructs the class
*/
- private static $event_class_mapping = ['add' => ['type' => 'HC','handler' => 'App\\Helpers\\HttpRequestHelper'], 'sub' => ['type' => 'CC','handler' => 'App\\Controllers\\Jobs\SubJob'],'fancy_date_time_format' => [ 'type' => 'HF','handler' => 'fancy_date_time_format'],'addNumber' => ['type' => 'HC','handler' => 'App\\Model\\HttpRequestHelper'],'excelFileFormatValidation' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'excelFileDataValidation' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'employeeOnboard' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'send_email' => ['type' => 'HC','handler' => 'App\\Helpers\\MailHelper'],'bulk_mail' => ['type' => 'HC','handler' => 'App\\Helpers\\MailHelper']];
+ private static $event_class_mapping = ['add' => ['type' => 'HC','handler' => 'App\\Helpers\\HttpRequestHelper'], 'sub' => ['type' => 'CC','handler' => 'App\\Controllers\\Jobs\SubJob'],'fancy_date_time_format' => [ 'type' => 'HF','handler' => 'fancy_date_time_format'],'addNumber' => ['type' => 'HC','handler' => 'App\\Model\\HttpRequestHelper'],'excelFileFormatValidation' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'excelFileDataValidation' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'employeesOnboardPreprocess' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'employeeDisembark' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'employeesSIEnhanceProcess' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'employeesCorrectionProcess' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'send_email' => ['type' => 'HC','handler' => 'App\\Helpers\\MailHelper'],'bulk_mail' => ['type' => 'HC','handler' => 'App\\Helpers\\MailHelper']];
public function __construct()
{
// echo 'HiC';//die();
diff --git a/app/Helpers/excel_import_export_helper.php b/app/Helpers/excel_import_export_helper.php
index e840fded..ffb72f4c 100644
--- a/app/Helpers/excel_import_export_helper.php
+++ b/app/Helpers/excel_import_export_helper.php
@@ -77,7 +77,7 @@ if (!function_exists('generate_excel')) {
if($totals == 1){
// Call the helper function for Calculate GST, Pro Rata Premium, and Total sums for inception
- add_totals_row($spreadsheet, $data);
+ add_totals_row($spreadsheet, $data, $headers);
}else if($totals == 2){
add_totals_for_deletion($spreadsheet, $data);
}
@@ -268,25 +268,39 @@ if (! function_exists('transform_objects_to_array_for_deletion')) {
if (!function_exists('add_totals_row')) {
- function add_totals_row(Spreadsheet $spreadsheet, array $data)
- {
+ function add_totals_row(Spreadsheet $spreadsheet, array $data, array $headers)
+ {
+
+ //find the index value
+ $rata = array_search('PRO RATA PREMIUM', $headers);
+ $gst = array_search('GST', $headers);
+ $total = array_search('TOTAL', $headers);
+
+
// Calculate GST, Pro Rata Premium, and Total sums
$gstSum = 0;
$proRataPremiumSum = 0;
$totalSum = 0;
foreach ($data as $row) {
- $gstSum += $row[18];
- $proRataPremiumSum += $row[19];
- $totalSum += $row[20];
+ $gstSum += $row[$gst];
+ $proRataPremiumSum += $row[$rata];
+ $totalSum += $row[$total];
}
+ $cellValue = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
+ $prev_index = $rata - 1;
+ $cellValueTotal = $cellValue[$prev_index];
+ $cellValueRata = $cellValue[$rata];
+ $cellValueGST = $cellValue[$gst];
+ $cellValueTotalSum = $cellValue[$total];
+
// Add a new row with sums
$lastRow = count($data) + 1; // To get the last row number
- $spreadsheet->getActiveSheet()->setCellValue('R' . ($lastRow + 1), 'TOTALS');
- $spreadsheet->getActiveSheet()->setCellValue('S' . ($lastRow + 1), $gstSum);
- $spreadsheet->getActiveSheet()->setCellValue('T' . ($lastRow + 1), $proRataPremiumSum);
- $spreadsheet->getActiveSheet()->setCellValue('U' . ($lastRow + 1), $totalSum);
+ $spreadsheet->getActiveSheet()->setCellValue($cellValueTotal . ($lastRow + 1), 'TOTALS');
+ $spreadsheet->getActiveSheet()->setCellValue($cellValueRata . ($lastRow + 1), $proRataPremiumSum);
+ $spreadsheet->getActiveSheet()->setCellValue($cellValueGST . ($lastRow + 1), $gstSum);
+ $spreadsheet->getActiveSheet()->setCellValue($cellValueTotalSum . ($lastRow + 1), $totalSum);
}
}
@@ -405,6 +419,19 @@ if (!function_exists('remove_underscore_capitalize_first_letter')) {
}
if (!function_exists('formatDateOrReturn')) {
+
+ /**
+ * Formats a given value as a date or returns the original value if it's not a valid date.
+ *
+ * This function checks if the provided value is a valid date. If it is, it formats
+ * the date as 'd-M-Y' (day-month-year) format and returns it. If the value is not
+ * a valid date, it returns the original value unchanged.
+ *
+ * @param mixed $value The value to be formatted as a date or returned unchanged.
+ * @return string|mixed The formatted date if the value is a valid date, otherwise the original value.
+ */
+
+
function formatDateOrReturn($value)
{
// Check if the value is a valid date
diff --git a/app/Helpers/excel_util_helper.php b/app/Helpers/excel_util_helper.php
index 46ccf8ee..3d8b9421 100644
--- a/app/Helpers/excel_util_helper.php
+++ b/app/Helpers/excel_util_helper.php
@@ -67,7 +67,7 @@ if (!function_exists('check_excel_date_format')) {
if(!function_exists('check_relationship'))
{
- function check_relationship($row,$relationship)
+ function check_relationship($row,$relationship,$policy_terms)
{
// print_r($relationship);
// echo ' ';
@@ -78,21 +78,33 @@ if(!function_exists('check_relationship'))
$slug = \Config\Services::slug();
$col = $slug->slugify($row[5]);
// echo $col;//die();
- if($col != 'self' && $col != 'spouse')
- {
+ // if($col != 'self' && $col != 'spouse')
+ // {
if(!isset($relationship[ $col ]))
{
return array('status' => false,'error' => 'Rule Conflict: Unknown Relationship');
}
- if(isset($relationship[ $col ]) && $relationship[ $col ]['gender'] != $row[4])
+ $family_floaters = isset($policy_terms['family_floaters']);
+ if($family_floaters)
{
- $error = "Gender relationship conflict: Expected ".$relationship[ $col ]['gender'].", received $row[4]";
- return array('status' => false,'error' => $error);
+ if(isset($relationship[ $col ]) && $relationship[ $col ]['gender'] != $row[4])
+ {
+ $error = "Gender relationship conflict: Expected ".$relationship[ $col ]['gender'].", received $row[4]";
+ return array('status' => false,'error' => $error);
+ }
+ }
+ else // if family_floaters not set the its GPA, reject all other dependents
+ {
+ if($col != 'self')
+ {
+ $error = "Dependent(s) are not allowed";
+ return array('status' => false,'error' => $error);
+ }
}
- }
+ // }
return array('status' => true);
}
else
@@ -278,6 +290,26 @@ if (!function_exists('name_dup_check_within_family'))
}
}
+if (!function_exists('check_self_available_in_family'))
+{
+ function check_self_available_in_family($family_data)
+ {
+
+ $is_self_found = false;
+ foreach ($family_data as $rkey => $row)
+ {
+ if($row[5] != null && strtolower($row[5]) == 'self')//$row[5] = relationship $row[4] = Gender
+ {
+ $is_self_found = true;
+ break;
+ }
+
+ }
+
+ return ['is_self_found' => $is_self_found,'emp_code' => $family_data[0][1]];
+ }
+}
+
if (!function_exists('name_and_empid_check_in_db'))
@@ -295,13 +327,13 @@ if (!function_exists('name_and_empid_check_in_db'))
$res = $employeeModel
->join('client_policy cp',"employees.client_id = cp.client_id")
->join('employee_polices ep',"cp.id = ep.client_policy_id AND employees.id = ep.employee_id")
- ->where("cp.policy_id",$policy_id)
+ // ->where("cp.id",$policy_id)
->where("employees.client_id",$client_id)
// ->where("ep.client_id",$client_id)
->where('name',$row[2])->where('emp_code',$row[1])
->findAll();
- // dd($employeeModel);
+ // dd($employeeModel->getLastQuery());
if(($current_action == 'deletion' || $current_action == 'correction' || $current_action == 'si_enhancement') && !count($res))
@@ -338,7 +370,7 @@ if (!function_exists('check_dependent_conflict'))
$allowed_parent_in_laws_count = 0;
$received_parent_in_laws_count = 0;
$overall_famility_relationships = [];
- $self_emp_row_id = 0;
+ $self_emp_row_id = null;
$temp_counts = [2,3,4,5,6,7,8,9,10]; //temp variable for check relation repetaed count
$slug = \Config\Services::slug();
@@ -356,6 +388,7 @@ if (!function_exists('check_dependent_conflict'))
// dd($allowed_adults == 0);
foreach ($family_data as $key => $row)
{
+ // dd($family_data[0][0]);
$relationship = $slug->slugify($row[5]);
if($actionArr != 'deletion' && $relationship != 'son' && $relationship != 'daughter')
@@ -411,7 +444,7 @@ if (!function_exists('check_dependent_conflict'))
// print_r(array_values(array_count_values($overall_famility_relationships)));
// print_r(in_array(2,array_values(array_count_values($overall_famility_relationships))));
- if($self_gender == $spouse_gender)
+ if($self_gender && $spouse_gender && $self_gender == $spouse_gender)
{
$result['status'] = false;
$result['error_data'][] = ['code' => 4,'col_name' => 'gender','msg' => 'Rule conflict: Self and Spouse cannot be same gender','row_id' => (isset($self_emp_row_id) ? $self_emp_row_id : $family_data[0][0])];
@@ -793,7 +826,7 @@ if (!function_exists('premium_calculation_manager'))
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $max_age && $slab_value['age_to'] >= $max_age))
{
-
+ $emp_data['policy_details']['basic_cover_si'] = (strtolower($emp_data['relationship']) == 'self' ? $employee_received_si : null);
$emp_data['policy_details']['date_coverage'] = (strtolower($emp_data['relationship']) == 'self' ? (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']) : "");
$emp_data['policy_details']['policy_end_date'] = (strtolower($emp_data['relationship']) == 'self' ? $policy_terms['policy_end_date'] : "");
$emp_data['policy_details']['days'] = (strtolower($emp_data['relationship']) == 'self' ? calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days : 0);
@@ -807,7 +840,7 @@ if (!function_exists('premium_calculation_manager'))
break;
case "11":
//GMC - Maximum count per Family
- $max_count = $emp_data['temp']['maxage'];
+ $max_count = $emp_data['temp']['maxcount'];
$employee_received_band = $emp_data['temp']['band'];
$employee_received_si = $emp_data['policy_details']['basic_cover_si'];
$emp_data['policy_details']['basic_cover_si'] = null;
@@ -817,10 +850,10 @@ if (!function_exists('premium_calculation_manager'))
if($slab_value['si'] == $employee_received_si && ($slab_value['grade'] == $employee_received_band))
{
//calculate premium based on count
- $famility_si_covered = $employee_received_si * $max_count;
- $famility_si_covered = ($famility_si_covered >= $slab_value['max_si'] ? $slab_value['max_si'] : $famility_si_covered);
+ $familiy_si_covered = $employee_received_si * $max_count;
+ $familiy_si_covered = ($familiy_si_covered >= $slab_value['max_si'] ? $slab_value['max_si'] : $familiy_si_covered);
- $emp_data['policy_details']['basic_cover_si'] = (strtolower($emp_data['relationship']) == 'self' ? $famility_si_covered : 0);
+ $emp_data['policy_details']['basic_cover_si'] = (strtolower($emp_data['relationship']) == 'self' ? $familiy_si_covered : null);
$emp_data['policy_details']['date_coverage'] = (strtolower($emp_data['relationship']) == 'self' ? (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']) : "");
$emp_data['policy_details']['policy_end_date'] = (strtolower($emp_data['relationship']) == 'self' ? $policy_terms['policy_end_date'] : "");
$emp_data['policy_details']['days'] = (strtolower($emp_data['relationship']) == 'self' ? calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days : 0);
diff --git a/app/Models/ClientPolicyModel.php b/app/Models/ClientPolicyModel.php
index 8008ad8d..8ca450a4 100644
--- a/app/Models/ClientPolicyModel.php
+++ b/app/Models/ClientPolicyModel.php
@@ -34,6 +34,7 @@ class ClientPolicyModel extends Model
"policy_terms",
"open_for_enrollment",
"is_addon",
+ "base_policy",
"created_by",
"updated_by",
"Is_active",
@@ -249,4 +250,21 @@ public function getDepositlistsummary($id)
->getResult();
}
+
+public function updateStatus(){
+
+ // Update client_policy table
+ $client = $this->db->query("UPDATE client_policy SET policy_status = 0 WHERE policy_end_date < CURDATE()");
+ $client_count = $this->db->affectedRows();
+ // Update employee_polices table
+ $employee = $this->db->query("UPDATE employee_polices SET status = 'expired' WHERE policy_end_date < CURDATE()");
+ $emp_count = $this->db->affectedRows();
+
+ return ['client'=>$client_count, 'emp' => $emp_count];
+
+
}
+
+
+}
+
diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php
index 3cdd2177..a86eaeb8 100644
--- a/app/Models/EmployeePolicyModel.php
+++ b/app/Models/EmployeePolicyModel.php
@@ -643,4 +643,40 @@ 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'])
+ ->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('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);
+
+ $result->whereIn('employee_polices.status', ['draft', 'enrolled']);
+ $result = $result->findAll();
+ return ($result);
+ }
+
+
+ public function getViewEmpSuccessList($file_id){
+ return $this->db->table('employees emp')
+ ->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'])
+ ->join('employee_polices', '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('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.file_id',$file_id)
+ ->whereIn('employee_polices.status', ['draft', 'enrolled'])
+ ->get()->getResultArray();
+ }
}
\ No newline at end of file
diff --git a/app/Models/InsurerModel.php b/app/Models/InsurerModel.php
index 77ad5d49..c23804c1 100644
--- a/app/Models/InsurerModel.php
+++ b/app/Models/InsurerModel.php
@@ -11,6 +11,7 @@ class InsurerModel extends Model
protected $allowedFields = [
"id",
"type",
+ "category",
"name",
"short_name",
"created_by",
diff --git a/app/Views/batch_list.php b/app/Views/batch_list.php
index 2e31acd9..31b16548 100644
--- a/app/Views/batch_list.php
+++ b/app/Views/batch_list.php
@@ -12,6 +12,7 @@
SNO
Batch Code
+ File Name
Client
Client Policy
Event Type
@@ -31,6 +32,7 @@
+
diff --git a/app/Views/client_deposit_list.php b/app/Views/client_deposit_list.php
index a0956ff9..fb1adc40 100644
--- a/app/Views/client_deposit_list.php
+++ b/app/Views/client_deposit_list.php
@@ -75,12 +75,21 @@ $(document).ready(function() {
buttons: [{
extend: 'csv',
text: 'CSV',
- title: 'Client_Deposit',
+ title: 'Client Deposit Details - ' + ' ',
className: 'my_class',
exportOptions: {
columns: ':not(:last-child)'
},
- }],
+ },
+ {
+ extend: 'pdf',
+ text: 'PDF',
+ title: 'Client Deposit Details - ' + ' ',
+ exportOptions: {
+ columns: ':not(:last-child)'
+ },
+ }
+ ],
language: {
diff --git a/app/Views/client_onboarding.php b/app/Views/client_onboarding.php
index 668cbb35..bca575d2 100644
--- a/app/Views/client_onboarding.php
+++ b/app/Views/client_onboarding.php
@@ -28,6 +28,10 @@ body {
}
+.navtab-bg .nav-link {
+ margin: 0 5px 10px!important;
+}
+
diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php
index 45b5cd9d..27da989b 100644
--- a/app/Views/client_policy.php
+++ b/app/Views/client_policy.php
@@ -2,11 +2,12 @@
- Add Policy
+ Add Policy
-
+
@@ -26,75 +27,91 @@
+
+
+
@@ -153,6 +181,13 @@ $(document).ready(function() {
event.preventDefault(); // Prevent default form submission
console.log('submit called');
+
+ var isValid = $('#emp-upload-form').parsley().validate();
+ if (!isValid) {
+ console.log('Form is Empty', 'Warning');
+ return;
+ }
+
var action_item = $('#upload-action-type').val();
var policy_id = $('#policy_id').val();
console.log('action_item - ' + action_item);
@@ -161,8 +196,10 @@ $(document).ready(function() {
// $('#policy_id').prop('title', 'plz choose policy');
// $('#policy_id').mouseover();
console.log('required');
- alert('please choose policy for this uploaing event ');
+ // alert('please choose policy for this uploaing event ');
+ toastr.warning('please choose policy for this uploaing event', 'warning')
return false;
+
} else {
$('#policy_id').attr('required', false);
@@ -230,9 +267,6 @@ $(document).ready(function() {
$(window).on("load", function() {
console.log("window loaded");
fetchClientPolicies();
-
-
-
});
@@ -281,85 +315,109 @@ function fetchFileError(file_id) {
console.log('fetchFileError');
console.log(apiURL);
$.ajax({
- url: apiURL,
- method: 'GET',
- headers: {
- "X-Requested-With": "XMLHttpRequest"
- },
- success: function(response) {
-
- $(this).find(".modal-body").html("");
- if (response.code === 200 && response.dataStatus === true && response.data !== "")
- {
- try {
- console.log((JSON.parse(response.data)));
- var file_error_data = (JSON.parse(response.data));
- var file_error_html = "";
-
- for (var key in file_error_data['error_summary']) {
- console.log(key);
- var err_id = key;
- var err_count = file_error_data['error_summary'][key];
- switch (err_id) {
- case 1:
- file_error_html += "
Mandatory values missing " + err_count + " ";
- break;
- case 2:
- file_error_html += "
Values not in expected format " + err_count + " ";
- break;
- case 3:
- file_error_html += "
Field contains not allowed values " + err_count + " ";
- break;
- case 4:
- file_error_html += "
Rule Conflict " + err_count + " ";
- break;
- case 5:
- file_error_html += "
" + file_error_data['error_data'] + " ";
- break;
- case 6:
- file_error_html += "
" + file_error_data['error_data'] + " ";
- break;
- case 7:
- file_error_html += "
Duplicate entry in file " + err_count + " ";
- break;
- case 8:
- file_error_html += "to be config";
- break;
- case 9:
- file_error_html += "
Duplicate entry " + err_count + " ";
- break;
- case 10:
- file_error_html += "
Duplicate entry in file " + err_count + " ";
- break;
- case 11:
- file_error_html += "
Rule conflict: Dependents not allowed " + err_count + " ";
- break;
- case 12:
- file_error_html += "
Rule conflict: Dependent count greater than allowed dependent count " + err_count + " ";
- break;
- case 13:
- file_error_html += "
Rule conflict: Twofold relationship found within family " + err_count + " ";
- break;
+ url: apiURL,
+ method: 'GET',
+ headers: {
+ "X-Requested-With": "XMLHttpRequest"
+ },
+ success: function(response) {
- default:
- file_error_html += "";
- break;
- }
- file_error_html += (err_id == 1 ?
- "
Mandatory values missing " +
- err_count + " " : (err_id == 2 ?
- "
Values not in expected format " +
- err_count + " " : (err_id == 3 ?
+ $(this).find(".modal-body").html("");
+ if (response.code === 200 && response.dataStatus === true && response.data !== "") {
+ try {
+ console.log((JSON.parse(response.data)));
+ var file_error_data = (JSON.parse(response.data));
+ var file_error_html = "";
+
+ for (var key in file_error_data['error_summary']) {
+ // console.log(key);
+ var err_id = parseInt(key);
+ var err_count = file_error_data['error_summary'][key];
+ switch (err_id) {
+ case 1:
+ file_error_html +=
+ "
Mandatory values missing " +
+ err_count + " ";
+ break;
+ case 2:
+ file_error_html +=
+ "
Values not in expected format " +
+ err_count + " ";
+ break;
+ case 3:
+ file_error_html +=
"
Field contains not allowed values " +
- err_count + " " : (err_id == 4 ?
- "
Rule Conflict " +
- err_count + " " : (err_id == 5 ? "
" +
- file_error_data['error_data'] + " " : (err_id ==
- 6 ?
- "
" + file_error_data['error_data'] +
- " " : ""))))));
+ err_count + "";
+ break;
+ case 4:
+ file_error_html +=
+ "
Rule Conflict " +
+ err_count + " ";
+ break;
+ case 5:
+ file_error_html += "
" + file_error_data['error_data'] + " ";
+ break;
+ case 6:
+ file_error_html += "
" + file_error_data['error_data'] + " ";
+ break;
+ case 7:
+ file_error_html +=
+ "
Duplicate entry in file " +
+ err_count + " ";
+ break;
+ case 8:
+ file_error_html += "to be config";
+ break;
+ case 9:
+ file_error_html +=
+ "
Duplicate entry " +
+ err_count + " ";
+ break;
+ case 10:
+ file_error_html +=
+ "
Duplicate entry in file " +
+ err_count + " ";
+ break;
+ case 11:
+ file_error_html +=
+ "
Rule conflict: Dependents not allowed " +
+ err_count + " ";
+ break;
+ case 12:
+ file_error_html +=
+ "
Rule conflict: Dependent count greater than allowed dependent count " +
+ err_count + " ";
+ break;
+ case 13:
+ file_error_html +=
+ "
Rule conflict: Twofold relationship found within family " +
+ err_count + " ";
+ break;
+
+ default:
+ file_error_html += "";
+ break;
+ }
+
+ // console.log('file_error_html_1', file_error_html)
+
+ // file_error_html += (err_id == 1 ?
+ // "
Mandatory values missing " +
+ // err_count + " " : (err_id == 2 ?
+ // "
Values not in expected format " +
+ // err_count + " " : (err_id == 3 ?
+ // "
Field contains not allowed values " +
+ // err_count + " " : (err_id == 4 ?
+ // "
Rule Conflict " +
+ // err_count + " " : (err_id == 5 ? "
" +
+ // file_error_data['error_data'] + " " : (err_id ==
+ // 6 ?
+ // "
" + file_error_data['error_data'] +
+ // " " : ""))))));
file_error_html += '
';
- // }
+ // // }
+
+ // console.log('file_error_html_2', file_error_html)
}
if (err_id != 5 && err_id != 6) {
@@ -369,7 +427,7 @@ function fetchFileError(file_id) {
"' target=_blank>click here to more details..." : "");
}
- console.log(file_error_html);
+ // console.log(file_error_html);
$('#file-err-modal').find(".modal-body").html(file_error_html);
return file_error_html;
} catch (error) {
@@ -439,7 +497,7 @@ function fetchEmpolyeeList(event) {
var policy_id = $('#policy_id').val();
console.log(client_id + '-' + policy_id);
if (client_id == '0' || policy_id == '0') {
- alert('Please select values in both dropdowns.');
+ toastr.warning('Please select values in both dropdowns.');
return;
}
@@ -508,5 +566,70 @@ document.getElementById('toggleIcon1').addEventListener('click', function() {
icon.classList.toggle('mdi-chevron-down');
icon.classList.toggle('mdi-chevron-up');
});
+
+$('#fetch_enrolled_data').click(function(){
+
+ $('#emp_data').empty();
+ var client_id = $('#client_id').val();
+ var policy_id = $('#policy_id').val();
+ var action = $('#upload-action-type').val();
+ console.log(client_id + '-' + policy_id);
+ if (client_id == '0' || policy_id == '0') {
+ toastr.warning('please select the client and policy for this uploaing event', 'warning')
+ $('#full-width-modal').modal('hide');
+ return;
+ }
+
+ var queryParams = {
+ client_id: client_id,
+ policy_id: policy_id,
+ action: action
+ };
+
+ console.log('queryParams', queryParams)
+ const queryString = objectToQueryString(queryParams);
+ console.log('queryString', queryString)
+
+ $('.loader').fadeIn();
+ $('.loader-mask').fadeIn();
+ var uri = '= base_url('util/featch-emp-list')?>?'+queryString
+ console.log(uri)
+
+ $.ajax({
+ url:uri,
+ data: {
+ client_id: client_id,
+ policy_id: policy_id
+ },
+ type: "GET",
+ dataType: 'json',
+ processData: false,
+ contentType: false,
+ success: function(res) {
+
+ console.log(res);
+
+ if (res) {
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ }, 1000);
+ }
+
+ $('#emp_data').html(res.data);
+ },
+ error: function(xhr, status, error) {
+ console.error(xhr.responseText);
+ console.error(status, error);
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ toastr.warning('Something went wrong', 'Warning');
+
+ }, 1000);
+ }
+ });
+
+})
//--------------------------------------------------------------------------------------
\ No newline at end of file
diff --git a/app/Views/excel_errors.php b/app/Views/excel_errors.php
index 25b100ad..0e8b070e 100644
--- a/app/Views/excel_errors.php
+++ b/app/Views/excel_errors.php
@@ -1,3 +1,5 @@
+
/assets/images/Nhance_Favi.svg">
+
Excel Error Report
diff --git a/app/Views/file_list.php b/app/Views/file_list.php
index 508cf00e..f0518ffb 100644
--- a/app/Views/file_list.php
+++ b/app/Views/file_list.php
@@ -1,14 +1,26 @@
+
+
-
-
-
-
-
-
-
+
+
+
+
+
-
-
+
+
+
+
SNO
File name
@@ -17,11 +29,12 @@
Event
User/Time
Status
+ Action
-
+
-
-
+ $file) { //print_r((json_decode($file['reason'])));
@@ -29,23 +42,258 @@
// $reason = "{'date':'value data kbckl kcn/aksl'}";
// echo $reason;
?>
-
-
-
-
-
-
-
- '.$file['first_name'].''?>
- ";
- }?>
-
-
-
-
-
-
+
+
+
+
+
+
+
+ '.$file['first_name'].''?>
+
+
+ ";
+
+ }else if( $file['status'] == 'inprogress'){
+
+ echo '' . $file['status'] . ' ';
+
+ }else{
+ echo $file['status'];
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/insurer_basic_info.php b/app/Views/insurer_basic_info.php
index b350522c..52421c87 100644
--- a/app/Views/insurer_basic_info.php
+++ b/app/Views/insurer_basic_info.php
@@ -2,38 +2,56 @@
+
@@ -451,18 +452,18 @@
-
diff --git a/app/Views/login.php b/app/Views/login.php
index a16a0206..e6519f06 100644
--- a/app/Views/login.php
+++ b/app/Views/login.php
@@ -3,13 +3,14 @@
-
nHANCE
+
NHANCE
+
-
/assets/images/favicon.ico">
+
/assets/images/Nhance_Favi.svg">
/assets/css/bootstrap-material.min.css" rel="stylesheet" type="text/css"
diff --git a/app/Views/view_deposit.php b/app/Views/view_deposit.php
index c3d40f84..e004bb33 100644
--- a/app/Views/view_deposit.php
+++ b/app/Views/view_deposit.php
@@ -111,11 +111,10 @@
- created_at)); ?>
+ created_at)); ?>
username; ?>
description; ?>
- sub_type]) ? $subTypeOptions[$row->sub_type] : ''; ?>
-
+ sub_type]) ? $subTypeOptions[$row->sub_type] : ''; ?>
transaction_type == 'Credit') ? $row->amount : ''; ?>
transaction_type == 'Debit') ? $row->amount : ''; ?>
balance; ?>
@@ -229,7 +228,16 @@ $(document).ready(function() {
exportOptions: {
columns: ''
}
- }],
+ },
+ {
+ extend: 'pdf',
+ text: 'PDF',
+ title: 'TransactionDetails',
+ exportOptions: {
+ columns: ''
+ }
+ }
+ ],
language: {
diff --git a/app/Views/view_file_upload_emp_list.php b/app/Views/view_file_upload_emp_list.php
new file mode 100644
index 00000000..11554d1f
--- /dev/null
+++ b/app/Views/view_file_upload_emp_list.php
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/public/assets/images/Nhance_Favi.png b/public/assets/images/Nhance_Favi.png
new file mode 100644
index 00000000..f3607983
Binary files /dev/null and b/public/assets/images/Nhance_Favi.png differ
diff --git a/public/assets/images/Nhance_Favi.svg b/public/assets/images/Nhance_Favi.svg
new file mode 100644
index 00000000..a281e4b7
--- /dev/null
+++ b/public/assets/images/Nhance_Favi.svg
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/public/assets/images/Nhance_Favi_white.png b/public/assets/images/Nhance_Favi_white.png
new file mode 100644
index 00000000..017226c1
Binary files /dev/null and b/public/assets/images/Nhance_Favi_white.png differ
diff --git a/public/assets/images/Nhance_Favi_white_2.png b/public/assets/images/Nhance_Favi_white_2.png
new file mode 100644
index 00000000..2c4dcb4b
Binary files /dev/null and b/public/assets/images/Nhance_Favi_white_2.png differ
diff --git a/public/assets/images/nhance-loader-fast.gif b/public/assets/images/nhance-loader-fast.gif
new file mode 100644
index 00000000..2ecd8e3a
Binary files /dev/null and b/public/assets/images/nhance-loader-fast.gif differ
diff --git a/public/assets/images/nhance-loader.gif b/public/assets/images/nhance-loader.gif
new file mode 100644
index 00000000..ed96c651
Binary files /dev/null and b/public/assets/images/nhance-loader.gif differ
diff --git a/public/assets/images/nhance_white_logo.svg b/public/assets/images/nhance_white_logo.svg
new file mode 100644
index 00000000..fa63c18d
--- /dev/null
+++ b/public/assets/images/nhance_white_logo.svg
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/public/sample_excel/inception.xls b/public/sample_excel/inception.xls
deleted file mode 100644
index 850d8d06..00000000
Binary files a/public/sample_excel/inception.xls and /dev/null differ
diff --git a/public/sample_excel/inception_1.xls b/public/sample_excel/inception_1.xls
deleted file mode 100644
index 850d8d06..00000000
Binary files a/public/sample_excel/inception_1.xls and /dev/null differ
diff --git a/public/sample_excel/inception_2.xls b/public/sample_excel/inception_2.xls
deleted file mode 100644
index 850d8d06..00000000
Binary files a/public/sample_excel/inception_2.xls and /dev/null differ
diff --git a/public/sample_excel/inception_3.xls b/public/sample_excel/inception_3.xls
deleted file mode 100644
index 850d8d06..00000000
Binary files a/public/sample_excel/inception_3.xls and /dev/null differ
diff --git a/public/sample_excel/sample_addition.xls b/public/sample_excel/sample_addition.xls
new file mode 100644
index 00000000..934df3cd
Binary files /dev/null and b/public/sample_excel/sample_addition.xls differ
diff --git a/public/sample_excel/sample_correction .xls b/public/sample_excel/sample_correction .xls
new file mode 100644
index 00000000..744769c1
Binary files /dev/null and b/public/sample_excel/sample_correction .xls differ
diff --git a/public/sample_excel/sample_deletion.xls b/public/sample_excel/sample_deletion.xls
new file mode 100644
index 00000000..8146a3df
Binary files /dev/null and b/public/sample_excel/sample_deletion.xls differ
diff --git a/public/sample_excel/sample_dependent_addition.xls b/public/sample_excel/sample_dependent_addition.xls
new file mode 100644
index 00000000..7e0dd112
Binary files /dev/null and b/public/sample_excel/sample_dependent_addition.xls differ
diff --git a/public/sample_excel/sample_inception.xls b/public/sample_excel/sample_inception.xls
new file mode 100644
index 00000000..934df3cd
Binary files /dev/null and b/public/sample_excel/sample_inception.xls differ
diff --git a/public/sample_excel/sample_si_enhancement.xls b/public/sample_excel/sample_si_enhancement.xls
new file mode 100644
index 00000000..3149edc9
Binary files /dev/null and b/public/sample_excel/sample_si_enhancement.xls differ
diff --git a/tests/unit/CheckFormateDataTest.php b/tests/unit/CheckFormateDataTest.php
new file mode 100644
index 00000000..d1fa2c01
--- /dev/null
+++ b/tests/unit/CheckFormateDataTest.php
@@ -0,0 +1,40 @@
+ 12,
+ 'client_policy_id' => 12,
+ 'insurer_or_tpa' => 'insurer',
+ 'event_type' => 'inception',
+ 'actions' => 'export',
+ 'file_name' => 'TCS_HealthFlex_Advantage_Policy_IEI_06-04-2024_17-42-31.xlsx',
+ ];
+
+ $empServiceController = new EmpDataServiceController();
+ $result = $empServiceController->generateExcelForAdditionAndInception($batch_data);
+
+ // You can add assertions here to verify the result if needed
+ $this->assertTrue($result);
+ }
+}