MERGE_DATA_IMPORT_EXPORT_FIXES

This commit is contained in:
velz 2024-04-17 16:22:12 +05:30
commit 6254ce535e
15 changed files with 1909 additions and 1281 deletions

View File

@ -215,6 +215,9 @@ $routes->group("/util", ["filter" => "authMVC"], function($routes){
$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");
$routes->get("fetch-emp-count/(:any)", "EmployeeController::getEmpCount/$1");
$routes->get("init-Emp-onboard/(:any)", "EmployeeController::initiateManualEmployeesOnboardProcess/$1");
$routes->get("full-excel-error-file/(:any)", "EmployeeController::downloadFullExcelErrorFile/$1");
});

View File

@ -610,7 +610,23 @@ class ClientController extends AdminController
$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 ($this->request->getPost('is_addon') == 3) {
$policyTerm = $policy_terms['policy_terms'];
$decoded_policyTerm = json_decode($policyTerm, true);
$decoded_policyTerm['family_floater'] =0;
$decoded_policyTerm['family_floaters']['self'] =0;
$decoded_policyTerm['family_floaters']['spouse'] =0;
$decoded_policyTerm['family_floaters']['childrens'] =0;
$decoded_policyTerm['family_floaters']['parents'] =0;
$decoded_policyTerm['family_floaters']['parents-in-law'] =0;
$decoded_policyTerm['family_floaters']['either-parents-pil'] =0;
$data['policy_terms'] = json_encode($decoded_policyTerm);
}else{
$data['policy_terms'] = $policy_terms['policy_terms'];
}
}
@ -679,7 +695,23 @@ class ClientController extends AdminController
$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 ($this->request->getPost('is_addon') == 3) {
$policyTerm = $policy_terms['policy_terms'];
$decoded_policyTerm = json_decode($policyTerm, true);
$decoded_policyTerm['family_floater'] =0;
$decoded_policyTerm['family_floaters']['self'] =0;
$decoded_policyTerm['family_floaters']['spouse'] =0;
$decoded_policyTerm['family_floaters']['childrens'] =0;
$decoded_policyTerm['family_floaters']['parents'] =0;
$decoded_policyTerm['family_floaters']['parents-in-law'] =0;
$decoded_policyTerm['family_floaters']['either-parents-pil'] =0;
$data['policy_terms'] = json_encode($decoded_policyTerm);
} else {
$data['policy_terms'] = $policy_terms['policy_terms'];
}
}
// dd($data);
@ -1259,6 +1291,7 @@ class ClientController extends AdminController
->where("employees.emp_status",'active')
->countAllResults();
$emp_count_by_policy = $this->employeePolicyModel->where('client_policy_id',$client_policy_id)->where('is_active',1)->countAllResults();
if($emp_count == 0){
$emp_count = true;
}else{
@ -1266,7 +1299,7 @@ class ClientController extends AdminController
}
if ($record) {
return $this->respond(['Status' => true,'code' => 200,'data' => $record['policy_terms'], 'count' => $emp_count, 'policy_name' => $policy_name], 200);
return $this->respond(['Status' => true,'code' => 200,'data' => $record['policy_terms'], 'count' => $emp_count, 'policy_name' => $policy_name,'policy_addon' => $record['is_addon'], 'emp_count_by_policy'=>$emp_count_by_policy], 200);
} else {
return $this->respond(['Status' => false,'code' => 200,'message' => 'Record not found.', 'count' => $emp_count, 'policy_name' => $policy_name], 200);
}

File diff suppressed because it is too large Load Diff

View File

