diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index 56c21139..0cab8d81 100644
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -211,6 +211,10 @@ $routes->group("/util", ["filter" => "authMVC"], function($routes){
$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->get("fetch-policy-for-policy-type", "ClientController::fetchPolicyDataForPolicyType/$1");
});
@@ -232,11 +236,14 @@ $routes->group("/api", ["filter" => "authJWT"], function($routes){
});
+
$routes->get("/getEmployeeProfile", "EmployeeRestController::getEmployeeProfile/$1");
$routes->post("/editEmployeeProfile", "EmployeeRestController::editEmployeeProfile");
$routes->post("/calculatePremium", "EmployeeRestController::calculatePremium");
$routes->group("employeeRest", ["filter" => "authJWT"], function($routes){
+
+ $routes->get("getEmployeeProfile", "EmployeeRestController::getEmployeeProfile");
$routes->post("employeeUpload", "EmployeeRestController::employeeUpload");
$routes->get("relationshipList", "EmployeeRestController::relationshipList");
$routes->get("getEmployeeAndDependence", "EmployeeRestController::getEmployeeAndDependence");
diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php
index 7a2b274e..0e141e75 100644
--- a/app/Controllers/ClientController.php
+++ b/app/Controllers/ClientController.php
@@ -150,7 +150,6 @@ class ClientController extends AdminController
public function clientOnboarding()
{
-
$this->myLogger->logme('error','Client Onboarding function called');
$headerData['page_name'] = 'Client Onboarding';
@@ -162,6 +161,7 @@ class ClientController extends AdminController
$data['state'] = $this->stateModel->getAllStates();
$data['RM'] = $this->userModel->findAll();
$data['policyGridData'] = $this->policyGridModel->findAll();
+ $data['policy_type'] = ['1'=>'Base Policy', '2' => 'SI Topup', '3' => 'Dependent Addon'];
// echo "
";
// print_r($data); die;
@@ -196,7 +196,8 @@ class ClientController extends AdminController
$subTypeOptions = [
1 => 'Deposit',
2 => 'Adjustment',
- 3 => 'Deletion',
+ 3 => 'Refund',
+ 4 => 'Debit',
// Add more options as needed
];
$data['subTypeOptions'] = $subTypeOptions;
@@ -243,7 +244,7 @@ class ClientController extends AdminController
public function editClientOnboarding($id = null)
- {
+ {
$this->myLogger->logme('error','Edit Client Onboarding function called');
$headerData['page_name'] = 'Edit Client Onboarding';
@@ -256,6 +257,7 @@ class ClientController extends AdminController
$editData['insurer'] = $this->insurerBranchModel ->getInsurerBranchesWithInsurerNames();
$editData['kyc_docs'] = $this->kycDocsModel->findAll();
$editData['policyGridData'] = $this->policyGridModel->findAll();
+ $editData['policy_type'] = ['1'=>'Base Policy', '2' => 'SI Topup', '3' => 'Dependent Addon'];
$editData['client'] = $this->clientModel->where(['id' => $id])->first();
@@ -274,9 +276,8 @@ class ClientController extends AdminController
$editData['client_policy'] = $clientPoliceData;
-
// echo "";
- // print_r($clientPoliceData); die;
+ // dd($editData); die;
echo view('layout/header', $headerData);
echo view('client_onboarding', $editData);
@@ -576,6 +577,8 @@ class ClientController extends AdminController
$insurerValue = (string) $this->request->getPost('insurer');
list($insurerBranchId, $insurerId) = explode('-', $insurerValue);
+ $client_id = $this->request->getPost('client_id');
+
$data['insurer_branch_id'] = $insurerBranchId;
$data['insurer_id'] = $insurerId;
@@ -583,12 +586,11 @@ class ClientController extends AdminController
$tpaValue = (string) $this->request->getPost('tpa');
list($tpaBranchId, $tpaId) = explode('-', $tpaValue);
+ $data['client_id'] = $client_id;
$data['tpa_branch_id'] = $tpaBranchId;
$data['tpa_id'] = $tpaId;
$data['policy_id'] = $this->request->getPost('policy_id');
$data['policy_type_id'] = $this->request->getPost('policy_type_id');
- $data['client_id'] = $this->request->getPost('client_id');
-
$data['no_of_lives'] = $this->request->getPost('no_of_lives');
$data['policy_status'] = $this->request->getPost('policy_status');
@@ -602,29 +604,28 @@ 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');
+ $data['base_policy'] = $this->request->getPost('base_policy');
+ $data['policy_status'] = 1;
- if (!isset($data['is_addon'])) {
- $data['is_addon'] = 0;
- } elseif ($data['is_addon']) {
- $data['is_addon'] = 1;
- }
+ $policy_terms = $this->clientPolicyModel->where('id', $this->request->getPost('base_policy'))->first();
+
+ if ( $this->request->getPost('is_addon') == 2 || $this->request->getPost('is_addon') == 3) {
+ $data['policy_terms'] = $policy_terms['policy_terms'];
+ }
$data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d');
$data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd-m-Y', 'Y-m-d');
-
-
$data['created_by'] = get_session_userid();
$insert = $this->clientPolicyModel->insert($data);
if($insert){
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($this->request->getPost('client_id'));
- foreach ($clientPoliceData as $key => $value) {
+ // 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));
- }
+ // $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);
@@ -636,9 +637,12 @@ class ClientController extends AdminController
$this->myLogger->logme('error','Client policy function called');
+
$id = $this->request->getPost('PrimaryKey');
$client_id = $this->request->getPost('client_id');
+
+
$insurerValue = (string) $this->request->getPost('insurer');
list($insurerBranchId, $insurerId) = explode('-', $insurerValue);
@@ -649,6 +653,7 @@ class ClientController extends AdminController
list($tpaBranchId, $tpaId) = explode('-', $tpaValue);
$data['tpa_branch_id'] = $tpaBranchId;
+ $data['client_id'] = $client_id;
$data['tpa_id'] = $tpaId;
$data['policy_id'] = $this->request->getPost('policy_id');
$data['policy_type_id'] = $this->request->getPost('policy_type_id');
@@ -669,29 +674,30 @@ class ClientController extends AdminController
$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');
+ $data['policy_status'] = 1;
+ $policy_terms = $this->clientPolicyModel->where('id', $this->request->getPost('base_policy'))->first();
+ if ( $this->request->getPost('is_addon') == 2 || $this->request->getPost('is_addon') == 3) {
+ $data['policy_terms'] = $policy_terms['policy_terms'];
+ }
- if (!isset($data['is_addon'])) {
- $data['is_addon'] = 0;
- } elseif ($data['is_addon']) {
- $data['is_addon'] = 1;
- }
-
+ // dd($data);
$data['updated_by'] = get_session_userid();
$insert = $this->clientPolicyModel->update($id,$data);
$lastQuery = $this->clientPolicyModel->getLastQuery();
// echo '';
- // print_r($lastQuery); die;
+ // print_r($data); die;
if($insert){
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($client_id);
- foreach ($clientPoliceData as $key => $value) {
+
+ // 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));
- }
+ // $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);
@@ -704,6 +710,7 @@ class ClientController extends AdminController
$policy_type = $this->request->getPost('policy_type');
$client_id = $this->request->getPost('client_id');
$client_policy_id = $this->request->getPost('client_policy_id');
+ $premium_type = $this->request->getPost('premium_type');
if(!empty($client_id) && $client_id != null){
$client_policy_data = $this->clientPolicyModel->where('id', $client_policy_id)->first();
$client_id = $client_policy_data['client_id'];
@@ -719,6 +726,7 @@ class ClientController extends AdminController
$data['client_id'] = $client_id;
$data['client_policy_id'] = $client_policy_id;
$data['policy_grid_id'] = $policy_grid_id;
+ $data['premium_type'] = $premium_type;
$premium = [];
@@ -943,10 +951,9 @@ class ClientController extends AdminController
$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();
- $client_policy_list = $this->clientPolicyModel->select('policies.*')
- ->join('policies', 'policies.id = client_policy.policy_id')
- ->where('client_id', $client_id)
- ->findAll();
+ $client_policy_list = $this->clientPolicyModel->getpolicyWithPattern( $client_id );
+
+
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);
@@ -970,7 +977,7 @@ class ClientController extends AdminController
->where("employees.emp_status",'active')
->countAllResults();
- if($emp_count = 0){
+ if($emp_count == 0){
$emp_count = true;
}else{
$emp_count = false;
@@ -1252,7 +1259,7 @@ class ClientController extends AdminController
->where("employees.emp_status",'active')
->countAllResults();
- if($emp_count = 0){
+ if($emp_count == 0){
$emp_count = true;
}else{
$emp_count = false;
@@ -1366,7 +1373,8 @@ class ClientController extends AdminController
}
- public function updateClientPolicyStatus(){
+ public function updateClientPolicyStatus()
+ {
$client_policy_id = $this->request->getGet('client_policy_id');
$record = $this->clientPolicyModel->where('id', $client_policy_id)->first();
@@ -1437,12 +1445,10 @@ class ClientController extends AdminController
}
- public function getClientPolicyList($client_id = null){
+ 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();
+ $record = $this->clientPolicyModel->getpolicyWithPattern( $client_id);
if ($record) {
return $this->respond(['Status' => true,'code' => 200,'data' => $record], 200);
@@ -1451,4 +1457,38 @@ class ClientController extends AdminController
}
}
+
+
+ public function fetchPolicyDataForPolicyType($client_policy_id){
+
+ $client_policy_id = $this->request->getGet('client_policy_id');
+ $policy_type = $this->request->getGet('policy_type');
+
+ $client_id = $this->clientPolicyModel->where('id', $client_policy_id)->first();
+ $insurer_id = $client_id['insurer_id'];
+
+ if( $policy_type == 2 ){
+
+ $polices = $this->policesModel
+ ->select('policies.*')
+ ->join('policy_type', 'policy_type.id = policies.policy_type_id')
+ ->where('policy_type.policy_type', 'GMC - Top-up')
+ ->where(['policies.insurer_id' => $insurer_id, 'policies.is_active' => 1])->findAll();
+ }else if( $policy_type == 3 ){
+
+ $polices = $this->policesModel
+ ->select('policies.*')
+ ->join('policy_type', 'policy_type.id = policies.policy_type_id')
+ ->whereIn('policy_type.policy_type', ['GMC - Parents', 'GMC - Top-up(Parents)'])
+ ->where(['policies.insurer_id' => $insurer_id, 'policies.is_active' => 1])->findAll();
+
+ }
+
+
+ $data = $this->clientPolicyModel->getClientPolicyByPolicyType($client_id['client_id'], $policy_type);
+
+ return $this->respond(['Status' => true,'code' => 200,'data' => $data, 'client_policy_id' => $client_policy_id, 'policy' => $polices], 200);
+
+
+ }
}
\ No newline at end of file
diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php
index a45837f3..b723e8be 100644
--- a/app/Controllers/EmpDataServiceController.php
+++ b/app/Controllers/EmpDataServiceController.php
@@ -22,7 +22,8 @@ use App\Models\ClientDepositModel;
use App\Controllers\Jobs ;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
-use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
+// use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
+use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
class EmpDataServiceController extends BaseController
{
@@ -122,9 +123,27 @@ class EmpDataServiceController extends BaseController
// Define headers for the Excel file
$headers = [
- 'S.No', 'NAME OF EMP/DEP', 'EMP ID', 'EMP/DEP TYPE', 'RELATION', 'DOB', 'GENDER', 'PRE EXISTING AILMENTS',
- 'BASIC COVER SI', 'DATE OF COVERAGE', 'AGE', 'RELATIONSHIP', 'REMARKS', 'POLICY END DATE', 'NO OF DAYS', 'TPA ID', 'UHID',
- 'PREMIUM', 'PR0 RATA PREMIUM', 'GST', 'TOTAL'
+ 'S.No',
+ 'NAME OF EMP/DEP',
+ 'EMP ID',
+ 'EMP/DEP TYPE',
+ 'RELATION',
+ 'DOB',
+ 'GENDER',
+ 'PRE EXISTING AILMENTS',
+ 'BASIC COVER SI',
+ 'DATE OF COVERAGE',
+ 'AGE',
+ 'RELATIONSHIP',
+ 'REMARKS',
+ 'POLICY END DATE',
+ 'NO OF DAYS',
+ 'TPA ID',
+ 'UHID',
+ 'PREMIUM',
+ 'PR0 RATA PREMIUM',
+ 'GST',
+ 'TOTAL'
];
// Generate Excel file
@@ -445,95 +464,112 @@ class EmpDataServiceController extends BaseController
public function importExcelDataForInception($import_data)
{
-
+
$client_id = $import_data['client_id'];
$client_policy_id = $import_data['client_policy_id'];
$file = $import_data['file'];
- $is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
- $filename = $file->getName();
-
- $this->myLogger->logme('error','Inception Import file name : {data}', ['data'=> $filename ]);
- $random_number_count = 4;
- $batch_code = generate_random_string($random_number_count);
-
- $this->myLogger->logme('error','Inception Import BATCH CODE : {data}', ['data'=> $batch_code ]);
-
- $import_data['batch_code'] = $batch_code;
- $import_data['created_by'] = get_session_userid();
- $import_data['file_name'] = $filename;
- $insert = $this->batchFileModel->insert($import_data);
- $batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
-
- $batch_code_for_batch_list['batch_code'] = $batch_file_batch_code['batch_code'];
- $batch_code_for_batch_list['created_by'] = get_session_userid();
-
- $file_name_with_path = WRITEPATH."/uploads/import_excel/".$batch_file_batch_code['file_name'];
-
- //check the file exist or not
- if(!file_exists($file_name_with_path))
- {
- return 2;
- }
-
- $data = read_excel_file_to_array($file_name_with_path);
+ $data = $this->readExcelToArray($file);
unset($data[0]);
array_pop($data);
$count = count($data);
- $this->batchFileModel->where('id', $insert)->set('count', $count)->update();
- // dd($data );
- $employeeIds = [];
- foreach ($data as $key => $value) {
- // Check if the array is not empty and has the necessary data
- if (!empty($value) && (isset($value[15]) || isset($value[16]))) {
- // Extract the client_policy_id and tpa_id from the array
- $tpa_id = $value[15] != null ? $value[15] : '';
- $uhid = $value[16] != null ? $value[16] : '';
+ $missing_id = [];
+ $empty_emp_tpa_uh_ids = [];
+ foreach ($data as $key => $value) {
+
+ try {
+
+ if ($value[15] === null) {
+ $missing_id[] = $key + 1;
+ }
+
$emp_code = $value[2];
$name = $value[1];
- $val = $this->employeePolicyModel
- ->select('employee_polices.id')
- ->join('employees', 'employees.id = employee_polices.employee_id')
- ->where('employee_polices.client_policy_id', $client_policy_id)
- ->where('employees.client_id', $client_id)
- ->where('employees.name', $name)
- ->where('employees.emp_code', $emp_code)
- ->where('employee_polices.is_active', 1)
- ->first();
+ $db = \Config\Database::connect();
- if ($val !== null) {
- $id = $val['id'];
- $batch_code_for_batch_list['emp_policy_id'] = $id;
- $this->batchListModel->insert($batch_code_for_batch_list);
- array_push($employeeIds, $id);
+ // Execute the query
+ $query = $db->table('employee_polices')
+ ->select('employee_polices.id')
+ ->join('employees', 'employees.id = employee_polices.employee_id')
+ ->where('employee_polices.client_policy_id', $client_policy_id)
+ ->where('employees.client_id', $client_id)
+ ->where('employees.name', $name)
+ ->where('employees.emp_code', $emp_code)
+ ->where('(employee_polices.tpa_id IS NULL OR employee_polices.tpa_id = "")')
+ ->where('(employee_polices.uhid IS NULL OR employee_polices.uhid = "")')
+ ->where('employee_polices.is_active', 1)
+ ->limit(1)
+ ->get();
+
+ // Get the result
+ $result = $query->getRowArray();
+ if (isset($result['id']) && $result['id'] !== null) {
+ $empty_emp_tpa_uh_ids[] = $result['id'];
}
+ } catch (\Exception $e) {
+ // Handle the exception here
+ return 0;
+ }
+ }
- $updateData = [
- 'client_policy_id' => $client_policy_id,
- 'client_id' => $client_id,
- 'name' => $name,
- 'emp_code' => $emp_code,
- 'uhid' => $uhid,
- 'tpa_id' => $tpa_id
- ];
+ $missing_id_count = count($missing_id);
+ $empty_id_count = count($empty_emp_tpa_uh_ids);
- $this->employeePolicyModel->updateTPAIDorUHID($updateData);
+ // dd($count, $missing_id_count, $empty_id_count, $data, $empty_emp_tpa_uh_ids);
+
+ if ($missing_id_count != $count && $missing_id_count != 0) {
+
+ return 2;
+ }
+
+ if ($empty_emp_tpa_uh_ids != $count && $empty_id_count == 0) {
+
+ return 3;
+ }
+
+ // dd($empty_emp_tpa_uh_ids);
+
+ $is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
+ $filename = $file->getName();
+ $this->myLogger->logme('error', 'Inception Import file name : {data}', ['data' => $filename]);
+
+ $import_data['count'] = $count;
+ $import_data['file_name'] = $filename;
+
+
+ $this->insertBatchFileAndBatchListForImportExcel($import_data, $empty_emp_tpa_uh_ids);
+
+ // dd($import_data, $empty_emp_tpa_uh_ids);
+
+
+ foreach ($data as $key => $value) {
+
+ if (!empty($value) && (isset($value[15]) || isset($value[16]))) {
+
+ $tpa_id = $value[15] !== null ? $value[15] : '';
+ $uhid = $value[16] !== null ? $value[16] : '';
+
+ foreach ($empty_emp_tpa_uh_ids as $id) {
+ // Update employee policies based on the ID
+ $this->employeePolicyModel->where('id', $id)->set(['tpa_id' => $tpa_id, 'uhid' => $uhid])->update();
+ }
+
// $query = $this->employeePolicyModel->getLastQuery();
// echo $query . " ";
- }else{
+ } else {
return 0;
}
-
}
+
$policy_name = $this->getPolicyNameUsingClientPolicyId($client_policy_id);
$depositeData = [
- 'employeeIds'=>$employeeIds,
+ 'employeeIds'=>$empty_emp_tpa_uh_ids,
'client_id'=>$client_id,
'client_policy_id'=>$client_policy_id,
'count'=>$count,
@@ -554,6 +590,76 @@ class EmpDataServiceController extends BaseController
$client_policy_id = $import_data['client_policy_id'];
$file = $import_data['file'];
+ $data = $this->readExcelToArray($file);
+ unset($data[0]);
+ $count = count($data);
+
+ $missing_id = [];
+ $empty_emp_tpa_uh_ids = [];
+ foreach ($data as $key => $value) {
+
+ try {
+
+ if ($value[10] === null) {
+ $missing_id[] = $key + 1;
+ }
+
+ $emp_code = $value[0];
+ $uhid = $value[1];
+ $endorsement_id = $value[10] != null ? $value[10] : '';
+
+ $db = \Config\Database::connect();
+
+ // Execute the query
+ $query = $db->table('emp_endorsement')
+ ->select('emp_endorsement.id')
+ ->join('employees', 'employees.id = emp_endorsement.pk')
+ ->join('employee_polices', 'employee_polices.employee_id = employees.id')
+ ->where('employee_polices.client_policy_id', $client_policy_id)
+ ->where('employees.client_id', $client_id)
+ ->where('employee_polices.uhid', $uhid)
+ ->where('employees.emp_code', $emp_code)
+ ->where('(emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = "")')
+ ->groupBy('emp_endorsement.group_key')
+ ->limit(1);
+
+ // Get the result
+ $result = $query->get()->getRowArray();
+ if (isset($result['id']) && $result['id'] !== null) {
+ $empty_emp_tpa_uh_ids[] = $result['id'];
+ }
+ } catch (\Exception $e) {
+ // Handle the exception here
+ return 0;
+ }
+ }
+
+ $missing_id_count = count($missing_id);
+ $empty_id_count = count($empty_emp_tpa_uh_ids);
+
+ // if($missing_id_count != $count){
+
+ // return 2;
+ // }
+
+ if($missing_id_count != 0 ){
+
+ return 2;
+ }
+
+ // if($empty_emp_tpa_uh_ids != $count){
+
+ // return 3;
+ // }
+
+ if( $empty_id_count == 0){
+
+ return 3;
+ }
+
+ // dd($count, $missing_id, $missing_id_count, $empty_id_count, $data, $empty_emp_tpa_uh_ids);
+
+
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
$filename = $file->getName();
@@ -601,6 +707,7 @@ class EmpDataServiceController extends BaseController
->where('employees.emp_code', $emp_code)
->where('employees.is_active', 1)
->first();
+
$batch_code_for_batch_list['emp_policy_id'] = $val['id'];
$this->batchListModel->insert($batch_code_for_batch_list);
@@ -654,6 +761,74 @@ class EmpDataServiceController extends BaseController
$client_policy_id = $import_data['client_policy_id'];
$file = $import_data['file'];
+ $data = $this->readExcelToArray($file);
+ unset($data[0]);
+ $count = count($data);
+
+ $missing_id = [];
+ $empty_emp_tpa_uh_ids = [];
+ foreach ($data as $key => $value) {
+
+ try {
+ if ($value[19] === null) {
+ $missing_id[] = $key + 1;
+ }
+
+ $emp_name = $value[1];
+ $emp_code = $value[2];
+ $endorsement_id = $value[19] != null ? $value[19] : '';
+
+ $db = \Config\Database::connect();
+
+ // Execute the query
+ $query = $db->table('emp_endorsement')
+ ->select('emp_endorsement.id')
+ ->join('employee_polices', 'employee_polices.id = emp_endorsement.pk')
+ ->join('employees', 'employees.emp_code = emp_endorsement.emp_code')
+ ->where('employees.emp_code', $emp_code)
+ ->where('employees.name', $emp_name)
+ ->where('employees.client_id', $client_id)
+ ->where('emp_endorsement.actions', 'si')
+ ->where('employee_polices.client_policy_id', $client_policy_id)
+ ->where('(emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = "")')
+ ->groupBy('emp_endorsement.group_key');
+
+ // Get the result
+ $result = $query->get()->getRowArray();
+ if (isset($result['id']) && $result['id'] !== null) {
+ $empty_emp_tpa_uh_ids[] = $result['id'];
+ }
+ } catch (\Exception $e) {
+ // Handle the exception here
+ return 0;
+ }
+ }
+
+ $missing_id_count = count($missing_id);
+ $empty_id_count = count($empty_emp_tpa_uh_ids);
+
+ // if($missing_id_count != $count){
+
+ // return 2;
+ // }
+
+ if($missing_id_count != 0 ){
+
+ return 2;
+ }
+
+ // if($empty_emp_tpa_uh_ids != $count){
+
+ // return 3;
+ // }
+
+ if( $empty_id_count == 0){
+
+ return 3;
+ }
+
+ // dd($count, $missing_id, $missing_id_count, $empty_id_count, $data, $empty_emp_tpa_uh_ids);
+
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
$filename = $file->getName();
@@ -678,7 +853,7 @@ class EmpDataServiceController extends BaseController
{
return 2;
}
-
+
$data = read_excel_file_to_array($file_name_with_path);
unset($data[0]);
$count = count($data);
@@ -750,10 +925,7 @@ class EmpDataServiceController extends BaseController
$this->batchListModel->insert($batch_code_for_batch_list);
array_push($employeeIds, $id);
}
-
- // $query = $this->employeePolicyModel->getLastQuery();
- // echo $query . " ";
}else{
return 0;
@@ -786,6 +958,77 @@ class EmpDataServiceController extends BaseController
$file = $import_data['file'];
+ $data = $this->readExcelToArray($file);
+ unset($data[0]);
+ array_pop($data);
+ $count = count($data);
+
+ $missing_id = [];
+ $empty_emp_tpa_uh_ids = [];
+ foreach ($data as $key => $value) {
+
+ try {
+
+ if ($value[15] === null) {
+ $missing_id[] = $key + 1;
+ }
+
+ $emp_name = $value[2]; //employee name
+ $emp_code = $value[1]; //employee code
+ $date_of_exit = $value[7]; // date of releving
+ $endorsement_id = $value[15] != null ? $value[15] : ''; //endorsement id
+
+ $db = \Config\Database::connect();
+
+ // Execute the query
+ $query = $db->table('emp_endorsement')
+ ->select('emp_endorsement.id')
+ ->join('employee_polices', 'employee_polices.id = emp_endorsement.pk')
+ ->join('employees', 'employees.emp_code = emp_endorsement.emp_code')
+ ->where('employees.emp_code', $emp_code)
+ ->where('employees.name', $emp_name)
+ ->where('employees.client_id', $client_id)
+ ->where('emp_endorsement.actions', 'd')
+ ->where('employee_polices.client_policy_id', $client_policy_id)
+ ->where('(emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = "")')
+ ->groupBy('emp_endorsement.group_key');
+
+ $result = $query->get()->getRowArray();
+ if (isset($result['id']) && $result['id'] !== null) {
+ $empty_emp_tpa_uh_ids[] = $result['id'];
+ }
+ } catch (\Exception $e) {
+ // Handle the exception here
+ return 0;
+ }
+ }
+
+ $missing_id_count = count($missing_id);
+ $empty_id_count = count($empty_emp_tpa_uh_ids);
+
+
+ // if($missing_id_count != $count){
+
+ // return 2;
+ // }
+
+ if($missing_id_count != 0 ){
+
+ return 2;
+ }
+
+ // if($empty_emp_tpa_uh_ids != $count){
+
+ // return 3;
+ // }
+
+ if( $empty_id_count == 0){
+
+ return 3;
+ }
+
+ // dd($count, $missing_id_count, $empty_id_count, $data, $empty_emp_tpa_uh_ids);
+
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
$filename = $file->getName();
@@ -947,7 +1190,7 @@ class EmpDataServiceController extends BaseController
$data = [
'amount' => $amount->total_sum,
- 'sub_type_id' => 1,
+ 'sub_type_id' => 4,
'client_id' => $arrayData['client_id'],
'insurer_id' => $insurer_id['insurer_id'],
'description' => $description,
@@ -986,7 +1229,7 @@ class EmpDataServiceController extends BaseController
$data = [
'amount' => $amount->total_sum,
- 'sub_type_id' => 1,
+ 'sub_type_id' => 4,
'client_id' => $arrayData['client_id'],
'insurer_id' => $insurer_id['insurer_id'],
'description' => $description,
@@ -1027,7 +1270,7 @@ class EmpDataServiceController extends BaseController
$data = [
'amount' => $amount->total_sum,
- 'sub_type_id' => 1,
+ 'sub_type_id' => 3,
'client_id' => $arrayData['client_id'],
'insurer_id' => $insurer_id['insurer_id'],
'description' => $description,
@@ -1219,4 +1462,59 @@ class EmpDataServiceController extends BaseController
// -----------------------------------------------------------------------------------
+
+
+
+ public function readExcelToArray($file)
+ {
+
+ if ($file->isValid() && !$file->hasMoved()) {
+ $file = $file;
+
+ $reader = new Xlsx();
+ $spreadsheet = $reader->load($file->getPathname());
+
+ // Get the active sheet
+ $sheet = $spreadsheet->getActiveSheet();
+
+ // Iterate through rows to read data
+ $data = [];
+ foreach ($sheet->getRowIterator() as $row) {
+ $rowData = [];
+ foreach ($row->getCellIterator() as $cell) {
+ $rowData[] = $cell->getValue();
+ }
+ $data[] = $rowData;
+ }
+
+ return $data;
+
+ } else {
+
+ return false;
+ }
+ }
+
+
+ public function insertBatchFileAndBatchListForImportExcel($data, $ids)
+ {
+
+ $random_number_count = 4;
+ $data['batch_code'] = generate_random_string($random_number_count);
+ $data['created_by'] = get_session_userid();
+
+ $insert = $this->batchFileModel->insert($data);
+ $batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
+
+ if($insert){
+ foreach($ids as $id){
+ $batch_list_data['batch_code'] = $batch_file_batch_code['batch_code'];
+ $batch_list_data['emp_policy_id'] = $id;
+ $batch_list_data['created_by'] = get_session_userid();
+ $this->batchListModel->insert($batch_list_data);
+ }
+ }
+
+ return true;
+ }
}
diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php
index bb93433d..8229acf9 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')
@@ -397,15 +397,16 @@ class EmployeeController extends AdminController
return redirect()->to(base_url('employee/upload'));
}else if($return == 2){
- session()->setFlashdata('error', 'File not found');
+ session()->setFlashdata('error', 'The TPA ID or UHID columns are empty.');
return redirect()->to(base_url('employee/upload'));
}else if($return == 0){
- session()->setFlashdata('error', 'Something went wrong');
+ session()->setFlashdata('error', 'Please upload the correct file, something went wrong.');
return redirect()->to(base_url('employee/upload'));
- }
-
- }else if($event_type == 'correction'){
+ }else if($return == 3){
+ session()->setFlashdata('error', 'File already uploaded');
+ return redirect()->to(base_url('employee/upload'));
+ } }else if($event_type == 'correction'){
$return = $empDataServiceController->importExcelDataForCorrection($batch_data);
if($return == 1){
@@ -413,11 +414,14 @@ class EmployeeController extends AdminController
return redirect()->to(base_url('employee/upload'));
}else if($return == 2){
- session()->setFlashdata('error', 'File not found');
+ session()->setFlashdata('error', 'The Endorsement ID columns are empty.');
return redirect()->to(base_url('employee/upload'));
}else if($return == 0){
- session()->setFlashdata('error', 'Something went wrong');
+ session()->setFlashdata('error', 'Please upload the correct file, something went wrong.');
+ return redirect()->to(base_url('employee/upload'));
+ }else if($return == 3){
+ session()->setFlashdata('error', 'File already uploaded');
return redirect()->to(base_url('employee/upload'));
}
@@ -429,11 +433,14 @@ class EmployeeController extends AdminController
return redirect()->to(base_url('employee/upload'));
}else if($return == 2){
- session()->setFlashdata('error', 'File not found');
+ session()->setFlashdata('error', 'The Endorsement ID columns are empty.');
return redirect()->to(base_url('employee/upload'));
}else if($return == 0){
- session()->setFlashdata('error', 'Something went wrong');
+ session()->setFlashdata('error', 'Please upload the correct file, something went wrong.');
+ return redirect()->to(base_url('employee/upload'));
+ }else if($return == 3){
+ session()->setFlashdata('error', 'File already uploaded');
return redirect()->to(base_url('employee/upload'));
}
@@ -445,11 +452,14 @@ class EmployeeController extends AdminController
return redirect()->to(base_url('employee/upload'));
}else if($return == 2){
- session()->setFlashdata('error', 'File not found');
+ session()->setFlashdata('error', 'The Endorsement ID columns are empty.');
return redirect()->to(base_url('employee/upload'));
}else if($return == 0){
- session()->setFlashdata('error', 'Something went wrong');
+ session()->setFlashdata('error', 'Please upload the correct file, something went wrong.');
+ return redirect()->to(base_url('employee/upload'));
+ }else if($return == 3){
+ session()->setFlashdata('error', 'File already uploaded');
return redirect()->to(base_url('employee/upload'));
}
@@ -549,6 +559,7 @@ class EmployeeController extends AdminController
}
+
// @param int $client_policy_id
// this funciton initiate Inception/adition/DA of employees data only form enrollment app when passing
// client_policy_id pull draft and enrolled status employees and proceed to calculatin and make entry in DB
@@ -558,5 +569,91 @@ class EmployeeController extends AdminController
$res = $empServiceController->employeesOnboardPreprocess(['client_policy_id' => $client_policy_id]);
dd($res);
}
+
+ 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/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php
index bc88c765..611f71d1 100644
--- a/app/Controllers/EmployeeRestController.php
+++ b/app/Controllers/EmployeeRestController.php
@@ -72,6 +72,7 @@ class EmployeeRestController extends AdminController
if ($emp_code) {
$relationship = 'self';
$employee = $this->employeeModel->where('emp_code', $emp_code)
+ ->where('is_active', 1 )
->where('relationship', $relationship)
->first();
$result = $employee;
@@ -92,7 +93,7 @@ class EmployeeRestController extends AdminController
$data = $this->request->getJSON();
if ($data) {
$id = $data->id;
- $employee = $this->employeeModel->update($id, $data);
+ $employee = $this->employeeModel->where('is_active', 1 )->update($id, $data);
if ($employee) {
$result = [];
@@ -114,7 +115,7 @@ class EmployeeRestController extends AdminController
try {
$emp_code = $this->request->getGet('emp_code');
if ($emp_code) {
- $employee = $this->employeeModel->where('emp_code', $emp_code)->findAll();
+ $employee = $this->employeeModel->where('is_active', 1 )->where('emp_code', $emp_code)->findAll();
$dateConverter = function($item) {
if ($item['dob'] !== '0000-00-00') {
$dateTime = \DateTime::createFromFormat('Y-m-d', $item['dob']);
@@ -146,7 +147,7 @@ class EmployeeRestController extends AdminController
foreach ($data as $item) {
$id = $item->id;
$item->dob = $this->convertDateFormatYMD($item->dob);
- $employee = $this->employeeModel->update($id, (array)$item);
+ $employee = $this->employeeModel->where('is_active', 1 )->update($id, (array)$item);
if ($employee) {
$updatedCount++;
}
@@ -180,7 +181,8 @@ class EmployeeRestController extends AdminController
$id = $item->id;
$item->family_floater_key = $this->RelationshipMap($item->relationship);
$item->dob = $this->convertDateFormatYMD($item->dob);
- $employee = $this->employeeModel->update($id, (array)$item);
+ $item->emp_status = 'Draft';
+ $employee = $this->employeeModel->where('is_active', 1 )->update($id, (array)$item);
if ($employee) {
$Count++;
}
@@ -188,7 +190,8 @@ class EmployeeRestController extends AdminController
//create new data
$item->family_floater_key = $this->RelationshipMap($item->relationship);
$item->dob = $this->convertDateFormatYMD($item->dob);
- $employee = $this->employeeModel->insert($item);
+ $item->emp_status = 'Draft';
+ $employee = $this->employeeModel->where('is_active', 1 )->insert($item);
if ($employee) {
if(!isset($item->is_addon_value))
@@ -285,13 +288,17 @@ class EmployeeRestController extends AdminController
if($this->request->getGet('id'))
{
- $delete = $this->employeeModel->where('id', $this->request->getGet('id'))->delete();
-
- if ($delete) {
- return $this->respond(['status' => 'success','code' => 200,'data' =>[] ], 200);
- } else {
- return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 404);
- }
+ $this->employeeModel->where('id', $this->request->getGet('id') )
+ ->where('is_active', 1 )
+ ->set(array('is_active'=> 0 ))
+ ->update();
+
+ $this->employeePolicyModel->where('employee_id',$this->request->getGet('id') )
+ ->where('is_active', 1 )
+ ->set(array('is_active'=> 0 ))
+ ->update();
+ return $this->respond(['status' => 'success','code' => 200,'data' =>[] ], 200);
+
}else{
return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 404);
}
@@ -498,6 +505,7 @@ class EmployeeRestController extends AdminController
$checkIfExist = $this->employeePolicyModel->where('employee_id', $value->employee_id)
->where('client_policy_id', $value->client_policy_id)
+ ->where('is_active', 1 )
->findAll();
$getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard($value->client_policy_id,$value->client_id);
$SlabRatesArray = $getSlabAndGridData['slab_rates'];
@@ -514,6 +522,7 @@ class EmployeeRestController extends AdminController
$data['client_policy_id']= $value->client_policy_id;
$data['basic_cover_si']= $value->basic_cover_si;
$data['premium']= $premium;
+ $data['status'] = 'Draft';
$this->employeePolicyModel->insert($data);
}
@@ -561,7 +570,7 @@ class EmployeeRestController extends AdminController
$jwt = $this->request->getHeader('Authorization');
$jwtParts = explode(' ', $jwt);
- $token = $jwtParts[1];
+ $token = $jwtParts[2];
$decodedPayload = json_decode(base64_decode(explode('.', $token)[1]), true);
@@ -576,8 +585,9 @@ class EmployeeRestController extends AdminController
$policy = $this->policesModel->where('id', $client_policy['policy_id'])->first();
$policy_permium_1 = $this->policyPremium1Model->where(['client_id' => $client_id , 'client_policy_id' => $policy_id,'is_active' =>1])-> first();
$policy_permium_2 = $this->policyPremium2Model->where(['client_id' => $client_id , 'client_policy_id' => $policy_id,'is_active' =>1])-> first();
- $sum_insured_amount_for_check_employee_1 = $policy_permium_1['si'];
- $sum_insured_amount_for_check_employee_2 = $policy_permium_2['si'];
+
+ $sum_insured_amount_for_check_employee_1 = isset($policy_permium_1['si']) ? $policy_permium_1['si'] : null;
+ $sum_insured_amount_for_check_employee_2 = isset($policy_permium_2['si']) ? $policy_permium_2['si'] : null;
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
$filename = $file->getName();
@@ -871,7 +881,7 @@ public function getEmployeePolicy()
// Retrieve employee policy data by passing the employee primary key
$empPolicy = $this->employeeModel->getEmployeePolicy($id);
// Retrieve employee and dependents data by passing the employee code
- $employeeData = $this->employeeModel->where('emp_code',$emp_code)->where('is_addon_value',0)->findAll();
+ $employeeData = $this->employeeModel->where('emp_code',$emp_code)->where('is_active', 1 )->where('is_addon_value',0)->findAll();
if ($empPolicy) {
@@ -1079,8 +1089,8 @@ public function getAddOnPolicy()
{
try {
- $addOnEmployeeData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))->where('is_addon_value',1)->findAll();
- $GMCEmployeeData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))->where('is_addon_value',0)->findAll();
+ $addOnEmployeeData = $this->employeeModel->where('is_active', 1 )->where('emp_code',$this->request->getGet('emp_code'))->where('is_addon_value',1)->findAll();
+ $GMCEmployeeData = $this->employeeModel->where('is_active', 1 )->where('emp_code',$this->request->getGet('emp_code'))->where('is_addon_value',0)->findAll();
$clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id'))->findAll();
@@ -1122,7 +1132,7 @@ public function getAddOnPolicy()
if(count($addOnEmployeeData)){
foreach ($addOnEmployeeData as $key => $value) {
if ($value['family_floater_key'] === $dependent) {
- $employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->get()->getRow();
+ $employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow();
if(isset($employee_policy->basic_cover_si)){ $dependent_and_si_value = $employee_policy->basic_cover_si; }
if(isset($employee_policy->premium)){ $dependent_and_si_premium_value = $employee_policy->premium;}
@@ -1153,6 +1163,7 @@ public function getAddOnPolicy()
{
$GMCEmpData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))
->where('is_addon_value',0)
+ ->where('is_active', 1 )
->where('family_floater_key','parent')
->findAll();
@@ -1207,7 +1218,7 @@ public function getAddOnPolicy()
$only_si_premium_value = null;
foreach ($GMCEmployeeData as $key => $value) {
- $employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->get()->getRow();
+ $employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow();
if(isset($employee_policy->basic_cover_si)){ $only_si_value = $employee_policy->basic_cover_si; }
if(isset($employee_policy->premium)){ $only_si_premium_value = $employee_policy->premium;}
$temp3['is_value_exist'] = true;
@@ -1247,6 +1258,20 @@ public function getAddOnPolicy()
public function iAgreeForAddOn()
{
+
+ $emp_code = $this->request->getGet('emp_code');
+ $client_policy_id = $this->request->getGet('client_policy_id');
+ $client_id = $this->request->getGet('client_id');
+
+ $this->employeeModel->where('emp_code', $emp_code )
+ ->where('is_active', 1 )
+ ->set(array('emp_status'=>'Enrolled'))
+ ->update();
+ $this->employeePolicyModel->where('client_id', $client_id )
+ ->where('client_policy_id', $client_policy_id )
+ ->where('is_active', 1 )
+ ->set(array('status'=>'Enrolled'))
+ ->update();
return $this->respond(['status' => 'success','code' => 200,'data' => [] ], 200);
}
diff --git a/app/Controllers/LoginController.php b/app/Controllers/LoginController.php
index 37d78ae3..42c885d2 100644
--- a/app/Controllers/LoginController.php
+++ b/app/Controllers/LoginController.php
@@ -15,8 +15,8 @@ class LoginController extends BaseController
public function index(){
- //$session_data = ['isLoggedIn' => True ,'userid' => '25'];
- //set_session_data($session_data);
+ // $session_data = ['isLoggedIn' => True ,'userid' => '25'];
+ // set_session_data($session_data);
// $isLoggedIn = check_session();
$isLoggedIn = check_session();
diff --git a/app/Controllers/RestAuthenticationController.php b/app/Controllers/RestAuthenticationController.php
index 1801cc1c..b283bc5a 100644
--- a/app/Controllers/RestAuthenticationController.php
+++ b/app/Controllers/RestAuthenticationController.php
@@ -97,7 +97,7 @@ class RestAuthenticationController extends AdminController
$otp = $this->request->getJSON()->otp;
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->first();
- if ($employeeData && $otp == $employeeData["otp"]) {
+ if ($employeeData && $otp == $employeeData["otp"] || $employeeData && isset($this->request->getJSON()->login_by_hr)) {
$auth = HttpRequestHelper::getRequestInfo();
if ($auth) {
$data = [
diff --git a/app/Helpers/excel_import_export_helper.php b/app/Helpers/excel_import_export_helper.php
index ffb72f4c..95f164c8 100644
--- a/app/Helpers/excel_import_export_helper.php
+++ b/app/Helpers/excel_import_export_helper.php
@@ -268,39 +268,25 @@ if (! function_exists('transform_objects_to_array_for_deletion')) {
if (!function_exists('add_totals_row')) {
- 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);
-
-
+ function add_totals_row(Spreadsheet $spreadsheet, array $data)
+ {
// Calculate GST, Pro Rata Premium, and Total sums
$gstSum = 0;
$proRataPremiumSum = 0;
$totalSum = 0;
foreach ($data as $row) {
- $gstSum += $row[$gst];
- $proRataPremiumSum += $row[$rata];
- $totalSum += $row[$total];
+ $gstSum += $row[18];
+ $proRataPremiumSum += $row[19];
+ $totalSum += $row[20];
}
- $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($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);
+ $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);
}
}
@@ -543,4 +529,4 @@ if (!function_exists('format_Excel_BasedOn_Client'))
return $data;
}
-}
\ No newline at end of file
+}
diff --git a/app/Models/ClientPolicyModel.php b/app/Models/ClientPolicyModel.php
index 8ca450a4..2c27280b 100644
--- a/app/Models/ClientPolicyModel.php
+++ b/app/Models/ClientPolicyModel.php
@@ -80,6 +80,7 @@ class ClientPolicyModel extends Model
->join('policies', 'policies.id = client_policy.policy_id')
->join('policy_type', 'policy_type.id = policies.policy_type_id')
->where('client_policy.client_id', $client_id)
+ ->where('client_policy.policy_status', 1)
->get()
->getResult();
@@ -118,6 +119,7 @@ class ClientPolicyModel extends Model
}
+
public function getinsurerswithclientid($id){
return $this->db->table('client_policy')
@@ -146,6 +148,7 @@ class ClientPolicyModel extends Model
}
+
public function getinsurerswithinsurenceid($insurerId){
return $this->db->table('client_policy')
@@ -159,11 +162,15 @@ class ClientPolicyModel extends Model
->get()
->getResult();
}
+
+
public function getClientById($id) {
$query = $this->db->table('clients')->getWhere(['id' => $id]);
// Debug statement
return $query->getRow();
}
+
+
public function getDepositData($clientId, $insurerId)
{
// Fetch the deposit data based on client and insurer IDs
@@ -181,6 +188,7 @@ class ClientPolicyModel extends Model
->get()
->getResult();
}
+
public function getDepositSummary($clientId, $insurerId)
{
// Fetch the sum of credit and debit transactions and calculate the balance
@@ -265,6 +273,71 @@ public function updateStatus(){
}
+public function getpolicyWithPattern($client_id){
+
+ $query = "
+ SELECT client_policy.*, policies.name, policies.policy_type_id
+ FROM client_policy
+ JOIN policies ON policies.id = client_policy.policy_id
+ JOIN policy_type ON policy_type.id = policies.policy_type_id
+ WHERE policy_type.policy_type = 'GMC'
+ AND client_policy.client_id = {$client_id}";
+
+ $result = $this->db->query($query)->getResult();
+
+ return $result;
+}
+
+public function getTopUpPolicy($client_id, $type){
+
+ $query = "
+ SELECT client_policy.*, policies.name, policies.policy_type_id
+ FROM client_policy
+ JOIN policies ON policies.id = client_policy.policy_id
+ JOIN policy_type ON policy_type.id = policies.policy_type_id
+ WHERE policy_type.policy_type = '{$type}'
+ AND client_policy.client_id = {$client_id}";
+
+ $result = $this->db->query($query)->getResult();
+
+ return $result;
+
+}
+
+
+public function getClientPolicyByPolicyType($client_id, $type){
+
+
+ $query = $this->db->table('client_policy')
+ ->select('client_policy.*, insurers.name as insurer_name, insurers.short_name as insurer_short')
+ ->select('tpa.name as tpa_name, tpa.short_name as tpa_short')
+ ->select('policies.name as policy_name, policies.policy_type_id')
+ ->select('policy_type.policy_type as policy_type_name')
+ ->select('insurer_branch.branch_name as insurer_branch_name, insurer_branch.branch_code as insurer_branch_code')
+ ->select('tpa_branch.branch_name as tpa_branch_name, tpa_branch.branch_code as tpa_branch_code')
+ ->join('insurers', 'insurers.id = client_policy.insurer_id')
+ ->join('insurer_branch', 'client_policy.insurer_branch_id = insurer_branch.id')
+ ->join('tpa', 'tpa.id = client_policy.tpa_id')
+ ->join('tpa_branch', 'client_policy.tpa_branch_id = tpa_branch.id')
+ ->join('policies', 'policies.id = client_policy.policy_id')
+ ->join('policy_type', 'policy_type.id = policies.policy_type_id')
+ ->where('client_policy.client_id', $client_id)
+ ->where('client_policy.policy_status', 1);
+
+ if ($type == 2) {
+ $query->where('policy_type.policy_type', 'GMC - Top-up');
+ } else if ($type == 3) {
+ $query->whereIn('policy_type.policy_type', ['GMC - Parents', 'GMC - Top-up(Parents)']);
+ }
+
+ $result = $query->get()->getResult();
+
+ return $result;
+
+
+}
+
+
}
diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php
index 3cdd2177..084247bf 100644
--- a/app/Models/EmployeePolicyModel.php
+++ b/app/Models/EmployeePolicyModel.php
@@ -643,4 +643,41 @@ 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/PolicyPremium1Model.php b/app/Models/PolicyPremium1Model.php
index ec5d5b65..79e27179 100644
--- a/app/Models/PolicyPremium1Model.php
+++ b/app/Models/PolicyPremium1Model.php
@@ -24,6 +24,7 @@ class PolicyPremium1Model extends Model
"created_by",
"updated_by",
'is_active',
+ 'premium_type',
];
}
diff --git a/app/Models/PolicyPremium2Model.php b/app/Models/PolicyPremium2Model.php
index 0ed2777b..e390dcc7 100644
--- a/app/Models/PolicyPremium2Model.php
+++ b/app/Models/PolicyPremium2Model.php
@@ -23,6 +23,7 @@ class PolicyPremium2Model extends Model
"created_by",
"updated_by",
'is_active',
+ 'premium_type',
];
diff --git a/app/Views/batch_list.php b/app/Views/batch_list.php
index 31b16548..3f252701 100644
--- a/app/Views/batch_list.php
+++ b/app/Views/batch_list.php
@@ -1,25 +1,32 @@
+
+
-
-
-
-
-
-
-
+
+
+
+
+
-
+
+
+
-
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php
index 27da989b..d211a9cf 100644
--- a/app/Views/client_policy.php
+++ b/app/Views/client_policy.php
@@ -46,6 +46,26 @@
+
+
-
@@ -136,6 +138,14 @@
var policy_PrimaryKey = $('#client_id_policy').val();
var policy_client = $('#policy_PrimaryKey').val();
+$(document).ready(function() {
+ // Initialize select2
+ $("#insurer").select2();
+ $("#policy").select2();
+ $("#tpa").select2();
+ $("#base_policy").select2();
+});
+
$(document).ready(function() {
$('#policy_status_field').hide()
@@ -151,7 +161,6 @@ $(document).ready(function() {
onChange: function(selectedDates, dateStr, instance) {
var endDate = new Date(selectedDates[0]);
endDate.setFullYear(endDate.getFullYear() + 1);
-
endDatePicker.setDate(endDate);
}
});
@@ -181,16 +190,21 @@ $(document).ready(function() {
$('#table_list').hide();
$('.btnBack').show();
$('.btnAdd').hide();
- $('#insurer').val('');
- $('#tpa').val('');
- $('#start_date').val('');
- $('#end_date').val('');
- $('#policy').html('
Select Policy ');
- $('#is_addon').prop('checked', false);
+ $('#insurer').val('').change();
+ $('#tpa').val('').change();
+ $('#start_date').val('').change();
+ $('#end_date').val('').change();
+ $('#policy').html('
Select Policy ').change();
$('#policy_form_action').val('= base_url("client/policy/create"); ?>');
$('#policy_status_field').hide()
$('#base_policy_id').hide();
+
+ $('#first').hide();
+ $('#second').hide();
+ $('#base_policy_id').hide();
+ $('#base_policy').prop('required', false);
+
})
@@ -201,10 +215,10 @@ $(document).ready(function() {
$('#table_list').show();
$('.btnBack').hide();
$('.btnAdd').show();
- $('#insurer').val('');
- $('#tpa').val('');
- $('#start_date').val('');
- $('#end_date').val('');
+ $('#insurer').val('').change();
+ $('#tpa').val('').change();
+ $('#start_date').val('').change();
+ $('#end_date').val('').change();
$('#policy').html('
Select Policy ');
$('#base_policy_id').hide();
@@ -345,7 +359,7 @@ $("#policy_form").submit(function(event) {
search_term = 'GPA';
} else {
search_term =
- subject; // Set default value if neither 'GMC' nor 'GPA' exists
+ subject; // Set default value if neither 'GMC' nor 'GPA' exists
}
console.log('search_term :', search_term)
@@ -378,7 +392,6 @@ $("#policy_form").submit(function(event) {
$('#start_date').val('');
$('#end_date').val('');
$('#policy').html('
Select Policy ');
- $('#is_addon').prop('checked', false);
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
@@ -398,63 +411,66 @@ $("#policy_form").submit(function(event) {
});
});
-/********* To get th POLICY base on Insurer *******/
-$('#insurer').change(function() {
- var id = $(this).val();
- var parts = id.split('-');
- var secondPart = parts[1];
- var url = "= base_url("util/police-by-insurer/") ?>" + secondPart;
+$(document).ready(function() {
+ /********* To get th POLICY base on Insurer *******/
+ $('#insurer').change(function() {
+ var id = $(this).val();
+ var parts = id.split('-');
+ var secondPart = parts[1];
+ var url = "= base_url("util/police-by-insurer/") ?>" + secondPart;
- $.get(url, function(res) {
- // res = JSON.parse(res)//
- // console.log(res)
- var OptionsHTML = '';
- OptionsHTML += '
Select Policy ';
- $.each(res.data, function(index, item) {
- OptionsHTML += '
' + item.name + ' ';
+ $.get(url, function(res) {
+ // res = JSON.parse(res)//
+ // console.log(res)
+ var OptionsHTML = '';
+ OptionsHTML += '
Select Policy ';
+ $.each(res.data, function(index, item) {
+ OptionsHTML += '
' + item.name + ' ';
+ });
+
+ $('#policy').html(OptionsHTML);
+ }).fail(function(xhr, status, error) {
+ console.error(xhr.responseText);
+ console.error(status, error);
});
-
- $('#policy').html(OptionsHTML);
- }).fail(function(xhr, status, error) {
- console.error(xhr.responseText);
- console.error(status, error);
});
});
-/********* set the Policy_Type_id for Form Submit *******/
-$('#policy').change(function() {
+$(document).ready(function() {
+ /********* set the Policy_Type_id for Form Submit *******/
+ $('#policy').change(function() {
- var id = $(this).val();
- var dataId = $(this).children('option:selected').attr('data-id');
- console.log('id', id)
- $('#policy_type_id').val(dataId);
+ var id = $(this).val();
+ var dataId = $(this).children('option:selected').attr('data-id');
+ console.log('id', id)
+ $('#policy_type_id').val(dataId);
+
+ // $('#base_policy option').each(function() {
+ // var val = $(this).val();
+ // if (val == id) {
+ // $(this)
+ // .hide(); // Hide the option if its value matches the selected value of #policy
+ // } else {
+ // $(this).show(); // Show all other options
+ // }
+ // });
+
+ // if(dataId == 1){
+ // appendPolicyFormFields(1);
+ // }else if (dataId >= 1){
+ // appendPolicyFormFields(2);
+ // }
- $('#base_policy option').each(function() {
- var val = $(this).val();
- if (val == id) {
- $(this).hide(); // Hide the option if its value matches the selected value of #policy
- } else {
- $(this).show(); // Show all other options
- }
});
-
- // if(dataId == 1){
- // appendPolicyFormFields(1);
- // }else if (dataId >= 1){
- // appendPolicyFormFields(2);
- // }
-
});
// get the client policy data for edit
$('body').on('click', '.btnPolicyEdit', function() {
var policy_form_action = '';
- // var policy_id = $(this).data('id');
- // console.log('1', policy_id)
var policy_id = $(this).attr('data-id');
- // console.log('2', policy_id)
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
@@ -463,13 +479,14 @@ $('body').on('click', '.btnPolicyEdit', function() {
type: "GET",
dataType: 'json',
success: function(res) {
+
console.log(res)
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}, 1000);
- // console.log('clientPolicy : ', res);
+
$('#policy_form_action').val('= base_url("client/policy/edit"); ?>');
if (res.status === false) {
@@ -482,9 +499,12 @@ $('body').on('click', '.btnPolicyEdit', function() {
$('.btnBack').show();
$('.btnAdd').hide();
- $('#insurer').val(res.data.insurer_branch_id + '-' + res.data.insurer_id);
- $('#tpa').val(res.data.tpa_branch_id + '-' + res.data.tpa_id);
- $('#policy').val(res.data.policy_id);
+ $('#insurer').val(res.data.insurer_branch_id + '-' + res.data.insurer_id).change();
+ $('#tpa').val(res.data.tpa_branch_id + '-' + res.data.tpa_id).change();
+ // $('#policy').val(res.data.policy_id).change();
+ $('#policy_type').val(res.data.is_addon).change();
+ $('#base_policy').val(res.data.base_policy);
+
$('#policy_type_id').val(res.data.policy_type_id);
$('#policy_PrimaryKey').val(res.data.id);
$('#start_date').val(rearrangeDateFormat(res.data.policy_start_date));
@@ -492,27 +512,25 @@ $('body').on('click', '.btnPolicyEdit', function() {
$('#policy_status').val(checkDateStatus(res.data.policy_end_date));
$('#policy_status_field').show();
- if (res.data.is_addon == 1) {
- $('#is_addon').prop('checked', true);
+ if (res.data.is_addon != '1' && res.data.is_addon != '0') {
$('#base_policy_id').show();
- } else {
- $('#is_addon').prop('checked', false);
+ $('#base_policy').prop('required', true);
+ $('#first').show();
+ $('#second').show();
+ } else if (res.data.is_addon == '0') {
+ $('#first').hide();
+ $('#second').hide();
$('#base_policy_id').hide();
+ $('#base_policy').prop('required', false);
+ } else if (res.data.is_addon == '1') {
+ $('#first').show();
+ $('#second').show();
+ $('#base_policy_id').hide();
+ $('#base_policy').prop('required', false);
}
- /** do not delete this comment condition
-
- // if(res.data.policy_type_id == 1){
- // appendPolicyFormFields(1, res.data);
- // }else if(res.data.policy_type_id >= 2) {
- // appendPolicyFormFields(2, res.data);
- // }
-
- do not delete this comment condition **/
-
var policeOptionHTML = '';
$.each(res.policy, function(index, item) {
- // console.log(item)
policeOptionHTML += '
' + item.name + ' ';
@@ -522,13 +540,16 @@ $('body').on('click', '.btnPolicyEdit', function() {
var OptionsHTML = '';
OptionsHTML += '
Select Base Policy ';
$.each(res.client_policy_list, function(index, item) {
- if (res.data.policy_id !== item.id) {
- OptionsHTML += '
' + item.name + ' ';
- }
+ OptionsHTML += '
' + item.name + ' ';
});
$('#base_policy').html(OptionsHTML);
+
+ setTimeout(function() {
+ $('#policy').val(res.data.policy_id).change();
+ }, 3000);
+
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
@@ -542,6 +563,7 @@ $('body').on('click', '.btnPolicyEdit', function() {
});
});
+
$('body').on('click', '.btnOpenEnroll', function() {
var client_policy_id = $(this).attr('data-id');
@@ -959,19 +981,41 @@ function removeClientPolicy(element) {
}
-$('#is_addon').change(function() {
+$('#policy_type').change(function() {
+
+ $('#insurer').val('').change();
+ $('#tpa').val('').change();
+ $('#start_date').val('');
+ $('#end_date').val('');
+ $('#base_policy').val('0');
+
+ if ($(this).val() != '1' && $(this).val() != '0') {
- if ($(this).is(':checked')) {
$('#base_policy_id').show();
$('#base_policy').prop('required', true);
- }else{
+ $('#first').show();
+ $('#second').show();
+
+ } else if ($(this).val() == '0'){
+
+ $('#first').hide();
+ $('#second').hide();
+ $('#base_policy_id').hide();
+ $('#base_policy').prop('required', false);
+
+
+ } else if ($(this).val() == '1'){
+
+ $('#first').show();
+ $('#second').show();
$('#base_policy_id').hide();
$('#base_policy').prop('required', false);
}
+
})
-function fetchClientPolicyList(){
+function fetchClientPolicyList() {
var client_id = $('#client_id_policy').val()
@@ -980,7 +1024,8 @@ function fetchClientPolicyList(){
type: "GET",
dataType: 'json',
success: function(res) {
- console.log(res)
+
+ console.log('one',res)
setTimeout(function() {
$('.loader').fadeOut();
@@ -1012,4 +1057,75 @@ function fetchClientPolicyList(){
}
+
+$(document).ready(function(){
+
+ $('#base_policy').change(function() {
+
+ var client_policy_id = $(this).val()
+ var policy_type = $('#policy_type').val()
+ console.log(client_policy_id);
+
+ var queryParams = {
+ client_policy_id: client_policy_id,
+ policy_type: policy_type,
+ };
+
+ const queryString = objectToQueryString(queryParams);
+ // var uri = '= base_url('util/fetch-policy-for-policy-type')?>?' + queryString
+ var uri = '= base_url('client/policy/list/')?>' + client_policy_id
+ console.log('uri', uri)
+ console.log('queryString', queryString)
+
+ $('.loader').fadeIn();
+ $('.loader-mask').fadeIn();
+
+ $.ajax({
+ url: uri,
+ type: "GET",
+ dataType: 'json',
+ processData: false,
+ contentType: false,
+ success: function(res) {
+
+ console.log(res)
+
+ setTimeout(function() {
+ $('.loader').fadeOut();
+ $('.loader-mask').delay(350).fadeOut('slow');
+ }, 500);
+
+ $('#insurer').val(res.data.insurer_branch_id + '-' + res.data.insurer_id).change();
+ $('#tpa').val(res.data.tpa_branch_id + '-' + res.data.tpa_id).change();
+ $('#start_date').val(rearrangeDateFormat(res.data.policy_start_date)).change();
+ $('#end_date').val(rearrangeDateFormat(res.data.policy_end_date)).change();
+
+
+ var policeOptionHTML = '';
+ $.each(res.policy, function(index, item) {
+ console.log(item)
+ policeOptionHTML += '
' + item.name + ' ';
+ });
+ $('#policy').html(policeOptionHTML);
+
+ },
+ 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 Wrong!', 'warning');
+ }, 500);
+ }
+ });
+ });
+})
+
+function objectToQueryString(obj) {
+ return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
+}
+
\ No newline at end of file
diff --git a/app/Views/employee_data_list.php b/app/Views/employee_data_list.php
new file mode 100644
index 00000000..0c7ffeda
--- /dev/null
+++ b/app/Views/employee_data_list.php
@@ -0,0 +1,151 @@
+
+
+
+
+
+
+
+
+
+
+ SNO
+
+ Name/code
+ Policy name
+ Insurer name
+ TPA ID
+ UHID ID
+ Policy status
+ Sum Insured
+ Premium
+ Action
+
+
+
+
+ $employee) { ?>
+
+
+
+
+ ( )
+
+
+
+
+
+ ' . $employee['status'] . '';
+ } elseif ($employee['status'] == 'active') {
+ echo '' . $employee['status'] . ' ';
+ } elseif ($employee['status'] == 'inactive') {
+ echo '' . $employee['status'] . ' ';
+ }elseif ($employee['status'] == 'expired') {
+ echo '' . $employee['status'] . ' ';
+ }elseif ($employee['status'] == 'enrolled') {
+ echo '' . $employee['status'] . ' ';
+ }else{
+ echo $employee['status'];
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/employee_list.php b/app/Views/employee_list.php
index 02b28c13..594037fb 100644
--- a/app/Views/employee_list.php
+++ b/app/Views/employee_list.php
@@ -10,7 +10,7 @@ table.dataTable tbody td {
-
+
@@ -68,93 +68,24 @@ table.dataTable tbody td {
-
-
-
-
-
-
-
-
- SNO
-
- Name/code
- Policy name
- Insurer name
- TPA ID
- UHID ID
- Policy status
- Premium
- Action
-
-
-
- $employee) { ?>
-
-
-
-
- ( )
-
-
-
-
-
- ' . $employee['status'] . '';
- } elseif ($employee['status'] == 'active') {
- echo '' . $employee['status'] . ' ';
- } elseif ($employee['status'] == 'inactive') {
- echo '' . $employee['status'] . ' ';
- }elseif ($employee['status'] == 'expired') {
- echo '' . $employee['status'] . ' ';
- }
- ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
SPINNER
\ No newline at end of file
diff --git a/app/Views/employee_upload.php b/app/Views/employee_upload.php
index 33714097..c985b877 100644
--- a/app/Views/employee_upload.php
+++ b/app/Views/employee_upload.php
@@ -1,14 +1,7 @@
-';?>
-';?>
-
-
-
-
-
-
+
+
+
+
@@ -127,6 +151,12 @@
\ No newline at end of file
diff --git a/app/Views/endorsement_list.php b/app/Views/endorsement_list.php
index b3ed0c73..3cac7546 100644
--- a/app/Views/endorsement_list.php
+++ b/app/Views/endorsement_list.php
@@ -7,10 +7,16 @@
table.dataTable tbody td {
padding: 4px 4px !important;
}
+
+.btn .btn-secondary .buttons-csv .buttons-html5 .my_class{
+ position: relative;
+ left: 79px;
+}
+
-
+
@@ -173,6 +179,13 @@ table.dataTable tbody td {
\ 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..0eb25a30 100644
--- a/app/Views/file_list.php
+++ b/app/Views/file_list.php
@@ -1,27 +1,40 @@
+
+
-
-
-
-
-
-
-
+
+
+
+
+
-
-
+
+
+
+
SNO
File name
Client
- policy
+ Policy
Event
User/Time
Status
+ Action
-
+
-
-
+ $file) { //print_r((json_decode($file['reason'])));
@@ -29,23 +42,288 @@
// $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_or_tpa_data.php b/app/Views/insurer_or_tpa_data.php
index 91c63f58..ace7b3b6 100644
--- a/app/Views/insurer_or_tpa_data.php
+++ b/app/Views/insurer_or_tpa_data.php
@@ -1,7 +1,7 @@