MERGE_UAT_ISSUES
This commit is contained in:
commit
f9d63a8fe9
@ -9,6 +9,8 @@ use CodeIgniter\Router\RouteCollection;
|
||||
|
||||
$routes->get('/swagger', 'SwaggerController::index', ['filter' => 'authMVC']);
|
||||
|
||||
// Reminder Mail Notification
|
||||
$routes->get("reminder_mail", "NotificationController::reminder_mail");
|
||||
|
||||
// $routes->get('/', 'LoginController::index');
|
||||
$routes->get('/test', 'Home::index');
|
||||
@ -18,6 +20,7 @@ $routes->get('/oauth2callback', 'LoginController::receiveGoogleOAuthResponse');
|
||||
$routes->get('/auth/google', 'LoginController::initiateGoogleOAuth');
|
||||
$routes->get('/update-emp-policy-status', 'ClientController::updateEmpAndPolicyStatus');
|
||||
$routes->get('download-e-card/(:segment)', 'EmployeeController::generateIDCardForEmployee/$1');
|
||||
$routes->get('download-kyc-docs/(:segment)', 'ClientController::downloadKYCDocument/$1');
|
||||
|
||||
|
||||
|
||||
@ -63,6 +66,11 @@ $routes->group("/client", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("list/(:any)", "ClientController::editClientOnboarding/$1");
|
||||
|
||||
|
||||
$routes->group("notification", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post("create", "NotificationController::createNotification");
|
||||
$routes->post("update_enable", "NotificationController::update_enable");
|
||||
$routes->get("getMailTemplateData/(:any)/(:any)", "NotificationController::getMailTemplateData/$1/$2");
|
||||
});
|
||||
|
||||
$routes->group("general", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post("create", "ClientController::createClientGeneralInfo");
|
||||
@ -219,6 +227,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("full-excel-error-file/(:any)", "EmployeeController::downloadFullExcelErrorFile/$1");
|
||||
$routes->get("id-card", "EmployeeController::viewECard/$1");
|
||||
$routes->get("preview-card/(:any)", "EmployeeController::previewTemplate/$1");
|
||||
$routes->get("export-import-error-list/(:any)", "EmployeeController::errorListExportImport/$1");
|
||||
});
|
||||
|
||||
$routes->cli('cli/processjob', 'JobWorker::processJob');
|
||||
@ -247,6 +256,7 @@ $routes->post("/calculatePremium", "EmployeeRestController::calculatePremium");
|
||||
|
||||
|
||||
|
||||
|
||||
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
||||
|
||||
$routes->get("getEmployeeProfile", "EmployeeRestController::getEmployeeProfile");
|
||||
|
||||
@ -30,6 +30,7 @@ use App\Models\PolicyPremium1Model;
|
||||
use App\Models\PolicyPremium2Model;
|
||||
use App\Models\EmployeeModel;
|
||||
use App\Models\EmployeePolicyModel;
|
||||
use App\Models\NotificationModel;
|
||||
|
||||
|
||||
|
||||
@ -60,6 +61,7 @@ class ClientController extends AdminController
|
||||
protected $clientDepositModel;
|
||||
protected $employeeModel;
|
||||
protected $employeePolicyModel;
|
||||
protected $notificationModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -87,6 +89,7 @@ class ClientController extends AdminController
|
||||
$this->policyPremium2Model = new PolicyPremium2Model();
|
||||
$this->employeeModel = new EmployeeModel();
|
||||
$this->employeePolicyModel = new EmployeePolicyModel();
|
||||
$this->notificationModel = new NotificationModel();
|
||||
|
||||
|
||||
|
||||
@ -267,17 +270,18 @@ class ClientController extends AdminController
|
||||
// dd('Hi');
|
||||
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($id);
|
||||
// dd($this->clientPolicyModel->getLastQuery());
|
||||
// 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));
|
||||
}
|
||||
|
||||
$editData['client_policy'] = $clientPoliceData;
|
||||
|
||||
|
||||
// echo "<pre>";
|
||||
// dd($clientPoliceData); die;
|
||||
$editData['notification'] =$this->notificationModel->select('template_name,enabled')->where('client_id',$id)->findAll();
|
||||
$editData['placeHolders'] = ['member_name','nhance_logo','tpa_id','ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'client_name'];
|
||||
|
||||
|
||||
echo view('layout/header', $headerData);
|
||||
echo view('client_onboarding', $editData);
|
||||
@ -587,7 +591,14 @@ class ClientController extends AdminController
|
||||
$data['insurer_id'] = $insurerId;
|
||||
|
||||
$tpaValue = (string) $this->request->getPost('tpa');
|
||||
list($tpaBranchId, $tpaId) = explode('-', $tpaValue);
|
||||
|
||||
if ($tpaValue === null || $tpaValue === '') {
|
||||
$tpaBranchId = null;
|
||||
$tpaId = null;
|
||||
} else {
|
||||
list($tpaBranchId, $tpaId) = explode('-', $tpaValue);
|
||||
}
|
||||
|
||||
|
||||
$data['client_id'] = $client_id;
|
||||
$data['tpa_branch_id'] = $tpaBranchId;
|
||||
@ -964,6 +975,7 @@ class ClientController extends AdminController
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
} else if ($policy_grid_id == '11') {
|
||||
|
||||
$premium = $this->request->getPost('11_premium[]');
|
||||
$sum_insure = $this->request->getPost('11_si[]');
|
||||
$grade = $this->request->getPost('11_grade[]');
|
||||
@ -972,7 +984,7 @@ class ClientController extends AdminController
|
||||
$data['premium'] = str_replace(',', '', $premium[$i]);
|
||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||
$data['grade'] = $grade[$i];
|
||||
$data['max_si'] = $max_sum_insure[$i];
|
||||
$data['max_si'] = str_replace(',', '', $max_sum_insure[$i]);
|
||||
$dataa = $this->policyPremium2Model->insert($data);
|
||||
}
|
||||
$data = $this->request->getPost();
|
||||
@ -1348,6 +1360,13 @@ class ClientController extends AdminController
|
||||
$data['familytransportationbenefit'] =str_replace(',', '',$this->request->getPost("familytransportationbenefit"));
|
||||
$data['reasonableandcustomarycharges'] =str_replace(',', '',$this->request->getPost("reasonableandcustomarycharges"));
|
||||
$data['ayudhtreatmentcover'] =str_replace(',', '',$this->request->getPost("ayudhtreatmentcover"));
|
||||
|
||||
if ($data['ayudhtreatmentcover'] == 1) {
|
||||
$data['ayushTreatmentCoverData'] = str_replace(',', '',$this->request->getPost("ayushTreatmentCoverData"));
|
||||
}else{
|
||||
$data['ayushTreatmentCoverData'] ="";
|
||||
}
|
||||
|
||||
$data['armdcovered'] =str_replace(',', '',$this->request->getPost("armdcovered"));
|
||||
$data['suminsuredenhancement'] =str_replace(',', '',$this->request->getPost("suminsuredenhancement"));
|
||||
$data['automaticsuminsuredreinstatement'] =str_replace(',', '',$this->request->getPost("automaticsuminsuredreinstatement"));
|
||||
@ -1363,6 +1382,15 @@ class ClientController extends AdminController
|
||||
$data['special_condition_label'] = str_replace(',', '',$this->request->getPost("special_condition_label")) ?? [];
|
||||
$data['special_condition_input'] = str_replace(',', '',$this->request->getPost("special_condition_input")) ?? [];
|
||||
|
||||
$data['cataract'] =str_replace(',', '',$this->request->getPost("cataract"));
|
||||
|
||||
if ($data['cataract'] == 1) {
|
||||
$data['cataractData'] = str_replace(',', '',$this->request->getPost("cataractData"));
|
||||
}else{
|
||||
$data['cataractData'] ="";
|
||||
}
|
||||
|
||||
|
||||
$jsonData = json_encode($data);
|
||||
$dataa = array(
|
||||
'policy_terms' => $jsonData,
|
||||
@ -1656,4 +1684,17 @@ class ClientController extends AdminController
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function downloadKYCDocument($file_name)
|
||||
{
|
||||
|
||||
$file = WRITEPATH . 'uploads/client_kyc_documents/' . $file_name; // Example file path
|
||||
|
||||
if (file_exists($file)) {
|
||||
return $this->response->download($file, null)->setFileName($file_name);
|
||||
} else {
|
||||
return "File not found.";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -22,6 +22,11 @@ class DashboardController extends AdminController
|
||||
echo view('layout/footer');
|
||||
}
|
||||
|
||||
public function dashboardNotifications()
|
||||
{
|
||||
//pull notofications to dashboard especially for file upload cases
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\DepositHelper;
|
||||
use App\Helpers\MailHelper;
|
||||
use App\Helpers\sendMailNotification;
|
||||
|
||||
|
||||
use App\Models\EmployeeModel;
|
||||
@ -20,10 +21,13 @@ use App\Models\BatchListModel;
|
||||
use App\Models\BatchFileModel;
|
||||
use App\Models\EmpEndorsementModel;
|
||||
use App\Models\ClientDepositModel;
|
||||
use App\Models\NotificationModel;
|
||||
|
||||
use App\Controllers\Jobs;
|
||||
use App\Controllers\JobWorker;
|
||||
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
// use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
|
||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
use PhpOffice\PhpSpreadsheet\Reader\Exception as SpreadsheetReaderException;
|
||||
@ -43,6 +47,7 @@ class EmpDataServiceController extends BaseController
|
||||
protected $batchFileModel;
|
||||
protected $empEndorsementModel;
|
||||
protected $clientDepositModel;
|
||||
protected $notificationModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -58,9 +63,10 @@ class EmpDataServiceController extends BaseController
|
||||
$this->batchFileModel = new BatchFileModel();
|
||||
$this->empEndorsementModel = new EmpEndorsementModel();
|
||||
$this->clientDepositModel = new ClientDepositModel();
|
||||
$this->notificationModel = new NotificationModel();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The below function are Inserts batch files and corresponding batch list entries into the database.
|
||||
*
|
||||
@ -93,6 +99,19 @@ class EmpDataServiceController extends BaseController
|
||||
}
|
||||
|
||||
|
||||
public function insertBatchList($params){
|
||||
|
||||
foreach ($params['batch_list_data'] as $value) {
|
||||
|
||||
$batch_list_data['batch_code'] = $params['batch_code'];
|
||||
$batch_list_data['emp_policy_id'] = $value['primaryKey'];
|
||||
$batch_list_data['created_by'] = get_session_userid();
|
||||
$this->batchListModel->insert($batch_list_data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates an Excel file for Inception_Addititon_DependentAddititon, Correction, SI_Enhancement and Deletion events based on given export data.
|
||||
*
|
||||
@ -107,23 +126,31 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
public function generateExcelForAdditionandInception($export_data)
|
||||
{
|
||||
|
||||
$return = $this->removeOldExportInfoFromBatchFile($export_data);
|
||||
|
||||
// Fetch employee data for export from the database
|
||||
$objects = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($export_data);
|
||||
|
||||
|
||||
$insurer_id = $this->clientPolicyModel->where('id', $export_data['client_policy_id'])->first();
|
||||
|
||||
$cash_balance = $this->clientDepositModel->where('client_id',$export_data['client_id'] )->where('insurer_id', $insurer_id['insurer_id'])->orderBy('id', 'DESC')->first();
|
||||
|
||||
|
||||
$cash_balance = $this->clientDepositModel->where('client_id', $export_data['client_id'])->where('insurer_id', $insurer_id['insurer_id'])->orderBy('id', 'DESC')->first();
|
||||
|
||||
|
||||
$totals = 0;
|
||||
foreach ($objects as $key => $value) {
|
||||
|
||||
|
||||
$totals += $value->total;
|
||||
}
|
||||
|
||||
if((int) $cash_balance['balance'] < (int) $totals){
|
||||
if (!empty($cash_balance)) {
|
||||
|
||||
return 0;
|
||||
if ((int) $cash_balance['balance'] < (int) $totals) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
// return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -131,6 +158,7 @@ class EmpDataServiceController extends BaseController
|
||||
$count = count($objects);
|
||||
$export_data['count'] = $count;
|
||||
$export_data['amount'] = $totals;
|
||||
$export_data['status'] = 'success';
|
||||
|
||||
|
||||
$this->myLogger->logme('error', 'Inception export data count : {data}', ['data' => $count]);
|
||||
@ -177,11 +205,27 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
// If Excel generation is successful
|
||||
if ($success) {
|
||||
|
||||
|
||||
// Batch files and list entry
|
||||
$return = $this->batchFilesAndBatchListEntry($export_data, $objects);
|
||||
// $return = $this->batchFilesAndBatchListEntry($export_data, $objects);
|
||||
|
||||
$random_number_count = 4;
|
||||
$export_data['batch_code'] = generate_random_string($random_number_count);
|
||||
$export_data['created_by'] = get_session_userid();
|
||||
|
||||
$insert = $this->batchFileModel->insert($export_data);
|
||||
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
|
||||
$batch_code = $batch_file_batch_code['batch_code'];
|
||||
|
||||
// $this->insertBatchList(['batch_code' => $batch_code, 'batch_list_data' => $objects ]);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'insertBatchList','payload' => ['batch_code' => $batch_code, 'batch_list_data' => $objects ]]);
|
||||
|
||||
|
||||
// If batch operation is successful
|
||||
if ($return) {
|
||||
if (true) {
|
||||
// Set headers for Excel file download
|
||||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Disposition: attachment;filename="' . $export_data['file_name'] . '"');
|
||||
@ -195,7 +239,9 @@ class EmpDataServiceController extends BaseController
|
||||
fclose($tempFile);
|
||||
|
||||
return true; // Excel file successfully generated and exported
|
||||
|
||||
} else {
|
||||
|
||||
return false; // Batch operation failed
|
||||
}
|
||||
}
|
||||
@ -289,7 +335,7 @@ class EmpDataServiceController extends BaseController
|
||||
$ids = [];
|
||||
$objects = $this->employeePolicyModel->getSIEnhancementEmployeesDataForExportExcel($export_data);
|
||||
|
||||
|
||||
|
||||
$totals = 0;
|
||||
foreach ($objects as $obj) {
|
||||
$ids[] = $obj->endorsement_primarykey;
|
||||
@ -395,7 +441,7 @@ class EmpDataServiceController extends BaseController
|
||||
$count = count($objects);
|
||||
$export_data['count'] = $count;
|
||||
$export_data['amount'] = $rounded_totals;
|
||||
|
||||
|
||||
|
||||
$this->myLogger->logme('error', 'Deletion export data count : {data}', ['data' => $count]);
|
||||
|
||||
@ -490,181 +536,467 @@ 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'];
|
||||
|
||||
$data = $this->readExcelToArray($file);
|
||||
|
||||
if (!$data) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unset($data[0]);
|
||||
array_pop($data);
|
||||
$count = count($data);
|
||||
|
||||
$missing_id = [];
|
||||
$empty_emp_tpa_uh_ids = [];
|
||||
$totals = 0;
|
||||
foreach ($data as $key => $value) {
|
||||
|
||||
try {
|
||||
|
||||
|
||||
if ($import_data['insurer_or_tpa'] == 'tpa') {
|
||||
|
||||
if ($value[15] === null) {
|
||||
$missing_id[] = $key + 1;
|
||||
}
|
||||
} else if ($import_data['insurer_or_tpa'] == 'insurer') {
|
||||
|
||||
if ($value[16] === null) {
|
||||
$missing_id[] = $key + 1;
|
||||
}
|
||||
}
|
||||
|
||||
$emp_code = $value[2];
|
||||
$name = $value[1];
|
||||
$totals += $value[20];
|
||||
|
||||
$db = \Config\Database::connect();
|
||||
|
||||
// Execute the query
|
||||
$query = $db->table('employee_polices');
|
||||
$query->select('employee_polices.id');
|
||||
$query->join('employees', 'employees.id = employee_polices.employee_id');
|
||||
$query->where('employee_polices.client_policy_id', $client_policy_id);
|
||||
$query->where('employees.client_id', $client_id);
|
||||
$query->where('employees.name', $name);
|
||||
$query->where('employees.emp_code', $emp_code);
|
||||
if ($import_data['insurer_or_tpa'] == 'tpa') {
|
||||
|
||||
$query->where('(employee_polices.tpa_id IS NULL OR employee_polices.tpa_id = "")');
|
||||
} else if ($import_data['insurer_or_tpa'] == 'insurer') {
|
||||
|
||||
$query->where('(employee_polices.uhid IS NULL OR employee_polices.uhid = "")');
|
||||
}
|
||||
$query->where('employee_polices.is_active', 1);
|
||||
$query->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) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$missing_id_count = count($missing_id);
|
||||
$empty_id_count = count($empty_emp_tpa_uh_ids);
|
||||
|
||||
|
||||
if ($import_data['insurer_or_tpa'] == 'tpa') {
|
||||
|
||||
if ($empty_id_count == 0) {
|
||||
|
||||
return 3;
|
||||
}
|
||||
|
||||
if ($missing_id_count != 0) {
|
||||
|
||||
return 2;
|
||||
}
|
||||
} else if ($import_data['insurer_or_tpa'] == 'insurer') {
|
||||
|
||||
if ($empty_id_count == 0) {
|
||||
|
||||
return 5;
|
||||
}
|
||||
|
||||
if ($missing_id_count != 0) {
|
||||
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
// if ($missing_id_count != $count) {
|
||||
|
||||
// return 2;
|
||||
// }
|
||||
|
||||
|
||||
// if ($empty_emp_tpa_uh_ids != $count) {
|
||||
|
||||
// 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;
|
||||
|
||||
$random_number_count = 4;
|
||||
$import_data['batch_code'] = generate_random_string($random_number_count);
|
||||
$import_data['created_by'] = get_session_userid();
|
||||
$import_data['status'] = 'pending';
|
||||
$import_data['file_name'] = $filename;
|
||||
$import_data['amount'] = $totals;
|
||||
|
||||
$insert = $this->batchFileModel->insert($import_data);
|
||||
|
||||
$this->insertBatchFileAndBatchListForImportExcel($import_data, $empty_emp_tpa_uh_ids);
|
||||
|
||||
// dd($import_data, $empty_emp_tpa_uh_ids);
|
||||
|
||||
|
||||
$tpa_id = [];
|
||||
$uhid = [];
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
$tpa_id[] = $value[15];
|
||||
$uhid[] = $value[16];
|
||||
}
|
||||
|
||||
foreach ($empty_emp_tpa_uh_ids as $key => $id) {
|
||||
|
||||
$dataToUpdateTPAID = ['tpa_id' => $tpa_id[$key]];
|
||||
$dataToUpdateUHID = ['uhid' => $uhid[$key]];
|
||||
|
||||
$this->employeePolicyModel->where('id', $id)
|
||||
->where('(employee_polices.tpa_id IS NULL OR employee_polices.tpa_id = "")')
|
||||
->set($dataToUpdateTPAID)->update();
|
||||
|
||||
$this->employeePolicyModel->where('id', $id)
|
||||
->where('(employee_polices.uhid IS NULL OR employee_polices.uhid = "")')
|
||||
->set($dataToUpdateUHID)->update();
|
||||
}
|
||||
|
||||
|
||||
if($import_data['insurer_or_tpa'] == 'tpa'){
|
||||
|
||||
$policy_name = $this->getPolicyNameUsingClientPolicyId($client_policy_id);
|
||||
$depositeData = [
|
||||
'employeeIds' => $empty_emp_tpa_uh_ids,
|
||||
'client_id' => $client_id,
|
||||
'client_policy_id' => $client_policy_id,
|
||||
'count' => $count,
|
||||
'event' => $import_data['event_type'],
|
||||
'policy_name' => $policy_name['policy_name'],
|
||||
];
|
||||
|
||||
$this->cashDepositCalculationForInception($depositeData);
|
||||
|
||||
|
||||
$this->sendMailForDownloadingECard($empty_emp_tpa_uh_ids);
|
||||
|
||||
}
|
||||
$file_id['file_id'] = $insert;
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'importInceptionFileValidation','payload' => ['file_id' => $insert]]);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
public function importInceptionFileValidation($params)
|
||||
{
|
||||
|
||||
$file_id = $params['file_id'];
|
||||
$file = $this->batchFileModel->where('id', $file_id)->first();
|
||||
$client_id = $file['client_id'];
|
||||
$client_policy_id = $file['client_policy_id'];
|
||||
$batch_code = $file['batch_code'];
|
||||
|
||||
|
||||
$insurer_or_tpa = $file['insurer_or_tpa'];
|
||||
if ($insurer_or_tpa == 'tpa') {
|
||||
|
||||
$id = 'tpa_id';
|
||||
} else if ($insurer_or_tpa == 'insurer') {
|
||||
|
||||
$id = 'uhid';
|
||||
}
|
||||
|
||||
$file_name_with_path = WRITEPATH . "/uploads/import_excel/" . $file['file_name'];
|
||||
$excel_data = $this->readExcelFileToArray($file_name_with_path);
|
||||
unset($excel_data[0]);
|
||||
array_pop($excel_data);
|
||||
|
||||
$emp_count = count($excel_data);
|
||||
|
||||
$employee_data = $this->employeePolicyModel
|
||||
->select('
|
||||
|
||||
employee_polices.id as emp_policy_id,
|
||||
employees.name AS emp_name,
|
||||
employees.emp_code AS emp_code,
|
||||
"Has Define" as emp_type,
|
||||
employees.relationship_code AS emp_relationship_code,
|
||||
employees.dob AS emp_dob,
|
||||
employees.gender AS emp_gender,
|
||||
employee_polices.pre_existing_alignments,
|
||||
employee_polices.basic_cover_si,
|
||||
employee_polices.date_coverage,
|
||||
TIMESTAMPDIFF(YEAR, employees.dob, CURDATE()) AS emp_age,
|
||||
employees.relationship AS emp_relationship,
|
||||
employees.change_event AS change_event,
|
||||
employee_polices.policy_end_date,
|
||||
employee_polices.days,
|
||||
employee_polices.tpa_id,
|
||||
employee_polices.uhid,
|
||||
employee_polices.premium,
|
||||
employee_polices.rata_premimum,
|
||||
employee_polices.gst,
|
||||
(employee_polices.rata_premimum + employee_polices.gst) AS total
|
||||
')
|
||||
|
||||
->join('employees', 'employees.id = employee_polices.employee_id')
|
||||
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||
->where('employees.client_id', $client_id)
|
||||
->where("employee_polices.{$id} IS NULL OR employee_polices.{$id} = ''")
|
||||
->findAll();
|
||||
|
||||
// echo '<pre>';
|
||||
// print_r($employee_data); die;
|
||||
|
||||
|
||||
if ($employee_data == null || empty($employee_data)) {
|
||||
|
||||
if ($insurer_or_tpa == 'tpa') {
|
||||
|
||||
$data = [
|
||||
'status' => 'failed-1',
|
||||
];
|
||||
|
||||
$this->batchFileModel->where('id', $file_id)->set($data)->update();
|
||||
|
||||
return 3;
|
||||
|
||||
} else if ($insurer_or_tpa == 'insurer') {
|
||||
|
||||
$data = [
|
||||
'status' => 'failed-2',
|
||||
];
|
||||
|
||||
$this->batchFileModel->where('id', $file_id)->set($data)->update();
|
||||
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
|
||||
$excel_data_count = count($excel_data);
|
||||
$emp_data_count = count($employee_data);
|
||||
|
||||
// dd($excel_data_count, $emp_data_count);
|
||||
$difference = $emp_data_count - $excel_data_count;
|
||||
|
||||
$status = 'in-progress';
|
||||
if ($excel_data_count < $emp_data_count) {
|
||||
|
||||
$status = 'in-progress-partially';
|
||||
$partially_updated_data = 'Expected : ' . $emp_data_count . ', ' . 'Updated : ' . $excel_data_count . ', ' . 'difference : ' . $difference;
|
||||
}
|
||||
|
||||
|
||||
if ($emp_data_count < $excel_data_count) {
|
||||
|
||||
$data = [
|
||||
'status' => 'failed-3',
|
||||
];
|
||||
|
||||
$this->batchFileModel->where('id', $file_id)->set($data)->update();
|
||||
return 6;
|
||||
}
|
||||
|
||||
|
||||
$errors = []; // Initialize an array to store errors
|
||||
$missing_id = [];
|
||||
$batch_list_id = [];
|
||||
|
||||
foreach ($employee_data as $key => $emp_value) {
|
||||
|
||||
$key = $key + 1;
|
||||
|
||||
if(!isset($excel_data[$key])){
|
||||
break;
|
||||
}
|
||||
|
||||
if ($insurer_or_tpa == 'tpa') {
|
||||
if ($excel_data[$key][15] === null) {
|
||||
$missing_id[$key][] = [
|
||||
'row' => $key,
|
||||
'column' => 15,
|
||||
];
|
||||
}
|
||||
} else if ($insurer_or_tpa == 'insurer') {
|
||||
if ($excel_data[$key][16] === null) {
|
||||
$missing_id[$key][] = [
|
||||
'row' => $key,
|
||||
'column' => 16,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($emp_value['emp_name'] != $excel_data[$key][1]) {
|
||||
$errors[$key][] = [
|
||||
'row' => $key,
|
||||
'column' => 1,
|
||||
'db_data' => $emp_value['emp_name'],
|
||||
'excel_data' => $excel_data[$key][1]
|
||||
];
|
||||
}
|
||||
|
||||
if ($emp_value['emp_code'] != $excel_data[$key][2]) {
|
||||
$errors[$key][] = [
|
||||
'row' => $key,
|
||||
'column' => 2,
|
||||
'db_data' => $emp_value['emp_code'],
|
||||
'excel_data' => $excel_data[$key][2]
|
||||
];
|
||||
}
|
||||
|
||||
if ($emp_value['emp_dob'] != $excel_data[$key][5]) {
|
||||
$errors[$key][] = [
|
||||
'row' => $key,
|
||||
'column' => 5,
|
||||
'db_data' => $emp_value['emp_dob'],
|
||||
'excel_data' => $excel_data[$key][5]
|
||||
];
|
||||
}
|
||||
|
||||
if ($emp_value['emp_gender'] != $excel_data[$key][6]) {
|
||||
$errors[$key][] = [
|
||||
'row' => $key,
|
||||
'column' => 6,
|
||||
'db_data' => $emp_value['emp_gender'],
|
||||
'excel_data' => $excel_data[$key][6]
|
||||
];
|
||||
}
|
||||
|
||||
if ($emp_value['pre_existing_alignments'] != $excel_data[$key][7]) {
|
||||
$errors[$key][] = [
|
||||
'row' => $key,
|
||||
'column' => 7,
|
||||
'db_data' => $emp_value['pre_existing_alignments'],
|
||||
'excel_data' => $excel_data[$key][7]
|
||||
];
|
||||
}
|
||||
|
||||
if ($emp_value['basic_cover_si'] != $excel_data[$key][8]) {
|
||||
$errors[$key][] = [
|
||||
'row' => $key,
|
||||
'column' => 8,
|
||||
'db_data' => $emp_value['basic_cover_si'],
|
||||
'excel_data' => $excel_data[$key][8]
|
||||
];
|
||||
}
|
||||
|
||||
if ($emp_value['emp_relationship'] != $excel_data[$key][11]) {
|
||||
$errors[$key][] = [
|
||||
'row' => $key,
|
||||
'column' => 11,
|
||||
'db_data' => $emp_value['emp_relationship'],
|
||||
'excel_data' => $excel_data[$key][11]
|
||||
];
|
||||
}
|
||||
|
||||
if ($emp_value['policy_end_date'] != $excel_data[$key][13]) {
|
||||
$errors[$key][] = [
|
||||
'row' => $key,
|
||||
'column' => 13,
|
||||
'db_data' => $emp_value['policy_end_date'],
|
||||
'excel_data' => $excel_data[$key][13]
|
||||
];
|
||||
}
|
||||
|
||||
if ($emp_value['days'] != $excel_data[$key][14]) {
|
||||
$errors[$key][] = [
|
||||
'row' => $key,
|
||||
'column' => 14,
|
||||
'db_data' => $emp_value['days'],
|
||||
'excel_data' => $excel_data[$key][14]
|
||||
];
|
||||
}
|
||||
|
||||
if ($emp_value['premium'] != $excel_data[$key][17]) {
|
||||
$errors[$key][] = [
|
||||
'row' => $key,
|
||||
'column' => 17,
|
||||
'db_data' => $emp_value['premium'],
|
||||
'excel_data' => $excel_data[$key][17]
|
||||
];
|
||||
}
|
||||
|
||||
if ($emp_value['rata_premimum'] != $excel_data[$key][18]) {
|
||||
$errors[$key][] = [
|
||||
'row' => $key,
|
||||
'column' => 18,
|
||||
'db_data' => $emp_value['rata_premimum'],
|
||||
'excel_data' => $excel_data[$key][18]
|
||||
];
|
||||
}
|
||||
|
||||
if ($emp_value['gst'] != $excel_data[$key][19]) {
|
||||
$errors[$key][] = [
|
||||
'row' => $key,
|
||||
'column' => 19,
|
||||
'db_data' => $emp_value['gst'],
|
||||
'excel_data' => $excel_data[$key][19]
|
||||
];
|
||||
}
|
||||
|
||||
if ($insurer_or_tpa == 'tpa') {
|
||||
|
||||
if ($emp_value['uhid'] != $excel_data[$key][16]) {
|
||||
$errors[$key][] = [
|
||||
'row' => $key,
|
||||
'column' => 16,
|
||||
'db_data' => $emp_value['uhid'],
|
||||
'excel_data' => $excel_data[$key][16]
|
||||
];
|
||||
}
|
||||
|
||||
} else if ($insurer_or_tpa == 'insurer') {
|
||||
|
||||
if ($emp_value['tpa_id'] != $excel_data[$key][15]) {
|
||||
$errors[$key][] = [
|
||||
'row' => $key,
|
||||
'column' => 15,
|
||||
'db_data' => $emp_value['tpa_id'],
|
||||
'excel_data' => $excel_data[$key][15]
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$batch_list_id[] = $emp_value['emp_policy_id'];
|
||||
}
|
||||
|
||||
|
||||
$error_count = count($errors);
|
||||
$json_errors = json_encode($errors);
|
||||
|
||||
// echo $json_errors; die;
|
||||
|
||||
$missing_id_count = count($missing_id);
|
||||
$json_missing_id = json_encode($missing_id);
|
||||
|
||||
// dd($error_count, $missing_id_count, $json_errors, $json_missing_id);
|
||||
|
||||
// dd($batch_list_id);
|
||||
|
||||
if ($missing_id_count > 0) {
|
||||
|
||||
$data = [
|
||||
'error_data' => $json_missing_id,
|
||||
'status' => 'failed',
|
||||
];
|
||||
|
||||
$this->batchFileModel->where('id', $file_id)->set($data)->update();
|
||||
|
||||
if ($insurer_or_tpa == 'tpa') {
|
||||
|
||||
return 2;
|
||||
|
||||
} else if ($insurer_or_tpa == 'insurer') {
|
||||
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($error_count > 0) {
|
||||
|
||||
$data = [
|
||||
'error_data' => $json_errors,
|
||||
'status' => 'failed',
|
||||
];
|
||||
|
||||
$this->batchFileModel->where('id', $file_id)->set($data)->update();
|
||||
return 0;
|
||||
|
||||
} else {
|
||||
|
||||
$data = [
|
||||
'count' => $emp_count,
|
||||
'status' => $status,
|
||||
'error_data' => $partially_updated_data ?? null,
|
||||
];
|
||||
|
||||
$this->batchFileModel->where('id', $file_id)->set($data)->update();
|
||||
|
||||
|
||||
foreach ($batch_list_id as $key => $value) {
|
||||
|
||||
$data = [
|
||||
'emp_policy_id' => $value,
|
||||
'batch_code' => $batch_code,
|
||||
];
|
||||
|
||||
$insert = $this->batchListModel->insert($data);
|
||||
}
|
||||
|
||||
|
||||
$parameters['file_id'] = $file_id;
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'importInceptionUpdateTPAandUHID','payload' => ['file_id' => $file_id]]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function importInceptionUpdateTPAandUHID($params)
|
||||
{
|
||||
|
||||
$file_id = $params['file_id'];
|
||||
$file = $this->batchFileModel->find($file_id);
|
||||
if (!$file) {
|
||||
$data = [
|
||||
'status' => 'failed-4',
|
||||
];
|
||||
|
||||
$this->batchFileModel->where('id', $file_id)->set($data)->update();
|
||||
return 0; // Return error code if file not found
|
||||
}
|
||||
|
||||
$client_id = $file['client_id'];
|
||||
$client_policy_id = $file['client_policy_id'];
|
||||
$insurer_or_tpa = $file['insurer_or_tpa'];
|
||||
$status = $file['status'];
|
||||
$batch_code = $file['batch_code'];
|
||||
|
||||
$status_val = 'success';
|
||||
if($status == 'in-progress-partially'){
|
||||
|
||||
$status_val = 'partially success';
|
||||
}
|
||||
|
||||
|
||||
$file_name_with_path = WRITEPATH . "/uploads/import_excel/" . $file['file_name'];
|
||||
$excel_data = $this->readExcelFileToArray($file_name_with_path);
|
||||
unset($excel_data[0]); // Remove header row
|
||||
array_pop($excel_data); // Remove footer row
|
||||
|
||||
$totals = 0;
|
||||
$emp_count = count($excel_data);
|
||||
$db = \Config\Database::connect();
|
||||
|
||||
foreach ($excel_data as $key => $value) {
|
||||
|
||||
$name = $value[1];
|
||||
$emp_code = $value[2];
|
||||
$tpa_id = $value[15];
|
||||
$uhid = $value[16];
|
||||
$amount = $value[20];
|
||||
|
||||
$totals += $amount;
|
||||
|
||||
$sql = "
|
||||
UPDATE employee_polices
|
||||
JOIN employees ON employees.id = employee_polices.employee_id
|
||||
SET tpa_id = ?
|
||||
WHERE employees.name = ?
|
||||
AND employees.emp_code = ?
|
||||
AND (employee_polices.tpa_id IS NULL OR employee_polices.tpa_id = '')";
|
||||
|
||||
$params = [$tpa_id, $name, $emp_code];
|
||||
$db->query($sql, $params);
|
||||
|
||||
|
||||
|
||||
$sql = "
|
||||
UPDATE employee_polices
|
||||
JOIN employees ON employees.id = employee_polices.employee_id
|
||||
SET employee_polices.uhid = ?
|
||||
WHERE employees.name = ?
|
||||
AND employees.emp_code = ?
|
||||
AND (employee_polices.uhid IS NULL OR employee_polices.uhid = '')";
|
||||
|
||||
$params = [$uhid, $name, $emp_code];
|
||||
$db->query($sql, $params);
|
||||
}
|
||||
|
||||
// Update batch file status and amount
|
||||
$this->batchFileModel->update($file_id, [
|
||||
'count' => $emp_count,
|
||||
'status' => $status_val,
|
||||
'amount' => $totals,
|
||||
]);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function importExcelDataForCorrection($import_data)
|
||||
{
|
||||
|
||||
@ -1046,7 +1378,7 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
$missing_id = [];
|
||||
$empty_emp_tpa_uh_ids = [];
|
||||
$totals = 0 ;
|
||||
$totals = 0;
|
||||
foreach ($data as $key => $value) {
|
||||
|
||||
try {
|
||||
@ -1545,15 +1877,15 @@ class EmpDataServiceController extends BaseController
|
||||
{
|
||||
if ($file->isValid() && !$file->hasMoved()) {
|
||||
$file = $file;
|
||||
|
||||
|
||||
try {
|
||||
|
||||
$reader = IOFactory::createReaderForFile($file->getPathname());
|
||||
$spreadsheet = $reader->load($file->getPathname());
|
||||
|
||||
|
||||
// Get the active sheet
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
|
||||
// Iterate through rows to read data
|
||||
$data = [];
|
||||
foreach ($sheet->getRowIterator() as $row) {
|
||||
@ -1563,9 +1895,8 @@ class EmpDataServiceController extends BaseController
|
||||
}
|
||||
$data[] = $rowData;
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
||||
return $data;
|
||||
} catch (SpreadsheetReaderException $e) {
|
||||
|
||||
error_log('PhpSpreadsheet reader exception: ' . $e->getMessage());
|
||||
@ -1575,7 +1906,7 @@ class EmpDataServiceController extends BaseController
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function insertBatchFileAndBatchListForImportExcel($data, $ids)
|
||||
@ -1604,10 +1935,12 @@ class EmpDataServiceController extends BaseController
|
||||
public function sendMailForDownloadingECard(array $ids)
|
||||
{
|
||||
try {
|
||||
$count = 0;
|
||||
|
||||
foreach ($ids as $key => $id) {
|
||||
|
||||
|
||||
$get_emp_email_and_other_details = $this->employeePolicyModel
|
||||
->select('employee_polices.client_policy_id, employees.emp_code, employees.email_corporate, employees.name, employees.id as employee_id, employees.emp_code employee_polices.rand_string, employee_polices.tpa_id')
|
||||
->select('employee_polices.client_policy_id, employees.emp_code, employees.email_corporate,employees.client_id as client_id, employees.name, employee_polices.rand_string, employee_polices.tpa_id')
|
||||
->join('employees', 'employees.id = employee_polices.employee_id')
|
||||
->where('employees.emp_status', 'active')
|
||||
->where('employees.is_active', '1')
|
||||
@ -1615,58 +1948,34 @@ class EmpDataServiceController extends BaseController
|
||||
->where('employee_polices.is_active', '1')
|
||||
->where('employee_polices.id', $id)->first();
|
||||
|
||||
if ($get_emp_email_and_other_details != null && $get_emp_email_and_other_details != "") {
|
||||
|
||||
$employee_id = $get_emp_email_and_other_details['employee_id'];
|
||||
$name = $get_emp_email_and_other_details['name'];
|
||||
$emp_code = $get_emp_email_and_other_details['name'];
|
||||
$email = $get_emp_email_and_other_details['email_corporate'];
|
||||
// echo "<pre>";
|
||||
// print_r($notification);
|
||||
// die;
|
||||
$client_data = $this->clientModel->where('id',$get_emp_email_and_other_details['client_id'])->first();
|
||||
|
||||
$notification = $this->notificationModel->where('client_id',$get_emp_email_and_other_details['client_id'])->where('template_name','member_ecard_mail')->first();
|
||||
if ($get_emp_email_and_other_details != null && $get_emp_email_and_other_details != "" && $notification['enabled'] == 1) {
|
||||
$rand_string = $get_emp_email_and_other_details['rand_string'];
|
||||
$tpa_id = $get_emp_email_and_other_details['tpa_id'];
|
||||
$link = generate_download_link($rand_string);
|
||||
$subject = 'Download E-Card';
|
||||
|
||||
$html = '<body>
|
||||
<p>Dear ' .$name .',</p>
|
||||
<p>Your Policy( ' .$tpa_id .' ) has been successfully created. Please click the link below to download the insurance card:</p>
|
||||
<p><a href="'.$link.'">Download Insurance Card</a></p>
|
||||
<p>Thank you,</p>
|
||||
</body>';
|
||||
|
||||
$params['rand_string'] = $rand_string;
|
||||
$params['tpa_id'] = $tpa_id;
|
||||
$params['notification'] = $notification;
|
||||
$params['client_data'] = $client_data;
|
||||
$params['notification'] = $notification;
|
||||
$params['notification'] = $notification;
|
||||
$params['get_emp_email_and_other_details'] = $get_emp_email_and_other_details;
|
||||
$wholeData = sendMailNotification::sendMailNotification('member_ecard_mail', $params);
|
||||
|
||||
$count++;
|
||||
|
||||
|
||||
|
||||
if ($email != null && $email != "") {
|
||||
|
||||
$mail_data = [
|
||||
'mail' => $email,
|
||||
'subject' => $subject,
|
||||
'message' => $html
|
||||
];
|
||||
|
||||
// dd($mail_data);
|
||||
|
||||
$result = Mailhelper::send_email($mail_data);
|
||||
$decoded_result = (array) json_decode($result);
|
||||
|
||||
$data = [
|
||||
'status' => $decoded_result['status'],
|
||||
'message'=>$decoded_result['message'] ?? 'Internal Server Error',
|
||||
'email' => $decoded_result['data']
|
||||
];
|
||||
|
||||
// dd($data);
|
||||
$this->myLogger->logme('error', 'status : {status}, message : {message}, email : {email}', $data);
|
||||
|
||||
}else{
|
||||
|
||||
$this->myLogger->log('error', 'The employee (primaryKey : {id}, Name : {name}, Emp Code : {emp_code} ) has no corporate email.', ['id' => $employee_id, 'name' => $name, 'emp_code' => $emp_code]);
|
||||
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
$this->myLogger->log('error', 'The employee policy ID ( {id} ) has no active policy or the employee is not active.', ['id' => $id]);
|
||||
|
||||
if($count == 20 || $count == count($ids)-1){
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'bulk_mail','payload' => $wholeData]);
|
||||
$wholeData = [];
|
||||
$count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true; // Email(s) sent successfully
|
||||
@ -1677,4 +1986,48 @@ class EmpDataServiceController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function readExcelFileToArray($path)
|
||||
{
|
||||
|
||||
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($path);
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
||||
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
||||
|
||||
return $excel_data;
|
||||
}
|
||||
|
||||
|
||||
public function removeOldExportInfoFromBatchFile($params){
|
||||
|
||||
$client_id = $params['client_id'];
|
||||
$client_policy_id = $params['client_policy_id'];
|
||||
$insurer_or_tpa = $params['insurer_or_tpa'];
|
||||
$event_type = $params['event_type'];
|
||||
$actions = $params['actions'];
|
||||
|
||||
|
||||
$batch_data = $this->batchFileModel
|
||||
->where('client_id', $client_id)
|
||||
->where('client_policy_id', $client_policy_id)
|
||||
->where('insurer_or_tpa', $insurer_or_tpa)
|
||||
->where('event_type', $event_type)
|
||||
->where('actions', $actions)
|
||||
->first();
|
||||
|
||||
if(!empty($batch_data)){
|
||||
|
||||
$id = $batch_data['id'];
|
||||
$batch_code = $batch_data['batch_code'];
|
||||
|
||||
$this->batchFileModel->where('id', $id)->delete();
|
||||
$this->batchListModel->where('batch_code', $batch_code)->delete();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -348,7 +348,7 @@ class EmployeeController extends AdminController
|
||||
|
||||
if($return == 0){
|
||||
|
||||
session()->setFlashdata('error', "The insurer has an insufficient deposit amount.");
|
||||
session()->setFlashdata('error', "Insufficient deposit amount.");
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
|
||||
@ -396,12 +396,35 @@ class EmployeeController extends AdminController
|
||||
} else if ($actions == 'import') {
|
||||
|
||||
$batch_data['file'] = $this->request->getFile('import_file_data');
|
||||
|
||||
|
||||
if ($event_type == 'inception' || $event_type == 'addition' || $event_type == 'dependent_addition') {
|
||||
|
||||
$return = $empDataServiceController->importExcelDataForInception($batch_data);
|
||||
|
||||
$file = $this->request->getFile('import_file_data');
|
||||
|
||||
$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_data['batch_code'] = generate_random_string($random_number_count);
|
||||
$batch_data['created_by'] = get_session_userid();
|
||||
$batch_data['status'] = 'pending';
|
||||
$batch_data['file_name'] = $filename;
|
||||
|
||||
$file_id = $this->batchFileModel->insert($batch_data);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'importInceptionFileValidation','payload' => ['file_id' => $file_id]]);
|
||||
|
||||
$return = 1;
|
||||
|
||||
// $return = $empDataServiceController->importExcelDataForInception($batch_data);
|
||||
|
||||
if ($return == 1) {
|
||||
session()->setFlashdata('success', 'Data updated successfully');
|
||||
session()->setFlashdata('success', 'Data updated successfully. File is being validated.');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 2) {
|
||||
session()->setFlashdata('error', 'The TPA ID column is either partially or entirely empty.');
|
||||
@ -418,6 +441,9 @@ class EmployeeController extends AdminController
|
||||
} else if ($return == 5) {
|
||||
session()->setFlashdata('error', 'The list of employees provided has already been updated with the UHID, or this is not the correct file');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 6) {
|
||||
session()->setFlashdata('error', 'The Excel record count exceeds the DB record count.');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
} else if ($event_type == 'correction') {
|
||||
|
||||
@ -714,7 +740,8 @@ class EmployeeController extends AdminController
|
||||
if (!file_exists($filePath)) {
|
||||
$error_message = "File not found";
|
||||
$this->myLogger->logme('error', $error_message . ' for file id ' . $file_id);
|
||||
return $error_message;
|
||||
$data['message'] = 'Physical File Not Found';
|
||||
return view('errors/404', $data);
|
||||
}
|
||||
|
||||
// Load the Excel file
|
||||
@ -1037,4 +1064,81 @@ class EmployeeController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function errorListExportImport($file_id)
|
||||
{
|
||||
|
||||
$empDataServiceController = new EmpDataServiceController();
|
||||
|
||||
$file = $this->batchFileModel->where('id', $file_id)->first();
|
||||
$client_id = $file['client_id'];
|
||||
$client_policy_id = $file['client_policy_id'];
|
||||
$insurer_or_tpa = $file['insurer_or_tpa'];
|
||||
|
||||
$error_data = json_decode($file['error_data']);
|
||||
|
||||
$file_name_with_path = WRITEPATH . "/uploads/import_excel/" . $file['file_name'];
|
||||
|
||||
if (!file_exists($file_name_with_path)) {
|
||||
$error_message = "File not found";
|
||||
$this->myLogger->logme('error', ($error_message . ' for file id ' . $file_id));
|
||||
$data['message'] = 'Physical File Not Found';
|
||||
return view('errors/404', $data);
|
||||
}
|
||||
|
||||
$excel_data = $empDataServiceController->readExcelFileToArray($file_name_with_path);
|
||||
$excelErrorData['excel_header'] = $excel_data[0];
|
||||
unset($excel_data[0]);
|
||||
array_pop($excel_data);
|
||||
|
||||
|
||||
$finalArray = [];
|
||||
foreach ($error_data as $key => $values) {
|
||||
|
||||
foreach ($values as $key2 => $value) {
|
||||
|
||||
$row = $value->row;
|
||||
$column = $value->column;
|
||||
|
||||
if(property_exists($value, 'db_data')){
|
||||
|
||||
$error = 'Expected value: ' . ($value->db_data == null || $value->db_data == "" ? 'NULL' : $value->db_data);
|
||||
|
||||
}else{
|
||||
|
||||
if ($insurer_or_tpa == 'tpa') {
|
||||
|
||||
$error = 'Expected value : TPA ID';
|
||||
|
||||
} else if ($insurer_or_tpa == 'insurer') {
|
||||
|
||||
$error = 'Expected value : UHID';
|
||||
}
|
||||
|
||||
}
|
||||
$data = ['value' => $excel_data[$row][$column], 'error' => $error,];
|
||||
$excel_data[$row][$column] = $data;
|
||||
}
|
||||
|
||||
array_push($finalArray, $excel_data[$key]);
|
||||
}
|
||||
|
||||
|
||||
foreach ($finalArray as $fkey => $value) {
|
||||
foreach ($value as $vkey => $arrayData) {
|
||||
if (!is_array($arrayData)) {
|
||||
$data = ['value' => $arrayData];
|
||||
$finalArray[$fkey][$vkey] = $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$excelErrorData['excel_data'] = $finalArray;
|
||||
$excelErrorData['file_id'] = $file_id;
|
||||
|
||||
// dd($finalArray);
|
||||
|
||||
echo view('export_import_error_list', $excelErrorData);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -9,10 +9,13 @@ use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\sendMailNotification;
|
||||
|
||||
|
||||
use App\Models\EmployeeModel;
|
||||
use App\Models\EmployeePolicyModel;
|
||||
use App\Models\ClientModel;
|
||||
use App\Models\ClientRMModel;
|
||||
use App\Models\PolicesModel;
|
||||
use App\Models\RelationshipModel;
|
||||
use App\Models\FileModel;
|
||||
@ -20,6 +23,8 @@ use App\Models\ClientPolicyModel;
|
||||
use App\Models\PolicyPremium1Model;
|
||||
use App\Models\PolicyPremium2Model;
|
||||
use App\Models\PolicyTypeModel;
|
||||
use App\Models\NotificationModel;
|
||||
use App\Models\UserModel;
|
||||
|
||||
use App\Controllers\Jobs ;
|
||||
use App\Controllers\JobWorker ;
|
||||
@ -42,6 +47,7 @@ class EmployeeRestController extends AdminController
|
||||
protected $employeeModel;
|
||||
protected $employeePolicyModel;
|
||||
protected $clientModel;
|
||||
protected $clientRMModel;
|
||||
protected $fileModel;
|
||||
protected $policesModel;
|
||||
protected $relationshipModel;
|
||||
@ -49,7 +55,9 @@ class EmployeeRestController extends AdminController
|
||||
protected $policyPremium1Model;
|
||||
protected $policyPremium2Model;
|
||||
protected $policyTypeModel;
|
||||
|
||||
protected $notificationModel;
|
||||
protected $userModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
// helper('utility');
|
||||
@ -58,6 +66,7 @@ class EmployeeRestController extends AdminController
|
||||
$this->employeeModel = new EmployeeModel();
|
||||
$this->employeePolicyModel = new EmployeePolicyModel();
|
||||
$this->clientModel = new ClientModel();
|
||||
$this->clientRMModel = new ClientRMModel();
|
||||
$this->policesModel = new PolicesModel();
|
||||
$this->relationshipModel = new RelationshipModel();
|
||||
$this->fileModel= new FileModel();
|
||||
@ -65,9 +74,11 @@ class EmployeeRestController extends AdminController
|
||||
$this->policyPremium1Model = new PolicyPremium1Model();
|
||||
$this->policyPremium2Model = new PolicyPremium2Model();
|
||||
$this->policyTypeModel = new PolicyTypeModel();
|
||||
$this->notificationModel = new NotificationModel();
|
||||
$this->userModel = new UserModel();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getEmployeeProfile()
|
||||
{
|
||||
try {
|
||||
@ -304,7 +315,7 @@ class EmployeeRestController extends AdminController
|
||||
->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'] , 'rate_premium'=> $value['policy_details']['rate_premium'] , 'gst'=> $value['policy_details']['gst'] ))
|
||||
->set(array('premium'=> $value['policy_details']['premium'] , 'rata_premimum'=> $value['policy_details']['rata_premimum'] , 'gst'=> $value['policy_details']['gst'] ))
|
||||
->update();
|
||||
|
||||
}
|
||||
@ -594,14 +605,26 @@ class EmployeeRestController extends AdminController
|
||||
// Upload the Employee Detail in DB by Sheet Data
|
||||
public function employeeUpload()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
try {
|
||||
// echo $this->request->getPost('client_id');
|
||||
// die;
|
||||
$file = $this->request->getFile('file');
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
$policy_id = $this->request->getPost('policy_id');
|
||||
|
||||
$client_data = $this->clientModel->where('id', $client_id)->first();
|
||||
|
||||
$notification = $this->notificationModel->where('client_id',$client_id)->where('template_name','member_welcome_mail')->first();
|
||||
|
||||
$jwt = $this->request->getHeader('Authorization');
|
||||
$jwtParts = explode(' ', $jwt);
|
||||
// print_r($jwtParts);die;
|
||||
$token = $jwtParts[2];
|
||||
// return "hello";
|
||||
|
||||
|
||||
$decodedPayload = json_decode(base64_decode(explode('.', $token)[1]), true);
|
||||
@ -611,7 +634,6 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
|
||||
$client_policy = $this->clientPolicyModel->where('id', $policy_id)->where('client_id', $client_id)->first();
|
||||
|
||||
if ($client_policy) {
|
||||
$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();
|
||||
@ -787,105 +809,98 @@ class EmployeeRestController extends AdminController
|
||||
$count = 0;
|
||||
for ($a=0; $a <count($dataToInsert) ; $a++)
|
||||
{
|
||||
$employee = $this->employeeModel->checkExistingEmployee($dataToInsert[$a]);
|
||||
$emp_id =0;
|
||||
|
||||
$data_after_gpa_or_gmc =[];
|
||||
if ($policy['policy_type_id'] == 1) {
|
||||
if (strtolower($dataToInsert[$a]['relationship']) == 'self') {
|
||||
$data_after_gpa_or_gmc = $dataToInsert[$a];
|
||||
}
|
||||
}else{
|
||||
$data_after_gpa_or_gmc = $dataToInsert[$a];
|
||||
}
|
||||
date_default_timezone_set('Asia/Kolkata');
|
||||
$current_timestamp = time();
|
||||
$formatted_date_time = date('Y-m-d H:i:s', $current_timestamp);
|
||||
|
||||
if ($employee) {
|
||||
|
||||
|
||||
$emp_id =$employee['id'];
|
||||
$id =$emp_id;
|
||||
$data_after_gpa_or_gmc['id'] = $id;
|
||||
$data_after_gpa_or_gmc['updated_by'] = $employee_id;
|
||||
$data_after_gpa_or_gmc['updated_at'] = $formatted_date_time;
|
||||
$result = $this->employeeModel->save($data_after_gpa_or_gmc);
|
||||
if ($result) {
|
||||
$log_message = 'Update Employee - '.$employee['name'].'('.$employee['emp_code'].') with PK '.$employee['id'];
|
||||
$this->myLogger->logme('error',('Update - ' . $employee['id'].' - '. $employee['emp_code'] .' - '.$employee['name']));
|
||||
}
|
||||
}else{
|
||||
if ($dataToInsert[$a]['emp_code'] != 0) {
|
||||
$result =false;
|
||||
if (count($data_after_gpa_or_gmc) != 0) {
|
||||
$data_after_gpa_or_gmc['created_by'] = $employee_id;
|
||||
$result = $this->employeeModel->insert($data_after_gpa_or_gmc);
|
||||
}
|
||||
$emp_id =$result;
|
||||
if ($result) {
|
||||
$emp = $this->employeeModel->where('id', $result)->get()->getResult();
|
||||
|
||||
$policy_name = $this->employeePolicyModel->where('employee_id', $result)->get()->getResult();;
|
||||
|
||||
|
||||
$log_message = 'Insert Employee- '.$dataToInsert[$a]['name'] .'('.$dataToInsert[$a]['emp_code'] .') with PK ';
|
||||
$this->myLogger->logme('error',('Insert - ' . $dataToInsert[$a]['emp_code'] .' - '. $dataToInsert[$a]['name']));
|
||||
}
|
||||
}
|
||||
}
|
||||
$emp_policy_data =[
|
||||
'employee_id'=>$emp_id,
|
||||
'client_policy_id'=>$policy_id,
|
||||
'status'=> 'draft',
|
||||
'basic_cover_si'=>isset($basic_cover_si[$a]) ? $basic_cover_si[$a] : null
|
||||
];
|
||||
|
||||
$employee_policy = $this->employeePolicyModel->checkExistingEmpPolicy(['employee_id' => $emp_id,'client_policy_id' => $policy_id]);
|
||||
if ($employee_policy) {
|
||||
foreach ($employee_policy as $existing_policy) {
|
||||
$emp_policy_data['id']= $existing_policy['id'];
|
||||
$emp_policy_data['updated_at'] = $formatted_date_time;
|
||||
$this->employeePolicyModel->save($emp_policy_data);
|
||||
}
|
||||
} else {
|
||||
$emp_policy = $this->employeePolicyModel->insert($emp_policy_data);
|
||||
}
|
||||
|
||||
|
||||
//trigger
|
||||
$mail = $dataToInsert[$a]['email_corporate'];
|
||||
$subject = 'Welcome, Employee Benefit Program Enrolment';
|
||||
// $message = 'Dear ' . $dataToInsert[$a]['name'] . ",<br> We are glad to welcome you to the employee benefit program ," .$policy_name['name'] ."offered by your employer, <br><br><br> Click on the link below to review your personal and family details:<br><a href='https://venbait.in/nhance/app/dev'>Review Details</a>" ;
|
||||
$data['employee_name']=$dataToInsert[$a]['name'];
|
||||
$data['policy_name']=$policy['name'];
|
||||
$data['App_Url'] = $_ENV['App_Url'];
|
||||
$employee = $this->employeeModel->checkExistingEmployee($dataToInsert[$a]);
|
||||
$emp_id =0;
|
||||
|
||||
$message = view('mail_welcome', $data);
|
||||
$data_after_gpa_or_gmc =[];
|
||||
if ($policy['policy_type_id'] == 1) {
|
||||
if (strtolower($dataToInsert[$a]['relationship']) == 'self') {
|
||||
$data_after_gpa_or_gmc = $dataToInsert[$a];
|
||||
}
|
||||
}else{
|
||||
$data_after_gpa_or_gmc = $dataToInsert[$a];
|
||||
}
|
||||
date_default_timezone_set('Asia/Kolkata');
|
||||
$current_timestamp = time();
|
||||
$formatted_date_time = date('Y-m-d H:i:s', $current_timestamp);
|
||||
|
||||
if ($dataToInsert[$a]['relationship'] == 'Self' && $mail != null || $mail != '') {
|
||||
$count++;
|
||||
$wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $message];
|
||||
if ($employee) {
|
||||
|
||||
|
||||
$emp_id =$employee['id'];
|
||||
$id =$emp_id;
|
||||
$data_after_gpa_or_gmc['id'] = $id;
|
||||
$data_after_gpa_or_gmc['updated_by'] = $employee_id;
|
||||
$data_after_gpa_or_gmc['updated_at'] = $formatted_date_time;
|
||||
$result = $this->employeeModel->save($data_after_gpa_or_gmc);
|
||||
if ($result) {
|
||||
$log_message = 'Update Employee - '.$employee['name'].'('.$employee['emp_code'].') with PK '.$employee['id'];
|
||||
$this->myLogger->logme('error',('Update - ' . $employee['id'].' - '. $employee['emp_code'] .' - '.$employee['name']));
|
||||
}
|
||||
}else{
|
||||
if ($dataToInsert[$a]['emp_code'] != 0) {
|
||||
$result =false;
|
||||
if (count($data_after_gpa_or_gmc) != 0) {
|
||||
$data_after_gpa_or_gmc['created_by'] = $employee_id;
|
||||
$result = $this->employeeModel->insert($data_after_gpa_or_gmc);
|
||||
}
|
||||
$emp_id =$result;
|
||||
if ($result) {
|
||||
$emp = $this->employeeModel->where('id', $result)->get()->getResult();
|
||||
|
||||
$policy_name = $this->employeePolicyModel->where('employee_id', $result)->get()->getResult();;
|
||||
|
||||
|
||||
$log_message = 'Insert Employee- '.$dataToInsert[$a]['name'] .'('.$dataToInsert[$a]['emp_code'] .') with PK ';
|
||||
$this->myLogger->logme('error',('Insert - ' . $dataToInsert[$a]['emp_code'] .' - '. $dataToInsert[$a]['name']));
|
||||
}
|
||||
}
|
||||
}
|
||||
$emp_policy_data =[
|
||||
'employee_id'=>$emp_id,
|
||||
'client_policy_id'=>$policy_id,
|
||||
'status'=> 'draft',
|
||||
'basic_cover_si'=>isset($basic_cover_si[$a]) ? $basic_cover_si[$a] : null
|
||||
];
|
||||
|
||||
$employee_policy = $this->employeePolicyModel->checkExistingEmpPolicy(['employee_id' => $emp_id,'client_policy_id' => $policy_id]);
|
||||
if ($employee_policy) {
|
||||
foreach ($employee_policy as $existing_policy) {
|
||||
$emp_policy_data['id']= $existing_policy['id'];
|
||||
$emp_policy_data['updated_at'] = $formatted_date_time;
|
||||
$this->employeePolicyModel->save($emp_policy_data);
|
||||
}
|
||||
} else {
|
||||
$emp_policy = $this->employeePolicyModel->insert($emp_policy_data);
|
||||
}
|
||||
|
||||
// print_r($wholeData);
|
||||
// if ($dataToInsert[$a]['email_corporate'] != null || $dataToInsert[$a]['email_corporate'] != '' && $dataToInsert[$a]['relationship'] == 'Self') {
|
||||
if($count == 20 || $a == count($dataToInsert)-1){
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'bulk_mail','payload' => $wholeData]);
|
||||
// $wholeData[]= $r;
|
||||
|
||||
// Mailhelper::bulk_mail($wholeData);
|
||||
$wholeData = [];
|
||||
$count = 0;
|
||||
if ($notification['enabled'] == 1) {
|
||||
//trigger
|
||||
if ($dataToInsert[$a]['relationship'] == 'Self') {
|
||||
|
||||
$params['dataToInsert'] = $dataToInsert[$a];
|
||||
$params['notification'] = $notification;
|
||||
$params['client_data'] = $client_data;
|
||||
|
||||
$wholeData[] = sendMailNotification::sendMailNotification('member_welcome_mail', $params);
|
||||
$count++;
|
||||
}
|
||||
if($count == 20 || $a == count($dataToInsert)-1){
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'bulk_mail','payload' => $wholeData]);
|
||||
// $wholeData[]= $r;
|
||||
|
||||
// Mailhelper::bulk_mail($wholeData);
|
||||
$wholeData = [];
|
||||
$count = 0;
|
||||
}
|
||||
|
||||
|
||||
// if ($dataToInsert[$a]['email_corporate'] != null || $dataToInsert[$a]['email_corporate'] != '' && $dataToInsert[$a]['relationship'] == 'Self') {
|
||||
|
||||
}
|
||||
|
||||
// print_r($r);//die();
|
||||
// $jobWorker = new JobWorker();
|
||||
//JobWorker::processJob($r);
|
||||
// $return_log = MailHelper::send_email($mail,$subject, $message);
|
||||
// $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" ], 200);
|
||||
}else{
|
||||
@ -949,6 +964,7 @@ public function getEmployeePolicy()
|
||||
|
||||
// Filter employee data where the family_floater_key is 'self'
|
||||
$selfData = array_filter($empData, fn($arr) => trim(strtolower($arr['family_floater_key'])) === 'self');
|
||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$selfData[0]['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow();
|
||||
|
||||
$self['is_value_exist'] = true;
|
||||
$self['data']['family_floater_key'] = 'self';
|
||||
@ -958,6 +974,7 @@ public function getEmployeePolicy()
|
||||
$self['data']['dob'] = $this->convertDateFormatDMY($selfData[0]['dob']);
|
||||
$self['data']['mobile'] = $selfData[0]['mobile'];
|
||||
$self['data']['client_policy_id'] = $array->ClientPolicyId;
|
||||
$self['data']['basic_cover_si'] = $employee_policy->basic_cover_si;
|
||||
|
||||
$array->mapped_family_floaters = $self;
|
||||
|
||||
@ -996,6 +1013,7 @@ public function getEmployeePolicy()
|
||||
if(count($empData)){
|
||||
foreach ($empData as $key => $value) {
|
||||
if ($value['family_floater_key'] === $dependent) {
|
||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow();
|
||||
$temp['is_value_exist'] = true;
|
||||
$temp['data']['family_floater_key'] = $familyFloatesValue;
|
||||
$temp['data']['employee_id'] = $value['id'];
|
||||
@ -1003,7 +1021,12 @@ public function getEmployeePolicy()
|
||||
$temp['data']['name'] = $value['name'];
|
||||
$temp['data']['dob'] = $this->convertDateFormatDMY($value['dob']);
|
||||
$temp['data']['client_policy_id'] = $array->ClientPolicyId;
|
||||
$temp['data']['form_type'] = $dependent;
|
||||
$temp['data']['form_type'] = $dependent;
|
||||
$temp['data']['basic_cover_si'] = $employee_policy->basic_cover_si;
|
||||
$ageKey = ($dependent == 'parent' || $dependent == 'parent_in_law') ? 'elders' : $dependent;
|
||||
|
||||
$temp['data']['age_validation'] = $decodedArray->age_ratio->$ageKey;
|
||||
|
||||
array_push($data,$temp);
|
||||
unset($empData[$key]);
|
||||
$floters = array_diff($floters, [$familyFloatesValue]);
|
||||
@ -1012,7 +1035,9 @@ public function getEmployeePolicy()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// dd($data);
|
||||
|
||||
|
||||
// Remove Unwanted floter key from floters array based on either-parents-pil term value
|
||||
if($familyFloates->{'either-parents-pil'} == 1 && count($floters))
|
||||
{
|
||||
@ -1147,13 +1172,16 @@ public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id)
|
||||
|
||||
// Convert familyFloaters terms data to plain array
|
||||
$floters = $this->FloterConvertion($familyFloates);
|
||||
|
||||
$data = [];
|
||||
foreach ($floters as $familyFloatesValue) {
|
||||
$dependent = preg_replace('/\d/', '', $familyFloatesValue);
|
||||
|
||||
|
||||
if(count($empData)){
|
||||
foreach ($empData as $key => $value) {
|
||||
if ($value['family_floater_key'] === $dependent) {
|
||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow();
|
||||
// dd( $employee_policy);
|
||||
$temp['is_value_exist'] = true;
|
||||
$temp['data']['family_floater_key'] = $familyFloatesValue;
|
||||
$temp['data']['employee_id'] = $value['id'];
|
||||
@ -1161,7 +1189,11 @@ public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id)
|
||||
$temp['data']['name'] = $value['name'];
|
||||
$temp['data']['dob'] = $this->convertDateFormatDMY($value['dob']);
|
||||
$temp['data']['client_policy_id'] = $array->ClientPolicyId;
|
||||
$temp['data']['form_type'] = $dependent;
|
||||
$temp['data']['form_type'] = $dependent;
|
||||
$temp['data']['basic_cover_si'] = $employee_policy->basic_cover_si;
|
||||
$ageKey = ($dependent == 'parent' || $dependent == 'parent_in_law') ? 'elders' : $dependent;
|
||||
$temp['data']['age_validation'] = $array->Policy_Terms->age_ratio->$ageKey;
|
||||
|
||||
array_push($data,$temp);
|
||||
unset($empData[$key]);
|
||||
$floters = array_diff($floters, [$familyFloatesValue]);
|
||||
@ -1300,6 +1332,7 @@ public function getAddOnPolicy()
|
||||
|
||||
if(count($clientPolicy))
|
||||
{
|
||||
$band = $addOnEmployeeData = $this->employeeModel->where('is_active', 1 )->where('emp_code',$this->request->getGet('emp_code'))->where('client_id',$this->request->getGet('client_id'))->where('family_floater_key','self')->get()->getRow()->band;
|
||||
$PolicyData = [];
|
||||
foreach ($clientPolicy as $key => $array) {
|
||||
$responce = [];
|
||||
@ -1307,9 +1340,26 @@ public function getAddOnPolicy()
|
||||
$decodedArray = json_decode($array['policy_terms']);
|
||||
$policy_terms = $decodedArray;
|
||||
$getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard($array['id'],$array['client_id']);
|
||||
$uniqueData = [];
|
||||
$siValues = [];
|
||||
foreach ($getSlabAndGridData['slab_rates'] as $item) {
|
||||
if($getSlabAndGridData['grid_master']['emp_band'] == 1 ){
|
||||
if ($item['grade'] == $band) {
|
||||
$uniqueData[] = $item;
|
||||
}
|
||||
}else{
|
||||
if (!in_array($item['si'], $siValues)) {
|
||||
$uniqueData[] = $item;
|
||||
$siValues[] = $item['si'];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$responce['policy_name'] = $this->policesModel->where('id',$array['policy_id'])->get()->getRow()->name;
|
||||
$responce['SlabRates'] = $getSlabAndGridData['slab_rates'];
|
||||
$responce['SlabRates'] = $uniqueData;
|
||||
$responce['GridMaster'] = $getSlabAndGridData['grid_master'];
|
||||
$responce['client_id'] = $array['client_id'];
|
||||
$responce['client_policy_id'] = $array['id'];
|
||||
@ -1460,11 +1510,12 @@ public function getAddOnPolicy()
|
||||
|
||||
}else if($array['is_addon'] == 2 && $array['policy_type_id'] == 4)//Topup policy
|
||||
{
|
||||
|
||||
|
||||
$whereArray = [];
|
||||
foreach ( $decodedArray->family_floaters as $key => $value) {
|
||||
if($value != 0){
|
||||
if($key == 'parents'){ $text = 'parent'; }else if($key == 'childrens'){ $text = 'child'; }else{ $text = $key; }
|
||||
if($key == 'parents'){ $text = 'parent'; }else if($key == 'childrens'){ $text = 'child'; }else if($key == 'parents-in-law'){$text = 'parent_in_law';}else{ $text = $key; }
|
||||
array_push($whereArray,$text);
|
||||
}
|
||||
}
|
||||
@ -1483,7 +1534,7 @@ public function getAddOnPolicy()
|
||||
|
||||
$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 = $only_si_premium_value + $employee_policy->rata_premium;}
|
||||
if(isset($employee_policy->premium)){ $only_si_premium_value = $only_si_premium_value + $employee_policy->rata_premimum;}
|
||||
if(isset($employee_policy->gst)){ $only_si_gst_value = $only_si_gst_value + $employee_policy->gst;}
|
||||
$temp3['is_value_exist'] = true;
|
||||
$temp3['data']['employee_id'] = $value['id'];
|
||||
@ -1532,7 +1583,7 @@ public function getAddOnPolicy()
|
||||
|
||||
$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 = $only_si_premium_value + $employee_policy->rata_premium;}
|
||||
if(isset($employee_policy->premium)){ $only_si_premium_value = $only_si_premium_value + $employee_policy->rata_premimum;}
|
||||
if(isset($employee_policy->gst)){ $only_si_gst_value = $only_si_gst_value + $employee_policy->gst;}
|
||||
$temp3['is_value_exist'] = true;
|
||||
$temp3['data']['employee_id'] = $value['id'];
|
||||
@ -1574,9 +1625,9 @@ public function getAddOnPolicy()
|
||||
|
||||
public function iAgreeForAddOn()
|
||||
{
|
||||
|
||||
|
||||
$postData = json_decode($this->request->getBody(), true);
|
||||
|
||||
$client_policy_id = $postData['client_policy_id'];
|
||||
$emp_code = $postData['emp_code'];
|
||||
$client_id = $postData['client_id'];
|
||||
@ -1589,15 +1640,41 @@ public function iAgreeForAddOn()
|
||||
|
||||
if (!is_null($client_policy_id) && is_array($client_policy_id))
|
||||
{
|
||||
$array_list = [];
|
||||
foreach ($client_policy_id as $key => $value)
|
||||
{
|
||||
$this->employeePolicyModel->where('client_policy_id', $value )
|
||||
->where('is_active', 1 )
|
||||
->set(array('status'=>'enrolled'))
|
||||
->update();
|
||||
$find = $this->employeeModel->getEmpFamilybyEmpCode(client_policy_id: $value,emp_code: $emp_code,client_id: $client_id,emp_status:['draft','enrolled'],policy_status:['draft','enrolled']);
|
||||
$array_list[] = $find;
|
||||
}
|
||||
$params ['array_list'] = $array_list;
|
||||
$params ['client_policy_id'] = $client_policy_id;
|
||||
$params ['emp_code'] = $emp_code;
|
||||
$params ['client_id'] = $client_id;
|
||||
$wholeData =sendMailNotification::sendMailNotification('member_review_and_summary_mail', $params);
|
||||
|
||||
MailHelper::send_email($wholeData[0]);
|
||||
|
||||
if (isset($wholeData[0])) {
|
||||
|
||||
$account_manager_wholeData =sendMailNotification::sendMailNotification('account_maneger_summary_mail', $params);
|
||||
|
||||
foreach ($account_manager_wholeData as $key => $value) {
|
||||
MailHelper::send_email($value);
|
||||
}
|
||||
|
||||
$client_hr_wholeData =sendMailNotification::sendMailNotification('client_hr_summary_mail', $params);
|
||||
|
||||
foreach ($client_hr_wholeData as $key => $value) {
|
||||
MailHelper::send_email($value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => [] ], 200);
|
||||
}
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@ class EmployeeServiceController extends AdminController
|
||||
protected $policiesModel;
|
||||
protected $empEndorsementModel;
|
||||
protected $general_relationships = ['self' => ['name' => 'Self', 'gender' => 'M','age_min' => 18,'age_max' => null], 'spouse' => ['name' => 'Spouse', 'gender' => 'F','age_min' => 18,'age_max' => null], 'son' => ['name' => 'Son', 'gender' => 'M','age_min' => null,'age_max' => 25], 'daughter' => ['name' => 'Daughter', 'gender' => 'F','age_min' => null,'age_max' => 25], 'father' => ['name' => 'Father', 'gender' => 'M','age_min' => 18,'age_max' => null], 'mother' => ['name' => 'Mother', 'gender' => 'F','age_min' => 18,'age_max' => null], 'father-in-law' => ['name' => 'Father in Law', 'gender' => 'M','age_min' => 18,'age_max' => null], 'mother-in-law' => ['name' => 'Mother in Law', 'gender' => 'F','age_min' => 18,'age_max' => null]];
|
||||
protected $inception_excel_columns = ['sno'=>['col_idx'=>0,'col_cell_name'=>'A','col_name'=>'S.No','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'emp_id'=>['col_idx'=>1,'col_cell_name'=>'B','col_name'=>'EMP ID','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'name_of_emp_dep'=>['col_idx'=>2,'col_cell_name'=>'C','col_name'=>'NAME OF EMP/DEP','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'dob'=>['col_idx'=>3,'col_cell_name'=>'D','col_name'=>'DOB','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'custom'=>'check_dob_diff','params'=>['row','relationship','default_age_ratio']],'gender'=>['col_idx'=>4,'col_cell_name'=>'E','col_name'=>'Gender','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>['M','F']],'relationship'=>['col_idx'=>5,'col_cell_name'=>'F','col_name'=>'RELATIONSHIP','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_relationship','params'=>['row','relationship','policy_terms']],'basic_cover_si'=>['col_idx'=>6,'col_cell_name'=>'G','col_name'=>'BASIC COVER SI','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom' => 'check_si','params' => ['row','policy_terms','slab_details']],'doc'=>['col_idx'=>7,'col_cell_name'=>'H','col_name'=>'Date of Coverage','is_mandatory'=>['A','DA'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'params'=>['row']],'doj'=>['col_idx'=>8,'col_cell_name'=>'I','col_name'=>'DOJ','is_mandatory'=>false,'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'custom'=>'check_doj','params'=>['row']],'basic_pay'=>['col_idx'=>9,'col_cell_name'=>'J','col_name'=>'Basic Pay','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_basic_pay','params'=>['row','policy_terms','slab_details']],'band_grade'=>['col_idx'=>10,'col_cell_name'=>'K','col_name'=>'Band/Grade','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_employee_band','params'=>['row','policy_terms','slab_details']],'designation'=>['col_idx'=>11,'col_cell_name'=>'L','col_name'=>'Designation','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'phone'=>['col_idx'=>12,'col_cell_name'=>'M','col_name'=>'Phone','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'email'=>['col_idx'=>13,'col_cell_name'=>'N','col_name'=>'Email','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'pre_existing_ailments'=>['col_idx'=>14,'col_cell_name'=>'O','col_name'=>'PRE EXISTING AILMENTS','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>['0','1']],'change_event'=>['col_idx'=>15,'col_cell_name'=>'P','col_name'=>'Change event','is_mandatory'=>['A','DA','D'],'data_type'=>'str','format'=>null,'allowed_values'=>null],'date_of_exit'=>['col_idx'=>16,'col_cell_name'=>'Q','col_name'=>'Date of exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null],'reason_for_exit'=>['col_idx'=>17,'col_cell_name'=>'R','col_name'=>'Reason for exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>null,'allowed_values'=>null]];
|
||||
protected $inception_excel_columns = ['sno'=>['col_idx'=>0,'col_cell_name'=>'A','col_name'=>'S.No','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'emp_id'=>['col_idx'=>1,'col_cell_name'=>'B','col_name'=>'EMP ID','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'name_of_emp_dep'=>['col_idx'=>2,'col_cell_name'=>'C','col_name'=>'NAME OF EMP/DEP','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'dob'=>['col_idx'=>3,'col_cell_name'=>'D','col_name'=>'DOB','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'custom'=>'check_dob_diff','params'=>['row','relationship','default_age_ratio']],'gender'=>['col_idx'=>4,'col_cell_name'=>'E','col_name'=>'Gender','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>['M','F']],'relationship'=>['col_idx'=>5,'col_cell_name'=>'F','col_name'=>'RELATIONSHIP','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_relationship','params'=>['row','relationship','policy_terms']],'basic_cover_si'=>['col_idx'=>6,'col_cell_name'=>'G','col_name'=>'BASIC COVER SI','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom' => 'check_si','params' => ['row','policy_terms','slab_details']],'doc'=>['col_idx'=>7,'col_cell_name'=>'H','col_name'=>'Date of Coverage','is_mandatory'=>['A','DA'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'params'=>['row']],'doj'=>['col_idx'=>8,'col_cell_name'=>'I','col_name'=>'DOJ','is_mandatory'=>false,'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'custom'=>'check_doj','params'=>['row']],'basic_pay'=>['col_idx'=>9,'col_cell_name'=>'J','col_name'=>'Basic Pay','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_basic_pay','params'=>['row','policy_terms','slab_details']],'band_grade'=>['col_idx'=>10,'col_cell_name'=>'K','col_name'=>'Band/Grade','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_employee_band','params'=>['row','policy_terms','slab_details']],'designation'=>['col_idx'=>11,'col_cell_name'=>'L','col_name'=>'Designation','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'phone'=>['col_idx'=>12,'col_cell_name'=>'M','col_name'=>'Phone','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom' => 'check_dup_mobileno','params' => ['row','existing_mobilenos']],'email'=>['col_idx'=>13,'col_cell_name'=>'N','col_name'=>'Email','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'pre_existing_ailments'=>['col_idx'=>14,'col_cell_name'=>'O','col_name'=>'PRE EXISTING AILMENTS','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>['0','1']],'change_event'=>['col_idx'=>15,'col_cell_name'=>'P','col_name'=>'Change event','is_mandatory'=>['A','DA','D'],'data_type'=>'str','format'=>null,'allowed_values'=>null],'date_of_exit'=>['col_idx'=>16,'col_cell_name'=>'Q','col_name'=>'Date of exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null],'reason_for_exit'=>['col_idx'=>17,'col_cell_name'=>'R','col_name'=>'Reason for exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>null,'allowed_values'=>null]];
|
||||
|
||||
protected $deletion_excel_columns = ['sno'=>['col_idx'=>0,'col_cell_name'=>'A','col_name'=>'S.No','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'emp_id'=>['col_idx'=>1,'col_cell_name'=>'B','col_name'=>'EMP ID','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'name_of_emp_dep'=>['col_idx'=>2,'col_cell_name'=>'C','col_name'=>'NAME OF EMP/DEP','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'change_event'=>['col_idx'=>3,'col_cell_name'=>'D','col_name'=>'Change event','is_mandatory'=>['D'],'data_type'=>'str','format'=>null,'allowed_values'=>null],'date_of_exit'=>['col_idx'=>4,'col_cell_name'=>'E','col_name'=>'Date of exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null],'reason_for_exit'=>['col_idx'=>5,'col_cell_name'=>'F','col_name'=>'Reason for exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>null,'allowed_values'=>null]];
|
||||
|
||||
@ -154,6 +154,9 @@ class EmployeeServiceController extends AdminController
|
||||
//remove header
|
||||
unset($excel_data[0]);
|
||||
$relationship = $this->general_relationships;
|
||||
//get exisiting mobilr nos
|
||||
$existing_mobilenos = $this->employeePolicyModel->getExisitingMobileNos(client_policy_id: $file['policy_id']);
|
||||
// dd($existing_mobilenos);
|
||||
foreach ($excel_data as $row_key => $row)
|
||||
{
|
||||
|
||||
@ -273,7 +276,7 @@ class EmployeeServiceController extends AdminController
|
||||
{
|
||||
//proceed next data level validation in JOB queue
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'excelFileDataValidation','payload' => ['file_id' => $file_id]]);
|
||||
$r = Jobs::addJob(['job_name' => 'excelFileDataValidation','payload' => ['file_id' => $file_id]]);
|
||||
// $jobWorker = new JobWorker();
|
||||
// JobWorker::processJob($r);
|
||||
}
|
||||
@ -471,7 +474,7 @@ class EmployeeServiceController extends AdminController
|
||||
{
|
||||
//proceed next data level validation in JOB queue
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'employeesOnboardPreprocess','payload' => ['file_id' => $file_id]]);
|
||||
$r = Jobs::addJob(['job_name' => 'employeesOnboardPreprocess','payload' => ['file_id' => $file_id]]);
|
||||
// $jobWorker = new JobWorker();
|
||||
// JobWorker::processJob($r);
|
||||
}
|
||||
@ -607,7 +610,7 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
|
||||
// die();
|
||||
return ($employee_data_group_by_family);
|
||||
return (($employee_data_group_by_family));
|
||||
|
||||
}
|
||||
|
||||
@ -855,9 +858,10 @@ class EmployeeServiceController extends AdminController
|
||||
$temp = $value['temp'];
|
||||
unset($value['policy_details']);
|
||||
unset($value['temp']);
|
||||
|
||||
// Kint::dump($value);
|
||||
// Kint::dump($policy_data);
|
||||
//start implemet of si enhancement of grid type 10,11
|
||||
if(count($employee) && (($file['action'] == 'dependent_addition' && in_array($value['temp']['source'],[10,11]) && ($slab_details['slab_rates'][0]['premium_type'] == 1 && strtolower($value['relationship']) == 'self') || ($slab_details['slab_rates'][0]['premium_type'] == 1 || $slab_details['slab_rates'][0]['premium_type'] == null))))
|
||||
if(count($employee) && (($file['action'] == 'dependent_addition' && in_array($value['temp']['source'],[10,11]) && ($slab_details['slab_rates'][0]['premium_type'] == 1 && strtolower($value['relationship']) == 'self') || ($slab_details['slab_rates'][0]['premium_type'] == 2 || $slab_details['slab_rates'][0]['premium_type'] == null))))
|
||||
{
|
||||
$res = $this->employeesSIEnhanceProcessWhileOnbboard(employee:$employee[0],policy_data: $policy_data,file:$file);// where employee holds existing emp data and policy_data holds new si enhancement
|
||||
if(!$res)
|
||||
@ -928,8 +932,8 @@ class EmployeeServiceController extends AdminController
|
||||
$employee = $this->employeeModel->where('emp_code', $employee['emp_code'])->where('name',$employee['name'])->where('client_id',$employee['client_id'])->where('is_active',1)->first();
|
||||
|
||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$employee['id'])->where('client_policy_id',$file['policy_id'])->first();
|
||||
|
||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($employee_policy['policy_id'],$employee['client_id']);
|
||||
// dd($employee_policy);
|
||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($employee_policy['client_policy_id'],$employee['client_id']);
|
||||
|
||||
//check si has changed in normal case OR check premium only changed, still treat as SI enhancement in grid type 10
|
||||
if($employee_policy['basic_cover_si'] != $policy_data['basic_cover_si'] || ($slab_details['grid_master']['ui_type'] == 10 && $policy_data['premimum'] != null && $policy_data['premimum'] != "" && $employee_policy['premimum'] != $policy_data['premimum']))
|
||||
|
||||
@ -14,7 +14,11 @@ class JobWorker extends AdminController
|
||||
* Constructs the class
|
||||
*/
|
||||
|
||||
private static $event_class_mapping = ['add' => ['type' => 'HC','handler' => 'App\\Helpers\\HttpRequestHelper'], 'sub' => ['type' => 'CC','handler' => 'App\\Controllers\\Jobs\SubJob'],'fancy_date_time_format' => [ 'type' => 'HF','handler' => 'fancy_date_time_format'],'addNumber' => ['type' => 'HC','handler' => 'App\\Model\\HttpRequestHelper'],'excelFileFormatValidation' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'excelFileDataValidation' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'employeesOnboardPreprocess' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'employeeDisembark' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'employeesSIEnhanceProcess' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'employeesCorrectionProcess' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'send_email' => ['type' => 'HC','handler' => 'App\\Helpers\\MailHelper'],'bulk_mail' => ['type' => 'HC','handler' => 'App\\Helpers\\MailHelper']];
|
||||
private static $event_class_mapping = [
|
||||
'add' => ['type' => 'HC', 'handler' => 'App\\Helpers\\HttpRequestHelper'], 'sub' => ['type' => 'CC', 'handler' => 'App\\Controllers\\Jobs\SubJob'], 'fancy_date_time_format' => ['type' => 'HF', 'handler' => 'fancy_date_time_format'], 'addNumber' => ['type' => 'HC', 'handler' => 'App\\Model\\HttpRequestHelper'], 'excelFileFormatValidation' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmployeeServiceController'], 'excelFileDataValidation' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmployeeServiceController'], 'employeesOnboardPreprocess' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmployeeServiceController'], 'employeeDisembark' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmployeeServiceController'], 'employeesSIEnhanceProcess' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmployeeServiceController'], 'employeesCorrectionProcess' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmployeeServiceController'], 'send_email' => ['type' => 'HC', 'handler' => 'App\\Helpers\\MailHelper'], 'bulk_mail' => ['type' => 'HC', 'handler' => 'App\\Helpers\\MailHelper'], 'insertBatchList' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
||||
'importInceptionFileValidation' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
||||
'importInceptionUpdateTPAandUHID' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
||||
];
|
||||
public function __construct()
|
||||
{
|
||||
// echo 'HiC';//die();
|
||||
@ -66,6 +70,7 @@ class JobWorker extends AdminController
|
||||
*/
|
||||
public static function processJob(array $jobdata = [])
|
||||
{
|
||||
|
||||
// print_r($jobdata);
|
||||
// echo 'listen';
|
||||
// die();
|
||||
|
||||
159
app/Controllers/NotificationController.php
Normal file
159
app/Controllers/NotificationController.php
Normal file
@ -0,0 +1,159 @@
|
||||
<?php
|
||||
|
||||
// declare(strict_types=1);
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
use App\Controllers\Jobs ;
|
||||
|
||||
use App\Models\NotificationModel;
|
||||
use App\Models\ClientModel;
|
||||
use App\Models\EmployeeModel;
|
||||
use App\Models\UserModel;
|
||||
|
||||
use App\Helpers\sendMailNotification;
|
||||
|
||||
|
||||
class NotificationController extends AdminController
|
||||
{
|
||||
use ResponseTrait;
|
||||
protected $myLogger;
|
||||
protected $notificationModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->myLogger = \Config\Services::mylogger();
|
||||
$this->notificationModel = new NotificationModel();
|
||||
}
|
||||
|
||||
// This is for Template Name Camel Case to Snake Case for store in DB
|
||||
public function camelCaseToSnakeCase($input)
|
||||
{
|
||||
$input = preg_replace('/(?<!^)([A-Z])/', '$1', $input);
|
||||
$input = str_replace(' ', '_', $input);
|
||||
return strtolower($input);
|
||||
}
|
||||
|
||||
// Create Or Update the Notification
|
||||
public function createNotification()
|
||||
{
|
||||
$form_data['template_name'] = $this->camelCaseToSnakeCase($this->request->getPost('template_name'));
|
||||
$form_data['subject'] = $this->request->getPost('subject');
|
||||
$form_data['mail_content'] = $this->request->getPost('mailContent');
|
||||
$form_data['client_id'] = $this->request->getPost('client_id');
|
||||
$notificationModel = new NotificationModel();
|
||||
|
||||
$find_notification = $notificationModel->where('client_id',$form_data['client_id'])->where('template_name',$form_data['template_name'])->first();
|
||||
if ($find_notification) {
|
||||
$id = $find_notification['id'];
|
||||
$form_data['updated_by'] = get_session_userid();
|
||||
$notificationModel->update($id,$form_data);
|
||||
$complete = "Update";
|
||||
}else{
|
||||
$form_data['created_by'] = get_session_userid();
|
||||
$notificationModel->insert($form_data);
|
||||
$complete = "Inserted";
|
||||
}
|
||||
return json_encode($complete);
|
||||
|
||||
}
|
||||
|
||||
// This is for the Enabls in Notification area and Update the Recipient and HR Mail Id in( Enables -> Notification table and Mail id's -> Client table)
|
||||
public function update_enable()
|
||||
{
|
||||
$checkboxNames = [
|
||||
'member_welcome_mail_btn',
|
||||
'member_reminder_mail_btn',
|
||||
'member_ecard_mail_btn',
|
||||
'member_review_and_summary_mail_btn',
|
||||
'account_maneger_summary_mail_btn',
|
||||
'client_hr_summary_mail_btn'
|
||||
];
|
||||
$data = [];
|
||||
|
||||
foreach ($checkboxNames as $checkboxName)
|
||||
{
|
||||
$data[str_replace('_btn', '', $checkboxName)] = ($this->request->getPost($checkboxName) === "true") ? 1 : 0;
|
||||
}
|
||||
|
||||
$notificationModel = new NotificationModel();
|
||||
$clientModel = new ClientModel();
|
||||
|
||||
$id =$this->request->getPost('client_id');
|
||||
$clientData['common_mails'] = $this->request->getPost('nhance_team_mail_ids');
|
||||
$clientData['hr_mails'] = $this->request->getPost('hr_mail_id');
|
||||
$clientModel->update($id,$clientData);
|
||||
|
||||
foreach ($data as $key => $value)
|
||||
{
|
||||
$find = $notificationModel->where('client_id',$this->request->getPost('client_id'))->where('template_name', $key)->first();
|
||||
if ($find)
|
||||
{
|
||||
$id = $find['id'];
|
||||
$changeData['enabled']= $value;
|
||||
$update = $notificationModel->update($id, $changeData);
|
||||
}
|
||||
}
|
||||
return json_encode("true");
|
||||
}
|
||||
|
||||
// This for Load the Template Data for in View Page
|
||||
public function getMailTemplateData($template_name,$client_id)
|
||||
{
|
||||
$notificationModel = new NotificationModel();
|
||||
|
||||
$value = $notificationModel->where('client_id',$client_id)->where('template_name',$template_name)->first();
|
||||
|
||||
return json_encode($value);
|
||||
}
|
||||
|
||||
// This will send the Reminder Mail
|
||||
public function reminder_mail()
|
||||
{
|
||||
$clientModel = new ClientModel();
|
||||
$employeeModel = new EmployeeModel();
|
||||
$notificationModel = new NotificationModel();
|
||||
|
||||
$client_list = $clientModel->where('is_active',1)->findAll();
|
||||
|
||||
$wholeData = [];
|
||||
foreach($client_list as $key=>$value){
|
||||
$notification_data = $notificationModel->where('client_id',$value['id'])->where('template_name', 'member_reminder_mail')->first();
|
||||
|
||||
$client_data = $clientModel->where('id', $value['id'])->first();
|
||||
|
||||
if(isset($notification_data) && $notification_data['enabled'] == 1){
|
||||
$emp_data = $employeeModel->where('client_id', $value['id'])->where('is_active',1)->where('emp_status','draft')->findAll();
|
||||
if( count($emp_data) != 0)
|
||||
{
|
||||
$params['emp_data'] = $emp_data;
|
||||
$params['client_data'] = $client_data;
|
||||
$params['notification_data'] = $notification_data;
|
||||
$wholeData[] =sendMailNotification::sendMailNotification('member_reminder_mail', $params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
foreach ($wholeData as $index => $values) {
|
||||
$whole_index = $index;
|
||||
foreach ($values as $index => $value) {
|
||||
$count++;
|
||||
$temp_whole_data[] = $value;
|
||||
if($count == 20 || $whole_index == count($wholeData)-1 && $index == count($values)-1){
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'bulk_mail','payload' => $temp_whole_data]);
|
||||
|
||||
$temp_whole_data = [];
|
||||
$count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
26
app/Controllers/PendingActionsController.php
Normal file
26
app/Controllers/PendingActionsController.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class PendingActionsController extends AdminController
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function getPendingActions()
|
||||
{
|
||||
//get pending actions like inception, corrections,deletions,SI enhanccnement to users
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -16,9 +16,16 @@ class MailHelper
|
||||
{
|
||||
public static function send_email($params)
|
||||
{
|
||||
|
||||
// print_r($params);die;
|
||||
$emaill = $params['mail'];
|
||||
$subject = $params['subject'];
|
||||
$message = $params['message'];
|
||||
if (isset($params['bcc'])) {
|
||||
$bcc = $params['bcc'];
|
||||
}else{
|
||||
$bcc= '';
|
||||
}
|
||||
try {
|
||||
|
||||
$email = \Config\Services::email();
|
||||
@ -27,7 +34,17 @@ class MailHelper
|
||||
|
||||
$email->setTo($emaill);
|
||||
|
||||
if (!empty($bcc)) {
|
||||
// Convert the comma-separated string into an array
|
||||
$bccList = explode(',', $bcc);
|
||||
// Trim whitespace from each email ID
|
||||
$bccList = array_map('trim', $bccList);
|
||||
// Set BCC recipients
|
||||
$email->setBCC($bccList);
|
||||
}
|
||||
|
||||
$email->setSubject($subject);
|
||||
|
||||
$email->setMessage($message);
|
||||
|
||||
if ($email->send()) {
|
||||
@ -44,6 +61,7 @@ class MailHelper
|
||||
|
||||
public static function bulk_mail(array $mails = [])
|
||||
{
|
||||
// print_r();die;
|
||||
$model = new JobModel();
|
||||
$start = microtime(true);
|
||||
$runtime= 0;
|
||||
|
||||
@ -990,7 +990,7 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$familiy_si_covered = ($familiy_si_covered >= $slab_value['max_si'] ? $slab_value['max_si'] : $familiy_si_covered);
|
||||
|
||||
$emp_data['policy_details']['basic_cover_si'] = $familiy_si_covered;
|
||||
$emp_data['policy_details']['date_coverage'] = (empty($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||
$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;
|
||||
$emp_data['policy_details']['premium'] = get_premium_for_si(slab_details: $slab_details,si_amount: $familiy_si_covered,band: $employee_received_band);
|
||||
@ -1015,7 +1015,7 @@ if (!function_exists('premium_calculation_manager'))
|
||||
{
|
||||
|
||||
$emp_data['policy_details']['basic_cover_si'] = $employee_received_si;
|
||||
$emp_data['policy_details']['date_coverage'] = (empty($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||
$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;
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
@ -1040,7 +1040,7 @@ if (!function_exists('premium_calculation_manager'))
|
||||
{
|
||||
|
||||
$emp_data['policy_details']['basic_cover_si'] = $employee_received_si;
|
||||
$emp_data['policy_details']['date_coverage'] = (empty($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||
$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;
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
@ -1281,4 +1281,20 @@ if(!function_exists('remap_default_age_ratio_into_relationship'))
|
||||
|
||||
return $general_relationships;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!function_exists('check_dup_mobileno'))
|
||||
{
|
||||
function check_dup_mobileno(array $row,array $existing_mobilenos)
|
||||
{
|
||||
foreach($existing_mobilenos as $k => $value)
|
||||
{
|
||||
if ($row['12'] == $value['mobile']) {
|
||||
return array('status' => false,'error' => "Duplicate Mobile No");
|
||||
// break;
|
||||
}
|
||||
}
|
||||
return array('status' => true);
|
||||
}
|
||||
}
|
||||
413
app/Helpers/sendMailNotification.php
Normal file
413
app/Helpers/sendMailNotification.php
Normal file
@ -0,0 +1,413 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers;
|
||||
|
||||
use App\Models\ClientModel;
|
||||
use App\Models\ClientRMModel;
|
||||
use App\Models\NotificationModel;
|
||||
use App\Models\UserModel;
|
||||
use App\Models\EmployeeModel;
|
||||
|
||||
class sendMailNotification
|
||||
{
|
||||
public static function sendMailNotification($action, $params)
|
||||
{
|
||||
if ($action == 'member_welcome_mail') {
|
||||
$dataToInsert = $params['dataToInsert'];
|
||||
$notification = $params['notification'];
|
||||
$client_data = $params['client_data'];
|
||||
|
||||
$mail = $dataToInsert['email_corporate'];
|
||||
$subject = $notification['subject'];
|
||||
$app_link = $_ENV['App_Url'];
|
||||
$employee_name =$dataToInsert['name'];
|
||||
$mail_content = $notification['mail_content'];
|
||||
$nhance_logo = $_ENV['NHANCE_LOGO'];
|
||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||
|
||||
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
|
||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||
|
||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
if ($dataToInsert['relationship'] == 'Self' && $mail != null || $mail != '') {
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails']];
|
||||
}
|
||||
return $wholeData;
|
||||
} else if($action == 'member_reminder_mail'){
|
||||
|
||||
// print_r($params);die;
|
||||
$EmployeeModel = new EmployeeModel();
|
||||
$emp_data = $params['emp_data'];
|
||||
$notification_data = $params['notification_data'];
|
||||
$client_data = $params['client_data'];
|
||||
|
||||
$subject = $notification_data['subject'];
|
||||
$app_link = $_ENV['App_Url'];
|
||||
$mail_content = $notification_data['mail_content'];
|
||||
$nhance_logo = $_ENV['NHANCE_LOGO'];
|
||||
|
||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
|
||||
if ($emp_data && (isset($notification_data) && $notification_data['enabled'] == 1)) {
|
||||
foreach ($emp_data as $key => $value) {
|
||||
if ($value['relationship'] != 'Self') {
|
||||
|
||||
$emp_data = $EmployeeModel->where('client_id', $client_data['id'])->where('emp_code', $value['emp_code'])->where('is_active',1)->findAll();
|
||||
|
||||
foreach ($emp_data as $key => $value) {
|
||||
if ($value['relationship'] == 'Self') {
|
||||
$employee_name =$value['name'];
|
||||
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
|
||||
|
||||
$mail = $value['email_corporate'];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$employee_name =$value['name'];
|
||||
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
|
||||
$mail = $value['email_corporate'];
|
||||
}
|
||||
$wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
|
||||
}
|
||||
return $wholeData;
|
||||
}else{
|
||||
return "false";
|
||||
}
|
||||
} else if($action == 'member_ecard_mail'){
|
||||
|
||||
$notification = $params['notification'];
|
||||
$get_emp_email_and_other_details = $params['get_emp_email_and_other_details'];
|
||||
$rand_string = $params['rand_string'];
|
||||
$client_data = $params['client_data'];
|
||||
$tpa_id = $params['tpa_id'];
|
||||
|
||||
|
||||
$mail_content = $notification['mail_content'];
|
||||
$mail = $get_emp_email_and_other_details['email_corporate'];
|
||||
$subject = $notification['subject'];
|
||||
$link = generate_download_link($rand_string);
|
||||
$app_link = $_ENV['App_Url'];
|
||||
$name = $get_emp_email_and_other_details['name'];
|
||||
$mail_content = $notification['mail_content'];
|
||||
$nhance_logo = $_ENV['NHANCE_LOGO'];
|
||||
|
||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||
// $client_logo = $nhance_logo;
|
||||
|
||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
|
||||
$mail_content = str_replace("[[member_name]]", $name, $mail_content);
|
||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
// $mail_content = str_replace("[[tpa_id]]", $tpa_id, $mail_content);
|
||||
$mail_content = str_replace("[[ecard_download_link]]", "<a href='$link'>Download Insurance Card</a>", $mail_content);
|
||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails']];
|
||||
|
||||
return $wholeData;
|
||||
} else if($action == 'member_review_and_summary_mail'){
|
||||
|
||||
$array_list = $params['array_list'];
|
||||
$client_policy_id = $params['client_policy_id'];
|
||||
$emp_code = $params['emp_code'];
|
||||
$client_id = $params['client_id'];
|
||||
|
||||
$clientModel = new ClientModel();
|
||||
$notificationModel = new NotificationModel();
|
||||
|
||||
$client_data =$clientModel->where('id', $client_id)->first();
|
||||
$notification_data = $notificationModel->where('client_id' ,$client_id)->where('template_name', $action)->first();
|
||||
|
||||
if ($notification_data['enabled'] == 1) {
|
||||
$mail_content = $notification_data['mail_content'];
|
||||
$subject = $notification_data['subject'];
|
||||
$app_link = $_ENV['App_Url'];
|
||||
$nhance_logo = $_ENV['NHANCE_LOGO'];
|
||||
|
||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||
// $client_logo = $nhance_logo;
|
||||
|
||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
|
||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
|
||||
// Step 1: Replace the placeholder with an HTML table structure
|
||||
$mail = '';
|
||||
// print_r($array_list);die;
|
||||
$table_content = '';
|
||||
$addtional_premium = 0;
|
||||
$gst = 0;
|
||||
foreach ($array_list as $item) {
|
||||
$table_content .= '<div style="text-align: left;"><div style="text-align:left;"><h4>Policy Name : ';
|
||||
$temp_data ='';
|
||||
foreach ($item as $inner_item) {
|
||||
$policy_name = $inner_item['policy_name'];
|
||||
$temp_data .= '<tr ><td style="width:20%">' . $inner_item['name'] . '</td><td style="width:20%">'.$inner_item['mobile'].'</td><td style="width:20%">₹'.number_format($inner_item['basic_cover_si'], 2, '.', ',').'</td><td style="width:20%">'.\DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y').'</tr>';
|
||||
if($inner_item['relationship'] == 'Self' || $inner_item['relationship'] == 'self'){
|
||||
$mail = $inner_item['email_corporate'];
|
||||
$name = $inner_item['name'];
|
||||
}
|
||||
// print_r($inner_item);die;
|
||||
$is_addon = $inner_item['is_addon'];
|
||||
|
||||
if($inner_item['is_addon'] == 2 || $inner_item['is_addon'] == 3){
|
||||
$addtional_premium = $inner_item['rata_premimum'] + $addtional_premium;
|
||||
$gst = $inner_item['gst'] + $gst;
|
||||
}
|
||||
}
|
||||
$table_content .= $policy_name.'</h4></div><table style="width:60%"><thead style="background-color: #02a8b5;"><tr><th style="width:20%">Name</th><th>Mobile Number</th><th>Sum Insure</th><th style="width:15%">Date Of Birth</th></tr></thead><tbody>';
|
||||
$table_content .= $temp_data;
|
||||
$table_content .= '</tbody></table></div>';
|
||||
|
||||
if ($is_addon == 2 || $is_addon == 3) {
|
||||
$addon_list_array = [
|
||||
'policy_name'=>$policy_name,
|
||||
'addtional_premium'=>$addtional_premium,
|
||||
'gst'=>$gst
|
||||
];
|
||||
$Addon_list[]= $addon_list_array;
|
||||
|
||||
}
|
||||
|
||||
|
||||
$temp_data = '';
|
||||
$addtional_premium = 0;
|
||||
$gst = 0;
|
||||
}
|
||||
|
||||
$table_content .='<br><table style="width:60%"><thead style="background-color: #e26828;"><tr><th>Policy Name</th><th> Additional Premium</th><th>GST</th><th>Total</th></tr></thead><tbody>';
|
||||
$sum_tolal = 0;
|
||||
foreach ($Addon_list as $key => $value) {
|
||||
$sum_tolal = $value['gst'] + $value['addtional_premium'] + $sum_tolal;
|
||||
$table_content .= '<tr><td>'.$value['policy_name'].'</td><td>₹'.$value['addtional_premium'].'</td><td>'.$value['gst'].'</td><td>'.$value['gst'] + $value['addtional_premium'] .'</td></tr>';
|
||||
}
|
||||
$table_content .= '<tr><td></td><td></td><td><h4>Total</h4></td><td>'.$sum_tolal.'</td></tr>';
|
||||
$table_content .= '</tbody></table>';
|
||||
$mail_content = str_replace("[[member_name]]", $name, $mail_content);
|
||||
|
||||
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
|
||||
// $mail = "aadhavanvalli@gmail.com";
|
||||
|
||||
$wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
|
||||
|
||||
return $wholeData;
|
||||
|
||||
}
|
||||
// print_r($wholeData);die;
|
||||
} else if($action == 'account_maneger_summary_mail'){
|
||||
|
||||
$client_id = $params['client_id'];
|
||||
|
||||
$clientModel = new ClientModel();
|
||||
|
||||
$client_data =$clientModel->where('id', $client_id)->first();
|
||||
$notificationModel = new NotificationModel();
|
||||
$notification_data = $notificationModel->where('client_id' ,$client_id)->where('template_name', $action)->first();
|
||||
$clientRMModel =new ClientRMModel();
|
||||
|
||||
if ($notification_data['enabled'] == 1) {
|
||||
$client_rm_data= $clientRMModel->where('client_id', $client_id)->where('is_active',1)->findAll();
|
||||
$user_list= [];
|
||||
foreach ($client_rm_data as $key => $value) {
|
||||
if($value['level'] == 3){
|
||||
$userModel = new UserModel();
|
||||
$user_data = $userModel->where('id', $value['user_id'])->first();
|
||||
$user_list[]=$user_data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$mail_content = $notification_data['mail_content'];
|
||||
$subject = $notification_data['subject'];
|
||||
$app_link = $_ENV['App_Url'];
|
||||
$nhance_logo = $_ENV['NHANCE_LOGO'];
|
||||
|
||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||
// $client_logo = $nhance_logo;
|
||||
|
||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
|
||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
|
||||
// Step 1: Replace the placeholder with an HTML table structure
|
||||
$mail = '';
|
||||
// print_r($array_list);die;
|
||||
$table_content = '';
|
||||
$addtional_premium = 0;
|
||||
$gst = 0;
|
||||
$array_list = $params['array_list'];
|
||||
|
||||
foreach ($array_list as $item) {
|
||||
$table_content .= '<div style="text-align: left;"><div style="text-align:left;"><h4>Policy Name : ';
|
||||
$temp_data ='';
|
||||
foreach ($item as $inner_item) {
|
||||
$policy_name = $inner_item['policy_name'];
|
||||
$temp_data .= '<tr ><td style="width:20%">' . $inner_item['name'] . '</td><td style="width:20%">'.$inner_item['mobile'].'</td><td style="width:20%">₹'.number_format($inner_item['basic_cover_si'], 2, '.', ',').'</td><td style="width:20%">'.\DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y').'</tr>';
|
||||
// print_r($inner_item);die;
|
||||
$is_addon = $inner_item['is_addon'];
|
||||
|
||||
if($inner_item['is_addon'] == 2 || $inner_item['is_addon'] == 3){
|
||||
$addtional_premium = $inner_item['rata_premimum'] + $addtional_premium;
|
||||
$gst = $inner_item['gst'] + $gst;
|
||||
}
|
||||
}
|
||||
$table_content .= $policy_name.'</h4></div><table style="width:60%"><thead style="background-color: #02a8b5;"><tr><th style="width:20%">Name</th><th>Mobile Number</th><th>Sum Insure</th><th style="width:15%">Date Of Birth</th></tr></thead><tbody>';
|
||||
$table_content .= $temp_data;
|
||||
$table_content .= '</tbody></table></div>';
|
||||
|
||||
if ($is_addon == 2 || $is_addon == 3) {
|
||||
$addon_list_array = [
|
||||
'policy_name'=>$policy_name,
|
||||
'addtional_premium'=>$addtional_premium,
|
||||
'gst'=>$gst
|
||||
];
|
||||
$Addon_list[]= $addon_list_array;
|
||||
|
||||
}
|
||||
|
||||
|
||||
$temp_data = '';
|
||||
$addtional_premium = 0;
|
||||
$gst = 0;
|
||||
|
||||
}
|
||||
|
||||
$table_content .='<br><table style="width:60%"><thead style="background-color: #e26828;"><tr><th>Policy Name</th><th> Additional Premium</th><th>GST</th><th>Total</th></tr></thead><tbody>';
|
||||
$sum_tolal = 0;
|
||||
foreach ($Addon_list as $key => $value) {
|
||||
$sum_tolal = $value['gst'] + $value['addtional_premium'] + $sum_tolal;
|
||||
$table_content .= '<tr><td>'.$value['policy_name'].'</td><td>₹'.$value['addtional_premium'].'</td><td>'.$value['gst'].'</td><td>'.$value['gst'] + $value['addtional_premium'] .'</td></tr>';
|
||||
}
|
||||
$table_content .= '<tr><td></td><td></td><td><h4>Total</h4></td><td>'.$sum_tolal.'</td></tr>';
|
||||
$table_content .= '</tbody></table>';
|
||||
|
||||
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
|
||||
|
||||
$account_manager_mail_list = [];
|
||||
foreach ($user_list as $key => $value) {
|
||||
$full_name = $value['first_name'] .' ' .$value['last_name'];
|
||||
$mail_content = str_replace("[[member_name]]", $full_name , $mail_content);
|
||||
|
||||
$wholeData[] = ['mail' => $value['email'], 'subject' => $subject,'message'=> $mail_content];
|
||||
// $wholeData[] = ['mail' => $value['email'], 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
|
||||
}
|
||||
return $wholeData;
|
||||
}
|
||||
} else if($action == 'client_hr_summary_mail'){
|
||||
|
||||
$client_id = $params['client_id'];
|
||||
|
||||
$clientModel = new ClientModel();
|
||||
|
||||
$client_data =$clientModel->where('id', $client_id)->first();
|
||||
$notificationModel = new NotificationModel();
|
||||
$notification_data = $notificationModel->where('client_id' ,$client_id)->where('template_name', $action)->first();
|
||||
$clientRMModel =new ClientRMModel();
|
||||
|
||||
if ($notification_data['enabled'] == 1) {
|
||||
$client_rm_data= $clientRMModel->where('client_id', $client_id)->where('is_active',1)->findAll();
|
||||
$user_list= [];
|
||||
foreach ($client_rm_data as $key => $value) {
|
||||
if($value['level'] == 3){
|
||||
$userModel = new UserModel();
|
||||
$user_data = $userModel->where('id', $value['user_id'])->first();
|
||||
$user_list[]=$user_data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$mail_content = $notification_data['mail_content'];
|
||||
$subject = $notification_data['subject'];
|
||||
$app_link = $_ENV['App_Url'];
|
||||
$nhance_logo = $_ENV['NHANCE_LOGO'];
|
||||
|
||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||
// $client_logo = $nhance_logo;
|
||||
|
||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||
|
||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
|
||||
// Step 1: Replace the placeholder with an HTML table structure
|
||||
$mail = '';
|
||||
// print_r($array_list);die;
|
||||
$table_content = '';
|
||||
$addtional_premium = 0;
|
||||
$gst = 0;
|
||||
$array_list = $params['array_list'];
|
||||
|
||||
foreach ($array_list as $item) {
|
||||
$table_content .= '<div style="text-align: left;"><div style="text-align:left;"><h4>Policy Name : ';
|
||||
$temp_data ='';
|
||||
foreach ($item as $inner_item) {
|
||||
$policy_name = $inner_item['policy_name'];
|
||||
$temp_data .= '<tr ><td style="width:20%">' . $inner_item['name'] . '</td><td style="width:20%">'.$inner_item['mobile'].'</td><td style="width:20%">₹'.number_format($inner_item['basic_cover_si'], 2, '.', ',').'</td><td style="width:20%">'.\DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y').'</tr>';
|
||||
// print_r($inner_item);die;
|
||||
$is_addon = $inner_item['is_addon'];
|
||||
|
||||
if($inner_item['is_addon'] == 2 || $inner_item['is_addon'] == 3){
|
||||
$addtional_premium = $inner_item['rata_premimum'] + $addtional_premium;
|
||||
$gst = $inner_item['gst'] + $gst;
|
||||
}
|
||||
}
|
||||
$table_content .= $policy_name.'</h4></div><table style="width:60%"><thead style="background-color: #02a8b5;"><tr><th style="width:20%">Name</th><th>Mobile Number</th><th>Sum Insure</th><th style="width:15%">Date Of Birth</th></tr></thead><tbody>';
|
||||
$table_content .= $temp_data;
|
||||
$table_content .= '</tbody></table></div>';
|
||||
|
||||
if ($is_addon == 2 || $is_addon == 3) {
|
||||
$addon_list_array = [
|
||||
'policy_name'=>$policy_name,
|
||||
'addtional_premium'=>$addtional_premium,
|
||||
'gst'=>$gst
|
||||
];
|
||||
$Addon_list[]= $addon_list_array;
|
||||
|
||||
}
|
||||
|
||||
|
||||
$temp_data = '';
|
||||
$addtional_premium = 0;
|
||||
$gst = 0;
|
||||
|
||||
}
|
||||
|
||||
$table_content .='<br><table style="width:60%"><thead style="background-color: #e26828;"><tr><th>Policy Name</th><th> Additional Premium</th><th>GST</th><th>Total</th></tr></thead><tbody>';
|
||||
$sum_tolal = 0;
|
||||
foreach ($Addon_list as $key => $value) {
|
||||
$sum_tolal = $value['gst'] + $value['addtional_premium'] + $sum_tolal;
|
||||
$table_content .= '<tr><td>'.$value['policy_name'].'</td><td>₹'.$value['addtional_premium'].'</td><td>'.$value['gst'].'</td><td>'.$value['gst'] + $value['addtional_premium'] .'</td></tr>';
|
||||
}
|
||||
$table_content .= '<tr><td></td><td></td><td><h4>Total</h4></td><td>'.$sum_tolal.'</td></tr>';
|
||||
$table_content .= '</tbody></table>';
|
||||
|
||||
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
|
||||
|
||||
|
||||
$hr_mails = $client_data['hr_mails'];
|
||||
$mail_array = explode(',', $hr_mails);
|
||||
$mail_array = array_map('trim', $mail_array);
|
||||
|
||||
foreach ($mail_array as $key => $value) {
|
||||
$wholeData[] = ['mail' => $value, 'subject' => $subject,'message'=> $mail_content];
|
||||
// $wholeData[] = ['mail' => $value, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
|
||||
}
|
||||
|
||||
return $wholeData;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -22,6 +22,8 @@ class BatchFileModel extends Model
|
||||
"updated_by",
|
||||
"is_active",
|
||||
"amount",
|
||||
"status",
|
||||
"error_data",
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
|
||||
@ -26,6 +26,8 @@ class ClientModel extends Model
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"is_active",
|
||||
"common_mails",
|
||||
"hr_mails"
|
||||
];
|
||||
|
||||
|
||||
|
||||
@ -76,8 +76,8 @@ class ClientPolicyModel extends Model
|
||||
->select('policy_type.policy_type as policy_type_name')
|
||||
->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('tpa', 'tpa.id = client_policy.tpa_id', 'left')
|
||||
->join('tpa_branch', 'client_policy.tpa_branch_id = tpa_branch.id', 'left')
|
||||
->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)
|
||||
|
||||
@ -98,13 +98,15 @@ class EmployeeModel extends Model
|
||||
|
||||
public function getEmpFamilybyEmpCode(string $client_policy_id = null,string $emp_code = null,string $client_id = null,array $emp_status = [],array $policy_status = [],array $relationship = [])
|
||||
{
|
||||
$result = $this->select(['employees.id as emp_id', 'employees.client_id', 'employees.relationship', 'employees.relationship_code', 'employees.change_event', 'employees.emp_code', 'employees.name', 'employees.email_personal', 'employees.email_corporate', 'employees.mobile', 'employees.gender', 'employees.dob', 'employees.doj', 'employees.basic_pay', 'employees.band', 'employees.designation', 'employees.emp_status','employee_polices.id as emp_policy_id', 'employee_polices.employee_id', 'employee_polices.client_policy_id', 'employee_polices.tpa_id', 'employee_polices.uhid', 'employee_polices.batch_code', 'employee_polices.status', 'employee_polices.pre_existing_alignments', 'employee_polices.basic_cover_si', 'employee_polices.date_coverage', 'employee_polices.policy_end_date', 'employee_polices.days', 'employee_polices.premium', 'employee_polices.rata_premimum', 'employee_polices.gst', 'employee_polices.date_of_exit', 'employee_polices.reason_for_exit'])
|
||||
$result = $this->select(['employees.id as emp_id', 'employees.client_id', 'employees.relationship', 'employees.relationship_code', 'employees.change_event', 'employees.emp_code', 'employees.name', 'employees.email_personal', 'employees.email_corporate', 'employees.mobile', 'employees.gender', 'employees.dob', 'employees.doj', 'employees.basic_pay', 'employees.band', 'employees.designation', 'employees.emp_status','employee_polices.id as emp_policy_id', 'employee_polices.employee_id', 'employee_polices.client_policy_id', 'employee_polices.tpa_id', 'employee_polices.uhid', 'employee_polices.batch_code', 'employee_polices.status', 'employee_polices.pre_existing_alignments', 'employee_polices.basic_cover_si', 'employee_polices.date_coverage', 'employee_polices.policy_end_date', 'employee_polices.days', 'employee_polices.premium', 'employee_polices.rata_premimum', 'employee_polices.gst', 'employee_polices.date_of_exit', 'employee_polices.reason_for_exit','policies.name as policy_name','client_policy.is_addon'])
|
||||
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
||||
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
|
||||
->join('policies', 'policies.id = client_policy.policy_id')
|
||||
->where('employees.is_active',1)
|
||||
->when($client_policy_id, function($query) use ($client_policy_id){
|
||||
return $query->where('employee_polices.client_policy_id',$client_policy_id);
|
||||
})
|
||||
|
||||
|
||||
->where('employee_polices.is_active',1)
|
||||
->where('employees.is_active',1)
|
||||
// ->where('employees.emp_code',$emp_code)
|
||||
|
||||
@ -771,5 +771,22 @@ class EmployeePolicyModel extends Model
|
||||
}
|
||||
|
||||
|
||||
public function getExisitingMobileNos(string $client_policy_id)
|
||||
{
|
||||
$result = $this->select(['employee_polices.id','emp.id as emp_id','emp.relationship','emp.emp_code','emp.name','emp.email_corporate','emp.mobile as mobile'])
|
||||
->join('employees emp', 'employee_polices.employee_id = emp.id')
|
||||
->join('client_policy cp', 'employee_polices.client_policy_id = cp.id')
|
||||
->where('employee_polices.client_policy_id',$client_policy_id)
|
||||
->whereIn('employee_polices.status', ['Active'])
|
||||
->whereIn('emp.emp_status', ['Active'])
|
||||
->where('emp.is_active', 1)
|
||||
->where('emp.relationship', 'Self')
|
||||
->where('emp.mobile is not null')
|
||||
->where('employee_polices.is_active', 1)
|
||||
->findAll();
|
||||
|
||||
return ($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
12
app/Models/NotificationModel.php
Normal file
12
app/Models/NotificationModel.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class NotificationModel extends Model
|
||||
{
|
||||
protected $table = 'notifications';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = ["id","client_id","template_name","subject","mail_content","enabled","created_by","updated_by","is_active",];
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
<style>
|
||||
.table-responsive {
|
||||
overflow-x: auto;
|
||||
}
|
||||
.table-responsive {
|
||||
overflow-x: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="col-12">
|
||||
@ -27,29 +27,51 @@
|
||||
<th class="font-weight-medium">Action</th>
|
||||
<th class="font-weight-medium">Count</th>
|
||||
<th class="font-weight-medium">Amount</th>
|
||||
<th class="font-weight-medium">status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody class="font-12">
|
||||
<?php
|
||||
if(isset($batch_list))
|
||||
{
|
||||
foreach ($batch_list as $key => $file) {
|
||||
<?php
|
||||
if (isset($batch_list)) {
|
||||
foreach ($batch_list as $key => $file) {
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td><b><?php echo ($key + 1)?></b></td>
|
||||
<td><?php echo $file['batch_code']?></td>
|
||||
<td data-toggle="tooltip" data-placement="top" title="<?php echo $file['file_name'] ?>" ><?php echo strlen($file['file_name']) > 5 ? substr($file['file_name'], 0, 10) . "..." : $file['file_name'] ?></td>
|
||||
<td><?php echo $file['client_short_name']?></td>
|
||||
<td><?php echo $file['policy_name']?></td>
|
||||
<td><?php echo $file['event_type']?></td>
|
||||
<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 }}?>
|
||||
<tr>
|
||||
<td><b><?php echo ($key + 1) ?></b></td>
|
||||
<td><?php echo $file['batch_code'] ?></td>
|
||||
<td data-toggle="tooltip" data-placement="top" title="<?php echo $file['file_name'] ?>"><?php echo strlen($file['file_name']) > 5 ? substr($file['file_name'], 0, 10) . "..." : $file['file_name'] ?></td>
|
||||
<td><?php echo $file['client_short_name'] ?></td>
|
||||
<td><?php echo $file['policy_name'] ?></td>
|
||||
<td><?php echo $file['event_type'] ?></td>
|
||||
<td><?php echo $file['insurer_or_tpa'] ?></td>
|
||||
<td><?php echo $file['actions'] ?></td>
|
||||
<td><?php echo $file['count'] ?></td>
|
||||
<td><?php echo intval($file['amount']) ?></td>
|
||||
<td>
|
||||
<?php if ($file['status'] == 'failed') { ?>
|
||||
<?php echo $file['status']; ?> <a href="<?= base_url('/util/export-import-error-list/') . $file['id'] ?>" class="fe-alert-circle" style="color: #000;" aria-hidden="true" target="_blank" data-toggle="tooltip" data-placement="top" title="Click to show the error"></a>
|
||||
<?php } else if ($file['status'] == 'partially success') { ?>
|
||||
<?php echo $file['status']; ?>
|
||||
<?php if ($file['error_data'] != 0) { ?>
|
||||
<a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip" data-placement="top" title="<?= $file['error_data'] ?>"></a>
|
||||
<?php } ?>
|
||||
<?php } else if ($file['status'] == 'failed-1') { ?>
|
||||
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip" data-placement="top" title="The list of employees provided has already been updated with the TPA ID."></a>
|
||||
<?php } else if ($file['status'] == 'failed-2') { ?>
|
||||
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip" data-placement="top" title="The list of employees provided has already been updated with the UHID."></a>
|
||||
<?php } else if ($file['status'] == 'failed-3') { ?>
|
||||
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip" data-placement="top" title="The Excel record count exceeds the DB record count."></a>
|
||||
<?php } else if ($file['status'] == 'failed-4') { ?>
|
||||
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip" data-placement="top" title="Physical File Not Found."></a>
|
||||
<?php } else { ?>
|
||||
<?php echo $file['status']; ?>
|
||||
<?php } ?>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<?php }
|
||||
} ?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
@ -59,31 +81,31 @@
|
||||
</div><!-- end col -->
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#datatable-buttons').DataTable({
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
||||
buttons: [{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'Batch List',
|
||||
className: 'my_class',
|
||||
}],
|
||||
initComplete: function(settings, json) {
|
||||
$('.my_class').css({
|
||||
position: "relative",
|
||||
left: "50px"
|
||||
});
|
||||
},
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true
|
||||
});
|
||||
|
||||
|
||||
$('#datatable-buttons').DataTable({
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
||||
buttons: [{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'Batch List',
|
||||
className: 'my_class',
|
||||
}],
|
||||
initComplete: function(settings, json) {
|
||||
$('.my_class').css({
|
||||
position: "relative",
|
||||
left: "50px"
|
||||
});
|
||||
},
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
@ -203,11 +203,13 @@ input:checked + .slider:before {
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const switchCheckbox = document.getElementById('switch-checkbox');
|
||||
const switchInner = document.querySelector('.switch-inner');
|
||||
|
||||
switchInner.addEventListener('click', function() {
|
||||
if (switchInner) {
|
||||
switchInner.addEventListener('click', function() {
|
||||
switchCheckbox.checked = !switchCheckbox.checked;
|
||||
switchInner.style.transform = switchCheckbox.checked ? 'translateX(100%)' : 'translateX(0)';
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@ -176,6 +176,26 @@
|
||||
$('#name_'+item.kyc_doc_type_id).html(item.file_name);
|
||||
$('#form_'+item.kyc_doc_type_id).hide();
|
||||
|
||||
console.log('step 1')
|
||||
|
||||
if(item.file_name != null && item.file_name != ""){
|
||||
console.log('step 2')
|
||||
|
||||
$('#download_'+item.kyc_doc_type_id).show();
|
||||
$('#download_' + item.kyc_doc_type_id).attr('href', '<?= base_url('download-kyc-docs/') ?>' + item.file_name);
|
||||
$('#delete_'+item.kyc_doc_type_id).show();
|
||||
|
||||
}
|
||||
else{
|
||||
console.log('step 3')
|
||||
|
||||
$('#download_'+item.kyc_doc_type_id).hide();
|
||||
$('#download_' + item.kyc_doc_type_id).attr('href', '#');
|
||||
$('#delete_'+item.kyc_doc_type_id).hide();
|
||||
|
||||
}
|
||||
console.log('step 4')
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
@ -212,19 +232,27 @@
|
||||
var tbody = $('#tbody');
|
||||
tbody.empty();
|
||||
|
||||
$.each(res.data, function (index, item) {
|
||||
$.each(res.data, function(index, item) {
|
||||
var row = `<tr>
|
||||
<td> ${item.file_name}</td>
|
||||
<td id="form_${item.id}" style=""><form class="ajax" ><input class="file-input__input" type="file" name="file_name">
|
||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||
<input type="hidden" class="form-control" value="${item.id}" name="kyc_doc_type_id" />
|
||||
<input type="hidden" name="client_id" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
|
||||
<button class="btn btn-sm btn-primary submit" style="position: relative;right: 80px;">Submit</button></form></td>
|
||||
<td>${item.file_name}</td>
|
||||
<td id="form_${item.id}">
|
||||
<form class="ajax">
|
||||
<input class="file-input__input" type="file" name="file_name">
|
||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>">
|
||||
<input type="hidden" class="form-control" value="${item.id}" name="kyc_doc_type_id">
|
||||
<input type="hidden" name="client_id" value="<?= isset($client['id']) ? $client['id'] : '' ?>">
|
||||
<button class="btn btn-sm btn-primary submit" style="position: relative; right: 80px;">Submit</button>
|
||||
</form>
|
||||
</td>
|
||||
<td id="name_${item.id}" style="display:none;"></td>
|
||||
<td><i data-id="${item.id}" class="mdi mdi-delete btnKycDelete" style="font-size:18px;"></i></td>
|
||||
<td>
|
||||
<i id="delete_${item.id}" data-id="${item.id}" class="mdi mdi-delete btnKycDelete" style="font-size:18px; display: none"></i>
|
||||
<a id="download_${item.id}" data-id="${item.id}" class="fa fa-download" style="font-size:18px; display: none" download></a>
|
||||
</td>
|
||||
</tr>`;
|
||||
tbody.append(row);
|
||||
});
|
||||
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
@ -250,7 +278,10 @@
|
||||
<tr id="kyc-${item.id}">
|
||||
<td>${item.other_docs_name}</td>
|
||||
<td>${item.file_name}</td>
|
||||
<td><i data-id="${item.id}" class="mdi mdi-delete btnKycOtherDelete" style="font-size:18px;"></i></td>
|
||||
<td>
|
||||
<i data-id="${item.id}" class="mdi mdi-delete btnKycOtherDelete" style="font-size:18px;"></i>
|
||||
<a href = "<?= base_url('download-kyc-docs/') ?>${item.file_name}" data-id="${item.id}" class="fa fa-download" style="font-size:18px;" download></a>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
|
||||
@ -267,6 +298,29 @@
|
||||
$('#name_'+item.kyc_doc_type_id).show();
|
||||
$('#name_'+item.kyc_doc_type_id).html(item.file_name);
|
||||
$('#form_'+item.kyc_doc_type_id).hide();
|
||||
|
||||
console.log('step 1')
|
||||
|
||||
if(item.file_name != null && item.file_name != ""){
|
||||
console.log('step 2')
|
||||
|
||||
$('#download_'+item.kyc_doc_type_id).show();
|
||||
$('#download_' + item.kyc_doc_type_id).attr('href', '<?= base_url('download-kyc-docs/') ?>' + item.file_name);
|
||||
$('#delete_'+item.kyc_doc_type_id).show();
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
console.log('step 3')
|
||||
|
||||
$('#download_'+item.kyc_doc_type_id).hide();
|
||||
$('#download_' + item.kyc_doc_type_id).attr('href', '#');
|
||||
$('#delete_'+item.kyc_doc_type_id).hide();
|
||||
|
||||
|
||||
}
|
||||
console.log('step 4')
|
||||
|
||||
}, 1000);
|
||||
|
||||
});
|
||||
@ -335,7 +389,10 @@
|
||||
<tr id="kyc-${item.id}">
|
||||
<td>${item.other_docs_name}</td>
|
||||
<td>${item.file_name}</td>
|
||||
<td><i data-id="${item.id}" class="mdi mdi-delete btnKycOtherDelete" style="font-size:18px;"></i></td>
|
||||
<td>
|
||||
<i data-id="${item.id}" class="mdi mdi-delete btnKycOtherDelete" style="font-size:18px;"></i>
|
||||
<a href = "<?= base_url('download-kyc-docs/') ?>${item.file_name}" data-id="${item.id}" class="fa fa-download" style="font-size:18px; display: none" download></a>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
}
|
||||
|
||||
@ -76,6 +76,12 @@ body {
|
||||
<span class="d-none d-sm-inline-block">Branch & Contacts</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#notification-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="notification_tab">
|
||||
<span class="mr-1"><i class="mdi mdi-bell"></i></span>
|
||||
<span class="d-none d-sm-inline-block">Notifications</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#police-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="policy_tab">
|
||||
<span class="mr-1"><i class="mdi mdi-book-open-page-variant"></i></span>
|
||||
@ -84,6 +90,8 @@ body {
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<?php include('notification.php'); ?>
|
||||
|
||||
<?php include('client_basic_info.php'); ?>
|
||||
<?php include('client_kyc.php'); ?>
|
||||
<?php include('client_rm.php'); ?>
|
||||
@ -187,6 +195,24 @@ body {
|
||||
|
||||
}
|
||||
|
||||
|
||||
function client_notification() {
|
||||
var check_client_id = $('#general_PrimaryKey');
|
||||
|
||||
|
||||
if(check_client_id[0].value == '' || check_client_id[0].value == null || check_client_id[0].value == 0){
|
||||
$('#btnBranchAdd').hide();
|
||||
toastr.warning('Please Add the Client!', 'warning',{timeOut: 2000});
|
||||
}else{
|
||||
if ($('#btnBranchBack')[0].style.display == 'none') {
|
||||
$('#btnBranchAdd').show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
document.getElementById("kyc_tab").addEventListener("click", function(event) {
|
||||
event.preventDefault();
|
||||
client_kyc_docs();
|
||||
@ -209,6 +235,12 @@ body {
|
||||
event.preventDefault();
|
||||
client_branch_contact();
|
||||
});
|
||||
|
||||
// document.getElementById("notification_tab").addEventListener("click", function(event) {
|
||||
// event.preventDefault();
|
||||
// client_notification();
|
||||
// });
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@ -80,7 +80,7 @@
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="mobile">TPA<span class="text-danger">*</span></label>
|
||||
<label for="mobile">TPA<span id="tpa_danger" class="text-danger">*</span></label>
|
||||
<select class="form-control" id="tpa" name="tpa" required>
|
||||
<option value="">Select TPA</option>
|
||||
<?php foreach ($tpa as $value) { ?>
|
||||
@ -269,12 +269,18 @@
|
||||
|
||||
}
|
||||
|
||||
var tpaValue = 'TPA Unavailable';
|
||||
|
||||
if (item.tpa_short && item.tpa_branch_code) {
|
||||
tpaValue = item.tpa_short + '-' + item.tpa_branch_code;
|
||||
}
|
||||
|
||||
|
||||
policyTable += `
|
||||
<tr>
|
||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||
<td>${item.policy_name} (${item.policy_type_name})</td>
|
||||
<td>${item.tpa_short} - ${item.tpa_branch_code}</td>
|
||||
<td>${tpaValue}</td>
|
||||
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
|
||||
<td style="text-align: center;">${(enrollmentStatus)}</td>
|
||||
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
||||
@ -424,11 +430,17 @@
|
||||
|
||||
}
|
||||
|
||||
var tpaValue = 'TPA Unavailable';
|
||||
|
||||
if (item.tpa_short && item.tpa_branch_code) {
|
||||
tpaValue = item.tpa_short + '-' + item.tpa_branch_code;
|
||||
}
|
||||
|
||||
policyTable += `
|
||||
<tr>
|
||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||
<td>${item.policy_name} (${item.policy_type_name})</td>
|
||||
<td>${item.tpa_short} - ${item.tpa_branch_code}</td>
|
||||
<td>${tpaValue}</td>
|
||||
<td>${rearrangeDateFormat(item.policy_start_date)} - ${rearrangeDateFormat(item.policy_end_date)}</td>
|
||||
<td style="text-align: center;">${(enrollmentStatus)}</td>
|
||||
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
||||
@ -555,6 +567,15 @@
|
||||
console.log('id', id)
|
||||
$('#policy_type_id').val(dataId);
|
||||
|
||||
if (dataId == 1) {
|
||||
$('#tpa').prop('required', false);
|
||||
$('#tpa_danger').hide()
|
||||
} else {
|
||||
$('#tpa').prop('required', true);
|
||||
$('#tpa_danger').show()
|
||||
}
|
||||
|
||||
|
||||
var base_policy_dataId = $('#base_policy').children('option:selected').attr('data-id');
|
||||
|
||||
|
||||
@ -647,7 +668,13 @@
|
||||
$('.btnAdd').hide();
|
||||
|
||||
$('#insurer').val(res.data.insurer_branch_id + '-' + res.data.insurer_id).change();
|
||||
$('#tpa').val(res.data.tpa_branch_id + '-' + res.data.tpa_id).change();
|
||||
var tpaValue = '';
|
||||
|
||||
if (res.data.tpa_branch_id && res.data.tpa_id) {
|
||||
tpaValue = res.data.tpa_branch_id + '-' + res.data.tpa_id;
|
||||
}
|
||||
|
||||
$('#tpa').val(tpaValue).change();
|
||||
// $('#policy').val(res.data.policy_id).change();
|
||||
$('#policy_type').val(res.data.is_addon).change();
|
||||
$('#base_policy').val(res.data.base_policy);
|
||||
|
||||
134
app/Views/export_import_error_list.php
Normal file
134
app/Views/export_import_error_list.php
Normal file
@ -0,0 +1,134 @@
|
||||
<link rel="shortcut icon" href="<?= base_url()."public"; ?>/assets/images/Nhance_Favi.svg">
|
||||
<title>Excel Error Report</title>
|
||||
<!-- Include DataTables CSS -->
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.5/css/jquery.dataTables.min.css">
|
||||
<!-- Include DataTables Buttons CSS -->
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/2.3.0/css/buttons.dataTables.min.css">
|
||||
<!-- Include Font Awesome CSS -->
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
|
||||
|
||||
<style>
|
||||
/* Table styles */
|
||||
.table {
|
||||
width: 100%;
|
||||
border: 2px solid #ddd;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.table th, .table td {
|
||||
padding: 8px;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.table th {
|
||||
background-color: #f2f2f2;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.table tr:nth-child(even) {
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
|
||||
.error-tooltip {
|
||||
display: none;
|
||||
/* Hide error message by default */
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
background-color: #000;
|
||||
color: #fff;
|
||||
padding: 5px;
|
||||
border-radius: 5px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.error-icon {
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.error-icon:hover+.error-tooltip {
|
||||
display: block;
|
||||
/* Show error message when hovering over the icon */
|
||||
}
|
||||
|
||||
/* .error-cell {
|
||||
border: 2px solid red !important;
|
||||
} */
|
||||
|
||||
/* .container{
|
||||
position: relative;
|
||||
bottom: 150px;
|
||||
} */
|
||||
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
|
||||
</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">
|
||||
<tr>
|
||||
<?php foreach ($excel_header as $header): ?>
|
||||
<th><?php echo $header; ?></th>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php for ($i = 0; $i < count($excel_data); $i++): ?>
|
||||
<tr>
|
||||
<?php foreach ($excel_data[$i] as $data): ?>
|
||||
<td <?php if (isset($data['error'])) echo 'class="error-cell"'; ?>>
|
||||
<?php
|
||||
if (isset($data['value'])) {
|
||||
echo $data['value'];
|
||||
}
|
||||
if (isset($data['error'])) {
|
||||
echo '<span class="error-icon"> <i class="fas fa-exclamation-circle" style="color: red;"></i></span>';
|
||||
echo '<span class="error-tooltip">' . $data['error'] . '</span>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php endfor; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Include jQuery -->
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<!-- Include DataTables JavaScript -->
|
||||
<script src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script>
|
||||
<!-- Include DataTables Buttons JavaScript -->
|
||||
<script src="https://cdn.datatables.net/buttons/2.3.0/js/dataTables.buttons.min.js"></script>
|
||||
<!-- Include DataTables JSZip library -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
|
||||
<!-- Include DataTables Buttons HTML5 export extension -->
|
||||
<script src="https://cdn.datatables.net/buttons/2.3.0/js/buttons.html5.min.js"></script>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#tickets-table').DataTable({
|
||||
dom: 'Bfrtip',
|
||||
buttons: [
|
||||
{
|
||||
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
|
||||
lengthMenu: [[-1], ["All"]] // Display all rows
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@ -496,6 +496,10 @@
|
||||
<!-- Jodit Js -->
|
||||
<script src="<?= base_url()."public"; ?>/assets/js/jodit.min.js"></script>
|
||||
|
||||
<script src="<?= base_url()."public"; ?>/assets/libs/quill/quill.min.js"></script>
|
||||
<script src="<?= base_url()."public"; ?>/assets/js/pages/form-quilljs.init.js"></script>
|
||||
|
||||
|
||||
<!-- select2 -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
||||
|
||||
|
||||
@ -43,6 +43,10 @@
|
||||
<!-- Jodit Css -->
|
||||
<link href="<?= base_url()."public"; ?>/assets/css/jodit.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
|
||||
<link href="<?= base_url()."public"; ?>/assets/libs/quill/quill.snow.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
|
||||
|
||||
<!-- JQuery CDN -->
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
@ -241,6 +245,7 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
1155
app/Views/notification.php
Normal file
1155
app/Views/notification.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -85,8 +85,10 @@
|
||||
}
|
||||
|
||||
.s {
|
||||
margin-left: 30px;
|
||||
width: 689px;
|
||||
/* margin-left: 30px;
|
||||
width: 689px; */
|
||||
margin-left: 141px;
|
||||
width: 576px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -134,14 +136,14 @@
|
||||
<tr>
|
||||
<td style="width: 11%;"><span style="margin-right: 20px;">Self:</span></td>
|
||||
<td style="width: 11%;"><input type="checkbox" style="margin-right: 70px;" name="family_floaters[]" value="self" id="self" checked> </td>
|
||||
<td style="width: 28%;" ><div class="self-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($self_min_age) ? $self_min_age : '18'; ?>" style="width: 18%;" type="number" name="self_min_age" id="self_min_age"></div></td>
|
||||
<td style="width: 28%;" ><div class="self-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>" style="width: 18%;" type="number" name="self_max_age" id="self_max_age"></div></td>
|
||||
<td style="width: 28%;" ><div class="self-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($self_min_age) ? $self_min_age : '18'; ?>" style="width: 25%;;" type="number" name="self_min_age" id="self_min_age" oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)"></div></td>
|
||||
<td style="width: 28%;" ><div class="self-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>" style="width: 25%;;" type="number" name="self_max_age" id="self_max_age" oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)"></div></td>
|
||||
</tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
|
||||
<tr>
|
||||
<td style="width: 11%;"><span style="margin-right: 20px;">Spouse:</span></td>
|
||||
<td style="width: 11%;"><input type="checkbox" style="margin-right: 70px;"name="family_floaters[]" value="spouse" id="spouse"></td>
|
||||
<td style="width: 28%;" ><div class="spouse-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($spouse_min_age) ? $spouse_min_age : '18'; ?>" style="width: 18%;" type="number" name="spouse_min_age" id="spouse_min_age"></div></td>
|
||||
<td style="width: 28%;" ><div class="spouse-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($spouse_max_age) ? $spouse_max_age : '60'; ?>" style="width: 18%;" type="number" name="spouse_max_age" id="spouse_max_age"></div></td>
|
||||
<td style="width: 28%;" ><div class="spouse-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($spouse_min_age) ? $spouse_min_age : '18'; ?>" style="width: 25%;;" type="number" name="spouse_min_age" id="spouse_min_age" oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)"></div></td>
|
||||
<td style="width: 28%;" ><div class="spouse-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($spouse_max_age) ? $spouse_max_age : '60'; ?>" style="width: 25%;;" type="number" name="spouse_max_age" id="spouse_max_age" oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)"></div></td>
|
||||
</tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
|
||||
<tr>
|
||||
<td style="width: 11%;"><span for="children">Children:</span></td>
|
||||
@ -153,8 +155,8 @@
|
||||
<option value="4">4</option>
|
||||
</select>
|
||||
</td>
|
||||
<td style="width: 28%;" ><div class="child-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($child_min_age) ? $child_min_age : '0'; ?>" style="width: 18%;" type="number" name="child_min_age" id="child_min_age"></div></td>
|
||||
<td style="width: 28%;" ><div class="child-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($child_max_age) ? $child_max_age : '25'; ?>" style="width: 18%;" type="number" name="child_max_age" id="child_max_age"></div></td>
|
||||
<td style="width: 28%;" ><div class="child-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($child_min_age) ? $child_min_age : '0'; ?>" style="width: 25%;;" type="number" name="child_min_age" id="child_min_age" oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)"></div></td>
|
||||
<td style="width: 28%;" ><div class="child-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($child_max_age) ? $child_max_age : '25'; ?>" style="width: 25%;;" type="number" name="child_max_age" id="child_max_age" oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)"></div></td>
|
||||
</tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -182,9 +184,9 @@
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width: 22%;" ><div class="other-member-age"><span style="margin-right: 20px;">Elders Count:</span><input class="underline-input" id="member_count" style="width: 18%;" type="number" name="member_count" disabled id="member_count"></div></td>
|
||||
<td style="width: 28%;" ><div class="other-member-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($other_member_min_age) ? $other_member_min_age : '18'; ?>" style="width: 18%;" type="number" class="underline-input min_age" name="other_member_min_age" id="other_member_min_age"></div></td>
|
||||
<td style="width: 28%;" ><div class="other-member-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input max_age" value="<?php echo isset($other_member_max_age) ? $other_member_max_age : '60'; ?>" style="width: 18%;" type="number" class="underline-input max_age" name="other_member_max_age" id="other_member_max_age"></div></td>
|
||||
<td style="width: 22%;" ><div class="other-member-age"><span style="margin-right: 20px;">Elders Count:</span><input class="underline-input" id="member_count" style="width: 25%;;" type="number" name="member_count" disabled id="member_count"></div></td>
|
||||
<td style="width: 28%;" ><div class="other-member-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($other_member_min_age) ? $other_member_min_age : '18'; ?>" style="width: 25%;;" type="number" class="underline-input min_age" name="other_member_min_age" id="other_member_min_age" oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)"></div></td>
|
||||
<td style="width: 28%;" ><div class="other-member-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input max_age" value="<?php echo isset($other_member_max_age) ? $other_member_max_age : '60'; ?>" style="width: 25%;;" type="number" class="underline-input max_age" name="other_member_max_age" id="other_member_max_age" oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)"></div></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
@ -320,7 +322,7 @@
|
||||
<div class="col-md-6">
|
||||
<select name="copayzonewisecopay" id="copayzonewisecopay" class="form-control ">
|
||||
<option value="">Select an option</option>
|
||||
<option value="5%">5%</option>
|
||||
<option value="Nil">Nil</option>
|
||||
<option value="10%">10%</option>
|
||||
<option value="15%">15%</option>
|
||||
<option value="20%">20%</option>
|
||||
@ -441,6 +443,15 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">AYUSH treatment cover Data</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="ayushTreatmentCoverData" id="ayushTreatmentCoverData" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">ARMD Covered</label>
|
||||
@ -552,6 +563,25 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Cataract</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="radio" name="cataract" class="cataract" value="1"> Yes
|
||||
<input type="radio" name="cataract" class="cataract" value="0" style="margin-left:10px"> No
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Cataract Data</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="cataractData" id="cataractData" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="form-column" id="grid_content_input">
|
||||
@ -599,8 +629,37 @@
|
||||
// }
|
||||
// });
|
||||
|
||||
$('input[name="ayudhtreatmentcover"]').change(function() {
|
||||
|
||||
console.log($(this).val());
|
||||
|
||||
if ($(this).val() == '1') {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
$(element).css("display", "");
|
||||
|
||||
} else {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
$(element).css("display", "none");
|
||||
}
|
||||
});
|
||||
|
||||
$('input[name="cataract"]').change(function() {
|
||||
|
||||
console.log($(this).val());
|
||||
|
||||
if ($(this).val() == '1') {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
$(element).css("display", "");
|
||||
|
||||
} else {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
$(element).css("display", "none");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('input[name="waiverofpreexistingdiseases"]').change(function() {
|
||||
|
||||
if ($(this).val() == '1') {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
$(element).css("display", "");
|
||||
@ -718,7 +777,7 @@
|
||||
|
||||
$('#gmc_client_policy_id').val(client_policy_id)
|
||||
|
||||
|
||||
$('.removeDom').remove();
|
||||
|
||||
var gmc_policy_type_id = $(this).attr('id');
|
||||
// console.log(gmc_policy_type_id)
|
||||
@ -789,11 +848,19 @@
|
||||
specialCondition();
|
||||
}
|
||||
}
|
||||
|
||||
console.log('key', key)
|
||||
let elements = document.getElementsByName(`${key}[]`);
|
||||
console.log(elements)
|
||||
|
||||
if (elements) {
|
||||
elements.forEach((element, index) => {
|
||||
element.value = jsonObject[key][index];
|
||||
console.log()
|
||||
if(jsonObject[key][index] == undefined){
|
||||
element.value = " ";
|
||||
}else{
|
||||
element.value = jsonObject[key][index];
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -909,6 +976,10 @@
|
||||
element.parentElement.parentElement.nextElementSibling.nextElementSibling.nextElementSibling.style.display = '';
|
||||
element.parentElement.parentElement.nextElementSibling.nextElementSibling.nextElementSibling.nextElementSibling.style.display = '';
|
||||
|
||||
}else if(element.name === "ayudhtreatmentcover"){
|
||||
element.parentElement.parentElement.nextElementSibling.style.display = '';
|
||||
}else if(element.name === "cataract"){
|
||||
element.parentElement.parentElement.nextElementSibling.style.display = '';
|
||||
}
|
||||
|
||||
|
||||
@ -929,7 +1000,12 @@
|
||||
}
|
||||
// console.log(jsonObject[key]);
|
||||
} else {
|
||||
element.value = jsonObject[key];
|
||||
|
||||
if(jsonObject[key] == undefined){
|
||||
element.value = " ";
|
||||
}else{
|
||||
element.value = jsonObject[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1119,7 +1195,10 @@
|
||||
|
||||
var index = $('.modifyclassinput').length;
|
||||
var appendElement = `<div class="form-group col-md-6 form-group-client-policy-masters removeDom">
|
||||
<label for="specialconditionlabel" class="special_condition_label[]" style="width: 450px;"><input name="special_condition_label[]" id="special_condition_label[]" style="position: relative;right: 15px;"><span class="specialConditionClose" style="color: red;margin-left: 5px;">X</span></label>
|
||||
<label for="specialconditionlabel" class="special_condition_label[]" style="width: 450px;position: relative;bottom: 6px;">
|
||||
<input class="form-control" name="special_condition_label[]" id="special_condition_label[]" style="position: relative;right: 15px;">
|
||||
<span class="specialConditionClose" style="color: red; float: right;position: relative;bottom: 28px;left: 15px;">X</span>
|
||||
</label>
|
||||
<input type="text" name="special_condition_input[]" id="special_condition_input[]" class="form-control s special_condition_input[]">
|
||||
</div>`;
|
||||
console.log($(this));
|
||||
|
||||
@ -102,7 +102,7 @@
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Total Sum Insured</label>
|
||||
<label for="totalSumInsured">Total Sum Assured</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" style="width: 100% !important;" class="form-control" name="totalSumInsured" id="totalSumInsured" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)">
|
||||
@ -132,13 +132,13 @@
|
||||
<td style="width: 20%;">
|
||||
<div class="self-age">
|
||||
<span style="margin-right: 20px;">Min Age:</span>
|
||||
<input class="underline-input min_age" value="<?php echo isset($self_min_age) ? $self_min_age : '18'; ?>" style="width: 35%;" type="number" name="self_min_age" id="self_min_age_gpa">
|
||||
<input class="underline-input min_age" value="<?php echo isset($self_min_age) ? $self_min_age : '18'; ?>" style="width: 44%;" type="number" name="self_min_age" id="self_min_age_gpa" oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)">
|
||||
</div>
|
||||
</td>
|
||||
<td style="width: 20%;">
|
||||
<div class="self-age">
|
||||
<span style="margin-right: 20px;">Max Age:</span>
|
||||
<input class="underline-input max_age" value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>" style="width: 35%;" type="number" name="self_max_age" id="self_max_age_gpa">
|
||||
<input class="underline-input max_age" value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>" style="width: 44%;" type="number" name="self_max_age" id="self_max_age_gpa" oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)">
|
||||
</div>
|
||||
</td>
|
||||
<td ></td>
|
||||
@ -503,6 +503,8 @@
|
||||
|
||||
$('#gpa_client_policy_id').val(client_policy_id);
|
||||
|
||||
|
||||
|
||||
var gpa_policy_type_id = $(this).attr('id');
|
||||
// console.log('gpa_policy_type_id', gpa_policy_type_id)
|
||||
|
||||
@ -558,7 +560,12 @@
|
||||
|
||||
if (elements) {
|
||||
elements.forEach((element, index) => {
|
||||
element.value = gpaJsonObjectForSpecialCondition[key][index];
|
||||
|
||||
if(gpaJsonObjectForSpecialCondition[key][index] == undefined){
|
||||
element.value = " ";
|
||||
}else{
|
||||
element.value = gpaJsonObjectForSpecialCondition[key][index];
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -605,7 +612,12 @@
|
||||
}
|
||||
|
||||
} else {
|
||||
element.value = jsonObject[key];
|
||||
|
||||
if(jsonObject[key] == undefined){
|
||||
element.value = " ";
|
||||
}else{
|
||||
element.value = jsonObject[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -643,6 +655,7 @@
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@ -669,9 +682,14 @@
|
||||
|
||||
var index = $('.modifyclassinput').length;
|
||||
var appendElement = `<div class="form-group col-md-6 form-group-client-policy-masters removeDom">
|
||||
<label for="specialconditionlabel" class="special_condition_label[]" style="width: 450px;"><input name="gpa_special_condition_label[]" id="gpa_special_condition_label[]" style="position: relative;right: 15px;"><span class="specialConditionClose" style="color: red;margin-left: 5px;">X</span></label>
|
||||
<input type="text" name="gpa_special_condition_input[]" id="gpa_special_condition_input[]" class="form-control s special_condition_input[]">
|
||||
</div>`;
|
||||
|
||||
<label for="specialconditionlabel" class="special_condition_label[]" style="width: 450px;position: relative;bottom: 6px;">
|
||||
<input class="form-control" name="gpa_special_condition_label[]" id="gpa_special_condition_label[]" style="position: relative;right: 15px;">
|
||||
<span class="specialConditionClose" style="color: red; float: right;position: relative;bottom: 28px;left: 15px;">X</span>
|
||||
</label>
|
||||
|
||||
<input type="text" name="gpa_special_condition_input[]" id="gpa_special_condition_input[]" class="form-control s special_condition_input[]">
|
||||
</div>`;
|
||||
console.log($(this));
|
||||
$('.gpa_special_condition').each(function() {
|
||||
$(this).append(appendElement);
|
||||
|
||||
@ -501,7 +501,8 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label for="mobile">Max SI<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.max_si : ''}" type="text" class="form-control" placeholder="Enter Max SI" name="11_max_si[]" id="11_max_si" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.max_si : ''}" type="text" class="form-control" placeholder="Enter Max SI" name="11_max_si[]" id="11_max_si" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)" required>
|
||||
<div id='max_si_number_word' class="text-danger-2" ></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button style="margin-top: 44px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(0,11)">x</button>
|
||||
@ -851,6 +852,10 @@ $('body').on('click', '.btnPolicyModel', function() {
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
|
||||
$('input[name="11_max_si[]"]').each(function() {
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
|
||||
var id_for_trigger = temp_for_premiumData[0].policy_grid_id;
|
||||
$(`input[name="${id_for_trigger}_si[]"]`).each(function() {
|
||||
console.log($(this));
|
||||
@ -1282,7 +1287,8 @@ function appendGridtHtml(ui_type = false, data = false, ) {
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label for="mobile">Max SI<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.max_si : ''}" type="text" class="form-control" placeholder="Enter Max SI" name="11_max_si[]" id="11_max_si[]" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.max_si : ''}" type="text" class="form-control" placeholder="Enter Max SI" name="11_max_si[]" id="11_max_si[]" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)" required>
|
||||
<div id='max_si_number_word' class="text-danger-2" ></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button style="margin-top: 44px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
|
||||
|
||||
1
public/assets/images/image-solid.svg
Normal file
1
public/assets/images/image-solid.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" viewBox="0 0 512 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path opacity="1" fill="#1E3050" d="M0 96C0 60.7 28.7 32 64 32H448c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6h96 32H424c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"/></svg>
|
||||
|
After Width: | Height: | Size: 667 B |
5
public/logo.jpg
Normal file
5
public/logo.jpg
Normal file
@ -0,0 +1,5 @@
|
||||
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M428.357 3.03152C399.835 2.7241 385.421 4.56862 377.14 12.869C365.486 24.551 366.1 42.3814 366.713 50.0669C366.713 72.816 366.713 95.5652 366.713 118.314C366.713 157.972 366.713 197.629 366.713 237.286C366.713 237.901 366.713 243.127 366.713 243.742C366.713 244.049 366.713 244.049 366.713 244.357C366.713 244.664 366.713 244.972 366.713 244.972C366.713 245.587 367.02 245.894 367.02 246.509C368.553 252.042 371.927 256.039 374.993 258.806C412.716 294.466 442.771 321.827 459.638 337.198C465.159 342.117 473.132 348.572 479.879 346.113C487.24 343.346 489.08 331.049 489.693 327.053C489.693 270.488 489.693 213.922 489.693 157.357C489.693 118.007 489.693 83.5758 490 48.2224C490 34.6959 490 19.3248 479.573 9.48735C470.679 2.10925 456.571 3.33894 428.357 3.03152Z" fill="#E26828"/>
|
||||
<path d="M83.6435 509.968C112.165 510.276 126.579 508.431 134.86 500.438C146.514 489.064 145.9 471.848 145.287 464.163C145.287 442.028 145.287 419.894 145.287 397.76C145.287 359.332 145.287 320.597 145.287 281.862C145.287 281.247 145.287 276.329 145.287 275.406C145.287 275.099 145.287 275.099 145.287 274.791C145.287 274.484 145.287 274.177 145.287 274.177C145.287 273.869 144.98 273.254 144.98 272.947C143.447 267.721 140.073 263.724 137.007 260.958C58.1887 192.71 52.055 184.41 52.055 184.41C46.8414 179.184 38.5609 170.268 31.5072 172.42C26.2936 173.957 23.5334 180.721 22.3067 185.332C22.3067 243.435 22.3067 301.537 22.3067 359.64C22 390.074 22 424.813 22 466.007C22 479.841 22.3067 494.597 32.4273 503.513C41.0144 510.891 55.1219 509.661 83.6435 509.968Z" fill="#E26828"/>
|
||||
<path d="M274.401 203.47L100.818 14.4061C91.924 4.56862 81.19 3.64636 68.9227 3.64636C43.7746 3.95378 19.2398 -5.57626 22.3067 52.5263L24.4535 91.5687C24.7602 97.4097 27.2136 103.558 31.5072 108.169L294.642 387.922L398.301 501.668C401.675 505.972 406.582 508.431 412.102 508.431C424.983 508.739 442.157 508.431 451.664 508.431C476.813 508.124 489.693 507.509 489.693 477.997L487.24 438.339C486.933 432.498 484.48 426.35 480.186 422.046L274.401 203.47Z" fill="#00999E"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.1 KiB |
43
tests/unit/CheckDefaultAgeRatioTest.php
Normal file
43
tests/unit/CheckDefaultAgeRatioTest.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Tests;
|
||||
|
||||
use CodeIgniter\Test\CIUnitTestCase;
|
||||
use Config\App;
|
||||
use Config\Services;
|
||||
use Tests\Support\Libraries\ConfigReader;
|
||||
|
||||
// use App\Helpers\excel_util_helper;
|
||||
use Kint\Kint;
|
||||
|
||||
class CheckDefaultAgeRatioTest extends CIUnitTestCase
|
||||
{
|
||||
public function testRelationshipDefaultAgeRatio()
|
||||
{
|
||||
helper('excel_util_helper');
|
||||
|
||||
$general_relationships = [
|
||||
'self' => ['name' => 'Self', 'gender' => 'M', 'age_min' => 18, 'age_max' => null],
|
||||
'spouse' => ['name' => 'Spouse', 'gender' => 'F', 'age_min' => 18, 'age_max' => null],
|
||||
'son' => ['name' => 'Son', 'gender' => 'M', 'age_min' => null, 'age_max' => 25],
|
||||
'daughter' => ['name' => 'Daughter', 'gender' => 'F', 'age_min' => null, 'age_max' => 25],
|
||||
'father' => ['name' => 'Father', 'gender' => 'M', 'age_min' => 18, 'age_max' => null],
|
||||
'mother' => ['name' => 'Mother', 'gender' => 'F', 'age_min' => 18, 'age_max' => null],
|
||||
'father-in-law' => ['name' => 'Father in Law', 'gender' => 'M', 'age_min' => 18, 'age_max' => null],
|
||||
'mother-in-law' => ['name' => 'Mother in Law', 'gender' => 'F', 'age_min' => 18, 'age_max' => null]
|
||||
];
|
||||
|
||||
$default_age_ratio = [
|
||||
"self" => ["min" => 0, "max" => 55],
|
||||
"spouse" => ["min" => 0, "max" => 18],
|
||||
"child" => ["min" => 0, "max" => 18],
|
||||
"elders" => ["min" => 18, "max" => 53]
|
||||
];
|
||||
|
||||
$employee_data = [1, 'EMPID001','John Doe', '01-Apr-1970', 'male', 'father-in-law','current_action' => 'I'];
|
||||
$res = check_dob_diff($employee_data,$general_relationships,$default_age_ratio);
|
||||
Kint::dump($res);
|
||||
$this->assertTrue(!$res['status']);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user