@ -26,6 +26,8 @@ use App\Controllers\EmpDataServiceController;
use CodeIgniter\API\ResponseTrait;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\IOFactory;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
class EmployeeController extends AdminController
{
@ -77,6 +79,7 @@ class EmployeeController extends AdminController
{
//echo $this->request->isAJAX();die();
$result = $this->clientModel->clientsWithPolicies();
// print_r($result);die();
if(!count($result))
{
@ -247,6 +250,7 @@ class EmployeeController extends AdminController
// Render views and capture output
$result = $empServiceController->getExcelErrorData($file_id);
$result['file_id'] = $file_id;
// echo '<pre>';
// print_r($result); die;
@ -557,37 +561,53 @@ class EmployeeController extends AdminController
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'no data found'], 200);
}
}
// @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
public function initiateManualEmployeesOnboardProcess($client_policy_id)
{
$empServiceController = new EmployeeServiceController();
$res = $empServiceController->employeesOnboardPreprocess(['client_policy_id' => $client_policy_id]);
dd($res);
{
$client_data = $this->clientPolicyModel->select('clients.client_name as client_name, policies.name as policy_name')
->join('clients', 'clients.id = client_policy.client_id')
->join('policies', 'policies.id = client_policy.policy_id')
->where('client_policy.id', $client_policy_id)
->first();
$empServiceController = new EmployeeServiceController();
$res = $empServiceController->employeesOnboardPreprocess(['client_policy_id' => $client_policy_id]);
// dd($res);
$count = count($res);
$message = $count . ' Employees are Initiate Onboard Process againts Client '. $client_data['client_name'] . ' and the Policy is ' . $client_data['policy_name'] ;
session()->setFlashdata('success1', $message);
return redirect()->to(base_url('/employee/upload'));
}
public function downloadFileList($fileName = null)
public function downloadFileList($file_id = null)
{
// $actionType = $this->request->getGet();
$file_data = $this->fileModel->where('id', $file_id)->first();
$fileName = $file_data['file_name'];
$error_data = json_decode($file_data['reason']);
$filePath = WRITEPATH . '/uploads/excel/' . $fileName;
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();
$data['message'] = 'The Physical File Not Found';
echo view('errors/404', $data);
}
} catch (\Exception $e) {
// Handle any exceptions
@ -596,7 +616,6 @@ class EmployeeController extends AdminController
// You can return an error response here
echo $errorMessage;
}
}
@ -641,6 +660,7 @@ class EmployeeController extends AdminController
$emp_data['tbody'] = $excel_data;
$html = view('view_file_upload_emp_list', $emp_data);
} else {
$html = '<div class="text-center">No Data Found</div>';
@ -657,5 +677,140 @@ class EmployeeController extends AdminController
}
}
public function getEmpCount($id = null){
$data = $this->employeePolicyModel->select('employee_polices.id')
->where('employee_polices.is_active', 1)
->where('employee_polices.client_policy_id', $id)
->findAll();
$emp_count = count($data);
if($data){
return $this->respond(['dataStatus' => true, 'code' => 200, 'emp_count' => $emp_count], 200);
}else{
return $this->respond(['dataStatus' => false, 'code' => 404], 404);
}
}
public function downloadFullExcelErrorFile($file_id = 137, $rowIndex = 1, $colIndex = 1)
{
// Get file data from the database
$file_data = $this->fileModel->find($file_id);
$error = json_decode($file_data['reason']);
// echo '<pre>';
// print_r($error); die;
// dd($error);
// Check if the file exists
if (!$file_data) {
$error_message = "File not found";
$this->myLogger->logme('error', $error_message . ' for file id ' . $file_id);
return $error_message;
}
$fileName = $file_data['file_name'];
$filePath = WRITEPATH . '/uploads/excel/' . $fileName;
// Check if the file exists
if (!file_exists($filePath)) {
$error_message = "File not found";
$this->myLogger->logme('error', $error_message . ' for file id ' . $file_id);
return $error_message;
}
// Load the Excel file
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filePath);
$sheet = $spreadsheet->getActiveSheet();
// echo '<pre>';
foreach ($error->error_data as $index => $error_data) {
$rowIndex = $index+1;
if( $error->error_type == 1 ){
foreach ($error_data as $key => $value) {
$colIndex = $value->col_idx+1;
$originalValue = $sheet->getCell([$colIndex, $rowIndex])->getValue();
$newValue = implode(', ',$value->error);
$val = $originalValue . ' ( ' . $newValue . ' )';
$sheet->setCellValue([$colIndex, $rowIndex], $val);
$style = [
'fill' => [
'fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
'startColor' => ['rgb' => 'ffad99'] // Red color
]
];
$sheet->getStyle([$colIndex, $rowIndex])->applyFromArray($style);
}
}else if( $error->error_type == 2){
foreach ($error_data as $key => $value) {
$originalValue = $sheet->getCell([1, $rowIndex])->getValue();
$newValue = implode(', ',$value->error);
$val = $originalValue . ' ( ' . $newValue . ' )';
$sheet->setCellValue([$colIndex, $rowIndex], $val);
$style = [
'fill' => [
'fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
'startColor' => ['rgb' => 'ffad99'] // Red color
]
];
$sheet->getStyle([$colIndex, $rowIndex])->applyFromArray($style);
}
}
}
// Create a new filename for the modified Excel file
$newFileName = 'modified_' . $fileName;
// Save the modified Excel file to a new location
$newFilePath = WRITEPATH . '/uploads/excel/' . $newFileName;
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet);
$writer->save($newFilePath);
// Set headers to force download
$response = service('response');
$response->setHeader('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
$response->setHeader('Content-Disposition', 'attachment;filename="' . $newFileName . '"');
$response->setHeader('Cache-Control', 'max-age=0');
$response->setHeader('Content-Length', filesize($newFilePath));
$response->setBody(file_get_contents($newFilePath));
// Delete the temporary file
unlink($newFilePath);
// Return the response
return $response;
}
}

View File

