diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 6c454276..007d80c1 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,8 @@ $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->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..5aa1b072 100644
--- a/app/Controllers/EmployeeController.php
+++ b/app/Controllers/EmployeeController.php
@@ -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');
}
}
diff --git a/app/Controllers/EmployeeServiceController.php b/app/Controllers/EmployeeServiceController.php
index 9ee925a8..fbe7bd89 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);
@@ -387,7 +390,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 +450,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;
@@ -552,7 +555,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());
@@ -929,6 +932,7 @@ class EmployeeServiceController extends AdminController
public function getExcelErrorData($file_id){
+ try {
$file = $this->fileModel->find($file_id);
$error_data = json_decode($file['reason']);
@@ -1015,6 +1019,13 @@ class EmployeeServiceController extends AdminController
}
+ }catch (\Exception $e) {
+ // Handle any exceptions
+ $errorMessage = $e->getMessage();
+ $this->myLogger->logme('error', $errorMessage);
+ return false; // You can return an error response here
+ }
+
}
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 534c4b61..a77d1e02 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
@@ -295,13 +307,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 +350,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 +368,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 +424,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])];
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/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 @@
-
+
-
+
@@ -26,75 +27,91 @@
-
+
-
+
-
+
-
@@ -116,85 +133,208 @@
\ No newline at end of file
diff --git a/app/Views/employee_upload.php b/app/Views/employee_upload.php
index 16e5d66d..f068f4cc 100644
--- a/app/Views/employee_upload.php
+++ b/app/Views/employee_upload.php
@@ -297,8 +297,8 @@ function fetchFileError(file_id) {
var file_error_html = "";
for (var key in file_error_data['error_summary']) {
- console.log(key);
- var err_id = key;
+ // console.log(key);
+ var err_id = parseInt(key);
var err_count = file_error_data['error_summary'][key];
switch (err_id) {
case 1:
@@ -345,21 +345,26 @@ function fetchFileError(file_id) {
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 ?
- "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'] +
- "" : ""))))));
+
+ // 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 +374,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) {
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 @@
-