@ -170,16 +170,18 @@ class EmployeeRestController extends AdminController
public function addEmployeeAndDependence()
{
try {
// try {
$data = $this->request->getJSON();
if ($data) {
$Count = 0;
foreach ($data as $item) {
if (isset($item->id)) {
//update old data
$id = $item->id;
$item->family_floater_key = $this->RelationshipMap($item->relationship);
$item->gender = $this->GenderMap($item->relationship , $item->emp_code);
$item->dob = $this->convertDateFormatYMD($item->dob);
$item->emp_status = 'Draft';
$employee = $this->employeeModel->where('is_active', 1 )->update($id, (array)$item);
@ -189,9 +191,10 @@ class EmployeeRestController extends AdminController
}else{
//create new data
$item->family_floater_key = $this->RelationshipMap($item->relationship);
$item->gender = $this->GenderMap($item->relationship , $item->emp_code);
$item->dob = $this->convertDateFormatYMD($item->dob);
$item->emp_status = 'Draft';
$employee = $this->employeeModel->where('is_active', 1 )->insert($item);
$employee = $this->employeeModel->insert($item);
if ($employee) {
if(!isset($item->is_addon_value))
@ -206,6 +209,7 @@ class EmployeeRestController extends AdminController
}
if ($Count > 0) {
$this->updatePremiumAmount($data[0]->client_policy_id , $data[0]->emp_code);
$result = [];
return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200);
} else {
@ -213,40 +217,57 @@ class EmployeeRestController extends AdminController
return $this->respond(['status' => 'failed','code' => 404,'data' => $result], 404);
}
}
} catch (\Exception $e) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
}
// } catch (\Exception $e) {
// return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
// }
}
public function createEmployeePolicyData($employee_id,$emp_code,$client_id,$client_policy_id)
{
$client_policy = $this->clientPolicyModel->where('id', $client_policy_id)->where('client_id', $client_id)->first();
$policy_terms = json_decode($client_policy['policy_terms']);
$basic_cover_si = $policy_terms->sum_insured;
$getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard($client_policy_id,$client_id);
$SlabRatesArray = $getSlabAndGridData['slab_rates'];
$premium = $this->findPremiumAmount($SlabRatesArray, $basic_cover_si);
$data['employee_id']= $employee_id;
$data['client_policy_id']= $client_policy_id;
$data['basic_cover_si']= $basic_cover_si;
$data['premium']= $premium;
$data['status']= 'draft';
$this->employeePolicyModel->insert($data);
return true;
}
public function updatePremiumAmount($client_policy_id , $emp_code)
{
$response = $this->calculatePremium($client_policy_id , $emp_code);
if(count($response[$emp_code]))
{
print_r($response[$emp_code]);
foreach ($response[$emp_code] as $key => $value)
{
$checkIfExist = $this->employeePolicyModel->where('employee_id', $value['temp']['emp_id'])
->where('client_policy_id', $value['policy_details']['client_policy_id'])
->where('is_active', 1 )
->findAll();
if($checkIfExist)
{
$this->employeePolicyModel
->where('client_policy_id',$value['policy_details']['client_policy_id'] )
->where('employee_id' , $value['temp']['emp_id'] )
->where('is_active', 1 )
->set(array('premium'=> $value['policy_details']['premium'] ))
->update();
}
}
}
}
public function RelationshipMap($value){
if ($value === 'Mother' || $value === 'Father') {
@ -260,6 +281,19 @@ class EmployeeRestController extends AdminController
}
}
public function GenderMap($value,$empCode){
if ($value === 'Mother' || $value === 'Daughter' || $value === 'Mother in Law') {
return 'F';
} else if($value === 'Son' || $value === 'Father' || $value === 'Father in Law'){
return 'M';
}else if($value === 'Spouse'){
$Gender = $this->employeeModel->where('emp_code',$empCode)->where('relationship','Self')->get()->getRow()->gender;
if($Gender == 'M'){ return 'F'; }else{ return 'M'; }
}
}
private function convertDateFormatYMD($dateString)
{
// Attempt to create a DateTime object from the provided date string
@ -339,8 +373,10 @@ class EmployeeRestController extends AdminController
$result = [];
foreach ($ClientPolicyData as $key => $value) {
$getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard( $value['client_policy_id'],$value['client_id']);
if($value['is_addon'] == 1){
$value['type'] = 'AddOn';
if($value['is_addon'] == "2"){
$value['type'] = 'SI-TopUp';
}else if($value['is_addon'] == "3"){
$value['type'] = 'Dependent-AddOn';
}else{
$value['type'] = $getSlabAndGridData['grid_master']['policy_type'];
}
@ -854,6 +890,7 @@ class EmployeeRestController extends AdminController
// $return_log = json_decode($return_log);
// $this->myLogger->logme('info', "Email Status : {mail_status}, Sender Email:{email}", ['mail_status' => $return_log->status, 'email'=> $return_log->data]);
}
return $this->respond(['status' => 'success', 'code' => 200, 'message' => "Success" ], 404);
}else{
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Client id and Client Policy id is Not Match!" ], 404);
}
@ -882,7 +919,7 @@ public function getEmployeePolicy()
$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_active', 1 )->where('is_addon_value',0)->findAll();
// dd($empPolicy);
if ($empPolicy) {
@ -1099,24 +1136,24 @@ public function getAddOnPolicy()
{
$PolicyData = [];
foreach ($clientPolicy as $key => $array) {
$responce = [];
$decodedArray = json_decode($array['policy_terms']);
$policy_terms = $decodedArray;
$getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard($array['id'],$array['client_id']);
if($array['is_addon'] == 1)
{
$responce['policy_name'] = $this->policesModel->where('id',$array['policy_id'])->get()->getRow()->name;
$responce['SlabRates'] = $getSlabAndGridData['slab_rates'];
$responce['GridMaster'] = $getSlabAndGridData['grid_master'];
$responce['client_id'] = $array['client_id'];
$responce['client_policy_id'] = $array['id'];
$responce['is_addon'] = $array['is_addon'];
$responce['open_for_enrollment'] = $array['open_for_enrollment'];
$responce['policy_terms'] = $decodedArray;
$responce['policy_name'] = $this->policesModel->where('id',$array['policy_id'])->get()->getRow()->name;
$responce['SlabRates'] = $getSlabAndGridData['slab_rates'];
$responce['GridMaster'] = $getSlabAndGridData['grid_master'];
$responce['client_id'] = $array['client_id'];
$responce['client_policy_id'] = $array['id'];
$responce['is_addon'] = $array['is_addon'];
$responce['open_for_enrollment'] = $array['open_for_enrollment'];
$responce['policy_terms'] = $decodedArray;
if($array['is_addon'] == 3)
{
// Map family floaters that already exist in the employee table
$familyFloates = $policy_terms->family_floaters;
@ -1213,40 +1250,52 @@ public function getAddOnPolicy()
$responce['family_floaters_of_dependent_and_si_premium_value'] = $dependent_and_si_premium_value;
$only_si_array = [];
$only_si_value = null;
$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'])->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;
$temp3['data']['employee_id'] = $value['id'];
$temp3['data']['relationship'] = $value['relationship'];
$temp3['data']['name'] = $value['name'];
$temp3['data']['dob'] = $this->convertDateFormatDMY($value['dob']);
$temp3['data']['client_policy_id'] = $array['id'];
$temp3['data']['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : null;
$temp3['data']['premium'] = isset($employee_policy->premium) ? $employee_policy->premium : null;
array_push($only_si_array,$temp3);
}
$responce['family_floaters_of_only_si_array'] = $only_si_array;
$responce['family_floaters_of_only_si_value'] = $only_si_value;
$responce['family_floaters_of_only_si_premium_value'] = $only_si_premium_value;
if($this->request->getGet('policy') == 'GMC-DEPENDENT-ADDON'){
return $this->respond(['status' => 'success','code' => 200,'data' => ['gmc_dependent_addon'=>$responce]], 200);
}
//array_push($PolicyData, $responce);
}else if($array['is_addon'] == 2){
$only_si_array = [];
$only_si_value = null;
$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'])->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;
$temp3['data']['employee_id'] = $value['id'];
$temp3['data']['relationship'] = $value['relationship'];
$temp3['data']['name'] = $value['name'];
$temp3['data']['dob'] = $this->convertDateFormatDMY($value['dob']);
$temp3['data']['client_policy_id'] = $array['id'];
$temp3['data']['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : null;
$temp3['data']['premium'] = isset($employee_policy->premium) ? $employee_policy->premium : null;
array_push($only_si_array,$temp3);
}
$responce['family_floaters_of_only_si_array'] = $only_si_array;
$responce['family_floaters_of_only_si_value'] = $only_si_value;
$responce['family_floaters_of_only_si_premium_value'] = $only_si_premium_value;
if($this->request->getGet('policy') == 'GMC-SI-TOPUP'){
return $this->respond(['status' => 'success','code' => 200,'data' => ['gmc_si_topup'=>$responce]], 200);
}
array_push($PolicyData, $responce);
}
}
return $this->respond(['status' => 'success','code' => 200,'data' => ['addon_policy'=>$responce]], 200);
// return $this->respond(['status' => 'success','code' => 200,'data' => ['addon_policy'=>$responce]], 200);
}else{
return $this->respond(['status' => 'failed','code' => 404,'data' => []], 404);
@ -1278,13 +1327,21 @@ public function iAgreeForAddOn()
//Post method - which receives client_policy id and empcode of the family.
//Pull records againest emp code and calculate premium
// retun array
public function calculatePremium()//family level
public function calculatePremium($clientPolicyId = null , $empCode = null, $default_si = null)//family level
{
helper('excel_util_helper');
$client_policy_id = $this->request->getVar('client_policy_id');
$emp_code = $this->request->getVar('emp_code');
// $client_policy_id = $this->request->getVar('client_policy_id');
// $emp_code = $this->request->getVar('emp_code');
// dd($default_si);
$client_policy_id = $this->request->getVar('client_policy_id') ?? $clientPolicyId;
$emp_code = $this->request->getVar('emp_code') ?? $empCode;
$default_si = $this->request->getVar('si') ?? $default_si;// si amt which choosed in add on policy
// dd($client_policy_id);
$client_id = ($this->clientPolicyModel->select('client_id')->find($client_policy_id))['client_id'];
// get policy and rack details
$policy_terms = $this->clientPolicyModel->getPolicyDetails($client_id,$client_policy_id);
@ -1292,8 +1349,9 @@ public function calculatePremium()//family level
//get policy slab rates
$slab_details = $this->policesModel->getPolicySlabRatesForEmpOnboard($client_policy_id,$client_id);
// dd($slab_details);
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(client_id: $client_id,client_policy_id: $client_policy_id,emp_code: $emp_code,emp_status:['active'],policy_status:['active']);
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(client_id: $client_id,client_policy_id: $client_policy_id,emp_code: $emp_code,emp_status:['draft','enrolled'],policy_status:['draft','enrolled']);
$file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception'];
// dd($this->employeeModel->getLastQuery());
@ -1303,14 +1361,21 @@ public function calculatePremium()//family level
foreach ($employee_data_group_by_family as $emp_id => $family)
{
$transformed_famility_details = transform_db_data_to_excel($family);
$data = calculate_premimum($transformed_famility_details,$policy_terms,$slab_details,$file);
$data = calculate_premimum($transformed_famility_details,$policy_terms,$slab_details,$file,$default_si);
// dd($data);
$employee_data_group_by_family[$emp_id] = $data;
}
// dd ($employee_data_group_by_family);
if($clientPolicyId != null && $empCode != null)
{
return $employee_data_group_by_family;
}else{
// dd ($employee_data_group_by_family);
return $this->respond(['status' => 'success','code' => (count($employee_data_group_by_family) ? 200 : 404),'data' => [$employee_data_group_by_family] ], 200);
}
}
}

View File

@ -568,7 +568,9 @@ class EmployeeServiceController extends AdminController
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(client_id: $client_id,client_policy_id: $client_policy_id,emp_status: ['enrolled','draft'],policy_status:['enrolled','draft']);
$file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception'];
// $file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception'];
$file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception','created_by' => get_session_userid()];
// dd($this->employeeModel->getLastQuery());
// Kint::dump($existing_famility_details);die();
$employee_data_group_by_family = data_group_by_family($existing_famility_details,$data_source = 'db');

View File

@ -509,7 +509,7 @@ if (!function_exists('generate_relationship_code'))
if (!function_exists('calculate_premimum'))
{
function calculate_premimum($family_data,$policy_terms,$slab_details,$fileArr)
function calculate_premimum($family_data,$policy_terms,$slab_details,$fileArr,$default_si = null)
{
//
// dd($fileArr);
@ -558,7 +558,7 @@ if (!function_exists('calculate_premimum'))
if( $fileArr['id'] == null || (in_array($grid_type,[10,11]) || $transformed_familiy_member_data['temp']['source'] == 'excel'))//if file id is null then data coming from enrollment (from DB) otherwise data coming from xcel, so calculate only data from excel (new entry) note: even data coming from excel for event dependet additon we fetch other dependts from db and calculate premium for whole family
{
$transformed_familiy_member_data = premium_calculation_manager($transformed_familiy_member_data,$policy_terms,$slab_details);
$transformed_familiy_member_data = premium_calculation_manager($transformed_familiy_member_data,$policy_terms,$slab_details,$default_si);
$result[] = $transformed_familiy_member_data;
}
@ -630,7 +630,7 @@ if (!function_exists('transform_excel_data_to_db'))
if (!function_exists('premium_calculation_manager'))
{
function premium_calculation_manager($emp_data,$policy_terms,$slab_details)
function premium_calculation_manager($emp_data,$policy_terms,$slab_details,$default_si = null)
{
// grid type
// 1 = premium => si
@ -639,11 +639,12 @@ if (!function_exists('premium_calculation_manager'))
switch ($grid_type) {
case "1":
//GPA - Sum Insured (SI) * Multiplier
$employee_received_si = $emp_data['policy_details']['basic_cover_si'];
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
{
if($slab_value['si'] == $employee_received_si)
{
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
$emp_data['policy_details']['days'] = calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days;
@ -658,11 +659,12 @@ if (!function_exists('premium_calculation_manager'))
break;
case "2":
//GPA - Flat Rate for all SI
$employee_received_si = $emp_data['policy_details']['basic_cover_si'];
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
{
if($slab_value['si'] == $employee_received_si)
{
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
$emp_data['policy_details']['days'] = calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days;
@ -676,11 +678,12 @@ if (!function_exists('premium_calculation_manager'))
break;
case "3":
//GMC - SI
$employee_received_si = $emp_data['policy_details']['basic_cover_si'];
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
{
if($slab_value['si'] == $employee_received_si)
{
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
$emp_data['policy_details']['days'] = calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days;
@ -694,13 +697,17 @@ if (!function_exists('premium_calculation_manager'))
break;
case "4":
//GMC - Employees Age band
$employee_received_si = $emp_data['policy_details']['basic_cover_si'];
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
// dd($employee_received_si);
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
{
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age))
{
// dd($slab_value);
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
$emp_data['policy_details']['days'] = calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days;
@ -714,13 +721,13 @@ if (!function_exists('premium_calculation_manager'))
break;
case "5":
//GMC - Employees Age + SI
$employee_received_si = $emp_data['policy_details']['basic_cover_si'];
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
{
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age))
{
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
$emp_data['policy_details']['days'] = calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days;
@ -734,13 +741,13 @@ if (!function_exists('premium_calculation_manager'))
break;
case "6":
//GMC - Employees + Dependent Age band
$employee_received_si = $emp_data['policy_details']['basic_cover_si'];
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
{
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age))
{
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
$emp_data['policy_details']['days'] = calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days;
@ -754,13 +761,13 @@ if (!function_exists('premium_calculation_manager'))
break;
case "7":
//GMC - Employees + Dependent Age + SI
$employee_received_si = $emp_data['policy_details']['basic_cover_si'];
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
{
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age))
{
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
$emp_data['policy_details']['days'] = calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days;
@ -776,14 +783,14 @@ if (!function_exists('premium_calculation_manager'))
case "8":
//GMC - SI as per Grade or Band
$employee_received_band = $emp_data['temp']['band'];
$employee_received_si = $emp_data['policy_details']['basic_cover_si'];
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
{
if($slab_value['grade'] == $employee_received_band && $slab_value['si'] == $employee_received_si)
{
// $emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
$emp_data['policy_details']['days'] = calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days;
@ -798,13 +805,13 @@ if (!function_exists('premium_calculation_manager'))
case "9":
//GMC - Flat Rate for all
$employee_received_band = $emp_data['temp']['band'];
$employee_received_si = $emp_data['policy_details']['basic_cover_si'];
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
{
if($slab_value['grade'] == $employee_received_band && $slab_value['si'] == $employee_received_si)
{
// $emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
$emp_data['policy_details']['days'] = calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days;
@ -819,7 +826,7 @@ if (!function_exists('premium_calculation_manager'))
case "10":
//GMC - Maximum age of Dependents
$max_age = $emp_data['temp']['maxage'];
$employee_received_si = $emp_data['policy_details']['basic_cover_si'];
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
$emp_data['policy_details']['basic_cover_si'] = null;
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
{
@ -842,7 +849,7 @@ if (!function_exists('premium_calculation_manager'))
//GMC - Maximum count per Family
$max_count = $emp_data['temp']['maxcount'];
$employee_received_band = $emp_data['temp']['band'];
$employee_received_si = $emp_data['policy_details']['basic_cover_si'];
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
$emp_data['policy_details']['basic_cover_si'] = null;
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
{

View File

@ -21,6 +21,7 @@ class BatchFileModel extends Model
"created_by",
"updated_by",
"is_active",
"amount",
];
// Callbacks

View File

@ -659,6 +659,7 @@ class EmployeePolicyModel extends Model
->where('employee_polices.client_policy_id',$policy_id);
$result->whereIn('employee_polices.status', ['draft', 'enrolled']);
$result->whereIn('emp.emp_status', ['draft', 'enrolled']);
$result = $result->findAll();
return ($result);
}

View File

@ -26,6 +26,7 @@
<th class="font-weight-medium">Insurer/TPA</th>
<th class="font-weight-medium">Action</th>
<th class="font-weight-medium">Count</th>
<th class="font-weight-medium">Amount</th>
</tr>
</thead>
@ -46,6 +47,7 @@
<td><?php echo $file['insurer_or_tpa']?></td>
<td><?php echo $file['actions']?></td>
<td><?php echo $file['count']?></td>
<td><?php echo $file['amount']?></td>
</tr>
<?php }}?>

View File

@ -424,10 +424,26 @@ $(document).ready(function() {
// console.log(res)
var OptionsHTML = '';
OptionsHTML += '<option value="" selected>Select Policy</option>';
$policy_type_value = $('#policy_type').val();
$.each(res.data, function(index, item) {
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
item.id +
'">' + item.name + '</option>';
if ($policy_type_value == 3) {
if (item.policy_type_id == 5 || item.policy_type_id == 3) {
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
item.id +
'">' + item.name + '</option>';
}
}else if($policy_type_value == 2){
if (item.policy_type_id == 4 ) {
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
item.id +
'">' + item.name + '</option>';
}
}else{
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
item.id +
'">' + item.name + '</option>';
}
});
$('#policy').html(OptionsHTML);
@ -989,6 +1005,10 @@ $('#policy_type').change(function() {
$('#end_date').val('');
$('#base_policy').val('0');
if($(this).val() == 3){
toastr.warning('Please Change the Policy Terms after Submit the Policy!', 'warning');
}
if ($(this).val() != '1' && $(this).val() != '0') {
$('#base_policy_id').show();
@ -1011,7 +1031,6 @@ $('#policy_type').change(function() {
$('#base_policy_id').hide();
$('#base_policy').prop('required', false);
}
})
@ -1074,8 +1093,8 @@ $(document).ready(function(){
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)
// console.log('uri', uri)
// console.log('queryString', queryString)
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
@ -1102,11 +1121,19 @@ $(document).ready(function(){
var policeOptionHTML = '';
$policy_type_value = $('#policy_type').val();
$.each(res.policy, function(index, item) {
console.log(item)
policeOptionHTML += '<option data-id="' + item.policy_type_id +
// if ($policy_type_value == 3) {
// if (item.policy_type_id == 5) {
console.log(item);
policeOptionHTML += '<option data-id="' + item.policy_type_id +
'" value="' + item.id + '" ' + (res.data.policy_id === item.id ?
'selected="selected"' : '') + '>' + item.name + '</option>';
// }
// }
});
$('#policy').html(policeOptionHTML);

View File

@ -1,3 +1,10 @@
<style>
option:disabled {
color: gray !important; /* Set text color to gray */
background-color: lightgray !important;}
</style>
<div class="tab-pane fade active show" id="general-q-tab">
<div class="row">
@ -124,7 +131,7 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary">Save changes</button>
<a id="fetch_btn" class="btn btn-primary">Initiate Emp Onboard</a>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
@ -152,6 +159,10 @@
$('#file_upload').hide();
$(document).ready(function() {
<?php if (session()->has('success1')): ?>
toastr.success('<?= session()->getFlashdata('success1') ?>', 'success');
<?php endif; ?>
// Initialize select2
$("#client_id").select2();
$("#policy_id").select2();
@ -478,7 +489,8 @@ $(document).ready(function() {
$('#client_id').on('change', function() {
var selectedClient = $(this).val();
console.log(selectedClient);
console.log('selectedClient', selectedClient);
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
// Check if the selected option exists in apiData
@ -487,6 +499,7 @@ $(document).ready(function() {
});
console.log(foundPolicies.policies);
appendPolicies(foundPolicies.policies);
});
});
@ -573,7 +586,15 @@ document.getElementById('toggleIcon1').addEventListener('click', function() {
icon.classList.toggle('mdi-chevron-up');
});
$('#fetch_enrolled_data').click(function() {
$('#fetch_enrolled_data').click(function()
{
var policy_id = $('#policy_id').val();
var uri = '<?= base_url('util/init-Emp-onboard/') ?>' + policy_id;
console.log(policy_id);
console.log(uri);
$('#fetch_btn').attr('href', uri);
$('#emp_data').empty();
var client_id = $('#client_id').val();
@ -637,5 +658,76 @@ $('#fetch_enrolled_data').click(function() {
});
})
$(document).ready(function() {
$('#policy_id').change(function(){
var selectedpolicy = $(this).val();
console.log('selectedpolicy',selectedpolicy)
var apiURL = '<?php echo base_url();?>' + 'util/fetch-emp-count/' + selectedpolicy;
console.log(apiURL);
$.ajax({
url: apiURL,
method: 'GET',
headers: {
"Content-Type": "application/json",
"X-Requested-With": "XMLHttpRequest"
},
success: function(response) {
console.log('responce data emp_count', response);
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
try {
console.log(response.emp_count.length)
if(response.emp_count > 0){
var select = document.getElementById("upload-action-type");
for (var i = 0; i < select.options.length; i++) {
if (select.options[i].value === "inception") {
select.options[i].disabled = true;
break;
}
}
}else{
var select = document.getElementById("upload-action-type");
for (var i = 0; i < select.options.length; i++) {
if (select.options[i].value === "inception") {
select.options[i].disabled = false;
break;
}
}
}
} catch (error) {
console.error('Error parsing API response data:', error);
}
} else if (response.code === 404 && response.dataStatus === false) {
console.error('no data found', response);
} else {
console.error('Something went wrong!');
}
},
error: function(xhr, status, error) {
console.error('Error fetching data from API:', error);
var select = document.getElementById("upload-action-type");
for (var i = 0; i < select.options.length; i++) {
if (select.options[i].value === "inception") {
select.options[i].disabled = false;
break;
}
}
}
});
})
})
//--------------------------------------------------------------------------------------
</script>

175
app/Views/errors/404.php Normal file
View File

@ -0,0 +1,175 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title><?= isset($page_name) ? $page_name : 'NHance'; ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta content="" name="description" />
<meta content="NHANCE" name="NHANCE" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!-- App favicon -->
<link rel="shortcut icon" href="<?= base_url()."public"; ?>/assets/images/Nhance_Favi.svg">
<style>
@import url('https://fonts.googleapis.com/css2?family=Poppins&display=swap');
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
position: relative;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background: #22232e;
font-family: 'Poppins', sans-serif;
}
a {
text-decoration: none;
}
ul {
list-style: disc;
color: #e0ffff;
}
section {
width: 100%;
}
.container {
display: flex;
justify-content: center;
align-items: center;
flex-direction: row;
column-gap: 20px;
}
.container img {
width: 420px;
}
.text {
display: block;
padding: 40px 40px;
width: 450px;
}
.text h1 {
color: #00c2cb;
font-size: 35px;
font-weight: 700;
margin-bottom: 15px;
}
.text p {
font-size: 15px;
color: #e0ffff;
margin-bottom: 15px;
line-height: 1.5rem;
margin-bottom: 15px;
}
.text .input-box {
position: relative;
display: flex;
width: 100%;
}
.input-box input {
width: 85%;
height: 40px;
padding: 5px 15px;
font-family: 'Jost', sans-serif;
font-size: 16px;
color: #22232e;
border-radius: 5px 0px 0px 5px;
border: 2px solid #42455a;
outline: none;
}
.input-box button {
display: flex;
width: 15%;
border: 1px solid #004958;
border-radius: 0px 5px 5px 0px;
background: #004958;
color: #e0ffff;
font-size: 22px;
align-items: center;
justify-content: center;
cursor: pointer;
}
.menu {
display: flex;
flex-direction: column;
margin-top: 15px;
margin-left: 30px;
}
.menu li a {
display: flex;
font-size: 1rem;
color: #00c2cb;
transition: 0.1s;
}
@media screen and (max-width:600px) {
.container {
display: flex;
flex-direction: column-reverse;
}
.text,
.image {
width: 100%;
}
.container {
min-width: 200px;
padding: 40px 0px;
}
.text {
display: block;
width: 100%;
padding: 20px 40px;
}
.image {
display: flex;
width: 200px;
align-self: center;
justify-content: center;
margin: auto;
}
}
</style>
</head>
<body>
<section>
<div class="container">
<div class="text">
<h1><?= isset($message) && !empty($message) ? $message : '404 PAGE NOT FOUND' ?></h1>
</div>
<div><img class="image" src="https://omjsblog.files.wordpress.com/2023/07/errorimg.png" alt=""></div>
</div>
</div>
</section>
</body>
</html>

View File

@ -66,6 +66,7 @@ table.dataTable tbody td {
</style>
<!-- <button><a href="">download full file</a></button> -->
<div class="container">
<table class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" id="tickets-table">
<thead class="bg-light">
@ -118,6 +119,12 @@ $(document).ready(function() {
extend: 'excel',
text: 'Excel', // Set the title for the Excel button
title: 'ExcelErrorData', // Set your custom title here
},
{
text: 'Excel Error', // Set the text for the custom button
action: function (e, dt, node, config) {
window.location.href = '<?= base_url("util/full-excel-error-file/") . $file_id ?>';
}
}
],
paging: false, // Disable pagination

View File

@ -105,8 +105,8 @@
<label for="totalSumInsured">Family Floater</label>
</div>
<div class="col-md-6">
<input type="radio" name="family_floater" value="1"> Yes
<input type="radio" name="family_floater" value="0" style="margin-left:10px"> No
<input type="radio" name="family_floater" class="family_floater" value="1"> Yes
<input type="radio" name="family_floater" class="family_floater" value="0" style="margin-left:10px"> No
</div>
<div class="col-md-6">
</div>
@ -159,8 +159,8 @@
<label for="totalSumInsured">Waiver of Pre-existing Diseases</label>
</div>
<div class="col-md-6">
<input type="radio" name="waiverofpreexistingdiseases" value="1"> Yes, waived off
<input type="radio" name="waiverofpreexistingdiseases" value="0" style="margin-left:10px"> No
<input type="radio" name="waiverofpreexistingdiseases" class="waiverofpreexistingdiseases" value="1"> Yes, waived off
<input type="radio" name="waiverofpreexistingdiseases" class="waiverofpreexistingdiseases" value="0" style="margin-left:10px"> No
</div>
</div>
@ -206,8 +206,8 @@
<label for="totalSumInsured">9-month waiting Period waived</label>
</div>
<div class="col-md-6">
<input type="radio" name="9monthwaitingperiodwaived" value="1"> Yes, waived off
<input type="radio" name="9monthwaitingperiodwaived" value="0" style="margin-left:10px"> No </div>
<input type="radio" name="9monthwaitingperiodwaived" class="9monthwaitingperiodwaived" value="1"> Yes, waived off
<input type="radio" name="9monthwaitingperiodwaived" class="9monthwaitingperiodwaived" value="0" style="margin-left:10px"> No </div>
</div>
<div class="row" style="margin-bottom: 10px;">
@ -224,8 +224,8 @@
<label for="totalSumInsured">Waiver of 1, 2, 3 & 4th year Exclusions</label>
</div>
<div class="col-md-6">
<input type="radio" name="waiverof1,2,3&4thyearexclusions" value="1"> Yes, waived off
<input type="radio" name="waiverof1,2,3&4thyearexclusions" value="0" style="margin-left:10px"> No
<input type="radio" name="waiverof1,2,3&4thyearexclusions" class="waiverof1234thyearexclusions" value="1"> Yes, waived off
<input type="radio" name="waiverof1,2,3&4thyearexclusions" class="waiverof1234thyearexclusions" value="0" style="margin-left:10px"> No
</div>
</div>
@ -235,8 +235,8 @@
<label for="totalSumInsured">Waiver of 30 days waiting period</label>
</div>
<div class="col-md-6">
<input type="radio" name="waiverof30dayswaitingperiod" value="1"> Yes, waived off
<input type="radio" name="waiverof30dayswaitingperiod" value="0" style="margin-left:10px"> No
<input type="radio" name="waiverof30dayswaitingperiod" class="waiverof30dayswaitingperiod" value="1"> Yes, waived off
<input type="radio" name="waiverof30dayswaitingperiod" class="waiverof30dayswaitingperiod" value="0" style="margin-left:10px"> No
</div>
</div>
@ -254,8 +254,8 @@
<label for="totalSumInsured">Congenital Diseases - Internal</label>
</div>
<div class="col-md-6">
<input type="radio" name="congenitaldiseasesinternal" value="internal"> Internal Covered
<input type="radio" name="congenitaldiseasesinternal" value="no" style="margin-left:10px"> No </div>
<input type="radio" name="congenitaldiseasesinternal" class="congenitaldiseasesinternal" value="internal"> Internal Covered
<input type="radio" name="congenitaldiseasesinternal" class="congenitaldiseasesinternal" value="no" style="margin-left:10px"> No </div>
</div>
<div class="row" style="margin-bottom: 10px;">
@ -324,8 +324,8 @@
<label for="totalSumInsured">Ailment capping</label>
</div>
<div class="col-md-6">
<input type="radio" name="ailmentcapping" value="1"> Yes
<input type="radio" name="ailmentcapping" value="0" style="margin-left:10px"> No
<input type="radio" name="ailmentcapping" class="ailmentcapping" value="1"> Yes
<input type="radio" name="ailmentcapping" class="ailmentcapping" value="0" style="margin-left:10px"> No
</div>
</div>
@ -361,8 +361,8 @@
<label for="totalSumInsured">Reasonable and Customary Charges</label>
</div>
<div class="col-md-6">
<input type="radio" name="reasonableandcustomarycharges" value="1">Applicable
<input type="radio" name="reasonableandcustomarycharges" value="0" style="margin-left:10px">Not Applicable </div>
<input type="radio" name="reasonableandcustomarycharges" class="reasonableandcustomarycharges" value="1">Applicable
<input type="radio" name="reasonableandcustomarycharges" class="reasonableandcustomarycharges" value="0" style="margin-left:10px">Not Applicable </div>
</div>
<div class="row" style="margin-bottom: 10px;">
@ -370,8 +370,8 @@
<label for="totalSumInsured">Day Care Treatment</label>
</div>
<div class="col-md-6">
<input type="radio" name="daycaretreatment" value="1"> Yes
<input type="radio" name="daycaretreatment" value="0" style="margin-left:10px"> No </div>
<input type="radio" name="daycaretreatment" class="daycaretreatment" value="1"> Yes
<input type="radio" name="daycaretreatment" class="daycaretreatment" value="0" style="margin-left:10px"> No </div>
</div>
<div class="row" style="margin-bottom: 10px;">
@ -379,8 +379,8 @@
<label for="totalSumInsured">AYUSH treatment cover</label>
</div>
<div class="col-md-6">
<input type="radio" name="ayudhtreatmentcover" value="1"> Yes
<input type="radio" name="ayudhtreatmentcover" value="0" style="margin-left:10px"> No
<input type="radio" name="ayudhtreatmentcover" class="ayudhtreatmentcover" value="1"> Yes
<input type="radio" name="ayudhtreatmentcover" class="ayudhtreatmentcover" value="0" style="margin-left:10px"> No
</div>
</div>
@ -398,8 +398,8 @@
<label for="totalSumInsured">Sum Insured enhancement</label>
</div>
<div class="col-md-6">
<input type="radio" name="suminsuredenhancement" value="1"> Yes
<input type="radio" name="suminsuredenhancement" value="0" style="margin-left:10px"> No
<input type="radio" name="suminsuredenhancement" class="suminsuredenhancement" value="1"> Yes
<input type="radio" name="suminsuredenhancement" class="suminsuredenhancement" value="0" style="margin-left:10px"> No
</div>
</div>
@ -640,7 +640,7 @@ var grid_html = '';
var gmc_policy_type_id = $(this).attr('id');
console.log(gmc_policy_type_id)
// console.log(gmc_policy_type_id)
if(gmc_policy_type_id == 'GMC'){
@ -657,7 +657,9 @@ var grid_html = '';
data: {client_policy_id: client_policy_id},
success: function(response) {
console.log('response',response);
console.log('count', response.count);
// console.log('count', response.count);
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
@ -684,6 +686,11 @@ var grid_html = '';
if (response) {
if ( response.emp_count_by_policy != 0) {
$('#btnGridSubmit1').hide();
$('#myButtonSpecialCondition').hide();
}
let jsonObject = JSON.parse(response.data);
Object.keys(jsonObject).forEach(function(key) {
if (key.includes("special_condition_label") || key.includes("special_condition_input")) {
@ -737,6 +744,53 @@ var grid_html = '';
}
}
if(response.policy_addon == '3'){
$('.jodit-container').prop('disabled', true);
$('.waiverofpreexistingdiseases').prop('disabled', true);
$('#maternitycoverage').prop('disabled', true);
$('#twindelivery').prop('disabled', true);
$('#preandpostnatal').prop('disabled', true);
$('#babyday1cover').prop('disabled', true);
$('.9monthwaitingperiodwaived').prop('disabled', true);
$('#coverfromthedateofjoining').prop('disabled', true);
$('.waiverof1234thyearexclusions').prop('disabled', true);
$('.waiverof30dayswaitingperiod').prop('disabled', true);
$('#prehospitalizationcover').prop('disabled', true);
$('.congenitaldiseasesinternal').prop('disabled', true);
$('#copayzonewisecopay').prop('disabled', true);
$('#bioabsorbablestenttoriclensmultifocallens').prop('disabled', true);
$('#roomrentlimit').prop('disabled', true);
$('#proportionatedeductionclause').prop('disabled', true);
$('#nursingallowance').prop('disabled', true);
$('.ailmentcapping').prop('disabled', true);
$('#ambulancecharges').prop('disabled', true);
$('#airambulance').prop('disabled', true);
$('#familytransportationbenefit').prop('disabled', true);
$('.reasonableandcustomarycharges').prop('disabled', true);
$('.daycaretreatment').prop('disabled', true);
$('.ayudhtreatmentcover').prop('disabled', true);
$('#armdcovered').prop('disabled', true);
$('.suminsuredenhancement').prop('disabled', true);
$('#automaticsuminsuredreinstatement').prop('disabled', true);
$('#lasiksurgery').prop('disabled', true);
$('#midterminclusion').prop('disabled', true);
$('#capd').prop('disabled', true);
$('#organdonorexpenses').prop('disabled', true);
$('#moderntreatmentsasperirdai').prop('disabled', true);
$('#days_of_discharge').prop('disabled', true);
$('#days_from_dod').prop('disabled', true);
setTimeout(function() {
var editor1 = new Jodit('#additionalsicknessbenefit');
var editor2 = new Jodit('#Wellness');
editor1.setReadOnly(true);
editor2.setReadOnly(true);
}, 3000);
}
}