MERGE_UAT_UNDEFINED_RR&CUSTOM_EXPORT&ENROLLMENT
This commit is contained in:
commit
73104d5e34
@ -14,6 +14,10 @@ $routes->get('/swagger', 'SwaggerController::index', ['filter' => 'authMVC']);
|
|||||||
$routes->get("reminder_mail", "NotificationController::reminder_mail");
|
$routes->get("reminder_mail", "NotificationController::reminder_mail");
|
||||||
$routes->get("testing", "ClientController::Testing");
|
$routes->get("testing", "ClientController::Testing");
|
||||||
$routes->get("update-policy-terms-for-corrections", "ClientController::updatePolicyTermsForCorrections");
|
$routes->get("update-policy-terms-for-corrections", "ClientController::updatePolicyTermsForCorrections");
|
||||||
|
$routes->get("update_rack_rate_json", "ClientController::updateRackRateJson");
|
||||||
|
$routes->get("updatajson", "EmpDataServiceController::updatajson");
|
||||||
|
$routes->get("view", "EmployeeController::viewECard/$1");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$routes->post("add_advertise_image", "AppContentManagementController::add_advertise_image");
|
$routes->post("add_advertise_image", "AppContentManagementController::add_advertise_image");
|
||||||
@ -107,6 +111,7 @@ $routes->group("/client", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->get("list/(:any)", "ClientController::getClientPolicyById/$1");
|
$routes->get("list/(:any)", "ClientController::getClientPolicyById/$1");
|
||||||
$routes->post("policyGMCTerms", "ClientController::policyGMCTerms");
|
$routes->post("policyGMCTerms", "ClientController::policyGMCTerms");
|
||||||
$routes->get("getterms", "ClientController::getterms");
|
$routes->get("getterms", "ClientController::getterms");
|
||||||
|
$routes->get("remove/(:any)", "ClientController::removePolicy/$1");
|
||||||
});
|
});
|
||||||
|
|
||||||
$routes->group("kyc", ["filter" => "authMVC"], function ($routes) {
|
$routes->group("kyc", ["filter" => "authMVC"], function ($routes) {
|
||||||
@ -136,7 +141,11 @@ $routes->group("/employee", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->post("upload", "EmployeeController::employeesUplodWithEvents");
|
$routes->post("upload", "EmployeeController::employeesUplodWithEvents");
|
||||||
$routes->get("excel_error/(:any)", "EmployeeController::getExcelFileErrors/$1");
|
$routes->get("excel_error/(:any)", "EmployeeController::getExcelFileErrors/$1");
|
||||||
$routes->get("endorsement-list", "EmployeeController::endorsementList");
|
$routes->get("endorsement-list", "EmployeeController::endorsementList");
|
||||||
|
$routes->match(['get','post'],'enrollment-list','EmployeeController::enrollmentClientList');
|
||||||
|
$routes->get("empby_client_clientbranch/(:any)/(:any)", "EmployeeController::empby_client_clientbranch/$1/$2");
|
||||||
$routes->get("truncate/(:any)", "EmployeeController::truncateFileData/$1");
|
$routes->get("truncate/(:any)", "EmployeeController::truncateFileData/$1");
|
||||||
|
$routes->get("test-rack-rate", "EmployeeController::testRackRate");
|
||||||
|
$routes->post("test-rack-rate", "EmployeeController::testRackRate");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -246,7 +255,6 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->get("fetch-emp-count/(:any)", "EmployeeController::getEmpCount/$1");
|
$routes->get("fetch-emp-count/(:any)", "EmployeeController::getEmpCount/$1");
|
||||||
$routes->get("init-Emp-onboard/(:any)", "EmployeeController::initiateManualEmployeesOnboardProcess/$1");
|
$routes->get("init-Emp-onboard/(:any)", "EmployeeController::initiateManualEmployeesOnboardProcess/$1");
|
||||||
$routes->get("full-excel-error-file/(:any)", "EmployeeController::downloadFullExcelErrorFile/$1");
|
$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("preview-card/(:any)", "EmployeeController::previewTemplate/$1");
|
||||||
$routes->get("export-import-error-list/(:any)", "EmployeeController::errorListExportImport/$1");
|
$routes->get("export-import-error-list/(:any)", "EmployeeController::errorListExportImport/$1");
|
||||||
$routes->get("has_policy_config_completed/(:any)", "EmployeeController::hasPolicyConfigCompleted/$1");
|
$routes->get("has_policy_config_completed/(:any)", "EmployeeController::hasPolicyConfigCompleted/$1");
|
||||||
@ -260,10 +268,14 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->get("getPolicyTermsFormJson/(:any)", "ClientController::getPolicyTermsFormJson/$1");
|
$routes->get("getPolicyTermsFormJson/(:any)", "ClientController::getPolicyTermsFormJson/$1");
|
||||||
$routes->get("checkHRNumber/(:any)", "ClientController::checkHRNumber/$1");
|
$routes->get("checkHRNumber/(:any)", "ClientController::checkHRNumber/$1");
|
||||||
$routes->get("check_addition_premium_JSON/(:any)", "ClientController::checkAdditionPremiumJSON/$1");
|
$routes->get("check_addition_premium_JSON/(:any)", "ClientController::checkAdditionPremiumJSON/$1");
|
||||||
|
$routes->get("get_policy_type_for_base_policy/(:any)", "ClientController::getPolicyTypeForBasePolicy/$1");
|
||||||
|
$routes->get("get_client_details/(:any)", "ClientController::getClientDetails/$1");
|
||||||
|
$routes->get("featch_dashboard_data/(:any)", "DashboardController::featch_dashboard_data/$1");
|
||||||
});
|
});
|
||||||
|
|
||||||
$routes->cli('cli/processjob', 'JobWorker::processJob');
|
$routes->cli('cli/processjob', 'JobWorker::processJob');
|
||||||
$routes->cli('cli/processjobs', 'JobWorker::processJobs');
|
$routes->cli('cli/processjobs', 'JobWorker::processJobs');
|
||||||
|
$routes->cli('cli/enrollment_status', 'JobWorker::enrollment_status');
|
||||||
$routes->get("processjob", "JobWorker::processJob");
|
$routes->get("processjob", "JobWorker::processJob");
|
||||||
|
|
||||||
|
|
||||||
@ -285,8 +297,10 @@ $routes->group("/api", ["filter" => "authJWT"], function ($routes) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
$routes->get("getChatResponse", "ChatBotController::getChatResponse");
|
|
||||||
|
|
||||||
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
||||||
|
$routes->post("storeFireBase", "EmployeeRestController::storeFireBase");
|
||||||
$routes->post("saveMpin", "RestAuthenticationController::saveMpin");
|
$routes->post("saveMpin", "RestAuthenticationController::saveMpin");
|
||||||
$routes->post("updateMpin", "RestAuthenticationController::updateMpin");
|
$routes->post("updateMpin", "RestAuthenticationController::updateMpin");
|
||||||
$routes->get("getChatResponse", "ChatBotController::getChatResponse");
|
$routes->get("getChatResponse", "ChatBotController::getChatResponse");
|
||||||
@ -320,6 +334,8 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
|||||||
$routes->get("getAdvertisementImage", "EmployeeRestController::getAdvertisementImage");
|
$routes->get("getAdvertisementImage", "EmployeeRestController::getAdvertisementImage");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$routes->get("sendPushNotification", "EmployeeRestController::sendPushNotification");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
13
app/Config/google-services.json
Normal file
13
app/Config/google-services.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"type": "service_account",
|
||||||
|
"project_id": "push-notification-enrollment",
|
||||||
|
"private_key_id": "979d0fcd0ce95d31367f3150d34ee0044ca51b0d",
|
||||||
|
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC4Xsan6ESIzM12\nG15gRU361Yy6PVmoMzTToWtZHPEcDRd9weFNlCXjmX+WAqdgD/hQ42GcZQVCndse\nEQGJHbRu/ifMKGo53zxOpshNZnCSxojAGWIGrIHFE5kFumiKz9drW9vPWsFLtgx0\nEAW0T7su1MejjH33GftHG8k/q3uyWoU0+OFRD6emhYkFdVsucwR27hE7GsFwE+CF\nnRdSWQ5mu2e8J7q9Qbpgot5d7uk7iJgpiyNdChPvqUZ7XeknVrw1F4REZlbAkVjb\nFuwKg5qtG97LZ1NkyYqFmssA1rNkqSi4+T+2/ERegdwyA6W4/HLT9fPbSl4v1MvB\ntJlGYkMpAgMBAAECggEABhspdCUmo+s4gMleQkz5TK3m58IhZocvoDSv4/cn6xhp\n50HVDucxrAyI47R5y54ryK4HLRFRb8ffmmrQxLRFpgln0wShpAIHMsmmR531a38E\nx2vvya3L7HV+M2jdjn9csJMNwBvO3A2O8wcW0UZ0uhPU+s8r2tOy9UNv0lqBEcKM\nUxCtk7UxcLEM3btDP5I4oEHVo2f5jzPeb99KHbYQV/vc0BtA1wtuYTzGT2EhBpTG\nN1rbQhlj6iJ6vMwHETWrctNMohCQNQEv/QIC/NWYPNRqmtrJfNe29XGWN9IIhv0e\n/ZmhdzoO+uhJW4VaWpI93nB5ZAa6LHqJSg+OyrPoawKBgQDd45Aiq7d+4Z+kDZYu\n72bgW5CGhyck2hrqHpBdHA960AYIftw/wHgI9xb9Z8hi+Lh+W18xDywOLoaz7TJV\nElj2Gh3oj2ZLzDpeyqV9UOgz11dbm6yYUK8jl7zyajBt7RhGcdj+4x+YjUTT6O61\nuxm2ZbKsb/0er/W6DlKDVvpWSwKBgQDUtqowATEaGTrd+eutanRwtv+rdptVcadj\nD4H3XdY4PAsVSp1mT9knGgh7c5elI0lBH/VD/IbM5uPXOc7judnIK4RgKScrJT2P\nekyEJnXyFAZGS3WTFG7fzeXn/cNNx5MCZE2Yay7LqqON8Kg08IvvesiTushrDlMJ\nX8cunSyz2wKBgDIOwZigxq/QNNSs4AHMrpfU8GD5IqKUtde1d3oZ94AMaCAIhqW3\nRR04qS4X+MQjOnP/JxWJR7YXVvpGe8FndzxmHfM2Tqyw8UYrT3RbCVeQsDuRfjmK\nkkhkVhMWU8Co6X4S9xJhqOIglLN97ESBZkaY4Ns4FJGUvsnvqzvIJofLAoGBAKJO\ny2eb0TK/46ozJEELxNOo30efVgGJmpa844e0A1yffDl/2MCT1ve+JpDEcAbi+OeH\nkieRTe6Vk27LvnEHhAT4J6cUX73NSb7sK+x+SGsyGmOS+qEC62M8gdxWRqtXyHX/\nwTG3P1rK1sfcxQy4K57NSrVmxbzijjvN6HdKGS0XAoGATtsid5pypcZ0BsYUp/27\neS6z++ewo7QCVCBPa4Ag4nX56/0kdrECvy/ISMDjggNv+mR8hpyCjfm9ztJ88njB\nUBu1jzLBZ+u5gEjmtu43qvuDJNobyb+evDSReEJmify943vFZqnkIhFlwg1PcS6S\nCd+pr559KWURPIgfxb7S/JU=\n-----END PRIVATE KEY-----\n",
|
||||||
|
"client_email": "firebase-adminsdk-gzzkw@push-notification-enrollment.iam.gserviceaccount.com",
|
||||||
|
"client_id": "109128197176743587316",
|
||||||
|
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
||||||
|
"token_uri": "https://oauth2.googleapis.com/token",
|
||||||
|
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
||||||
|
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-gzzkw%40push-notification-enrollment.iam.gserviceaccount.com",
|
||||||
|
"universe_domain": "googleapis.com"
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@ -11,12 +11,16 @@ use CodeIgniter\API\ResponseTrait;
|
|||||||
|
|
||||||
use App\Models\MessageModel;
|
use App\Models\MessageModel;
|
||||||
use App\Models\UserMessageModel;
|
use App\Models\UserMessageModel;
|
||||||
|
use App\Models\ClientModel;
|
||||||
|
|
||||||
|
use App\Controllers\PendingActionsContrller;
|
||||||
|
|
||||||
class DashboardController extends AdminController
|
class DashboardController extends AdminController
|
||||||
{
|
{
|
||||||
|
|
||||||
use ResponseTrait;
|
use ResponseTrait;
|
||||||
protected $messageModel;
|
protected $messageModel;
|
||||||
|
protected $clientModel;
|
||||||
protected $userMessageModel;
|
protected $userMessageModel;
|
||||||
protected $myLogger;
|
protected $myLogger;
|
||||||
|
|
||||||
@ -26,12 +30,100 @@ class DashboardController extends AdminController
|
|||||||
$this->messageModel = new MessageModel();
|
$this->messageModel = new MessageModel();
|
||||||
$this->userMessageModel = new UserMessageModel();
|
$this->userMessageModel = new UserMessageModel();
|
||||||
$this->myLogger = \Config\Services::mylogger();
|
$this->myLogger = \Config\Services::mylogger();
|
||||||
|
$this->clientModel = new ClientModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dashboard()
|
public function dashboard()
|
||||||
{
|
{
|
||||||
|
$data = [];
|
||||||
|
|
||||||
|
$pendingActionsController = new PendingActionsController;
|
||||||
|
$pendingActionsData = $pendingActionsController->getPendingActionsForDashBoard();
|
||||||
|
|
||||||
|
$results = $this->clientModel->select('clients.id as client_id, clients.client_name, clients.short_name,
|
||||||
|
client_branch.id as client_branch_id, client_branch.branch_name,
|
||||||
|
client_branch.branch_code, employees.id as employee_id,
|
||||||
|
employees.name as employee_name, employees.relationship,
|
||||||
|
employees.emp_code, employees.emp_status, auth_history.user_type')
|
||||||
|
->join('client_branch', 'clients.id = client_branch.client_id', 'left')
|
||||||
|
->join('employees', 'client_branch.id = employees.client_branch_id', 'left')
|
||||||
|
->join('auth_history', 'employees.id = auth_history.user_id AND "employee" = auth_history.user_type', 'left')
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
$groupedData = [];
|
||||||
|
$employeeId = '';
|
||||||
|
foreach ($results as $row) {
|
||||||
|
$clientId = $row['client_id'];
|
||||||
|
$clientName = $row['client_name'];
|
||||||
|
$shortName = $row['short_name'];
|
||||||
|
$branchId = $row['client_branch_id'];
|
||||||
|
$branchName = $row['branch_name'];
|
||||||
|
$branchCode = $row['branch_code'];
|
||||||
|
if ($employeeId != $row['employee_id']) {
|
||||||
|
$employeeId = $row['employee_id'];
|
||||||
|
} else {
|
||||||
|
$employeeId = null;
|
||||||
|
}
|
||||||
|
$employeeName = $row['employee_name'];
|
||||||
|
$employeeRelationship = $row['relationship'];
|
||||||
|
$employeeEmpCode = $row['emp_code'];
|
||||||
|
$employeeEmpStatus = $row['emp_status'];
|
||||||
|
$employeeUserType = $row['user_type'];
|
||||||
|
|
||||||
|
// Initialize the client entry if it doesn't exist
|
||||||
|
if (!isset($groupedData[$clientId])) {
|
||||||
|
$groupedData[$clientId] = [
|
||||||
|
'client_id' => $clientId,
|
||||||
|
'client_name' => $clientName,
|
||||||
|
'short_name' => $shortName,
|
||||||
|
'branches' => []
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize the branch entry if it doesn't exist
|
||||||
|
if (!isset($groupedData[$clientId]['branches'][$branchId])) {
|
||||||
|
$groupedData[$clientId]['branches'][$branchId] = [
|
||||||
|
'client_branch_id' => $branchId,
|
||||||
|
'branch_name' => $branchName,
|
||||||
|
'branch_code' => $branchCode,
|
||||||
|
'emp_login' => 0,
|
||||||
|
'emp_enroll' => 0,
|
||||||
|
'employees' => []
|
||||||
|
];
|
||||||
|
}
|
||||||
|
if ($employeeId !== null && $employeeRelationship == 'Self') {
|
||||||
|
// Append employee info to the branch's employees list
|
||||||
|
$groupedData[$clientId]['branches'][$branchId]['employees'][] = [
|
||||||
|
'employee_id' => $employeeId,
|
||||||
|
'employee_name' => $employeeName,
|
||||||
|
'relationship' => $employeeRelationship,
|
||||||
|
'emp_code' => $employeeEmpCode,
|
||||||
|
'emp_status' => $employeeEmpStatus,
|
||||||
|
'user_type' => $employeeUserType
|
||||||
|
];
|
||||||
|
if (!empty($employeeUserType)) {
|
||||||
|
$groupedData[$clientId]['branches'][$branchId]['emp_login']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Increment emp_enroll if emp_status is not 'draft'
|
||||||
|
if ($employeeEmpStatus !== 'draft') {
|
||||||
|
$groupedData[$clientId]['branches'][$branchId]['emp_enroll']++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$employeeId = $row['employee_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-index the arrays to match the expected structure
|
||||||
|
foreach ($groupedData as &$client) {
|
||||||
|
$client['branches'] = array_values($client['branches']);
|
||||||
|
}
|
||||||
|
// echo "<pre>";
|
||||||
|
$data['client_branch_emp_list'] = $groupedData;
|
||||||
|
$data['pendingActionsData'] = $pendingActionsData;
|
||||||
|
// print_r($data);die;
|
||||||
|
|
||||||
echo view('layout/header');
|
echo view('layout/header');
|
||||||
echo view('DashBoard');
|
echo view('DashBoard', $data);
|
||||||
echo view('layout/footer');
|
echo view('layout/footer');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,4 +154,41 @@ class DashboardController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function featch_dashboard_data($type)
|
||||||
|
{
|
||||||
|
$pendingActionsController = new PendingActionsController;
|
||||||
|
$pendingActionsData = $pendingActionsController->getPendingActionsForClientData();
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
|
||||||
|
if($type == 'insurer'){
|
||||||
|
|
||||||
|
$data = $pendingActionsData['uhid'];
|
||||||
|
|
||||||
|
}else if($type == 'TPA'){
|
||||||
|
$data = $pendingActionsData['tpa'];
|
||||||
|
|
||||||
|
}else if($type == 'I'){
|
||||||
|
$data = $pendingActionsData['inception'];
|
||||||
|
|
||||||
|
}else if($type == 'D'){
|
||||||
|
$data = $pendingActionsData['deletion'];
|
||||||
|
|
||||||
|
}else if($type == 'C'){
|
||||||
|
$data = $pendingActionsData['correction'];
|
||||||
|
|
||||||
|
}else if($type == 'SI'){
|
||||||
|
$data = $pendingActionsData['si_enhancement'];
|
||||||
|
|
||||||
|
}else if($type == 'policy'){
|
||||||
|
$data = $pendingActionsData['policy'];
|
||||||
|
|
||||||
|
}else if($type == 'ticket'){
|
||||||
|
$data = $pendingActionsData['uhid'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->respond(['status' => true, 'data' => $data], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -7,10 +7,13 @@ use CodeIgniter\HTTP\RequestInterface;
|
|||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
|
use App\Helpers\DepositHelper;
|
||||||
|
|
||||||
|
|
||||||
use App\Models\EmployeeModel;
|
use App\Models\EmployeeModel;
|
||||||
use App\Models\EmployeePolicyModel;
|
use App\Models\EmployeePolicyModel;
|
||||||
use App\Models\ClientModel;
|
use App\Models\ClientModel;
|
||||||
|
use App\Models\ClientBranchModel;
|
||||||
use App\Models\PolicesModel;
|
use App\Models\PolicesModel;
|
||||||
use App\Models\FileModel;
|
use App\Models\FileModel;
|
||||||
use App\Models\BatchListModel;
|
use App\Models\BatchListModel;
|
||||||
@ -18,6 +21,10 @@ use App\Models\BatchFileModel;
|
|||||||
use App\Models\EmpEndorsementModel;
|
use App\Models\EmpEndorsementModel;
|
||||||
use App\Models\ClientPolicyModel;
|
use App\Models\ClientPolicyModel;
|
||||||
use App\Models\TPAModel;
|
use App\Models\TPAModel;
|
||||||
|
use App\Models\InsurerExcelExportTemplateModel;
|
||||||
|
use App\Models\InsurerModel;
|
||||||
|
use App\Models\ClientDepositModel;
|
||||||
|
|
||||||
|
|
||||||
use App\Controllers\Jobs;
|
use App\Controllers\Jobs;
|
||||||
use App\Controllers\JobWorker;
|
use App\Controllers\JobWorker;
|
||||||
@ -44,6 +51,7 @@ class EmployeeController extends AdminController
|
|||||||
protected $employeeModel;
|
protected $employeeModel;
|
||||||
protected $employeePolicyModel;
|
protected $employeePolicyModel;
|
||||||
protected $clientModel;
|
protected $clientModel;
|
||||||
|
protected $clientBranchModel;
|
||||||
protected $fileModel;
|
protected $fileModel;
|
||||||
protected $batchListModel;
|
protected $batchListModel;
|
||||||
protected $batchFileModel;
|
protected $batchFileModel;
|
||||||
@ -51,6 +59,9 @@ class EmployeeController extends AdminController
|
|||||||
protected $clientPolicyModel;
|
protected $clientPolicyModel;
|
||||||
protected $TPAModel;
|
protected $TPAModel;
|
||||||
protected $policiesModel;
|
protected $policiesModel;
|
||||||
|
protected $excelExportTemplateModel;
|
||||||
|
protected $insurerModel;
|
||||||
|
protected $cashDepositModel;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -60,6 +71,7 @@ class EmployeeController extends AdminController
|
|||||||
$this->employeeModel = new EmployeeModel();
|
$this->employeeModel = new EmployeeModel();
|
||||||
$this->employeePolicyModel = new EmployeePolicyModel();
|
$this->employeePolicyModel = new EmployeePolicyModel();
|
||||||
$this->clientModel = new ClientModel();
|
$this->clientModel = new ClientModel();
|
||||||
|
$this->clientBranchModel = new ClientBranchModel();
|
||||||
$this->fileModel = new FileModel();
|
$this->fileModel = new FileModel();
|
||||||
$this->batchListModel = new BatchListModel();
|
$this->batchListModel = new BatchListModel();
|
||||||
$this->batchFileModel = new BatchFileModel();
|
$this->batchFileModel = new BatchFileModel();
|
||||||
@ -67,13 +79,15 @@ class EmployeeController extends AdminController
|
|||||||
$this->clientPolicyModel = new ClientPolicyModel();
|
$this->clientPolicyModel = new ClientPolicyModel();
|
||||||
$this->TPAModel = new TPAModel();
|
$this->TPAModel = new TPAModel();
|
||||||
$this->policiesModel = new PolicesModel();
|
$this->policiesModel = new PolicesModel();
|
||||||
|
$this->insurerModel = new InsurerModel();
|
||||||
|
$this->cashDepositModel = new ClientDepositModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function list()
|
public function list()
|
||||||
{
|
{
|
||||||
// $model = new UserModel();
|
// $model = new UserModel();
|
||||||
$data = [];
|
$data = [];
|
||||||
$data['status'] = ['draft' => 'Draft', 'active' => 'Active', 'inactive' => 'In-Active', 'expired' => 'Expired'];
|
$data['status'] = ['draft' => 'Draft', 'active' => 'Active', 'inactive' => 'In-Active', 'pending' => 'Pending'];
|
||||||
if (count($this->request->getGet())) {
|
if (count($this->request->getGet())) {
|
||||||
$filterData = $this->request->getGet();
|
$filterData = $this->request->getGet();
|
||||||
$data['employees'] = $this->employeePolicyModel->getEmployeePolicy(
|
$data['employees'] = $this->employeePolicyModel->getEmployeePolicy(
|
||||||
@ -212,6 +226,7 @@ class EmployeeController extends AdminController
|
|||||||
|
|
||||||
//process post variable entry in file table
|
//process post variable entry in file table
|
||||||
$loggedInUserID = get_session_userid();
|
$loggedInUserID = get_session_userid();
|
||||||
|
// dd($loggedInUserID);
|
||||||
// $loggedInUserID = 8;
|
// $loggedInUserID = 8;
|
||||||
|
|
||||||
$client_id = $this->request->getPost('client_id');
|
$client_id = $this->request->getPost('client_id');
|
||||||
@ -220,7 +235,7 @@ class EmployeeController extends AdminController
|
|||||||
$action = $this->request->getPost('upload-action-type');
|
$action = $this->request->getPost('upload-action-type');
|
||||||
$status = 'inprogress';
|
$status = 'inprogress';
|
||||||
|
|
||||||
$file_id = $this->fileModel->insert(['file_name' => $filename, 'client_id' => $client_id, 'policy_id' => $policy_id, 'created_by' => $loggedInUserID, 'status' => $status, 'action' => $action, 'client_branch_id' => $branch_id]); //here field policy_id have client_policy_id and not policy id from policy master
|
$file_id = $this->fileModel->insert(['file_name' => $filename, 'client_id' => $client_id, 'policy_id' => $policy_id, 'created_by' => $loggedInUserID, 'status' => $status, 'action' => $action, 'client_branch_id' => $branch_id,'uploaded_by' => 1]); //here field policy_id have client_policy_id and not policy id from policy master
|
||||||
$this->myLogger->logme("error", '{file_id} uploaded success', ['file_id' => $file_id]);
|
$this->myLogger->logme("error", '{file_id} uploaded success', ['file_id' => $file_id]);
|
||||||
|
|
||||||
//start validation process
|
//start validation process
|
||||||
@ -236,9 +251,10 @@ class EmployeeController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//for TPA/insurer upload
|
||||||
$data['events'] = ['inception' => 'Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement'];
|
$data['events'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement'];
|
||||||
$data['actions'] = ['inception' => 'Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addtion' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement'];
|
//for inception upload
|
||||||
|
$data['actions'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addtion' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement','enrollment' => 'Enrollment'];
|
||||||
|
|
||||||
$data['import_or_export'] = ['import' => 'Import', 'export' => 'Export'];
|
$data['import_or_export'] = ['import' => 'Import', 'export' => 'Export'];
|
||||||
$data['insurer_or_tpa'] = ['insurer' => 'Insurer', 'tpa' => 'TPA'];
|
$data['insurer_or_tpa'] = ['insurer' => 'Insurer', 'tpa' => 'TPA'];
|
||||||
@ -257,7 +273,6 @@ class EmployeeController extends AdminController
|
|||||||
'files.*',
|
'files.*',
|
||||||
'up.emp_code',
|
'up.emp_code',
|
||||||
'up.first_name',
|
'up.first_name',
|
||||||
'pm.name as policy_name',
|
|
||||||
'c.short_name',
|
'c.short_name',
|
||||||
'cb.branch_name',
|
'cb.branch_name',
|
||||||
'cp.id as client_policy_id',
|
'cp.id as client_policy_id',
|
||||||
@ -275,8 +290,7 @@ class EmployeeController extends AdminController
|
|||||||
->join('user_profiles up', 'files.created_by = up.id')
|
->join('user_profiles up', 'files.created_by = up.id')
|
||||||
->join('client_policy cp', 'files.policy_id = cp.id', 'left')
|
->join('client_policy cp', 'files.policy_id = cp.id', 'left')
|
||||||
->join('client_branch cb', 'files.client_branch_id = cb.id', 'left')
|
->join('client_branch cb', 'files.client_branch_id = cb.id', 'left')
|
||||||
->join('policies pm', 'cp.policy_id = pm.id', 'left')
|
->join('policy_type', 'policy_type.id = cp.policy_type_id')
|
||||||
->join('policy_type', 'policy_type.id = pm.policy_type_id')
|
|
||||||
->join('clients c', 'files.client_id = c.id and files.client_id = cp.client_id', 'left')
|
->join('clients c', 'files.client_id = c.id and files.client_id = cp.client_id', 'left')
|
||||||
->where('files.created_by', get_session_userid())
|
->where('files.created_by', get_session_userid())
|
||||||
->orderBy('files.created_at', 'desc')
|
->orderBy('files.created_at', 'desc')
|
||||||
@ -285,7 +299,6 @@ class EmployeeController extends AdminController
|
|||||||
|
|
||||||
$data['batch_list'] = $this->batchFileModel->select(
|
$data['batch_list'] = $this->batchFileModel->select(
|
||||||
'batch_files.*,
|
'batch_files.*,
|
||||||
policies.name as policy_name,
|
|
||||||
clients.short_name as client_short_name,
|
clients.short_name as client_short_name,
|
||||||
client_branch.branch_name,
|
client_branch.branch_name,
|
||||||
client_policy.policy_no,
|
client_policy.policy_no,
|
||||||
@ -293,8 +306,7 @@ class EmployeeController extends AdminController
|
|||||||
')
|
')
|
||||||
->join('client_policy', 'client_policy.id = batch_files.client_policy_id')
|
->join('client_policy', 'client_policy.id = batch_files.client_policy_id')
|
||||||
->join('client_branch', 'client_branch.id = batch_files.client_branch_id')
|
->join('client_branch', 'client_branch.id = batch_files.client_branch_id')
|
||||||
->join('policies', 'policies.id = client_policy.policy_id')
|
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
||||||
->join('policy_type', 'policy_type.id = policies.policy_type_id')
|
|
||||||
->join('clients', 'clients.id = client_policy.client_id')
|
->join('clients', 'clients.id = client_policy.client_id')
|
||||||
->orderBy('batch_files.id', 'desc')
|
->orderBy('batch_files.id', 'desc')
|
||||||
->findAll();
|
->findAll();
|
||||||
@ -357,6 +369,10 @@ class EmployeeController extends AdminController
|
|||||||
$filePath = ROOTPATH . 'public/sample_excel/sample_addition.xls';
|
$filePath = ROOTPATH . 'public/sample_excel/sample_addition.xls';
|
||||||
} else if ($actionType == 'deletion') {
|
} else if ($actionType == 'deletion') {
|
||||||
$filePath = ROOTPATH . 'public/sample_excel/sample_deletion.xls';
|
$filePath = ROOTPATH . 'public/sample_excel/sample_deletion.xls';
|
||||||
|
} else if ($actionType == 'enrollment') {
|
||||||
|
$filePath = ROOTPATH . 'public/sample_excel/enrollment.xls';
|
||||||
|
}else if ($actionType == 'missed_inception') {
|
||||||
|
$filePath = ROOTPATH . 'public/sample_excel/sample_inception.xls';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the file exists
|
// Check if the file exists
|
||||||
@ -387,6 +403,15 @@ class EmployeeController extends AdminController
|
|||||||
public function importExport()
|
public function importExport()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$array = $this->request->getPost('event_type');
|
||||||
|
|
||||||
|
if (is_array($array)) {
|
||||||
|
$event_type = 'MultipleEvents';
|
||||||
|
} else {
|
||||||
|
$event_type = $this->request->getPost('event_type');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->myLogger->logme('error', 'Import Export -- Function called');
|
$this->myLogger->logme('error', 'Import Export -- Function called');
|
||||||
$empDataServiceController = new EmpDataServiceController();
|
$empDataServiceController = new EmpDataServiceController();
|
||||||
|
|
||||||
@ -394,16 +419,12 @@ class EmployeeController extends AdminController
|
|||||||
$client_policy_id = $this->request->getPost('client_policy_id');
|
$client_policy_id = $this->request->getPost('client_policy_id');
|
||||||
$client_branch_id = $this->request->getPost('client_branch_id');
|
$client_branch_id = $this->request->getPost('client_branch_id');
|
||||||
$insurer_or_tpa = $this->request->getPost('insurer_or_tpa');
|
$insurer_or_tpa = $this->request->getPost('insurer_or_tpa');
|
||||||
$event_type = $this->request->getPost('event_type');
|
|
||||||
$actions = $this->request->getPost('action_type');
|
$actions = $this->request->getPost('action_type');
|
||||||
|
|
||||||
$client_data = $this->clientModel->where('id', $client_id)->first();
|
$client_data = $this->clientPolicyModel->getCliendDataForExcelFileName($client_policy_id);
|
||||||
$policy_name_and_branch_name = $this->clientPolicyModel->select('policies.name, client_branch.branch_code')
|
$file_name = generate_filename($client_data['short_name'], $event_type, $actions, $insurer_or_tpa, $client_data['policy_type'], $client_data['branch_code']);
|
||||||
->join('client_branch', 'client_branch.id = client_policy.client_branch_id')
|
|
||||||
->join('policies', 'policies.id = client_policy.policy_id')
|
// dd($client_data, $file_name);
|
||||||
->where('client_policy.id', $client_policy_id)
|
|
||||||
->first();
|
|
||||||
$file_name = generate_filename($client_data['short_name'], $event_type, $actions, $insurer_or_tpa, $policy_name_and_branch_name['name'], $policy_name_and_branch_name['branch_code']);
|
|
||||||
|
|
||||||
$batch_data = [
|
$batch_data = [
|
||||||
'client_id' => $client_id,
|
'client_id' => $client_id,
|
||||||
@ -415,10 +436,9 @@ class EmployeeController extends AdminController
|
|||||||
'file_name' => $file_name,
|
'file_name' => $file_name,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
if ($actions == 'export') {
|
if ($actions == 'export') {
|
||||||
|
|
||||||
if ($event_type == 'inception' || $event_type == 'addition' || $event_type == 'dependent_addition') {
|
if ($event_type == 'inception' || $event_type == 'addition' || $event_type == 'dependent_addition' || $event_type == 'missed_inception') {
|
||||||
|
|
||||||
$return = $empDataServiceController->generateExcelForAdditionandInception($batch_data);
|
$return = $empDataServiceController->generateExcelForAdditionandInception($batch_data);
|
||||||
|
|
||||||
@ -432,6 +452,11 @@ class EmployeeController extends AdminController
|
|||||||
session()->setFlashdata('error', "The policy does not have a CD account number.");
|
session()->setFlashdata('error', "The policy does not have a CD account number.");
|
||||||
return redirect()->to(base_url('employee/upload'));
|
return redirect()->to(base_url('employee/upload'));
|
||||||
}
|
}
|
||||||
|
else if($return === 6){
|
||||||
|
|
||||||
|
session()->setFlashdata('error', "The Insurer does not have an Excel export template format.");
|
||||||
|
return redirect()->to(base_url('employee/upload'));
|
||||||
|
}
|
||||||
|
|
||||||
if (!$return) {
|
if (!$return) {
|
||||||
|
|
||||||
@ -448,6 +473,12 @@ class EmployeeController extends AdminController
|
|||||||
} else if ($event_type == 'correction') {
|
} else if ($event_type == 'correction') {
|
||||||
|
|
||||||
$return = $empDataServiceController->generateExcelForCorrection($batch_data);
|
$return = $empDataServiceController->generateExcelForCorrection($batch_data);
|
||||||
|
|
||||||
|
if($return === 6){
|
||||||
|
session()->setFlashdata('error', "The Insurer does not have an Excel export template format.");
|
||||||
|
return redirect()->to(base_url('employee/upload'));
|
||||||
|
}
|
||||||
|
|
||||||
if (!$return) {
|
if (!$return) {
|
||||||
session()->setFlashdata('error', 'No data found about this action');
|
session()->setFlashdata('error', 'No data found about this action');
|
||||||
return redirect()->to(base_url('employee/upload'));
|
return redirect()->to(base_url('employee/upload'));
|
||||||
@ -466,6 +497,10 @@ class EmployeeController extends AdminController
|
|||||||
|
|
||||||
session()->setFlashdata('error', "The policy does not have a CD account number.");
|
session()->setFlashdata('error', "The policy does not have a CD account number.");
|
||||||
return redirect()->to(base_url('employee/upload'));
|
return redirect()->to(base_url('employee/upload'));
|
||||||
|
}else if($return === 6){
|
||||||
|
|
||||||
|
session()->setFlashdata('error', "The Insurer does not have an Excel export template format.");
|
||||||
|
return redirect()->to(base_url('employee/upload'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$return) {
|
if (!$return) {
|
||||||
@ -477,12 +512,38 @@ class EmployeeController extends AdminController
|
|||||||
} else if ($event_type == 'deletion') {
|
} else if ($event_type == 'deletion') {
|
||||||
|
|
||||||
$return = $empDataServiceController->generateExcelForDeletion($batch_data);
|
$return = $empDataServiceController->generateExcelForDeletion($batch_data);
|
||||||
|
|
||||||
|
if($return === 6){
|
||||||
|
|
||||||
|
session()->setFlashdata('error', "The Insurer does not have an Excel export template format.");
|
||||||
|
return redirect()->to(base_url('employee/upload'));
|
||||||
|
}
|
||||||
|
|
||||||
if (!$return) {
|
if (!$return) {
|
||||||
session()->setFlashdata('error', 'No data found about this action');
|
session()->setFlashdata('error', 'No data found about this action');
|
||||||
return redirect()->to(base_url('employee/upload'));
|
return redirect()->to(base_url('employee/upload'));
|
||||||
} else {
|
} else {
|
||||||
$this->myLogger->logme('error', 'Successfully exported Excel file in Deletion.');
|
$this->myLogger->logme('error', 'Successfully exported Excel file in Deletion.');
|
||||||
}
|
}
|
||||||
|
} else if($event_type == 'MultipleEvents'){
|
||||||
|
|
||||||
|
$batch_data['event_type'] = $array;
|
||||||
|
$return = $empDataServiceController->generateExcelForAllEventType($batch_data);
|
||||||
|
|
||||||
|
|
||||||
|
if($return === 6){
|
||||||
|
|
||||||
|
session()->setFlashdata('error', "The Insurer does not have an Excel export template format.");
|
||||||
|
return redirect()->to(base_url('employee/upload'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$return) {
|
||||||
|
session()->setFlashdata('error', 'No data found about this action');
|
||||||
|
return redirect()->to(base_url('employee/upload'));
|
||||||
|
} else {
|
||||||
|
$this->myLogger->logme('error', 'Excel exported successfully.');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} else if ($actions == 'import') {
|
} else if ($actions == 'import') {
|
||||||
|
|
||||||
@ -499,7 +560,7 @@ class EmployeeController extends AdminController
|
|||||||
$batch_data['status'] = 'pending';
|
$batch_data['status'] = 'pending';
|
||||||
$batch_data['file_name'] = $filename;
|
$batch_data['file_name'] = $filename;
|
||||||
|
|
||||||
if ($event_type == 'inception' || $event_type == 'addition' || $event_type == 'dependent_addition') {
|
if ($event_type == 'inception' || $event_type == 'addition' || $event_type == 'dependent_addition' || $event_type == 'missed_inception') {
|
||||||
|
|
||||||
$file_id = $this->batchFileModel->insert($batch_data);
|
$file_id = $this->batchFileModel->insert($batch_data);
|
||||||
|
|
||||||
@ -610,6 +671,78 @@ class EmployeeController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Below function displays the Enrollment list page.
|
||||||
|
*
|
||||||
|
* This method retrieves filter data from the request and fetches the Enrollment list
|
||||||
|
* based on the provided filters such as client , client_branch , employee - ( Log-in-or-not , ENrolled-or-not).
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function enrollmentClientList()
|
||||||
|
{
|
||||||
|
$data = [];
|
||||||
|
$client_list = $this->clientModel->findAll();
|
||||||
|
$branch_list = $this->clientBranchModel->findAll();
|
||||||
|
$data['client_list'] = $client_list;
|
||||||
|
$data['branch_list'] = $branch_list;
|
||||||
|
|
||||||
|
// Get session data if available
|
||||||
|
$data['selected_client_id'] = session()->get('client_id');
|
||||||
|
$data['selected_branch_id'] = session()->get('branch_id');
|
||||||
|
$data['selected_type'] = session()->get('type');
|
||||||
|
|
||||||
|
$this->myLogger->logme('error', 'list called');
|
||||||
|
return $this->loadLayout('enrollment_list', $data);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function empby_client_clientbranch($client_id, $branch_id)
|
||||||
|
{
|
||||||
|
|
||||||
|
$results = $this->clientModel->select('employees.id as employee_id, employees.name as employee_name,
|
||||||
|
employees.relationship, employees.emp_code,
|
||||||
|
employees.emp_status, auth_history.user_type')
|
||||||
|
->join('employees', $client_id .'= employees.client_id AND ' . $branch_id . '= employees.client_branch_id', 'left')
|
||||||
|
->join('auth_history', 'employees.id = auth_history.user_id AND "employee" = auth_history.user_type', 'left')
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
$groupedData = [];
|
||||||
|
$employeeId = '';
|
||||||
|
foreach ($results as $row) {
|
||||||
|
if($employeeId != $row['employee_id']){
|
||||||
|
$employeeId = $row['employee_id'];
|
||||||
|
}else{
|
||||||
|
$employeeId = null;
|
||||||
|
}
|
||||||
|
$employeeName = $row['employee_name'] ;
|
||||||
|
$employeeRelationship = $row['relationship'] ;
|
||||||
|
$employeeEmpCode = $row['emp_code'] ;
|
||||||
|
$employeeEmpStatus = $row['emp_status'];
|
||||||
|
$employeeUserType = $row['user_type'];
|
||||||
|
|
||||||
|
|
||||||
|
if ($employeeId !== null && $employeeRelationship == 'Self') {
|
||||||
|
// Append employee info to the branch's employees list
|
||||||
|
$groupedData[] = [
|
||||||
|
'employee_id' => $employeeId,
|
||||||
|
'employee_name' => $employeeName,
|
||||||
|
'relationship' => $employeeRelationship,
|
||||||
|
'emp_code' => $employeeEmpCode,
|
||||||
|
'emp_status' => $employeeEmpStatus,
|
||||||
|
'user_type' => $employeeUserType
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
||||||
|
$employeeId = $row['employee_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return json_encode($groupedData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Beleo function retrieves employee endorsement (emp_endorsement table) data.
|
* Beleo function retrieves employee endorsement (emp_endorsement table) data.
|
||||||
*
|
*
|
||||||
@ -690,7 +823,6 @@ class EmployeeController extends AdminController
|
|||||||
return redirect()->to(base_url('/employee/upload'));
|
return redirect()->to(base_url('/employee/upload'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function downloadFileList($file_id = null)
|
public function downloadFileList($file_id = null)
|
||||||
{
|
{
|
||||||
// $actionType = $this->request->getGet();
|
// $actionType = $this->request->getGet();
|
||||||
@ -724,7 +856,6 @@ class EmployeeController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function featchEmpList()
|
public function featchEmpList()
|
||||||
{
|
{
|
||||||
$client_id = $this->request->getGet('client_id');
|
$client_id = $this->request->getGet('client_id');
|
||||||
@ -736,7 +867,6 @@ class EmployeeController extends AdminController
|
|||||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => $html], 200);
|
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => $html], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function viewUploadedEmployeeList()
|
public function viewUploadedEmployeeList()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -785,7 +915,6 @@ class EmployeeController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getEmpCount($id = null)
|
public function getEmpCount($id = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -800,7 +929,6 @@ class EmployeeController extends AdminController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function downloadFullExcelErrorFile($file_id, $rowIndex = 1, $colIndex = 1)
|
public function downloadFullExcelErrorFile($file_id, $rowIndex = 1, $colIndex = 1)
|
||||||
{
|
{
|
||||||
// Get file data from the database
|
// Get file data from the database
|
||||||
@ -908,13 +1036,14 @@ class EmployeeController extends AdminController
|
|||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function generateIDCardForEmployee($rand_string, $people = 0)
|
public function generateIDCardForEmployee($rand_string, $people = 0)
|
||||||
{
|
{
|
||||||
// dd($rand_string, $people);
|
// dd($rand_string, $people);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
$this->myLogger->logme('error', 'generateIDCardForEmployee function started.');
|
||||||
|
|
||||||
|
// Step 1: Attempt to fetch employee code and client policy ID
|
||||||
|
$this->myLogger->logme('error', 'Fetching employee code and client policy ID.');
|
||||||
$get_emp_code_and_client_policy_id = $this->employeePolicyModel
|
$get_emp_code_and_client_policy_id = $this->employeePolicyModel
|
||||||
->select('employee_polices.client_policy_id, employees.emp_code, tpa.short_name,employees.client_id')
|
->select('employee_polices.client_policy_id, employees.emp_code, tpa.short_name,employees.client_id')
|
||||||
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
|
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
|
||||||
@ -925,53 +1054,52 @@ class EmployeeController extends AdminController
|
|||||||
->where("employee_polices.tpa_id IS NOT NULL AND employee_polices.tpa_id <> ''")
|
->where("employee_polices.tpa_id IS NOT NULL AND employee_polices.tpa_id <> ''")
|
||||||
->where('employee_polices.status', 'active')
|
->where('employee_polices.status', 'active')
|
||||||
->where('employee_polices.is_active', '1')
|
->where('employee_polices.is_active', '1')
|
||||||
->where('employee_polices.rand_string', $rand_string)->first();
|
->where('employee_polices.rand_string', $rand_string)
|
||||||
|
->first();
|
||||||
// dd($get_emp_code_and_client_policy_id);
|
|
||||||
|
|
||||||
|
|
||||||
if ($get_emp_code_and_client_policy_id == null || $get_emp_code_and_client_policy_id == "") {
|
if ($get_emp_code_and_client_policy_id == null || $get_emp_code_and_client_policy_id == "") {
|
||||||
|
$this->myLogger->logme('error', 'Member not found in this rand_string: ' . $rand_string);
|
||||||
$data['message'] = 'Record Not Found';
|
$data['message'] = 'Record Not Found';
|
||||||
return view('errors/404', $data);
|
return view('errors/404', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->myLogger->logme('error', 'Member found. Client policy ID: ' . $get_emp_code_and_client_policy_id['client_policy_id']);
|
||||||
|
|
||||||
$client_policy_id = $get_emp_code_and_client_policy_id['client_policy_id'];
|
$client_policy_id = $get_emp_code_and_client_policy_id['client_policy_id'];
|
||||||
$emp_code = $get_emp_code_and_client_policy_id['emp_code'];
|
$emp_code = $get_emp_code_and_client_policy_id['emp_code'];
|
||||||
|
$client_id = $get_emp_code_and_client_policy_id['client_id'];
|
||||||
|
|
||||||
|
// Step 2: Fetch ECard data
|
||||||
|
$this->myLogger->logme('error', 'Fetching ECard data using client_policy_id: ' . $client_policy_id . ' and emp_code: ' . $emp_code);
|
||||||
$data = $this->employeePolicyModel->getECardDataUsingMd5($client_policy_id, $emp_code,$client_id);
|
$data = $this->employeePolicyModel->getECardDataUsingMd5($client_policy_id, $emp_code,$client_id);
|
||||||
|
|
||||||
if($people == 0){
|
if ($people == 0) {
|
||||||
$data = $this->employeePolicyModel->getECardSingleData($rand_string, $emp_code,$client_id);
|
$this->myLogger->logme('error', 'Fetching single ECard data using rand_string: ' . $rand_string . ' and emp_code: ' . $emp_code);
|
||||||
|
$data = $this->employeePolicyModel->getECardSingleData($rand_string, $emp_code,$client_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// dd($data);
|
// Step 3: Prepare template path
|
||||||
|
$template_data_path = WRITEPATH . 'e_card_template/';
|
||||||
$template_data_path = WRITEPATH . 'e_card_template/';
|
|
||||||
$tpa_short_name = strtolower(str_replace(' ', '_', $get_emp_code_and_client_policy_id['short_name'])) . '.html';
|
$tpa_short_name = strtolower(str_replace(' ', '_', $get_emp_code_and_client_policy_id['short_name'])) . '.html';
|
||||||
$final_path = $template_data_path . $tpa_short_name;
|
$final_path = $template_data_path . $tpa_short_name;
|
||||||
|
|
||||||
// dd($template_data_path, $tpa_short_name, $final_path);
|
$this->myLogger->logme('error', 'Checking if template file exists at: ' . $final_path);
|
||||||
|
|
||||||
if (!file_exists($final_path)) {
|
if (!file_exists($final_path)) {
|
||||||
|
$this->myLogger->logme('error', 'Template file not found: ' . $final_path);
|
||||||
$data['message'] = 'Record Not Found';
|
$data['message'] = 'Template File Not Found';
|
||||||
return view('errors/404', $data);
|
return view('errors/404', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->myLogger->logme('error', 'Template file found. Reading template data.');
|
||||||
$tmplt_data = file_get_contents($final_path);
|
$tmplt_data = file_get_contents($final_path);
|
||||||
|
|
||||||
// dd($tmplt_data);
|
// Step 4: Generate HTML content
|
||||||
|
$this->myLogger->logme('error', 'Generating HTML content from template.');
|
||||||
$html = ""; // Initialize the HTML variable
|
$html = "";
|
||||||
foreach ($data as $key => $value) {
|
foreach ($data as $key => $value) {
|
||||||
|
|
||||||
// Get the HTML content from the template
|
|
||||||
// $htmlContent = view('ecard_template/md_tpa');
|
|
||||||
$htmlContent = $tmplt_data;
|
$htmlContent = $tmplt_data;
|
||||||
|
|
||||||
// Define the placeholders and their corresponding values
|
|
||||||
$placeholders = [
|
$placeholders = [
|
||||||
'{TPA_ID}' => $value['tpa_id'],
|
'{TPA_ID}' => $value['tpa_id'],
|
||||||
'{NAME}' => $value['name'],
|
'{NAME}' => $value['name'],
|
||||||
@ -986,12 +1114,12 @@ class EmployeeController extends AdminController
|
|||||||
'{INSURER_LOGO}' => base_url() . 'public/uploads/logo/' . $value['insurer_logo'],
|
'{INSURER_LOGO}' => base_url() . 'public/uploads/logo/' . $value['insurer_logo'],
|
||||||
'{FRONT_CARD}' => base_url() . 'public/uploads/template_bg/' . $value['front_card'],
|
'{FRONT_CARD}' => base_url() . 'public/uploads/template_bg/' . $value['front_card'],
|
||||||
'{BACK_CARD}' => base_url() . 'public/uploads/template_bg/' . $value['back_card'],
|
'{BACK_CARD}' => base_url() . 'public/uploads/template_bg/' . $value['back_card'],
|
||||||
'{EMP_ID}' =>$value['emp_code'],
|
'{EMP_ID}' => $value['emp_code'],
|
||||||
'{CORPORATE_NAME}' =>$value['client_name'],
|
'{CORPORATE_NAME}' => $value['client_name'],
|
||||||
'{AGE}' =>$value['emp_age'],
|
'{AGE}' => $value['emp_age'],
|
||||||
'{TPA_NAME}' =>$value['tpa_name'],
|
'{TPA_NAME}' => $value['tpa_name'],
|
||||||
'{INSURER_BRANCH}' =>$value['insurer_branch_city'],
|
'{INSURER_BRANCH}' => $value['insurer_branch_city'],
|
||||||
'{RELATION}' =>$value['relationship'],
|
'{RELATION}' => $value['relationship'],
|
||||||
'{TPA_LOGO}' => base_url() . 'public/uploads/logo/' . $value['tpa_logo'],
|
'{TPA_LOGO}' => base_url() . 'public/uploads/logo/' . $value['tpa_logo'],
|
||||||
'{MEDI_USER}' => base_url() . 'public/e_card_imgs/medi_uesr.jpg',
|
'{MEDI_USER}' => base_url() . 'public/e_card_imgs/medi_uesr.jpg',
|
||||||
'{MEDI_INSURER}' => base_url() . 'public/e_card_imgs/Magma.png',
|
'{MEDI_INSURER}' => base_url() . 'public/e_card_imgs/Magma.png',
|
||||||
@ -1000,10 +1128,8 @@ class EmployeeController extends AdminController
|
|||||||
'{QR_IOS}' => base_url() . 'public/e_card_imgs/ios.png',
|
'{QR_IOS}' => base_url() . 'public/e_card_imgs/ios.png',
|
||||||
'{QR_ANDROID_2}' => base_url() . 'public/e_card_imgs/play_store.png',
|
'{QR_ANDROID_2}' => base_url() . 'public/e_card_imgs/play_store.png',
|
||||||
'{QR_IOS_2}' => base_url() . 'public/e_card_imgs/appstore.png',
|
'{QR_IOS_2}' => base_url() . 'public/e_card_imgs/appstore.png',
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
// Replace placeholders with values in HTML content
|
|
||||||
foreach ($placeholders as $placeholder => $replaceValue) {
|
foreach ($placeholders as $placeholder => $replaceValue) {
|
||||||
$htmlContent = str_replace($placeholder, $replaceValue, $htmlContent);
|
$htmlContent = str_replace($placeholder, $replaceValue, $htmlContent);
|
||||||
}
|
}
|
||||||
@ -1011,6 +1137,8 @@ class EmployeeController extends AdminController
|
|||||||
$html .= $htmlContent;
|
$html .= $htmlContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Step 5: Output HTML and script for printing
|
||||||
|
$this->myLogger->logme('error', 'Generating HTML output with print button.');
|
||||||
echo '<button id="downloadBtn" style="display: block;margin: 30px;position: relative;left: 220px;">Print</button>' . $html . '</button>
|
echo '<button id="downloadBtn" style="display: block;margin: 30px;position: relative;left: 220px;">Print</button>' . $html . '</button>
|
||||||
<script>
|
<script>
|
||||||
document.getElementById("downloadBtn").addEventListener("click", function() {
|
document.getElementById("downloadBtn").addEventListener("click", function() {
|
||||||
@ -1020,111 +1148,70 @@ class EmployeeController extends AdminController
|
|||||||
});
|
});
|
||||||
</script>';
|
</script>';
|
||||||
|
|
||||||
|
$this->myLogger->logme('error', 'generateIDCardForEmployee function completed successfully.');
|
||||||
|
|
||||||
// $file_name = $get_emp_code_and_client_policy_id['short_names'] ?? 'md_tpa';
|
|
||||||
// $file_name = strtolower(str_replace(' ', '_', $file_name));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// $file_path = ROOTPATH . 'app/Views/ecard_template/' . $file_name . '.php';
|
|
||||||
|
|
||||||
// if (is_file($file_path)) {
|
|
||||||
// $view_file = 'ecard_template/' . $file_name;
|
|
||||||
|
|
||||||
// } else {
|
|
||||||
// $view_file = 'ecard_template/default_ecard';
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// $dpi = 132;
|
|
||||||
// $html = view('ecard_template/md_tpa');
|
|
||||||
// // echo $html; die;
|
|
||||||
|
|
||||||
// $options = new Options();
|
|
||||||
// $options->set('isRemoteEnabled', true);
|
|
||||||
// $options->set('isPhpEnabled', true);
|
|
||||||
// $options->setDpi($dpi);
|
|
||||||
// $dompdf = new Dompdf($options);
|
|
||||||
|
|
||||||
// $dompdf->loadHtml($html);
|
|
||||||
// $dompdf->setPaper('A4', 'portrait');
|
|
||||||
// $dompdf->render();
|
|
||||||
|
|
||||||
|
|
||||||
// $filename = 'ECard.pdf'; // Default filename
|
|
||||||
|
|
||||||
// foreach ($data['data'] as $key => $value) {
|
|
||||||
|
|
||||||
// if ($value['relationship'] == "Self") {
|
|
||||||
|
|
||||||
// $filename = $value['tpa_id'] . '.pdf'; // Update filename if relationship is "Self"
|
|
||||||
// } elseif (!empty($value['tpa_id']) && $filename == 'ECard.pdf') {
|
|
||||||
|
|
||||||
// $filename = $value['tpa_id'] . '.pdf';
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// $dompdf->stream($filename, array("Attachment" => false));
|
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
$this->myLogger->logme('error', 'Exception occurred: ' . $e->getMessage());
|
||||||
$data['message'] = 'Record Not Founds';
|
$data['message'] = 'Record Not Found';
|
||||||
return view('errors/404', $data);
|
return view('errors/404', $data);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function viewECard()
|
public function viewECard()
|
||||||
{
|
{
|
||||||
|
|
||||||
// $this->loadLayout('ecard_template/default_ecard');
|
// $this->loadLayout('ecard_template/default_ecard');
|
||||||
|
|
||||||
$empDataServiceController = new EmpDataServiceController();
|
$data = [
|
||||||
$file_name = generate_filename("TCS", 'inception', 'export', 'insurer', 'policy', 'branch');
|
'employeeIds' => [6,8,10],
|
||||||
|
'client_id' => 12,
|
||||||
|
'client_policy_id' => 12,
|
||||||
|
'client_branch_id' => 1,
|
||||||
|
'cd_ac_no' => '34567834567892',
|
||||||
|
'endorsement_no' => null,
|
||||||
|
'count' => 3,
|
||||||
|
'event_name' =>'inception',
|
||||||
|
'policy_name' => 'new policy',
|
||||||
|
'user_id' => 1,
|
||||||
|
];
|
||||||
|
|
||||||
$batch_data = [
|
$empDataServiceController = new EmpDataServiceController();
|
||||||
'client_id' => 12,
|
$empData= $empDataServiceController->cashDepositCalculationForInception($data);
|
||||||
'client_policy_id' => 12,
|
|
||||||
'client_branch_id' => 1,
|
|
||||||
'insurer_or_tpa' => 'insurer',
|
|
||||||
'event_type' => 'inception',
|
|
||||||
'actions' => 'export',
|
|
||||||
'file_name' => $file_name,
|
|
||||||
];
|
|
||||||
|
|
||||||
$return = $empDataServiceController->generateExcelForAdditionandInception($batch_data);
|
|
||||||
|
|
||||||
if ($return == 0) {
|
|
||||||
|
|
||||||
dd('error', "Insufficient deposit amount.");
|
|
||||||
|
|
||||||
}else if($return == 1){
|
|
||||||
|
|
||||||
dd('error', "The policy does not have a CD account number.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$return) {
|
|
||||||
dd('error', "No data was found");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//truncateFileDataIn DB (de activate rows)
|
||||||
public function truncateFileData() //truncateFileDataIn DB (de activate rows)
|
public function truncateFileData($file_id, $role_id = null)
|
||||||
{
|
{
|
||||||
$file_id = $this->request->uri->getSegment(3);
|
$file_id = $this->request->uri->getSegment(3);
|
||||||
// $file_id = 112;
|
// $file_id = 112;
|
||||||
$file = $this->fileModel->find($file_id);
|
$file = $this->fileModel->find($file_id);
|
||||||
|
$client_id = $file['client_id'];
|
||||||
|
$client_policy_id = $file['policy_id'];
|
||||||
|
$loggedInUserID = get_session_userid();
|
||||||
|
|
||||||
|
$policy_data = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||||
|
$cd_tranction = $this->cashDepositModel
|
||||||
|
->where('client_id', $client_id)
|
||||||
|
->where('insurer_id', $policy_data['insurer_id'])
|
||||||
|
->where('event_name',$file['action'])
|
||||||
|
->where('client_policy_id', $client_policy_id)
|
||||||
|
->orderBy('id', 'desc')
|
||||||
|
->first();
|
||||||
|
|
||||||
// $file['action'] = 'si_enhancement';
|
// $file['action'] = 'si_enhancement';
|
||||||
// $result = [];
|
// $result = [];
|
||||||
// !dd($file);
|
// !dd($file);
|
||||||
if ($file['action'] == 'inception' || $file['action'] == 'dependent_addition' || $file['action'] == 'addition') {
|
if ($file['action'] == 'inception' || $file['action'] == 'dependent_addition' || $file['action'] == 'addition') {
|
||||||
$result = $this->employeeModel->getEmpListByFileId(file_id: $file_id, emp_status: ['active'], policy_status: ['active']);
|
$result = $this->employeeModel->getEmpListByFileId(file_id: $file_id, emp_status: ['active'], policy_status: ['active']);
|
||||||
// ~dd($result);
|
// ~dd($result);
|
||||||
if (count($result)) {
|
if (count($result) && $role_id == null) {
|
||||||
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'File data already processed'], 200);
|
if(get_role_id() == 1 || get_role_id() == 5){
|
||||||
|
return $this->respond(['role' => get_role_id(), 'dataStatus' => false, 'code' => 404, 'message' => 'File data already processed. Do you want to truncate data from uploaded file?'], 200);
|
||||||
|
}else{
|
||||||
|
return $this->respond(['role' => get_role_id(), 'dataStatus' => false, 'code' => 404, 'message' => 'File data already processed'], 200);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
//update emp and emp plocies
|
//update emp and emp plocies
|
||||||
@ -1137,9 +1224,30 @@ class EmployeeController extends AdminController
|
|||||||
//update file status
|
//update file status
|
||||||
$this->fileModel->where('id', $file_id)->set(['status' => 'truncated'])->update();
|
$this->fileModel->where('id', $file_id)->set(['status' => 'truncated'])->update();
|
||||||
|
|
||||||
|
if($cd_tranction){
|
||||||
|
|
||||||
|
$cd_data = [
|
||||||
|
'amount' => $cd_tranction['amount'],
|
||||||
|
'sub_type_id' => 8,
|
||||||
|
'endorsement_no' => null,
|
||||||
|
'insurer_id' =>$policy_data['insurer_id'],
|
||||||
|
'description' => 'The policy Truncated by Admin or Head',
|
||||||
|
'transaction_type' => 'Credit',
|
||||||
|
'updated_by' => 1,
|
||||||
|
'client_id' => $client_id,
|
||||||
|
'client_policy_id' => $client_policy_id,
|
||||||
|
'cd_ac_no' => $policy_data['cd_ac_no'] ?? null,
|
||||||
|
'event_name' => $file['action'],
|
||||||
|
];
|
||||||
|
|
||||||
|
$response = DepositHelper::saveDeposit($cd_data, $loggedInUserID);
|
||||||
|
}
|
||||||
|
|
||||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => round($affectedRows / 2)], 200);
|
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => round($affectedRows / 2)], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ($file['action'] == 'si_enhancement' || $file['action'] == 'correction' || $file['action'] == 'deletion') {
|
} else if ($file['action'] == 'si_enhancement' || $file['action'] == 'correction' || $file['action'] == 'deletion') {
|
||||||
|
|
||||||
$res = $this->empEndorsementModel->select(['count(id) as count'])
|
$res = $this->empEndorsementModel->select(['count(id) as count'])
|
||||||
->where('emp_endorsement.file_id', $file_id)
|
->where('emp_endorsement.file_id', $file_id)
|
||||||
->groupStart()
|
->groupStart()
|
||||||
@ -1148,25 +1256,52 @@ class EmployeeController extends AdminController
|
|||||||
->groupEnd()
|
->groupEnd()
|
||||||
->get()
|
->get()
|
||||||
->getResult();
|
->getResult();
|
||||||
|
|
||||||
// print_r($this->empEndorsementModel->getLastQuery());
|
// print_r($this->empEndorsementModel->getLastQuery());
|
||||||
// echo $res[0]->count;die();
|
// echo $res[0]->count;die();
|
||||||
if ($res[0]->count == 0) {
|
if ($res[0]->count == 0 || $role_id == 5 || $role_id == 1) {
|
||||||
//update truncated status to db
|
//update truncated status to db
|
||||||
$this->empEndorsementModel->where('file_id', $file_id)
|
$this->empEndorsementModel->where('file_id', $file_id)
|
||||||
->set(['status' => 'truncated'])
|
->set(['status' => 'truncated'])
|
||||||
->update();
|
->update();
|
||||||
//update file status
|
//update file status
|
||||||
$this->fileModel->where('id', $file_id)->set(['status' => 'truncated'])->update();
|
$this->fileModel->where('id', $file_id)->set(['status' => 'truncated'])->update();
|
||||||
|
|
||||||
|
if($cd_tranction && $file['action'] != 'correction'){
|
||||||
|
|
||||||
|
$transaction_type = 'Credit';
|
||||||
|
if($file['action'] == 'deletion'){
|
||||||
|
$transaction_type = 'Debit';
|
||||||
|
}
|
||||||
|
|
||||||
|
$cd_data = [
|
||||||
|
'amount' => $cd_tranction['amount'],
|
||||||
|
'sub_type_id' => 8,
|
||||||
|
'endorsement_no' => null,
|
||||||
|
'insurer_id' =>$policy_data['insurer_id'],
|
||||||
|
'description' => 'The policy Truncated by Admin or Head',
|
||||||
|
'transaction_type' => $transaction_type,
|
||||||
|
'updated_by' => 1,
|
||||||
|
'client_id' => $client_id,
|
||||||
|
'client_policy_id' => $client_policy_id,
|
||||||
|
'cd_ac_no' => $policy_data['cd_ac_no'] ?? null,
|
||||||
|
'event_name' => $file['action'],
|
||||||
|
];
|
||||||
|
|
||||||
|
$response = DepositHelper::saveDeposit($cd_data, $loggedInUserID);
|
||||||
|
}
|
||||||
|
|
||||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => 'success'], 200);
|
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => 'success'], 200);
|
||||||
} else {
|
} else {
|
||||||
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'File data already processed'], 200);
|
if(get_role_id() == 1 || get_role_id() == 5){
|
||||||
|
return $this->respond(['role' => get_role_id(), 'dataStatus' => false, 'code' => 404, 'message' => 'File data already processed. Do you want to truncate data from uploaded file?'], 200);
|
||||||
|
}else{
|
||||||
|
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'File data already processed'], 200);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function previewTemplate($id = null)
|
public function previewTemplate($id = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -1249,7 +1384,6 @@ class EmployeeController extends AdminController
|
|||||||
echo $htmlContent;
|
echo $htmlContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function errorListExportImport($file_id)
|
public function errorListExportImport($file_id)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -1340,6 +1474,7 @@ class EmployeeController extends AdminController
|
|||||||
{
|
{
|
||||||
$client_policy_id = $this->request->uri->getSegment(3);
|
$client_policy_id = $this->request->uri->getSegment(3);
|
||||||
$policy_details = $this->clientPolicyModel->find($client_policy_id);
|
$policy_details = $this->clientPolicyModel->find($client_policy_id);
|
||||||
|
$insurer_details = $this->insurerModel->where('id', $policy_details['insurer_id'])->first();
|
||||||
$policy_terms = isset($policy_details['policy_terms']) ? true : false;
|
$policy_terms = isset($policy_details['policy_terms']) ? true : false;
|
||||||
|
|
||||||
$si_enhancement_true_or_false = 1;
|
$si_enhancement_true_or_false = 1;
|
||||||
@ -1366,8 +1501,83 @@ class EmployeeController extends AdminController
|
|||||||
}
|
}
|
||||||
$message = isset($message) ? ($message . ' not defined for choosed policy') : null;
|
$message = isset($message) ? ($message . ' not defined for choosed policy') : null;
|
||||||
|
|
||||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'message' => $message, 'si_enhancement' => $si_enhancement_true_or_false], 200);
|
return $this->respond(['dataStatus' => true, 'code' => 200, 'message' => $message, 'si_enhancement' => $si_enhancement_true_or_false, 'insurer_multi_event' => $insurer_details['is_multi_event']], 200);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testRackRate()
|
||||||
|
{
|
||||||
|
if ($this->request->getMethod() == 'get') {
|
||||||
|
$filterData = $this->request->getGet('client_policy_id');
|
||||||
|
//just load UI only
|
||||||
|
$this->loadLayout('rack_rate_test');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($this->request->getMethod() == 'post') {
|
||||||
|
$json = $this->request->getJSON();
|
||||||
|
// return $this->respond(['dataStatus' => false, 'code' => 200, 'data' => $data], 200);
|
||||||
|
// $data = (json_decode(json_encode($data),true));
|
||||||
|
$client_id = $json->client_id;
|
||||||
|
$policy_id = $json->policy_id;
|
||||||
|
$branch_id = $json->branch_id;
|
||||||
|
$tabledata = $json->data;
|
||||||
|
|
||||||
|
if(count($tabledata))
|
||||||
|
{
|
||||||
|
$family_details = [];
|
||||||
|
foreach($tabledata as $key => $row)
|
||||||
|
{
|
||||||
|
$row = (array)$row;
|
||||||
|
if(!$row['column12'])
|
||||||
|
{
|
||||||
|
|
||||||
|
$temp[0] = $row['column1'];//sno
|
||||||
|
$temp[1] = $row['column2'];//emp code
|
||||||
|
$temp[2] = $row['column3'];//name
|
||||||
|
$temp[3] = $row['column4'];//DOB
|
||||||
|
$temp[4] = strtoupper($row['column5']);//Gender
|
||||||
|
$temp[5] = $row['column6'];//relation
|
||||||
|
$temp[6] = $row['column7'];//SI
|
||||||
|
$temp[7] = $row['column8'];//DOC
|
||||||
|
$temp[8] = '';//DOJ
|
||||||
|
$temp[9] = $row['column9'];//BP
|
||||||
|
$temp[10] = $row['column10'];//band
|
||||||
|
$temp[11] = '';//designation
|
||||||
|
$temp[12] = '';//mobile
|
||||||
|
$temp[13] = '';//EMail
|
||||||
|
$temp[14] = '';//CE
|
||||||
|
$temp[15] = '';//RFE
|
||||||
|
$temp[16] = '';//DOE
|
||||||
|
$temp[17] = '';//Unit
|
||||||
|
$temp[18] = $row['column11'];//unit
|
||||||
|
$family_details[] = $temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// print_r($family_details);
|
||||||
|
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => $family_details], 200);
|
||||||
|
//get policy details
|
||||||
|
$policy_details = $this->clientPolicyModel->getPolicyDetails($file['client_id'],$file['policy_id']);
|
||||||
|
//get rack rates
|
||||||
|
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($file['policy_id'],$file['client_id']);
|
||||||
|
//get file array or construnct dummy file array here
|
||||||
|
$file = ['id' => null,'client_id' => 10,'policy_id' => 10,'action' => 'inception','client_branch_id' => 1,'created_by' => 1];
|
||||||
|
//get familiy details in inception file format array from post method
|
||||||
|
$family_details = [
|
||||||
|
[2,'TEST001','John Doe', '01-Jan-1988', 'M', 'Self', '5000000', NULL, '', '', 'G', '', '', '', '', '', '',''],
|
||||||
|
[1,'TEST001','Jane Doe', '01-Jan-1985', 'F', 'Spouse', 5000000, '01-Jan-2024', '01-Jan-2020', 50000, 'A', 'Manager', '1234567890', 'john.doe@example.com', '0', '', '', ''],
|
||||||
|
|
||||||
|
// [3,'TEST001','Peter Doe', '01-Jan-1955', 'M', 'Father', '', NULL, '', '', '', '', '', '', '', '', '',''],
|
||||||
|
[4,'TEST001','Mary Doe', '01-Jan-1953', 'F', 'Mother', '', NULL, '', '', '', '', '', '', '', '', '',''],
|
||||||
|
[5,'TEST001','Grace Doe', '01-Jan-1954', 'F', 'Mother in law', '', NULL, '', '', '', '', '', '', '', '', '',''],
|
||||||
|
//[6,'TEST001','George Doe', '01-Jan-1948', 'M', 'Father in law', '', NULL, '', '', '', '', '', '', '', '', '',''],
|
||||||
|
[7,'TEST001','Alice Doe', '01-Jan-1990', 'F', 'Daughter', 5000000, '01-Jan-2024', '01-Jan-2024', 40000, 'B', 'Supervisor', '9876543210', '', '', '', '',''],
|
||||||
|
[6,'TEST001','Bob Doe', '01-Jan-1993', 'M', 'son', '50000', NULL, '', '', '', '', '', '', '', '', '',''],
|
||||||
|
];
|
||||||
|
$data = calculate_premimum_new($family_details,$policy_details,$all_rack_rates,$file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -16,6 +16,10 @@ use App\Models\PolicesModel;
|
|||||||
use App\Models\FileModel;
|
use App\Models\FileModel;
|
||||||
use App\Models\EmpEndorsementModel;
|
use App\Models\EmpEndorsementModel;
|
||||||
use App\Models\MessageModel;
|
use App\Models\MessageModel;
|
||||||
|
use App\Models\ClientBranchModel;
|
||||||
|
use App\Models\NotificationModel;
|
||||||
|
|
||||||
|
use App\Helpers\sendMailNotification;
|
||||||
|
|
||||||
use App\Controllers\Jobs ;
|
use App\Controllers\Jobs ;
|
||||||
use App\Controllers\JobWorker ;
|
use App\Controllers\JobWorker ;
|
||||||
@ -35,6 +39,8 @@ class EmployeeServiceController extends AdminController
|
|||||||
protected $policiesModel;
|
protected $policiesModel;
|
||||||
protected $empEndorsementModel;
|
protected $empEndorsementModel;
|
||||||
protected $messageModel;
|
protected $messageModel;
|
||||||
|
protected $clientBranchModel;
|
||||||
|
protected $notificationModel;
|
||||||
|
|
||||||
protected $general_relationships = [
|
protected $general_relationships = [
|
||||||
'self' => [
|
'self' => [
|
||||||
@ -155,7 +161,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
'format' => null,
|
'format' => null,
|
||||||
'allowed_values' => null,
|
'allowed_values' => null,
|
||||||
'custom' => 'check_si',
|
'custom' => 'check_si',
|
||||||
'params' => ['row', 'policy_terms', 'slab_details']
|
'params' => ['row', 'policy_details', 'slab_details']
|
||||||
],
|
],
|
||||||
'doc' => [
|
'doc' => [
|
||||||
'col_idx' => 7,
|
'col_idx' => 7,
|
||||||
@ -266,6 +272,18 @@ class EmployeeServiceController extends AdminController
|
|||||||
'format' => null,
|
'format' => null,
|
||||||
'allowed_values' => null
|
'allowed_values' => null
|
||||||
]
|
]
|
||||||
|
,
|
||||||
|
'unit' => [
|
||||||
|
'col_idx' => 18,
|
||||||
|
'col_cell_name' => 'S',
|
||||||
|
'col_name' => 'Unit',
|
||||||
|
'is_mandatory' => false,
|
||||||
|
'data_type' => 'str',
|
||||||
|
'format' => null,
|
||||||
|
'allowed_values' => null,
|
||||||
|
'custom' => 'check_unit',
|
||||||
|
'params' => ['row', 'existing_units']
|
||||||
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $deletion_excel_columns = [
|
protected $deletion_excel_columns = [
|
||||||
@ -565,6 +583,15 @@ class EmployeeServiceController extends AdminController
|
|||||||
'format' => null,
|
'format' => null,
|
||||||
'allowed_values' => null,
|
'allowed_values' => null,
|
||||||
'custom' => null
|
'custom' => null
|
||||||
|
],
|
||||||
|
'unit' => [
|
||||||
|
'col_idx' => 12,
|
||||||
|
'col_cell_name' => 'M',
|
||||||
|
'col_name' => 'Unit',
|
||||||
|
'is_mandatory' => false,
|
||||||
|
'data_type' => 'str',
|
||||||
|
'format' => null,
|
||||||
|
'allowed_values' => null
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -586,7 +613,8 @@ class EmployeeServiceController extends AdminController
|
|||||||
14 => null, // inception: pre_existing_ailments (PRE EXISTING AILMENTS) -> No match in enrollment
|
14 => null, // inception: pre_existing_ailments (PRE EXISTING AILMENTS) -> No match in enrollment
|
||||||
15 => null, // inception: change_event (Change event) -> No match in enrollment
|
15 => null, // inception: change_event (Change event) -> No match in enrollment
|
||||||
16 => null, // inception: date_of_exit (Date of exit) -> No match in enrollment
|
16 => null, // inception: date_of_exit (Date of exit) -> No match in enrollment
|
||||||
17 => null // inception: reason_for_exit (Reason for exit) -> No match in enrollment
|
17 => null, // inception: reason_for_exit (Reason for exit) -> No match in enrollment
|
||||||
|
18 => null // inception: reason_for_exit (Reason for exit) -> No match in enrollment
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $enrollment_to_inception_mapping = [
|
protected $enrollment_to_inception_mapping = [
|
||||||
@ -619,6 +647,8 @@ class EmployeeServiceController extends AdminController
|
|||||||
$this->policiesModel = new PolicesModel();
|
$this->policiesModel = new PolicesModel();
|
||||||
$this->empEndorsementModel = new EmpEndorsementModel();
|
$this->empEndorsementModel = new EmpEndorsementModel();
|
||||||
$this->messageModel = new MessageModel();
|
$this->messageModel = new MessageModel();
|
||||||
|
$this->clientBranchModel = new ClientBranchModel();
|
||||||
|
$this->notificationModel = new NotificationModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function excelFileFormatValidation($params)
|
public function excelFileFormatValidation($params)
|
||||||
@ -663,6 +693,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
if($file['action'] == 'correction'){ $columns_to_check = $this->correction_excel_columns; }
|
if($file['action'] == 'correction'){ $columns_to_check = $this->correction_excel_columns; }
|
||||||
if($file['action'] == 'si_enhancement'){ $columns_to_check = $this->si_enhance_excel_columns; }
|
if($file['action'] == 'si_enhancement'){ $columns_to_check = $this->si_enhance_excel_columns; }
|
||||||
if($file['action'] == 'enrollment'){ $columns_to_check = $this->enrollment_excel_columns; }
|
if($file['action'] == 'enrollment'){ $columns_to_check = $this->enrollment_excel_columns; }
|
||||||
|
if($file['action'] == 'missed_inception'){ $columns_to_check = $this->inception_excel_columns; }
|
||||||
|
|
||||||
|
|
||||||
$result = ['error_type' => 1,'error_summary' => [], 'error_data' => [] ];
|
$result = ['error_type' => 1,'error_summary' => [], 'error_data' => [] ];
|
||||||
@ -722,7 +753,10 @@ class EmployeeServiceController extends AdminController
|
|||||||
$relationship = $this->general_relationships;
|
$relationship = $this->general_relationships;
|
||||||
//get exisiting mobilr nos
|
//get exisiting mobilr nos
|
||||||
$existing_mobilenos = $this->employeePolicyModel->getExisitingMobileNos(client_policy_id: $file['policy_id']);
|
$existing_mobilenos = $this->employeePolicyModel->getExisitingMobileNos(client_policy_id: $file['policy_id']);
|
||||||
// dd($existing_mobilenos);
|
|
||||||
|
//get existing units in the current branch
|
||||||
|
$existing_units = $this->clientBranchModel->getExisitingUnits(client_id: $file['client_id'],client_branch_id: $file['client_branch_id']);
|
||||||
|
// dd($existing_units);
|
||||||
foreach ($excel_data as $row_key => $row)
|
foreach ($excel_data as $row_key => $row)
|
||||||
{
|
{
|
||||||
//define row wise action/event in temporary variable
|
//define row wise action/event in temporary variable
|
||||||
@ -734,6 +768,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
else if($file['action'] == 'correction'){ $current_column_action = 'C'; }
|
else if($file['action'] == 'correction'){ $current_column_action = 'C'; }
|
||||||
else if($file['action'] == 'si_enhancement'){ $current_column_action = 'SI'; }
|
else if($file['action'] == 'si_enhancement'){ $current_column_action = 'SI'; }
|
||||||
else if($file['action'] == 'enrollment'){ $current_column_action = 'I'; }
|
else if($file['action'] == 'enrollment'){ $current_column_action = 'I'; }
|
||||||
|
else if($file['action'] == 'missed_inception'){ $current_column_action = 'MI'; }
|
||||||
//1. avoid empty rows
|
//1. avoid empty rows
|
||||||
if(check_row_is_empty_or_null($row))
|
if(check_row_is_empty_or_null($row))
|
||||||
{
|
{
|
||||||
@ -863,15 +898,16 @@ class EmployeeServiceController extends AdminController
|
|||||||
}
|
}
|
||||||
else //trigger next data validation via job queue server
|
else //trigger next data validation via job queue server
|
||||||
{
|
{
|
||||||
if($file['action'] == 'enrollment') // if current action is enrollment call next validation and return result
|
if($file['action'] == 'enrollment' && $file['uploaded_by'] != 1) // if current action is enrollment and uploaded by HR (0 or NULL) call next validation and return result
|
||||||
{
|
{
|
||||||
|
// dd();
|
||||||
$res = $this->excelFileDataValidation(['file_id' => $file['id']]);
|
$res = $this->excelFileDataValidation(['file_id' => $file['id']]);
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
//proceed next data level validation in JOB queue
|
//proceed next data level validation in JOB queue
|
||||||
$job_details = new Jobs();
|
// $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 = new JobWorker();
|
||||||
// JobWorker::processJob($r);
|
// JobWorker::processJob($r);
|
||||||
|
|
||||||
@ -914,6 +950,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
if($file['action'] == 'correction'){ $columns_to_check = $this->correction_excel_columns; }
|
if($file['action'] == 'correction'){ $columns_to_check = $this->correction_excel_columns; }
|
||||||
if($file['action'] == 'si_enhancement'){ $columns_to_check = $this->si_enhance_excel_columns; }
|
if($file['action'] == 'si_enhancement'){ $columns_to_check = $this->si_enhance_excel_columns; }
|
||||||
if($file['action'] == 'enrollment'){ $columns_to_check = $this->enrollment_excel_columns; }
|
if($file['action'] == 'enrollment'){ $columns_to_check = $this->enrollment_excel_columns; }
|
||||||
|
if($file['action'] == 'missed_inception'){ $columns_to_check = $this->inception_excel_columns; }
|
||||||
|
|
||||||
// get policy and rack details
|
// get policy and rack details
|
||||||
$policy_terms = $this->clientPolicyModel->getPolicyDetails($file['client_id'],$file['policy_id']);
|
$policy_terms = $this->clientPolicyModel->getPolicyDetails($file['client_id'],$file['policy_id']);
|
||||||
@ -940,7 +977,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
$relationship = $this->general_relationships;
|
$relationship = $this->general_relationships;
|
||||||
|
|
||||||
|
|
||||||
if(in_array($file['action'],['inception','addition','dependent_addition','deletion','correction','si_enhancement','enrollment']))// the below funcitons are only for I,DA,A
|
if(in_array($file['action'],['inception','missed_inception','addition','dependent_addition','deletion','correction','si_enhancement','enrollment']))// the below funcitons are only for I,DA,A
|
||||||
{
|
{
|
||||||
$employee_data_group_by_family = data_group_by_family($excel_data,'excel',($file['action'] == 'enrollment' ? 'enrollment' : ''));
|
$employee_data_group_by_family = data_group_by_family($excel_data,'excel',($file['action'] == 'enrollment' ? 'enrollment' : ''));
|
||||||
// dd($employee_data_group_by_family);
|
// dd($employee_data_group_by_family);
|
||||||
@ -968,12 +1005,12 @@ class EmployeeServiceController extends AdminController
|
|||||||
// dd(array_keys($existing_famility_details[0]));
|
// dd(array_keys($existing_famility_details[0]));
|
||||||
$family = array_merge($family,$existing_famility_details);
|
$family = array_merge($family,$existing_famility_details);
|
||||||
// kint::dump($family);
|
// kint::dump($family);
|
||||||
$family = data_group_by_family($family)[ $emp_id ];// reason to call this again is bring self to first index of the array
|
$family = data_group_by_family($family)[ $emp_id ];// reason to call this again bring self to first index of the array
|
||||||
}
|
}
|
||||||
// kint::dump($family);//die();
|
// kint::dump($family);//die();
|
||||||
|
|
||||||
//check name dup within a family
|
//check name dup within a family
|
||||||
if($file['action'] == 'inception' || $file['action'] == 'addition' || $file['action'] == 'dependent_addition' || $file['action'] == 'enrollment')
|
if($file['action'] == 'inception' || $file['action'] == 'missed_inception' || $file['action'] == 'addition' || $file['action'] == 'dependent_addition' || $file['action'] == 'enrollment')
|
||||||
{
|
{
|
||||||
$res = name_dup_check_within_family($family,$file['action']);//in both file data & DB data
|
$res = name_dup_check_within_family($family,$file['action']);//in both file data & DB data
|
||||||
// dd($res);
|
// dd($res);
|
||||||
@ -987,7 +1024,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(($policy_details['base_policy'] == null && ($file['action'] == 'inception' || $file['action'] == 'addition' || $file['action'] == 'enrollment')) || ($policy_details['policy_type_id'] == 3 && $is_self_available_in_policy_terms)) // 3 is GMC parents dep addon)
|
if(($policy_details['base_policy'] == null || $policy_details['base_policy'] == 0 && ($file['action'] == 'inception' || $file['action'] == 'missed_inception' || $file['action'] == 'addition' || $file['action'] == 'enrollment')) || ($policy_details['policy_type_id'] == 3 && $is_self_available_in_policy_terms)) // 3 is GMC parents dep addon)
|
||||||
{
|
{
|
||||||
$res = check_self_available_in_family($family,$file['action']);
|
$res = check_self_available_in_family($family,$file['action']);
|
||||||
if(!$res['is_self_found'])
|
if(!$res['is_self_found'])
|
||||||
@ -1010,7 +1047,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if($file['action'] == 'dependent_addition' || $file['action'] == 'addition' || $file['action'] == 'inception' || $file['action'] == 'enrollment')
|
if($file['action'] == 'dependent_addition' || $file['action'] == 'addition' || $file['action'] == 'inception'|| $file['action'] == 'missed_inception' || $file['action'] == 'enrollment')
|
||||||
{
|
{
|
||||||
$res = check_dependent_conflict($family,$policy_terms,$file['action']);
|
$res = check_dependent_conflict($family,$policy_terms,$file['action']);
|
||||||
// dd($res);
|
// dd($res);
|
||||||
@ -1081,14 +1118,18 @@ class EmployeeServiceController extends AdminController
|
|||||||
|
|
||||||
$r = Jobs::addJob(['job_name' => 'employeesCorrectionProcess','payload' => ['file_id' => $file_id]]);
|
$r = Jobs::addJob(['job_name' => 'employeesCorrectionProcess','payload' => ['file_id' => $file_id]]);
|
||||||
}
|
}
|
||||||
else if ($file['action'] == 'inception' || $file['action'] == 'addition' || $file['action'] == 'dependent_addition')//inception OR addition OR dependent addition
|
else if ($file['action'] == 'inception' || $file['action'] == 'missed_inception' || $file['action'] == 'addition' || $file['action'] == 'dependent_addition')//inception OR addition OR dependent addition
|
||||||
{
|
{
|
||||||
//proceed next data level validation in JOB queue
|
//proceed next data level validation in JOB queue
|
||||||
$job_details = new Jobs();
|
// $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 = new JobWorker();
|
||||||
// JobWorker::processJob($r);
|
// JobWorker::processJob($r);
|
||||||
}
|
}
|
||||||
|
else if($file['action'] == 'enrollment' && $file['uploaded_by'] == 1)// enrollment uploaded by nhance user not by hr
|
||||||
|
{
|
||||||
|
$r = Jobs::addJob(['job_name' => 'employeesEnrollmentInsert','payload' => ['file_id' => $file_id]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@ -1134,6 +1175,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
if($file['action'] == 'deletion'){ $columns_to_check = $this->deletion_excel_columns; }
|
if($file['action'] == 'deletion'){ $columns_to_check = $this->deletion_excel_columns; }
|
||||||
if($file['action'] == 'correction'){ $columns_to_check = $this->correction_excel_columns; }
|
if($file['action'] == 'correction'){ $columns_to_check = $this->correction_excel_columns; }
|
||||||
if($file['action'] == 'si_enhancement'){ $columns_to_check = $this->si_enhance_excel_columns; }
|
if($file['action'] == 'si_enhancement'){ $columns_to_check = $this->si_enhance_excel_columns; }
|
||||||
|
if($file['action'] == 'missed_inception'){ $columns_to_check = $this->inception_excel_columns; }
|
||||||
|
|
||||||
// get policy and rack details
|
// get policy and rack details
|
||||||
$policy_terms = $this->clientPolicyModel->getPolicyDetails($file['client_id'],$file['policy_id']);
|
$policy_terms = $this->clientPolicyModel->getPolicyDetails($file['client_id'],$file['policy_id']);
|
||||||
@ -1155,6 +1197,8 @@ class EmployeeServiceController extends AdminController
|
|||||||
//get policy slab rates
|
//get policy slab rates
|
||||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($file['policy_id'],$file['client_id']);
|
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($file['policy_id'],$file['client_id']);
|
||||||
// dd($slab_details);
|
// dd($slab_details);
|
||||||
|
//get existing units in the current branch
|
||||||
|
$existing_units = $this->clientBranchModel->getExisitingUnits(client_id: $file['client_id'],client_branch_id: $file['client_branch_id']);
|
||||||
|
|
||||||
$employee_data_group_by_family = data_group_by_family($excel_data);
|
$employee_data_group_by_family = data_group_by_family($excel_data);
|
||||||
// dd($employee_data_group_by_family);
|
// dd($employee_data_group_by_family);
|
||||||
@ -1175,7 +1219,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Kint::dump($family);die();
|
// Kint::dump($family);die();
|
||||||
$data = calculate_premimum($family,$policy_terms,$slab_details,$file);
|
$data = calculate_premium_new(family_data:$family,policy_terms: $policy_terms,slab_details : $slab_details,fileArr: $file, existing_units:$existing_units);
|
||||||
// dd($data);
|
// dd($data);
|
||||||
$employee_data_group_by_family[$emp_id] = $data;
|
$employee_data_group_by_family[$emp_id] = $data;
|
||||||
$this->employeesOnboardProcess(['familiy_data' => $data,'file' => $file]);
|
$this->employeesOnboardProcess(['familiy_data' => $data,'file' => $file]);
|
||||||
@ -1204,6 +1248,9 @@ class EmployeeServiceController extends AdminController
|
|||||||
|
|
||||||
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(client_id: $client_id,client_policy_id: $client_policy_id,emp_status: ['enrolled','draft'],policy_status:['enrolled','draft']);
|
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(client_id: $client_id,client_policy_id: $client_policy_id,emp_status: ['enrolled','draft'],policy_status:['enrolled','draft']);
|
||||||
|
|
||||||
|
//get existing units in the current branch
|
||||||
|
$existing_units = $this->clientBranchModel->getExisitingUnits(client_id: $file['client_id'],client_branch_id: $file['client_branch_id']);
|
||||||
|
|
||||||
|
|
||||||
// $file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception'];
|
// $file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception'];
|
||||||
$file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception','created_by' => get_session_userid(),'client_branch_id' => $params['client_branch_id']];
|
$file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception','created_by' => get_session_userid(),'client_branch_id' => $params['client_branch_id']];
|
||||||
@ -1214,7 +1261,8 @@ class EmployeeServiceController extends AdminController
|
|||||||
foreach ($employee_data_group_by_family as $emp_id => $family)
|
foreach ($employee_data_group_by_family as $emp_id => $family)
|
||||||
{
|
{
|
||||||
$transformed_famility_details = transform_db_data_to_excel($family);
|
$transformed_famility_details = transform_db_data_to_excel($family);
|
||||||
$data = calculate_premimum($transformed_famility_details,$policy_terms,$slab_details,$file);
|
// $data = calculate_premium_new($transformed_famility_details,$policy_terms,$slab_details,$file);
|
||||||
|
$data = calculate_premium_new(family_data:$transformed_famility_details,policy_terms: $policy_terms,slab_details : $slab_details,fileArr: $file, existing_units:$existing_units);
|
||||||
// dd($data);
|
// dd($data);
|
||||||
$employee_data_group_by_family[$emp_id] = $data;
|
$employee_data_group_by_family[$emp_id] = $data;
|
||||||
$this->employeesOnboardProcess(['familiy_data' => $data,'file' => $file]);
|
$this->employeesOnboardProcess(['familiy_data' => $data,'file' => $file]);
|
||||||
@ -1448,17 +1496,43 @@ class EmployeeServiceController extends AdminController
|
|||||||
if(!count($existing_endorsements))
|
if(!count($existing_endorsements))
|
||||||
{
|
{
|
||||||
//transform data to send
|
//transform data to send
|
||||||
|
|
||||||
|
//get applicable slab rate for current member relation
|
||||||
|
$pre_rack_rate_name = '';
|
||||||
|
$applicable_rack_rate_name = '';
|
||||||
|
$applicable_rack_rate_master = '';
|
||||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||||
{
|
{
|
||||||
if($slab_value['si'] == $row[3])
|
if($pre_rack_rate_name != $slab_value['rack_rate_name'])
|
||||||
{
|
{
|
||||||
$group_key = rand(100000, 999999);
|
$pre_rack_rate_name = $slab_value['rack_rate_name'];
|
||||||
$this->empEndorsementModel->save(['pk' => (int)$employee_policy['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'basic_cover_si','old_value' => $employee_policy['basic_cover_si'],'new_value' => $row[3],'created_by' => $file['created_by'],'remarks' => 'general si enhancement','group_key' => $group_key,'file_id' => $file['id'],'status' => 'pending']);
|
$rack_rate_json = json_decode($slab_value['additional_relationship']);
|
||||||
$this->empEndorsementModel->save(['pk' => (int)$employee_policy['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'premium','old_value' => $employee_policy['premium'],'new_value' => $slab_value['premium'],'created_by' => $file['created_by'],'remarks' => 'general si enhancement','group_key' => $group_key,'file_id' => $file['id'],'status' => 'pending']);
|
if(in_array(strtolower($employee['relationship']), $rack_rate_json) && $rack_rate_json[ strtolower($employee['relationship']) ] != 0 && $rack_rate_json[ strtolower($employee['relationship']) ] != NA)
|
||||||
$this->empEndorsementModel->save(['pk' => (int)$employee_policy['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'si_enhancement_date','old_value' => null,'new_value' => change_date_format($row[4],'d-M-Y','Y-m-d'),'created_by' => $file['created_by'],'remarks' => 'general si enhancement','group_key' => $group_key,'file_id' => $file['id'],'status' => 'pending']);
|
{
|
||||||
break;
|
$applicable_rack_rate_name = $slab_value['rack_rate_name'];
|
||||||
|
$applicable_rack_rate_master = $slab_value['grid_master'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//get max age,max count of the familiy
|
||||||
|
$max_age_and_max_count_of_current_member = $this->employeeModel->getFamiliyCountAndMaxage($employee['emp_code']);
|
||||||
|
//transform SI excel row data as inception excel OR premium calculateable fomart
|
||||||
|
|
||||||
|
$data = transform_si_excel_row_to_calculatable_format(employee: $employee,employee_policy: $employee_policy,maxage_and_maxcount: $max_age_and_max_count_of_current_member,slab_details: $slab_details,applicable_slab_name: $applicable_rack_rate_name,augmented_si: $row[3],grid_master: $applicable_rack_rate_master);
|
||||||
|
$policy_terms = $this->clientPolicyModel->getPolicyDetails($file['client_id'],$file['policy_id']);
|
||||||
|
//grouping slab details by rack rate name
|
||||||
|
$temp_slab_rates = group_slab_rates_basedon_name($slab_details);
|
||||||
|
|
||||||
|
$calculated_data = premium_calculation_manager($data,$policy_terms,$temp_slab_rates,$row[3]);
|
||||||
|
|
||||||
|
$group_key = rand(100000, 999999);
|
||||||
|
$this->empEndorsementModel->save(['pk' => (int)$employee_policy['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'basic_cover_si','old_value' => $employee_policy['basic_cover_si'],'new_value' => $row[3],'created_by' => $file['created_by'],'remarks' => 'general si enhancement','group_key' => $group_key,'file_id' => $file['id'],'status' => 'pending']);
|
||||||
|
$this->empEndorsementModel->save(['pk' => (int)$employee_policy['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'premium','old_value' => $employee_policy['premium'],'new_value' => $calculated_data['policy_details']['premium'],'created_by' => $file['created_by'],'remarks' => 'general si enhancement','group_key' => $group_key,'file_id' => $file['id'],'status' => 'pending']);
|
||||||
|
$this->empEndorsementModel->save(['pk' => (int)$employee_policy['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'si_enhancement_date','old_value' => null,'new_value' => change_date_format($row[4],'d-M-Y','Y-m-d'),'created_by' => $file['created_by'],'remarks' => 'general si enhancement','group_key' => $group_key,'file_id' => $file['id'],'status' => 'pending']);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1474,105 +1548,114 @@ class EmployeeServiceController extends AdminController
|
|||||||
|
|
||||||
|
|
||||||
// insert or update in db for inception addition depent addition
|
// insert or update in db for inception addition depent addition
|
||||||
public function employeesOnboardProcess($params)
|
public function employeesOnboardProcess($params)
|
||||||
{
|
{
|
||||||
$familiy_data = $params['familiy_data'];
|
$familiy_data = $params['familiy_data'];
|
||||||
$file = $params['file'];
|
$file = $params['file'];
|
||||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($file['policy_id'],$file['client_id']);
|
|
||||||
foreach($familiy_data as $fkey => $value)
|
foreach($familiy_data as $fkey => $value)
|
||||||
{
|
{
|
||||||
if($file['id'] == null || $value['temp']['source'] == 'excel' || (($file['action'] == 'dependent_addition' && ($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)))) //insert data come from excel and from db i.e. ( $file['id'] == null for enrollment data)
|
if(is_array($value))
|
||||||
{
|
{
|
||||||
|
|
||||||
$employee = $this->employeeModel->checkExistingEmp($value,$file['client_branch_id']);
|
|
||||||
$policy_data = $value['policy_details'];
|
|
||||||
$temp = $value['temp'];
|
|
||||||
unset($value['policy_details']);
|
|
||||||
unset($value['temp']);
|
|
||||||
// Kint::dump($value);
|
|
||||||
// Kint::dump($temp);
|
|
||||||
// Kint::dump($policy_data);
|
|
||||||
// echo '---------------------------------------';
|
|
||||||
|
|
||||||
//start implemet of si enhancement of grid type 10,11
|
if($file['id'] == null || $value['temp']['source'] == 'excel' || (($file['action'] == 'dependent_addition' && ($value['temp']['premium_type'] == 1 && strtolower($value['relationship']) == 'self') || ($value['temp']['premium_type'] == 2 || $value['temp']['premium_type'] == null)))) //insert data come from excel and from db i.e. ( $file['id'] == null for enrollment data)
|
||||||
if(count($employee) && $file['action'] == 'dependent_addition' && $temp['source'] == 'db' && in_array($value['temp']['grid_id'],[10,11]) && ( ($slab_details['slab_rates'][0]['premium_type'] == 1 && (strtolower($value['relationship']) == 'self' || $temp['additional_rack_rate_acting_self'])) || ($slab_details['slab_rates'][0]['premium_type'] == 2 || $slab_details['slab_rates'][0]['premium_type'] == null)))
|
|
||||||
{
|
|
||||||
$log_message = 'Employee record from DB,Checking SI for - '.$employee[0]['name'].'('.$employee[0]['emp_code'].')';
|
|
||||||
$this->myLogger->logme('error',$log_message);
|
|
||||||
$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
|
|
||||||
|
|
||||||
break;//skip db employee
|
|
||||||
}
|
|
||||||
//end implemet of si enhancement of grid type
|
|
||||||
|
|
||||||
//save employee table
|
|
||||||
if(count($employee))
|
|
||||||
{
|
|
||||||
$value['updated_by'] = $file['created_by'];
|
|
||||||
$value['id'] = $employee[0]['id'];
|
|
||||||
$value['emp_status'] = 'active';
|
|
||||||
$value['client_branch_id'] = $file['client_branch_id'];
|
|
||||||
$log_message = 'Update Employee - '.$employee[0]['name'].'('.$employee[0]['emp_code'].') with PK '.$employee[0]['id'];
|
|
||||||
// $this->myLogger->logme('error',('Update - ' . $employee[0]['id'].' - '. $employee[0]['emp_code'] .' - '.$employee[0]['name']));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$value['emp_status'] = 'active';
|
|
||||||
$value['created_by'] = $file['created_by'];
|
|
||||||
$value['client_branch_id'] = $file['client_branch_id'];
|
|
||||||
$log_message = 'Insert Employee- '.$value['name'] .'('.$value['emp_code'] .') with PK ';
|
|
||||||
// $this->myLogger->logme('error',('Insert - ' . $value['emp_code'] .' - '. $value['name']));
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->employeeModel->save($value);
|
|
||||||
$emp_id = $this->employeeModel->getInsertID();
|
|
||||||
if($emp_id != 0){ $log_message .= $emp_id; }
|
|
||||||
else{ $emp_id = $employee[0]['id']; }
|
|
||||||
|
|
||||||
$this->myLogger->logme('error',$log_message);
|
|
||||||
|
|
||||||
//save policy table
|
|
||||||
$employee_policy = $this->employeePolicyModel->checkExistingEmpPolicy(['employee_id' => $emp_id,'client_policy_id' => $file['policy_id']]);
|
|
||||||
if(count($employee_policy))
|
|
||||||
{
|
|
||||||
$policy_data['updated_by'] = $file['created_by'];
|
|
||||||
$policy_data['id'] = $employee_policy[0]['id'];
|
|
||||||
$policy_data['status'] = 'active';
|
|
||||||
|
|
||||||
$log_message = 'Update Employee Policy for '. $value['name'].'('. $value['emp_code'].') with PK- ' . $employee_policy[0]['id'] .' client policy ID '.$employee_policy[0]['client_policy_id'].' with SI '.$policy_data['basic_cover_si'];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$policy_data['employee_id'] = $emp_id;
|
|
||||||
$policy_data['client_policy_id'] = $file['policy_id'];
|
|
||||||
$policy_data['created_by'] = $file['created_by'];
|
|
||||||
$policy_data['status'] = 'active';
|
|
||||||
$log_message = 'Insert Employee Policy for '. $value['name'].'('. $value['emp_code'].') - client policy id -'. $file['policy_id'].' - with SI '.$policy_data['basic_cover_si'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->employeePolicyModel->save($policy_data);
|
|
||||||
$emp_policy_id = $this->employeePolicyModel->getInsertID();
|
|
||||||
if($emp_policy_id != 0)//emp policy inserted
|
|
||||||
{
|
|
||||||
$log_message .= ' with PK ' . $emp_policy_id;
|
|
||||||
|
|
||||||
//make endorsement entry if action is addition OR Dependt addition
|
|
||||||
if(($file['action'] == 'dependent_addition' || $file['action'] == 'addition') && $temp['source'] == 'excel')
|
|
||||||
{
|
{
|
||||||
$log_message = $file['action'].' - endorsement'. $value['emp_code'].' - '.$value['name'].' - with policy id'.$emp_policy_id;
|
|
||||||
$this->myLogger->logme('error',$log_message);
|
|
||||||
$actions = ($file['action'] == 'dependent_addition' ? 'da' : ($file['action'] == 'addition' ? 'a' : NULL));
|
|
||||||
$addition_endorse_data = ['pk' => $emp_policy_id,'group_key' => rand(100000, 999999),'emp_code' => $value['emp_code'],'table_name' => 'employee_polices','actions' => $actions,'name' => $value['name'],'field_name' => 'basic_cover_si','old_value' => NULL,'new_value' => $policy_data['basic_cover_si'],'remarks' => 'addition endorsement','file_id' => $file['id'],'created_by' => $file['created_by']];
|
|
||||||
$this->employeeEndorsementforAddtionAndDependentAddition($addition_endorse_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
$employee = $this->employeeModel->checkExistingEmp($value,$file['client_branch_id']);
|
||||||
else{ $emp_policy_id = $employee_policy[0]['id']; }
|
$policy_data = $value['policy_details'];
|
||||||
|
$temp = $value['temp'];
|
||||||
|
unset($value['policy_details']);
|
||||||
|
unset($value['temp']);
|
||||||
|
// Kint::dump($value);
|
||||||
|
// Kint::dump($temp);
|
||||||
|
// Kint::dump($policy_data);
|
||||||
|
// echo '---------------------------------------';
|
||||||
|
|
||||||
$this->myLogger->logme('error',$log_message);
|
//start implemet of si enhancement of grid type 10,11
|
||||||
|
if(count($employee) && $file['action'] == 'dependent_addition' && $temp['source'] == 'db' && in_array($value['temp']['grid_id'],[10,11]) && ( ($value['temp']['premium_type'] == 1 && (strtolower($value['relationship']) == 'self' || $temp['acting_self'])) || ($value['temp']['premium_type'] == 2 || $value['temp']['premium_type'] == null)))
|
||||||
|
{
|
||||||
|
$log_message = 'Employee record from DB,Checking SI for - '.$employee[0]['name'].'('.$employee[0]['emp_code'].')';
|
||||||
|
$this->myLogger->logme('error',$log_message);
|
||||||
|
$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
|
||||||
|
|
||||||
|
break;//skip db employee
|
||||||
|
}
|
||||||
|
//end implemet of si enhancement of grid type
|
||||||
|
|
||||||
|
//save employee table
|
||||||
|
$value['relationship'] = ucfirst(trim($value['relationship']));
|
||||||
|
if(count($employee))
|
||||||
|
{
|
||||||
|
$value['updated_by'] = $file['created_by'];
|
||||||
|
$value['id'] = $employee[0]['id'];
|
||||||
|
$value['emp_status'] = 'active';
|
||||||
|
$value['client_branch_id'] = $file['client_branch_id'];
|
||||||
|
$log_message = 'Update Employee - '.$employee[0]['name'].'('.$employee[0]['emp_code'].') with PK '.$employee[0]['id'];
|
||||||
|
// $this->myLogger->logme('error',('Update - ' . $employee[0]['id'].' - '. $employee[0]['emp_code'] .' - '.$employee[0]['name']));
|
||||||
|
// echo 'insert emp';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$value['emp_status'] = 'active';
|
||||||
|
$value['created_by'] = $file['created_by'];
|
||||||
|
$value['client_branch_id'] = $file['client_branch_id'];
|
||||||
|
$log_message = 'Insert Employee- '.$value['name'] .'('.$value['emp_code'] .') with PK ';
|
||||||
|
// $this->myLogger->logme('error',('Insert - ' . $value['emp_code'] .' - '. $value['name']));
|
||||||
|
// echo 'update emp';
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->employeeModel->save($value);
|
||||||
|
$emp_id = $this->employeeModel->getInsertID();
|
||||||
|
if($emp_id != 0){ $log_message .= $emp_id; }
|
||||||
|
else{ $emp_id = $employee[0]['id']; }
|
||||||
|
|
||||||
|
$this->myLogger->logme('error',$log_message);
|
||||||
|
|
||||||
|
//save policy table
|
||||||
|
$employee_policy = $this->employeePolicyModel->checkExistingEmpPolicy(['employee_id' => $emp_id,'client_policy_id' => $file['policy_id']]);
|
||||||
|
if(count($employee_policy))
|
||||||
|
{
|
||||||
|
$policy_data['updated_by'] = $file['created_by'];
|
||||||
|
$policy_data['id'] = $employee_policy[0]['id'];
|
||||||
|
$policy_data['status'] = 'active';
|
||||||
|
|
||||||
|
$log_message = 'Update Employee Policy for '. $value['name'].'('. $value['emp_code'].') with PK- ' . $employee_policy[0]['id'] .' client policy ID '.$employee_policy[0]['client_policy_id'].' with SI '.$policy_data['basic_cover_si'];
|
||||||
|
// echo 'insert policy';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$policy_data['employee_id'] = $emp_id;
|
||||||
|
$policy_data['client_policy_id'] = $file['policy_id'];
|
||||||
|
$policy_data['created_by'] = $file['created_by'];
|
||||||
|
$policy_data['status'] = 'active';
|
||||||
|
$log_message = 'Insert Employee Policy for '. $value['name'].'('. $value['emp_code'].') - client policy id -'. $file['policy_id'].' - with SI '.$policy_data['basic_cover_si'];
|
||||||
|
// echo 'update policy';
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->employeePolicyModel->save($policy_data);
|
||||||
|
$emp_policy_id = $this->employeePolicyModel->getInsertID();
|
||||||
|
if($emp_policy_id != 0)//emp policy inserted
|
||||||
|
{
|
||||||
|
$log_message .= ' with PK ' . $emp_policy_id;
|
||||||
|
|
||||||
|
//make endorsement entry if action is addition OR Dependt addition
|
||||||
|
if(($file['action'] == 'missed_inception' || $file['action'] == 'dependent_addition' || $file['action'] == 'addition') && $temp['source'] == 'excel')
|
||||||
|
{
|
||||||
|
$log_message = $file['action'].' - endorsement'. $value['emp_code'].' - '.$value['name'].' - with policy id'.$emp_policy_id;
|
||||||
|
$this->myLogger->logme('error',$log_message);
|
||||||
|
$actions = ($file['action'] == 'dependent_addition' ? 'da' : ($file['action'] == 'addition' ? 'a' : NULL));
|
||||||
|
$addition_endorse_data = ['pk' => $emp_policy_id,'group_key' => rand(100000, 999999),'emp_code' => $value['emp_code'],'table_name' => 'employee_polices','actions' => $actions,'name' => $value['name'],'field_name' => 'basic_cover_si','old_value' => NULL,'new_value' => $policy_data['basic_cover_si'],'remarks' => 'addition endorsement','file_id' => $file['id'],'created_by' => $file['created_by']];
|
||||||
|
$this->employeeEndorsementforAddtionAndDependentAddition($addition_endorse_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else{ $emp_policy_id = $employee_policy[0]['id']; }
|
||||||
|
|
||||||
|
$this->myLogger->logme('error',$log_message);
|
||||||
|
|
||||||
}// if end
|
}// if end
|
||||||
}// for end
|
}// is array check end
|
||||||
|
}// for end
|
||||||
}//function end
|
}//function end
|
||||||
|
|
||||||
|
|
||||||
@ -1748,10 +1831,10 @@ class EmployeeServiceController extends AdminController
|
|||||||
public function getFileMetaDataByFileId($file_id, $status = 'success'){
|
public function getFileMetaDataByFileId($file_id, $status = 'success'){
|
||||||
|
|
||||||
$data = $this->fileModel
|
$data = $this->fileModel
|
||||||
->select('files.*, clients.client_name, clients.short_name, policies.name as policy_name,client_branch.branch_code')
|
->select('files.*, clients.client_name, clients.short_name, policy_type.policy_type as policy_name,client_branch.branch_code')
|
||||||
->join('clients', 'clients.id = files.client_id')
|
->join('clients', 'clients.id = files.client_id')
|
||||||
->join('client_policy', 'client_policy.id = files.policy_id')
|
->join('client_policy', 'client_policy.id = files.policy_id')
|
||||||
->join('policies', 'policies.id = client_policy.policy_id')
|
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
||||||
->join('client_branch', 'client_branch.id = files.client_branch_id','left')
|
->join('client_branch', 'client_branch.id = files.client_branch_id','left')
|
||||||
->where('files.id', $file_id)
|
->where('files.id', $file_id)
|
||||||
->first();
|
->first();
|
||||||
@ -1792,8 +1875,173 @@ class EmployeeServiceController extends AdminController
|
|||||||
$this->messageModel->insert($msg_data);
|
$this->messageModel->insert($msg_data);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function employeesEnrollmentInsert($params)
|
||||||
|
{
|
||||||
|
|
||||||
|
helper('excel_util_helper');
|
||||||
|
//get file name
|
||||||
|
$file_id = $params['file_id'];
|
||||||
|
$file = $this->fileModel->find($file_id);
|
||||||
|
// dd($file);
|
||||||
|
$return = [];
|
||||||
|
if(!isset($file))
|
||||||
|
{
|
||||||
|
//file not found in DB
|
||||||
|
return array('status' => false, 'msg' => 'file not found in DB');
|
||||||
|
}
|
||||||
|
$file_name_with_path = WRITEPATH."/uploads/excel/".$file['file_name'];
|
||||||
|
|
||||||
|
//check physical file
|
||||||
|
if(!file_exists($file_name_with_path))
|
||||||
|
{
|
||||||
|
//file not found update status and reason
|
||||||
|
$message = "Physical file not found";
|
||||||
|
// echo $message;
|
||||||
|
$this->myLogger->logme('error',($message . ' for file id ' . $file_id));
|
||||||
|
$this->fileModel->where('id', $file_id)->set(['status' => 'failed','reason' => json_encode(['error_summary' => array_count_values([5]),'error_data' => $message])])->update();
|
||||||
|
return array('error_summary' => [5], 'error_data' => $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
//get excel data
|
||||||
|
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path);
|
||||||
|
$sheet = $spreadsheet->getActiveSheet();
|
||||||
|
|
||||||
|
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
||||||
|
$result = ['error_type' => 2,'error_summary' => [], 'error_data' => [] ];
|
||||||
|
$columns_to_check = $this->enrollment_excel_columns;
|
||||||
|
$keys = array_keys($columns_to_check);
|
||||||
|
$allowedHighestColumn = end($columns_to_check);
|
||||||
|
$excel_data = $sheet->rangeToArray('A1:' . $allowedHighestColumn['col_cell_name'] . $highestRowAndColumn['row']);
|
||||||
|
// print_r($keys);die();
|
||||||
|
|
||||||
|
//remove header
|
||||||
|
unset($excel_data[0]);
|
||||||
|
// dd($excel_data);
|
||||||
|
$emp_emails = [];
|
||||||
|
|
||||||
|
//check is welcome notification enabled
|
||||||
|
$notification = $this->notificationModel->where('client_id',$file['client_id'])->where('template_name','member_welcome_mail')->first();
|
||||||
|
// dd($notification);
|
||||||
|
$client_details = $this->clientModel->where('id', $file['client_id'])->first();
|
||||||
|
|
||||||
|
foreach ($excel_data as $key => $row)
|
||||||
|
{
|
||||||
|
// dd($key.'-'.count($excel_data));
|
||||||
|
$value = [];
|
||||||
|
$policy_data = [];
|
||||||
|
|
||||||
|
$value['emp_code'] = $row[1];
|
||||||
|
$value['name'] = $row[2];
|
||||||
|
$value['doj'] = (!empty($row[3]) ? convert_string_to_date($row[3],'Y-m-d'): null);
|
||||||
|
$value['gender'] = $row[4];
|
||||||
|
$value['relationship'] = ucfirst(trim($row[5]));
|
||||||
|
$value['dob'] = convert_string_to_date($row[6],'Y-m-d');
|
||||||
|
$value['email_corporate'] = $row[7];
|
||||||
|
$value['mobile'] = $row[8];
|
||||||
|
$value['band'] = $row[10];
|
||||||
|
$value['basic_pay'] = $row[11];
|
||||||
|
$value['unit'] = $row[12];
|
||||||
|
$value['family_floater_key'] = null;
|
||||||
|
$value['client_id'] = $file['client_id'];
|
||||||
|
$value['client_branch_id'] = $file['client_branch_id'];
|
||||||
|
|
||||||
|
$value['temp']['emp_id'] = null; // dummy value for using exisitng funciton in model
|
||||||
|
if (strtolower(trim($value['relationship'])) === 'mother' || strtolower(trim($value['relationship'])) === 'Father') {
|
||||||
|
$relation = 'parent';
|
||||||
|
} else if(strtolower(trim($value['relationship'])) === 'son' || strtolower(trim($value['relationship'])) === 'daughter'){
|
||||||
|
$relation = 'child';
|
||||||
|
}else if(strtolower(trim($value['relationship'])) === 'father in Law' || strtolower(trim($value['relationship'])) === 'mother in Law'){
|
||||||
|
$relation = 'parent_in_law';
|
||||||
|
}else if(strtolower(trim($value['relationship'])) === 'spouse'){
|
||||||
|
$relation = 'spouse';
|
||||||
|
}else{
|
||||||
|
$relation = 'self';
|
||||||
|
}
|
||||||
|
$value['family_floater_key'] = $relation;
|
||||||
|
|
||||||
|
$policy_data['basic_cover_si'] = $row[9];
|
||||||
|
$policy_data['client_policy_id'] = $file['policy_id'];
|
||||||
|
|
||||||
|
$employee = $this->employeeModel->checkExistingEmployee($value,$file['client_branch_id']);
|
||||||
|
unset($value['temp']);
|
||||||
|
//save employee table
|
||||||
|
// dd($employee['id']);
|
||||||
|
if($employee !== null)
|
||||||
|
{
|
||||||
|
$value['updated_by'] = $file['created_by'];
|
||||||
|
$value['id'] = $employee['id'];
|
||||||
|
$value['emp_status'] = 'draft';
|
||||||
|
|
||||||
|
$log_message = 'Enrollment Update Employee - '.$employee['name'].'('.$employee['emp_code'].') with PK '.$employee['id'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$value['emp_status'] = 'draft';
|
||||||
|
$value['created_by'] = $file['created_by'];
|
||||||
|
$log_message = 'Enrollment Insert Employee- '.$value['name'] .'('.$value['emp_code'] .') with PK ';
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->employeeModel->save($value);
|
||||||
|
$emp_id = $this->employeeModel->getInsertID();
|
||||||
|
if($emp_id != 0){ $log_message .= $emp_id; }
|
||||||
|
else{ $emp_id = $employee['id']; }
|
||||||
|
|
||||||
|
$this->myLogger->logme('error',$log_message);
|
||||||
|
|
||||||
|
//save policy table
|
||||||
|
$employee_policy = $this->employeePolicyModel->checkExistingEmpPolicy(['employee_id' => $emp_id,'client_policy_id' => $file['policy_id']]);
|
||||||
|
if(count($employee_policy))
|
||||||
|
{
|
||||||
|
$policy_data['updated_by'] = $file['created_by'];
|
||||||
|
$policy_data['id'] = $employee_policy[0]['id'];
|
||||||
|
$policy_data['status'] = 'draft';
|
||||||
|
|
||||||
|
$log_message = 'Update Employee Policy for '. $value['name'].'('. $value['emp_code'].') with PK- ' . $employee_policy[0]['id'] .' client policy ID '.$employee_policy[0]['client_policy_id'].' with SI '.$policy_data['basic_cover_si'];
|
||||||
|
// echo 'insert policy';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$policy_data['employee_id'] = $emp_id;
|
||||||
|
$policy_data['client_policy_id'] = $file['policy_id'];
|
||||||
|
$policy_data['created_by'] = $file['created_by'];
|
||||||
|
$policy_data['status'] = 'draft';
|
||||||
|
$log_message = 'Insert Employee Policy for '. $value['name'].'('. $value['emp_code'].') - client policy id -'. $file['policy_id'].' - with SI '.$policy_data['basic_cover_si'];
|
||||||
|
// echo 'update policy';
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->employeePolicyModel->save($policy_data);
|
||||||
|
$emp_policy_id = $this->employeePolicyModel->getInsertID();
|
||||||
|
$this->myLogger->logme('error',$log_message);
|
||||||
|
|
||||||
|
//save email of self for send mail later
|
||||||
|
if (isset($notification) && $notification['enabled'] == 1 && $notification['mail_content'] != '')
|
||||||
|
{
|
||||||
|
if(strtolower($value['relationship']) == 'self' && $value['email_corporate'] != "")
|
||||||
|
{
|
||||||
|
$params['dataToInsert'] = $value; //holds employee master data
|
||||||
|
$params['notification'] = $notification;
|
||||||
|
$params['client_data'] = $client_details;
|
||||||
|
|
||||||
|
//store email and mail content via helper to send notification
|
||||||
|
$emp_emails[] = sendMailNotification::sendMailNotification('member_welcome_mail', $params);
|
||||||
|
Kint::dump($emp_emails);
|
||||||
|
Kint::dump($key.'-'.count($excel_data));
|
||||||
|
// if mail count is 20 send bulk mail and reset emp_emails variable
|
||||||
|
if (count($emp_emails) == 20 || $key == count($excel_data) ) {
|
||||||
|
$job_details = new Jobs();
|
||||||
|
$r = Jobs::addJob(['job_name' => 'bulk_mail','payload' => $emp_emails]);
|
||||||
|
echo 'Mail triggered';
|
||||||
|
$emp_emails = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} //end of for loop
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,13 @@ namespace App\Controllers;
|
|||||||
|
|
||||||
|
|
||||||
use App\Models\JobModel;
|
use App\Models\JobModel;
|
||||||
|
use App\Models\ClientModel;
|
||||||
|
use App\Models\ClientPolicyModel;
|
||||||
|
use App\Models\NotificationModel;
|
||||||
|
use App\Models\EmployeePolicyModel;
|
||||||
|
|
||||||
|
use App\Helpers\sendMailNotification;
|
||||||
|
|
||||||
class JobWorker extends AdminController
|
class JobWorker extends AdminController
|
||||||
{
|
{
|
||||||
const STATUS_DONE = 'done';
|
const STATUS_DONE = 'done';
|
||||||
@ -14,25 +21,120 @@ class JobWorker extends AdminController
|
|||||||
* Constructs the class
|
* Constructs the class
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private static $event_class_mapping = [
|
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'],
|
'add' => [
|
||||||
|
'type' => 'HC', // Handler Category (Possible values: HC, CC, HF)
|
||||||
|
'handler' => 'App\Helpers\HttpRequestHelper',
|
||||||
|
],
|
||||||
|
'sub' => [
|
||||||
|
'type' => 'CC', // Handler Category
|
||||||
|
'handler' => 'App\Controllers\Jobs\SubJob',
|
||||||
|
],
|
||||||
|
'fancy_date_time_format' => [
|
||||||
|
'type' => 'HF', // Handler Category (Possible values: HC, CC, HF)
|
||||||
|
'handler' => 'fancy_date_time_format', // Likely a custom function
|
||||||
|
],
|
||||||
|
'addNumber' => [
|
||||||
|
'type' => 'HC', // Handler Category
|
||||||
|
'handler' => 'App\Model\HttpRequestHelper',
|
||||||
|
],
|
||||||
|
'excelFileFormatValidation' => [
|
||||||
|
'type' => 'CC', // Handler Category
|
||||||
|
'handler' => 'App\Controllers\EmployeeServiceController',
|
||||||
|
],
|
||||||
|
'excelFileDataValidation' => [
|
||||||
|
'type' => 'CC', // Handler Category
|
||||||
|
'handler' => 'App\Controllers\EmployeeServiceController',
|
||||||
|
],
|
||||||
|
'employeesOnboardPreprocess' => [
|
||||||
|
'type' => 'CC', // Handler Category
|
||||||
|
'handler' => 'App\Controllers\EmployeeServiceController',
|
||||||
|
],
|
||||||
|
'employeeDisembark' => [
|
||||||
|
'type' => 'CC', // Handler Category
|
||||||
|
'handler' => 'App\Controllers\EmployeeServiceController',
|
||||||
|
],
|
||||||
|
'employeesSIEnhanceProcess' => [
|
||||||
|
'type' => 'CC', // Handler Category
|
||||||
|
'handler' => 'App\Controllers\EmployeeServiceController',
|
||||||
|
],
|
||||||
|
'employeesCorrectionProcess' => [
|
||||||
|
'type' => 'CC', // Handler Category
|
||||||
|
'handler' => 'App\Controllers\EmployeeServiceController',
|
||||||
|
],
|
||||||
|
'send_email' => [
|
||||||
|
'type' => 'HC', // Handler Category
|
||||||
|
'handler' => 'App\Helpers\MailHelper',
|
||||||
|
],
|
||||||
|
'bulk_mail' => [
|
||||||
|
'type' => 'HC', // Handler Category
|
||||||
|
'handler' => 'App\Helpers\MailHelper',
|
||||||
|
],
|
||||||
|
'insertBatchList' => [
|
||||||
|
'type' => 'CC', // Handler Category
|
||||||
|
'handler' => 'App\Controllers\EmpDataServiceController',
|
||||||
|
],
|
||||||
|
|
||||||
'importInceptionFileValidation' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
// Employee Data Service Events
|
||||||
'importInceptionUpdateTPAandUHID' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
'importInceptionFileValidation' => [
|
||||||
'cashDepositCalculationForInception' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
'type' => 'CC', // Handler Category
|
||||||
'sendMailForDownloadingECard' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
'handler' => 'App\Controllers\EmpDataServiceController',
|
||||||
|
],
|
||||||
|
'importInceptionUpdateTPAandUHID' => [
|
||||||
|
'type' => 'CC', // Handler Category
|
||||||
|
'handler' => 'App\Controllers\EmpDataServiceController',
|
||||||
|
],
|
||||||
|
'cashDepositCalculationForInception' => [
|
||||||
|
'type' => 'CC', // Handler Category
|
||||||
|
'handler' => 'App\Controllers\EmpDataServiceController',
|
||||||
|
],
|
||||||
|
'sendMailForDownloadingECard' => [
|
||||||
|
'type' => 'CC', // Handler Category
|
||||||
|
'handler' => 'App\Controllers\EmpDataServiceController',
|
||||||
|
],
|
||||||
|
|
||||||
|
'importCorrectionValidation' => [
|
||||||
|
'type' => 'CC', // Handler Category
|
||||||
|
'handler' => 'App\Controllers\EmpDataServiceController',
|
||||||
|
],
|
||||||
|
'importCorrectionUpdateEndorsementID' => [
|
||||||
|
'type' => 'CC', // Handler Category
|
||||||
|
'handler' => 'App\Controllers\EmpDataServiceController',
|
||||||
|
],
|
||||||
|
|
||||||
|
'cashDepositCalculationForSIEnhancement' => [
|
||||||
|
'type' => 'CC', // Handler Category
|
||||||
|
'handler' => 'App\Controllers\EmpDataServiceController',
|
||||||
|
],
|
||||||
|
'importSIEnhancementValidation' => [
|
||||||
|
'type' => 'CC', // Handler Category
|
||||||
|
'handler' => 'App\Controllers\EmpDataServiceController',
|
||||||
|
],
|
||||||
|
'importSIEnhancementUpdateEndorsementID' => [
|
||||||
|
'type' => 'CC', // Handler Category
|
||||||
|
'handler' => 'App\Controllers\EmpDataServiceController',
|
||||||
|
],
|
||||||
|
|
||||||
|
'cashDepositCalculationForDeletion' => [
|
||||||
|
'type' => 'CC', // Handler Category
|
||||||
|
'handler' => 'App\Controllers\EmpDataServiceController',
|
||||||
|
],
|
||||||
|
'importDeletionValidation' => [
|
||||||
|
'type' => 'CC', // Handler Category
|
||||||
|
'handler' => 'App\Controllers\EmpDataServiceController',
|
||||||
|
],
|
||||||
|
'importDeletionUpdateEndorsementID' => [
|
||||||
|
'type' => 'CC', // Handler Category
|
||||||
|
'handler' => 'App\Controllers\EmpDataServiceController',
|
||||||
|
],
|
||||||
|
'employeesEnrollmentInsert' => [
|
||||||
|
'type' => 'CC', // Handler Category
|
||||||
|
'handler' => 'App\Controllers\EmployeeServiceController',
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
'importCorrectionValidation' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
|
||||||
'importCorrectionUpdateEndorsementID' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
|
||||||
|
|
||||||
'cashDepositCalculationForSIEnhancement' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
|
||||||
'importSIEnhancementValidation' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
|
||||||
'importSIEnhancementUpdateEndorsementID' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
|
||||||
|
|
||||||
'cashDepositCalculationForDeletion' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
|
||||||
'importDeletionValidation' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
|
||||||
'importDeletionUpdateEndorsementID' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
|
||||||
];
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
// echo 'HiC';//die();
|
// echo 'HiC';//die();
|
||||||
@ -228,6 +330,71 @@ class JobWorker extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function enrollment_status() {
|
||||||
|
$clientModel = new ClientModel();
|
||||||
|
$clientPolicyModel = new ClientPolicyModel();
|
||||||
|
$notificationModel = new NotificationModel();
|
||||||
|
$employeePolicyModel = new EmployeePolicyModel();
|
||||||
|
$myLogger = \Config\Services::mylogger();
|
||||||
|
|
||||||
|
$client_policy_data = $clientPolicyModel->where('is_active', 1)
|
||||||
|
->where('policy_status', 1)
|
||||||
|
->where('inception_type', 2)
|
||||||
|
->findAll();
|
||||||
|
$currentDate = date('Y-m-d');
|
||||||
|
|
||||||
|
// Update policy status based on start and end dates
|
||||||
|
foreach ($client_policy_data as $client_policy) {
|
||||||
|
$id = $client_policy['id'];
|
||||||
|
|
||||||
|
if ($currentDate == $client_policy['policy_start_date']) {
|
||||||
|
$clientPolicyModel->update($id, ['open_for_enrollment' => 1]);
|
||||||
|
}
|
||||||
|
if ($client_policy['policy_end_date'] < $currentDate) {
|
||||||
|
$clientPolicyModel->update($id, ['open_for_enrollment' => 0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$reminder_whole_mail = [];
|
||||||
|
foreach ($client_policy_data as $client_policy) {
|
||||||
|
$employee = $employeePolicyModel->select('employees.*')
|
||||||
|
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
|
||||||
|
->where('employee_polices.client_policy_id', $client_policy['id'])
|
||||||
|
->first();
|
||||||
|
$client_data = $clientModel->find($client_policy['client_id']);
|
||||||
|
$notification_data = $notificationModel->where('client_id', $client_policy['client_id'])
|
||||||
|
->where('template_name', 'member_reminder_mail')
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($notification_data && $notification_data['enabled'] == 1 && $currentDate == $client_policy['reminder_date']) {
|
||||||
|
$params['emp_data'] = $employee;
|
||||||
|
$params['client_data'] = $client_data;
|
||||||
|
$params['notification_data'] = $notification_data;
|
||||||
|
$reminder_whole_mail[] = sendMailNotification::sendMailNotification('member_reminder_mail', $params);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Process and queue bulk emails
|
||||||
|
$temp_whole_data = [];
|
||||||
|
$count = 0;
|
||||||
|
foreach ($reminder_whole_mail as $whole_index => $values) {
|
||||||
|
foreach ($values as $index => $value) {
|
||||||
|
$temp_whole_data[] = $value;
|
||||||
|
$count++;
|
||||||
|
|
||||||
|
if ($count == 20 || ($whole_index == count($reminder_whole_mail) - 1 && $index == count($values) - 1)) {
|
||||||
|
if (!empty($temp_whole_data)) {
|
||||||
|
Jobs::addJob(['job_name' => 'bulk_mail', 'payload' => $temp_whole_data]);
|
||||||
|
$temp_whole_data = [];
|
||||||
|
$count = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return json_encode(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1062,10 +1062,9 @@ class MasterController extends AdminController
|
|||||||
//start CD Master list
|
//start CD Master list
|
||||||
public function CDMasterList()
|
public function CDMasterList()
|
||||||
{
|
{
|
||||||
|
|
||||||
$data['CD_Master_Data'] = $this->CDMasterModel->getCDMasterList();
|
$data['CD_Master_Data'] = $this->CDMasterModel->getCDMasterList();
|
||||||
$data['insurers'] = $this->insurerModel->findAll();
|
$data['insurers'] = $this->insurerModel->where('is_active', 1)->findAll();
|
||||||
$data['clients'] = $this->clientModel->findAll();
|
$data['clients'] = $this->clientModel->where('is_active', 1)->findAll();
|
||||||
$this->loadLayout('cd_master_list', $data);
|
$this->loadLayout('cd_master_list', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1157,7 +1156,12 @@ class MasterController extends AdminController
|
|||||||
public function getCDMasterDataByID($id = null)
|
public function getCDMasterDataByID($id = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
$cd_data = $this->CDMasterModel->where('id', $id)->first();
|
$cd_data = $this->CDMasterModel
|
||||||
|
->where('id', $id)
|
||||||
|
->where('is_active', 1)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
// convert the date formate 2000-01-01 to 01-01-2000
|
||||||
$cd_data['opening_date'] = date('d-m-Y', strtotime($cd_data['opening_date']));
|
$cd_data['opening_date'] = date('d-m-Y', strtotime($cd_data['opening_date']));
|
||||||
|
|
||||||
if ($cd_data) {
|
if ($cd_data) {
|
||||||
@ -1169,7 +1173,10 @@ class MasterController extends AdminController
|
|||||||
|
|
||||||
public function checkUniqueCDAccountNumber($AccountNumber)
|
public function checkUniqueCDAccountNumber($AccountNumber)
|
||||||
{
|
{
|
||||||
$uniqueAC = $this->CDMasterModel->where('cd_ac_no', $AccountNumber)->findAll();
|
$uniqueAC = $this->CDMasterModel
|
||||||
|
->where('cd_ac_no', $AccountNumber)
|
||||||
|
->where('is_active', 1)
|
||||||
|
->findAll();
|
||||||
|
|
||||||
if($uniqueAC != null){
|
if($uniqueAC != null){
|
||||||
return $this->respond(['status' => true, 'message' => 'The CD Account Number is Already Exist', 'code' => 200], 200);
|
return $this->respond(['status' => true, 'message' => 'The CD Account Number is Already Exist', 'code' => 200], 200);
|
||||||
@ -1184,7 +1191,18 @@ class MasterController extends AdminController
|
|||||||
$this->myLogger->logme('error','CDMaster Remove function called');
|
$this->myLogger->logme('error','CDMaster Remove function called');
|
||||||
$data['updated_by'] = get_session_userid();
|
$data['updated_by'] = get_session_userid();
|
||||||
$data['is_active'] = 0;
|
$data['is_active'] = 0;
|
||||||
$update = $this->CDMasterModel->where('id', $id)->set($data)->update();
|
$cash_transaction_data = $this->CDMasterModel->where('id', $id)->first();
|
||||||
|
|
||||||
|
$update = $this->CDMasterModel->where('id', $id)->set($data)->update();
|
||||||
|
|
||||||
|
$cd_tranction_update = $this->clientDepositModel
|
||||||
|
->where('client_id', $cash_transaction_data['client_id'])
|
||||||
|
->where('insurer_id', $cash_transaction_data['insurer_id'])
|
||||||
|
->where('cd_ac_no', $cash_transaction_data['cd_ac_no'])
|
||||||
|
->where('sub_type', 7)
|
||||||
|
->set($data)
|
||||||
|
->update();
|
||||||
|
|
||||||
if($update){
|
if($update){
|
||||||
return $this->respond(['status' => true,'code' => 200], 200);
|
return $this->respond(['status' => true,'code' => 200], 200);
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@ -7,7 +7,6 @@ use CodeIgniter\HTTP\RequestInterface;
|
|||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
use App\Helpers\DepositHelper;
|
|
||||||
use App\Helpers\MailHelper;
|
use App\Helpers\MailHelper;
|
||||||
use App\Helpers\sendMailNotification;
|
use App\Helpers\sendMailNotification;
|
||||||
|
|
||||||
@ -43,10 +42,10 @@ class PendingActionsController extends AdminController
|
|||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
//section
|
//session
|
||||||
set_session_context('PendingActionsController Called');
|
set_session_context('PendingActionsController Called');
|
||||||
|
|
||||||
//services
|
//log services
|
||||||
$this->myLogger = \Config\Services::mylogger();
|
$this->myLogger = \Config\Services::mylogger();
|
||||||
$this->db = \Config\Database::connect();
|
$this->db = \Config\Database::connect();
|
||||||
|
|
||||||
@ -60,7 +59,7 @@ class PendingActionsController extends AdminController
|
|||||||
$this->empEndorsementModel = new EmpEndorsementModel();
|
$this->empEndorsementModel = new EmpEndorsementModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//for AJAX
|
||||||
public function getPendingActions()
|
public function getPendingActions()
|
||||||
{
|
{
|
||||||
//get pending actions like inception, corrections,deletions,SI enhanccnement to users
|
//get pending actions like inception, corrections,deletions,SI enhanccnement to users
|
||||||
@ -71,13 +70,145 @@ class PendingActionsController extends AdminController
|
|||||||
$deletion = $this->getPendingActionForDeletion();
|
$deletion = $this->getPendingActionForDeletion();
|
||||||
$tpa = $this->getPendingActionForTPAIDEmpty();
|
$tpa = $this->getPendingActionForTPAIDEmpty();
|
||||||
$uhid = $this->getPendingActionForUHIDEmpty();
|
$uhid = $this->getPendingActionForUHIDEmpty();
|
||||||
|
$PolicyRenewalData = $this->getPolicyRenewalDataForAllClient();
|
||||||
|
|
||||||
|
|
||||||
// dd($inception, $si_enhancement, $correction, $deletion, $tpa, $uhid);
|
// dd($inception, $si_enhancement, $correction, $deletion, $tpa, $uhid);
|
||||||
|
|
||||||
$data = ['inception' => $inception, 'correction' => $correction, 'si_enhancement' => $si_enhancement, 'deletion' => $deletion, 'tpa' => $tpa, 'uhid' => $uhid];
|
$data = ['inception' => $inception, 'correction' => $correction, 'si_enhancement' => $si_enhancement, 'deletion' => $deletion, 'tpa' => $tpa, 'uhid' => $uhid, 'policy' => $PolicyRenewalData];
|
||||||
return $this->respond($data);
|
return $this->respond($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//for NORMAL
|
||||||
|
public function getPendingActionsForClientData()
|
||||||
|
{
|
||||||
|
|
||||||
|
$inception = $this->getPendingActionForInception();
|
||||||
|
$correction = $this->getPendingActionForCorrection();
|
||||||
|
$si_enhancement = $this->getPendingActionForSIEnhancement();
|
||||||
|
$deletion = $this->getPendingActionForDeletion();
|
||||||
|
$tpa = $this->getPendingActionForTPAIDEmpty();
|
||||||
|
$uhid = $this->getPendingActionForUHIDEmpty();
|
||||||
|
$PolicyRenewalData = $this->getPolicyRenewalDataForAllClient();
|
||||||
|
|
||||||
|
// dd($inception, $si_enhancement, $correction, $deletion, $tpa, $uhid);
|
||||||
|
|
||||||
|
$data = ['inception' => $inception, 'correction' => $correction, 'si_enhancement' => $si_enhancement, 'deletion' => $deletion, 'tpa' => $tpa, 'uhid' => $uhid, 'policy' => $PolicyRenewalData];
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
//for only COUNT
|
||||||
|
public function getPendingActionsForDashBoard()
|
||||||
|
{
|
||||||
|
$tpa = $this->getPendingActionForTPAIDEmpty();
|
||||||
|
$uhid = $this->getPendingActionForUHIDEmpty();
|
||||||
|
$deletion = $this->getPendingActionForDeletion();
|
||||||
|
$inception = $this->getPendingActionForInception();
|
||||||
|
$ticketData = $this->getTicketsDataForDashBoard();
|
||||||
|
$correction = $this->getPendingActionForCorrection();
|
||||||
|
$si_enhancement = $this->getPendingActionForSIEnhancement();
|
||||||
|
$PolicyRenewalData = $this->getPolicyRenewalDataForAllClient();
|
||||||
|
|
||||||
|
$uhid_export_count = [];
|
||||||
|
$uhid_not_export_count = [];
|
||||||
|
foreach ($uhid as $value) {
|
||||||
|
if($value['batch_export_count'] == 1){
|
||||||
|
$uhid_export_count[] = $value['batch_export_count'];
|
||||||
|
}else{
|
||||||
|
$uhid_not_export_count[] = $value['batch_export_count'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$tpa_export_count = [];
|
||||||
|
$tpa_not_export_count = [];
|
||||||
|
foreach ($tpa as $value) {
|
||||||
|
if($value['batch_export_count'] == 1){
|
||||||
|
$tpa_export_count[] = $value['batch_export_count'];
|
||||||
|
}else{
|
||||||
|
$tpa_not_export_count[] = $value['batch_export_count'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$deletion_export_count = [];
|
||||||
|
$deletion_not_export_count = [];
|
||||||
|
foreach ($deletion as $value) {
|
||||||
|
if($value['batch_export_count'] == 1){
|
||||||
|
$deletion_export_count[] = $value['batch_export_count'];
|
||||||
|
}else{
|
||||||
|
$deletion_not_export_count[] = $value['batch_export_count'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$correction_export_count = [];
|
||||||
|
$correction_not_export_count = [];
|
||||||
|
foreach ($correction as $value) {
|
||||||
|
if($value['batch_export_count'] == 1){
|
||||||
|
$correction_export_count[] = $value['batch_export_count'];
|
||||||
|
}else{
|
||||||
|
$correction_not_export_count[] = $value['batch_export_count'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$si_export_count = [];
|
||||||
|
$si_not_export_count = [];
|
||||||
|
foreach ($si_enhancement as $value) {
|
||||||
|
if($value['batch_export_count'] == 1){
|
||||||
|
$si_export_count[] = $value['batch_export_count'];
|
||||||
|
}else{
|
||||||
|
$si_not_export_count[] = $value['batch_export_count'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// dd($uhid_export_count, $tpa_export_count ,$deletion_export_count, $correction_export_count, $si_export_count, $ticketData, $inception, $si_enhancement, $correction, $deletion, $tpa, $uhid, $PolicyRenewalData);
|
||||||
|
|
||||||
|
$inception = count($inception);
|
||||||
|
$correction = count($correction);
|
||||||
|
$si_enhancement = count($si_enhancement);
|
||||||
|
$deletion = count($deletion);
|
||||||
|
$tpa = count($tpa);
|
||||||
|
$uhid = count($uhid);
|
||||||
|
$PolicyRenewalData = count($PolicyRenewalData);
|
||||||
|
$ticketData = count($ticketData);
|
||||||
|
|
||||||
|
$uhid_export_count = count($uhid_export_count);
|
||||||
|
$tpa_export_count = count($tpa_export_count);
|
||||||
|
$deletion_export_count = count($deletion_export_count);
|
||||||
|
$correction_export_count = count($correction_export_count);
|
||||||
|
$si_export_count = count($si_export_count);
|
||||||
|
|
||||||
|
$uhid_not_export_count = count($uhid_not_export_count);
|
||||||
|
$tpa_not_export_count = count($tpa_not_export_count);
|
||||||
|
$deletion_not_export_count = count($deletion_not_export_count);
|
||||||
|
$correction_not_export_count = count($correction_not_export_count);
|
||||||
|
$si_not_export_count = count($si_not_export_count);
|
||||||
|
|
||||||
|
|
||||||
|
// dd($inception, $si_enhancement, $correction, $deletion, $tpa, $uhid, $PolicyRenewalData);
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'inception' => $inception,
|
||||||
|
'correction' => $correction,
|
||||||
|
'si_enhancement' => $si_enhancement,
|
||||||
|
'deletion' => $deletion,
|
||||||
|
'tpa' => $tpa,
|
||||||
|
'uhid' => $uhid,
|
||||||
|
'PolicyRenewalData' => $PolicyRenewalData,
|
||||||
|
'ticketData' => $ticketData,
|
||||||
|
|
||||||
|
'uhid_export_count' => $uhid_export_count,
|
||||||
|
'tpa_export_count' => $tpa_export_count,
|
||||||
|
'deletion_export_count' => $deletion_export_count,
|
||||||
|
'correction_export_count' => $correction_export_count,
|
||||||
|
'si_export_count' => $si_export_count,
|
||||||
|
|
||||||
|
'uhid_not_export_count' => $uhid_not_export_count,
|
||||||
|
'tpa_not_export_count' => $tpa_not_export_count,
|
||||||
|
'deletion_not_export_count' => $deletion_not_export_count,
|
||||||
|
'correction_not_export_count' => $correction_not_export_count,
|
||||||
|
'si_not_export_count' => $si_not_export_count,
|
||||||
|
];
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function getPendingActionForInception()
|
public function getPendingActionForInception()
|
||||||
{
|
{
|
||||||
@ -86,7 +217,7 @@ class PendingActionsController extends AdminController
|
|||||||
$builder = $this->db->table('client_policy cp');
|
$builder = $this->db->table('client_policy cp');
|
||||||
$builder->select('
|
$builder->select('
|
||||||
clients.client_name,
|
clients.client_name,
|
||||||
policies.name as policy_name,
|
policy_type.policy_type as policy_name,
|
||||||
cp.id as client_policy_id,
|
cp.id as client_policy_id,
|
||||||
cp.client_id,
|
cp.client_id,
|
||||||
cp.policy_id,
|
cp.policy_id,
|
||||||
@ -102,7 +233,7 @@ class PendingActionsController extends AdminController
|
|||||||
$builder->join('employee_polices ep', 'cp.id = ep.client_policy_id AND ep.is_active = 1', 'left');
|
$builder->join('employee_polices ep', 'cp.id = ep.client_policy_id AND ep.is_active = 1', 'left');
|
||||||
$builder->join('clients', 'cp.client_id = clients.id');
|
$builder->join('clients', 'cp.client_id = clients.id');
|
||||||
$builder->join('client_branch cb', 'cb.id = cp.client_branch_id');
|
$builder->join('client_branch cb', 'cb.id = cp.client_branch_id');
|
||||||
$builder->join('policies', 'cp.policy_id = policies.id');
|
$builder->join('policy_type', 'cp.policy_type_id = policy_type.id');
|
||||||
$builder->where('cp.is_active', 1);
|
$builder->where('cp.is_active', 1);
|
||||||
$builder->where('cp.open_for_enrollment', 1);
|
$builder->where('cp.open_for_enrollment', 1);
|
||||||
$builder->where('cp.is_addon', 1);
|
$builder->where('cp.is_addon', 1);
|
||||||
@ -121,7 +252,6 @@ class PendingActionsController extends AdminController
|
|||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getPendingActionForCorrection()
|
public function getPendingActionForCorrection()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -152,6 +282,7 @@ class PendingActionsController extends AdminController
|
|||||||
clients.id as client_id,
|
clients.id as client_id,
|
||||||
client_branch.id as branch_id,
|
client_branch.id as branch_id,
|
||||||
client_branch.branch_name,
|
client_branch.branch_name,
|
||||||
|
policy_type.policy_type as policy_name,
|
||||||
emp_endorsement.id,
|
emp_endorsement.id,
|
||||||
emp_endorsement.pk,
|
emp_endorsement.pk,
|
||||||
emp_endorsement.endorsement_id,
|
emp_endorsement.endorsement_id,
|
||||||
@ -161,10 +292,20 @@ class PendingActionsController extends AdminController
|
|||||||
emp_endorsement.actions,
|
emp_endorsement.actions,
|
||||||
emp_endorsement.name,
|
emp_endorsement.name,
|
||||||
emp_endorsement.status,
|
emp_endorsement.status,
|
||||||
employees.name as ename
|
employees.name as ename,
|
||||||
|
(
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM batch_files bl
|
||||||
|
WHERE bl.client_id = clients.id
|
||||||
|
AND bl.actions = "export"
|
||||||
|
AND bl.event_type = "correction"
|
||||||
|
AND bl.insurer_or_tpa = "tpa"
|
||||||
|
) AS export_count
|
||||||
')
|
')
|
||||||
->join('employees', 'emp_endorsement.pk = employees.id AND employees.is_active = 1 AND employees.emp_status = \'active\'')
|
->join('employees', 'emp_endorsement.pk = employees.id AND employees.is_active = 1 AND employees.emp_status = \'active\'')
|
||||||
->join('clients', 'employees.client_id = clients.id AND clients.is_active = 1', 'left')
|
->join('clients', 'employees.client_id = clients.id AND clients.is_active = 1', 'left')
|
||||||
|
->join('client_policy', 'client_policy.client_id = clients.id AND clients.is_active = 1', 'left')
|
||||||
|
->join('policy_type', 'client_policy.policy_type_id = policy_type.id ')
|
||||||
->join('client_branch', 'client_branch.id = employees.client_branch_id', 'left')
|
->join('client_branch', 'client_branch.id = employees.client_branch_id', 'left')
|
||||||
->where([
|
->where([
|
||||||
'emp_endorsement.actions' => 'c',
|
'emp_endorsement.actions' => 'c',
|
||||||
@ -195,14 +336,16 @@ class PendingActionsController extends AdminController
|
|||||||
$results = $query->getResultArray();
|
$results = $query->getResultArray();
|
||||||
|
|
||||||
|
|
||||||
$filteredResults = array_filter($results, function ($value) {
|
$filteredResults = [];
|
||||||
return $value['subquery_count'] != 0;
|
foreach ($results as $value) {
|
||||||
});
|
if ($value['subquery_count'] != 0) {
|
||||||
|
$filteredResults[] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $filteredResults;
|
return $filteredResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getPendingActionForSIEnhancement()
|
public function getPendingActionForSIEnhancement()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -234,8 +377,7 @@ class PendingActionsController extends AdminController
|
|||||||
client_branch.id as branch_id,
|
client_branch.id as branch_id,
|
||||||
client_branch.branch_name,
|
client_branch.branch_name,
|
||||||
client_policy.id as client_policy_id,
|
client_policy.id as client_policy_id,
|
||||||
policies.name as policy_name,
|
policy_type.policy_type as policy_name,
|
||||||
policies.id as pid,
|
|
||||||
emp_endorsement.id,
|
emp_endorsement.id,
|
||||||
emp_endorsement.pk,
|
emp_endorsement.pk,
|
||||||
emp_endorsement.endorsement_id,
|
emp_endorsement.endorsement_id,
|
||||||
@ -250,7 +392,7 @@ class PendingActionsController extends AdminController
|
|||||||
->join('client_policy', 'employee_polices.client_policy_id = client_policy.id AND client_policy.is_active = 1 AND client_policy.policy_status = 1')
|
->join('client_policy', 'employee_polices.client_policy_id = client_policy.id AND client_policy.is_active = 1 AND client_policy.policy_status = 1')
|
||||||
->join('clients', 'client_policy.client_id = clients.id AND clients.is_active = 1')
|
->join('clients', 'client_policy.client_id = clients.id AND clients.is_active = 1')
|
||||||
->join('client_branch', 'client_branch.id = client_policy.client_branch_id')
|
->join('client_branch', 'client_branch.id = client_policy.client_branch_id')
|
||||||
->join('policies', 'client_policy.policy_id = policies.id AND policies.is_active = 1')
|
->join('policy_type', 'client_policy.policy_type_id = policy_type.id')
|
||||||
->where([
|
->where([
|
||||||
'emp_endorsement.actions' => 'si',
|
'emp_endorsement.actions' => 'si',
|
||||||
'emp_endorsement.is_active' => 1,
|
'emp_endorsement.is_active' => 1,
|
||||||
@ -283,14 +425,16 @@ class PendingActionsController extends AdminController
|
|||||||
$results = $query->getResultArray();
|
$results = $query->getResultArray();
|
||||||
|
|
||||||
|
|
||||||
$filteredResults = array_filter($results, function ($value) {
|
$filteredResults = [];
|
||||||
return $value['subquery_count'] != 0;
|
foreach ($results as $value) {
|
||||||
});
|
if ($value['subquery_count'] != 0) {
|
||||||
|
$filteredResults[] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $filteredResults;
|
return $filteredResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getPendingActionForDeletion()
|
public function getPendingActionForDeletion()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -322,8 +466,7 @@ class PendingActionsController extends AdminController
|
|||||||
client_branch.id as branch_id,
|
client_branch.id as branch_id,
|
||||||
client_branch.branch_name,
|
client_branch.branch_name,
|
||||||
client_policy.id as client_policy_id,
|
client_policy.id as client_policy_id,
|
||||||
policies.name as policy_name,
|
policy_type.policy_type as policy_name,
|
||||||
policies.id as pid,
|
|
||||||
emp_endorsement.pk,
|
emp_endorsement.pk,
|
||||||
emp_endorsement.id,
|
emp_endorsement.id,
|
||||||
emp_endorsement.group_key,
|
emp_endorsement.group_key,
|
||||||
@ -338,7 +481,7 @@ class PendingActionsController extends AdminController
|
|||||||
->join('client_policy', 'employee_polices.client_policy_id = client_policy.id AND client_policy.is_active = 1 AND client_policy.policy_status = 1', 'left')
|
->join('client_policy', 'employee_polices.client_policy_id = client_policy.id AND client_policy.is_active = 1 AND client_policy.policy_status = 1', 'left')
|
||||||
->join('clients', 'client_policy.client_id = clients.id AND clients.is_active = 1', 'left')
|
->join('clients', 'client_policy.client_id = clients.id AND clients.is_active = 1', 'left')
|
||||||
->join('client_branch', 'client_branch.id = client_policy.client_branch_id', 'left')
|
->join('client_branch', 'client_branch.id = client_policy.client_branch_id', 'left')
|
||||||
->join('policies', 'client_policy.policy_id = policies.id AND policies.is_active = 1', 'left')
|
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
|
||||||
->where([
|
->where([
|
||||||
'emp_endorsement.actions' => 'd',
|
'emp_endorsement.actions' => 'd',
|
||||||
'emp_endorsement.is_active' => 1,
|
'emp_endorsement.is_active' => 1,
|
||||||
@ -346,7 +489,7 @@ class PendingActionsController extends AdminController
|
|||||||
'emp_endorsement.endorsement_id' => null,
|
'emp_endorsement.endorsement_id' => null,
|
||||||
'emp_endorsement.table_name' => 'employee_polices'
|
'emp_endorsement.table_name' => 'employee_polices'
|
||||||
])
|
])
|
||||||
->groupBy('emp_endorsement.pk, emp_endorsement.emp_code, emp_endorsement.actions, emp_endorsement.name');
|
->groupBy('emp_endorsement.pk, emp_endorsement.emp_code, emp_endorsement.actions, emp_endorsement.name');
|
||||||
|
|
||||||
// Build the main query
|
// Build the main query
|
||||||
$builder = $this->db->table('clients');
|
$builder = $this->db->table('clients');
|
||||||
@ -371,14 +514,16 @@ class PendingActionsController extends AdminController
|
|||||||
// Fetch the results
|
// Fetch the results
|
||||||
$results = $query->getResultArray();
|
$results = $query->getResultArray();
|
||||||
|
|
||||||
$filteredResults = array_filter($results, function ($value) {
|
$filteredResults = [];
|
||||||
return $value['subquery_count'] != 0;
|
foreach ($results as $value) {
|
||||||
});
|
if ($value['subquery_count'] != 0) {
|
||||||
|
$filteredResults[] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $filteredResults;
|
return $filteredResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getPendingActionForUHIDEmpty()
|
public function getPendingActionForUHIDEmpty()
|
||||||
{
|
{
|
||||||
// Subquery for batch_export_count
|
// Subquery for batch_export_count
|
||||||
@ -406,7 +551,7 @@ class PendingActionsController extends AdminController
|
|||||||
->select('ep.client_policy_id')
|
->select('ep.client_policy_id')
|
||||||
->select('c.client_name')
|
->select('c.client_name')
|
||||||
->select('c.short_name')
|
->select('c.short_name')
|
||||||
->select('p.name as policy_name')
|
->select('policy_type.policy_type as policy_name')
|
||||||
->select('ep.uhid')
|
->select('ep.uhid')
|
||||||
->select('cb.branch_name, cb.id as branch_id')
|
->select('cb.branch_name, cb.id as branch_id')
|
||||||
->select("($subQueryExport) AS batch_export_count", false)
|
->select("($subQueryExport) AS batch_export_count", false)
|
||||||
@ -414,11 +559,11 @@ class PendingActionsController extends AdminController
|
|||||||
->join('client_policy cp', 'ep.client_policy_id = cp.id AND cp.is_active = 1 AND cp.policy_status = 1')
|
->join('client_policy cp', 'ep.client_policy_id = cp.id AND cp.is_active = 1 AND cp.policy_status = 1')
|
||||||
->join('clients c', 'c.id = cp.client_id')
|
->join('clients c', 'c.id = cp.client_id')
|
||||||
->join('client_branch cb', 'cb.id = cp.client_branch_id')
|
->join('client_branch cb', 'cb.id = cp.client_branch_id')
|
||||||
->join('policies p', 'p.id = cp.policy_id')
|
->join('policy_type', 'policy_type.id = cp.policy_type_id')
|
||||||
->where('ep.uhid IS NULL')
|
->where('ep.uhid IS NULL')
|
||||||
->where('ep.status', 'active')
|
->where('ep.status', 'active')
|
||||||
->where('ep.is_active', 1)
|
->where('ep.is_active', 1)
|
||||||
->groupBy('ep.client_policy_id, ep.uhid, c.short_name, p.name')
|
->groupBy('ep.client_policy_id, ep.uhid, c.short_name, policy_type.policy_type')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
// Fetch the results
|
// Fetch the results
|
||||||
@ -427,7 +572,6 @@ class PendingActionsController extends AdminController
|
|||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getPendingActionForTPAIDEmpty()
|
public function getPendingActionForTPAIDEmpty()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -459,7 +603,7 @@ class PendingActionsController extends AdminController
|
|||||||
employee_polices.tpa_id,
|
employee_polices.tpa_id,
|
||||||
clients.short_name,
|
clients.short_name,
|
||||||
clients.client_name,
|
clients.client_name,
|
||||||
policies.name as policy_name,
|
policy_type.policy_type as policy_name,
|
||||||
clients.id as client_id,
|
clients.id as client_id,
|
||||||
client_branch.id as branch_id,
|
client_branch.id as branch_id,
|
||||||
client_branch.branch_name
|
client_branch.branch_name
|
||||||
@ -470,7 +614,7 @@ class PendingActionsController extends AdminController
|
|||||||
$builder->join('client_policy', 'employee_polices.client_policy_id = client_policy.id AND client_policy.is_active = 1 AND client_policy.policy_status = 1');
|
$builder->join('client_policy', 'employee_polices.client_policy_id = client_policy.id AND client_policy.is_active = 1 AND client_policy.policy_status = 1');
|
||||||
$builder->join('clients', 'clients.id = client_policy.client_id');
|
$builder->join('clients', 'clients.id = client_policy.client_id');
|
||||||
$builder->join('client_branch', 'client_branch.id = client_policy.client_branch_id');
|
$builder->join('client_branch', 'client_branch.id = client_policy.client_branch_id');
|
||||||
$builder->join('policies', 'policies.id = client_policy.policy_id');
|
$builder->join('policy_type', 'policy_type.id = client_policy.policy_type_id');
|
||||||
$builder->where('employee_polices.tpa_id', null);
|
$builder->where('employee_polices.tpa_id', null);
|
||||||
$builder->where('employee_polices.uhid IS NOT NULL');
|
$builder->where('employee_polices.uhid IS NOT NULL');
|
||||||
$builder->where('employee_polices.status', 'active');
|
$builder->where('employee_polices.status', 'active');
|
||||||
@ -485,4 +629,86 @@ class PendingActionsController extends AdminController
|
|||||||
|
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPolicyRenewalDataForAllClient()
|
||||||
|
{
|
||||||
|
$PolicyRenewalData = $this->clientPolicyModel
|
||||||
|
->select('
|
||||||
|
clients.client_name,
|
||||||
|
client_branch.branch_name,
|
||||||
|
policy_type.policy_type as policy_name,
|
||||||
|
client_policy.policy_end_date,
|
||||||
|
client_branch.id as branch_id
|
||||||
|
')
|
||||||
|
->join('clients', 'clients.id = client_policy.client_id')
|
||||||
|
->join('client_branch', 'client_branch.id = client_policy.client_branch_id')
|
||||||
|
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
||||||
|
->where('client_policy.is_active', 1)
|
||||||
|
->where('client_policy.policy_status', 0)
|
||||||
|
->where('clients.is_active', 1)
|
||||||
|
->where('client_branch.is_active', 1)
|
||||||
|
->where('client_policy.policy_end_date < DATE_ADD(CURDATE(), INTERVAL 2 MONTH)', null, false)
|
||||||
|
->get()
|
||||||
|
->getResultArray();
|
||||||
|
|
||||||
|
return $PolicyRenewalData;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTicketsDataForDashBoard()
|
||||||
|
{
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
|
||||||
|
$ticket_data = $db->table('hdz_tickets')
|
||||||
|
->select('hdz_tickets.*, hdz_status.status')
|
||||||
|
->join('hdz_status', 'hdz_status.id = hdz_tickets.status')
|
||||||
|
->where('hdz_status.active', 1)
|
||||||
|
->where('hdz_tickets.status !=', 5)
|
||||||
|
->get()
|
||||||
|
->getResultArray();
|
||||||
|
|
||||||
|
return $ticket_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
//ticket status count
|
||||||
|
public function getTicketStatusCount()
|
||||||
|
{
|
||||||
|
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
|
||||||
|
// Count status = 1
|
||||||
|
$countStatus1 = $db->table('hdz_tickets')
|
||||||
|
->selectCount('status')
|
||||||
|
->where('status', 1)
|
||||||
|
->get()
|
||||||
|
->getRowArray()['status'];
|
||||||
|
|
||||||
|
// Count status = 4
|
||||||
|
$countStatus4 = $db->table('hdz_tickets')
|
||||||
|
->selectCount('status')
|
||||||
|
->where('status', 4)
|
||||||
|
->get()
|
||||||
|
->getRowArray()['status'];
|
||||||
|
|
||||||
|
// Count status = 2
|
||||||
|
$countStatus2 = $db->table('hdz_tickets')
|
||||||
|
->selectCount('status')
|
||||||
|
->where('status', 2)
|
||||||
|
->get()
|
||||||
|
->getRowArray()['status'];
|
||||||
|
|
||||||
|
// Count status = 3
|
||||||
|
$countStatus3 = $db->table('hdz_tickets')
|
||||||
|
->selectCount('status')
|
||||||
|
->where('status', 3)
|
||||||
|
->get()
|
||||||
|
->getRowArray()['status'];
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getexportCount()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,15 +69,13 @@ class RestAuthenticationController extends AdminController
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$mobile_number = $this->request->getJSON()->mobile_number;
|
$mobile_number = $this->request->getJSON()->mobile_number;
|
||||||
$randomNumber = rand(100000, 999999);
|
|
||||||
$randomNumber = 123456;
|
|
||||||
|
|
||||||
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first();
|
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first();
|
||||||
|
|
||||||
if ($employeeData) {
|
if ($employeeData) {
|
||||||
$id= $employeeData["id"];
|
|
||||||
$otp = $this->employeeModel->where('id', $id)->set('otp', $randomNumber)->update();
|
$result = ['user_verification' => true ,'message' => "Verified Successfully"];
|
||||||
$result = ['user_verification' => true ,'message' => "Verified Successfully", 'otp'=>$randomNumber];
|
|
||||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||||
} else {
|
} else {
|
||||||
$result = ['user_verification' => false , 'message' => "User not found"];
|
$result = ['user_verification' => false , 'message' => "User not found"];
|
||||||
@ -92,13 +90,13 @@ class RestAuthenticationController extends AdminController
|
|||||||
|
|
||||||
public function getVerifiedUserData()
|
public function getVerifiedUserData()
|
||||||
{
|
{
|
||||||
// try {
|
try {
|
||||||
$mobile_number = $this->request->getJSON()->mobile_number;
|
$mobile_number = $this->request->getJSON()->mobile_number;
|
||||||
$otp = $this->request->getJSON()->otp;
|
$otp_verification = $this->request->getJSON()->otp_verification;
|
||||||
|
|
||||||
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first();
|
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first();
|
||||||
|
|
||||||
if ($employeeData && $otp == $employeeData["otp"] || $employeeData && isset($this->request->getJSON()->login_by_hr)) {
|
if ($employeeData && $otp_verification == true || $employeeData && isset($this->request->getJSON()->login_by_hr)) {
|
||||||
$auth = HttpRequestHelper::getRequestInfo();
|
$auth = HttpRequestHelper::getRequestInfo();
|
||||||
if ($auth) {
|
if ($auth) {
|
||||||
$data = [
|
$data = [
|
||||||
@ -108,36 +106,31 @@ class RestAuthenticationController extends AdminController
|
|||||||
'platform' => $auth['platform'],
|
'platform' => $auth['platform'],
|
||||||
'broswer' => $auth['browser'],
|
'broswer' => $auth['browser'],
|
||||||
];
|
];
|
||||||
|
$this->authHistoryModel->insert($data);
|
||||||
$authdata= $this->authHistoryModel->insert($data);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
$otp_null = $this->employeeModel->where('id', $employeeData["id"])->set('otp', null)->update();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$result = JWTToken::encode($employeeData);
|
$result = JWTToken::encode($employeeData);
|
||||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return $this->respond(['status' => 'failed','code' => 404,'data' => "Invalid OTP"],200);
|
return $this->respond(['status' => 'failed','code' => 404,'data' => "Invalid OTP"],200);
|
||||||
}
|
}
|
||||||
// } catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()],500);
|
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()],500);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function verifyHrWithMobileNumber()
|
public function verifyHrWithMobileNumber()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$mobile_number = $this->request->getJSON()->mobile_number;
|
$mobile_number = $this->request->getJSON()->mobile_number;
|
||||||
$randomNumber = rand(100000, 999999);
|
|
||||||
$randomNumber = 123456;
|
|
||||||
$HrData = $this->hrModel->where('mobile', $mobile_number)->where('contact_type', 'client')->first();
|
$HrData = $this->hrModel->where('mobile', $mobile_number)->where('contact_type', 'client')->first();
|
||||||
|
|
||||||
if ($HrData) {
|
if ($HrData) {
|
||||||
$id= $HrData["id"];
|
|
||||||
$otp = $this->hrModel->where('id', $id)->set('otp', $randomNumber)->update();
|
$result = ['user_verification' => true ,'message' => "Verified Successfully"];
|
||||||
$result = ['user_verification' => true ,'message' => "Verified Successfully", 'otp'=>$randomNumber];
|
|
||||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||||
} else {
|
} else {
|
||||||
$result = ['user_verification' => false , 'message' => "User not found"];
|
$result = ['user_verification' => false , 'message' => "User not found"];
|
||||||
@ -154,10 +147,10 @@ class RestAuthenticationController extends AdminController
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$mobile_number = $this->request->getJSON()->mobile_number;
|
$mobile_number = $this->request->getJSON()->mobile_number;
|
||||||
$otp = $this->request->getJSON()->otp;
|
$otp_verification = $this->request->getJSON()->otp_verification;
|
||||||
|
|
||||||
$hrData = $this->hrModel->where('mobile', $mobile_number)->first();
|
$hrData = $this->hrModel->where('mobile', $mobile_number)->first();
|
||||||
if ($hrData && $otp == $hrData["otp"]) {
|
if ($hrData && $otp_verification == true) {
|
||||||
$auth = HttpRequestHelper::getRequestInfo();
|
$auth = HttpRequestHelper::getRequestInfo();
|
||||||
if ($auth) {
|
if ($auth) {
|
||||||
$data = [
|
$data = [
|
||||||
@ -168,10 +161,10 @@ class RestAuthenticationController extends AdminController
|
|||||||
'broswer' => $auth['browser'],
|
'broswer' => $auth['browser'],
|
||||||
];
|
];
|
||||||
|
|
||||||
$authdata= $this->authHistoryModel->insert($data);
|
$this->authHistoryModel->insert($data);
|
||||||
|
|
||||||
}
|
}
|
||||||
$otp_null = $this->hrModel->where('id', $hrData["id"])->set('otp', null)->update();
|
|
||||||
|
|
||||||
$hrData = $this->hrModel ->select('level_contacts.* , client_branch.client_id as client_id')
|
$hrData = $this->hrModel ->select('level_contacts.* , client_branch.client_id as client_id')
|
||||||
->join('client_branch', 'level_contacts.ref_id = client_branch.id', 'left')
|
->join('client_branch', 'level_contacts.ref_id = client_branch.id', 'left')
|
||||||
@ -179,7 +172,7 @@ class RestAuthenticationController extends AdminController
|
|||||||
->find();
|
->find();
|
||||||
|
|
||||||
$result = JWTToken::encode($hrData['0']);
|
$result = JWTToken::encode($hrData['0']);
|
||||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||||
} else {
|
} else {
|
||||||
return $this->respond(['status' => 'failed','code' => 404,'data' => "Invalid OTP"],200);
|
return $this->respond(['status' => 'failed','code' => 404,'data' => "Invalid OTP"],200);
|
||||||
}
|
}
|
||||||
@ -190,11 +183,6 @@ class RestAuthenticationController extends AdminController
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function employeeLogout()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getUserIdFromToken()
|
public function getUserIdFromToken()
|
||||||
{
|
{
|
||||||
$id = JWTToken::getUserIdFromToken();
|
$id = JWTToken::getUserIdFromToken();
|
||||||
|
|||||||
@ -37,6 +37,9 @@ class AuthJWT implements FilterInterface
|
|||||||
$model->update($id, $data);
|
$model->update($id, $data);
|
||||||
return true;
|
return true;
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
|
// if($user_data['token_time_out'] != "" && $user_data['token_time_out'] != NULL)
|
||||||
|
|
||||||
$data =["token_time_out" => ''];
|
$data =["token_time_out" => ''];
|
||||||
$model->update($id, $data);
|
$model->update($id, $data);
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
|
|||||||
@ -54,7 +54,9 @@ class DepositHelper
|
|||||||
'cd_ac_no' => $data['cd_ac_no'],
|
'cd_ac_no' => $data['cd_ac_no'],
|
||||||
'endorsement_no' => $data['endorsement_no'],
|
'endorsement_no' => $data['endorsement_no'],
|
||||||
'insurer_id' => $data['insurer_id'],
|
'insurer_id' => $data['insurer_id'],
|
||||||
|
'unit' => $data['unit'] ?? null,
|
||||||
'description' => $data['description'],
|
'description' => $data['description'],
|
||||||
|
'event_name' => $data['event_name'],
|
||||||
'transaction_type' => $data['transaction_type'],
|
'transaction_type' => $data['transaction_type'],
|
||||||
'is_active' => 1,
|
'is_active' => 1,
|
||||||
'created_by' => $loggedInUserID,
|
'created_by' => $loggedInUserID,
|
||||||
|
|||||||
@ -18,6 +18,7 @@ class MailHelper
|
|||||||
{
|
{
|
||||||
|
|
||||||
// print_r($params);die;
|
// print_r($params);die;
|
||||||
|
$myLogger = \Config\Services::mylogger();
|
||||||
$emaill = $params['mail'];
|
$emaill = $params['mail'];
|
||||||
$subject = $params['subject'];
|
$subject = $params['subject'];
|
||||||
$message = $params['message'];
|
$message = $params['message'];
|
||||||
@ -48,12 +49,16 @@ class MailHelper
|
|||||||
$email->setMessage($message);
|
$email->setMessage($message);
|
||||||
|
|
||||||
if ($email->send()) {
|
if ($email->send()) {
|
||||||
|
|
||||||
return json_encode(['status' => 'success','code' => 200, 'message'=>'Email Sent Successfully...','data' => $emaill,],200);
|
return json_encode(['status' => 'success','code' => 200, 'message'=>'Email Sent Successfully...','data' => $emaill,],200);
|
||||||
} else {
|
} else {
|
||||||
|
$myLogger->logme('error', "mail sent failed - $emaill");
|
||||||
return json_encode(['status' => 'failed','code' => 404,'message'=>'Email Sent Failed...','data' => $emaill ],404);
|
return json_encode(['status' => 'failed','code' => 404,'message'=>'Email Sent Failed...','data' => $emaill ],404);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
$msg = $e->getMessage();
|
||||||
|
$myLogger->logme('error', "mail sent failed - $msg");
|
||||||
return json_encode(['status' => 'failed','code' => 500,'data' => $emaill],500);
|
return json_encode(['status' => 'failed','code' => 500,'data' => $emaill],500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -665,7 +665,7 @@ if(!function_exists('generate_insurer_based_excel')){
|
|||||||
|
|
||||||
$rowData = [];
|
$rowData = [];
|
||||||
foreach ($excel_header_array as $header) {
|
foreach ($excel_header_array as $header) {
|
||||||
$fieldName = $header['header_name'];
|
$fieldName = $header['db_column_name'];
|
||||||
|
|
||||||
if ($fieldName === 'index') {
|
if ($fieldName === 'index') {
|
||||||
$value = $serialNumber;
|
$value = $serialNumber;
|
||||||
|
|||||||
@ -90,7 +90,7 @@ if(!function_exists('check_relationship'))
|
|||||||
{
|
{
|
||||||
// print_r($relationship);
|
// print_r($relationship);
|
||||||
// echo '<br>';
|
// echo '<br>';
|
||||||
if($row['current_action'] != null && in_array(strtoupper($row['current_action']), ['I','A','DA']))// check rule only of action column data available
|
if($row['current_action'] != null && in_array(strtoupper($row['current_action']), ['I','A','DA','MI']))// check rule only of action column data available
|
||||||
{
|
{
|
||||||
if($row[5] != null && $row[4] != null)//$row[5] = relationship $row[4] = Gender
|
if($row[5] != null && $row[4] != null)//$row[5] = relationship $row[4] = Gender
|
||||||
{
|
{
|
||||||
@ -141,7 +141,7 @@ if(!function_exists('check_doj'))
|
|||||||
|
|
||||||
function check_doj($row)
|
function check_doj($row)
|
||||||
{
|
{
|
||||||
if($row['current_action'] != null && in_array(strtoupper($row['current_action']), ['I','A','DA']))// check rule only of action column data available
|
if($row['current_action'] != null && in_array(strtoupper($row['current_action']), ['I','A','DA','MI']))// check rule only of action column data available
|
||||||
{
|
{
|
||||||
$slug = \Config\Services::slug();
|
$slug = \Config\Services::slug();
|
||||||
$relationship = $slug->slugify($row[5]);
|
$relationship = $slug->slugify($row[5]);
|
||||||
@ -188,7 +188,7 @@ if(!function_exists('check_employee_band'))
|
|||||||
{
|
{
|
||||||
function check_employee_band($row,$policy_terms,$slab_details)
|
function check_employee_band($row,$policy_terms,$slab_details)
|
||||||
{
|
{
|
||||||
if($row['current_action'] != null && in_array(strtoupper($row['current_action']), ['I','A','DA']))// check rule only of action column data available
|
if($row['current_action'] != null && in_array(strtoupper($row['current_action']), ['I','A','DA','MI']))// check rule only of action column data available
|
||||||
{
|
{
|
||||||
$is_emp_band_needed = $slab_details['grid_master']['emp_band'];
|
$is_emp_band_needed = $slab_details['grid_master']['emp_band'];
|
||||||
// $is_emp_band_needed = true;
|
// $is_emp_band_needed = true;
|
||||||
@ -225,12 +225,20 @@ if(!function_exists('check_employee_band'))
|
|||||||
|
|
||||||
if(!function_exists('check_si'))
|
if(!function_exists('check_si'))
|
||||||
{
|
{
|
||||||
function check_si($row,$policy_terms,$slab_details)
|
function check_si($row,$policy_details,$slab_details)
|
||||||
{
|
{
|
||||||
$return_array = array('status' => true,'error' => '');
|
$return_array = array('status' => true,'error' => '');
|
||||||
$is_si_found = false;
|
$is_si_found = false;
|
||||||
$is_age_slab_found = false;
|
$is_age_slab_found = false;
|
||||||
if($row['current_action'] != null && in_array(strtoupper($row['current_action']), ['I','A','DA','SI']))// check rule only of action column data available
|
|
||||||
|
if($policy_details[0]['policy_type_id'] == 1 && $slab_details[0]['policy_grid_id'] == 1 && $slab_details[0]['si_or_bp'] == 2) // GPA && grid type 1 for GPA && sub type is basic pay
|
||||||
|
{
|
||||||
|
$is_si_found = true;
|
||||||
|
$is_age_slab_found = true;
|
||||||
|
$return_array = array('status' => true,'error' => '');
|
||||||
|
}
|
||||||
|
|
||||||
|
if($row['current_action'] != null && in_array(strtoupper($row['current_action']), ['I','A','DA','SI','MI']))// check rule only of action column data available
|
||||||
{
|
{
|
||||||
$received_si = $row['current_action'] == 'SI' ? $row[3] : $row[6];
|
$received_si = $row['current_action'] == 'SI' ? $row[3] : $row[6];
|
||||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||||
@ -247,7 +255,7 @@ if(!function_exists('check_si'))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check age slab
|
// check age slab
|
||||||
if(in_array(strtoupper($row['current_action']), ['I','A','DA']) && (($slab_value['premium_type'] == 1 && strtolower($row['5']) == 'self' ) || ($slab_value['premium_type'] == 2) ) )
|
if(in_array(strtoupper($row['current_action']), ['I','A','DA','MI']) && (($slab_value['premium_type'] == 1 && strtolower($row['5']) == 'self' ) || ($slab_value['premium_type'] == 2) ) )
|
||||||
{
|
{
|
||||||
if($row[3] != '' && $row[3] != null)// dob
|
if($row[3] != '' && $row[3] != null)// dob
|
||||||
{
|
{
|
||||||
@ -311,7 +319,7 @@ if(!function_exists('check_basic_pay'))
|
|||||||
{
|
{
|
||||||
function check_basic_pay($row,$policy_terms,$slab_details)
|
function check_basic_pay($row,$policy_terms,$slab_details)
|
||||||
{
|
{
|
||||||
if($row['current_action'] != null && in_array(strtoupper($row['current_action']), ['I','A','DA']))// check rule only of action column data available
|
if($row['current_action'] != null && in_array(strtoupper($row['current_action']), ['I','A','DA','MI']))// check rule only of action column data available
|
||||||
{
|
{
|
||||||
$is_basic_pay_needed = $slab_details['grid_master']['basicpay'];
|
$is_basic_pay_needed = $slab_details['grid_master']['basicpay'];
|
||||||
// $is_basic_pay_needed = true;
|
// $is_basic_pay_needed = true;
|
||||||
@ -329,7 +337,7 @@ if (!function_exists('check_dob_diff'))
|
|||||||
{
|
{
|
||||||
function check_dob_diff($row,$relationships,$default_age_ratio) {
|
function check_dob_diff($row,$relationships,$default_age_ratio) {
|
||||||
// echo 'called';
|
// echo 'called';
|
||||||
if($row['current_action'] != null && in_array(strtoupper($row['current_action']), ['I','A','DA']))// check rule only of action column data available
|
if($row['current_action'] != null && in_array(strtoupper($row['current_action']), ['I','A','DA','MI']))// check rule only of action column data available
|
||||||
{
|
{
|
||||||
if($row[3] != null && $row[5] != null)
|
if($row[3] != null && $row[5] != null)
|
||||||
{
|
{
|
||||||
@ -667,9 +675,10 @@ if (!function_exists('generate_relationship_code'))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!function_exists('calculate_premimum'))
|
if (!function_exists('calculate_premium'))
|
||||||
{
|
{
|
||||||
function calculate_premimum($family_data,$policy_terms,$slab_details,$fileArr,$default_si = null)
|
// function calculate_premimum($family_data,$policy_terms,$slab_details,$fileArr,$default_si = null)
|
||||||
|
function calculate_premium(array $family_data,array $policy_terms,array $slab_details,array $fileArr,string $default_si = null,array $existing_units = [])
|
||||||
{
|
{
|
||||||
// dd($family_data);
|
// dd($family_data);
|
||||||
$slug = \Config\Services::slug();
|
$slug = \Config\Services::slug();
|
||||||
@ -865,6 +874,116 @@ if (!function_exists('calculate_premimum'))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!function_exists('calculate_premium_new'))
|
||||||
|
{
|
||||||
|
function calculate_premium_new(array $family_data,array $policy_terms,array $slab_details,array $fileArr,array $existing_units,string $default_si = null,)
|
||||||
|
{
|
||||||
|
|
||||||
|
//grouping slab details by rack rate name
|
||||||
|
$temp_slab_rates = group_slab_rates_basedon_name($slab_details);
|
||||||
|
// dd($temp_slab_rates);
|
||||||
|
/* 1. construct available/incoming family members composition & count */
|
||||||
|
$incoming_familiy_composition = get_familiy_composition($family_data);
|
||||||
|
// dd($incoming_familiy_composition);
|
||||||
|
|
||||||
|
//2 .get applicable familiy members composition & count from slab details & constrcut an array
|
||||||
|
//3 in for another loop compare slab level applicable familiy composition with available family composition
|
||||||
|
$result = [];
|
||||||
|
foreach($temp_slab_rates as $key => $slab)
|
||||||
|
{
|
||||||
|
// dd($slab);
|
||||||
|
$res = compare_incoming_family_slab_with_configured_slab($slab,$incoming_familiy_composition);
|
||||||
|
// kint::dump($key);
|
||||||
|
// kint::dump($res);
|
||||||
|
|
||||||
|
if($res['is_applicable'])
|
||||||
|
{
|
||||||
|
$temp_slab_rates[$key]['is_applicable'] = true;
|
||||||
|
$temp_slab_rates[$key]['members'] = $res['applicable_members'];
|
||||||
|
|
||||||
|
//get applicable members for current rack rate from over all familiy members and calculate max age and max count,self/acting self and grid type and set it in individual familiy member level
|
||||||
|
$applicable_members_from_familiy = get_applicable_familiy_members($family_data,$res['applicable_members']);
|
||||||
|
// dd( $applicable_members_from_familiy);
|
||||||
|
$is_self_acting_self_set = false;
|
||||||
|
foreach($applicable_members_from_familiy['index'] as $val)
|
||||||
|
{
|
||||||
|
$acting_self = false;
|
||||||
|
if(!$is_self_acting_self_set)
|
||||||
|
{
|
||||||
|
if(strtolower($family_data[$val][5]) == 'self' || !$is_self_acting_self_set) $acting_self = true;
|
||||||
|
$is_self_acting_self_set = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$family_data[$val]['temp'] = ['max_age' => max($applicable_members_from_familiy['max_age']),'max_count' => $applicable_members_from_familiy['max_count'],'grid_name' => $key,'grid_master' => $slab['grid_master'],'acting_self' => $acting_self,'premium_type' => $slab['slab_rates'][0]['premium_type']];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$temp_slab_rates[$key]['is_applicable'] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// dd();
|
||||||
|
|
||||||
|
//4. if macthed then the current rack rate is applicable and find common variables link max age,max count,grade, basic pay,SI, self/acting self for current rack rate
|
||||||
|
|
||||||
|
foreach($family_data as $fkey => $member)
|
||||||
|
{
|
||||||
|
// dd($member);
|
||||||
|
//get grid type either primary or additional based on current member relationship available in primary_rack_rate_applicable_familiy_members or not. if yes then primaty grid type else additional grid type
|
||||||
|
|
||||||
|
$fileArr['grid_info'] = ['type' => isset($member['temp']['grid_name']) ? $member['temp']['grid_name'] : NULL , 'grid_id' => isset($member['temp']['grid_master']['ui_type']) ? $member['temp']['grid_master']['ui_type'] : NULL];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//set self (first index of familiy) SI and grade to rest of the familiy
|
||||||
|
$member[6] = $family_data[0][6];
|
||||||
|
$member[10] = $family_data[0][10];
|
||||||
|
$member[18] = $family_data[0][18];
|
||||||
|
//set default unit if unit is not available in self/members level
|
||||||
|
if(empty($member[18])){ $member[18] = $existing_units[0]; }
|
||||||
|
//transform as db row column
|
||||||
|
$transformed_familiy_member_data = transform_excel_data_to_db($member,$fileArr);
|
||||||
|
// kint::dump($transformed_familiy_member_data);
|
||||||
|
//generate relationship code
|
||||||
|
if($transformed_familiy_member_data['temp']['action'] != 'D' && $transformed_familiy_member_data['temp']['action'] != 'C' && $transformed_familiy_member_data['temp']['action'] != 'SI')
|
||||||
|
{
|
||||||
|
$temp_res = generate_relationship_code($transformed_familiy_member_data);
|
||||||
|
$transformed_familiy_member_data['relationship_code'] = $temp_res['relationship_code'];
|
||||||
|
$transformed_familiy_member_data['emp_type'] = $temp_res['emp_type_code'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// // this array hold conditions to allow calculate premium amt
|
||||||
|
$conditions = [
|
||||||
|
'isEmployeeSourceEnrollment' => $fileArr['id'] == null,
|
||||||
|
'isEmployeeSourceExcelFile' => $transformed_familiy_member_data['temp']['source'] == 'excel',
|
||||||
|
'isCurrentActionDependentAddition' => $fileArr['action'] == 'dependent_addition',
|
||||||
|
// 'isPrimaryGridPremiumTypeSingle' => $transformed_familiy_member_data['temp']['premium_type'] == 1,
|
||||||
|
'isCurrentRelationshipSelf' => (strtolower($transformed_familiy_member_data['relationship']) == 'self' || (isset($transformed_familiy_member_data['temp']['acting_self']) && $transformed_familiy_member_data['temp']['acting_self'] === true)),
|
||||||
|
'isBasicCoverCalculatedToCurrentEmployee' => ($transformed_familiy_member_data['policy_details']['basic_cover_si'] != null && $transformed_familiy_member_data['policy_details']['basic_cover_si'] != 0)
|
||||||
|
];
|
||||||
|
|
||||||
|
$primaryGridTypeCondition = $conditions['isCurrentActionDependentAddition'] && $conditions['isPrimaryGridPremiumTypeSingle'] && $conditions['isCurrentRelationshipSelf'] && $conditions['isBasicCoverCalculatedToCurrentEmployee'];
|
||||||
|
|
||||||
|
// // Final combined condition
|
||||||
|
if ($conditions['isEmployeeSourceEnrollment'] || $conditions['isEmployeeSourceExcelFile'] || $primaryGridTypeCondition ) {
|
||||||
|
// dd($transformed_familiy_member_data);
|
||||||
|
$transformed_familiy_member_data = premium_calculation_manager($transformed_familiy_member_data,$policy_terms,$temp_slab_rates,$default_si);
|
||||||
|
// dd($transformed_familiy_member_data);
|
||||||
|
$result[] = $transformed_familiy_member_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// $result[] = $transformed_familiy_member_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// dd($result);
|
||||||
|
return ($result);
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!function_exists('transform_excel_data_to_db'))
|
if (!function_exists('transform_excel_data_to_db'))
|
||||||
{
|
{
|
||||||
@ -878,14 +997,16 @@ if (!function_exists('transform_excel_data_to_db'))
|
|||||||
else if($actionArr['action'] == 'deletion'){ $current_column_action = 'D'; }
|
else if($actionArr['action'] == 'deletion'){ $current_column_action = 'D'; }
|
||||||
else if($actionArr['action'] == 'correction'){ $current_column_action = 'C'; }
|
else if($actionArr['action'] == 'correction'){ $current_column_action = 'C'; }
|
||||||
else if($actionArr['action'] == 'si_enhancement'){ $current_column_action = 'SI'; }
|
else if($actionArr['action'] == 'si_enhancement'){ $current_column_action = 'SI'; }
|
||||||
|
else if($actionArr['action'] == 'missed_inception'){ $current_column_action = 'MI'; }
|
||||||
|
|
||||||
if($actionArr['action'] == 'inception' || $actionArr['action'] == 'addition' || $actionArr['action'] == 'dependent_addition')
|
if($actionArr['action'] == 'inception' || $actionArr['action'] == 'missed_inception' || $actionArr['action'] == 'addition' || $actionArr['action'] == 'dependent_addition')
|
||||||
{
|
{
|
||||||
|
|
||||||
$policy['basic_cover_si'] = $memArr[6];
|
$policy['basic_cover_si'] = $memArr[6];
|
||||||
$policy['pre_existing_alignments'] = $memArr[14];
|
$policy['pre_existing_alignments'] = $memArr[14];
|
||||||
// $policy['date_of_exit'] = isset($memArr[16]) ? change_date_format($memArr[16],'d-M-Y','Y-m-d') : NULL;
|
// $policy['date_of_exit'] = isset($memArr[16]) ? change_date_format($memArr[16],'d-M-Y','Y-m-d') : NULL;
|
||||||
// $policy['reason_for_exit'] = $memArr[17];
|
// $policy['reason_for_exit'] = $memArr[17];
|
||||||
|
|
||||||
$policy['client_policy_id'] = $actionArr['policy_id'];
|
$policy['client_policy_id'] = $actionArr['policy_id'];
|
||||||
$policy['date_coverage'] = isset($memArr[7]) ? convert_string_to_date($memArr[7],'Y-m-d') : NULL;
|
$policy['date_coverage'] = isset($memArr[7]) ? convert_string_to_date($memArr[7],'Y-m-d') : NULL;
|
||||||
$policy['policy_end_date'] = null;
|
$policy['policy_end_date'] = null;
|
||||||
@ -910,7 +1031,11 @@ if (!function_exists('transform_excel_data_to_db'))
|
|||||||
$result['file_id'] = $actionArr['id'];
|
$result['file_id'] = $actionArr['id'];
|
||||||
$result['client_id'] = $actionArr['client_id'];
|
$result['client_id'] = $actionArr['client_id'];
|
||||||
$result['change_event'] = $memArr[15];
|
$result['change_event'] = $memArr[15];
|
||||||
|
$result['unit'] = $memArr[18];
|
||||||
|
$result['temp'] = [];
|
||||||
|
if(isset($memArr['temp'])) $result['temp'] = array_merge($result['temp'],$memArr['temp']);
|
||||||
$result['temp']['grid_type'] = $actionArr['grid_info']['type'];
|
$result['temp']['grid_type'] = $actionArr['grid_info']['type'];
|
||||||
|
$result['temp']['band'] = $result['band'];
|
||||||
$result['temp']['grid_id'] = $actionArr['grid_info']['grid_id'];
|
$result['temp']['grid_id'] = $actionArr['grid_info']['grid_id'];
|
||||||
$result['temp']['action'] = isset($memArr['current_action']) ? $memArr['current_action'] : $current_column_action;
|
$result['temp']['action'] = isset($memArr['current_action']) ? $memArr['current_action'] : $current_column_action;
|
||||||
$result['temp']['source'] = isset($memArr['temp']['source']) ? $memArr['temp']['source'] : 'excel';
|
$result['temp']['source'] = isset($memArr['temp']['source']) ? $memArr['temp']['source'] : 'excel';
|
||||||
@ -932,7 +1057,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
{
|
{
|
||||||
function premium_calculation_manager($emp_data,$policy_terms,$slab_details,$default_si = null)
|
function premium_calculation_manager($emp_data,$policy_terms,$slab_details,$default_si = null)
|
||||||
{
|
{
|
||||||
// Kint::dump($emp_data);
|
// Kint::dump($emp_data);die();
|
||||||
|
|
||||||
$myLogger = \Config\Services::mylogger();
|
$myLogger = \Config\Services::mylogger();
|
||||||
// grid type
|
// grid type
|
||||||
@ -964,13 +1089,21 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
$emp_data['policy_details'] = replace_original_data(original_data:$original_emp_policy_records,current_data:$emp_data['policy_details']);
|
$emp_data['policy_details'] = replace_original_data(original_data:$original_emp_policy_records,current_data:$emp_data['policy_details']);
|
||||||
// Kint::dump($policy_data);
|
// Kint::dump($policy_data);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
//end of fetching data from audit history table
|
}//end of fetching data from audit history table
|
||||||
|
|
||||||
//gird and calculation start
|
//gird and calculation start
|
||||||
$slug = \Config\Services::slug();
|
$slug = \Config\Services::slug();
|
||||||
$grid_type = $emp_data['temp']['grid_id'];
|
$grid_type = $emp_data['temp']['grid_id'];
|
||||||
$temp_slab_rates = $emp_data['temp']['grid_type'] == 'primary' ? $slab_details['slab_rates'] : $slab_details['additional_slab_info']['slab_rates'];
|
$slab_index = isset($emp_data['temp']['grid_name']) ? $emp_data['temp']['grid_name'] : false;
|
||||||
|
// echo $emp_data['name'];
|
||||||
|
// kint::dump($slab_index);
|
||||||
|
if ($slab_index === false)
|
||||||
|
{
|
||||||
|
// echo 'not set';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$temp_slab_rates = $slab_details[ $slab_index ]['slab_rates'];
|
||||||
|
|
||||||
//if curent action is dependent addition OR addition then pull insurer master to set whether add one day from employee date of coverage
|
//if curent action is dependent addition OR addition then pull insurer master to set whether add one day from employee date of coverage
|
||||||
if($emp_data['temp']['action'] == 'DA' || $emp_data['temp']['action'] == 'A')
|
if($emp_data['temp']['action'] == 'DA' || $emp_data['temp']['action'] == 'A')
|
||||||
@ -984,6 +1117,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
}
|
}
|
||||||
// dd($emp_data);
|
// dd($emp_data);
|
||||||
$is_match_found = false;
|
$is_match_found = false;
|
||||||
|
$gst = isset($policy_terms['gst']) && $policy_terms['gst'] != 0 ? $policy_terms['gst'] : 18;
|
||||||
switch ($grid_type) {
|
switch ($grid_type) {
|
||||||
case "1":
|
case "1":
|
||||||
//GPA - Sum Insured (SI) * Multiplier
|
//GPA - Sum Insured (SI) * Multiplier
|
||||||
@ -991,7 +1125,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
$employee_received_band = $emp_data['temp']['band'];
|
$employee_received_band = $emp_data['temp']['band'];
|
||||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||||
{
|
{
|
||||||
if(($slab_value['si'] == $employee_received_si) || ($slab_value['grade'] != null && $slab_value['grade'] == $employee_received_band && $slab_value['si'] == $employee_received_si))
|
if(($slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit']) || ($slab_value['grade'] != null && $slab_value['grade'] == $employee_received_band && $slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit']))
|
||||||
{
|
{
|
||||||
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||||
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||||
@ -999,19 +1133,40 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
||||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.','');
|
||||||
$is_match_found = true;
|
$is_match_found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//auto calculate of SI and premium for basic pay type
|
||||||
|
if(!$is_match_found)
|
||||||
|
{
|
||||||
|
if($temp_slab_rates[0]['si_or_bp'] == 2)
|
||||||
|
{
|
||||||
|
$temp_si = $emp_data['basic_pay'] * $temp_slab_rates[0]['si_or_bp'];
|
||||||
|
$temp_premium = ($temp_si * $temp_slab_rates[0]['multiplier']) / 1000;
|
||||||
|
|
||||||
|
$emp_data['policy_details']['basic_cover_si'] = $temp_si;
|
||||||
|
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||||
|
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
|
||||||
|
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
||||||
|
$emp_data['policy_details']['premium'] = $temp_premium;
|
||||||
|
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||||
|
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.','');
|
||||||
|
$is_match_found = true;
|
||||||
|
|
||||||
|
$log_message = 'Pre defined SI not found. auto calc SI & premium for -' . $emp_data['emp_code'].' - '. $emp_data['name'].' - '. $temp_si.' - '. $temp_premium;
|
||||||
|
$myLogger->logme('error',$log_message);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "2":
|
case "2":
|
||||||
//GPA - Flat Rate for all SI
|
//GPA - Flat Rate for all SI
|
||||||
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
|
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
|
||||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||||
{
|
{
|
||||||
if($slab_value['si'] == $employee_received_si)
|
if($slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'])
|
||||||
{
|
{
|
||||||
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||||
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||||
@ -1019,7 +1174,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
||||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.','');
|
||||||
$is_match_found = true;
|
$is_match_found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1030,7 +1185,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
|
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
|
||||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||||
{
|
{
|
||||||
if($slab_value['si'] == $employee_received_si && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
if($slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] ) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||||
{
|
{
|
||||||
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||||
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||||
@ -1038,7 +1193,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
||||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.','');
|
||||||
$is_match_found = true;
|
$is_match_found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1053,7 +1208,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||||
{
|
{
|
||||||
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
||||||
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
if($slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] ) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||||
{
|
{
|
||||||
// dd($slab_value);
|
// dd($slab_value);
|
||||||
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||||
@ -1062,7 +1217,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
||||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.','');
|
||||||
$is_match_found = true;
|
$is_match_found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1074,7 +1229,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||||
{
|
{
|
||||||
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
||||||
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
if($slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] ) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||||
{
|
{
|
||||||
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||||
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||||
@ -1082,7 +1237,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
||||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.','');
|
||||||
$is_match_found = true;
|
$is_match_found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1094,7 +1249,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||||
{
|
{
|
||||||
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
||||||
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
if($slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] ) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||||
{
|
{
|
||||||
// echo $emp_data['name'];
|
// echo $emp_data['name'];
|
||||||
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||||
@ -1103,7 +1258,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
||||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.','');
|
||||||
$is_match_found = true;
|
$is_match_found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1116,7 +1271,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||||
{
|
{
|
||||||
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
||||||
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
if($slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] ) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||||
{
|
{
|
||||||
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||||
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||||
@ -1124,7 +1279,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
||||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.','');
|
||||||
|
|
||||||
$is_match_found = true;
|
$is_match_found = true;
|
||||||
break;
|
break;
|
||||||
@ -1138,7 +1293,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||||
{
|
{
|
||||||
|
|
||||||
if($slab_value['grade'] == $employee_received_band && $slab_value['si'] == $employee_received_si && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
if($slab_value['grade'] == $employee_received_band && $slab_value['unit'] == $emp_data['unit'] && $slab_value['si'] == $employee_received_si && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] ) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||||
{
|
{
|
||||||
// $emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
// $emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||||
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||||
@ -1147,7 +1302,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
||||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.','');
|
||||||
$is_match_found = true;
|
$is_match_found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1160,7 +1315,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||||
{
|
{
|
||||||
|
|
||||||
if($slab_value['si'] == $employee_received_si && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self'])) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
if($slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] )) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||||
{
|
{
|
||||||
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||||
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||||
@ -1168,7 +1323,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
||||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.','');
|
||||||
$is_match_found = true;
|
$is_match_found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1176,7 +1331,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
break;
|
break;
|
||||||
case "10":
|
case "10":
|
||||||
//GMC - Maximum age of Dependents
|
//GMC - Maximum age of Dependents
|
||||||
$max_age = $emp_data['temp']['maxage'];
|
$max_age = $emp_data['temp']['max_age'];
|
||||||
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
|
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
|
||||||
// echo $emp_data['name'].'-'.$employee_received_si.'<br>';
|
// echo $emp_data['name'].'-'.$employee_received_si.'<br>';
|
||||||
// echo $emp_data['temp']['grid_type'].'<br>';
|
// echo $emp_data['temp']['grid_type'].'<br>';
|
||||||
@ -1184,10 +1339,10 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||||
{
|
{
|
||||||
// echo $slab_value['si'].'-'.$slab_value['age_from'].'-'.$slab_value['age_to'].'-'.$max_age.'<br>';
|
// echo $slab_value['si'].'-'.$slab_value['age_from'].'-'.$slab_value['age_to'].'-'.$max_age.'<br>';
|
||||||
if( $slab_value['si'] == $employee_received_si &&
|
if( $slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] &&
|
||||||
($slab_value['age_from'] <= $max_age && $slab_value['age_to'] >= $max_age) &&
|
($slab_value['age_from'] <= $max_age && $slab_value['age_to'] >= $max_age) &&
|
||||||
(($slab_value['premium_type'] == 1 &&
|
(($slab_value['premium_type'] == 1 &&
|
||||||
( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self'])) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ) )
|
( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] )) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ) )
|
||||||
{
|
{
|
||||||
$emp_data['policy_details']['basic_cover_si'] = $employee_received_si;
|
$emp_data['policy_details']['basic_cover_si'] = $employee_received_si;
|
||||||
$emp_data['policy_details']['date_coverage'] = isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date'];
|
$emp_data['policy_details']['date_coverage'] = isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date'];
|
||||||
@ -1195,7 +1350,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
||||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||||
$emp_data['policy_details']['gst'] = ((float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.',''));
|
$emp_data['policy_details']['gst'] = ((float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.',''));
|
||||||
$is_match_found = true;
|
$is_match_found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1203,16 +1358,16 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
break;
|
break;
|
||||||
case "11":
|
case "11":
|
||||||
//GMC - Maximum count per Family
|
//GMC - Maximum count per Family
|
||||||
$max_count = $emp_data['temp']['maxcount'];
|
$max_count = $emp_data['temp']['max_count'];
|
||||||
$employee_received_band = $emp_data['temp']['band'];
|
$employee_received_band = $emp_data['band'];
|
||||||
// echo $employee_received_band;
|
// echo $employee_received_band;
|
||||||
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
|
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
|
||||||
$emp_data['policy_details']['basic_cover_si'] = null;
|
$emp_data['policy_details']['basic_cover_si'] = null;
|
||||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||||
{
|
{
|
||||||
|
|
||||||
if($slab_value['si'] == $employee_received_si && $slab_value['grade'] == $employee_received_band && (($slab_value['premium_type'] == 1 &&
|
if($slab_value['si'] == $employee_received_si && $slab_value['grade'] == $employee_received_band && $slab_value['unit'] == $emp_data['unit'] && (($slab_value['premium_type'] == 1 &&
|
||||||
( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self'])) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] )) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||||
{
|
{
|
||||||
//calculate premium based on count
|
//calculate premium based on count
|
||||||
// echo $emp_data['name'];
|
// echo $emp_data['name'];
|
||||||
@ -1223,9 +1378,9 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
$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']['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']['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 + 1);
|
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
||||||
$emp_data['policy_details']['premium'] = get_premium_for_si(slab_details: $slab_details,si_amount: $familiy_si_covered,band: $employee_received_band);
|
$emp_data['policy_details']['premium'] = get_premium_for_si(slab_details: $temp_slab_rates,si_amount: $familiy_si_covered,band: $employee_received_band,unit:$emp_data['unit']);
|
||||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||||
$emp_data['policy_details']['gst'] = ((float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.',''));
|
$emp_data['policy_details']['gst'] = ((float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.',''));
|
||||||
$is_match_found = true;
|
$is_match_found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1241,7 +1396,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
$emp_data['policy_details']['basic_cover_si'] = null;
|
$emp_data['policy_details']['basic_cover_si'] = null;
|
||||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||||
{
|
{
|
||||||
if( $slab_value['si'] == $employee_received_si && ((($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) && $slab_value['relationship'] == $employee_relationship) || ($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) )) )
|
if( $slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] && ((($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) && $slab_value['relationship'] == $employee_relationship) || ($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] ) )) )
|
||||||
{
|
{
|
||||||
|
|
||||||
$emp_data['policy_details']['basic_cover_si'] = $employee_received_si;
|
$emp_data['policy_details']['basic_cover_si'] = $employee_received_si;
|
||||||
@ -1250,7 +1405,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
||||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||||
$emp_data['policy_details']['gst'] = ((float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.',''));
|
$emp_data['policy_details']['gst'] = ((float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.',''));
|
||||||
$is_match_found = true;
|
$is_match_found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1266,7 +1421,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
||||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||||
{
|
{
|
||||||
if( $slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && ((($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) && $slab_value['relationship'] == $employee_relationship) || ($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) )) )
|
if( $slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && ((($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) && $slab_value['relationship'] == $employee_relationship) || ($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] ) )) )
|
||||||
{
|
{
|
||||||
|
|
||||||
$emp_data['policy_details']['basic_cover_si'] = $employee_received_si;
|
$emp_data['policy_details']['basic_cover_si'] = $employee_received_si;
|
||||||
@ -1275,7 +1430,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
||||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days);
|
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days);
|
||||||
$emp_data['policy_details']['gst'] = ((float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.',''));
|
$emp_data['policy_details']['gst'] = ((float) number_format(($emp_data['policy_details']['rata_premimum'] * ($gst/100)),2,'.',''));
|
||||||
$is_match_found = true;
|
$is_match_found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1295,7 +1450,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
{
|
{
|
||||||
$log_message .= ' - skipping, calculating only self..!';
|
$log_message .= ' - skipping, calculating only self..!';
|
||||||
//reset emp si and others policy level data if premium only for self
|
//reset emp si and others policy level data if premium only for self
|
||||||
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
|
// $emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
|
||||||
$emp_data['policy_details']['basic_cover_si'] = 0;
|
$emp_data['policy_details']['basic_cover_si'] = 0;
|
||||||
$emp_data['policy_details']['premium'] = 0;
|
$emp_data['policy_details']['premium'] = 0;
|
||||||
$emp_data['policy_details']['rata_premimum'] = 0;
|
$emp_data['policy_details']['rata_premimum'] = 0;
|
||||||
@ -1347,6 +1502,7 @@ if (!function_exists('transform_db_data_to_excel'))
|
|||||||
$row[14] = $value['pre_existing_alignments'];
|
$row[14] = $value['pre_existing_alignments'];
|
||||||
$row[16] = isset($value['date_of_exit']) ? change_date_format($value['date_of_exit'], 'Y-m-d', 'd-M-Y') : NULL;
|
$row[16] = isset($value['date_of_exit']) ? change_date_format($value['date_of_exit'], 'Y-m-d', 'd-M-Y') : NULL;
|
||||||
$row[17] = $value['reason_for_exit'];
|
$row[17] = $value['reason_for_exit'];
|
||||||
|
$row[18] = $value['unit'];
|
||||||
|
|
||||||
|
|
||||||
$row[7] = isset($value['date_coverage']) ? change_date_format($value['date_coverage'], 'Y-m-d', 'd-M-Y') : NULL;
|
$row[7] = isset($value['date_coverage']) ? change_date_format($value['date_coverage'], 'Y-m-d', 'd-M-Y') : NULL;
|
||||||
@ -1461,11 +1617,12 @@ if(!function_exists('replace_original_data'))
|
|||||||
|
|
||||||
if(!function_exists('get_premium_for_si'))
|
if(!function_exists('get_premium_for_si'))
|
||||||
{
|
{
|
||||||
function get_premium_for_si(array $slab_details,string $si_amount,string $band)
|
function get_premium_for_si(array $slab_details,string $si_amount,string $band,string $unit)
|
||||||
{
|
{
|
||||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
// dd($slab_details);
|
||||||
|
foreach ($slab_details as $skey => $slab_value)
|
||||||
{
|
{
|
||||||
if($slab_value['si'] == $si_amount && $slab_value['grade'] == $band && $slab_value['max_si'] == 0)
|
if($slab_value['si'] == $si_amount && $slab_value['grade'] == $band && $slab_value['unit'] == $unit && $slab_value['max_si'] == 0)
|
||||||
{
|
{
|
||||||
return $slab_value['premium'];
|
return $slab_value['premium'];
|
||||||
}
|
}
|
||||||
@ -1633,3 +1790,308 @@ if(!function_exists('transform_enrollment_row_to_inception_row'))
|
|||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!function_exists('get_familiy_composition'))
|
||||||
|
{
|
||||||
|
|
||||||
|
function get_familiy_composition($family_data)
|
||||||
|
{
|
||||||
|
// dd($family_data);
|
||||||
|
$family_composition = [];
|
||||||
|
$slug = \Config\Services::slug();
|
||||||
|
foreach ($family_data as $key => $row)
|
||||||
|
{
|
||||||
|
// Kint::dump($row);
|
||||||
|
$relationship = $slug->slugify($row[5]);
|
||||||
|
// echo $relationship;
|
||||||
|
if($relationship == 'self')
|
||||||
|
{
|
||||||
|
$family_composition['self'] = 1;
|
||||||
|
}
|
||||||
|
else if(!array_key_exists('self', $family_composition))
|
||||||
|
{
|
||||||
|
$family_composition['self'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($relationship == 'spouse')
|
||||||
|
{
|
||||||
|
$family_composition['spouse'] = 1;
|
||||||
|
}
|
||||||
|
else if(!array_key_exists('spouse', $family_composition))
|
||||||
|
{
|
||||||
|
$family_composition['spouse'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($relationship == 'son' || $relationship == 'daughter')
|
||||||
|
{
|
||||||
|
$family_composition['childrens'] = (isset($family_composition['childrens']) ? $family_composition['childrens'] + 1 : 1);
|
||||||
|
}
|
||||||
|
else if(!array_key_exists('childrens', $family_composition))
|
||||||
|
{
|
||||||
|
$family_composition['childrens'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($relationship == 'father' || $relationship == 'mother')
|
||||||
|
{
|
||||||
|
$family_composition['parents'] = (isset($family_composition['parents']) ? $family_composition['parents'] + 1 : 1);
|
||||||
|
}
|
||||||
|
else if(!array_key_exists('parents', $family_composition))
|
||||||
|
{
|
||||||
|
$family_composition['parents'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($relationship == 'father-in-law' || $relationship == 'mother-in-law')
|
||||||
|
{
|
||||||
|
$family_composition['parents-in-law'] = (isset($family_composition['parents-in-law']) ? $family_composition['parents-in-law'] + 1 : 1);
|
||||||
|
}
|
||||||
|
else if(!array_key_exists('parents-in-law', $family_composition))
|
||||||
|
{
|
||||||
|
$family_composition['parents-in-law'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return ($family_composition);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('compare_incoming_family_slab_with_configured_slab'))
|
||||||
|
{
|
||||||
|
// function compare_incoming_family_slab_with_configured_slab($slab,$incoming_familiy_composition)
|
||||||
|
// {
|
||||||
|
// $relationship_mapping = [
|
||||||
|
// "self" => ["self"],
|
||||||
|
// "spouse" => ["spouse"],
|
||||||
|
// "childrens" => ["son", "daughter"],
|
||||||
|
// "parents" => ["father", "mother"],
|
||||||
|
// "parents-in-law" => ["father-in-law", "mother-in-law"],
|
||||||
|
// "either-parents-pil" => ["either-parents-pil"]
|
||||||
|
// ];
|
||||||
|
|
||||||
|
// $result = ['is_applicable' => false,'applicable_members' => []];
|
||||||
|
// $configured_familiy_composition = json_decode($slab['slab_rates'][0]['additional_relationship'],true);
|
||||||
|
// Kint::dump($incoming_familiy_composition);//die();
|
||||||
|
// Kint::dump($configured_familiy_composition);//die();
|
||||||
|
// unset($configured_familiy_composition['either-parents-pil']);
|
||||||
|
// unset($configured_familiy_composition['elders_count']);
|
||||||
|
|
||||||
|
// if(count($configured_familiy_composition))
|
||||||
|
// {
|
||||||
|
// foreach($configured_familiy_composition as $key => $value)
|
||||||
|
// {
|
||||||
|
// if($value != 'NA')
|
||||||
|
// {
|
||||||
|
// // echo 'OUTSIDE - ' . $value . $incoming_familiy_composition[$key];
|
||||||
|
// if(isset($incoming_familiy_composition[$key]) && ($incoming_familiy_composition[$key] == $value || $value == 'any') )
|
||||||
|
// {
|
||||||
|
// // echo 'INSIDE - ' . $value;
|
||||||
|
// $result['is_applicable'] = true;
|
||||||
|
// $result['applicable_members'] = array_merge($result['applicable_members'],$relationship_mapping[ $key ]);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// $result['is_applicable'] = false;
|
||||||
|
// $result['applicable_members'] = [];
|
||||||
|
// // break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// $result['is_applicable'] = false;
|
||||||
|
// $result['applicable_members'] = [];
|
||||||
|
// }
|
||||||
|
// // dd($result);
|
||||||
|
// return $result;
|
||||||
|
// }
|
||||||
|
|
||||||
|
function compare_incoming_family_slab_with_configured_slab($slab, $incoming_familiy_composition)
|
||||||
|
{
|
||||||
|
$relationship_mapping = [
|
||||||
|
"self" => ["self"],
|
||||||
|
"spouse" => ["spouse"],
|
||||||
|
"childrens" => ["son", "daughter"],
|
||||||
|
"parents" => ["father", "mother"],
|
||||||
|
"parents-in-law" => ["father-in-law", "mother-in-law"],
|
||||||
|
"either-parents-pil" => ["either-parents-pil"]
|
||||||
|
];
|
||||||
|
|
||||||
|
$result = ['is_applicable' => false, 'applicable_members' => []];
|
||||||
|
$configured_familiy_composition = json_decode($slab['slab_rates'][0]['additional_relationship'], true);
|
||||||
|
|
||||||
|
// Remove unnecessary keys
|
||||||
|
// kint::dump($incoming_familiy_composition);
|
||||||
|
// kint::dump($configured_familiy_composition);
|
||||||
|
unset($configured_familiy_composition['either-parents-pil']);
|
||||||
|
unset($configured_familiy_composition['elders_count']);
|
||||||
|
|
||||||
|
// foreach ($configured_familiy_composition as $key => $value) {
|
||||||
|
// if ($value === 0) {
|
||||||
|
// // If any relationship is zero, make the rack rate not applicable
|
||||||
|
// return $result;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (count($configured_familiy_composition)) {
|
||||||
|
foreach ($configured_familiy_composition as $key => $value) {
|
||||||
|
if ( $value != 'NA') {
|
||||||
|
if (isset($incoming_familiy_composition[$key])) {
|
||||||
|
if ($incoming_familiy_composition[$key] == $value || $value == 'any') {
|
||||||
|
$result['is_applicable'] = true;
|
||||||
|
$result['applicable_members'] = array_merge($result['applicable_members'], $relationship_mapping[$key]);
|
||||||
|
} else {
|
||||||
|
$result['is_applicable'] = false;
|
||||||
|
$result['applicable_members'] = [];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$result['is_applicable'] = false;
|
||||||
|
$result['applicable_members'] = [];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$result['is_applicable'] = false;
|
||||||
|
$result['applicable_members'] = [];
|
||||||
|
}
|
||||||
|
// dd($result);
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('get_applicable_familiy_members'))
|
||||||
|
{
|
||||||
|
function get_applicable_familiy_members($family_data,$applicable_members)
|
||||||
|
{
|
||||||
|
$slug = \Config\Services::slug();
|
||||||
|
$result = ['index' => [],'max_age'=> [],'max_count' => 0];
|
||||||
|
foreach ($family_data as $index => $family_member)
|
||||||
|
{
|
||||||
|
if(in_array($slug->slugify($family_member[5]),$applicable_members))
|
||||||
|
{
|
||||||
|
$result['index'] = array_merge($result['index'],[$index]);
|
||||||
|
$result['max_age'] = array_merge($result['max_age'],[calculate_days_bw_dates(from_date: $family_member[3])->y]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$result['max_count'] = count($result['index']);
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('check_unit'))
|
||||||
|
{
|
||||||
|
function check_unit($row,$existing_units)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
if(in_array($row['current_action'], ['I','A','MI']) )
|
||||||
|
{
|
||||||
|
if(count($existing_units) == 1)
|
||||||
|
{
|
||||||
|
if(empty(trim($row[18])))
|
||||||
|
{
|
||||||
|
return array('status' => true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(strtolower($row[5]) == 'self')
|
||||||
|
{
|
||||||
|
if(in_array(trim($row[18]),$existing_units)) //18 is unit name
|
||||||
|
{
|
||||||
|
return array('status' => true);
|
||||||
|
}
|
||||||
|
else if(!empty(trim($row[18])))
|
||||||
|
{
|
||||||
|
return array('status' => false,'error' => 'wrong unit name');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return array('status' => false,'error' => 'name of the unit is mandantory');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(empty(trim($row[18])))
|
||||||
|
{
|
||||||
|
return array('status' => true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(in_array(trim($row[18]),$existing_units)) //18 is unit name
|
||||||
|
{
|
||||||
|
return array('status' => true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return array('status' => false,'error' => 'wrong unit name');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return array('status' => true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!function_exists('transform_si_excel_row_to_calculatable_format'))
|
||||||
|
{
|
||||||
|
function transform_si_excel_row_to_calculatable_format(array $employee,array$employee_policy,array $maxage_and_maxcount,array $slab_details,string $applicable_slab_name,string $augmented_si,array $grid_master)
|
||||||
|
{
|
||||||
|
$employee['temp'] = [];
|
||||||
|
$employee['temp']['max_age'] = $maxage_and_maxcount[0]['max_age'];
|
||||||
|
$employee['temp']['max_count'] = $maxage_and_maxcount[0]['family_member_count'];
|
||||||
|
$employee['temp']['grid_name'] = $applicable_slab_name;
|
||||||
|
$employee['temp']['grid_master'] = $grid_master;
|
||||||
|
$employee['temp']['acting_self'] = true;
|
||||||
|
$employee['temp']['premium_type'] = $grid_master['premium_type'];
|
||||||
|
$employee['temp']['grid_type'] = $applicable_slab_name;
|
||||||
|
$employee['temp']['grid_id'] = $grid_master['ui_type'];
|
||||||
|
$employee['temp']['action'] = 'SI';
|
||||||
|
$employee['temp']['source'] = 'excel';
|
||||||
|
$employee['temp']['emp_id'] = null;
|
||||||
|
$employee['temp']['emp_policy_id'] = null;
|
||||||
|
$employee['temp']['policy_status'] = null;
|
||||||
|
$employee['temp']['emp_status'] = null;
|
||||||
|
$employee['temp']['rata_premimum'] = null;
|
||||||
|
|
||||||
|
return $employee;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('group_slab_rates_basedon_name'))
|
||||||
|
{
|
||||||
|
function group_slab_rates_basedon_name($slab_details)
|
||||||
|
{
|
||||||
|
// dd($slab_details);
|
||||||
|
//grouping slab details by rack rate name
|
||||||
|
$temp_slab_rates = [];
|
||||||
|
$pre_name = '';
|
||||||
|
$pre_grid_master = [];
|
||||||
|
foreach ($slab_details['slab_rates'] as $key => $value)
|
||||||
|
{
|
||||||
|
$pre_grid_master = $value['grid_master'];
|
||||||
|
unset($value['grid_master']);
|
||||||
|
if($value['rack_rate_name'] != $pre_name)
|
||||||
|
{
|
||||||
|
$pre_name = $value['rack_rate_name'];
|
||||||
|
$temp_slab_rates[ $value['rack_rate_name'] ]['slab_rates'][] = $value;
|
||||||
|
}
|
||||||
|
$temp_slab_rates[ $value['rack_rate_name'] ]['slab_rates'][] = $value;
|
||||||
|
$temp_slab_rates[ $value['rack_rate_name'] ]['grid_master'] = $pre_grid_master;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $temp_slab_rates;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -12,7 +12,7 @@ class sendMailNotification
|
|||||||
{
|
{
|
||||||
public static function sendMailNotification($action, $params)
|
public static function sendMailNotification($action, $params)
|
||||||
{
|
{
|
||||||
print_r($params);die;
|
$wholeData =[];
|
||||||
if ($action == 'member_welcome_mail') {
|
if ($action == 'member_welcome_mail') {
|
||||||
$dataToInsert = $params['dataToInsert'];
|
$dataToInsert = $params['dataToInsert'];
|
||||||
$notification = $params['notification'];
|
$notification = $params['notification'];
|
||||||
@ -37,7 +37,6 @@ class sendMailNotification
|
|||||||
}
|
}
|
||||||
return $wholeData;
|
return $wholeData;
|
||||||
} else if($action == 'member_reminder_mail'){
|
} else if($action == 'member_reminder_mail'){
|
||||||
|
|
||||||
$EmployeeModel = new EmployeeModel();
|
$EmployeeModel = new EmployeeModel();
|
||||||
$emp_data = $params['emp_data'];
|
$emp_data = $params['emp_data'];
|
||||||
$notification_data = $params['notification_data'];
|
$notification_data = $params['notification_data'];
|
||||||
@ -51,27 +50,46 @@ class sendMailNotification
|
|||||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
$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("[[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);
|
$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)) {
|
if ($emp_data && (isset($notification_data) && $notification_data['enabled'] == 1)) {
|
||||||
|
if(isset($emp_data['relationship'])){
|
||||||
|
if ($emp_data['relationship'] == 'Self') {
|
||||||
|
if(count($emp_data) > 0){
|
||||||
|
$mail ='';
|
||||||
|
if ($emp_data['relationship'] == 'Self') {
|
||||||
|
$employee_name =$emp_data['name'];
|
||||||
|
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
|
||||||
|
$mail = $emp_data['email_corporate'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$mail ='';
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
$employee_name =$emp_data['name'];
|
||||||
|
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
|
||||||
|
$mail = $emp_data['email_corporate'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($mail) && !empty($mail)) {
|
||||||
|
$wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
|
||||||
|
}
|
||||||
|
}else{
|
||||||
foreach ($emp_data as $key => $value) {
|
foreach ($emp_data as $key => $value) {
|
||||||
if ($value['relationship'] != 'Self') {
|
if ($value['relationship'] != 'Self') {
|
||||||
|
|
||||||
$emp_data = $EmployeeModel->where('client_id', $client_data['id'])->where('emp_code', $value['emp_code'])->where('is_active',1)->findAll();
|
$emp_data = $EmployeeModel->where('client_id', $client_data['id'])->where('emp_code', $value['emp_code'])->where('is_active',1)->findAll();
|
||||||
|
|
||||||
if(count($emp_data) > 1){
|
if(count($emp_data) > 1){
|
||||||
$mail ='';
|
$mail ='';
|
||||||
foreach ($emp_data as $key => $values) {
|
foreach ($emp_data as $key => $values) {
|
||||||
if ($value['relationship'] == 'Self') {
|
if ($value['relationship'] == 'Self') {
|
||||||
$employee_name =$values['name'];
|
$employee_name =$values['name'];
|
||||||
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
|
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
|
||||||
|
|
||||||
$mail = $values['email_corporate'];
|
$mail = $values['email_corporate'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$mail ='';
|
$mail ='';
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
$employee_name =$value['name'];
|
$employee_name =$value['name'];
|
||||||
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
|
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
|
||||||
@ -81,13 +99,15 @@ class sendMailNotification
|
|||||||
$wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
|
$wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count($wholeData) < 1) {
|
|
||||||
$wholeData = [];
|
|
||||||
}
|
|
||||||
return $wholeData;
|
|
||||||
}else{
|
|
||||||
return "false";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (count($wholeData) < 1) {
|
||||||
|
$wholeData = [];
|
||||||
|
}
|
||||||
|
return $wholeData;
|
||||||
|
// }else{
|
||||||
|
// return "false";
|
||||||
|
// }
|
||||||
} else if($action == 'member_ecard_mail'){
|
} else if($action == 'member_ecard_mail'){
|
||||||
|
|
||||||
$notification = $params['notification'];
|
$notification = $params['notification'];
|
||||||
@ -129,7 +149,7 @@ class sendMailNotification
|
|||||||
return $wholeData;
|
return $wholeData;
|
||||||
} else if($action == 'member_review_and_summary_mail'){
|
} else if($action == 'member_review_and_summary_mail'){
|
||||||
|
|
||||||
$array_list = $params['array_list'];
|
$array_list = $params['array_list'];//employeee lst
|
||||||
$client_policy_id = $params['client_policy_id'];
|
$client_policy_id = $params['client_policy_id'];
|
||||||
$emp_code = $params['emp_code'];
|
$emp_code = $params['emp_code'];
|
||||||
$client_id = $params['client_id'];
|
$client_id = $params['client_id'];
|
||||||
|
|||||||
@ -65,31 +65,37 @@ class CDMasterModel extends Model
|
|||||||
{
|
{
|
||||||
|
|
||||||
$query = $this->db->table('cd_master')
|
$query = $this->db->table('cd_master')
|
||||||
->select('cd_master.*, clients.client_name, clients.short_name, insurers.name AS insurer_name, user_profiles.first_name AS user_name, IFNULL(cd_ac_counts.cd_ac_no_count, 0) AS cd_ac_no_count, IFNULL(cd_ac_counts_for_cdt.cd_ac_no_count_cd_tranction, 0) AS cd_ac_no_count_cd_tranction')
|
->select('cd_master.*, clients.client_name, clients.short_name, insurers.name AS insurer_name, user_profiles.first_name AS user_name, IFNULL(cd_ac_counts.cd_ac_no_count, 0) AS cd_ac_no_count, IFNULL(cd_ac_counts_for_cdt.cd_ac_no_count_cd_tranction, 0) AS cd_ac_no_count_cd_tranction')
|
||||||
->join('clients', 'clients.id = cd_master.client_id')
|
->join('clients', 'clients.id = cd_master.client_id')
|
||||||
->join('insurers', 'insurers.id = cd_master.insurer_id')
|
->join('insurers', 'insurers.id = cd_master.insurer_id')
|
||||||
->join('user_profiles', 'user_profiles.id = cd_master.created_by')
|
->join('user_profiles', 'user_profiles.id = cd_master.created_by')
|
||||||
->join(
|
->join(
|
||||||
'(SELECT cd_master.cd_ac_no, COUNT(client_policy.cd_ac_no) AS cd_ac_no_count
|
'(SELECT cd_master.cd_ac_no, COUNT(client_policy.cd_ac_no) AS cd_ac_no_count
|
||||||
FROM cd_master
|
FROM cd_master
|
||||||
JOIN client_policy ON client_policy.cd_ac_no = cd_master.cd_ac_no
|
JOIN client_policy ON client_policy.cd_ac_no = cd_master.cd_ac_no
|
||||||
|
WHERE client_policy.is_active = 1
|
||||||
|
AND cd_master.is_active = 1
|
||||||
GROUP BY cd_master.cd_ac_no) AS cd_ac_counts',
|
GROUP BY cd_master.cd_ac_no) AS cd_ac_counts',
|
||||||
'cd_ac_counts.cd_ac_no = cd_master.cd_ac_no',
|
'cd_ac_counts.cd_ac_no = cd_master.cd_ac_no',
|
||||||
'left'
|
'left'
|
||||||
)
|
)
|
||||||
->join(
|
->join(
|
||||||
'(SELECT cd_master.cd_ac_no, COUNT(cash_deposit.cd_ac_no) AS cd_ac_no_count_cd_tranction
|
'(SELECT cd_master.cd_ac_no, COUNT(cash_deposit.cd_ac_no) AS cd_ac_no_count_cd_tranction
|
||||||
FROM cd_master
|
FROM cd_master
|
||||||
JOIN cash_deposit ON cash_deposit.cd_ac_no = cd_master.cd_ac_no
|
JOIN cash_deposit ON cash_deposit.cd_ac_no = cd_master.cd_ac_no
|
||||||
|
WHERE cash_deposit.is_active = 1
|
||||||
|
AND cd_master.is_active = 1
|
||||||
GROUP BY cd_master.cd_ac_no) AS cd_ac_counts_for_cdt',
|
GROUP BY cd_master.cd_ac_no) AS cd_ac_counts_for_cdt',
|
||||||
'cd_ac_counts_for_cdt.cd_ac_no = cd_master.cd_ac_no',
|
'cd_ac_counts_for_cdt.cd_ac_no = cd_master.cd_ac_no',
|
||||||
'left'
|
'left'
|
||||||
)
|
)
|
||||||
->where('cd_master.is_active', 1)
|
->where('cd_master.is_active', 1)
|
||||||
->get();
|
->where('clients.is_active', 1)
|
||||||
|
->where('insurers.is_active', 1)
|
||||||
|
->where('user_profiles.is_active', 1)
|
||||||
|
->get();
|
||||||
|
|
||||||
$result = $query->getResultArray();
|
$result = $query->getResultArray();
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,6 +24,7 @@ class ClientBranchModel extends Model
|
|||||||
"address2",
|
"address2",
|
||||||
"gst",
|
"gst",
|
||||||
"sez",
|
"sez",
|
||||||
|
"units",
|
||||||
];
|
];
|
||||||
|
|
||||||
public function getBranchAndContactByBranchId($branch_id){
|
public function getBranchAndContactByBranchId($branch_id){
|
||||||
@ -38,4 +39,14 @@ class ClientBranchModel extends Model
|
|||||||
->getResult();
|
->getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getExisitingUnits(string $client_id,string $client_branch_id)
|
||||||
|
{
|
||||||
|
$res = $this->select('client_branch.units')
|
||||||
|
->where('client_id', $client_id)
|
||||||
|
->where('id', $client_branch_id)
|
||||||
|
->find();
|
||||||
|
//->getResult();
|
||||||
|
return (json_decode($res[0]['units']));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,8 @@ class ClientDepositModel extends Model
|
|||||||
"client_policy_id",
|
"client_policy_id",
|
||||||
"cd_ac_no",
|
"cd_ac_no",
|
||||||
"endorsement_no",
|
"endorsement_no",
|
||||||
|
"event_name",
|
||||||
|
"unit",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -68,11 +68,11 @@ class ClientModel extends Model
|
|||||||
'client_policy.id as client_policy_id',
|
'client_policy.id as client_policy_id',
|
||||||
'client_policy.policy_terms',
|
'client_policy.policy_terms',
|
||||||
'client_policy.policy_no',
|
'client_policy.policy_no',
|
||||||
'p.name',
|
// 'p.name',
|
||||||
'pt.policy_type',
|
'pt.policy_type',
|
||||||
])
|
])
|
||||||
->join('client_branch', 'client_branch.id = client_policy.client_branch_id')
|
->join('client_branch', 'client_branch.id = client_policy.client_branch_id')
|
||||||
->join('policies p', 'p.id = client_policy.policy_id')
|
// ->join('policies p', 'p.id = client_policy.policy_id')
|
||||||
->join('policy_type pt','client_policy.policy_type_id = pt.id')
|
->join('policy_type pt','client_policy.policy_type_id = pt.id')
|
||||||
->where('client_policy.client_id',$client['id'])
|
->where('client_policy.client_id',$client['id'])
|
||||||
->where('client_policy.is_active', 1)
|
->where('client_policy.is_active', 1)
|
||||||
|
|||||||
@ -19,6 +19,7 @@ class ClientPolicyModel extends Model
|
|||||||
"policy_type_id",
|
"policy_type_id",
|
||||||
"policy_start_date",
|
"policy_start_date",
|
||||||
"policy_end_date",
|
"policy_end_date",
|
||||||
|
"reminder_date",
|
||||||
"insured",
|
"insured",
|
||||||
"no_of_employees",
|
"no_of_employees",
|
||||||
"no_of_lives",
|
"no_of_lives",
|
||||||
@ -45,6 +46,8 @@ class ClientPolicyModel extends Model
|
|||||||
"client_branch_id",
|
"client_branch_id",
|
||||||
"cd_ac_no",
|
"cd_ac_no",
|
||||||
"gst",
|
"gst",
|
||||||
|
"enrolment_visibility",
|
||||||
|
"is_active",
|
||||||
];
|
];
|
||||||
|
|
||||||
public function getClientPolicyById($id){
|
public function getClientPolicyById($id){
|
||||||
@ -73,7 +76,6 @@ class ClientPolicyModel extends Model
|
|||||||
->select('client_policy.*')
|
->select('client_policy.*')
|
||||||
->select('insurers.name as insurer_name, insurers.short_name as insurer_short')
|
->select('insurers.name as insurer_name, insurers.short_name as insurer_short')
|
||||||
->select('tpa.name as tpa_name, tpa.short_name as tpa_short')
|
->select('tpa.name as tpa_name, tpa.short_name as tpa_short')
|
||||||
->select('policies.name as policy_name, policies.policy_type_id')
|
|
||||||
->select('policy_type.policy_type as policy_type_name')
|
->select('policy_type.policy_type as policy_type_name')
|
||||||
->select('insurer_branch.branch_name as insurer_branch_name, insurer_branch.branch_code as insurer_branch_code')
|
->select('insurer_branch.branch_name as insurer_branch_name, insurer_branch.branch_code as insurer_branch_code')
|
||||||
->select('tpa_branch.branch_name as tpa_branch_name, tpa_branch.branch_code as tpa_branch_code')
|
->select('tpa_branch.branch_name as tpa_branch_name, tpa_branch.branch_code as tpa_branch_code')
|
||||||
@ -83,8 +85,7 @@ class ClientPolicyModel extends Model
|
|||||||
->join('insurer_branch', 'client_policy.insurer_branch_id = insurer_branch.id')
|
->join('insurer_branch', 'client_policy.insurer_branch_id = insurer_branch.id')
|
||||||
->join('tpa', 'tpa.id = client_policy.tpa_id', 'left')
|
->join('tpa', 'tpa.id = client_policy.tpa_id', 'left')
|
||||||
->join('tpa_branch', 'client_policy.tpa_branch_id = tpa_branch.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 = client_policy.policy_type_id')
|
||||||
->join('policy_type', 'policy_type.id = policies.policy_type_id')
|
|
||||||
->join('client_branch', 'client_branch.id = client_policy.client_branch_id')
|
->join('client_branch', 'client_branch.id = client_policy.client_branch_id')
|
||||||
->where('client_policy.client_id', $client_id)
|
->where('client_policy.client_id', $client_id)
|
||||||
->where('client_policy.policy_status', 1)
|
->where('client_policy.policy_status', 1)
|
||||||
@ -186,7 +187,7 @@ class ClientPolicyModel extends Model
|
|||||||
return $this->db->table('cash_deposit')
|
return $this->db->table('cash_deposit')
|
||||||
->select('cash_deposit.*')
|
->select('cash_deposit.*')
|
||||||
->select('insurers.name as insurer_name, insurers.short_name as insurer_short')
|
->select('insurers.name as insurer_name, insurers.short_name as insurer_short')
|
||||||
->select('clients.client_name as clientname, clients.short_name as clientshort')
|
->select('clients.client_name as clientname, clients.short_name as clientshort, client_policy.policy_no')
|
||||||
// ->select('policies.name as policy_name')
|
// ->select('policies.name as policy_name')
|
||||||
->select('policy_type.policy_type')
|
->select('policy_type.policy_type')
|
||||||
->select('user_profiles.first_name as username')
|
->select('user_profiles.first_name as username')
|
||||||
@ -355,6 +356,34 @@ public function getClientPolicyByPolicyType($client_id, $type){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getPolicyTypeForPolicyBinding($client_id){
|
||||||
|
|
||||||
|
$result = $this->table('client_policy')
|
||||||
|
->select('policy_type.*, client_policy.id as client_policy_id, client_policy.policy_no')
|
||||||
|
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
||||||
|
->where('client_policy.client_id', $client_id)
|
||||||
|
->where('client_policy.is_active', 1)
|
||||||
|
->whereIn('policy_type.id', [2,3])
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getCliendDataForExcelFileName($client_policy_id){
|
||||||
|
|
||||||
|
return $this->table('client_policy')
|
||||||
|
->select('clients.short_name, policy_type.policy_type, client_branch.branch_code')
|
||||||
|
->join('clients', 'clients.id = client_policy.client_id')
|
||||||
|
->join('client_branch', 'client_branch.id = client_policy.client_branch_id')
|
||||||
|
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
||||||
|
->where('client_policy.id', $client_policy_id)
|
||||||
|
->where('client_policy.is_active', 1)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -41,6 +41,7 @@ class EmployeeModel extends Model
|
|||||||
"client_branch_id",
|
"client_branch_id",
|
||||||
"token_time_out",
|
"token_time_out",
|
||||||
"emp_type",
|
"emp_type",
|
||||||
|
"unit",
|
||||||
"mpin"
|
"mpin"
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -105,7 +106,7 @@ 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 = [],array $client_branch_id = [])
|
public function getEmpFamilybyEmpCode(string $client_policy_id = null,string $emp_code = null,string $client_id = null,array $emp_status = [],array $policy_status = [],array $relationship = [],array $client_branch_id = [])
|
||||||
{
|
{
|
||||||
$result = $this->select(['employees.id as emp_id', 'employees.client_id','employees.client_branch_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'])
|
$result = $this->select(['employees.id as emp_id', 'employees.client_id','employees.client_branch_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','employees.unit','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('employee_polices', 'employee_polices.employee_id = employees.id')
|
||||||
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
|
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
|
||||||
->join('policies', 'policies.id = client_policy.policy_id')
|
->join('policies', 'policies.id = client_policy.policy_id')
|
||||||
@ -158,9 +159,9 @@ class EmployeeModel extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
// for EMP rest API process do not change
|
// for EMP rest API process do not change
|
||||||
public function checkExistingEmployee($arr)
|
public function checkExistingEmployee($arr,$client_branch_id)
|
||||||
{
|
{
|
||||||
return $this->where('emp_code',$arr['emp_code'])->where('name',$arr['name'])->where('client_id', $arr['client_id'])->first();
|
return $this->where('emp_code',$arr['emp_code'])->where('name',$arr['name'])->where('client_id', $arr['client_id'])->where('client_branch_id', $client_branch_id)->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -189,4 +190,24 @@ class EmployeeModel extends Model
|
|||||||
return ($result);
|
return ($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getFamiliyCountAndMaxage(string $emp_code)
|
||||||
|
{
|
||||||
|
$query = "
|
||||||
|
SELECT emp_code,family_member_count,max_age
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
emp_code,
|
||||||
|
COUNT(*) AS family_member_count,
|
||||||
|
MAX(TIMESTAMPDIFF(YEAR, dob, CURDATE())) AS max_age
|
||||||
|
FROM employees where emp_code = '{$emp_code}'
|
||||||
|
GROUP BY emp_code
|
||||||
|
) AS family_stats
|
||||||
|
ORDER BY family_member_count DESC, max_age DESC
|
||||||
|
LIMIT 1;";
|
||||||
|
$results = $this->db->query($query)->getResult();
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -75,7 +75,7 @@ class EmployeePolicyModel extends Model
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------------------
|
||||||
public function getEmployeePolicy($client_id = 0, $policy_id=0, $status=0, $branch_id=0, $emp_code="", $emp_name="")
|
public function getEmployeePolicy($client_id = 0, $policy_id=0, $status=0, $branch_id=0, $emp_code="", $emp_name="")
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -130,7 +130,15 @@ class EmployeePolicyModel extends Model
|
|||||||
$result->where('employee_polices.client_policy_id', $policy_id);
|
$result->where('employee_polices.client_policy_id', $policy_id);
|
||||||
}
|
}
|
||||||
if ($status !=0 && !empty($status)) {
|
if ($status !=0 && !empty($status)) {
|
||||||
$result->where('employee_polices.status', $status);
|
if($status == 'active'){
|
||||||
|
$result->where('employee_polices.tpa_id IS NOT NULL');
|
||||||
|
$result->where('employee_polices.uhid IS NOT NULL');
|
||||||
|
}else if($status == 'pending'){
|
||||||
|
$status = 'active';
|
||||||
|
$result->where('employee_polices.status', $status);
|
||||||
|
}else{
|
||||||
|
$result->where('employee_polices.status', $status);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!empty($emp_code)) {
|
if (!empty($emp_code)) {
|
||||||
$result->where('emp.emp_code', $emp_code);
|
$result->where('emp.emp_code', $emp_code);
|
||||||
@ -146,8 +154,6 @@ class EmployeePolicyModel extends Model
|
|||||||
return $result->findAll();
|
return $result->findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//for emp onboard do not change
|
//for emp onboard do not change
|
||||||
public function checkExistingEmpPolicy($arr)
|
public function checkExistingEmpPolicy($arr)
|
||||||
{
|
{
|
||||||
@ -156,8 +162,7 @@ class EmployeePolicyModel extends Model
|
|||||||
->where('is_active',1)
|
->where('is_active',1)
|
||||||
->find();
|
->find();
|
||||||
}
|
}
|
||||||
|
//-------------------------------------------------------------------------------------------------------
|
||||||
//------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
public function getInceptionEmployeeDataForExportExcel($ref_data)
|
public function getInceptionEmployeeDataForExportExcel($ref_data)
|
||||||
@ -176,6 +181,21 @@ class EmployeePolicyModel extends Model
|
|||||||
$id = 'uhid';
|
$id = 'uhid';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$datas = '';
|
||||||
|
if($event === 'inception'){
|
||||||
|
|
||||||
|
$datas = 'I';
|
||||||
|
|
||||||
|
}else if($event === 'dependent_addition'){
|
||||||
|
|
||||||
|
$datas = 'DA';
|
||||||
|
|
||||||
|
}else if($event === 'addition'){
|
||||||
|
|
||||||
|
$datas = 'A';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$sql = "
|
$sql = "
|
||||||
SELECT
|
SELECT
|
||||||
employees.name AS emp_name,
|
employees.name AS emp_name,
|
||||||
@ -185,9 +205,20 @@ class EmployeePolicyModel extends Model
|
|||||||
employees.change_event AS change_event,
|
employees.change_event AS change_event,
|
||||||
employees.relationship AS emp_relationship,
|
employees.relationship AS emp_relationship,
|
||||||
employees.relationship_code AS emp_relationship_code,
|
employees.relationship_code AS emp_relationship_code,
|
||||||
|
'$datas' as event_type_data,
|
||||||
|
|
||||||
|
employees.doj AS emp_doj,
|
||||||
|
employees.mobile AS emp_mobile,
|
||||||
|
employees.email_corporate AS emp_email_c,
|
||||||
|
employees.email_personal AS emp_email_p,
|
||||||
|
employees.band AS emp_grade,
|
||||||
|
employees.designation AS emp_designation,
|
||||||
|
employees.basic_pay AS emp_basic_pay,
|
||||||
|
|
||||||
TIMESTAMPDIFF(YEAR, employees.dob, CURDATE()) AS emp_age,
|
TIMESTAMPDIFF(YEAR, employees.dob, CURDATE()) AS emp_age,
|
||||||
employees.emp_type as emp_type,
|
employees.emp_type as emp_type,
|
||||||
|
|
||||||
|
|
||||||
employee_polices.id as primaryKey,
|
employee_polices.id as primaryKey,
|
||||||
employee_polices.tpa_id,
|
employee_polices.tpa_id,
|
||||||
employee_polices.uhid,
|
employee_polices.uhid,
|
||||||
@ -195,16 +226,23 @@ class EmployeePolicyModel extends Model
|
|||||||
employee_polices.basic_cover_si,
|
employee_polices.basic_cover_si,
|
||||||
employee_polices.date_coverage,
|
employee_polices.date_coverage,
|
||||||
employee_polices.policy_end_date,
|
employee_polices.policy_end_date,
|
||||||
employee_polices.days,
|
employee_polices.days as no_of_days,
|
||||||
employee_polices.premium,
|
employee_polices.premium,
|
||||||
employee_polices.rata_premimum,
|
employee_polices.rata_premimum as pro_rata_premium,
|
||||||
employee_polices.gst,
|
employee_polices.gst,
|
||||||
(employee_polices.rata_premimum + employee_polices.gst) AS total,
|
(employee_polices.rata_premimum + employee_polices.gst) AS total,
|
||||||
batch_data.emp_policy_id,
|
batch_data.emp_policy_id,
|
||||||
batch_data.bl AS batch_list_batch_code,
|
batch_data.bl AS batch_list_batch_code,
|
||||||
batch_data.bf AS batch_files_batch_code
|
batch_data.bf AS batch_files_batch_code,
|
||||||
|
|
||||||
|
CASE
|
||||||
|
WHEN client_branch.sez = 0 THEN 'NON-SEZ'
|
||||||
|
WHEN client_branch.sez = 1 THEN 'SEZ'
|
||||||
|
END as sez
|
||||||
|
|
||||||
FROM employee_polices
|
FROM employee_polices
|
||||||
LEFT JOIN employees ON employees.id = employee_polices.employee_id
|
LEFT JOIN employees ON employees.id = employee_polices.employee_id
|
||||||
|
LEFT JOIN client_branch ON client_branch.id = employees.client_branch_id
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT
|
SELECT
|
||||||
batch_list.emp_policy_id,
|
batch_list.emp_policy_id,
|
||||||
@ -223,7 +261,6 @@ class EmployeePolicyModel extends Model
|
|||||||
AND employee_polices.status = 'active'
|
AND employee_polices.status = 'active'
|
||||||
AND employees.is_active = 1
|
AND employees.is_active = 1
|
||||||
AND employees.emp_status = 'active'
|
AND employees.emp_status = 'active'
|
||||||
|
|
||||||
";
|
";
|
||||||
|
|
||||||
// Get the result set
|
// Get the result set
|
||||||
@ -257,9 +294,20 @@ class EmployeePolicyModel extends Model
|
|||||||
employees.dob AS emp_dob,
|
employees.dob AS emp_dob,
|
||||||
employees.gender AS emp_gender,
|
employees.gender AS emp_gender,
|
||||||
employees.client_id AS emp_client_id,
|
employees.client_id AS emp_client_id,
|
||||||
employees.emp_type as emp_type,
|
employees.emp_type as emp_temp_codeype,
|
||||||
employee_polices.uhid,
|
employee_polices.uhid,
|
||||||
employees.relationship_code,
|
employees.relationship_code,
|
||||||
|
employees.relationship,
|
||||||
|
'C' as event_type_data,
|
||||||
|
|
||||||
|
employees.doj AS emp_doj,
|
||||||
|
employees.mobile AS emp_mobile,
|
||||||
|
employees.email_corporate AS emp_email_c,
|
||||||
|
employees.email_personal AS emp_email_p,
|
||||||
|
employees.band AS emp_grade,
|
||||||
|
employees.designation AS emp_designation,
|
||||||
|
employees.basic_pay AS emp_basic_pay,
|
||||||
|
|
||||||
batch_data.emp_policy_id,
|
batch_data.emp_policy_id,
|
||||||
batch_data.bl AS batch_list_batch_code,
|
batch_data.bl AS batch_list_batch_code,
|
||||||
batch_data.bf AS batch_files_batch_code
|
batch_data.bf AS batch_files_batch_code
|
||||||
@ -324,7 +372,19 @@ class EmployeePolicyModel extends Model
|
|||||||
employees.dob AS emp_dob,
|
employees.dob AS emp_dob,
|
||||||
employees.gender AS emp_gender,
|
employees.gender AS emp_gender,
|
||||||
employees.relationship_code AS emp_relationship_code,
|
employees.relationship_code AS emp_relationship_code,
|
||||||
|
employees.relationship AS emp_relationship,
|
||||||
employees.emp_type as emp_type,
|
employees.emp_type as emp_type,
|
||||||
|
'SI' as event_type_data,
|
||||||
|
|
||||||
|
|
||||||
|
employees.doj AS emp_doj,
|
||||||
|
employees.mobile AS emp_mobile,
|
||||||
|
employees.email_corporate AS emp_email_c,
|
||||||
|
employees.email_personal AS emp_email_p,
|
||||||
|
employees.band AS emp_grade,
|
||||||
|
employees.designation AS emp_designation,
|
||||||
|
employees.basic_pay AS emp_basic_pay,
|
||||||
|
|
||||||
employee_polices.uhid AS risk_id,
|
employee_polices.uhid AS risk_id,
|
||||||
employee_polices.pre_existing_alignments,
|
employee_polices.pre_existing_alignments,
|
||||||
employee_polices.policy_end_date,
|
employee_polices.policy_end_date,
|
||||||
@ -341,11 +401,18 @@ class EmployeePolicyModel extends Model
|
|||||||
|
|
||||||
sidata.new_si_premium - employee_polices.rata_premimum AS difference_premium,
|
sidata.new_si_premium - employee_polices.rata_premimum AS difference_premium,
|
||||||
|
|
||||||
ROUND((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365, 2) AS pro_rata_premimum,
|
ROUND((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365, 2) AS pro_rata_premium,
|
||||||
|
|
||||||
ROUND(((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2) AS gst,
|
ROUND(((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2) AS gst,
|
||||||
|
|
||||||
((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) + ROUND(((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2) AS total
|
ROUND(
|
||||||
|
((sidata.new_si_premium - employee_polices.rata_premimum) *
|
||||||
|
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) +
|
||||||
|
ROUND(
|
||||||
|
((sidata.new_si_premium - employee_polices.rata_premimum) *
|
||||||
|
(DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2
|
||||||
|
), 2
|
||||||
|
) AS total
|
||||||
|
|
||||||
FROM
|
FROM
|
||||||
emp_endorsement a
|
emp_endorsement a
|
||||||
@ -441,12 +508,23 @@ class EmployeePolicyModel extends Model
|
|||||||
employees.dob AS emp_dob,
|
employees.dob AS emp_dob,
|
||||||
employees.gender AS emp_gender,
|
employees.gender AS emp_gender,
|
||||||
employees.relationship AS emp_relationship,
|
employees.relationship AS emp_relationship,
|
||||||
|
employees.relationship_code AS emp_relationship_code,
|
||||||
employees.emp_type as emp_type,
|
employees.emp_type as emp_type,
|
||||||
|
'D' as event_type_data,
|
||||||
|
|
||||||
|
employees.doj AS emp_doj,
|
||||||
|
employees.mobile AS emp_mobile,
|
||||||
|
employees.email_corporate AS emp_email_c,
|
||||||
|
employees.email_personal AS emp_email_p,
|
||||||
|
employees.band AS emp_grade,
|
||||||
|
employees.designation AS emp_designation,
|
||||||
|
employees.basic_pay AS emp_basic_pay,
|
||||||
|
|
||||||
employee_polices.basic_cover_si,
|
employee_polices.basic_cover_si,
|
||||||
employee_polices.uhid as risk_id,
|
employee_polices.uhid as uhid,
|
||||||
employee_polices.policy_end_date,
|
employee_polices.policy_end_date,
|
||||||
employee_polices.rata_premimum as premium,
|
employee_polices.premium,
|
||||||
|
employee_polices.rata_premimum as pro_rata_premium,
|
||||||
|
|
||||||
batch_data.emp_policy_id AS emp_policy_id,
|
batch_data.emp_policy_id AS emp_policy_id,
|
||||||
batch_data.bl AS batch_list_batch_code,
|
batch_data.bl AS batch_list_batch_code,
|
||||||
@ -519,96 +597,6 @@ class EmployeePolicyModel extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function updateTPAIDorUHID($update_data)
|
|
||||||
{
|
|
||||||
$client_id = $update_data['client_id'];
|
|
||||||
$client_policy_id = $update_data['client_policy_id'];
|
|
||||||
$name = $update_data['name'];
|
|
||||||
$emp_code = $update_data['emp_code'];
|
|
||||||
$uhid = $update_data['uhid'];
|
|
||||||
$tpa_id = $update_data['tpa_id'];
|
|
||||||
|
|
||||||
$query = "
|
|
||||||
UPDATE employee_polices
|
|
||||||
JOIN employees ON employees.id = employee_polices.employee_id
|
|
||||||
SET employee_polices.tpa_id = '{$tpa_id}',
|
|
||||||
employee_polices.uhid = '{$uhid}'
|
|
||||||
WHERE employees.emp_code = '{$emp_code}'
|
|
||||||
AND employees.name = '{$name}'
|
|
||||||
AND employees.client_id = '{$client_id}'
|
|
||||||
AND employee_polices.client_policy_id = '{$client_policy_id}'
|
|
||||||
";
|
|
||||||
|
|
||||||
$this->query($query);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function updateCorrectionData($update_data)
|
|
||||||
{
|
|
||||||
|
|
||||||
$emp_code = $update_data['emp_code'];
|
|
||||||
$uhid = $update_data['uhid'];
|
|
||||||
$endorsement_id = $update_data['tpa_id'];
|
|
||||||
|
|
||||||
$sql = "
|
|
||||||
UPDATE emp_endorsement
|
|
||||||
JOIN employees ON employees.id = emp_endorsement.pk
|
|
||||||
JOIN employee_polices ON employees.id = employee_polices.employee_id
|
|
||||||
SET emp_endorsement.endorsement_id = '$endorsement_id', emp_endorsement.status = 'complete'
|
|
||||||
WHERE employees.emp_code = '$emp_code'
|
|
||||||
AND employee_polices.uhid = '$uhid'
|
|
||||||
";
|
|
||||||
$query = $this->query($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function updateEndoresmentIdForSIEnhancement($update_data){
|
|
||||||
|
|
||||||
$client_id = $update_data['client_id'];
|
|
||||||
$client_policy_id = $update_data['client_policy_id'];
|
|
||||||
$emp_name = $update_data['emp_name'];
|
|
||||||
$emp_code = $update_data['emp_code'];
|
|
||||||
$endorsement_id = $update_data['endorsement_id'];
|
|
||||||
|
|
||||||
$sql = "
|
|
||||||
UPDATE emp_endorsement
|
|
||||||
JOIN employee_polices ON employee_polices.id = emp_endorsement.pk
|
|
||||||
JOIN employees ON employee_polices.employee_id = employees.id
|
|
||||||
SET emp_endorsement.endorsement_id = '$endorsement_id', emp_endorsement.status = 'complete'
|
|
||||||
WHERE emp_endorsement.emp_code = '$emp_code'
|
|
||||||
AND employees.client_id = '$client_id'
|
|
||||||
AND employee_polices.client_policy_id = '$client_policy_id'
|
|
||||||
AND emp_endorsement.actions = 'si'
|
|
||||||
AND emp_endorsement.name = '$emp_name'
|
|
||||||
";
|
|
||||||
$query = $this->query($sql);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function updateEndoresmentIdForDeletion($update_data)
|
|
||||||
{
|
|
||||||
|
|
||||||
$client_id = $update_data['client_id'];
|
|
||||||
$client_policy_id = $update_data['client_policy_id'];
|
|
||||||
$emp_name = $update_data['emp_name'];
|
|
||||||
$emp_code = $update_data['emp_code'];
|
|
||||||
$endorsement_id = $update_data['endorsement_id'];
|
|
||||||
|
|
||||||
$sql = "
|
|
||||||
UPDATE emp_endorsement
|
|
||||||
JOIN employee_polices ON employee_polices.id = emp_endorsement.pk
|
|
||||||
JOIN employees ON employee_polices.employee_id = employees.id
|
|
||||||
SET emp_endorsement.endorsement_id = '$endorsement_id', emp_endorsement.status = 'complete'
|
|
||||||
WHERE employees.emp_code = '$emp_code'
|
|
||||||
AND employees.client_id = '$client_id'
|
|
||||||
AND employee_polices.client_policy_id = '$client_policy_id'
|
|
||||||
AND employees.name = '$emp_name'
|
|
||||||
";
|
|
||||||
$query = $this->query($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function fetchEmpEndorsementData($fetch_data)
|
public function fetchEmpEndorsementData($fetch_data)
|
||||||
{
|
{
|
||||||
@ -671,7 +659,8 @@ class EmployeePolicyModel extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// //for emp onboard do not change
|
//for emp onboard do not change
|
||||||
|
|
||||||
// public function checkExistingEmpPolicy($arr)
|
// public function checkExistingEmpPolicy($arr)
|
||||||
// {
|
// {
|
||||||
// return $this->where('employee_id',$arr['employee_id'])
|
// return $this->where('employee_id',$arr['employee_id'])
|
||||||
|
|||||||
@ -19,6 +19,7 @@ class FileModel extends Model
|
|||||||
"client_id",
|
"client_id",
|
||||||
"policy_id",
|
"policy_id",
|
||||||
"client_branch_id",
|
"client_branch_id",
|
||||||
|
"uploaded_by"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
23
app/Models/InsurerExcelExportTemplateModel.php
Normal file
23
app/Models/InsurerExcelExportTemplateModel.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class InsurerExcelExportTemplateModel extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'insurer_excel_export_template';
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
protected $allowedFields = [
|
||||||
|
"id",
|
||||||
|
"insurer_id",
|
||||||
|
"policy_type_id",
|
||||||
|
"event_name",
|
||||||
|
"type_name",
|
||||||
|
"jsoncolumns",
|
||||||
|
"created_by",
|
||||||
|
"updated_by",
|
||||||
|
"updated_at",
|
||||||
|
"is_active",
|
||||||
|
];
|
||||||
|
}
|
||||||
@ -18,7 +18,9 @@ class InsurerModel extends Model
|
|||||||
"created_by",
|
"created_by",
|
||||||
"updated_by",
|
"updated_by",
|
||||||
"is_active",
|
"is_active",
|
||||||
"addition_add_day"
|
"addition_add_day",
|
||||||
|
"is_multi_event",
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -50,9 +50,9 @@ class PolicesModel extends Model
|
|||||||
{
|
{
|
||||||
// echo '2';
|
// echo '2';
|
||||||
$policyPremium2Model = new PolicyPremium2Model();
|
$policyPremium2Model = new PolicyPremium2Model();
|
||||||
$premium_slab_data = $policyPremium2Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1,'rack_rate_type' => 0])->findAll();
|
$premium_slab_data = $policyPremium2Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll();
|
||||||
|
|
||||||
//check any additional rack rate configured
|
// check any additional rack rate configured
|
||||||
$additional_premium_slab_data = $policyPremium2Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1,'rack_rate_type' => 1])->findAll();
|
$additional_premium_slab_data = $policyPremium2Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1,'rack_rate_type' => 1])->findAll();
|
||||||
|
|
||||||
|
|
||||||
@ -60,9 +60,20 @@ class PolicesModel extends Model
|
|||||||
|
|
||||||
if(isset($premium_slab_data[0]['policy_grid_id']))
|
if(isset($premium_slab_data[0]['policy_grid_id']))
|
||||||
{
|
{
|
||||||
$grid_id = $premium_slab_data[0]['policy_grid_id'];
|
$pre_grid_id = 0;
|
||||||
$policyGridModel = new PolicyGridModel();
|
$grid_type = [];
|
||||||
$grid_type = $policyGridModel->find($grid_id);
|
foreach ($premium_slab_data as $key => $value)
|
||||||
|
{
|
||||||
|
if($value['policy_grid_id'] != $pre_grid_id)
|
||||||
|
{
|
||||||
|
$grid_id = $value['policy_grid_id'];
|
||||||
|
$policyGridModel = new PolicyGridModel();
|
||||||
|
$grid_type = $policyGridModel->find($grid_id);
|
||||||
|
$premium_slab_data[$key]['grid_master'] = $grid_type;
|
||||||
|
}
|
||||||
|
$premium_slab_data[$key]['grid_master'] = $grid_type;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if(isset($additional_premium_slab_data[0]['policy_grid_id']))
|
if(isset($additional_premium_slab_data[0]['policy_grid_id']))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -26,6 +26,9 @@ class PolicyPremium1Model extends Model
|
|||||||
'is_active',
|
'is_active',
|
||||||
'grade',
|
'grade',
|
||||||
'premium_type',
|
'premium_type',
|
||||||
|
'rack_rate_name',
|
||||||
|
'unit',
|
||||||
|
'additional_relationship',
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@ -27,6 +27,8 @@ class PolicyPremium2Model extends Model
|
|||||||
'relationship',
|
'relationship',
|
||||||
'additional_relationship',
|
'additional_relationship',
|
||||||
'rack_rate_type',
|
'rack_rate_type',
|
||||||
|
'rack_rate_name',
|
||||||
|
'unit',
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@ -17,5 +17,6 @@ class PolicyTypeModel extends Model
|
|||||||
"created_by",
|
"created_by",
|
||||||
"updated_by",
|
"updated_by",
|
||||||
"is_active",
|
"is_active",
|
||||||
|
"long_name",
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1 +1,78 @@
|
|||||||
<h4 class="page-title">Welcome !</h4>
|
<style>
|
||||||
|
|
||||||
|
body {
|
||||||
|
.multiselect-native-select {
|
||||||
|
position: relative;
|
||||||
|
/* bottom: 32px; */
|
||||||
|
select {
|
||||||
|
border: 0 !important;
|
||||||
|
clip: rect(0 0 0 0) !important;
|
||||||
|
height: 1px !important;
|
||||||
|
margin: -1px -1px -1px -3px !important;
|
||||||
|
overflow: hidden !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
position: absolute !important;
|
||||||
|
width: 1px !important;
|
||||||
|
left: 50%;
|
||||||
|
top: 30px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.multiselect-container{
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.multiselect-selected-text{
|
||||||
|
float: left !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.navtab-bg .nav-link {
|
||||||
|
margin: 0 5px 10px!important;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row" id="client_add" style="margin-top: -32px;">
|
||||||
|
<div class="col-12">
|
||||||
|
<!-- <div class="card"> -->
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="row" style="padding-bottom: 10px;">
|
||||||
|
<div class="col-6" style="align-self: center;">
|
||||||
|
</div>
|
||||||
|
<div class="col-6" style="text-align: right;">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<ul class="nav nav-pills navtab-bg">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="#pending-actions-dash-tab" data-toggle="tab" aria-expanded="false"
|
||||||
|
class="nav-link px-3 py-2 active" id="pending_actions_tab">
|
||||||
|
<span class="mr-1"><i class="mdi mdi-contacts"></i></span>
|
||||||
|
<span class="d-none d-sm-inline-block">Pending Actions</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="#enrollment-dash-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="enrollemnt_tab">
|
||||||
|
<span class="mr-1"><i class="fa fa-file"></i></span>
|
||||||
|
<span class="d-none d-sm-inline-block">Enrollment</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<div class="tab-content">
|
||||||
|
<?php include('enrollment_dash.php'); ?>
|
||||||
|
<?php include('endorsement_dash.php'); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- </div> -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -58,7 +58,8 @@
|
|||||||
</td>
|
</td>
|
||||||
<td><?php echo $file['client_short_name'] ?></td>
|
<td><?php echo $file['client_short_name'] ?></td>
|
||||||
<td><?php echo $file['branch_name'] ?></td>
|
<td><?php echo $file['branch_name'] ?></td>
|
||||||
<td><?php echo isset($file['policy_name']) ? $file['policy_name'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?> - <?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?></td>
|
<!-- <td><?php echo isset($file['policy_name']) ? $file['policy_name'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?> - <?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?></td> -->
|
||||||
|
<td><?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?></td>
|
||||||
<td><?php echo $file['event_type'] ?></td>
|
<td><?php echo $file['event_type'] ?></td>
|
||||||
<td><?php echo $file['insurer_or_tpa'] ?></td>
|
<td><?php echo $file['insurer_or_tpa'] ?></td>
|
||||||
<td><?php echo $file['actions'] ?></td>
|
<td><?php echo $file['actions'] ?></td>
|
||||||
|
|||||||
@ -57,17 +57,25 @@ table.dataTable thead th {
|
|||||||
<td><?php echo date('d-M-Y h:i A', strtotime($row['created_at'])) ?> by
|
<td><?php echo date('d-M-Y h:i A', strtotime($row['created_at'])) ?> by
|
||||||
<?php echo $row['user_name']; ?></td>
|
<?php echo $row['user_name']; ?></td>
|
||||||
<td>
|
<td>
|
||||||
<div class="btn-group dropdown">
|
<?php if($row['cd_ac_no_count'] > 0 && $row['cd_ac_no_count_cd_tranction'] > 1) {?>
|
||||||
<a href="javascript: void(0);"class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
<div class="btn-group dropdown">
|
||||||
<div class="dropdown-menu dropdown-menu-right">
|
<!-- <a href="javascript: void(0);"class="dropdown-toggle arrow-none btn btn-light btn-sm"aria-expanded="false"></i></a> -->
|
||||||
<?php if($row['cd_ac_no_count_cd_tranction'] <= 1) { ?>
|
|
||||||
<a class="dropdown-item btnEdit" data-id="<?= $row['id'];?>" data-toggle="modal" data-target="#con-close-modal"> <i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
|
||||||
<?php } ?>
|
|
||||||
<?php if($row['cd_ac_no_count'] == 0) { ?>
|
|
||||||
<a class="dropdown-item" data-id="<?= $row['id'];?>" onclick="removeCDMaster(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
|
||||||
<?php } ?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<?php } else { ?>
|
||||||
|
|
||||||
|
<div class="btn-group dropdown">
|
||||||
|
<a href="javascript: void(0);"class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||||
|
<div class="dropdown-menu dropdown-menu-right">
|
||||||
|
<?php if($row['cd_ac_no_count_cd_tranction'] <= 1) { ?>
|
||||||
|
<a class="dropdown-item btnEdit" data-id="<?= $row['id'];?>" data-toggle="modal" data-target="#con-close-modal"> <i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||||
|
<?php } ?>
|
||||||
|
<?php if($row['cd_ac_no_count'] == 0) { ?>
|
||||||
|
<a class="dropdown-item" data-id="<?= $row['id'];?>" onclick="removeCDMaster(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|||||||
@ -1,3 +1,36 @@
|
|||||||
|
<style>
|
||||||
|
/* Hide the dropdown list */
|
||||||
|
/* .select2-container--default .select2-dropdown {
|
||||||
|
display: none;
|
||||||
|
} */
|
||||||
|
|
||||||
|
.select2-hidden-accessible + .select2-container .select2-dropdown {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select2-container .select2-selection--multiple .select2-selection__choice {
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.cards {
|
||||||
|
display: inline-block;
|
||||||
|
margin: 5px;
|
||||||
|
padding: 10px;
|
||||||
|
background-color: #f8f9fa;
|
||||||
|
border: 1px solid #ced4da;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
.cards button {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
color: red;
|
||||||
|
font-size: 16px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
<div class="tab-pane fade" id="branch-tab">
|
<div class="tab-pane fade" id="branch-tab">
|
||||||
<input type="hidden" id="client_id_for_client_branch" value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
|
<input type="hidden" id="client_id_for_client_branch" value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
|
||||||
<div class="row float-right" style="padding-bottom: 10px;position: relative;right: 13px;">
|
<div class="row float-right" style="padding-bottom: 10px;position: relative;right: 13px;">
|
||||||
@ -46,7 +79,7 @@
|
|||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="branch_code">Branch Code<span class="text-danger">*</span></label>
|
<label for="branch_code">Branch Code<span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="branch_code" placeholder="Enter Branch Code"
|
<input type="text" class="form-control" id="branch_code" placeholder="Enter Branch Code"
|
||||||
name="branch_code" required>
|
name="branch_code" onchange="setDefaultUnitValue(this)" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -92,6 +125,11 @@
|
|||||||
<label for="gst">GST<span class="text-danger">*</span></label>
|
<label for="gst">GST<span class="text-danger">*</span></label>
|
||||||
<input type="text" name="gst" class="form-control" id="gst" placeholder="Enter GST Number" data-parsley-error-message="Invalid GST Number. Example: 12ABCDE1234F5Z6" data-parsley-trigger="change" data-parsley-pattern="^\d{2}[A-Z]{5}\d{4}[A-Z]{1}[A-Z\d]{1}[Z]{1}[A-Z\d]{1}$" required>
|
<input type="text" name="gst" class="form-control" id="gst" placeholder="Enter GST Number" data-parsley-error-message="Invalid GST Number. Example: 12ABCDE1234F5Z6" data-parsley-trigger="change" data-parsley-pattern="^\d{2}[A-Z]{5}\d{4}[A-Z]{1}[A-Z\d]{1}[Z]{1}[A-Z\d]{1}$" required>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group col-md-4">
|
||||||
|
<label for="state">Units<span class="text-danger"></span></label>
|
||||||
|
<select id="selected" class="form-control" multiple="multiple" name="units[]" >
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label class="switch" style="position: relative;top: 43px;left: 20px;">
|
<label class="switch" style="position: relative;top: 43px;left: 20px;">
|
||||||
<input id="sez" type="checkbox" name="sez">
|
<input id="sez" type="checkbox" name="sez">
|
||||||
@ -103,8 +141,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
<h6 class="header-title">Contact 1</h6>
|
|
||||||
<br>
|
<div class="form-row">
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label>Contact 1</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
@ -174,6 +216,7 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
var branchTable = '';
|
var branchTable = '';
|
||||||
var data = <?= isset($client_branch) ? json_encode($client_branch) : '[]' ?>;
|
var data = <?= isset($client_branch) ? json_encode($client_branch) : '[]' ?>;
|
||||||
|
console.log('branch data', data)
|
||||||
var role = data.role
|
var role = data.role
|
||||||
delete data.role;
|
delete data.role;
|
||||||
console.log(role)
|
console.log(role)
|
||||||
@ -210,7 +253,6 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$('#btnBranchAdd').click(function() {
|
$('#btnBranchAdd').click(function() {
|
||||||
|
|
||||||
branch_form_action = '<?= base_url("client/branch/create"); ?>';
|
branch_form_action = '<?= base_url("client/branch/create"); ?>';
|
||||||
@ -286,9 +328,11 @@ $('.btnBack').click(function() {
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
$("#branch_form").submit(function(event) {
|
$("#branch_form").submit(function(event) {
|
||||||
|
|
||||||
|
var selectedValues = $("#selected").val();
|
||||||
|
console.log(selectedValues, selectedValues);
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
branch_PrimaryKey = $('#client_id_branch').val();
|
branch_PrimaryKey = $('#client_id_branch').val();
|
||||||
|
|
||||||
@ -311,6 +355,13 @@ $("#branch_form").submit(function(event) {
|
|||||||
|
|
||||||
var formData = new FormData($('#branch_form')[0]);
|
var formData = new FormData($('#branch_form')[0]);
|
||||||
|
|
||||||
|
const jsonString = JSON.stringify(selectedValues);
|
||||||
|
console.log('jsonString', jsonString);
|
||||||
|
|
||||||
|
|
||||||
|
// Append the JSON string to the FormData object
|
||||||
|
formData.append('units', jsonString);
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: formData,
|
data: formData,
|
||||||
url: branch_form_action,
|
url: branch_form_action,
|
||||||
@ -390,7 +441,6 @@ $("#branch_form").submit(function(event) {
|
|||||||
contactCount = 1
|
contactCount = 1
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$('body').on('click', '.btnBranchEdit', function() {
|
$('body').on('click', '.btnBranchEdit', function() {
|
||||||
|
|
||||||
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||||
@ -451,6 +501,8 @@ $('body').on('click', '.btnBranchEdit', function() {
|
|||||||
$('#sez').prop('checked', false);
|
$('#sez').prop('checked', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
appendOption(res.data.units)
|
||||||
|
|
||||||
$('#name').val(res.contact[0].name);
|
$('#name').val(res.contact[0].name);
|
||||||
$('#email').val(res.contact[0].email);
|
$('#email').val(res.contact[0].email);
|
||||||
$('#mobile').val(res.contact[0].mobile);
|
$('#mobile').val(res.contact[0].mobile);
|
||||||
@ -480,7 +532,6 @@ $('body').on('click', '.btnBranchEdit', function() {
|
|||||||
console.log(branch_form_action);
|
console.log(branch_form_action);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$("#remove_btn").click(function() {
|
$("#remove_btn").click(function() {
|
||||||
$("#name").val('');
|
$("#name").val('');
|
||||||
$("#email").val('');
|
$("#email").val('');
|
||||||
@ -500,8 +551,11 @@ function appendContactHtml(contact = false, reset = false) {
|
|||||||
var html = `
|
var html = `
|
||||||
<div id="${uniqueId}">
|
<div id="${uniqueId}">
|
||||||
<hr>
|
<hr>
|
||||||
<h6 class="header-title">Contact ${contactCount}</h6>
|
<div class="form-row">
|
||||||
<br>
|
<div class="form-group col-md-6">
|
||||||
|
<label>Contact ${contactCount}</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="${uniqueId}_first_name">Name<span class="text-danger">*</span></label>
|
<label for="${uniqueId}_first_name">Name<span class="text-danger">*</span></label>
|
||||||
@ -565,7 +619,6 @@ function storeButtonId(id) {
|
|||||||
localStorage.setItem('buttonIds', JSON.stringify(buttonIds));
|
localStorage.setItem('buttonIds', JSON.stringify(buttonIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function hideStoredAddButtons() {
|
function hideStoredAddButtons() {
|
||||||
var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||||
storedIds.forEach(function(id) {
|
storedIds.forEach(function(id) {
|
||||||
@ -666,8 +719,6 @@ function removeClientBranch(element) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function checkMobileNumber(input) {
|
function checkMobileNumber(input) {
|
||||||
|
|
||||||
console.log('function called')
|
console.log('function called')
|
||||||
@ -695,3 +746,153 @@ function checkMobileNumber(input) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
$("#selected").select2({
|
||||||
|
tags: true,
|
||||||
|
tokenSeparators: [], // Disable default token separators
|
||||||
|
createTag: function (params) {
|
||||||
|
var term = $.trim(params.term);
|
||||||
|
if (term === '') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
id: term,
|
||||||
|
text: term,
|
||||||
|
newTag: true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Intercept keydown event
|
||||||
|
$("#selected").on('select2:select', function (e) {
|
||||||
|
var newTag = e.params.data.newTag;
|
||||||
|
|
||||||
|
// Remove the tag if it was not created by pressing Enter
|
||||||
|
if (!newTag) {
|
||||||
|
$(this).find('option[value="' + e.params.data.id + '"]').remove();
|
||||||
|
$(this).trigger('change');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Listen for the Enter key
|
||||||
|
$("#selected").on('keydown', function (e) {
|
||||||
|
if (e.key === 'Enter') {
|
||||||
|
var $input = $(this).data('select2').dropdown.$search || $(this).data('select2').selection.$search;
|
||||||
|
var term = $.trim($input.val());
|
||||||
|
if (term !== '') {
|
||||||
|
var option = new Option(term, term, true, true); // Set selected to true
|
||||||
|
$(this).append(option).trigger('change');
|
||||||
|
$input.val('');
|
||||||
|
}
|
||||||
|
e.preventDefault(); // Prevent the default action of the Enter key
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Get the Select2 container element
|
||||||
|
var select2Container = $('#selected').next('.select2-container');
|
||||||
|
|
||||||
|
// Find the dropdown within the Select2 container
|
||||||
|
var select2Dropdown = select2Container.find('.select2-dropdown');
|
||||||
|
|
||||||
|
// Set the display style to none
|
||||||
|
select2Dropdown.css('display', 'none');
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
// Wait for Select2 to be fully initialized and rendered
|
||||||
|
$('#selected').on('select2:open', function (e) {
|
||||||
|
// Get the Select2 dropdown element
|
||||||
|
var select2Dropdown = $('.select2-container--open').find('.select2-dropdown');
|
||||||
|
// Set the display style to none
|
||||||
|
select2Dropdown.css('display', 'none');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function appendOption(data){
|
||||||
|
|
||||||
|
data = JSON.parse(data);
|
||||||
|
$('#selected').empty();
|
||||||
|
$.each(data, function(index, item) {
|
||||||
|
|
||||||
|
const option = $('<option>', {
|
||||||
|
value: item,
|
||||||
|
text:item,
|
||||||
|
selected: true
|
||||||
|
});
|
||||||
|
$('#selected').append(option);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function setDefaultUnitValue()
|
||||||
|
{
|
||||||
|
|
||||||
|
var client_id = $('#client_id_branch').val();
|
||||||
|
var branch_code = $('#branch_code').val();
|
||||||
|
var units = $('#selected').val();
|
||||||
|
|
||||||
|
console.log('client_id', client_id)
|
||||||
|
console.log('branch_code', branch_code)
|
||||||
|
console.log('units', units)
|
||||||
|
|
||||||
|
var url_for_get_client_details = '<?php echo base_url('util/get_client_details/') ?>' + client_id;
|
||||||
|
|
||||||
|
|
||||||
|
if(units.length == 0 || units.length == 1){
|
||||||
|
|
||||||
|
$.get(url_for_get_client_details, function(response){
|
||||||
|
|
||||||
|
console.log(response)
|
||||||
|
console.log(response.data)
|
||||||
|
|
||||||
|
if (!response || !response.data || !response.data.short_name) {
|
||||||
|
if (!response) {
|
||||||
|
console.log('Response is null');
|
||||||
|
} else if (!response.data) {
|
||||||
|
console.log('Response data is null');
|
||||||
|
} else if (!response.data.short_name) {
|
||||||
|
toastr.warning('The client has no Short name');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$('#selected').empty();
|
||||||
|
var default_unit = response.data.short_name + '-' + branch_code;
|
||||||
|
|
||||||
|
if(units.length == 1){
|
||||||
|
|
||||||
|
if(units[0] != default_unit){
|
||||||
|
|
||||||
|
const option = $('<option>', {
|
||||||
|
value: default_unit,
|
||||||
|
text: default_unit,
|
||||||
|
selected: true
|
||||||
|
});
|
||||||
|
$('#selected').append(option);
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
const option = $('<option>', {
|
||||||
|
value: default_unit,
|
||||||
|
text: default_unit,
|
||||||
|
selected: true
|
||||||
|
});
|
||||||
|
$('#selected').append(option);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}).fail(function(xhr, status, error) {
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
console.error(status, error);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@ -8,7 +8,8 @@
|
|||||||
|
|
||||||
<div class="row" style="padding-top: 20px;margin-bottom: 18px;">
|
<div class="row" style="padding-top: 20px;margin-bottom: 18px;">
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<h4 style="position: relative;left: 18px;top: 2px;">Client Basic Info</h4>
|
<h4 style="position: relative;left: 18px;top: 2px;">Client Basic Info - <strong> <?= $client['client_name'] ?> (
|
||||||
|
<?= $client['short_name'] ?> ) </strong></h4>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
@ -35,16 +36,15 @@
|
|||||||
<div class="card-body" style="position: relative;bottom: 25px;">
|
<div class="card-body" style="position: relative;bottom: 25px;">
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
<!--
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="font-size: 18px;"> <strong> <?= $client['client_name'] ?> (
|
<td style="font-size: 18px;"></td>
|
||||||
<?= $client['short_name'] ?> ) </strong></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div> -->
|
||||||
|
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
|
|
||||||
@ -62,18 +62,16 @@
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
<div class="col-6">
|
<!-- <div class="col-6">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="padding: 3px;"><label>Address :</label>
|
<td style="padding: 3px;"></td>
|
||||||
<?= $client['address1'] ?> <br> <?= $client['address2'] ?></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="padding: 3px;"><?= $client['city'] ?>, <?= $client['state'] ?> -
|
<td style="padding: 3px;"></td>
|
||||||
<?= $client['pincode'] ?></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div> -->
|
||||||
|
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<table>
|
<table>
|
||||||
@ -142,7 +140,7 @@
|
|||||||
data-id="<?= htmlspecialchars($value['policy_terms']) ?>"
|
data-id="<?= htmlspecialchars($value['policy_terms']) ?>"
|
||||||
data-toggle="modal" data-target="#bs-example-modal-lg">
|
data-toggle="modal" data-target="#bs-example-modal-lg">
|
||||||
<td><?= $value['branch_name'] ?></td>
|
<td><?= $value['branch_name'] ?></td>
|
||||||
<td><?= $value['policy_name'] ?> ( <?= $value['policy_type'] ?> )</td>
|
<td><?= $value['policy_type'] ?></td>
|
||||||
<td><?= $value['insurer_short_name'] ?></td>
|
<td><?= $value['insurer_short_name'] ?></td>
|
||||||
<td><?= $value['tpa_short_name'] ?></td>
|
<td><?= $value['tpa_short_name'] ?></td>
|
||||||
<td><?= $value['policy_start_date'] ?> / <?= $value['policy_end_date'] ?>
|
<td><?= $value['policy_start_date'] ?> / <?= $value['policy_end_date'] ?>
|
||||||
|
|||||||
@ -81,83 +81,91 @@ table.dataTable thead th {
|
|||||||
<div id="append_client_info"></div>
|
<div id="append_client_info"></div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function()
|
||||||
|
{
|
||||||
|
|
||||||
$('#tickets-table').DataTable({
|
$('#tickets-table').DataTable({
|
||||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
|
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
|
||||||
"<'row'<'col-sm-12'tr>>" +
|
"<'row'<'col-sm-12'tr>>" +
|
||||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
||||||
buttons: [{
|
buttons: [{
|
||||||
extend: 'csv',
|
extend: 'csv',
|
||||||
text: 'CSV',
|
text: 'CSV',
|
||||||
title: 'ClientList',
|
title: 'ClientList',
|
||||||
className: 'my_class',
|
className: 'my_class',
|
||||||
exportOptions: {
|
exportOptions: {
|
||||||
columns: ':not(:last-child)'
|
columns: ':not(:last-child)'
|
||||||
|
},
|
||||||
|
}],
|
||||||
|
language: {
|
||||||
|
search: "_INPUT_",
|
||||||
|
searchPlaceholder: "Search..."
|
||||||
},
|
},
|
||||||
}],
|
paging: true ,
|
||||||
language: {
|
// pagingType: 'full_numbers'
|
||||||
search: "_INPUT_",
|
});
|
||||||
searchPlaceholder: "Search..."
|
|
||||||
},
|
|
||||||
paging: true ,
|
|
||||||
// pagingType: 'full_numbers'
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function removeClient(element)
|
||||||
|
{
|
||||||
function removeClient(element) {
|
|
||||||
|
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: "Are you sure?",
|
title: "Are you sure?",
|
||||||
text: "You need to remove this client.",
|
text: "You need to remove this client.",
|
||||||
icon: "info",
|
icon: "info",
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonColor: "#3085d6",
|
confirmButtonColor: "#3085d6",
|
||||||
confirmButtonText: "Yes",
|
confirmButtonText: "Yes",
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
|
|
||||||
if (result.isConfirmed) {
|
if (result.isConfirmed) {
|
||||||
var id = element.getAttribute('data-id');
|
|
||||||
var form_action = '<?= base_url("client/remove/") ?>' + id;
|
$('.loader').fadeIn();
|
||||||
$.ajax({
|
$('.loader-mask').fadeIn();
|
||||||
url: form_action,
|
|
||||||
type: "GET",
|
var id = element.getAttribute('data-id');
|
||||||
dataType: 'json',
|
var form_action = '<?= base_url("client/remove/") ?>' + id;
|
||||||
processData: false,
|
$.ajax({
|
||||||
contentType: false,
|
url: form_action,
|
||||||
success: function(res) {
|
type: "GET",
|
||||||
// console.log(res.status == true);
|
dataType: 'json',
|
||||||
if(res){
|
processData: false,
|
||||||
if (res.status == true) {
|
contentType: false,
|
||||||
toastr.success('Client removed successfully.', 'success');
|
success: function(res) {
|
||||||
location.reload();
|
|
||||||
} else {
|
$('.loader').fadeOut();
|
||||||
toastr.warning('Failed to remove client.', 'warning');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
}
|
|
||||||
}
|
if(res){
|
||||||
},
|
if (res.status == true) {
|
||||||
error: function (xhr, status, error) {
|
toastr.success('Client removed successfully.', 'success');
|
||||||
console.error(xhr.responseText);
|
location.reload();
|
||||||
console.error(status, error);
|
} else {
|
||||||
$('.loader').fadeOut();
|
Swal.fire({
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
title: "warning!",
|
||||||
console.log('Something Wrong!', 'warning');
|
text: res.message,
|
||||||
|
icon: "warning"
|
||||||
|
});
|
||||||
|
// toastr.warning(res.message, 'warning');
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
console.error(status, error);
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
console.log('Something Wrong!', 'warning');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$(document).on('click', '.client_info', function() {
|
$(document).on('click', '.client_info', function() {
|
||||||
|
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
|
|||||||
@ -56,10 +56,10 @@
|
|||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="email"> Policy Type<span class="text-danger">*</span></label>
|
<label for="email"> Policy Type<span class="text-danger">*</span></label>
|
||||||
<select class="form-control" id="policy_type" name="is_addon" required>
|
<select class="form-control" id="policy_type" name="policy_type_id" required>
|
||||||
<option value="0">Select Policy Type</option>
|
<option value="0">Select Policy Type</option>
|
||||||
<?php foreach ($policy_type as $key => $value) { ?>
|
<?php foreach ($policy_types as $value) { ?>
|
||||||
<option value="<?= $key ?>"><?= $value ?></option>
|
<option value="<?= $value['id']?>"><?= $value['policy_type'] ?></option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -74,6 +74,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-row" id="first" style="display: none;">
|
<div class="form-row" id="first" style="display: none;">
|
||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="email">Insurer<span class="text-danger">*</span></label>
|
<label for="email">Insurer<span class="text-danger">*</span></label>
|
||||||
<select class="form-control" id="insurer" name="insurer" required>
|
<select class="form-control" id="insurer" name="insurer" required>
|
||||||
@ -84,12 +85,7 @@
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-4">
|
|
||||||
<label for="policy">Policies<span class="text-danger">*</span></label>
|
|
||||||
<select class="form-control" id="policy" name="policy_id" required>
|
|
||||||
<option value="" selected>Select Policy</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="mobile">TPA<span id="tpa_danger" 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>
|
<select class="form-control" id="tpa" name="tpa" required>
|
||||||
@ -100,22 +96,27 @@
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-row" id="second" style="display: none;">
|
<div class="form-group col-md-4">
|
||||||
<div class="form-group col-md-3">
|
|
||||||
<label for="policy_no">Policy No<span class="text-danger">*</span></label>
|
<label for="policy_no">Policy No<span class="text-danger">*</span></label>
|
||||||
<input value="" type="text" class="form-control" placeholder="Enter Policy Number " name="policy_no" id="policy_no" required>
|
<input value="" type="text" class="form-control" placeholder="Enter Policy Number " name="policy_no" id="policy_no" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-3">
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row" id="second" style="display: none;">
|
||||||
|
<div class="form-group col-md-4">
|
||||||
<label for="policy_start_date">Policy Start Date<span class="text-danger">*</span></label>
|
<label for="policy_start_date">Policy Start Date<span class="text-danger">*</span></label>
|
||||||
<input value="" type="text" class="form-control" placeholder="Enter Start Date " name="policy_start_date" id="start_date" required>
|
<input value="" type="text" class="form-control" placeholder="Enter Start Date " name="policy_start_date" id="start_date" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-4">
|
||||||
<label for="policy_end_date">Policy End Date<span class="text-danger">*</span></label>
|
<label for="policy_end_date">Policy End Date<span class="text-danger">*</span></label>
|
||||||
<input value="" type="text" class="form-control" placeholder="Enter End Date " name="policy_end_date" id="end_date" required>
|
<input value="" type="text" class="form-control" placeholder="Enter End Date " name="policy_end_date" id="end_date" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-3" id="policy_status_field">
|
<div class="form-group col-md-4">
|
||||||
|
<label for="reminder_date">Reminder Date<span class="text-danger">*</span></label>
|
||||||
|
<input value="" type="text" class="form-control" placeholder="Enter Reminder Date " name="reminder_date" id="reminder_date" required>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-4" id="policy_status_field">
|
||||||
<label for="policy_status">Policy Status</label>
|
<label for="policy_status">Policy Status</label>
|
||||||
<input value="" type="text" class="form-control" placeholder="Policy Status" id="policy_status" readonly>
|
<input value="" type="text" class="form-control" placeholder="Policy Status" id="policy_status" readonly>
|
||||||
</div>
|
</div>
|
||||||
@ -145,6 +146,15 @@
|
|||||||
<label for="inception_type" style="position: relative;bottom: 5px;left: 85px;">Enable
|
<label for="inception_type" style="position: relative;bottom: 5px;left: 85px;">Enable
|
||||||
Employee Enrolment Process</label>
|
Employee Enrolment Process</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-4">
|
||||||
|
<label class="switch" style="position: relative;top: 43px;left: 20px;">
|
||||||
|
<input id="policy_visibility" type="checkbox" name="enrolment_visibility" checked>
|
||||||
|
<span class="slider round" style="height: 27px;"></span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label for="inception_type" style="position: relative;bottom: 5px;left: 85px;">Policy Visibilty</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="policy_fields"></div>
|
<div id="policy_fields"></div>
|
||||||
@ -168,6 +178,23 @@
|
|||||||
<?php include('other_policy_terms.php'); ?>
|
<?php include('other_policy_terms.php'); ?>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
$('#inception_type').change(function () {
|
||||||
|
var start_data = $('#start_date').parent();
|
||||||
|
var end_data = $('#end_date').parent();
|
||||||
|
var reminder_data = $('#reminder_date').parent();
|
||||||
|
if($(this).prop('checked')){
|
||||||
|
$(start_data).show();
|
||||||
|
$(end_data).show();
|
||||||
|
$(reminder_data).show();
|
||||||
|
}else{
|
||||||
|
$(start_data).hide();
|
||||||
|
$(end_data).hide();
|
||||||
|
$(reminder_data).hide();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
var policy_PrimaryKey = $('#client_id_policy').val();
|
var policy_PrimaryKey = $('#client_id_policy').val();
|
||||||
var policy_client = $('#policy_PrimaryKey').val();
|
var policy_client = $('#policy_PrimaryKey').val();
|
||||||
|
|
||||||
@ -212,6 +239,13 @@
|
|||||||
allowInput: false
|
allowInput: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var reminderDatePicker = flatpickr("#reminder_date", {
|
||||||
|
dateFormat: "d-m-Y",
|
||||||
|
defaultDate: endDate,
|
||||||
|
allowInput: false
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
$('#add_form').hide();
|
$('#add_form').hide();
|
||||||
$('.btnBack').hide();
|
$('.btnBack').hide();
|
||||||
|
|
||||||
@ -219,8 +253,10 @@
|
|||||||
if (policy_PrimaryKey !== '') {
|
if (policy_PrimaryKey !== '') {
|
||||||
var policyTable = '';
|
var policyTable = '';
|
||||||
var data = <?= isset($client_policy) ? json_encode($client_policy) : '[]' ?>;
|
var data = <?= isset($client_policy) ? json_encode($client_policy) : '[]' ?>;
|
||||||
// //console.log('client_policy_data',data)
|
console.log('client_policy_data',data)
|
||||||
data.forEach(function(item) {
|
var role = data.role
|
||||||
|
delete data.role;
|
||||||
|
$.each(data, function(index, item) {
|
||||||
// //console.log(item.open_for_enrollment);
|
// //console.log(item.open_for_enrollment);
|
||||||
var patternGMC = /gmc/i; // Case insensitive pattern for 'gmc'
|
var patternGMC = /gmc/i; // Case insensitive pattern for 'gmc'
|
||||||
var patternGPA = /gpa/i; // Case insensitive pattern for 'gpa'
|
var patternGPA = /gpa/i; // Case insensitive pattern for 'gpa'
|
||||||
@ -266,29 +302,42 @@
|
|||||||
tpaValue = item.tpa_short + '-' + item.tpa_branch_code;
|
tpaValue = item.tpa_short + '-' + item.tpa_branch_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
var policy_name_data = `${item.policy_name ?? ''}` + ' - ' + `${item.policy_no ?? ''}` + ' - ' + `${item.policy_type_name ?? ''}`;
|
var policy_name_data = `${item.policy_type_name ?? ''}` + ' - ' + `${item.policy_no ?? ''}`;
|
||||||
|
|
||||||
policyTable += `
|
var role = data.role;
|
||||||
<tr>
|
|
||||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
$.each(data, function(index, item) {
|
||||||
<td>${policy_name_data}</td>
|
policyTable += `
|
||||||
<td>${item.branch_name ? item.branch_name : ' - '}</td>
|
<tr>
|
||||||
<td>${tpaValue}</td>
|
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||||
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
|
<td>${policy_name_data}</td>
|
||||||
<td style="text-align: center;">${(enrollmentStatus)}</td>
|
<td>${item.branch_name ? item.branch_name : ' - '}</td>
|
||||||
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
<td>${tpaValue}</td>
|
||||||
<td>
|
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
|
||||||
<div class="btn-group dropdown">
|
<td style="text-align: center;">${(enrollmentStatus)}</td>
|
||||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
||||||
<div class="dropdown-menu dropdown-menu-right">
|
<td>
|
||||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
<div class="btn-group dropdown">
|
||||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" data-toggle="modal"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rack Rate</a>
|
<div class="dropdown-menu dropdown-menu-right">
|
||||||
|
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||||
|
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" data-toggle="modal"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||||
|
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rack Rate</a>`;
|
||||||
|
|
||||||
|
// Conditionally render the delete option based on the role
|
||||||
|
if (role !== 3 && role !== 4) {
|
||||||
|
policyTable += `
|
||||||
|
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item" onclick="removepolicy(this)"><i class="fa fa-trash mr-2 text-muted font-18 vertical-middle"></i>Delete</a>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
policyTable += `
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</td>
|
||||||
</td>
|
</tr>
|
||||||
</tr>
|
`;
|
||||||
`;
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#policy_table').append(policyTable);
|
$('#policy_table').append(policyTable);
|
||||||
@ -302,9 +351,10 @@
|
|||||||
// ordering: false
|
// ordering: false
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
$('.btnAdd').click(function() {
|
$('.btnAdd').click(function() {
|
||||||
|
|
||||||
fetchClientBranch()
|
fetchClientBranch()
|
||||||
@ -319,7 +369,7 @@
|
|||||||
$('#policy_no').val('').change();
|
$('#policy_no').val('').change();
|
||||||
$('#start_date').val('').change();
|
$('#start_date').val('').change();
|
||||||
$('#end_date').val('').change();
|
$('#end_date').val('').change();
|
||||||
$('#policy').html('<option value="" selected>Select Policy</option>').change();
|
// $('#policy').html('<option value="" selected>Select Policy</option>').change();
|
||||||
$('#policy_form_action').val('<?= base_url("client/policy/create"); ?>');
|
$('#policy_form_action').val('<?= base_url("client/policy/create"); ?>');
|
||||||
$('#policy_status_field').hide()
|
$('#policy_status_field').hide()
|
||||||
$('#base_policy_id').hide();
|
$('#base_policy_id').hide();
|
||||||
@ -337,7 +387,6 @@
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
$('.btnBack').click(function() {
|
$('.btnBack').click(function() {
|
||||||
|
|
||||||
$('#policy_form')[0].reset();
|
$('#policy_form')[0].reset();
|
||||||
@ -378,11 +427,11 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (basePolicyDataId == policyDataId) {
|
// if (basePolicyDataId == policyDataId) {
|
||||||
|
|
||||||
toastr.warning('The policy cannot be the same as the base policy.', 'Warning');
|
// toastr.warning('The policy cannot be the same as the base policy.', 'Warning');
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (basePolicyDataId == 3 || basePolicyDataId == 2) {
|
if (basePolicyDataId == 3 || basePolicyDataId == 2) {
|
||||||
|
|
||||||
@ -415,7 +464,8 @@
|
|||||||
contentType: false,
|
contentType: false,
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
|
|
||||||
//console.log(res);
|
console.log('client policy response', res);
|
||||||
|
|
||||||
$('#policy_form')[0].reset();
|
$('#policy_form')[0].reset();
|
||||||
if (res.status === false) {
|
if (res.status === false) {
|
||||||
toastr.error('Policy Dose Not Create', 'Error');
|
toastr.error('Policy Dose Not Create', 'Error');
|
||||||
@ -489,10 +539,12 @@
|
|||||||
tpaValue = item.tpa_short + '-' + item.tpa_branch_code;
|
tpaValue = item.tpa_short + '-' + item.tpa_branch_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var policy_name_data = `${item.policy_type_name ?? ''}` + ' - ' + `${item.policy_no ?? ''}`;
|
||||||
|
|
||||||
policyTable += `
|
policyTable += `
|
||||||
<tr>
|
<tr>
|
||||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||||
<td>${item.policy_name} (${item.policy_type_name})</td>
|
<td>${policy_name_data}</td>
|
||||||
<td>${item.branch_name}</td>
|
<td>${item.branch_name}</td>
|
||||||
<td>${tpaValue}</td>
|
<td>${tpaValue}</td>
|
||||||
<td>${rearrangeDateFormat(item.policy_start_date)} / ${rearrangeDateFormat(item.policy_end_date)}</td>
|
<td>${rearrangeDateFormat(item.policy_start_date)} / ${rearrangeDateFormat(item.policy_end_date)}</td>
|
||||||
@ -505,6 +557,7 @@
|
|||||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" data-toggle="modal"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" data-toggle="modal"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}"class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rack Rate</a>
|
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}"class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rack Rate</a>
|
||||||
|
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item" onclick = "removepolicy(this)"><i class="fa fa-trash mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@ -512,7 +565,7 @@
|
|||||||
`;
|
`;
|
||||||
});
|
});
|
||||||
$('#policy_table').append(policyTable);
|
$('#policy_table').append(policyTable);
|
||||||
console.log(policyTable);
|
// console.log(policyTable);
|
||||||
|
|
||||||
|
|
||||||
$('#insurer').val('');
|
$('#insurer').val('');
|
||||||
@ -554,78 +607,6 @@
|
|||||||
|
|
||||||
var selectedOption = $('#base_policy').find(':selected');
|
var selectedOption = $('#base_policy').find(':selected');
|
||||||
var base_policy_data_id = selectedOption.data('id');
|
var base_policy_data_id = selectedOption.data('id');
|
||||||
// //console.log('base_policy_data_id', base_policy_data_id);
|
|
||||||
|
|
||||||
|
|
||||||
$.get(url, function(res) {
|
|
||||||
// res = JSON.parse(res)//
|
|
||||||
//console.log('polices', res)
|
|
||||||
var OptionsHTML = '';
|
|
||||||
OptionsHTML += '<option value="" selected>Select Policy</option>';
|
|
||||||
$policy_type_value = $('#policy_type').val();
|
|
||||||
|
|
||||||
$.each(res.data, function(index, item) {
|
|
||||||
|
|
||||||
if ($policy_type_value == 3) {
|
|
||||||
|
|
||||||
if (base_policy_data_id == 3) {
|
|
||||||
|
|
||||||
if (item.policy_type_id == 5) {
|
|
||||||
|
|
||||||
OptionsHTML += '<option data-id="' + item.policy_type_id +
|
|
||||||
'" value="' +
|
|
||||||
item.id +
|
|
||||||
'">' + item.name + '( ' + item.policy_type +
|
|
||||||
' )</option>';
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (item.policy_type_id == 5 || item.policy_type_id == 3) {
|
|
||||||
|
|
||||||
OptionsHTML += '<option data-id="' + item.policy_type_id +
|
|
||||||
'" value="' +
|
|
||||||
item.id +
|
|
||||||
'">' + item.name + '( ' + item.policy_type +
|
|
||||||
' )</option>';
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} else if ($policy_type_value == 2) {
|
|
||||||
if (item.policy_type_id == 4 || item.policy_type_id == 5) {
|
|
||||||
OptionsHTML += '<option data-id="' + item.policy_type_id +
|
|
||||||
'" value="' +
|
|
||||||
item.id +
|
|
||||||
'">' + item.name + '( ' + item.policy_type + ' )</option>';
|
|
||||||
}
|
|
||||||
} else if ($policy_type_value == 1) {
|
|
||||||
|
|
||||||
// const policyTypeId = Number(item.policy_type_id);
|
|
||||||
|
|
||||||
// if ([1, 2, 3, 6, 7,].includes(policyTypeId))
|
|
||||||
if (item.policy_type_id == 1 || item.policy_type_id == 2 || item
|
|
||||||
.policy_type_id == 3 || item.policy_type_id == 7 || item.policy_type_id == 6){
|
|
||||||
|
|
||||||
//console.log(item.policy_type_id)
|
|
||||||
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' + item.id + '">' + item.name + '( ' + item.policy_type + ' )</option>';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
|
|
||||||
OptionsHTML += '<option data-id="' + item.policy_type_id +
|
|
||||||
'" value="' +
|
|
||||||
item.id +
|
|
||||||
'">' + item.name + '( ' + item.policy_type + ' )</option>';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#policy').html(OptionsHTML);
|
|
||||||
|
|
||||||
}).fail(function(xhr, status, error) {
|
|
||||||
console.error(xhr.responseText);
|
|
||||||
console.error(status, error);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$.get(url_for_cd, function(response){
|
$.get(url_for_cd, function(response){
|
||||||
@ -670,29 +651,6 @@
|
|||||||
|
|
||||||
var url = '<?php echo base_url('util/check_policy_type/') ?>' + dataId + '/' + branch_id + '/' + client_id;
|
var url = '<?php echo base_url('util/check_policy_type/') ?>' + dataId + '/' + branch_id + '/' + client_id;
|
||||||
|
|
||||||
// if (dataId && branch_id && client_id) {
|
|
||||||
// // Check if all parameters exist
|
|
||||||
// if ($('#policy_PrimaryKey').val() == "" || id != $('#insurer_policy_id').val()) {
|
|
||||||
// $.get(url, function(response) {
|
|
||||||
// console.log(response);
|
|
||||||
// console.log(response.count);
|
|
||||||
|
|
||||||
// if (response.count > 0) {
|
|
||||||
// console.log('Policy already exist in the branch');
|
|
||||||
// toastr.error('Policy already exist in the branch', 'Error');
|
|
||||||
// $('#policy').val('').change();
|
|
||||||
// }
|
|
||||||
// console.log('outer');
|
|
||||||
|
|
||||||
// }).fail(function(xhr, status, error) {
|
|
||||||
// console.error(xhr.responseText);
|
|
||||||
// console.error(status, error);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// console.log('Missing parameter(s): dataId, branch_id, or client_id');
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
if (dataId == 1) {
|
if (dataId == 1) {
|
||||||
$('#tpa').prop('required', false);
|
$('#tpa').prop('required', false);
|
||||||
@ -704,42 +662,41 @@
|
|||||||
|
|
||||||
var base_policy_dataId = $('#base_policy').children('option:selected').attr('data-id');
|
var base_policy_dataId = $('#base_policy').children('option:selected').attr('data-id');
|
||||||
|
|
||||||
if ($('#policy_type').val() == 1) {
|
if ($('#policy_type').val() == 1) {
|
||||||
|
|
||||||
// //console.log('step 1')
|
// //console.log('step 1')
|
||||||
|
|
||||||
if (dataId == 3) {
|
if (dataId == 3) {
|
||||||
|
|
||||||
// //console.log('step 2')
|
// //console.log('step 2')
|
||||||
|
|
||||||
var displayStatus = $('#base_policy_id').css('display');
|
var displayStatus = $('#base_policy_id').css('display');
|
||||||
$('#base_policy_id').show();
|
$('#base_policy_id').show();
|
||||||
$('#base_danger').hide();
|
$('#base_danger').hide();
|
||||||
// $('#base_policy').prop('required', true);
|
// $('#base_policy').prop('required', true);
|
||||||
|
|
||||||
if (displayStatus === 'none') {
|
if (displayStatus === 'none') {
|
||||||
// //console.log('step 2.1')
|
// //console.log('step 2.1')
|
||||||
|
|
||||||
$('#base_policy').val('').change();
|
$('#base_policy').val('').change();
|
||||||
}
|
|
||||||
|
|
||||||
// $('#base_policy').find('option[data-id="3"]').hide();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
// //console.log('step 3')
|
|
||||||
|
|
||||||
var displayStatus = $('#base_policy_id').css('display');
|
|
||||||
$('#base_policy_id').hide();
|
|
||||||
$('#base_danger').show();
|
|
||||||
// $('#base_policy').prop('required', false);
|
|
||||||
|
|
||||||
if (displayStatus === 'none') {
|
|
||||||
// //console.log('step 3.1')
|
|
||||||
|
|
||||||
$('#base_policy').val('').change();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// $('#base_policy').find('option[data-id="3"]').hide();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// //console.log('step 3')
|
||||||
|
|
||||||
|
var displayStatus = $('#base_policy_id').css('display');
|
||||||
|
$('#base_policy_id').hide();
|
||||||
|
$('#base_danger').show();
|
||||||
|
// $('#base_policy').prop('required', false);
|
||||||
|
|
||||||
|
if (displayStatus === 'none') {
|
||||||
|
// //console.log('step 3.1')
|
||||||
|
$('#base_policy').val('').change();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -762,7 +719,7 @@
|
|||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
|
|
||||||
console.log('client_policy_res', res)
|
console.log('client_policy_res', res);
|
||||||
|
|
||||||
var gst = (res.data.gst == 0.00) ? 18 : res.data.gst;
|
var gst = (res.data.gst == 0.00) ? 18 : res.data.gst;
|
||||||
|
|
||||||
@ -791,7 +748,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$('#tpa').val(tpaValue).change();
|
$('#tpa').val(tpaValue).change();
|
||||||
$('#policy_type').val(res.data.is_addon).change();
|
$('#policy_type').val(res.data.policy_type_id).change();
|
||||||
$('#base_policy').val(res.data.base_policy);
|
$('#base_policy').val(res.data.base_policy);
|
||||||
|
|
||||||
$('#policy_type_id').val(res.data.policy_type_id);
|
$('#policy_type_id').val(res.data.policy_type_id);
|
||||||
@ -800,6 +757,7 @@
|
|||||||
$('#policy_no').val(res.data.policy_no);
|
$('#policy_no').val(res.data.policy_no);
|
||||||
$('#start_date').val(rearrangeDateFormat(res.data.policy_start_date));
|
$('#start_date').val(rearrangeDateFormat(res.data.policy_start_date));
|
||||||
$('#end_date').val(rearrangeDateFormat(res.data.policy_end_date));
|
$('#end_date').val(rearrangeDateFormat(res.data.policy_end_date));
|
||||||
|
$('#reminder_date').val(rearrangeDateFormat(res.data.reminder_date));
|
||||||
$('#policy_status').val(checkDateStatus(res.data.policy_end_date));
|
$('#policy_status').val(checkDateStatus(res.data.policy_end_date));
|
||||||
$('#gst_no').val(gst);
|
$('#gst_no').val(gst);
|
||||||
$('#policy_status_field').show();
|
$('#policy_status_field').show();
|
||||||
@ -812,24 +770,68 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (res.data.is_addon != '1' && res.data.is_addon != '0') {
|
if (res.data.enrolment_visibility == 1) {
|
||||||
|
$('#policy_visibility').prop('checked', true);
|
||||||
|
} else {
|
||||||
|
$('#policy_visibility').prop('checked', false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// if (res.data.is_addon != '1' && res.data.is_addon != '0') {
|
||||||
|
// $('#base_policy_id').show();
|
||||||
|
// $('#base_policy').prop('required', true);
|
||||||
|
// $('#first').show();
|
||||||
|
// $('#second').show();
|
||||||
|
// $('#third').show();
|
||||||
|
// } else if (res.data.is_addon == '0') {
|
||||||
|
// $('#first').hide();
|
||||||
|
// $('#second').hide();
|
||||||
|
// $('#third').hide();
|
||||||
|
// $('#base_policy_id').hide();
|
||||||
|
// $('#base_policy').prop('required', false);
|
||||||
|
// } else if (res.data.is_addon == '1') {
|
||||||
|
// $('#first').show();
|
||||||
|
// $('#second').show();
|
||||||
|
// $('#third').show();
|
||||||
|
// $('#base_policy_id').hide();
|
||||||
|
// $('#base_policy').prop('required', false);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
if (res.data.policy_type_id == '4' || res.data.policy_type_id == '5') {
|
||||||
|
|
||||||
$('#base_policy_id').show();
|
$('#base_policy_id').show();
|
||||||
$('#base_policy').prop('required', true);
|
$('#base_policy').prop('required', true);
|
||||||
$('#first').show();
|
$('#first').show();
|
||||||
$('#second').show();
|
$('#second').show();
|
||||||
$('#third').show();
|
$('#third').show();
|
||||||
} else if (res.data.is_addon == '0') {
|
|
||||||
|
} else if (res.data.policy_type_id == '0') {
|
||||||
|
|
||||||
$('#first').hide();
|
$('#first').hide();
|
||||||
$('#second').hide();
|
$('#second').hide();
|
||||||
$('#third').hide();
|
$('#third').hide();
|
||||||
$('#base_policy_id').hide();
|
$('#base_policy_id').hide();
|
||||||
$('#base_policy').prop('required', false);
|
$('#base_policy').prop('required', false);
|
||||||
} else if (res.data.is_addon == '1') {
|
|
||||||
|
|
||||||
|
} else if (res.data.policy_type_id == '1' || res.data.policy_type_id == '2' || res.data.policy_type_id == '6' || res.data.policy_type_id == '7') {
|
||||||
|
|
||||||
$('#first').show();
|
$('#first').show();
|
||||||
$('#second').show();
|
$('#second').show();
|
||||||
$('#third').show();
|
$('#third').show();
|
||||||
$('#base_policy_id').hide();
|
$('#base_policy_id').hide();
|
||||||
$('#base_policy').prop('required', false);
|
$('#base_policy').prop('required', false);
|
||||||
|
|
||||||
|
}else if(res.data.policy_type_id == '3'){
|
||||||
|
|
||||||
|
$('#first').show();
|
||||||
|
$('#second').show();
|
||||||
|
$('#third').show();
|
||||||
|
$('#base_policy_id').show();
|
||||||
|
$('#base_policy').prop('required', false);
|
||||||
|
$('#base_danger').hide();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -870,7 +872,6 @@
|
|||||||
|
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
appendCDACNO(res.cd_data, res.data.cd_ac_no) // append and select the current CD Account Number
|
appendCDACNO(res.cd_data, res.data.cd_ac_no) // append and select the current CD Account Number
|
||||||
appendPolicyList(res.policy, res.data.policy_id, ); // append and select the current policy
|
|
||||||
appendBasePolicyList(res.client_policy_list, res.data.base_policy, res.data.client_branch_id); // append and select the Base palicy
|
appendBasePolicyList(res.client_policy_list, res.data.base_policy, res.data.client_branch_id); // append and select the Base palicy
|
||||||
}, 2000)
|
}, 2000)
|
||||||
|
|
||||||
@ -889,7 +890,6 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$('body').on('click', '.btnOpenEnroll', function() {
|
$('body').on('click', '.btnOpenEnroll', function() {
|
||||||
|
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
@ -990,7 +990,6 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//for date convert to indian formate like this 'yyyy-mm-dd' to this 'dd-mm-yyyy'
|
//for date convert to indian formate like this 'yyyy-mm-dd' to this 'dd-mm-yyyy'
|
||||||
function rearrangeDateFormat(inputDate) {
|
function rearrangeDateFormat(inputDate) {
|
||||||
|
|
||||||
@ -1230,11 +1229,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function removeClientPolicy(element) {
|
|
||||||
// //console.log(element);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$('#policy_type').change(function() {
|
$('#policy_type').change(function() {
|
||||||
|
|
||||||
$('#insurer').val('').change();
|
$('#insurer').val('').change();
|
||||||
@ -1242,14 +1236,33 @@
|
|||||||
$('#policy_no').val('');
|
$('#policy_no').val('');
|
||||||
$('#start_date').val('');
|
$('#start_date').val('');
|
||||||
$('#end_date').val('');
|
$('#end_date').val('');
|
||||||
|
$('#reminder_date').val('');
|
||||||
$('#base_policy').val('').change();
|
$('#base_policy').val('').change();
|
||||||
|
|
||||||
|
var client_id = $('#client_id_policy').val();
|
||||||
|
var client_branch_id = $('#client_branch').val();
|
||||||
|
|
||||||
if ($(this).val() == 2 || $(this).val() == 3) {
|
var url_for_get_policy_type_list = '<?php echo base_url('util/get_policy_type_for_base_policy/') ?>' + client_id + '/' + client_branch_id;
|
||||||
|
|
||||||
|
$.get(url_for_get_policy_type_list, function(response){
|
||||||
|
|
||||||
|
console.log(response)
|
||||||
|
console.log(response.data)
|
||||||
|
|
||||||
|
appendBasePolicyList(response.data);
|
||||||
|
|
||||||
|
}).fail(function(xhr, status, error) {
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
console.error(status, error);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
if ($(this).val() == 4 || $(this).val() == 5) {
|
||||||
|
|
||||||
$("#insurer").next(".select2-container").css({
|
$("#insurer").next(".select2-container").css({
|
||||||
'pointer-events': 'none',
|
'pointer-events': 'none',
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#select2-insurer-container').css({
|
$('#select2-insurer-container').css({
|
||||||
'background-color': '#ebebe0',
|
'background-color': '#ebebe0',
|
||||||
});
|
});
|
||||||
@ -1257,6 +1270,7 @@
|
|||||||
$("#tpa").next(".select2-container").css({
|
$("#tpa").next(".select2-container").css({
|
||||||
'pointer-events': 'none',
|
'pointer-events': 'none',
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#select2-tpa-container').css({
|
$('#select2-tpa-container').css({
|
||||||
'background-color': '#ebebe0',
|
'background-color': '#ebebe0',
|
||||||
});
|
});
|
||||||
@ -1283,17 +1297,18 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($(this).val() == 3) {
|
if ($(this).val() == 5) {
|
||||||
toastr.warning('Please Change the Policy Terms after Submit the Policy!', 'INFO');
|
toastr.warning('Please Change the Policy Terms after Submit the Policy!', 'INFO');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($(this).val() != '1' && $(this).val() != '0') {
|
if ($(this).val() == '4' || $(this).val() == '5') {
|
||||||
|
|
||||||
$('#base_policy_id').show();
|
$('#base_policy_id').show();
|
||||||
$('#base_policy').prop('required', true);
|
$('#base_policy').prop('required', true);
|
||||||
$('#first').show();
|
$('#first').show();
|
||||||
$('#second').show();
|
$('#second').show();
|
||||||
$('#third').show();
|
$('#third').show();
|
||||||
|
$('#base_danger').show();
|
||||||
|
|
||||||
} else if ($(this).val() == '0') {
|
} else if ($(this).val() == '0') {
|
||||||
|
|
||||||
@ -1302,15 +1317,33 @@
|
|||||||
$('#third').hide();
|
$('#third').hide();
|
||||||
$('#base_policy_id').hide();
|
$('#base_policy_id').hide();
|
||||||
$('#base_policy').prop('required', false);
|
$('#base_policy').prop('required', false);
|
||||||
|
$('#base_danger').show();
|
||||||
|
|
||||||
|
} else if ($(this).val() == '1' || $(this).val() == '2' || $(this).val() == '6' || $(this).val() == '7') {
|
||||||
} else if ($(this).val() == '1') {
|
|
||||||
|
|
||||||
$('#first').show();
|
$('#first').show();
|
||||||
$('#second').show();
|
$('#second').show();
|
||||||
$('#third').show();
|
$('#third').show();
|
||||||
$('#base_policy_id').hide();
|
$('#base_policy_id').hide();
|
||||||
$('#base_policy').prop('required', false);
|
$('#base_policy').prop('required', false);
|
||||||
|
$('#base_danger').show();
|
||||||
|
|
||||||
|
}else if($(this).val() == '3'){
|
||||||
|
|
||||||
|
$('#first').show();
|
||||||
|
$('#second').show();
|
||||||
|
$('#third').show();
|
||||||
|
$('#base_policy_id').show();
|
||||||
|
$('#base_policy').prop('required', false);
|
||||||
|
$('#base_danger').hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if($('#inception_type').prop('checked')){
|
||||||
|
|
||||||
|
}else{
|
||||||
|
$('#start_date').parent().hide();
|
||||||
|
$('#end_date').parent().hide();
|
||||||
|
$('#reminder_date').parent().hide();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1382,28 +1415,20 @@
|
|||||||
|
|
||||||
var dataId = 0;
|
var dataId = 0;
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
$('#base_policy').change(function() {
|
$('#base_policy').change(function() {
|
||||||
|
|
||||||
var client_policy_id = $(this).val() ? $(this).val() : 0;
|
var client_policy_id = $(this).val() ? $(this).val() : 0;
|
||||||
var policy_type = $('#policy_type').val()
|
var policy_type = $('#policy_type').val()
|
||||||
// //console.log(client_policy_id);
|
console.log('client_policy_id', client_policy_id);
|
||||||
|
|
||||||
dataId = $('#policy').children('option:selected').attr('data-id');
|
|
||||||
// //console.log('dataId', dataId)
|
|
||||||
|
|
||||||
base_policy_data_id = $(this).children('option:selected').attr('data-id');
|
base_policy_data_id = $(this).children('option:selected').attr('data-id');
|
||||||
// //console.log('base_policy_data_id', base_policy_data_id);
|
console.log('base_policy_data_id', base_policy_data_id);
|
||||||
|
|
||||||
var queryParams = {
|
|
||||||
client_policy_id: client_policy_id,
|
|
||||||
policy_type: policy_type,
|
|
||||||
};
|
|
||||||
|
|
||||||
const queryString = objectToQueryString(queryParams);
|
|
||||||
// var uri = '<?= base_url('util/fetch-policy-for-policy-type') ?>?' + queryString
|
|
||||||
var uri = '<?= base_url('client/policy/list/') ?>' + client_policy_id
|
var uri = '<?= base_url('client/policy/list/') ?>' + client_policy_id
|
||||||
// //console.log('uri', uri)
|
console.log('uri', uri)
|
||||||
// //console.log('queryString', queryString)
|
|
||||||
|
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
$('.loader-mask').fadeIn();
|
$('.loader-mask').fadeIn();
|
||||||
@ -1430,35 +1455,6 @@
|
|||||||
$('#policy_no').val(res.data.policy_no).change();
|
$('#policy_no').val(res.data.policy_no).change();
|
||||||
$('#start_date').val(rearrangeDateFormat(res.data.policy_start_date)).change();
|
$('#start_date').val(rearrangeDateFormat(res.data.policy_start_date)).change();
|
||||||
$('#end_date').val(rearrangeDateFormat(res.data.policy_end_date)).change();
|
$('#end_date').val(rearrangeDateFormat(res.data.policy_end_date)).change();
|
||||||
|
|
||||||
var policeOptionHTML = '';
|
|
||||||
$policy_type_value = $('#policy_type').val();
|
|
||||||
$.each(res.policy, function(index, item) {
|
|
||||||
|
|
||||||
policeOptionHTML += '<option data-id="' + item.policy_type_id +
|
|
||||||
'" value="' + item.id + '" ' + (res.data.policy_id === item
|
|
||||||
.id ?
|
|
||||||
'selected="selected"' : '') + '>' + item.name +
|
|
||||||
'</option>';
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log('policeOptionHTML', policeOptionHTML)
|
|
||||||
|
|
||||||
$('#policy').html(policeOptionHTML);
|
|
||||||
|
|
||||||
if (dataId == 3 || policy_type == 1) {
|
|
||||||
|
|
||||||
setTimeout(function() {
|
|
||||||
var $option = $('#policy').find('option[data-id="3"]');
|
|
||||||
if ($option.length > 0) {
|
|
||||||
$option.prop('selected', true).change();
|
|
||||||
} else {
|
|
||||||
toastr.warning('The insurer does not have a GMC-Parents policy.', 'Warning');
|
|
||||||
}
|
|
||||||
}, 1500);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -1468,7 +1464,6 @@
|
|||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
//console.log('Something Wrong!', 'warning');
|
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1476,10 +1471,6 @@
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
function objectToQueryString(obj) {
|
|
||||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
|
||||||
}
|
|
||||||
|
|
||||||
// fetch the client branch list for the dropdown
|
// fetch the client branch list for the dropdown
|
||||||
function fetchClientBranch() {
|
function fetchClientBranch() {
|
||||||
|
|
||||||
@ -1548,15 +1539,6 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
|
||||||
|
|
||||||
$("#client_branch").on('change', function() {
|
|
||||||
fetchClientPolicyList();
|
|
||||||
});
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
//append the CD Account number for the dropdown
|
//append the CD Account number for the dropdown
|
||||||
function appendCDACNO(data, select = null) {
|
function appendCDACNO(data, select = null) {
|
||||||
|
|
||||||
@ -1584,36 +1566,9 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// append Policies list to the dropdown for edit only
|
|
||||||
function appendPolicyList(data, select = null, ) {
|
|
||||||
|
|
||||||
console.log('appendPolicyList', 'function called');
|
|
||||||
console.log('appendPolicyList data', data);
|
|
||||||
console.log('appendPolicyList selected value', select);
|
|
||||||
|
|
||||||
$('#policy').empty();
|
|
||||||
$('#policy').append($('<option>', {
|
|
||||||
value: '',
|
|
||||||
text: 'Select Policy'
|
|
||||||
}));
|
|
||||||
|
|
||||||
$.each(data, function(index, item) {
|
|
||||||
const option = $('<option>', {
|
|
||||||
value: item.id, //policy id primary key
|
|
||||||
text: item.name + ' - ' + item.policy_type, // policy name
|
|
||||||
'data-id': item.policy_type_id //policy type id like gpa and gmc
|
|
||||||
});
|
|
||||||
|
|
||||||
if (select === item.id) {
|
|
||||||
option.attr('selected', true);
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#policy').append(option);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// append Base Policy to the dropdown for edit only
|
// append Base Policy to the dropdown for edit only
|
||||||
function appendBasePolicyList(data, select = null, client_branch_id = null) {
|
function appendBasePolicyList(data, select = null)
|
||||||
|
{
|
||||||
|
|
||||||
console.log('appendBasePolicyList', 'function called');
|
console.log('appendBasePolicyList', 'function called');
|
||||||
console.log('appendBasePolicyList data', data);
|
console.log('appendBasePolicyList data', data);
|
||||||
@ -1627,21 +1582,78 @@
|
|||||||
|
|
||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
|
|
||||||
if (item.client_branch_id == client_branch_id) {
|
const option = $('<option>', {
|
||||||
|
value: item.client_policy_id,
|
||||||
|
text:`${item.policy_type ?? ''} - ${item.policy_no ?? ''}`,
|
||||||
|
'data-id': item.id
|
||||||
|
});
|
||||||
|
|
||||||
const option = $('<option>', {
|
if (select === item.client_policy_id) {
|
||||||
value: item.id,
|
option.attr('selected', true);
|
||||||
text: item.name + ' - ' + item.policy_type,
|
|
||||||
'data-id': item.policy_type_id
|
|
||||||
});
|
|
||||||
|
|
||||||
if (select === item.id) {
|
|
||||||
//console.log('selected');
|
|
||||||
option.attr('selected', true);
|
|
||||||
}
|
|
||||||
$('#base_policy').append(option);
|
|
||||||
}
|
}
|
||||||
|
$('#base_policy').append(option);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function removepolicy(element)
|
||||||
|
{
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: "Are you sure?",
|
||||||
|
text: "You need to remove this Policy.",
|
||||||
|
icon: "info",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#3085d6",
|
||||||
|
confirmButtonText: "Yes",
|
||||||
|
}).then((result) => {
|
||||||
|
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
|
var id = element.getAttribute('data-id');
|
||||||
|
console.log(id)
|
||||||
|
var form_action = '<?= base_url("client/policy/remove/") ?>' + id;
|
||||||
|
console.log(form_action)
|
||||||
|
$.ajax({
|
||||||
|
url: form_action,
|
||||||
|
type: "GET",
|
||||||
|
dataType: 'json',
|
||||||
|
processData: false,
|
||||||
|
contentType: false,
|
||||||
|
success: function(res) {
|
||||||
|
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
console.log(res)
|
||||||
|
|
||||||
|
if(res){
|
||||||
|
if (res.status == true) {
|
||||||
|
toastr.success('Policy removed successfully.', 'success');
|
||||||
|
location.reload();
|
||||||
|
} else {
|
||||||
|
Swal.fire({
|
||||||
|
title: "warning!",
|
||||||
|
text: res.message,
|
||||||
|
icon: "warning"
|
||||||
|
});
|
||||||
|
// toastr.warning('Failed to remove policy', 'warning');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
console.error(status, error);
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
console.log('Something Wrong!', 'warning');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -76,7 +76,8 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><b><?php echo ($key + 1)?></b></td>
|
<td><b><?php echo ($key + 1)?></b></td>
|
||||||
<td><?php echo $employee['name']?>( <?php echo $employee['emp_code']?> - <?php echo $employee['relationship']?> )</td>
|
<td><?php echo $employee['name']?>( <?php echo $employee['emp_code']?> - <?php echo $employee['relationship']?> )</td>
|
||||||
<td><?php echo isset($employee['policy_name']) ? $employee['policy_name'] : '' ?> - <?php echo isset($employee['policy_no']) ? $employee['policy_no'] : '' ?> - <?php echo isset($employee['policy_type']) ? $employee['policy_type'] : '' ?></td>
|
<!-- <td><?php echo isset($employee['policy_name']) ? $employee['policy_name'] : '' ?> - <?php echo isset($employee['policy_no']) ? $employee['policy_no'] : '' ?> - <?php echo isset($employee['policy_type']) ? $employee['policy_type'] : '' ?></td> -->
|
||||||
|
<td><?php echo isset($employee['policy_type']) ? $employee['policy_type'] : '' ?> - <?php echo isset($employee['policy_no']) ? $employee['policy_no'] : '' ?></td>
|
||||||
<td><?php echo $employee['insurer_short_name']?></td>
|
<td><?php echo $employee['insurer_short_name']?></td>
|
||||||
<td><?php echo $employee['tpa_id']?></td>
|
<td><?php echo $employee['tpa_id']?></td>
|
||||||
<td><?php echo $employee['uhid']?></td>
|
<td><?php echo $employee['uhid']?></td>
|
||||||
|
|||||||
@ -253,7 +253,8 @@ function appendPolicies(data) {
|
|||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
var option = $('<option>', {
|
var option = $('<option>', {
|
||||||
value: item.client_policy_id,
|
value: item.client_policy_id,
|
||||||
text: `${item.name ?? ''} - ${item.policy_no ?? ''} - ${item.policy_type ?? ''}`
|
// text: `${item.name ?? ''} - ${item.policy_no ?? ''} - ${item.policy_type ?? ''}`
|
||||||
|
text:`${item.policy_type ?? ''} - ${item.policy_no ?? ''}`
|
||||||
});
|
});
|
||||||
if (PolicyID == item.client_policy_id) {
|
if (PolicyID == item.client_policy_id) {
|
||||||
option.attr('selected', true);
|
option.attr('selected', true);
|
||||||
|
|||||||
@ -645,7 +645,8 @@ function appendPolicies(data) {
|
|||||||
|
|
||||||
var option = $('<option>', {
|
var option = $('<option>', {
|
||||||
value: item.client_policy_id,
|
value: item.client_policy_id,
|
||||||
text:`${item.name ?? ''} - ${item.policy_no ?? ''} - ${item.policy_type ?? ''}`
|
// text:`${item.name ?? ''} - ${item.policy_no ?? ''} - ${item.policy_type ?? ''}`
|
||||||
|
text:`${item.policy_type ?? ''} - ${item.policy_no ?? ''}`
|
||||||
});
|
});
|
||||||
if (client_policy_param == item.client_policy_id) {
|
if (client_policy_param == item.client_policy_id) {
|
||||||
option.attr('selected', true);
|
option.attr('selected', true);
|
||||||
@ -989,6 +990,19 @@ function checkPolicyTermsAndRackRatesHasDefiend(event)
|
|||||||
$('.si-enhancement-option').show();
|
$('.si-enhancement-option').show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var event = response.insurer_multi_event ;
|
||||||
|
$('#event_type_data').val(response.insurer_multi_event);
|
||||||
|
|
||||||
|
if(event == 1){
|
||||||
|
$("#event_type").attr("multiple", "multiple");
|
||||||
|
$("#event_type").attr("name", "event_type[]");
|
||||||
|
$("#event_type").select2();
|
||||||
|
}else{
|
||||||
|
$("#event_type").removeAttr("multiple");
|
||||||
|
$("#event_type").attr("name", "event_type");
|
||||||
|
$("#event_type").select2('destroy');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (response.code === 200 && response.dataStatus === true && response.message !== null) {
|
if (response.code === 200 && response.dataStatus === true && response.message !== null) {
|
||||||
toastr.error(response.message, 'Error');
|
toastr.error(response.message, 'Error');
|
||||||
|
|||||||
390
app/Views/endorsement_dash.php
Normal file
390
app/Views/endorsement_dash.php
Normal file
@ -0,0 +1,390 @@
|
|||||||
|
<style>
|
||||||
|
|
||||||
|
body{
|
||||||
|
margin-top:20px;
|
||||||
|
background:#FAFAFA;
|
||||||
|
}
|
||||||
|
.order-card {
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-blue {
|
||||||
|
background: linear-gradient(45deg,#4099ff,#73b4ff);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-green {
|
||||||
|
background: linear-gradient(45deg,#2ed8b6,#59e0c5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-yellow {
|
||||||
|
background: linear-gradient(45deg,#FFB64D,#ffcb80);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-pink {
|
||||||
|
background: linear-gradient(45deg,#FF5370,#ff869a);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-red {
|
||||||
|
background: linear-gradient(45deg,#FF4E50,#F9D423);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-purple {
|
||||||
|
background: linear-gradient(45deg,#9D50BB,#6E48AA);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-orange {
|
||||||
|
background: linear-gradient(45deg,#F2994A,#F2C94C);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-teal {
|
||||||
|
background: linear-gradient(45deg,#1ABC9C,#16A085);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-cyan {
|
||||||
|
background: linear-gradient(45deg,#00C9FF,#92FE9D);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-lime {
|
||||||
|
background: linear-gradient(45deg,#A8E063,#56AB2F);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-indigo {
|
||||||
|
background: linear-gradient(45deg,#3F51B5,#5A55AE);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-Pelorous {
|
||||||
|
background: linear-gradient(45deg, #00d6db, #00a8b5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-Pelorous2 {
|
||||||
|
background: linear-gradient(45deg, #02a8b5, #017f8b);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-Pelorous3 {
|
||||||
|
background: linear-gradient(45deg, #098895, #046063);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-Grenadier {
|
||||||
|
background: linear-gradient(45deg, #ff9d37, #ff7a10);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-Grenadier2 {
|
||||||
|
background: linear-gradient(45deg, #ff8010, #ff4c00);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-Grenadier3 {
|
||||||
|
background: linear-gradient(45deg, #f06306, #cc4b05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-SilverChalice {
|
||||||
|
background: linear-gradient(45deg, #a3a8a8, #8f9494);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-SilverChalice2 {
|
||||||
|
background: linear-gradient(45deg, #7e8484, #686e6e);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-c-SilverChalice3 {
|
||||||
|
background: linear-gradient(45deg, #5c6363, #434949);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.card {
|
||||||
|
border-radius: 5px;
|
||||||
|
-webkit-box-shadow: 0 1px 2.94px 0.06px rgba(4,26,55,0.16);
|
||||||
|
box-shadow: 0 1px 2.94px 0.06px rgba(4,26,55,0.16);
|
||||||
|
border: none;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
-webkit-transition: all 0.3s ease-in-out;
|
||||||
|
transition: all 0.3s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card .card-block {
|
||||||
|
padding-top: 10px;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
padding-left: 25px;
|
||||||
|
padding-right: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-card i {
|
||||||
|
font-size: 26px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.f-left {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.f-right {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.m-b-1{
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-right{
|
||||||
|
width: 100% !important;
|
||||||
|
justify-content: normal !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-body {
|
||||||
|
max-height: 100vh;
|
||||||
|
overflow-y: auto;
|
||||||
|
padding-left: 25px !important;
|
||||||
|
padding-right: 25px !important;
|
||||||
|
padding-top: 10px !important;
|
||||||
|
padding-bottom: 35% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="tab-pane active show" id="pending-actions-dash-tab" style="/*padding-left: 35px;*/padding-right: 35px;">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4 col-xl-3">
|
||||||
|
<div data-toggle="modal" data-target="#right-modal" class="card bg-c-Pelorous order-card" onclick="getPendingActionClientDataForDashboard(this, 'Inception Pending', 'I')">
|
||||||
|
<div class="card-block">
|
||||||
|
<h6 class="m-b-20 font-15">Inception Pending</h6>
|
||||||
|
<h2 class="text-right"><i class="mdi mdi-account-multiple-plus f-left"></i><span><?= $pendingActionsData['inception'] ?></span></h2>
|
||||||
|
<p class="m-b-1"> <span class="f-right"></span></p>
|
||||||
|
<p class="m-b-1"> <span class="f-right"></span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-4 col-xl-3">
|
||||||
|
<div data-toggle="modal" data-target="#right-modal" class="card bg-c-Pelorous2 order-card" onclick="getPendingActionClientDataForDashboard(this, 'Pending Insurer', 'insurer')">
|
||||||
|
<div class="card-block">
|
||||||
|
<h6 class="m-b-20 font-15">Pending Insurer</h6>
|
||||||
|
<h2 class="text-right"><i class="mdi mdi-account-box f-left"></i><span><?= $pendingActionsData['uhid'] ?></span></h2>
|
||||||
|
<p class="m-b-1">Exported <span class="f-right"><?= $pendingActionsData['uhid_export_count'] ?></span></p>
|
||||||
|
<p class="m-b-1">Not Exported <span class="f-right"><?= $pendingActionsData['uhid_not_export_count'] ?></span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-4 col-xl-3">
|
||||||
|
<div data-toggle="modal" data-target="#right-modal" class="card bg-c-Pelorous3 order-card" onclick="getPendingActionClientDataForDashboard(this, 'Pending TPA', 'TPA')">
|
||||||
|
<div class="card-block">
|
||||||
|
<h6 class="m-b-20 font-15">Pending TPA</h6>
|
||||||
|
<h2 class="text-right"><i class="mdi mdi-signal-variant f-left"></i><span><?= $pendingActionsData['tpa'] ?></span></h2>
|
||||||
|
<p class="m-b-1">Exported <span class="f-right"><?= $pendingActionsData['tpa_export_count'] ?></span></p>
|
||||||
|
<p class="m-b-1">Not Exported <span class="f-right"><?= $pendingActionsData['tpa_not_export_count'] ?></span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-4 col-xl-3">
|
||||||
|
<div data-toggle="modal" data-target="#right-modal" class="card bg-c-Grenadier order-card" onclick="getPendingActionClientDataForDashboard(this, 'Correction Pending', 'C')">
|
||||||
|
<div class="card-block">
|
||||||
|
<h6 class="m-b-20 font-15">Correction Pending</h6>
|
||||||
|
<h2 class="text-right"><i class="mdi mdi-account-edit f-left"></i><span><?= $pendingActionsData['correction'] ?></span></h2>
|
||||||
|
<p class="m-b-1">Exported <span class="f-right"><?= $pendingActionsData['correction_export_count'] ?></span></p>
|
||||||
|
<p class="m-b-1">Not Exported <span class="f-right"><?= $pendingActionsData['correction_not_export_count'] ?></span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-4 col-xl-3">
|
||||||
|
<div data-toggle="modal" data-target="#right-modal" class="card bg-c-Grenadier2 order-card" onclick="getPendingActionClientDataForDashboard(this, 'Deletion Pending', 'D')">
|
||||||
|
<div class="card-block">
|
||||||
|
<h6 class="m-b-20 font-15">Deletion Pending</h6>
|
||||||
|
<h2 class="text-right"><i class="mdi mdi-account-multiple-minus f-left"></i><span><?= $pendingActionsData['deletion'] ?></span></h2>
|
||||||
|
<p class="m-b-1">Exported <span class="f-right"><?= $pendingActionsData['deletion_export_count'] ?></span></p>
|
||||||
|
<p class="m-b-1">Not Exported <span class="f-right"><?= $pendingActionsData['deletion_not_export_count'] ?></span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-4 col-xl-3">
|
||||||
|
<div data-toggle="modal" data-target="#right-modal" class="card bg-c-Grenadier3 order-card" onclick="getPendingActionClientDataForDashboard(this, 'SI Enhancement Pending', 'SI')">
|
||||||
|
<div class="card-block">
|
||||||
|
<h6 class="m-b-20 font-15">SI Enhancment Pending</h6>
|
||||||
|
<h2 class="text-right"><i class="mdi mdi-account-convert f-left"></i><span><?= $pendingActionsData['si_enhancement'] ?></span></h2>
|
||||||
|
<p class="m-b-1">Exported <span class="f-right"><?= $pendingActionsData['si_export_count'] ?></span></p>
|
||||||
|
<p class="m-b-1">Not Exported <span class="f-right"><?= $pendingActionsData['si_not_export_count'] ?></span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-4 col-xl-3">
|
||||||
|
<div data-toggle="modal" data-target="#right-modal" class="card bg-c-SilverChalice order-card" onclick="getPendingActionClientDataForDashboard(this, 'Policy Renewal', 'policy')">
|
||||||
|
<div class="card-block">
|
||||||
|
<h6 class="m-b-20 font-15">Policy</h6>
|
||||||
|
<h2 class="text-right"><i class="mdi mdi-autorenew f-left"></i><span><?= $pendingActionsData['PolicyRenewalData'] ?></span></h2>
|
||||||
|
<p class="m-b-1"> <span class="f-right"></span></p>
|
||||||
|
<p class="m-b-1"> <span class="f-right"></span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-4 col-xl-3">
|
||||||
|
<div class="card bg-c-SilverChalice2 order-card">
|
||||||
|
<div class="card-block">
|
||||||
|
<h6 class="m-b-20 font-15">Ticket</h6>
|
||||||
|
<h2 class="text-right"><i class="mdi mdi-tag f-left"></i><span><?= $pendingActionsData['ticketData'] ?></span></h2>
|
||||||
|
<p class="m-b-1"> <span class="f-right"></span></p>
|
||||||
|
<p class="m-b-1"> <span class="f-right"></span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Right modal content -->
|
||||||
|
<div id="right-modal" class="modal fade" role="dialog" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg modal-right">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header border-0">
|
||||||
|
<h4 class="modal-title" id="right-modalLabel">Modal Heading</h4>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
</div>
|
||||||
|
</div><!-- /.modal-content -->
|
||||||
|
</div><!-- /.modal-dialog -->
|
||||||
|
</div><!-- /.modal -->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function getPendingActionClientDataForDashboard(input, headerName, type)
|
||||||
|
{
|
||||||
|
console.log('hi')
|
||||||
|
$(".modal-body").empty();
|
||||||
|
var nodata = '<center>No data available</center>';
|
||||||
|
$(".modal-body").html(nodata);
|
||||||
|
|
||||||
|
$("#right-modalLabel").html(headerName);
|
||||||
|
$.ajax({
|
||||||
|
url: '<?= base_url("util/featch_dashboard_data/") ?>' + type,
|
||||||
|
type: "GET",
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(res) {
|
||||||
|
|
||||||
|
console.log('responce', res)
|
||||||
|
console.log('responce', res.data)
|
||||||
|
var table;
|
||||||
|
|
||||||
|
var actions = 'inception';
|
||||||
|
|
||||||
|
|
||||||
|
var link = '<?=base_url()?>';
|
||||||
|
|
||||||
|
if (res.data.length !== 0) {
|
||||||
|
table = `<table class="table table-striped table-sm table-centered mb-0"><tbody>`;
|
||||||
|
$.each(res.data, function(index, item) {
|
||||||
|
|
||||||
|
var Params = null;
|
||||||
|
|
||||||
|
if(type == 'insurer'){
|
||||||
|
|
||||||
|
Params = {
|
||||||
|
client_id: item.client_id,
|
||||||
|
client_policy_id: item.client_policy_id,
|
||||||
|
client_branch_id: item.branch_id,
|
||||||
|
event: 'inception',
|
||||||
|
insurer_or_tpa: 'insurer',
|
||||||
|
actions: 'export',
|
||||||
|
};
|
||||||
|
|
||||||
|
}else if(type == 'TPA'){
|
||||||
|
Params = {
|
||||||
|
client_id: item.client_id,
|
||||||
|
client_policy_id: item.client_policy_id,
|
||||||
|
client_branch_id: item.branch_id,
|
||||||
|
event: 'inception',
|
||||||
|
insurer_or_tpa: 'insurer',
|
||||||
|
actions: 'export',
|
||||||
|
};
|
||||||
|
}else if(type == 'I'){
|
||||||
|
Params = {
|
||||||
|
client_id: item.client_id,
|
||||||
|
client_policy_id: item.client_policy_id,
|
||||||
|
client_branch_id: item.branch_id,
|
||||||
|
actions: 'inception'
|
||||||
|
};
|
||||||
|
}else if(type == 'D'){
|
||||||
|
Params = {
|
||||||
|
client_id: item.client_id,
|
||||||
|
client_policy_id: item.client_policy_id,
|
||||||
|
client_branch_id: item.branch_id,
|
||||||
|
event: 'deletion',
|
||||||
|
actions: 'export',
|
||||||
|
insurer_or_tpa: 'tpa',
|
||||||
|
};
|
||||||
|
}else if(type == 'C'){
|
||||||
|
Params = {
|
||||||
|
client_id: item.client_id,
|
||||||
|
client_policy_id: item.client_policy_id,
|
||||||
|
client_branch_id: item.branch_id,
|
||||||
|
event: 'correction',
|
||||||
|
insurer_or_tpa: 'insurer',
|
||||||
|
actions: 'export',
|
||||||
|
};
|
||||||
|
}else if(type == 'SI'){
|
||||||
|
Params = {
|
||||||
|
client_id: item.client_id,
|
||||||
|
client_policy_id: item.client_policy_id,
|
||||||
|
client_branch_id: item.branch_id,
|
||||||
|
event: 'si_enhancement',
|
||||||
|
actions: 'export',
|
||||||
|
insurer_or_tpa: 'tpa',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(Params);
|
||||||
|
console.log(Params);
|
||||||
|
|
||||||
|
if(Params){
|
||||||
|
var queryString = generateQueryString(Params);
|
||||||
|
console.log(queryString)
|
||||||
|
var tabId = type !== 'I' ? '#KYC-DOC-tab' : '';
|
||||||
|
link += 'employee/upload?' + queryString + tabId;
|
||||||
|
}else{
|
||||||
|
link = '';
|
||||||
|
}
|
||||||
|
console.log(link)
|
||||||
|
|
||||||
|
table += `<tr><td onclick="linkRedirect('${link}')">${item.client_name} - ${item.branch_name} - ${item.policy_name}</td></tr>`;
|
||||||
|
|
||||||
|
});
|
||||||
|
table += "</tbody></table>";
|
||||||
|
} else {
|
||||||
|
table = '<center>No data available</center>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$(".modal-body").html(table);
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
console.error(status, error);
|
||||||
|
$(".modal-body").html(nodata);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function generateQueryString(queryParams)
|
||||||
|
{
|
||||||
|
return Object.keys(queryParams)
|
||||||
|
.map(key => encodeURIComponent(key) + '=' + encodeURIComponent(queryParams[key]))
|
||||||
|
.join('&');
|
||||||
|
}
|
||||||
|
|
||||||
|
function linkRedirect(link)
|
||||||
|
{
|
||||||
|
console.log(link);
|
||||||
|
console.log(typeof link);
|
||||||
|
|
||||||
|
if(link){
|
||||||
|
window.location.href = link;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
@ -110,7 +110,8 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><b><?php echo ($key + 1) ?></b></td>
|
<td><b><?php echo ($key + 1) ?></b></td>
|
||||||
<td><?php echo $employee['name'] ?>( <?php echo $employee['emp_code'] ?> )</td>
|
<td><?php echo $employee['name'] ?>( <?php echo $employee['emp_code'] ?> )</td>
|
||||||
<td><?php echo isset($employee['policy_name']) ? $employee['policy_name'] : '' ?> - <?php echo isset($employee['policy_no']) ? $employee['policy_no'] : '' ?> - <?php echo isset($employee['policy_type']) ? $employee['policy_type'] : '' ?></td>
|
<!-- <td><?php echo isset($employee['policy_name']) ? $employee['policy_name'] : '' ?> - <?php echo isset($employee['policy_no']) ? $employee['policy_no'] : '' ?> - <?php echo isset($employee['policy_type']) ? $employee['policy_type'] : '' ?></td> -->
|
||||||
|
<td><?php echo isset($employee['policy_type']) ? $employee['policy_type'] : '' ?> - <?php echo isset($employee['policy_no']) ? $employee['policy_no'] : '' ?></td>
|
||||||
<td><?php echo $employee['endorsement_id'] ?></td>
|
<td><?php echo $employee['endorsement_id'] ?></td>
|
||||||
<td><?php echo isset($employee['insurer_short_name']) ? $employee['insurer_short_name'] : '' ?>
|
<td><?php echo isset($employee['insurer_short_name']) ? $employee['insurer_short_name'] : '' ?>
|
||||||
</td>
|
</td>
|
||||||
@ -326,7 +327,8 @@
|
|||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
var option = $('<option>', {
|
var option = $('<option>', {
|
||||||
value: item.client_policy_id,
|
value: item.client_policy_id,
|
||||||
text: `${item.name ?? ''} - ${item.policy_no ?? ''} - ${item.policy_type ?? ''}`
|
// text: `${item.name ?? ''} - ${item.policy_no ?? ''} - ${item.policy_type ?? ''}`
|
||||||
|
text:`${item.policy_type ?? ''} - ${item.policy_no ?? ''}`
|
||||||
});
|
});
|
||||||
if (PolicyID == item.client_policy_id) {
|
if (PolicyID == item.client_policy_id) {
|
||||||
option.attr('selected', true);
|
option.attr('selected', true);
|
||||||
|
|||||||
336
app/Views/enrollment_dash.php
Normal file
336
app/Views/enrollment_dash.php
Normal file
@ -0,0 +1,336 @@
|
|||||||
|
<!-- Bootstrap CSS -->
|
||||||
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
|
||||||
|
<!-- jQuery -->
|
||||||
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||||
|
|
||||||
|
<!-- Bootstrap JS -->
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/js/bootstrap.bundle.min.js"></script>
|
||||||
|
|
||||||
|
<!-- Bootstrap JS (ensure this is included) -->
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/js/bootstrap.min.js"></script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/* Existing CSS ... */
|
||||||
|
|
||||||
|
.carousel-control-prev {
|
||||||
|
left: -38px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-option {
|
||||||
|
padding: 0.5rem !important;
|
||||||
|
background-color: darkgrey;
|
||||||
|
}
|
||||||
|
|
||||||
|
.emp-count-view-click {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.emp-status .col-6 {
|
||||||
|
padding-bottom: 0.3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.emp-status label {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.client-branch-label {
|
||||||
|
padding: 0.2rem;
|
||||||
|
border-radius: 0.2rem;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scroll-container {
|
||||||
|
display: flex;
|
||||||
|
overflow-x: auto;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scroll-item {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
width: 33%; /* Adjust based on the number of items you want to show */
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 1200px) {
|
||||||
|
.col-xl-3 {
|
||||||
|
max-width: 32% !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.center_text {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-body {
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.number_css {
|
||||||
|
font-family: Roboto, sans-serif;
|
||||||
|
color: #343a40;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label_bottom_reduce {
|
||||||
|
margin-bottom: .0rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-input {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
padding: 0.5rem;
|
||||||
|
border-radius: 0.25rem;
|
||||||
|
border: 1px solid #ced4da;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.carousel-inner {
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.carousel-item {
|
||||||
|
height: auto; /* Adjust if needed */
|
||||||
|
/* margin-left: 80px; */
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
margin: 0 auto; /* Center card in carousel item */
|
||||||
|
}
|
||||||
|
|
||||||
|
.carousel-control-prev, .carousel-control-next {
|
||||||
|
width: 5%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.carousel-control-prev-icon, .carousel-control-next-icon {
|
||||||
|
background-color: rgba(0,0,0,0.5); /* Change color as needed */
|
||||||
|
}
|
||||||
|
|
||||||
|
.carousel-control-prev-icon {
|
||||||
|
background-image: url('data:image/svg+xml;charset=utf8,%3Csvg xmlns%3D"http://www.w3.org/2000/svg" fill%3D"%23000000" viewBox%3D"0 0 8 8"%3E%3Cpath d%3D"M2.5 0L4 1.5 1.5 4 4 6.5 2.5 8 0 4 2.5 0z"/%3E%3C/svg%3E');
|
||||||
|
}
|
||||||
|
|
||||||
|
.carousel-control-next-icon {
|
||||||
|
background-image: url('data:image/svg+xml;charset=utf8,%3Csvg xmlns%3D"http://www.w3.org/2000/svg" fill%3D"%23000000" viewBox%3D"0 0 8 8"%3E%3Cpath d%3D"M5.5 8L4 6.5 6.5 4 4 1.5 5.5 0l4 4-4 4z"/%3E%3C/svg%3E');
|
||||||
|
}
|
||||||
|
|
||||||
|
.show-item {
|
||||||
|
display: inline-block !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hide-item {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-page {
|
||||||
|
background-color: #e8eff5;
|
||||||
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
background-color: #e8eff5;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="enrollment-dash-tab">
|
||||||
|
<div class="row visa_status_count_view">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card" style="border: 0px;">
|
||||||
|
<div class="card-body status-option" id="statusContent" style="padding: 0.5rem !important;background-color: white;">
|
||||||
|
<!-- Search Input Field -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-3">
|
||||||
|
<select class="form-control" name="" id="">
|
||||||
|
<option value="">Open Enrollment</option>
|
||||||
|
<option value="">Close Enrollment</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-5"></div>
|
||||||
|
<div class="col-4">
|
||||||
|
<input type="text" id="searchInput" class="search-input" placeholder="Search by client or branch">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Carousel Structure -->
|
||||||
|
<div id="carouselExampleControls" class="carousel slide" data-ride="carousel" data-interval="false">
|
||||||
|
<div class="carousel-inner">
|
||||||
|
<?php
|
||||||
|
$itemsPerSlide = 3; // Number of items per slide
|
||||||
|
$currentItem = 0; // Counter for items
|
||||||
|
$isActive = true; // Variable to set the first item as active
|
||||||
|
foreach ($client_branch_emp_list as $clients) {
|
||||||
|
foreach ($clients['branches'] as $branches) {
|
||||||
|
// Start a new carousel item if needed
|
||||||
|
if ($currentItem % $itemsPerSlide == 0) {
|
||||||
|
if (!$isActive) echo '</div>'; // Close previous carousel item
|
||||||
|
echo '<div class="carousel-item' . ($isActive ? ' active' : '') . '">';
|
||||||
|
$isActive = false;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<!-- New Card Layout for each item -->
|
||||||
|
<div class="col-xl-3 col-md-6 d-inline-block scroll-item carousel-slide-item" data-client="<?php echo $clients['short_name']; ?>" data-branch="<?php echo $branches['branch_name']; ?>">
|
||||||
|
<div class="card" style="box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);">
|
||||||
|
<div class="card-header" >
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-8 center_text emp-count-view-click" >
|
||||||
|
<div class="d-flex justify-content-between">
|
||||||
|
<div class="w-100 text-center" >
|
||||||
|
<h3 class="my-2 py-1 number_css" ><span data-plugin="counterup" style="margin-left: 113px;font-size: 2.0rem;" onclick="enrollment_list(this, 'emp_count_view_click')"><?php echo isset($branches['employees']) ? count($branches['employees']) : '0'; ?></span></h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 center_text emp-count-view-click" >
|
||||||
|
<div class="d-flex justify-content-between">
|
||||||
|
|
||||||
|
<div class="w-100 text-center" >
|
||||||
|
<h5 class="text-muted font-weight-normal mt-0 text-truncate" title="Branch Info" style="text-align: center;"><?php echo isset($clients['short_name']) ? $clients['short_name'] : 'N/A'; ?> - <?php echo isset($branches['branch_name']) ? $branches['branch_name'] : 'N/A'; ?></h5>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- <div class="col-3 center_text emp-count-view-click" >
|
||||||
|
<div class="d-flex justify-content-between">
|
||||||
|
<div class="w-100 text-center" >
|
||||||
|
<p class="mb-0 text-muted">
|
||||||
|
<span class="text-success mr-2"></span>
|
||||||
|
<span class="text-nowrap">Emp Count</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div> -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-body add_card_background_random" >
|
||||||
|
|
||||||
|
<input type="text" class="client_id" value="<?php echo $clients['client_id']; ?>" hidden>
|
||||||
|
<input type="text" class="client_branch_id" value="<?php echo $branches['client_branch_id'] ?>" hidden>
|
||||||
|
<div class="row emp-status" style="margin-top: -9px;">
|
||||||
|
<div class="col-6 center_text emp-count-view-click" >
|
||||||
|
<span style="font-size: large;color: white !important;" class="number_css" onclick="enrollment_list(this, 'emp_logged_in_view_click')"><?php echo isset($branches['emp_login']) ? $branches['emp_login'] : '0'; ?></span><br>
|
||||||
|
<span class="text-nowrap " style="color: currentColor;font-size: 15px;">Logged-In</span>
|
||||||
|
</div>
|
||||||
|
<div class="col-6 center_text emp-count-view-click" >
|
||||||
|
<span style="font-size: large;color: white !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_logged_in_view_click')"><?php echo isset($branches['emp_login']) ? count($branches['employees']) - $branches['emp_login'] : '0'; ?></span><br>
|
||||||
|
<span class="text-nowrap" style="color: currentColor;font-size: 15px;margin-left: -13px;">Not Logged-In</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row emp-status" style="margin-top: -9px;">
|
||||||
|
|
||||||
|
<div class="col-6 center_text emp-count-view-click" >
|
||||||
|
<span style="font-size: large;color: white !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_enrolled_view_click')"><?php echo isset($branches['emp_enroll']) ? count($branches['employees']) - $branches['emp_enroll'] : '0'; ?></span><br>
|
||||||
|
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Draft</span>
|
||||||
|
</div>
|
||||||
|
<div class="col-6 center_text emp-count-view-click" >
|
||||||
|
<span style="font-size: large;color: white !important;" class="number_css" onclick="enrollment_list(this, 'emp_enrolled_view_click')"><?php echo isset($branches['emp_enroll']) ? $branches['emp_enroll'] : '0'; ?></span><br>
|
||||||
|
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Enrolled</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
$currentItem++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($currentItem % $itemsPerSlide != 0) echo '</div>'; // Close the last carousel item
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
|
||||||
|
<!-- <span class="carousel-control-prev-icon" aria-hidden="true"></span> -->
|
||||||
|
<!-- <span class="sr-only">Previous</span> -->
|
||||||
|
<i class="fas fa-angle-left"></i>
|
||||||
|
</a>
|
||||||
|
<a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
|
||||||
|
<span class="carousel-control-next-icon" aria-hidden="true"></span>
|
||||||
|
<span class="sr-only">Next</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
// Scroll functionality
|
||||||
|
$('.scroll-container').on('wheel', function(e) {
|
||||||
|
if (e.originalEvent.deltaY < 0) {
|
||||||
|
this.scrollLeft -= 100; // Adjust scroll speed
|
||||||
|
} else {
|
||||||
|
this.scrollLeft += 100; // Adjust scroll speed
|
||||||
|
}
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Search functionality
|
||||||
|
$('#searchInput').on('input', function() {
|
||||||
|
var searchValue = $(this).val().toLowerCase();
|
||||||
|
var firstVisibleItem = null;
|
||||||
|
|
||||||
|
$('.scroll-item').each(function() {
|
||||||
|
var itemText = $(this).find('h5').text().toLowerCase();
|
||||||
|
|
||||||
|
if (itemText.indexOf(searchValue) > -1) {
|
||||||
|
$(this).removeClass('hide-item').addClass('show-item'); // Show item
|
||||||
|
|
||||||
|
if (!firstVisibleItem) {
|
||||||
|
firstVisibleItem = $(this);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$(this).removeClass('show-item').addClass('hide-item'); // Hide item
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (firstVisibleItem) {
|
||||||
|
// Remove active class from all carousel items
|
||||||
|
$('.carousel-item').removeClass('active');
|
||||||
|
|
||||||
|
// Add active class to the parent carousel item of the first visible item
|
||||||
|
firstVisibleItem.closest('.carousel-item').addClass('active');
|
||||||
|
|
||||||
|
// Scroll to the first visible item
|
||||||
|
$('html, body').animate({
|
||||||
|
scrollTop: firstVisibleItem.offset().top
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
function enrollment_list(current_element, type) {
|
||||||
|
var clientId = $(current_element).closest('.carousel-slide-item').find('.client_id').val();
|
||||||
|
var branchId = $(current_element).closest('.carousel-slide-item').find('.client_branch_id').val();
|
||||||
|
|
||||||
|
var baseUrl = '<?php echo base_url(); ?>'; // Adjust this to your actual base URL if needed
|
||||||
|
var url = baseUrl + 'employee/enrollment-list'; // Change this to the actual URL of your enroller_list page
|
||||||
|
|
||||||
|
var params = new URLSearchParams({
|
||||||
|
client_id: clientId,
|
||||||
|
branch_id: branchId,
|
||||||
|
type: type
|
||||||
|
});
|
||||||
|
|
||||||
|
// Redirect to the constructed URL with parameters
|
||||||
|
window.location.href = `${url}?${params.toString()}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
// Array of predefined colors
|
||||||
|
var colors = ['yellowgreen', 'indianred', 'cadetblue', 'burlywood', 'darkolivegreen'];
|
||||||
|
|
||||||
|
// Counter to keep track of the current color index
|
||||||
|
var colorIndex = 0;
|
||||||
|
|
||||||
|
// Apply a color from the array to each card-header in sequence
|
||||||
|
document.querySelectorAll('.add_card_background_random').forEach(function(header) {
|
||||||
|
header.style.backgroundColor = colors[colorIndex];
|
||||||
|
colorIndex = (colorIndex + 1) % colors.length; // Move to the next color, cycling back to 0 if needed
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
466
app/Views/enrollment_list.php
Normal file
466
app/Views/enrollment_list.php
Normal file
@ -0,0 +1,466 @@
|
|||||||
|
<style>
|
||||||
|
.table th,
|
||||||
|
.table td {
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.dataTable tbody td {
|
||||||
|
padding: 4px 4px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn .btn-secondary .buttons-csv .buttons-html5 .my_class {
|
||||||
|
position: relative;
|
||||||
|
left: 79px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.visa_status_count_view .card-header {
|
||||||
|
/* background-color: #eb7a76; */
|
||||||
|
background-color: darkgrey;
|
||||||
|
/* padding-bottom: 1px; */
|
||||||
|
padding-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#tickets-table_filter {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.click_hover {
|
||||||
|
background: #1aa79c !important;
|
||||||
|
color: #fff !important;
|
||||||
|
border-radius: 5px;
|
||||||
|
box-shadow: 6px 5px 8px 0 #00000036;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.click_hover .text-muted{
|
||||||
|
color: #fff !important;
|
||||||
|
}
|
||||||
|
.click_hover span{
|
||||||
|
color: #fff !important;
|
||||||
|
}
|
||||||
|
.card {
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="row visa_status_count_view">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-3">
|
||||||
|
<div id="categoryFilter" style="display: flex;">
|
||||||
|
<select class="form-control" id="clients" onchange="populateBranches()">
|
||||||
|
<option value="0">Select Client</option>
|
||||||
|
<?php foreach ($client_list as $client) { ?>
|
||||||
|
<option value="<?= $client['id'] ?>"><?= $client['client_name'] ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
|
<div id="categoryFilter_11">
|
||||||
|
<select name="branch_id" class="form-control" id="branch_id">
|
||||||
|
<option value="0">Select Branch</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
|
<div id="categoryFilter_11">
|
||||||
|
<a href="#" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="fetchEmpolyeeList(event);">Search</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-3 text-right view-status-btn">
|
||||||
|
|
||||||
|
<button type="button" class="btn btn-link visa_status_button" onclick="toggleContent()">
|
||||||
|
Status <i id="toggleIcon" class="fas fa-minus"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-body status-option" id="statusContent" style="padding: 0.5rem !important;background-color: darkgrey;">
|
||||||
|
<div class="text-center">
|
||||||
|
<div class="row" style="margin-right: -261px;margin-left: 5px;">
|
||||||
|
<div class="col-xl-2 col-md-3">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body" id="emp_count_view_click">
|
||||||
|
<div class="d-flex justify-content-between" style="justify-content: center !important;">
|
||||||
|
<div>
|
||||||
|
<h5 class="text-muted font-weight-normal mt-0 text-truncate" title="Emp Count">Emp Count</h5>
|
||||||
|
<h3 class="my-2 py-1"><span data-plugin="counterup" id="emp_count_view">0</span></h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div><!-- end col -->
|
||||||
|
<div class="col-xl-2 col-md-3">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body" id="emp_enrolled_view_click">
|
||||||
|
<div class="d-flex justify-content-between" style="justify-content: center !important;">
|
||||||
|
<div>
|
||||||
|
<h5 class="text-muted font-weight-normal mt-0 text-truncate" title="Enrolled">Enrolled</h5>
|
||||||
|
<h3 class="my-2 py-1"><span data-plugin="counterup" id="emp_enrolled_view">0</span></h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div><!-- end col -->
|
||||||
|
<div class="col-xl-2 col-md-3">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body" id="emp_not_enrolled_view_click">
|
||||||
|
<div class="d-flex justify-content-between" style="justify-content: center !important;">
|
||||||
|
<div>
|
||||||
|
<h5 class="text-muted font-weight-normal mt-0 text-truncate" title="Not Enrolled">Not Enrolled</h5>
|
||||||
|
<h3 class="my-2 py-1"><span data-plugin="counterup" id="emp_not_enrolled_view">0</span></h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div><!-- end col -->
|
||||||
|
<div class="col-xl-2 col-md-3">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body" id="emp_logged_in_view_click">
|
||||||
|
<div class="d-flex justify-content-between" style="justify-content: center !important;">
|
||||||
|
<div>
|
||||||
|
<h5 class="text-muted font-weight-normal mt-0 text-truncate" title="Logged-In">Logged-In</h5>
|
||||||
|
<h3 class="my-2 py-1"><span data-plugin="counterup" id="emp_logged_in_view">0</span></h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div><!-- end col -->
|
||||||
|
<div class="col-xl-2 col-md-3">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body" id="emp_not_logged_in_view_click">
|
||||||
|
<div class="d-flex justify-content-between" style="justify-content: center !important;">
|
||||||
|
<div>
|
||||||
|
<h5 class="text-muted font-weight-normal mt-0 text-truncate" title="Not Logged-In">Not Logged-In</h5>
|
||||||
|
<h3 class="my-2 py-1"><span data-plugin="counterup" id="emp_not_logged_in_view">0</span></h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div><!-- end col -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row" id="client_list">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card" style="">
|
||||||
|
<div class="card-body">
|
||||||
|
<table class="table table-hover m-0 table-centered dt-responsive w-100" cellspacing="0" id="tickets-table">
|
||||||
|
<thead class="bg-light">
|
||||||
|
<tr>
|
||||||
|
<th class="font-weight-medium">SNO</th>
|
||||||
|
<th class="font-weight-medium">Name</th>
|
||||||
|
<th class="font-weight-medium">Emp Code</th>
|
||||||
|
<th class="font-weight-medium">Enrolled</th>
|
||||||
|
<th class="font-weight-medium">Logged-In</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody class="font-12">
|
||||||
|
<!-- Table body -->
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Center modal content omitted for brevity -->
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function populateBranches() {
|
||||||
|
var clientId = document.getElementById('clients').value;
|
||||||
|
var branchDropdown = document.getElementById('branch_id');
|
||||||
|
|
||||||
|
branchDropdown.innerHTML = '<option value="0">Select Branch</option>';
|
||||||
|
|
||||||
|
if (clientId == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var branches = <?= json_encode($branch_list) ?>;
|
||||||
|
|
||||||
|
branches.forEach(branch => {
|
||||||
|
if (branch.client_id == clientId) {
|
||||||
|
var option = document.createElement('option');
|
||||||
|
option.value = branch.id;
|
||||||
|
option.textContent = branch.branch_name;
|
||||||
|
branchDropdown.appendChild(option);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function filterTable(columnIndex, filterValue) {
|
||||||
|
var table = $('#tickets-table').DataTable();
|
||||||
|
|
||||||
|
// Reset the search filter for all columns
|
||||||
|
table.columns().search('').draw();
|
||||||
|
|
||||||
|
// Apply the filter to the specified column
|
||||||
|
table.column(columnIndex).search(filterValue).draw();
|
||||||
|
}
|
||||||
|
function fetchEmpolyeeList(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
var client_id = $('#clients').val();
|
||||||
|
var branch_id = $('#branch_id').val();
|
||||||
|
if (client_id == '0' || branch_id == '0') {
|
||||||
|
alert('Please select values in both dropdowns.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: '<?php echo base_url(); ?>' + '/employee/empby_client_clientbranch/' + client_id + '/' + branch_id,
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"X-Requested-With": "XMLHttpRequest"
|
||||||
|
},
|
||||||
|
success: function(response) {
|
||||||
|
var data = JSON.parse(response);
|
||||||
|
console.log(data);
|
||||||
|
var table = $('#tickets-table').DataTable();
|
||||||
|
table.clear();
|
||||||
|
|
||||||
|
if (data.length === 0) {
|
||||||
|
table.row.add([
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'No data available',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
''
|
||||||
|
]).draw();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var enrolled_count = 0;
|
||||||
|
var loggedIn_count = 0;
|
||||||
|
data.forEach(function(employee, index) {
|
||||||
|
|
||||||
|
if(employee.emp_status !== 'draft'){
|
||||||
|
var enrolled = 'Yes';
|
||||||
|
enrolled_count++;
|
||||||
|
}else{
|
||||||
|
var enrolled = 'No';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(employee.user_type === 'employee'){
|
||||||
|
var loggedIn = 'Yes';
|
||||||
|
loggedIn_count++;
|
||||||
|
}else{
|
||||||
|
var loggedIn = 'No';
|
||||||
|
}
|
||||||
|
|
||||||
|
table.row.add([
|
||||||
|
index + 1,
|
||||||
|
employee.employee_name,
|
||||||
|
employee.emp_code,
|
||||||
|
enrolled,
|
||||||
|
loggedIn
|
||||||
|
]);
|
||||||
|
|
||||||
|
$('#emp_count_view').html(data.length);
|
||||||
|
$('#emp_enrolled_view').html(enrolled_count);
|
||||||
|
$('#emp_not_enrolled_view').html(data.length - enrolled_count);
|
||||||
|
$('#emp_logged_in_view').html(loggedIn_count);
|
||||||
|
$('#emp_not_logged_in_view').html(data.length - loggedIn_count);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
table.draw();
|
||||||
|
|
||||||
|
function getUrlParameter(name) {
|
||||||
|
var params = new URLSearchParams(window.location.search);
|
||||||
|
return params.get(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
console.error('Error fetching data from API:', error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
function getUrlParameter(name) {
|
||||||
|
var params = new URLSearchParams(window.location.search);
|
||||||
|
return params.get(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for URL parameters and set form values
|
||||||
|
var client_id = getUrlParameter('client_id');
|
||||||
|
var branch_id = getUrlParameter('branch_id');
|
||||||
|
var type = getUrlParameter('type');
|
||||||
|
|
||||||
|
if (client_id) {
|
||||||
|
$('#clients').val(client_id).trigger('change'); // Set client ID and trigger change event to populate branches
|
||||||
|
}
|
||||||
|
|
||||||
|
if (branch_id) {
|
||||||
|
setTimeout(function() { // Ensure branches are populated before setting branch ID
|
||||||
|
$('#branch_id').val(branch_id).trigger('change');
|
||||||
|
if($('#branch_id').val() != 0){
|
||||||
|
$('#get-emp-list').click().trigger();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}, 500);
|
||||||
|
|
||||||
|
}
|
||||||
|
if (history.pushState) {
|
||||||
|
var newUrl = window.location.protocol + "//" + window.location.host + window.location.pathname;
|
||||||
|
window.history.pushState({path: newUrl}, '', newUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
// var type = getUrlParameter('type');
|
||||||
|
console.log("------------------------");
|
||||||
|
console.log(type);
|
||||||
|
$('#' + type).click().trigger();
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
$('#clients').select2();
|
||||||
|
$('#branch_id').select2();
|
||||||
|
var table = $('#tickets-table').DataTable({
|
||||||
|
dom: 'fBrtip',
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
extend: 'copy',
|
||||||
|
text: '<i class="fa fa-copy"></i>',
|
||||||
|
titleAttr: 'Copy',
|
||||||
|
filename: 'Enrollment List'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
extend: 'print',
|
||||||
|
text: '<i class="fa fa-print"></i>',
|
||||||
|
titleAttr: 'Print',
|
||||||
|
filename: 'Enrollment List'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
extend: 'pdf',
|
||||||
|
text: '<i class="fa fa-file-pdf"></i>',
|
||||||
|
titleAttr: 'PDF',
|
||||||
|
filename: 'Enrollment List'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
extend: 'csv',
|
||||||
|
text: '<i class="fa fa-file-csv"></i>',
|
||||||
|
titleAttr: 'CSV',
|
||||||
|
filename: 'Enrollment List'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
initComplete: function() {
|
||||||
|
// Add custom class to the print button
|
||||||
|
$('.buttons-print').addClass('buttons-html5');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$('#emp_enrolled_view_click').on('click', function() {
|
||||||
|
if ($(this).hasClass('click_hover')) {
|
||||||
|
// $(this).removeClass('click_hover');
|
||||||
|
$('.click_hover').each(function() {
|
||||||
|
$(this).removeClass('click_hover');
|
||||||
|
});
|
||||||
|
table.columns().search('').draw(); // Clear all filters and show all data
|
||||||
|
}else{
|
||||||
|
$('.click_hover').each(function() {
|
||||||
|
$(this).removeClass('click_hover');
|
||||||
|
});
|
||||||
|
$('#emp_enrolled_view_click').addClass('click_hover');
|
||||||
|
filterTable(3, 'Yes'); // Filter "Enrolled" column (4th column, index 3)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#emp_not_enrolled_view_click').on('click', function() {
|
||||||
|
if ($(this).hasClass('click_hover')) {
|
||||||
|
// $(this).removeClass('click_hover');
|
||||||
|
$('.click_hover').each(function() {
|
||||||
|
$(this).removeClass('click_hover');
|
||||||
|
});
|
||||||
|
table.columns().search('').draw(); // Clear all filters and show all data
|
||||||
|
}else{
|
||||||
|
$('.click_hover').each(function() {
|
||||||
|
$(this).removeClass('click_hover');
|
||||||
|
});
|
||||||
|
$('#emp_not_enrolled_view_click').addClass('click_hover');
|
||||||
|
filterTable(3, 'No'); // Filter "Enrolled" column (4th column, index 3)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#emp_logged_in_view_click').on('click', function() {
|
||||||
|
if ($(this).hasClass('click_hover')) {
|
||||||
|
// $(this).removeClass('click_hover');
|
||||||
|
$('.click_hover').each(function() {
|
||||||
|
$(this).removeClass('click_hover');
|
||||||
|
});
|
||||||
|
table.columns().search('').draw(); // Clear all filters and show all data
|
||||||
|
}else{
|
||||||
|
$('.click_hover').each(function() {
|
||||||
|
$(this).removeClass('click_hover');
|
||||||
|
});
|
||||||
|
$('#emp_logged_in_view_click').addClass('click_hover');
|
||||||
|
filterTable(4, 'Yes'); // Filter "Logged-In" column (5th column, index 4)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#emp_not_logged_in_view_click').on('click', function() {
|
||||||
|
if ($(this).hasClass('click_hover')) {
|
||||||
|
// $(this).removeClass('click_hover');
|
||||||
|
$('.click_hover').each(function() {
|
||||||
|
$(this).removeClass('click_hover');
|
||||||
|
});
|
||||||
|
table.columns().search('').draw(); // Clear all filters and show all data
|
||||||
|
}else{
|
||||||
|
$('.click_hover').each(function() {
|
||||||
|
$(this).removeClass('click_hover');
|
||||||
|
});
|
||||||
|
$('#emp_not_logged_in_view_click').addClass('click_hover');
|
||||||
|
filterTable(4, 'No'); // Filter "Logged-In" column (5th column, index 4)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#emp_count_view_click').on('click', function() {
|
||||||
|
if ($(this).hasClass('click_hover')) {
|
||||||
|
// $(this).removeClass('click_hover');
|
||||||
|
$('.click_hover').each(function() {
|
||||||
|
$(this).removeClass('click_hover');
|
||||||
|
});
|
||||||
|
table.columns().search('').draw(); // Clear all filters and show all data
|
||||||
|
}else{
|
||||||
|
$('.click_hover').each(function() {
|
||||||
|
$(this).removeClass('click_hover');
|
||||||
|
});
|
||||||
|
$('#emp_count_view_click').addClass('click_hover');
|
||||||
|
table.columns().search('').draw(); // Clear all filters and show all data
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
toggleContent();
|
||||||
|
});
|
||||||
|
|
||||||
|
function toggleContent() {
|
||||||
|
var content = document.getElementById("statusContent");
|
||||||
|
var toggleIcon = document.getElementById("toggleIcon");
|
||||||
|
if (content.style.display === "none") {
|
||||||
|
content.style.display = "block";
|
||||||
|
toggleIcon.classList.remove("fa-plus");
|
||||||
|
toggleIcon.classList.add("fa-minus");
|
||||||
|
} else {
|
||||||
|
content.style.display = "none";
|
||||||
|
toggleIcon.classList.remove("fa-minus");
|
||||||
|
toggleIcon.classList.add("fa-plus");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@ -50,7 +50,8 @@
|
|||||||
</td>
|
</td>
|
||||||
<td><?php echo $file['short_name'] ?></td>
|
<td><?php echo $file['short_name'] ?></td>
|
||||||
<td><?php echo $file['branch_name'] ?></td>
|
<td><?php echo $file['branch_name'] ?></td>
|
||||||
<td><?php echo isset($file['policy_name']) ? $file['policy_name'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?> - <?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?></td>
|
<!-- <td><?php echo isset($file['policy_name']) ? $file['policy_name'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?> - <?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?></td> -->
|
||||||
|
<td><?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?></td>
|
||||||
<td><?php echo $file['action'] ?></td>
|
<td><?php echo $file['action'] ?></td>
|
||||||
<td><?php echo fancy_date_time_format($file['created_at']) . ' by <strong>' . $file['first_name'] . '</strong>' ?>
|
<td><?php echo fancy_date_time_format($file['created_at']) . ' by <strong>' . $file['first_name'] . '</strong>' ?>
|
||||||
</td>
|
</td>
|
||||||
@ -92,26 +93,15 @@
|
|||||||
class="mdi mdi-dots-horizontal"></i></a>
|
class="mdi mdi-dots-horizontal"></i></a>
|
||||||
<div class="dropdown-menu dropdown-menu-right">
|
<div class="dropdown-menu dropdown-menu-right">
|
||||||
<?php if ($file['status'] == 'failed') { ?>
|
<?php if ($file['status'] == 'failed') { ?>
|
||||||
<a data-id="<?= htmlspecialchars(json_encode(['client_id' => $file['client_id'], 'client_policy_id' => $file['client_policy_id'], 'client_branch_id' => $file['client_branch_id'], 'action' => $file['action']])) ?>"
|
<a data-id="<?= htmlspecialchars(json_encode(['client_id' => $file['client_id'], 'client_policy_id' => $file['client_policy_id'], 'client_branch_id' => $file['client_branch_id'], 'action' => $file['action']])) ?>" data-toggle="modal" data-target="#file-upload-modal" class="dropdown-item upload_button" href="#"><i class="mdi mdi-upload mr-2 text-muted font-18 vertical-middle"></i>Re-Upload</a>
|
||||||
data-toggle="modal" data-target="#file-upload-modal"
|
|
||||||
class="dropdown-item upload_button" href="#"><i
|
|
||||||
class="mdi mdi-upload mr-2 text-muted font-18 vertical-middle"></i>Re-Upload</a>
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<a class="dropdown-item"
|
|
||||||
href="<?= base_url("util/download-file-list/") . $file['id']; ?>"><i
|
|
||||||
class="mdi mdi-download mr-2 text-muted font-18 vertical-middle"></i>Download</a>
|
|
||||||
|
|
||||||
<a data-id="<?php echo $file['id'] ?>" data-toggle="modal"
|
<a class="dropdown-item" href="<?= base_url("util/download-file-list/") . $file['id']; ?>"><i class="mdi mdi-download mr-2 text-muted font-18 vertical-middle"></i>Download</a>
|
||||||
data-target="#full-width-modal-emp-list" class="dropdown-item view_emp_list"
|
<a data-id="<?php echo $file['id'] ?>" data-toggle="modal" data-target="#full-width-modal-emp-list" class="dropdown-item view_emp_list" href="#"><i class="mdi mdi-eye mr-2 text-muted font-18 vertical-middle"></i>View</a>
|
||||||
href="#"><i
|
|
||||||
class="mdi mdi-eye mr-2 text-muted font-18 vertical-middle"></i>View</a>
|
|
||||||
<?php if ($file['status'] == 'success') { ?>
|
<?php if ($file['status'] == 'success') { ?>
|
||||||
|
<a data-id="<?php echo $file['id'] ?>" class="dropdown-item truncate" href="#"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Truncate</a>
|
||||||
|
<?php } ?>
|
||||||
<a data-id="<?php echo $file['id'] ?>" class="dropdown-item truncate" href="#"><i
|
|
||||||
class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Truncate</a>
|
|
||||||
<?php
|
|
||||||
} ?>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -255,6 +245,7 @@ $('body').on('click', '.upload_button', function() {
|
|||||||
$('#file_upload_actions').val(fileId.action)
|
$('#file_upload_actions').val(fileId.action)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
$('body').on('click', '.truncate', function(event) {
|
$('body').on('click', '.truncate', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
// console.log(event);
|
// console.log(event);
|
||||||
@ -272,40 +263,29 @@ $('body').on('click', '.truncate', function(event) {
|
|||||||
if (result.isConfirmed) {
|
if (result.isConfirmed) {
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
$('.loader-mask').fadeIn();
|
$('.loader-mask').fadeIn();
|
||||||
var apiURL = '<?php echo base_url(); ?>' + 'employee/truncate/' + fileId;
|
var apiURL = '<?php echo base_url(); ?>employee/truncate/' + fileId;
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: apiURL,
|
url: apiURL,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
// "Content-Type": "application/json",
|
|
||||||
"X-Requested-With": "XMLHttpRequest"
|
"X-Requested-With": "XMLHttpRequest"
|
||||||
},
|
},
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
// console.log(response.code);
|
|
||||||
// console.log(response.dataStatus);
|
|
||||||
// console.log(response.data);
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
|
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||||
if (response.code === 200 && response.dataStatus === true && response
|
|
||||||
.data !== "") {
|
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: "Deleted!",
|
title: "Deleted!",
|
||||||
// text: "Data from truncated",
|
|
||||||
icon: "success"
|
icon: "success"
|
||||||
});
|
});
|
||||||
} else if (response.code === 404 && response.dataStatus === false) {
|
} else if (response.code === 404 && response.dataStatus === false) {
|
||||||
console.error('no data found', response);
|
console.error('No data found', response);
|
||||||
Swal.fire({
|
handleNoDataFound(response, fileId);
|
||||||
title: "Failed!",
|
|
||||||
text: response.message,
|
|
||||||
icon: "error"
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: "Failed!",
|
title: "Failed!",
|
||||||
text: 'Something went wrong! Try later',
|
text: 'Something went wrong! Try later',
|
||||||
@ -323,13 +303,77 @@ $('body').on('click', '.truncate', function(event) {
|
|||||||
toastr.error('Something went wrong! Try later', 'Error');
|
toastr.error('Something went wrong! Try later', 'Error');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function handleNoDataFound(response, fileId) {
|
||||||
|
if (response.role == 1 || response.role == 5) {
|
||||||
|
Swal.fire({
|
||||||
|
title: response.message,
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonText: "Delete",
|
||||||
|
confirmButtonColor: "#ff3333",
|
||||||
|
}).then((result) => {
|
||||||
|
|
||||||
|
console.log(result);
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
var apiURL = '<?php echo base_url(); ?>employee/truncate/' + fileId + '/' + <?= get_role_id(); ?>;
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: apiURL,
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
"X-Requested-With": "XMLHttpRequest"
|
||||||
|
},
|
||||||
|
success: function(response) {
|
||||||
|
setTimeout(function() {
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||||
|
Swal.fire({
|
||||||
|
title: "Deleted!",
|
||||||
|
icon: "success"
|
||||||
|
});
|
||||||
|
} else if (response.code === 404 && response.dataStatus === false) {
|
||||||
|
console.error('No data found', response);
|
||||||
|
Swal.fire({
|
||||||
|
title: "Failed!",
|
||||||
|
text: response.message,
|
||||||
|
icon: "error"
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Swal.fire({
|
||||||
|
title: "Failed!",
|
||||||
|
text: 'Something went wrong! Try later',
|
||||||
|
icon: "error"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
setTimeout(function() {
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
console.error('Error fetching data from API:', error);
|
||||||
|
console.error('Something went wrong! Try later', 'Error');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Swal.fire({
|
||||||
|
title: "Failed!",
|
||||||
|
text: response.message,
|
||||||
|
icon: "error"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$('#uploadForm').submit(function() {
|
$('#uploadForm').submit(function() {
|
||||||
|
|
||||||
@ -391,7 +435,6 @@ $('#uploadForm').submit(function() {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
$('body').on('click', '.reload', function() {
|
$('body').on('click', '.reload', function() {
|
||||||
|
|
||||||
console.log('status');
|
console.log('status');
|
||||||
|
|||||||
@ -1,5 +1,11 @@
|
|||||||
<div class="tab-pane fade" id="KYC-DOC-tab">
|
<style>
|
||||||
|
.select2-container .select2-selection--multiple .select2-selection__choice {
|
||||||
|
padding: 5px 7px 5px 0 !important;
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="KYC-DOC-tab">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xl-12">
|
<div class="col-xl-12">
|
||||||
<div id="accordion" class="mb-3">
|
<div id="accordion" class="mb-3">
|
||||||
@ -14,6 +20,7 @@
|
|||||||
<!-- <div class="text-center"> -->
|
<!-- <div class="text-center"> -->
|
||||||
<form class="parsley-examples" id="import_export_excel_form" action="<?php echo base_url() . 'util/import-export' ?>" method="post" enctype="multipart/form-data">
|
<form class="parsley-examples" id="import_export_excel_form" action="<?php echo base_url() . 'util/import-export' ?>" method="post" enctype="multipart/form-data">
|
||||||
<input type="hidden" name="<?= csrf_token() ?>" value="<?= csrf_hash() ?>" id="csrf_token">
|
<input type="hidden" name="<?= csrf_token() ?>" value="<?= csrf_hash() ?>" id="csrf_token">
|
||||||
|
<input type="hidden" id="event_type_data">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
@ -82,7 +89,6 @@
|
|||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
@ -130,8 +136,8 @@
|
|||||||
$("#client").select2();
|
$("#client").select2();
|
||||||
$("#policy").select2();
|
$("#policy").select2();
|
||||||
$("#client_branch_id").select2();
|
$("#client_branch_id").select2();
|
||||||
});
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
// Declare a global variable to store API response data
|
// Declare a global variable to store API response data
|
||||||
var clientPolicies = [];
|
var clientPolicies = [];
|
||||||
@ -224,8 +230,6 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$(window).on("load", function() {
|
$(window).on("load", function() {
|
||||||
|
|
||||||
fetchClientPolicies2();
|
fetchClientPolicies2();
|
||||||
@ -239,8 +243,6 @@
|
|||||||
// Use URLSearchParams to get the query parameters
|
// Use URLSearchParams to get the query parameters
|
||||||
const params = new URLSearchParams(urlObject.search);
|
const params = new URLSearchParams(urlObject.search);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Get the value of 'client_id' and 'client_policy_id'
|
// Get the value of 'client_id' and 'client_policy_id'
|
||||||
client_id_param2 = params.get('client_id');
|
client_id_param2 = params.get('client_id');
|
||||||
client_policy_param2 = params.get('client_policy_id');
|
client_policy_param2 = params.get('client_policy_id');
|
||||||
@ -249,16 +251,12 @@
|
|||||||
insurer_or_tpa = params.get('insurer_or_tpa');
|
insurer_or_tpa = params.get('insurer_or_tpa');
|
||||||
event = params.get('event');
|
event = params.get('event');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// console.log('client_id2:', client_id_param2);
|
// console.log('client_id2:', client_id_param2);
|
||||||
// console.log('client_policy_id2:', client_policy_param2);
|
// console.log('client_policy_id2:', client_policy_param2);
|
||||||
// console.log('actions:', actions);
|
// console.log('actions:', actions);
|
||||||
// console.log('insurer_or_tpa:', insurer_or_tpa);
|
// console.log('insurer_or_tpa:', insurer_or_tpa);
|
||||||
// console.log('event:', event);
|
// console.log('event:', event);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (inception_param != null) {
|
if (inception_param != null) {
|
||||||
|
|
||||||
$('#action_type').val(actions).change()
|
$('#action_type').val(actions).change()
|
||||||
@ -286,7 +284,6 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function fetchClientPolicies2() {
|
function fetchClientPolicies2() {
|
||||||
|
|
||||||
$('#loader').show();
|
$('#loader').show();
|
||||||
@ -364,7 +361,6 @@
|
|||||||
$('#loader').hide();
|
$('#loader').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function appendClients2(data) {
|
function appendClients2(data) {
|
||||||
|
|
||||||
// console.log('client_id_param2', client_id_param2)
|
// console.log('client_id_param2', client_id_param2)
|
||||||
@ -381,7 +377,6 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function appendBranch2(data) {
|
function appendBranch2(data) {
|
||||||
|
|
||||||
// console.log(data)
|
// console.log(data)
|
||||||
@ -403,7 +398,6 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function appendPolicies2(data) {
|
function appendPolicies2(data) {
|
||||||
|
|
||||||
$('#policy').empty();
|
$('#policy').empty();
|
||||||
@ -415,7 +409,8 @@
|
|||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
var option = $('<option>', {
|
var option = $('<option>', {
|
||||||
value: item.client_policy_id,
|
value: item.client_policy_id,
|
||||||
text: `${item.name ?? ''} - ${item.policy_no ?? ''} - ${item.policy_type ?? ''}`
|
// text: `${item.name ?? ''} - ${item.policy_no ?? ''} - ${item.policy_type ?? ''}`
|
||||||
|
text:`${item.policy_type ?? ''} - ${item.policy_no ?? ''}`
|
||||||
});
|
});
|
||||||
if (client_policy_param2 == item.client_policy_id) {
|
if (client_policy_param2 == item.client_policy_id) {
|
||||||
option.attr('selected', true);
|
option.attr('selected', true);
|
||||||
@ -510,7 +505,6 @@
|
|||||||
|
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
$('#action_type').change(function() {
|
$('#action_type').change(function() {
|
||||||
|
|
||||||
var selectedValue = $(this).val();
|
var selectedValue = $(this).val();
|
||||||
@ -532,14 +526,12 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
document.getElementById('toggleIcon').addEventListener('click', function() {
|
document.getElementById('toggleIcon').addEventListener('click', function() {
|
||||||
var icon = document.getElementById('icon');
|
var icon = document.getElementById('icon');
|
||||||
icon.classList.toggle('mdi-chevron-down');
|
icon.classList.toggle('mdi-chevron-down');
|
||||||
icon.classList.toggle('mdi-chevron-up');
|
icon.classList.toggle('mdi-chevron-up');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
$('#event_type').change(function() {
|
$('#event_type').change(function() {
|
||||||
@ -556,6 +548,59 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
$('#insurer_or_tpa').change(function(){
|
||||||
|
var insurer_or_tpa = $(this).val()
|
||||||
|
var policy_value = $('#policy').val()
|
||||||
|
var event_type_data = $('#event_type_data').val();
|
||||||
|
console.log('policy_value', policy_value)
|
||||||
|
|
||||||
|
if(insurer_or_tpa == 'tpa' || event_type_data == 0){
|
||||||
|
$("#event_type").removeAttr("multiple");
|
||||||
|
$("#event_type").attr("name", "event_type");
|
||||||
|
$("#event_type").select2('destroy');
|
||||||
|
}else{
|
||||||
|
if(policy_value != 0){
|
||||||
|
$("#event_type").attr("multiple", "multiple");
|
||||||
|
$("#event_type").attr("name", "event_type[]");
|
||||||
|
$("#event_type").select2();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}) ;
|
||||||
|
|
||||||
|
$('#action_type').change(function(){
|
||||||
|
var insurer_or_tpa = $(this).val()
|
||||||
|
var policy_value = $('#policy').val()
|
||||||
|
var event_type_data = $('#event_type_data').val();
|
||||||
|
|
||||||
|
console.log('policy_value', policy_value)
|
||||||
|
if(insurer_or_tpa == 'import' || event_type_data == 0){
|
||||||
|
$("#event_type").removeAttr("multiple");
|
||||||
|
$("#event_type").attr("name", "event_type");
|
||||||
|
$("#event_type").select2('destroy');
|
||||||
|
}else{
|
||||||
|
if(policy_value != 0){
|
||||||
|
$("#event_type").attr("multiple", "multiple");
|
||||||
|
$("#event_type").attr("name", "event_type[]");
|
||||||
|
$("#event_type").select2();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
$('#policy').change(function(){
|
||||||
|
var policy_value = $(this).val()
|
||||||
|
if(policy_value == 0){
|
||||||
|
$("#event_type").removeAttr("multiple");
|
||||||
|
$("#event_type").attr("name", "event_type");
|
||||||
|
$("#event_type").select2('destroy');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -175,6 +175,8 @@
|
|||||||
|
|
||||||
pullNotificationCount = response.message.length
|
pullNotificationCount = response.message.length
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
localStorage.setItem('pullNotificationCount', pullNotificationCount)
|
localStorage.setItem('pullNotificationCount', pullNotificationCount)
|
||||||
|
|
||||||
response.message.forEach(message => {
|
response.message.forEach(message => {
|
||||||
@ -305,7 +307,7 @@
|
|||||||
method: 'GET',
|
method: 'GET',
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
|
|
||||||
//console.log(response);
|
console.log(response);
|
||||||
|
|
||||||
if (response.length == 0) {
|
if (response.length == 0) {
|
||||||
|
|
||||||
@ -314,87 +316,34 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (let key in response) {
|
for (let key in response) {
|
||||||
pendingActionCount += response[key].length;
|
// console.log(response[key].length)
|
||||||
|
// console.log('type', typeof response[key].length)
|
||||||
|
// console.log('key', response[key])
|
||||||
|
if(response[key].length != 'undefined' && response[key].length != undefined)
|
||||||
|
{
|
||||||
|
pendingActionCount = pendingActionCount + response[key].length;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(pendingActionCount);
|
||||||
|
|
||||||
let messagesList = $('#messages-list-2');
|
let messagesList = $('#messages-list-2');
|
||||||
messagesList.empty();
|
messagesList.empty();
|
||||||
|
|
||||||
|
|
||||||
response.inception.forEach(function(item, index) {
|
if (response.inception) {
|
||||||
|
$.each(response.inception, function(index, item) {
|
||||||
var queryParams = {
|
|
||||||
client_id: item.client_id,
|
|
||||||
client_policy_id: item.client_policy_id,
|
|
||||||
client_branch_id: item.branch_id,
|
|
||||||
actions: 'inception'
|
|
||||||
};
|
|
||||||
|
|
||||||
const queryString = objectToQueryString(queryParams);
|
|
||||||
|
|
||||||
var url = 'employee/upload?' + queryString
|
|
||||||
////console.log(url)
|
|
||||||
|
|
||||||
|
|
||||||
var toast_body_css = 'background : #bfd7eb !important;';
|
|
||||||
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
|
|
||||||
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
|
||||||
var toast_status_word = 'Info';
|
|
||||||
|
|
||||||
if (!item.branch_name.toLowerCase().includes('branch')) {
|
|
||||||
|
|
||||||
//console.log(item.branch_name)
|
|
||||||
item.branch_name += ' branch';
|
|
||||||
}
|
|
||||||
|
|
||||||
////console.log(item.branch_name);
|
|
||||||
|
|
||||||
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
|
|
||||||
|
|
||||||
////console.log(toast_body_data);
|
|
||||||
|
|
||||||
var html = ` <li data-id="" data-url="${url}">
|
|
||||||
<div class="p-3">
|
|
||||||
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
|
|
||||||
<div class="toast-header " style="${toast_head_css}" >
|
|
||||||
<strong class="${toast_icon}"> ${toast_status_word}</strong>
|
|
||||||
<button type="button" class="ml-2 mb-1 close rm_msg" data-dismiss="toast" aria-label="Close">
|
|
||||||
<span aria-hidden="true">×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="toast-body" style="${toast_body_css}">
|
|
||||||
<strong>Inception Pending</strong><br><br>
|
|
||||||
<small style="position: relative;bottom: 8px;">${toast_body_data}</small>
|
|
||||||
<div class="toast-footer">
|
|
||||||
<a href="#" class="redirect_page" data-toggle="tooltip" data-placement="bottom" title="Click Go to the Page"><small style="margin-right: 142px;position: relative;top: 2px;">see more</small></a>
|
|
||||||
<small style="position: relative;top: 2px;left: 5px;font-size: 10px;"></small>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>`
|
|
||||||
|
|
||||||
|
|
||||||
messagesList.append(html);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
response.correction.forEach(function(item, index) {
|
|
||||||
|
|
||||||
if (item.batch_export_count == 0 || item.batch_import_count == 0) {
|
|
||||||
|
|
||||||
|
|
||||||
var queryParams = {
|
var queryParams = {
|
||||||
client_id: item.client_id,
|
client_id: item.client_id,
|
||||||
|
client_policy_id: item.client_policy_id,
|
||||||
client_branch_id: item.branch_id,
|
client_branch_id: item.branch_id,
|
||||||
event: 'correction',
|
actions: 'inception'
|
||||||
actions: 'export',
|
|
||||||
insurer_or_tpa: 'tpa',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const queryString = objectToQueryString(queryParams);
|
const queryString = objectToQueryString(queryParams);
|
||||||
|
|
||||||
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
|
var url = 'employee/upload?' + queryString
|
||||||
////console.log(url)
|
////console.log(url)
|
||||||
|
|
||||||
|
|
||||||
@ -403,101 +352,320 @@
|
|||||||
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
||||||
var toast_status_word = 'Info';
|
var toast_status_word = 'Info';
|
||||||
|
|
||||||
var title = 'Correction Pending';
|
|
||||||
|
|
||||||
|
|
||||||
if (!item.branch_name.toLowerCase().includes('branch')) {
|
if (!item.branch_name.toLowerCase().includes('branch')) {
|
||||||
|
|
||||||
//console.log(item.branch_name)
|
//console.log(item.branch_name)
|
||||||
item.branch_name += ' branch';
|
item.branch_name += ' branch';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////console.log(item.branch_name);
|
////console.log(item.branch_name);
|
||||||
|
|
||||||
// if (item.batch_export_count > 0) {
|
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
|
||||||
|
|
||||||
// title = 'Correction Import Pending';
|
|
||||||
// }
|
|
||||||
|
|
||||||
var toast_body_data = item.client_name + ' - ' + item.branch_name;
|
|
||||||
////console.log(toast_body_data);
|
////console.log(toast_body_data);
|
||||||
|
|
||||||
var html = ` <li data-id="" data-url="${url}">
|
var html = ` <li data-id="" data-url="${url}">
|
||||||
<div class="p-3">
|
<div class="p-3">
|
||||||
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
|
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
|
||||||
<div class="toast-header " style="${toast_head_css}" >
|
<div class="toast-header " style="${toast_head_css}" >
|
||||||
<strong class="${toast_icon}"> ${toast_status_word}</strong>
|
<strong class="${toast_icon}"> ${toast_status_word}</strong>
|
||||||
<button type="button" class="ml-2 mb-1 close rm_msg" data-dismiss="toast" aria-label="Close">
|
<button type="button" class="ml-2 mb-1 close rm_msg" data-dismiss="toast" aria-label="Close">
|
||||||
<span aria-hidden="true">×</span>
|
<span aria-hidden="true">×</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="toast-body" style="${toast_body_css}">
|
<div class="toast-body" style="${toast_body_css}">
|
||||||
<strong>${title}</strong><br><br>
|
<strong>Inception Pending</strong><br><br>
|
||||||
<small style="position: relative;bottom: 8px;">${toast_body_data}</small>
|
<small style="position: relative;bottom: 8px;">${toast_body_data}</small>
|
||||||
<div class="toast-footer">
|
<div class="toast-footer">
|
||||||
<a href="#" class="redirect_page" data-toggle="tooltip" data-placement="bottom" title="Click Go to the Page"><small style="margin-right: 142px;position: relative;top: 2px;">see more</small></a>
|
<a href="#" class="redirect_page" data-toggle="tooltip" data-placement="bottom" title="Click Go to the Page"><small style="margin-right: 142px;position: relative;top: 2px;">see more</small></a>
|
||||||
<small style="position: relative;top: 2px;left: 5px;font-size: 10px;"></small>
|
<small style="position: relative;top: 2px;left: 5px;font-size: 10px;"></small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</li>`
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>`
|
|
||||||
|
|
||||||
|
|
||||||
messagesList.append(html);
|
messagesList.append(html);
|
||||||
|
|
||||||
}
|
});
|
||||||
|
} else {
|
||||||
|
console.log('response.inception is undefined or null');
|
||||||
|
}
|
||||||
|
|
||||||
});
|
if (response.correction) {
|
||||||
|
$.each(response.correction, function(index, item) {
|
||||||
response.deletion.forEach(function(item, index) {
|
if (item.batch_export_count == 0 || item.batch_import_count == 0) {
|
||||||
|
|
||||||
if (item.batch_export_count == 0 || item.batch_import_count == 0) {
|
|
||||||
|
|
||||||
|
|
||||||
var queryParams = {
|
var queryParams = {
|
||||||
|
client_id: item.client_id,
|
||||||
|
client_branch_id: item.branch_id,
|
||||||
|
event: 'correction',
|
||||||
|
actions: 'export',
|
||||||
|
insurer_or_tpa: 'tpa',
|
||||||
|
};
|
||||||
|
|
||||||
client_id: item.client_id,
|
const queryString = objectToQueryString(queryParams);
|
||||||
client_policy_id: item.client_policy_id,
|
|
||||||
client_branch_id: item.branch_id,
|
|
||||||
event: 'deletion',
|
|
||||||
actions: 'export',
|
|
||||||
insurer_or_tpa: 'tpa',
|
|
||||||
|
|
||||||
};
|
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
|
||||||
|
////console.log(url)
|
||||||
const queryString = objectToQueryString(queryParams);
|
|
||||||
|
|
||||||
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
|
|
||||||
////console.log(url)
|
|
||||||
|
|
||||||
|
|
||||||
var toast_body_css = 'background : #bfd7eb !important;';
|
var toast_body_css = 'background : #bfd7eb !important;';
|
||||||
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
|
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
|
||||||
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
||||||
var toast_status_word = 'Info';
|
var toast_status_word = 'Info';
|
||||||
var title = 'Deletion Pending';
|
|
||||||
|
var title = 'Correction Pending';
|
||||||
|
|
||||||
|
|
||||||
if (!item.branch_name.toLowerCase().includes('branch')) {
|
if (!item.branch_name.toLowerCase().includes('branch')) {
|
||||||
|
|
||||||
//console.log(item.branch_name)
|
//console.log(item.branch_name)
|
||||||
item.branch_name += ' branch';
|
item.branch_name += ' branch';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
////console.log(item.branch_name);
|
||||||
|
|
||||||
|
// if (item.batch_export_count > 0) {
|
||||||
|
|
||||||
|
// title = 'Correction Import Pending';
|
||||||
|
// }
|
||||||
|
|
||||||
|
var toast_body_data = item.client_name + ' - ' + item.branch_name;
|
||||||
|
////console.log(toast_body_data);
|
||||||
|
|
||||||
|
var html = ` <li data-id="" data-url="${url}">
|
||||||
|
<div class="p-3">
|
||||||
|
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
|
||||||
|
<div class="toast-header " style="${toast_head_css}" >
|
||||||
|
<strong class="${toast_icon}"> ${toast_status_word}</strong>
|
||||||
|
<button type="button" class="ml-2 mb-1 close rm_msg" data-dismiss="toast" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="toast-body" style="${toast_body_css}">
|
||||||
|
<strong>${title}</strong><br><br>
|
||||||
|
<small style="position: relative;bottom: 8px;">${toast_body_data}</small>
|
||||||
|
<div class="toast-footer">
|
||||||
|
<a href="#" class="redirect_page" data-toggle="tooltip" data-placement="bottom" title="Click Go to the Page"><small style="margin-right: 142px;position: relative;top: 2px;">see more</small></a>
|
||||||
|
<small style="position: relative;top: 2px;left: 5px;font-size: 10px;"></small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>`
|
||||||
|
|
||||||
|
|
||||||
|
messagesList.append(html);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
console.log('response.correction is undefined or null');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.deletion) {
|
||||||
|
$.each(response.deletion, function(index, item) {
|
||||||
|
|
||||||
|
if (item.batch_export_count == 0 || item.batch_import_count == 0) {
|
||||||
|
|
||||||
|
|
||||||
|
var queryParams = {
|
||||||
|
|
||||||
|
client_id: item.client_id,
|
||||||
|
client_policy_id: item.client_policy_id,
|
||||||
|
client_branch_id: item.branch_id,
|
||||||
|
event: 'deletion',
|
||||||
|
actions: 'export',
|
||||||
|
insurer_or_tpa: 'tpa',
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
const queryString = objectToQueryString(queryParams);
|
||||||
|
|
||||||
|
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
|
||||||
|
////console.log(url)
|
||||||
|
|
||||||
|
|
||||||
|
var toast_body_css = 'background : #bfd7eb !important;';
|
||||||
|
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
|
||||||
|
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
||||||
|
var toast_status_word = 'Info';
|
||||||
|
var title = 'Deletion Pending';
|
||||||
|
|
||||||
|
|
||||||
|
if (!item.branch_name.toLowerCase().includes('branch')) {
|
||||||
|
|
||||||
|
//console.log(item.branch_name)
|
||||||
|
item.branch_name += ' branch';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
////console.log(item.branch_name);
|
||||||
|
|
||||||
|
// if (item.batch_export_count > 0) {
|
||||||
|
|
||||||
|
// title = 'Deletion Import Pending';
|
||||||
|
// }
|
||||||
|
|
||||||
|
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
|
||||||
|
////console.log(toast_body_data);
|
||||||
|
|
||||||
|
var html = ` <li data-id="" data-url="${url}">
|
||||||
|
<div class="p-3">
|
||||||
|
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
|
||||||
|
<div class="toast-header " style="${toast_head_css}" >
|
||||||
|
<strong class="${toast_icon}"> ${toast_status_word}</strong>
|
||||||
|
<button type="button" class="ml-2 mb-1 close rm_msg" data-dismiss="toast" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="toast-body" style="${toast_body_css}">
|
||||||
|
<strong>${title}</strong><br><br>
|
||||||
|
<small style="position: relative;bottom: 8px;">${toast_body_data}</small>
|
||||||
|
<div class="toast-footer">
|
||||||
|
<a href="#" class="redirect_page" data-toggle="tooltip" data-placement="bottom" title="Click Go to the Page"><small style="margin-right: 142px;position: relative;top: 2px;">see more</small></a>
|
||||||
|
<small style="position: relative;top: 2px;left: 5px;font-size: 10px;"></small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>`
|
||||||
|
|
||||||
|
|
||||||
|
messagesList.append(html);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////console.log(item.branch_name);
|
});
|
||||||
|
}else{
|
||||||
|
console.log('response.deletion is undefined or null');
|
||||||
|
|
||||||
// if (item.batch_export_count > 0) {
|
}
|
||||||
|
|
||||||
// title = 'Deletion Import Pending';
|
if (response.si_enhancement) {
|
||||||
// }
|
$.each(response.si_enhancement, function(index, item) {
|
||||||
|
if (item.batch_export_count == 0 || item.batch_import_count == 0) {
|
||||||
|
|
||||||
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
|
|
||||||
////console.log(toast_body_data);
|
|
||||||
|
|
||||||
var html = ` <li data-id="" data-url="${url}">
|
var queryParams = {
|
||||||
|
client_id: item.client_id,
|
||||||
|
client_policy_id: item.client_policy_id,
|
||||||
|
client_branch_id: item.branch_id,
|
||||||
|
event: 'si_enhancement',
|
||||||
|
actions: 'export',
|
||||||
|
insurer_or_tpa: 'tpa',
|
||||||
|
};
|
||||||
|
|
||||||
|
const queryString = objectToQueryString(queryParams);
|
||||||
|
|
||||||
|
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
|
||||||
|
////console.log(url)
|
||||||
|
|
||||||
|
|
||||||
|
var toast_body_css = 'background : #bfd7eb !important;';
|
||||||
|
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
|
||||||
|
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
||||||
|
var toast_status_word = 'Info';
|
||||||
|
var title = 'SI Enhancement Pending';
|
||||||
|
|
||||||
|
|
||||||
|
if (!item.branch_name.toLowerCase().includes('branch')) {
|
||||||
|
|
||||||
|
//console.log(item.branch_name)
|
||||||
|
item.branch_name += ' branch';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
////console.log(item.branch_name);
|
||||||
|
|
||||||
|
// if (item.batch_export_count > 0) {
|
||||||
|
|
||||||
|
// title = 'SI Enhancement Import Pending';
|
||||||
|
// }
|
||||||
|
|
||||||
|
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
|
||||||
|
////console.log(toast_body_data);
|
||||||
|
|
||||||
|
var html = ` <li data-id="" data-url="${url}">
|
||||||
|
<div class="p-3">
|
||||||
|
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
|
||||||
|
<div class="toast-header " style="${toast_head_css}" >
|
||||||
|
<strong class="${toast_icon}"> ${toast_status_word}</strong>
|
||||||
|
<button type="button" class="ml-2 mb-1 close rm_msg" data-dismiss="toast" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="toast-body" style="${toast_body_css}">
|
||||||
|
<strong>${title}</strong><br><br>
|
||||||
|
<small style="position: relative;bottom: 8px;">${toast_body_data}</small>
|
||||||
|
<div class="toast-footer">
|
||||||
|
<a href="#" class="redirect_page" data-toggle="tooltip" data-placement="bottom" title="Click Go to the Page"><small style="margin-right: 142px;position: relative;top: 2px;">see more</small></a>
|
||||||
|
<small style="position: relative;top: 2px;left: 5px;font-size: 10px;"></small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>`
|
||||||
|
|
||||||
|
|
||||||
|
messagesList.append(html);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
console.log('response.si_enhancement is undefined or null');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.tpa) {
|
||||||
|
$.each(response.tpa, function(index, item) {
|
||||||
|
if (item.batch_export_count == 0 || item.batch_import_count == 0) {
|
||||||
|
|
||||||
|
|
||||||
|
var queryParams = {
|
||||||
|
client_id: item.client_id,
|
||||||
|
client_policy_id: item.client_policy_id,
|
||||||
|
client_branch_id: item.branch_id,
|
||||||
|
event: 'inception',
|
||||||
|
insurer_or_tpa: 'tpa',
|
||||||
|
actions: 'export',
|
||||||
|
};
|
||||||
|
|
||||||
|
const queryString = objectToQueryString(queryParams);
|
||||||
|
|
||||||
|
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
|
||||||
|
////console.log(url)
|
||||||
|
|
||||||
|
|
||||||
|
var toast_body_css = 'background : #bfd7eb !important;';
|
||||||
|
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
|
||||||
|
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
||||||
|
var toast_status_word = 'Info';
|
||||||
|
var title = 'TPA Pending';
|
||||||
|
|
||||||
|
if (!item.branch_name.toLowerCase().includes('branch')) {
|
||||||
|
|
||||||
|
//console.log(item.branch_name)
|
||||||
|
item.branch_name += ' branch';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
////console.log(item.branch_name);
|
||||||
|
|
||||||
|
// if (item.batch_export_count > 0) {
|
||||||
|
|
||||||
|
// title = 'TPA Import Pending';
|
||||||
|
// }
|
||||||
|
|
||||||
|
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
|
||||||
|
////console.log(toast_body_data);
|
||||||
|
|
||||||
|
var html = ` <li data-id="" data-url="${url}">
|
||||||
<div class="p-3">
|
<div class="p-3">
|
||||||
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
|
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
|
||||||
<div class="toast-header " style="${toast_head_css}" >
|
<div class="toast-header " style="${toast_head_css}" >
|
||||||
@ -519,227 +687,87 @@
|
|||||||
</li>`
|
</li>`
|
||||||
|
|
||||||
|
|
||||||
messagesList.append(html);
|
messagesList.append(html);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
response.si_enhancement.forEach(function(item, index) {
|
|
||||||
|
|
||||||
if (item.batch_export_count == 0 || item.batch_import_count == 0) {
|
|
||||||
|
|
||||||
|
|
||||||
var queryParams = {
|
|
||||||
client_id: item.client_id,
|
|
||||||
client_policy_id: item.client_policy_id,
|
|
||||||
client_branch_id: item.branch_id,
|
|
||||||
event: 'si_enhancement',
|
|
||||||
actions: 'export',
|
|
||||||
insurer_or_tpa: 'tpa',
|
|
||||||
};
|
|
||||||
|
|
||||||
const queryString = objectToQueryString(queryParams);
|
|
||||||
|
|
||||||
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
|
|
||||||
////console.log(url)
|
|
||||||
|
|
||||||
|
|
||||||
var toast_body_css = 'background : #bfd7eb !important;';
|
|
||||||
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
|
|
||||||
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
|
||||||
var toast_status_word = 'Info';
|
|
||||||
var title = 'SI Enhancement Pending';
|
|
||||||
|
|
||||||
|
|
||||||
if (!item.branch_name.toLowerCase().includes('branch')) {
|
|
||||||
|
|
||||||
//console.log(item.branch_name)
|
|
||||||
item.branch_name += ' branch';
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
console.log('response.tpa is undefined or null');
|
||||||
|
|
||||||
////console.log(item.branch_name);
|
}
|
||||||
|
|
||||||
// if (item.batch_export_count > 0) {
|
if (response.uhid) {
|
||||||
|
$.each(response.uhid, function(index, item) {
|
||||||
|
if (item.batch_export_count == 0 || item.batch_import_count == 0) {
|
||||||
|
|
||||||
// title = 'SI Enhancement Import Pending';
|
var queryParams = {
|
||||||
// }
|
|
||||||
|
|
||||||
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
|
client_id: item.client_id,
|
||||||
////console.log(toast_body_data);
|
client_policy_id: item.client_policy_id,
|
||||||
|
client_branch_id: item.branch_id,
|
||||||
|
event: 'inception',
|
||||||
|
insurer_or_tpa: 'insurer',
|
||||||
|
actions: 'export',
|
||||||
|
};
|
||||||
|
|
||||||
var html = ` <li data-id="" data-url="${url}">
|
const queryString = objectToQueryString(queryParams);
|
||||||
<div class="p-3">
|
|
||||||
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
|
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
|
||||||
<div class="toast-header " style="${toast_head_css}" >
|
//console.log(url)
|
||||||
<strong class="${toast_icon}"> ${toast_status_word}</strong>
|
|
||||||
<button type="button" class="ml-2 mb-1 close rm_msg" data-dismiss="toast" aria-label="Close">
|
var toast_body_css = 'background : #bfd7eb !important;';
|
||||||
<span aria-hidden="true">×</span>
|
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
|
||||||
</button>
|
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
||||||
</div>
|
var toast_status_word = 'Info';
|
||||||
<div class="toast-body" style="${toast_body_css}">
|
var title = 'Insurer Pending';
|
||||||
<strong>${title}</strong><br><br>
|
|
||||||
<small style="position: relative;bottom: 8px;">${toast_body_data}</small>
|
|
||||||
<div class="toast-footer">
|
if (!item.branch_name.toLowerCase().includes('branch')) {
|
||||||
<a href="#" class="redirect_page" data-toggle="tooltip" data-placement="bottom" title="Click Go to the Page"><small style="margin-right: 142px;position: relative;top: 2px;">see more</small></a>
|
|
||||||
<small style="position: relative;top: 2px;left: 5px;font-size: 10px;"></small>
|
//console.log(item.branch_name)
|
||||||
|
item.branch_name += ' branch';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
////console.log(item.branch_name);
|
||||||
|
|
||||||
|
// if (item.batch_export_count > 0) {
|
||||||
|
|
||||||
|
// title = 'Insurer Import Pending';
|
||||||
|
// }
|
||||||
|
|
||||||
|
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
|
||||||
|
////console.log(toast_body_data);
|
||||||
|
|
||||||
|
var html = ` <li data-id="" data-url="${url}">
|
||||||
|
<div class="p-3">
|
||||||
|
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
|
||||||
|
<div class="toast-header " style="${toast_head_css}" >
|
||||||
|
<strong class="${toast_icon}"> ${toast_status_word}</strong>
|
||||||
|
<button type="button" class="ml-2 mb-1 close rm_msg" data-dismiss="toast" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="toast-body" style="${toast_body_css}">
|
||||||
|
<strong>${title}</strong><br><br>
|
||||||
|
<small style="position: relative;bottom: 8px;">${toast_body_data}</small>
|
||||||
|
<div class="toast-footer">
|
||||||
|
<a href="#" class="redirect_page" data-toggle="tooltip" data-placement="bottom" title="Click Go to the Page"><small style="margin-right: 142px;position: relative;top: 2px;">see more</small></a>
|
||||||
|
<small style="position: relative;top: 2px;left: 5px;font-size: 10px;"></small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</li>`
|
||||||
</div>
|
|
||||||
</li>`
|
|
||||||
|
|
||||||
|
|
||||||
messagesList.append(html);
|
messagesList.append(html);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
response.tpa.forEach(function(item, index) {
|
|
||||||
|
|
||||||
if (item.batch_export_count == 0 || item.batch_import_count == 0) {
|
|
||||||
|
|
||||||
|
|
||||||
var queryParams = {
|
|
||||||
client_id: item.client_id,
|
|
||||||
client_policy_id: item.client_policy_id,
|
|
||||||
client_branch_id: item.branch_id,
|
|
||||||
event: 'inception',
|
|
||||||
insurer_or_tpa: 'tpa',
|
|
||||||
actions: 'export',
|
|
||||||
};
|
|
||||||
|
|
||||||
const queryString = objectToQueryString(queryParams);
|
|
||||||
|
|
||||||
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
|
|
||||||
////console.log(url)
|
|
||||||
|
|
||||||
|
|
||||||
var toast_body_css = 'background : #bfd7eb !important;';
|
|
||||||
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
|
|
||||||
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
|
||||||
var toast_status_word = 'Info';
|
|
||||||
var title = 'TPA Pending';
|
|
||||||
|
|
||||||
if (!item.branch_name.toLowerCase().includes('branch')) {
|
|
||||||
|
|
||||||
//console.log(item.branch_name)
|
|
||||||
item.branch_name += ' branch';
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
////console.log(item.branch_name);
|
}else{
|
||||||
|
console.log('response.uhid is undefined or null');
|
||||||
// if (item.batch_export_count > 0) {
|
}
|
||||||
|
|
||||||
// title = 'TPA Import Pending';
|
|
||||||
// }
|
|
||||||
|
|
||||||
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
|
|
||||||
////console.log(toast_body_data);
|
|
||||||
|
|
||||||
var html = ` <li data-id="" data-url="${url}">
|
|
||||||
<div class="p-3">
|
|
||||||
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
|
|
||||||
<div class="toast-header " style="${toast_head_css}" >
|
|
||||||
<strong class="${toast_icon}"> ${toast_status_word}</strong>
|
|
||||||
<button type="button" class="ml-2 mb-1 close rm_msg" data-dismiss="toast" aria-label="Close">
|
|
||||||
<span aria-hidden="true">×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="toast-body" style="${toast_body_css}">
|
|
||||||
<strong>${title}</strong><br><br>
|
|
||||||
<small style="position: relative;bottom: 8px;">${toast_body_data}</small>
|
|
||||||
<div class="toast-footer">
|
|
||||||
<a href="#" class="redirect_page" data-toggle="tooltip" data-placement="bottom" title="Click Go to the Page"><small style="margin-right: 142px;position: relative;top: 2px;">see more</small></a>
|
|
||||||
<small style="position: relative;top: 2px;left: 5px;font-size: 10px;"></small>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>`
|
|
||||||
|
|
||||||
|
|
||||||
messagesList.append(html);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
response.uhid.forEach(function(item, index) {
|
|
||||||
|
|
||||||
if (item.batch_export_count == 0 || item.batch_import_count == 0) {
|
|
||||||
|
|
||||||
var queryParams = {
|
|
||||||
|
|
||||||
client_id: item.client_id,
|
|
||||||
client_policy_id: item.client_policy_id,
|
|
||||||
client_branch_id: item.branch_id,
|
|
||||||
event: 'inception',
|
|
||||||
insurer_or_tpa: 'insurer',
|
|
||||||
actions: 'export',
|
|
||||||
};
|
|
||||||
|
|
||||||
const queryString = objectToQueryString(queryParams);
|
|
||||||
|
|
||||||
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
|
|
||||||
////console.log(url)
|
|
||||||
|
|
||||||
var toast_body_css = 'background : #bfd7eb !important;';
|
|
||||||
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
|
|
||||||
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
|
||||||
var toast_status_word = 'Info';
|
|
||||||
var title = 'Insurer Pending';
|
|
||||||
|
|
||||||
|
|
||||||
if (!item.branch_name.toLowerCase().includes('branch')) {
|
|
||||||
|
|
||||||
//console.log(item.branch_name)
|
|
||||||
item.branch_name += ' branch';
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
////console.log(item.branch_name);
|
|
||||||
|
|
||||||
// if (item.batch_export_count > 0) {
|
|
||||||
|
|
||||||
// title = 'Insurer Import Pending';
|
|
||||||
// }
|
|
||||||
|
|
||||||
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
|
|
||||||
////console.log(toast_body_data);
|
|
||||||
|
|
||||||
var html = ` <li data-id="" data-url="${url}">
|
|
||||||
<div class="p-3">
|
|
||||||
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
|
|
||||||
<div class="toast-header " style="${toast_head_css}" >
|
|
||||||
<strong class="${toast_icon}"> ${toast_status_word}</strong>
|
|
||||||
<button type="button" class="ml-2 mb-1 close rm_msg" data-dismiss="toast" aria-label="Close">
|
|
||||||
<span aria-hidden="true">×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="toast-body" style="${toast_body_css}">
|
|
||||||
<strong>${title}</strong><br><br>
|
|
||||||
<small style="position: relative;bottom: 8px;">${toast_body_data}</small>
|
|
||||||
<div class="toast-footer">
|
|
||||||
<a href="#" class="redirect_page" data-toggle="tooltip" data-placement="bottom" title="Click Go to the Page"><small style="margin-right: 142px;position: relative;top: 2px;">see more</small></a>
|
|
||||||
<small style="position: relative;top: 2px;left: 5px;font-size: 10px;"></small>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>`
|
|
||||||
|
|
||||||
|
|
||||||
messagesList.append(html);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
localStorage.setItem('pendingActionCount', pendingActionCount)
|
localStorage.setItem('pendingActionCount', pendingActionCount)
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|||||||
@ -55,6 +55,8 @@
|
|||||||
<!-- select2 -->
|
<!-- select2 -->
|
||||||
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/css/select2.min.css" rel="stylesheet" type="text/css">
|
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/css/select2.min.css" rel="stylesheet" type="text/css">
|
||||||
|
|
||||||
|
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.3/dist/umd/popper.min.js"></script>
|
||||||
|
|
||||||
<link rel="manifest" href="../manifest.json">
|
<link rel="manifest" href="../manifest.json">
|
||||||
|
|
||||||
@ -69,6 +71,11 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.css" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick-theme.min.css" />
|
||||||
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js"></script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
|
|
||||||
@ -550,53 +557,61 @@
|
|||||||
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
|
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
|
||||||
<i class="fas fa-user-tie"></i>
|
<i class="fas fa-user-tie"></i>
|
||||||
<span class="badge badge-success badge-pill float-right">2</span>
|
<span class="badge badge-success badge-pill float-right">2</span>
|
||||||
<span> Members </span>
|
<span> Action on Policies </span>
|
||||||
</a>
|
</a>
|
||||||
<div class="collapse" id="sidebarDashboards">
|
<div class="collapse" id="sidebarDashboards">
|
||||||
<ul class="nav-second-level">
|
<ul class="nav-second-level">
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<a href="<?= base_url('/employee/upload') ?>">Upload</a>
|
<a href="<?= base_url('/employee/upload') ?>">View Inception</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="<?= base_url('/employee/list') ?>">List</a>
|
<a href="<?= base_url('/employee/list') ?>">View Members</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="<?= base_url('/employee/endorsement-list') ?>">Endorsement List</a>
|
<a href="<?= base_url('/employee/endorsement-list') ?>">View Endorsement</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="<?= base_url('/employee/enrollment-list') ?>">View Enrollment</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<?php if(get_role_id() == 1 || get_role_id() == 5) { ?>
|
||||||
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
|
|
||||||
<i class="ri-database-2-line"></i>
|
<li>
|
||||||
<span class="badge badge-success badge-pill float-right">2</span>
|
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
|
||||||
<span> Masters </span>
|
<i class="ri-database-2-line"></i>
|
||||||
</a>
|
<span class="badge badge-success badge-pill float-right">2</span>
|
||||||
<div class="collapse" id="sidebarDashboards">
|
<span> Masters </span>
|
||||||
<ul class="nav-second-level">
|
</a>
|
||||||
<li>
|
<div class="collapse" id="sidebarDashboards">
|
||||||
<a href="<?= base_url('/master/insurer/list') ?>">Insurer</a>
|
<ul class="nav-second-level">
|
||||||
</li>
|
<li>
|
||||||
<li>
|
<a href="<?= base_url('/master/insurer/list') ?>">Insurer</a>
|
||||||
<a href="<?= base_url('/master/tpa/list') ?>">TPA</a>
|
</li>
|
||||||
</li>
|
<li>
|
||||||
<li>
|
<a href="<?= base_url('/master/tpa/list') ?>">TPA</a>
|
||||||
<a href="<?= base_url('/master/kyc/list') ?>">KYC</a>
|
</li>
|
||||||
</li>
|
<li>
|
||||||
<li>
|
<a href="<?= base_url('/master/kyc/list') ?>">KYC</a>
|
||||||
<a href="<?= base_url('/master/policy/list') ?>">Policy</a>
|
</li>
|
||||||
</li>
|
<li>
|
||||||
<li>
|
<a href="<?= base_url('/master/policy/list') ?>">Policy</a>
|
||||||
<a href="<?= base_url('/master/cash_deposite/list') ?>">CD Master</a>
|
</li>
|
||||||
</li>
|
<li>
|
||||||
<li>
|
<a href="<?= base_url('/master/cash_deposite/list') ?>">CD Master</a>
|
||||||
<a href="<?= base_url('/user/list') ?>"> Users </a>
|
</li>
|
||||||
</li>
|
<li>
|
||||||
</ul>
|
<a href="<?= base_url('/user/list') ?>"> Users </a>
|
||||||
</div>
|
</li>
|
||||||
</li>
|
</ul>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<?php
|
<?php
|
||||||
$sessionData = get_session_userdata();
|
$sessionData = get_session_userdata();
|
||||||
|
|||||||
@ -872,7 +872,7 @@
|
|||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
}, 1000);
|
}, 1000);
|
||||||
$('#nameOfThePolicyInGMC').html(' - ' + response.policy_name.name);
|
// $('#nameOfThePolicyInGMC').html(' - ' + response.policy_name.name);
|
||||||
$('gmc_emp_count').val(response.count);
|
$('gmc_emp_count').val(response.count);
|
||||||
|
|
||||||
// //console.log('count--1', response.count);
|
// //console.log('count--1', response.count);
|
||||||
|
|||||||
@ -538,7 +538,7 @@
|
|||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
}, 1000);
|
}, 1000);
|
||||||
$('#nameOfThePolicyInGPA').html(' - ' + res.policy_name.name);
|
// $('#nameOfThePolicyInGPA').html(' - ' + res.policy_name.name);
|
||||||
|
|
||||||
|
|
||||||
$('#emp_count').val(res.count)
|
$('#emp_count').val(res.count)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -36,77 +36,91 @@ const excel_headers = {
|
|||||||
1: {
|
1: {
|
||||||
|
|
||||||
1: {
|
1: {
|
||||||
|
"unit": "Units",
|
||||||
"sum_insured": "Sum Insured",
|
"sum_insured": "Sum Insured",
|
||||||
},
|
},
|
||||||
2: {
|
2: {
|
||||||
|
"unit": "Units",
|
||||||
"basic_pay": "Basic Pay",
|
"basic_pay": "Basic Pay",
|
||||||
},
|
},
|
||||||
3: {
|
3: {
|
||||||
|
"unit": "Units",
|
||||||
"band_or_grade": "Band or Grade",
|
"band_or_grade": "Band or Grade",
|
||||||
"sum_insured": "Sum Insured",
|
"sum_insured": "Sum Insured",
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
2: {
|
2: {
|
||||||
|
"unit": "Units",
|
||||||
"sum_insured": "Sum Insured",
|
"sum_insured": "Sum Insured",
|
||||||
"premium": "Premium"
|
"premium": "Premium"
|
||||||
},
|
},
|
||||||
3: {
|
3: {
|
||||||
|
"unit": "Units",
|
||||||
"sum_insured": "Sum Insured",
|
"sum_insured": "Sum Insured",
|
||||||
"premium": "Premium"
|
"premium": "Premium"
|
||||||
},
|
},
|
||||||
4: {
|
4: {
|
||||||
|
"unit": "Units",
|
||||||
"sum_insured": "Sum Insured",
|
"sum_insured": "Sum Insured",
|
||||||
"from_age": "From Age",
|
"from_age": "From Age",
|
||||||
"to_age": "To Age",
|
"to_age": "To Age",
|
||||||
"premium": "Premium"
|
"premium": "Premium"
|
||||||
},
|
},
|
||||||
5: {
|
5: {
|
||||||
|
"unit": "Units",
|
||||||
"sum_insured": "Sum Insured",
|
"sum_insured": "Sum Insured",
|
||||||
"from_age": "From Age",
|
"from_age": "From Age",
|
||||||
"to_age": "To Age",
|
"to_age": "To Age",
|
||||||
"premium": "Premium"
|
"premium": "Premium"
|
||||||
},
|
},
|
||||||
6: {
|
6: {
|
||||||
|
"unit": "Units",
|
||||||
"sum_insured": "Sum Insured",
|
"sum_insured": "Sum Insured",
|
||||||
"from_age": "From Age",
|
"from_age": "From Age",
|
||||||
"to_age": "To Age",
|
"to_age": "To Age",
|
||||||
"premium": "Premium"
|
"premium": "Premium"
|
||||||
},
|
},
|
||||||
7: {
|
7: {
|
||||||
|
"unit": "Units",
|
||||||
"sum_insured": "Sum Insured",
|
"sum_insured": "Sum Insured",
|
||||||
"from_age": "From Age",
|
"from_age": "From Age",
|
||||||
"to_age": "To Age",
|
"to_age": "To Age",
|
||||||
"premium": "Premium"
|
"premium": "Premium"
|
||||||
},
|
},
|
||||||
8: {
|
8: {
|
||||||
|
"unit": "Units",
|
||||||
"sum_insured": "Sum Insured",
|
"sum_insured": "Sum Insured",
|
||||||
"grade": "Grade",
|
"grade": "Grade",
|
||||||
"premium": "Premium"
|
"premium": "Premium"
|
||||||
},
|
},
|
||||||
9: {
|
9: {
|
||||||
|
"unit": "Units",
|
||||||
"sum_insured": "Sum Insured",
|
"sum_insured": "Sum Insured",
|
||||||
"premium": "Premium"
|
"premium": "Premium"
|
||||||
},
|
},
|
||||||
10: {
|
10: {
|
||||||
|
"unit": "Units",
|
||||||
"sum_insured": "Sum Insured",
|
"sum_insured": "Sum Insured",
|
||||||
"from_age": "From Age",
|
"from_age": "From Age",
|
||||||
"to_age": "To Age",
|
"to_age": "To Age",
|
||||||
"premium": "Premium"
|
"premium": "Premium"
|
||||||
},
|
},
|
||||||
11: {
|
11: {
|
||||||
|
"unit": "Units",
|
||||||
"sum_insured": "Sum Insured",
|
"sum_insured": "Sum Insured",
|
||||||
"grade": "Grade",
|
"grade": "Grade",
|
||||||
"premium": "Premium",
|
"premium": "Premium",
|
||||||
"max_si": "Max Si"
|
"max_si": "Max Si"
|
||||||
},
|
},
|
||||||
12: {
|
12: {
|
||||||
|
"unit": "Units",
|
||||||
"sum_insured": "Sum Insured",
|
"sum_insured": "Sum Insured",
|
||||||
"relationship": "Relationship",
|
"relationship": "Relationship",
|
||||||
"premium": "Premium"
|
"premium": "Premium"
|
||||||
},
|
},
|
||||||
13: {
|
13: {
|
||||||
|
"unit": "Units",
|
||||||
"sum_insured": "Sum Insured",
|
"sum_insured": "Sum Insured",
|
||||||
"relationship": "Relationship",
|
"relationship": "Relationship",
|
||||||
"from_age": "From Age",
|
"from_age": "From Age",
|
||||||
@ -121,27 +135,34 @@ function slugify(text) {
|
|||||||
.replace(/^-+/, '').replace(/-+$/, '');
|
.replace(/^-+/, '').replace(/-+$/, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
function copyHeaders(rack_rate_type) {
|
function copyHeaders(unique_id) {
|
||||||
|
|
||||||
|
var client_units = localStorage.getItem('client_units');
|
||||||
|
client_units = JSON.parse(client_units);
|
||||||
|
|
||||||
let formatType = $('#grid').val();
|
let formatType = $('#grid').val();
|
||||||
var secondKey = $('#si_or_bp').val();
|
var secondKey = $('#si_or_bp').val();
|
||||||
var obj = $('#grid');
|
var obj = $('#grid');
|
||||||
|
|
||||||
if (rack_rate_type == 1) {
|
if (unique_id != 'na') {
|
||||||
formatType = $('#additional_grid').val();
|
formatType = $('#grid_'+unique_id).val();
|
||||||
obj = $('#additional_grid');
|
obj = $('#grid_'+unique_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//console.log(obj)
|
||||||
|
//console.log(formatType)
|
||||||
|
//console.log(unique_id)
|
||||||
|
|
||||||
if (formatType == 1) {
|
if (formatType == 1) {
|
||||||
if (secondKey == "") {
|
if (secondKey == "") {
|
||||||
toastr.warning('Please select the Basic Pay, Sum Insured or Band/Grade', 'Warning');
|
toastr.warning('Please select the Basic Pay, Sum Insured and Band/Grade', 'Warning');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// //console.log(obj)
|
//console.log(obj)
|
||||||
// //console.log(formatType)
|
//console.log(formatType)
|
||||||
// //console.log(rack_rate_type)
|
//console.log(unique_id)
|
||||||
|
|
||||||
if (!formatType && formatType == "") {
|
if (!formatType && formatType == "") {
|
||||||
toastr.warning('Please select the Policy Premium Type', 'Warning');
|
toastr.warning('Please select the Policy Premium Type', 'Warning');
|
||||||
@ -157,12 +178,21 @@ function copyHeaders(rack_rate_type) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var headerString = Object.values(excel_headers[formatType]).join(
|
if(client_units.length == 1){
|
||||||
"\t"); // Using specified format type for copying headers
|
delete excel_headers[formatType].unit;
|
||||||
if (formatType == 1) {
|
|
||||||
var headerString = Object.values(excel_headers[formatType][secondKey]).join(
|
|
||||||
"\t"); // Using specified format type for copying headers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var headerString = Object.values(excel_headers[formatType]).join("\t"); // Using specified format type for copying headers
|
||||||
|
if (formatType == 1) {
|
||||||
|
if(client_units.length = 1){
|
||||||
|
delete excel_headers[formatType][secondKey].unit;
|
||||||
|
}
|
||||||
|
var headerString = Object.values(excel_headers[formatType][secondKey]).join("\t"); // Using specified format type for copying headers
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('headerString', headerString);
|
||||||
|
|
||||||
|
|
||||||
//console.log('headerString', headerString);
|
//console.log('headerString', headerString);
|
||||||
navigator.clipboard.writeText(headerString).then(function() {
|
navigator.clipboard.writeText(headerString).then(function() {
|
||||||
toastr.success('Headers copied to clipboard', 'success');
|
toastr.success('Headers copied to clipboard', 'success');
|
||||||
@ -171,24 +201,26 @@ function copyHeaders(rack_rate_type) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateTable(rack_rate_type) {
|
function generateTable(unique_id) {
|
||||||
|
|
||||||
|
var client_units = localStorage.getItem('client_units');
|
||||||
|
client_units = JSON.parse(client_units);
|
||||||
|
|
||||||
var data = $('#copied_excel_data').val();
|
var data = $('#copied_excel_data').val();
|
||||||
let formatType = $('#grid').val();
|
let formatType = $('#grid').val();
|
||||||
var obj = $('#grid');
|
var obj = $('#grid');
|
||||||
var secondKey = $('#si_or_bp').val();
|
var secondKey = $('#si_or_bp').val();
|
||||||
|
|
||||||
|
if (unique_id != 'na') {
|
||||||
if (rack_rate_type == 1) {
|
data = $('#copied_excel_data_'+unique_id).val();
|
||||||
data = $('#additional_copied_excel_data').val();
|
formatType = $('#grid_'+unique_id).val();
|
||||||
formatType = $('#additional_grid').val();
|
obj = $('#grid_'+unique_id);
|
||||||
obj = $('#additional_grid');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//console.log(obj);
|
// console.log('generateTable obj', obj);
|
||||||
//console.log(formatType);
|
// console.log('generateTable formatType', formatType);
|
||||||
//console.log(data);
|
// console.log('generateTable data', data);
|
||||||
console.log(secondKey);
|
// console.log('generateTable secondKey', secondKey);
|
||||||
|
|
||||||
if (!formatType || formatType == "") {
|
if (!formatType || formatType == "") {
|
||||||
$('.excel_table_class').empty();
|
$('.excel_table_class').empty();
|
||||||
@ -249,32 +281,31 @@ function generateTable(rack_rate_type) {
|
|||||||
expectedHeader = Object.keys(excel_headers[formatType][secondKey]);
|
expectedHeader = Object.keys(excel_headers[formatType][secondKey]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//console.log('expectedHeader', expectedHeader);
|
// console.log('expectedHeader', expectedHeader);
|
||||||
//console.log('HEADERS' , JSON.stringify(header))
|
// console.log('HEADERS' , JSON.stringify(header))
|
||||||
//console.log('Excepted HEADERS' , JSON.stringify(expectedHeader))
|
// console.log('Excepted HEADERS' , JSON.stringify(expectedHeader))
|
||||||
|
|
||||||
|
|
||||||
if (secondKey != 2) {
|
if (secondKey != 2) {
|
||||||
|
|
||||||
if (JSON.stringify(header) !== JSON.stringify(expectedHeader)) {
|
if (JSON.stringify(header) !== JSON.stringify(expectedHeader)) {
|
||||||
const expectedHeaders = JSON.stringify(Object.values(excel_headers[formatType][secondKey]));
|
const expectedHeaders = JSON.stringify(Object.values(excel_headers[formatType][secondKey]));
|
||||||
const receivedHeaders = JSON.stringify(columnsToKeep.map(i => rows[0].split("\t")[i]));
|
const receivedHeaders = JSON.stringify(columnsToKeep.map(i => rows[0].split("\t")[i]));
|
||||||
|
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: "Header Mismatch",
|
title: "Header Mismatch",
|
||||||
html: `
|
html: `
|
||||||
<p>Header columns do not match expected format:</p>
|
<p>Header columns do not match expected format:</p>
|
||||||
<p><strong>Expected:</strong> ${expectedHeaders}</p>
|
<p><strong>Expected:</strong> ${expectedHeaders}</p>
|
||||||
<p><strong>Received:</strong> ${receivedHeaders}</p>
|
<p><strong>Received:</strong> ${receivedHeaders}</p>
|
||||||
`,
|
`,
|
||||||
icon: "error"
|
icon: "error"
|
||||||
});
|
});
|
||||||
$('.excel_table_class').empty();
|
$('.excel_table_class').empty();
|
||||||
$('.excel_textarea').val('');
|
$('.excel_textarea').val('');
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var table = $('<table class="table table-striped compact-table" />');
|
var table = $('<table class="table table-striped compact-table" />');
|
||||||
var uniqueRows = new Set();
|
var uniqueRows = new Set();
|
||||||
@ -299,62 +330,113 @@ function generateTable(rack_rate_type) {
|
|||||||
var si_or_bp = $('#si_or_bp').val();
|
var si_or_bp = $('#si_or_bp').val();
|
||||||
var key;
|
var key;
|
||||||
switch (formatType) {
|
switch (formatType) {
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
if (si_or_bp == 1) {
|
if (si_or_bp == 1) {
|
||||||
key = cells[0] // Sum Insured,
|
if (client_units.length == 1) {
|
||||||
|
key = cells[0]; //Sum Insured
|
||||||
|
}else{
|
||||||
|
key = cells[0] + "|" + cells[1]; //Units, Sum Insured
|
||||||
|
}
|
||||||
} else if (si_or_bp == 2) {
|
} else if (si_or_bp == 2) {
|
||||||
key = cells[0] //Basic Pay
|
if (client_units.length == 1) {
|
||||||
|
key = cells[0]; //Basic Pay
|
||||||
|
}else{
|
||||||
|
key = cells[0] + "|" + cells[1]; //Units, Basic Pay
|
||||||
|
}
|
||||||
} else if (si_or_bp == 3) {
|
} else if (si_or_bp == 3) {
|
||||||
key = cells[0] + "|" + cells[1] //Band or Grade, Sum Insured
|
if (client_units.length == 1) {
|
||||||
|
key = cells[0] + "|" + cells[1];//Band or Grade, Sum Insured
|
||||||
|
}else{
|
||||||
|
key = cells[0] + "|" + cells[1] + "|" + cells[2]; //Units, Band or Grade, Sum Insured
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
key = cells[0] + "|" + cells[1] // Sum Insured, Premium
|
if (client_units.length == 1) {
|
||||||
|
key = cells[0]+ "|" + cells[1]; // Sum Insured, Premium
|
||||||
|
} else {
|
||||||
|
key = cells[0] + "|" + cells[1] + "|" + cells[2]; // Units, Sum Insured, Premium
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
key = cells[0] + "|" + cells[1] // Sum Insured, Premium
|
if (client_units.length == 1) {
|
||||||
|
key = cells[0]+ "|" + cells[1]; // Sum Insured, Premium
|
||||||
|
} else {
|
||||||
|
key = cells[0] + "|" + cells[1]+ "|" + cells[2]; // Units, Sum Insured, Premium
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[
|
if (client_units.length == 1) {
|
||||||
3]; // Sum Insured, From Age, To Age, Premium
|
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, From Age, To Age, Premium
|
||||||
|
} else {
|
||||||
|
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3] + "|" + cells[4]; // Units, Sum Insured, From Age, To Age, Premium
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[
|
if (client_units.length == 1) {
|
||||||
3]; // Sum Insured, From Age, To Age, Premium
|
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, From Age, To Age, Premium
|
||||||
|
} else {
|
||||||
|
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3] + "|" + cells[4]; // Units Sum Insured, From Age, To Age, Premium
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[
|
if (client_units.length == 1) {
|
||||||
3]; // Sum Insured, From Age, To Age, Premium
|
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, From Age, To Age, Premium
|
||||||
|
} else {
|
||||||
|
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3] + "|" + cells[4]; //Units, Sum Insured, From Age, To Age, Premium
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[
|
if (client_units.length == 1) {
|
||||||
3]; // Sum Insured, From Age, To Age, Premium
|
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, From Age, To Age, Premium
|
||||||
|
} else {
|
||||||
|
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3] + "|" + cells[4]; // Units Sum Insured, From Age, To Age, Premium
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
key = cells[0] + "|" + cells[1] + "|" + cells[2]; // Sum Insured, Grade, Premium
|
if (client_units.length == 1) {
|
||||||
|
key = cells[0] + "|" + cells[1] + "|" + cells[2]; // Sum Insured, Grade, Premium
|
||||||
|
} else {
|
||||||
|
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Units, Sum Insured, Grade, Premium
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
key = cells[0] + "|" + cells[1]; // Sum Insured, Premium
|
if (client_units.length == 1) {
|
||||||
|
key = cells[0] + "|" + cells[2]; // Sum Insured, Premium
|
||||||
|
} else {
|
||||||
|
key = cells[0] + "|" + cells[1] + "|" + cells[2]; //Units, Sum Insured, Premium+ "|" + cells[5]
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[
|
if (client_units.length == 1) {
|
||||||
3]; // Sum Insured, From Age, To Age, Premium
|
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, From Age, To Age, Premium
|
||||||
|
} else {
|
||||||
|
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3] + "|" + cells[4]; //Units, Sum Insured, From Age, To Age, Premium
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[
|
if (client_units.length == 1) {
|
||||||
3]; // Sum Insured, Grade, Premium, Max SI
|
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, Grade, Premium, Max SI
|
||||||
|
} else {
|
||||||
|
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3] + "|" + cells[4]; // Units, Sum Insured, Grade, Premium, Max SI
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
key = cells[0] + "|" + cells[1] + "|" + cells[2]; // Sum Insured, Relationship, Premium
|
if (client_units.length == 1) {
|
||||||
|
key = cells[0] + "|" + cells[1] + "|" + cells[2]; // Sum Insured, Relationship, Premium
|
||||||
|
} else {
|
||||||
|
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; //Units Sum Insured, Relationship, Premium
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3] + "|" + cells[
|
if (client_units.length == 1) {
|
||||||
4]; // Sum Insured, Relationship, From Age, To Age, Premium
|
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3] + "|" + cells[4] ; // Sum Insured, Relationship, From Age, To Age, Premium
|
||||||
|
} else {
|
||||||
|
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3] + "|" + cells[4] + "|" + cells[5]; // Units, Sum Insured, Relationship, From Age, To Age, Premium
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
key = cells.join("|");
|
key = cells.join("|");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (y > 0 && uniqueRows.has(key)) {
|
if (y > 0 && uniqueRows.has(key)) {
|
||||||
@ -365,10 +447,11 @@ function generateTable(rack_rate_type) {
|
|||||||
table.append(row);
|
table.append(row);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (rack_rate_type == 1) {
|
|
||||||
$('#additional_excel_table').empty();
|
if (unique_id != 'na') {
|
||||||
$('#additional_excel_table').html(table);
|
$('#excel_table_'+unique_id).empty();
|
||||||
} else if (rack_rate_type == 0) {
|
$('#excel_table_'+unique_id).html(table);
|
||||||
|
}else{
|
||||||
$('#excel_table').empty();
|
$('#excel_table').empty();
|
||||||
$('#excel_table').html(table);
|
$('#excel_table').html(table);
|
||||||
}
|
}
|
||||||
@ -390,11 +473,12 @@ function generateTable(rack_rate_type) {
|
|||||||
$('.excel_table_class').empty();
|
$('.excel_table_class').empty();
|
||||||
$('.excel_textarea').val('');
|
$('.excel_textarea').val('');
|
||||||
}
|
}
|
||||||
submitData(rack_rate_type);
|
submitData(unique_id);
|
||||||
$('.excel_textarea').val('');
|
$('.excel_textarea').val('');
|
||||||
}
|
}
|
||||||
|
|
||||||
function submitData(rack_rate_type) {
|
function submitData(unique_id)
|
||||||
|
{
|
||||||
|
|
||||||
let formatType = $('#grid').val();
|
let formatType = $('#grid').val();
|
||||||
var table = $('#excel_table table');
|
var table = $('#excel_table table');
|
||||||
@ -409,11 +493,10 @@ function submitData(rack_rate_type) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (rack_rate_type == 1) {
|
if (unique_id != 'na') {
|
||||||
|
formatType = $('#grid_'+unique_id).val();
|
||||||
formatType = $('#additional_grid').val();
|
table = $('#excel_table_'+unique_id+' table');
|
||||||
table = $('#additional_excel_table table');
|
obj = $('#grid_'+unique_id);
|
||||||
obj = $('#additional_grid');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -493,18 +576,18 @@ function submitData(rack_rate_type) {
|
|||||||
console.log(jsonData);
|
console.log(jsonData);
|
||||||
console.log('formatType', formatType);
|
console.log('formatType', formatType);
|
||||||
|
|
||||||
if (rack_rate_type == 1) {
|
if (unique_id != 'na') {
|
||||||
|
|
||||||
$('#additional_grid_content_input').empty()
|
$('#grid_content_input_'+unique_id).empty()
|
||||||
|
|
||||||
if ($('#copyfromexcelforadditional').text() == "Manual entry") {
|
if ($('#copyfromexcel_'+unique_id).text() == "Manual entry") {
|
||||||
$('#copyfromexcelforadditional').text("Copy from excel")
|
$('#copyfromexcel_'+unique_id).text("Copy from excel")
|
||||||
} else {
|
} else {
|
||||||
$('#copyfromexcelforadditional').text("Copy from excel");
|
$('#copyfromexcel_'+unique_id).text("Copy from excel");
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#additional_grid_content_input').toggle();
|
$('#grid_content_input_'+unique_id).toggle();
|
||||||
$('#additional_grid_content_from_excel').toggle();
|
$('#grid_content_from_excel_'+unique_id).toggle();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -521,17 +604,20 @@ function submitData(rack_rate_type) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(unique_id == 'na'){
|
||||||
|
unique_id = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (formatType == 1 || formatType == 2 || formatType == 4 || formatType == 6) {
|
if (formatType == 1 || formatType == 2 || formatType == 4 || formatType == 6) {
|
||||||
var FirstIndex = jsonData[0]
|
var FirstIndex = jsonData[0]
|
||||||
addGridHTML(false, FirstIndex, formatType, si_or_bp, 0)
|
addGridHTML(false, FirstIndex, formatType, si_or_bp, unique_id)
|
||||||
jsonData.shift();
|
jsonData.shift();
|
||||||
}
|
}
|
||||||
|
|
||||||
$.each(jsonData, function(index, item) {
|
$.each(jsonData, function(index, item) {
|
||||||
appendGridtHtml(formatType, rack_rate_type, item)
|
appendGridtHtml(formatType, unique_id, item)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$('input[name="11_max_si[]"]').each(function() {
|
$('input[name="11_max_si[]"]').each(function() {
|
||||||
$(this).trigger('keyup');
|
$(this).trigger('keyup');
|
||||||
});
|
});
|
||||||
|
|||||||
@ -14,6 +14,12 @@
|
|||||||
<input type="text" class="form-control" id="policy_type"
|
<input type="text" class="form-control" id="policy_type"
|
||||||
placeholder="Enter Policy Type Name" value="<?= isset($policytype['policy_type']) ? $policytype['policy_type'] : '' ?>" name="policy_type" required>
|
placeholder="Enter Policy Type Name" value="<?= isset($policytype['policy_type']) ? $policytype['policy_type'] : '' ?>" name="policy_type" required>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group col-md-4">
|
||||||
|
<label for="kyc_name">Policy Type Long Name<span
|
||||||
|
class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" id="long_name"
|
||||||
|
placeholder="Enter Policy Type Long Name" value="<?= isset($policytype['long_name']) ? $policytype['long_name'] : '' ?>" name="long_name" required>
|
||||||
|
</div>
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="bap">BAP<span
|
<label for="bap">BAP<span
|
||||||
class="text-danger">*</span></label>
|
class="text-danger">*</span></label>
|
||||||
|
|||||||
@ -15,6 +15,7 @@
|
|||||||
<thead class="bg-light">
|
<thead class="bg-light">
|
||||||
<tr>
|
<tr>
|
||||||
<th class="font-weight-medium">Policy Type</th>
|
<th class="font-weight-medium">Policy Type</th>
|
||||||
|
<th class="font-weight-medium">Policy Long Name</th>
|
||||||
<th class="font-weight-medium">BAP</th>
|
<th class="font-weight-medium">BAP</th>
|
||||||
<th class="font-weight-medium">Category</th>
|
<th class="font-weight-medium">Category</th>
|
||||||
<th class="font-weight-medium">BAP Category</th>
|
<th class="font-weight-medium">BAP Category</th>
|
||||||
@ -26,6 +27,7 @@
|
|||||||
<?php if(is_array($policyList)) {foreach($policyList as $row){ ?>
|
<?php if(is_array($policyList)) {foreach($policyList as $row){ ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo $row['policy_type']; ?> </td>
|
<td><?php echo $row['policy_type']; ?> </td>
|
||||||
|
<td><?php echo $row['long_name']; ?> </td>
|
||||||
<td><?php echo $row['bap']; ?></td>
|
<td><?php echo $row['bap']; ?></td>
|
||||||
<td><?php echo $row['allocg']; ?></td>
|
<td><?php echo $row['allocg']; ?></td>
|
||||||
<td><?php echo $row['alloci']; ?></td>
|
<td><?php echo $row['alloci']; ?></td>
|
||||||
|
|||||||
@ -50,12 +50,12 @@ body {
|
|||||||
<span class="d-none d-sm-inline-block">General</span>
|
<span class="d-none d-sm-inline-block">General</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<!-- <li class="nav-item">
|
||||||
<a href="#branch-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="policy_id_type">
|
<a href="#branch-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="policy_id_type">
|
||||||
<span class="mr-1"><i class="mdi mdi-source-branch"></i></span>
|
<span class="mr-1"><i class="mdi mdi-source-branch"></i></span>
|
||||||
<span class="d-none d-sm-inline-block">Policies</span>
|
<span class="d-none d-sm-inline-block">Policies</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li> -->
|
||||||
</ul>
|
</ul>
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<?php include('policy_type_basic_info.php'); ?>
|
<?php include('policy_type_basic_info.php'); ?>
|
||||||
|
|||||||
695
app/Views/rack_rate_test.php
Normal file
695
app/Views/rack_rate_test.php
Normal file
@ -0,0 +1,695 @@
|
|||||||
|
<style>
|
||||||
|
.table th,
|
||||||
|
.table td {
|
||||||
|
padding: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.dataTable tbody td {
|
||||||
|
padding: 4px 4px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn .btn-secondary .buttons-csv .buttons-html5 .my_class {
|
||||||
|
position: relative;
|
||||||
|
left: 79px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Add styles for the table and its elements as needed */
|
||||||
|
.disabled {
|
||||||
|
background-color: #ddd; /* Set desired gray color for disabled rows */
|
||||||
|
}
|
||||||
|
|
||||||
|
.small-width {
|
||||||
|
width: 5%;
|
||||||
|
}
|
||||||
|
.medium-width {
|
||||||
|
width: 10%;
|
||||||
|
}
|
||||||
|
.large-width {
|
||||||
|
width: 15%;
|
||||||
|
}
|
||||||
|
.extra-large-width {
|
||||||
|
width: 20%;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xl-12">
|
||||||
|
<div id="accordion" class="mb-3">
|
||||||
|
<div class="card mb-1">
|
||||||
|
<h5 class="m-1">
|
||||||
|
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne" aria-expanded="true">
|
||||||
|
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
||||||
|
</a>
|
||||||
|
</h5>
|
||||||
|
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
|
||||||
|
<div class="card-body">
|
||||||
|
<!-- <div class="text-center"> -->
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="form-group col-md-4">
|
||||||
|
<label>Client</label> <br />
|
||||||
|
<select class="form-control" id="clients">
|
||||||
|
<option value="0">Select</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group col-md-4">
|
||||||
|
<label>Branch</label> <br />
|
||||||
|
<select name="branch_id" class="form-control" id="branch_id">
|
||||||
|
<option value="0">Select</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-4">
|
||||||
|
<label>Policy</label> <br />
|
||||||
|
<select class="form-control" id="policies">
|
||||||
|
<option value="0">Select</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<!-- <div class="col-6" style="text-align: right;">
|
||||||
|
<a href="<?= base_url("employee/endorsement-list"); ?>" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="fetchEmpolyeeList(event);">Submit</a>
|
||||||
|
</div> -->
|
||||||
|
<div class="col-12" style="text-align: right;">
|
||||||
|
<a href="<?= base_url("employee/endorsement-list"); ?>" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="calculatePremium(event);" >calc</a>
|
||||||
|
<a href="#" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="addRowToTable();">+</a>
|
||||||
|
</div>
|
||||||
|
<!-- <button onclick="addRowToTable()">Add Row</button> -->
|
||||||
|
</div>
|
||||||
|
<!-- </div> -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row" id="client_list">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="row" style="padding-bottom: 10px;">
|
||||||
|
<!-- <div class="col-6" style="align-self: center;">
|
||||||
|
<h4 style="position: relative;">Endorsement List</h4>
|
||||||
|
</div> -->
|
||||||
|
<div id="suggestion-box" style="display: none; position: absolute; background-color: #fff; border: 1px solid #ccc; padding: 5px; z-index: 100;">
|
||||||
|
Suggestions, pick any one
|
||||||
|
<ul id="suggestions"></ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<table class="table table-hover m-0 table-centered dt-responsive w-100" cellspacing="0" id="emptable">
|
||||||
|
<thead class="bg-light">
|
||||||
|
<tr>
|
||||||
|
<th class="small-width">SNO</th>
|
||||||
|
<th class="small-width">Emp code</th>
|
||||||
|
<th class="large-width">Name</th>
|
||||||
|
<th class="large-width">DOB</th>
|
||||||
|
<th class="small-width">Gender</th>
|
||||||
|
<th class="medium-width">Relation</th>
|
||||||
|
<th class="large-width">SI</th>
|
||||||
|
<th class="medium-width">DOC</th>
|
||||||
|
<th class="medium-width">Basic pay</th>
|
||||||
|
<th class="small-width">Band</th>
|
||||||
|
<th class="small-width">Unit</th>
|
||||||
|
<th class="small-width">Delete</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody id='emptablebody'>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div><!-- end col -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="modal fade" id="centermodal" tabindex="-1" role="dialog" aria-hidden="true" >
|
||||||
|
<div class="modal-dialog modal-dialog-centered" style="max-width:80%;">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title" id="myCenterModalLabel">Center modal</h4>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<h5>Overflowing text to show scroll behavior</h5>
|
||||||
|
<p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p>
|
||||||
|
<p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p>
|
||||||
|
</div>
|
||||||
|
</div><!-- /.modal-content -->
|
||||||
|
</div><!-- /.modal-dialog -->
|
||||||
|
</div><!-- /.modal -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
// Initialize select2
|
||||||
|
$("#clients").select2();
|
||||||
|
$("#policies").select2();
|
||||||
|
$("#branch_id").select2();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Declare a global variable to store API response data
|
||||||
|
var clientPolicies = [];
|
||||||
|
var clientPoliciesWithBranch = {
|
||||||
|
policies: []
|
||||||
|
};
|
||||||
|
var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>';
|
||||||
|
var client_branch_id = '<?= isset($getData) ? $getData['branch_id'] : '0' ?>';
|
||||||
|
|
||||||
|
$(window).on("load", function() {
|
||||||
|
console.log("window loaded");
|
||||||
|
// $('#centermodal').modal('show');
|
||||||
|
fetchClientPolicies();
|
||||||
|
|
||||||
|
addRowToTable(['Ram Kumar','01-Apr-1990','M','Self','500000','',450000,'A','unit1']);
|
||||||
|
addRowToTable(['Sita','01-Apr-1993','F','Spouse','500000','','','A','unit1']);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function fetchClientPolicies() {
|
||||||
|
|
||||||
|
$('#loader').show();
|
||||||
|
var apiURL = '<?php echo base_url(); ?>' + 'util/clients-with-policies';
|
||||||
|
console.log('fetchClientPolicies');
|
||||||
|
// console.log(apiURL);
|
||||||
|
$.ajax({
|
||||||
|
url: apiURL,
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"X-Requested-With": "XMLHttpRequest"
|
||||||
|
},
|
||||||
|
success: function(response) {
|
||||||
|
// console.log(response.code);
|
||||||
|
// console.log(response.dataStatus);
|
||||||
|
// console.log(response.data);
|
||||||
|
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||||
|
try {
|
||||||
|
clientPolicies = (response.data);
|
||||||
|
|
||||||
|
|
||||||
|
response.data.forEach(policy => {
|
||||||
|
// console.log('policies', policy.policies);
|
||||||
|
policy.policies.forEach(p => {
|
||||||
|
clientPoliciesWithBranch.policies.push(p);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// console.log(clientPolicies);
|
||||||
|
appendClients(clientPolicies);
|
||||||
|
|
||||||
|
setTimeout(function() {
|
||||||
|
if (client_id) {
|
||||||
|
var foundPolicies = clientPolicies.find(function(item) {
|
||||||
|
// console.log(typeof item.id)
|
||||||
|
return item.id == client_id;
|
||||||
|
});
|
||||||
|
appendBranch(foundPolicies.branchs);
|
||||||
|
}
|
||||||
|
}, 500);
|
||||||
|
|
||||||
|
setTimeout(function() {
|
||||||
|
if (client_branch_id) {
|
||||||
|
|
||||||
|
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
|
||||||
|
// console.log('item', item);
|
||||||
|
return item.branch_id === client_branch_id;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (foundPolicies) {
|
||||||
|
// console.log('foundPolicies', foundPolicies);
|
||||||
|
appendPolicies(foundPolicies);
|
||||||
|
} else {
|
||||||
|
console.log('No policies found for the selected client');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 500);
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error parsing API response data:', error);
|
||||||
|
}
|
||||||
|
} else if (response.code === 404 && response.dataStatus === false) {
|
||||||
|
console.error('no data found', response);
|
||||||
|
} else {
|
||||||
|
console.error('Something went wrong!');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
console.error('Error fetching data from API:', error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#loader').hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function appendClients(data) {
|
||||||
|
|
||||||
|
var clientID = <?= isset($getData) ? $getData['client_id'] : '0' ?>;
|
||||||
|
$.each(data, function(index, item) {
|
||||||
|
var option = $('<option>', {
|
||||||
|
value: item.id,
|
||||||
|
text: item.client_name
|
||||||
|
});
|
||||||
|
if (clientID == item.id) {
|
||||||
|
option.attr('selected', true);
|
||||||
|
}
|
||||||
|
$('#clients').append(option);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function appendBranch(data) {
|
||||||
|
|
||||||
|
$('#branch_id').empty();
|
||||||
|
$('#branch_id').append($('<option>', {
|
||||||
|
value: '0',
|
||||||
|
text: 'Select'
|
||||||
|
}));
|
||||||
|
$.each(data, function(index, item) {
|
||||||
|
var option = $('<option>', {
|
||||||
|
value: item.id,
|
||||||
|
text: item.branch_name
|
||||||
|
});
|
||||||
|
if (client_branch_id == item.id) {
|
||||||
|
option.attr('selected', true);
|
||||||
|
}
|
||||||
|
$('#branch_id').append(option);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function appendPolicies(data) {
|
||||||
|
|
||||||
|
$('#policies').empty();
|
||||||
|
$('#policies').append($('<option>', {
|
||||||
|
value: '0',
|
||||||
|
text: 'Select'
|
||||||
|
}));
|
||||||
|
|
||||||
|
var PolicyID = <?= isset($getData) ? $getData['policy_id'] : '0' ?>;
|
||||||
|
// console.log(PolicyID)
|
||||||
|
$.each(data, function(index, item) {
|
||||||
|
var option = $('<option>', {
|
||||||
|
value: item.client_policy_id,
|
||||||
|
text: `${item.name ?? ''} - ${item.policy_no ?? ''} - ${item.policy_type ?? ''}`
|
||||||
|
});
|
||||||
|
if (PolicyID == item.client_policy_id) {
|
||||||
|
option.attr('selected', true);
|
||||||
|
}
|
||||||
|
$('#policies').append(option);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
$('#clients').on('change', function() {
|
||||||
|
|
||||||
|
$('#policies').empty();
|
||||||
|
$('#policies').append($('<option>', {
|
||||||
|
value: '0',
|
||||||
|
text: 'Select'
|
||||||
|
}));
|
||||||
|
|
||||||
|
var selectedClient = $(this).val();
|
||||||
|
// console.log(selectedClient);
|
||||||
|
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
|
||||||
|
|
||||||
|
// Check if the selected option exists in apiData
|
||||||
|
var foundPolicies = clientPolicies.find(function(item) {
|
||||||
|
return item.id === selectedClient;
|
||||||
|
});
|
||||||
|
// console.log(foundPolicies.branchs);
|
||||||
|
appendBranch(foundPolicies.branchs);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
$('#branch_id').on('change', function() {
|
||||||
|
|
||||||
|
var selectedClient = $(this).val();
|
||||||
|
|
||||||
|
// console.log('selectedBranch', selectedClient);
|
||||||
|
// console.log('clientPolicies', clientPoliciesWithBranch);
|
||||||
|
|
||||||
|
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
|
||||||
|
// console.log('item', item);
|
||||||
|
return item.branch_id === selectedClient;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
if (Array.isArray(foundPolicies) && foundPolicies.length === 0) {
|
||||||
|
|
||||||
|
appendPolicies(foundPolicies);
|
||||||
|
toastr.warning('No policies found for the selected client branch.');
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// console.log('foundPolicies', foundPolicies);
|
||||||
|
appendPolicies(foundPolicies);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// Function to convert object to query parameters
|
||||||
|
function objectToQueryString(obj) {
|
||||||
|
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||||
|
}
|
||||||
|
|
||||||
|
function calculatePremium() {
|
||||||
|
event.preventDefault(); // Prevent default action
|
||||||
|
let table = document.getElementById('emptable');
|
||||||
|
let tabledata = getTableDataAsJson(table);
|
||||||
|
// return;
|
||||||
|
var client_id = $('#clients').val();
|
||||||
|
var policy_id = $('#policies').val();
|
||||||
|
var branch_id = $('#branch_id').val();
|
||||||
|
// console.log(client_id + '-' + policy_id);
|
||||||
|
// if (client_id == '0' || policy_id == '0') {
|
||||||
|
// alert('Please select values in both dropdowns.');
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
var queryParams = {
|
||||||
|
client_id: client_id,
|
||||||
|
policy_id: policy_id,
|
||||||
|
branch_id: branch_id,
|
||||||
|
data: tabledata,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// $('#loader').show();
|
||||||
|
var apiURL = '<?php echo base_url(); ?>' + 'employee/test-rack-rate';
|
||||||
|
console.log('calculatePremium');
|
||||||
|
// console.log(apiURL);
|
||||||
|
$.ajax({
|
||||||
|
url: apiURL,
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"X-Requested-With": "XMLHttpRequest"
|
||||||
|
},
|
||||||
|
data: JSON.stringify(queryParams),
|
||||||
|
success: function(response) {
|
||||||
|
console.log(response);
|
||||||
|
|
||||||
|
var myModal = new bootstrap.Modal(document.getElementById('centermodal'), { keyboard: true });
|
||||||
|
|
||||||
|
// Show the modal
|
||||||
|
myModal.show();
|
||||||
|
// return;
|
||||||
|
// console.log(response.dataStatus);
|
||||||
|
// console.log(response.data);
|
||||||
|
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||||
|
// $("#centermodal").modal('show');
|
||||||
|
console.log('success');
|
||||||
|
} else if (response.code === 404 && response.dataStatus === false) {
|
||||||
|
console.error('no data found', response);
|
||||||
|
} else {
|
||||||
|
console.error('Something went wrong!');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
console.error('Error fetching data from API:', error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// $('#loader').hide();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
document.getElementById('toggleIcon').addEventListener('click', function() {
|
||||||
|
var icon = document.getElementById('icon');
|
||||||
|
icon.classList.toggle('mdi-chevron-down');
|
||||||
|
icon.classList.toggle('mdi-chevron-up');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function formatNumberToIndianLocale(value, field_name, action) {
|
||||||
|
|
||||||
|
// Check if the value is a valid number (either as a number or as a string)
|
||||||
|
if (!isNaN(value) && !isNaN(parseFloat(value)) && field_name != 'No of Days') {
|
||||||
|
|
||||||
|
// Convert the value to a number and format it using Indian English locale
|
||||||
|
var return_val = parseFloat(value).toLocaleString('en-IN');
|
||||||
|
|
||||||
|
if (field_name == 'Period of non coverage') {
|
||||||
|
|
||||||
|
return value + ' days';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (field_name == 'Total Amount') {
|
||||||
|
|
||||||
|
return '₹ ' + return_val + ' ( To be Refunded )';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (field_name == 'Total') {
|
||||||
|
|
||||||
|
if (action == 'd') {
|
||||||
|
|
||||||
|
return '₹ ' + return_val + ' ( To be Refunded )';
|
||||||
|
|
||||||
|
} else if (action == 'si') {
|
||||||
|
|
||||||
|
return '₹ ' + return_val + ' ( To be paid )';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return '₹ ' + return_val;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Return the original value if it's not a valid number
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$('.close').click(function() {
|
||||||
|
|
||||||
|
$('#table_data').empty();
|
||||||
|
})
|
||||||
|
|
||||||
|
const suggestionBox = document.getElementById("suggestion-box");
|
||||||
|
const suggestionsList = document.getElementById("suggestions");
|
||||||
|
|
||||||
|
function addRowToTable(default_data = false) {
|
||||||
|
console.log(default_data);
|
||||||
|
const tableBody = document.getElementById("emptablebody");
|
||||||
|
const existingRowCount = tableBody.rows.length;
|
||||||
|
|
||||||
|
const newRow = document.createElement("tr");
|
||||||
|
|
||||||
|
let newCell;
|
||||||
|
|
||||||
|
// SNO with auto-increment
|
||||||
|
newCell = document.createElement("td");
|
||||||
|
newCell.textContent = existingRowCount + 1;
|
||||||
|
newCell.contentEditable = "true"; // Make the cell editable (if needed)
|
||||||
|
newCell.style.border = "1px solid";
|
||||||
|
newRow.appendChild(newCell);
|
||||||
|
|
||||||
|
// Emp code (assuming you want an input field)
|
||||||
|
newCell = document.createElement("td");
|
||||||
|
newCell.innerHTML = 'FAM001';
|
||||||
|
newCell.contentEditable = "true"; // Make the cell editable (if needed)
|
||||||
|
newCell.style.border = "1px solid";
|
||||||
|
newRow.appendChild(newCell);
|
||||||
|
|
||||||
|
// Name (assuming you want an input field)
|
||||||
|
newCell = document.createElement("td");
|
||||||
|
newCell.innerHTML = (default_data != false ? default_data[0] : '');
|
||||||
|
newCell.contentEditable = "true"; // Make the cell editable (if needed)
|
||||||
|
newCell.style.border = "1px solid";
|
||||||
|
newRow.appendChild(newCell);
|
||||||
|
|
||||||
|
// **HERE'S WHERE YOU ADD CELLS FOR OTHER COLUMNS**
|
||||||
|
|
||||||
|
// DOB (assuming you want a date input field)
|
||||||
|
newCell = document.createElement("td");
|
||||||
|
// newCell.innerHTML = '<input type="date" class="form-control">'; // Adjust for your needs
|
||||||
|
newCell.innerHTML = (default_data != false ? default_data[1] : ''); // Adjust for your needs
|
||||||
|
newCell.contentEditable = "true"; // Make the cell editable (if needed)
|
||||||
|
newCell.style.border = "1px solid";
|
||||||
|
newRow.appendChild(newCell);
|
||||||
|
|
||||||
|
// Gender (assuming you want a date input field)
|
||||||
|
newCell = document.createElement("td");
|
||||||
|
newCell.innerHTML = (default_data != false ? default_data[2] : ''); // Adjust for your needs
|
||||||
|
newCell.contentEditable = "true"; // Make the cell editable (if needed)
|
||||||
|
newCell.style.border = "1px solid";
|
||||||
|
// newCell.addEventListener("input", handleInput);
|
||||||
|
newRow.appendChild(newCell);
|
||||||
|
|
||||||
|
// relationship (assuming you want a date input field)
|
||||||
|
newCell = document.createElement("td");
|
||||||
|
newCell.innerHTML = (default_data != false ? default_data[3] : ''); // Adjust for your needs
|
||||||
|
newCell.contentEditable = "true"; // Make the cell editable (if needed)
|
||||||
|
newCell.style.border = "1px solid";
|
||||||
|
newCell.addEventListener("input", handleInput);
|
||||||
|
newRow.appendChild(newCell);
|
||||||
|
|
||||||
|
// SI (assuming you want a date input field)
|
||||||
|
newCell = document.createElement("td");
|
||||||
|
newCell.innerHTML = (default_data != false ? default_data[4] : ''); // Adjust for your needs
|
||||||
|
newCell.contentEditable = "true"; // Make the cell editable (if needed)
|
||||||
|
newCell.style.border = "1px solid";
|
||||||
|
newRow.appendChild(newCell);
|
||||||
|
|
||||||
|
// DOC (assuming you want a date input field)
|
||||||
|
newCell = document.createElement("td");
|
||||||
|
newCell.innerHTML = (default_data != false ? default_data[5] : ''); // Adjust for your needs
|
||||||
|
newCell.contentEditable = "true"; // Make the cell editable (if needed)
|
||||||
|
newCell.style.border = "1px solid";
|
||||||
|
newRow.appendChild(newCell);
|
||||||
|
|
||||||
|
// BP (assuming you want a date input field)
|
||||||
|
newCell = document.createElement("td");
|
||||||
|
newCell.innerHTML = (default_data != false ? default_data[6] : '');
|
||||||
|
// Adjust for your needs
|
||||||
|
newCell.contentEditable = "true"; // Make the cell editable (if needed)
|
||||||
|
newCell.style.border = "1px solid";
|
||||||
|
newRow.appendChild(newCell);
|
||||||
|
// band (assuming you want a date input field)
|
||||||
|
newCell = document.createElement("td");
|
||||||
|
newCell.innerHTML = (default_data != false ? default_data[7] : ''); // Adjust for your needs
|
||||||
|
newCell.contentEditable = "true"; // Make the cell editable (if needed)
|
||||||
|
newCell.style.border = "1px solid";
|
||||||
|
newRow.appendChild(newCell);
|
||||||
|
// unit (assuming you want a date input field)
|
||||||
|
newCell = document.createElement("td");
|
||||||
|
newCell.innerHTML = (default_data != false ? default_data[8] : ''); // Adjust for your needs
|
||||||
|
newCell.contentEditable = "true"; // Make the cell editable (if needed)
|
||||||
|
newCell.style.border = "1px solid";
|
||||||
|
newRow.appendChild(newCell);
|
||||||
|
|
||||||
|
// ... Add remaining cells and content
|
||||||
|
|
||||||
|
// Create a checkbox for disabled
|
||||||
|
newCell = document.createElement("td");
|
||||||
|
|
||||||
|
newCell.style.border = "1px solid";
|
||||||
|
newCell.innerHTML = '<i class="material-icons" onclick="deleteRow(event)"></i>';
|
||||||
|
const checkBox = document.createElement("input");
|
||||||
|
checkBox.type = "checkbox";
|
||||||
|
checkBox.addEventListener("change", function() {
|
||||||
|
newRow.classList.toggle("disabled");
|
||||||
|
});
|
||||||
|
newCell.appendChild(checkBox);
|
||||||
|
newRow.appendChild(newCell);
|
||||||
|
tableBody.appendChild(newRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteRow(button) {
|
||||||
|
// console.log(button.target.parentElement.parentElement);
|
||||||
|
// console.log(button.parentNode.parentNode);
|
||||||
|
const tableBody = document.getElementById("emptablebody");
|
||||||
|
const rowToDelete = button.target.parentElement.parentElement;
|
||||||
|
tableBody.removeChild(rowToDelete);
|
||||||
|
}
|
||||||
|
|
||||||
|
let focusedCell;
|
||||||
|
|
||||||
|
function handleInput(event) {
|
||||||
|
focusedCell = event.target;
|
||||||
|
const inputValue = focusedCell.textContent.trim();
|
||||||
|
if (inputValue.length > 1) { // Show suggestions only after 2 characters
|
||||||
|
showSuggestions(inputValue);
|
||||||
|
} else {
|
||||||
|
hideSuggestions();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function showSuggestions(inputValue) {
|
||||||
|
console.log(inputValue);
|
||||||
|
|
||||||
|
const suggestions = ["Self", "Spouse", "Son","Daughter","Father","Mother","Father in law",'Mother in law','M','F']; // Replace with your logic or API call
|
||||||
|
const filteredSuggestions = suggestions.filter(s => s.toLowerCase().startsWith(inputValue.toLowerCase()));
|
||||||
|
console.log(filteredSuggestions);
|
||||||
|
console.log(filteredSuggestions.length);
|
||||||
|
suggestionsList.innerHTML = ""; // Clear previous suggestions
|
||||||
|
if(filteredSuggestions.length)
|
||||||
|
{
|
||||||
|
suggestionBox.style.display = "block"; // Show the suggestion box
|
||||||
|
for (const suggestion of filteredSuggestions) {
|
||||||
|
const listItem = document.createElement("li");
|
||||||
|
listItem.textContent = suggestion;
|
||||||
|
listItem.addEventListener("click", function() {
|
||||||
|
console.log(focusedCell);
|
||||||
|
if (focusedCell) { // Check if a cell is focused
|
||||||
|
focusedCell.textContent = suggestion; // Set the selected suggestion in the focused cell
|
||||||
|
}
|
||||||
|
hideSuggestions();
|
||||||
|
});
|
||||||
|
suggestionsList.appendChild(listItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Position the suggestion box near the input field (optional)
|
||||||
|
const cellRect = focusedCell.parentNode.getBoundingClientRect();
|
||||||
|
// console.log(cellRect.left);
|
||||||
|
// console.log(cellRect.right);
|
||||||
|
suggestionBox.style.left = 170 + "px";
|
||||||
|
suggestionBox.style.top = 50 + "px";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function hideSuggestions() {
|
||||||
|
suggestionBox.style.display = "none";
|
||||||
|
suggestionsList.innerHTML = ""; // Clear suggestions
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getTableDataAsJson(table) {
|
||||||
|
// let index = {'1' : 'sno','2' : 'emp_code'};
|
||||||
|
const tableBody = table.querySelector("tbody");
|
||||||
|
if (!tableBody) {
|
||||||
|
console.error("Error: Table does not have a tbody element.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get all rows
|
||||||
|
const rows = tableBody.querySelectorAll("tr");
|
||||||
|
|
||||||
|
// Create an empty array to store JSON data
|
||||||
|
const jsonData = [];
|
||||||
|
|
||||||
|
// Loop through each row
|
||||||
|
for (const row of rows) {
|
||||||
|
const cells = row.querySelectorAll("td");
|
||||||
|
const rowData = {}; // Create an object to hold cell data
|
||||||
|
|
||||||
|
// Loop through each cell in the row
|
||||||
|
for (let i = 0; i < cells.length; i++) {
|
||||||
|
const cellContent = cells[i].textContent.trim();
|
||||||
|
// You can adjust the property name logic if needed (e.g., use cell index as key)
|
||||||
|
const isCheckbox = i === 11;
|
||||||
|
if (isCheckbox) {
|
||||||
|
rowData[`column${i + 1}`] = cells[i].querySelector("input[type='checkbox']").checked;
|
||||||
|
} else {
|
||||||
|
rowData[`column${i + 1}`] = cellContent; // Use descriptive column names (optional)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the row data object to the JSON array
|
||||||
|
jsonData.push(rowData);
|
||||||
|
}
|
||||||
|
console.log(jsonData);
|
||||||
|
return jsonData;
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
@ -107,7 +107,7 @@
|
|||||||
<thead class="bg-light">
|
<thead class="bg-light">
|
||||||
<tr>
|
<tr>
|
||||||
<th class="font-weight-medium">Date</th>
|
<th class="font-weight-medium">Date</th>
|
||||||
<!-- <th class="font-weight-medium">CD Account No</th> -->
|
<th class="font-weight-medium">Unit</th>
|
||||||
<th class="font-weight-medium">Policy</th>
|
<th class="font-weight-medium">Policy</th>
|
||||||
<th class="font-weight-medium">Endorsement No</th>
|
<th class="font-weight-medium">Endorsement No</th>
|
||||||
<th class="font-weight-medium">Sub Type</th>
|
<th class="font-weight-medium">Sub Type</th>
|
||||||
@ -122,8 +122,20 @@
|
|||||||
<?php foreach($depositdata as $row) { ?>
|
<?php foreach($depositdata as $row) { ?>
|
||||||
<tr id="<?php echo $row->id;?>">
|
<tr id="<?php echo $row->id;?>">
|
||||||
<td><?php echo date('d-M-Y h:i A', strtotime($row->created_at)); ?></td>
|
<td><?php echo date('d-M-Y h:i A', strtotime($row->created_at)); ?></td>
|
||||||
|
<td><?php echo $row->unit ?? ' - '; ?></td>
|
||||||
<!-- <td><?php echo $row->policy_name ?? '<center> - </center>'; ?></td> -->
|
<!-- <td><?php echo $row->policy_name ?? '<center> - </center>'; ?></td> -->
|
||||||
<td><?php echo $row->policy_type ?? '<center> - </center>'; ?></td>
|
<td>
|
||||||
|
<?php
|
||||||
|
$policyType = $row->policy_type ?? '';
|
||||||
|
$policyNo = $row->policy_no ?? '';
|
||||||
|
|
||||||
|
if ($policyType || $policyNo) {
|
||||||
|
echo trim($policyType . ' - ' . $policyNo, ' -');
|
||||||
|
} else {
|
||||||
|
echo '<center> - </center>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
<td><?php echo $row->endorsement_no ?? '<center> - </center>'; ?></td>
|
<td><?php echo $row->endorsement_no ?? '<center> - </center>'; ?></td>
|
||||||
<td><?php echo isset($subTypeOptions[$row->sub_type]) ? $subTypeOptions[$row->sub_type] : ''; ?>
|
<td><?php echo isset($subTypeOptions[$row->sub_type]) ? $subTypeOptions[$row->sub_type] : ''; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@ -23,7 +23,9 @@
|
|||||||
"phpoffice/phpspreadsheet": "^2.1",
|
"phpoffice/phpspreadsheet": "^2.1",
|
||||||
"psr/log": "^1.1",
|
"psr/log": "^1.1",
|
||||||
"slim/slim": "^4.13",
|
"slim/slim": "^4.13",
|
||||||
"zircote/swagger-php": "^4.8"
|
"zircote/swagger-php": "^4.8",
|
||||||
|
"psr/http-message": "^1.0",
|
||||||
|
"kreait/firebase-php":"^7.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"codeigniter/coding-standard": "^1.7",
|
"codeigniter/coding-standard": "^1.7",
|
||||||
|
|||||||
BIN
public/sample_excel/enrollment.xlsx
Normal file
BIN
public/sample_excel/enrollment.xlsx
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
236
tests/unit/PremiumCalculationTestNew.php
Normal file
236
tests/unit/PremiumCalculationTestNew.php
Normal file
@ -0,0 +1,236 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
namespace App\Tests;
|
||||||
|
|
||||||
|
use CodeIgniter\Test\CIUnitTestCase;
|
||||||
|
use Config\App;
|
||||||
|
use Config\Services;
|
||||||
|
use Tests\Support\Libraries\ConfigReader;
|
||||||
|
|
||||||
|
use App\Controllers\EmployeeServiceController;
|
||||||
|
use CodeIgniter\Test\DatabaseTestTrait;
|
||||||
|
use Kint\Kint;
|
||||||
|
|
||||||
|
class PremiumCalculationTestNew extends CIUnitTestCase
|
||||||
|
{
|
||||||
|
use DatabaseTestTrait;
|
||||||
|
protected $migrate = false;
|
||||||
|
|
||||||
|
//primary, single parent, double parent, and double parent in law
|
||||||
|
public function testPremiumCalculation($MY_PARAM = 'default')
|
||||||
|
{
|
||||||
|
helper('excel_util_helper');
|
||||||
|
$param = getenv('MY_PARAM');
|
||||||
|
// echo isset($param) && $param != NULL ? $param : $MY_PARAM;
|
||||||
|
|
||||||
|
//first slab
|
||||||
|
$primary_relationship = '{"self":1,"spouse":"any","childrens":"any","parents":"NA","parents-in-law":"NA","either-parents-pil":0}';
|
||||||
|
$primary_grid_id = 7;
|
||||||
|
$primary_unit = 'unit1';
|
||||||
|
$primary_grid_type = 2;
|
||||||
|
$primary_max_si = 35000000;
|
||||||
|
$primary_grid_name = 'dependent + age + SI';
|
||||||
|
$primary_grid_master = ['id' => 4,'policy_type' => 'GMC','ui_type' => $primary_grid_id,'policy_grid_type' => $primary_grid_name,'is_dependent_allowed' => 1,'max_dependent_age' => 0,'max_dependent_count' => 1,'basicpay' => 0,'emp_band' => 0];
|
||||||
|
$primary_slabs = [
|
||||||
|
[ 'id' => 322, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $primary_grid_id, 'age_from' => 0, 'age_to' => 18, 'grade' => 'A', 'si' => 5000000, 'premium' => 500, 'max_si' => $primary_max_si,'premium_type' => $primary_grid_type, 'relationship' => null,'additional_relationship' => $primary_relationship,'unit' => $primary_unit],
|
||||||
|
[ 'id' => 323, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $primary_grid_id, 'age_from' => 19, 'age_to' => 25, 'grade' => 'B', 'si' => 5000000, 'premium' => 1500, 'max_si' => $primary_max_si, 'premium_type' => $primary_grid_type, 'relationship' => null,'additional_relationship' => $primary_relationship,'unit' => $primary_unit],
|
||||||
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $primary_grid_id, 'age_from' => 26, 'age_to' => 35, 'grade' => 'C', 'si' => 5000000, 'premium' => 2000, 'max_si' => $primary_max_si, 'premium_type' => $primary_grid_type, 'relationship' => null,'additional_relationship' => $primary_relationship,'unit' => $primary_unit],
|
||||||
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $primary_grid_id, 'age_from' => 36, 'age_to' => 45, 'grade' => 'D', 'si' => 5000000, 'premium' => 2500, 'max_si' => $primary_max_si, 'premium_type' => $primary_grid_type, 'relationship' => null,'additional_relationship' => $primary_relationship,'unit' => $primary_unit],
|
||||||
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $primary_grid_id, 'age_from' => 46, 'age_to' => 55, 'grade' => 'E', 'si' => 5000000, 'premium' => 3000, 'max_si' => $primary_max_si, 'premium_type' => $primary_grid_type, 'relationship' => null,'additional_relationship' => $primary_relationship,'unit' => $primary_unit],
|
||||||
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $primary_grid_id, 'age_from' => 56, 'age_to' => 75, 'grade' => 'F', 'si' => 5000000, 'premium' => 3500, 'max_si' => $primary_max_si, 'premium_type' => $primary_grid_type, 'relationship' => null,'additional_relationship' => $primary_relationship,'unit' => $primary_unit],
|
||||||
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $primary_grid_id, 'age_from' => 76, 'age_to' => 85, 'grade' => 'G', 'si' => 5000000, 'premium' => 4000, 'max_si' => $primary_max_si, 'premium_type' => $primary_grid_type, 'relationship' => null,'additional_relationship' => $primary_relationship,'unit' => $primary_unit],
|
||||||
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $primary_grid_id, 'age_from' => 86, 'age_to' => 100, 'grade' => 'G', 'si' => 5000000, 'premium' => 4500, 'max_si' => $primary_max_si, 'premium_type' => $primary_grid_type, 'relationship' => null,'additional_relationship' => $primary_relationship,'unit' => $primary_unit],
|
||||||
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $primary_grid_id, 'age_from' => 86, 'age_to' => 100, 'grade' => 'G', 'si' => $primary_max_si, 'premium' => 15000, 'max_si' => 0, 'premium_type' => $primary_grid_type, 'relationship' => null,'additional_relationship' => $primary_relationship,'unit' => $primary_unit],
|
||||||
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $primary_grid_id, 'age_from' => 86, 'age_to' => 100, 'grade' => 'G', 'si' => 30000000, 'premium' => 30000, 'max_si' => 0, 'premium_type' => $primary_grid_type, 'relationship' => null,'additional_relationship' => $primary_relationship,'unit' => $primary_unit]
|
||||||
|
];
|
||||||
|
|
||||||
|
//second slab
|
||||||
|
$second_relationship = '{"self":"NA","spouse":"NA","childrens":"NA","parents":"any","parents-in-law":"NA","either-parents-pil":0}';
|
||||||
|
$second_grid_id = 10;
|
||||||
|
$second_unit = 'unit1';
|
||||||
|
$second_grid_type = 1;
|
||||||
|
$second_max_si = 35000000;
|
||||||
|
$second_grid_name = 'max age';
|
||||||
|
$second_grid_master = ['id' => 4,'policy_type' => 'GMC','ui_type' => $second_grid_id,'policy_grid_type' => $second_grid_name,'is_dependent_allowed' => 1,'max_dependent_age' => 0,'max_dependent_count' => 1,'basicpay' => 0,'emp_band' => 0];
|
||||||
|
$second_slabs = [
|
||||||
|
[ 'id' => 322, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $second_grid_id, 'age_from' => 0, 'age_to' => 18, 'grade' => 'A', 'si' => 5000000, 'premium' => 700, 'max_si' => 2500000,'premium_type' => $second_grid_type, 'relationship' => null,'additional_relationship' => $second_relationship,'unit' => $second_unit ],
|
||||||
|
[ 'id' => 323, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $second_grid_id, 'age_from' => 19, 'age_to' => 25, 'grade' => 'B', 'si' => 5000000, 'premium' => 1400, 'max_si' => 2000000, 'premium_type' => $second_grid_type, 'relationship' => null,'additional_relationship' => $second_relationship,'unit' => $second_unit],
|
||||||
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $second_grid_id, 'age_from' => 26, 'age_to' => 35, 'grade' => 'C', 'si' => 5000000, 'premium' => 2300, 'max_si' => 1800000, 'premium_type' => $second_grid_type, 'relationship' => null,'additional_relationship' => $second_relationship,'unit' => $second_unit],
|
||||||
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $second_grid_id, 'age_from' => 36, 'age_to' => 45, 'grade' => 'D', 'si' => 5000000, 'premium' => 2750, 'max_si' => 150000, 'premium_type' => $second_grid_type, 'relationship' => null,'additional_relationship' => $second_relationship,'unit' => $second_unit],
|
||||||
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $second_grid_id, 'age_from' => 46, 'age_to' => 55, 'grade' => 'E', 'si' => 5000000, 'premium' => 3500, 'max_si' => 130000, 'premium_type' => $second_grid_type, 'relationship' => null,'additional_relationship' => $second_relationship,'unit' => $second_unit],
|
||||||
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $second_grid_id, 'age_from' => 56, 'age_to' => 75, 'grade' => 'F', 'si' => 5000000, 'premium' => 4250, 'max_si' => 10, 'premium_type' => $second_grid_type, 'relationship' => null,'additional_relationship' => $second_relationship,'unit' => $second_unit],
|
||||||
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $second_grid_id, 'age_from' => 76, 'age_to' => 85, 'grade' => 'G', 'si' => 5000000, 'premium' => 4950, 'max_si' => 5, 'premium_type' => $second_grid_type, 'relationship' => null,'additional_relationship' => $second_relationship,'unit' => $second_unit],
|
||||||
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $second_grid_id, 'age_from' => 86, 'age_to' => 100, 'grade' => 'G', 'si' => 5000000, 'premium' => 5500, 'max_si' => 5, 'premium_type' => $second_grid_type, 'relationship' => null,'additional_relationship' => $second_relationship,'unit' => $second_unit]
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
// third slab
|
||||||
|
$third_relationship = '{"self":"NA","spouse":"NA","childrens":"NA","parents":1,"parents-in-law":"NA","either-parents-pil":0}';
|
||||||
|
$third_grid_id = 7;
|
||||||
|
$third_unit = 'unit1';
|
||||||
|
$third_grid_type = 1;
|
||||||
|
$third_max_si = 35000000;
|
||||||
|
$third_grid_name = 'age band';
|
||||||
|
$third_grid_master = ['id' => 4,'policy_type' => 'GMC','ui_type' => $third_grid_id,'policy_grid_type' => $third_grid_name,'is_dependent_allowed' => 1,'max_dependent_age' => 0,'max_dependent_count' => 1,'basicpay' => 0,'emp_band' => 0];
|
||||||
|
$third_slabs = [
|
||||||
|
[ 'id' => 322, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $third_grid_id, 'age_from' => 0, 'age_to' => 18, 'grade' => 'A', 'si' => 5000000, 'premium' => 701, 'max_si' => 2500000,'premium_type' => $third_grid_type, 'relationship' => null,'additional_relationship' => $third_relationship,'unit' => $third_unit ],
|
||||||
|
[ 'id' => 323, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $third_grid_id, 'age_from' => 19, 'age_to' => 25, 'grade' => 'B', 'si' => 5000000, 'premium' => 1401, 'max_si' => 2000000, 'premium_type' => $third_grid_type, 'relationship' => null,'additional_relationship' => $third_relationship,'unit' => $third_unit],
|
||||||
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $third_grid_id, 'age_from' => 26, 'age_to' => 35, 'grade' => 'C', 'si' => 5000000, 'premium' => 2301, 'max_si' => 1800000, 'premium_type' => $third_grid_type, 'relationship' => null,'additional_relationship' => $third_relationship,'unit' => $third_unit],
|
||||||
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $third_grid_id, 'age_from' => 36, 'age_to' => 45, 'grade' => 'D', 'si' => 5000000, 'premium' => 2751, 'max_si' => 150000, 'premium_type' => $third_grid_type, 'relationship' => null,'additional_relationship' => $third_relationship,'unit' => $third_unit],
|
||||||
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $third_grid_id, 'age_from' => 46, 'age_to' => 55, 'grade' => 'E', 'si' => 5000000, 'premium' => 3501, 'max_si' => 130000, 'premium_type' => $third_grid_type, 'relationship' => null,'additional_relationship' => $third_relationship,'unit' => $third_unit],
|
||||||
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $third_grid_id, 'age_from' => 56, 'age_to' => 75, 'grade' => 'F', 'si' => 5000000, 'premium' => 4251, 'max_si' => 10, 'premium_type' => $third_grid_type, 'relationship' => null,'additional_relationship' => $third_relationship,'unit' => $third_unit],
|
||||||
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $third_grid_id, 'age_from' => 76, 'age_to' => 85, 'grade' => 'G', 'si' => 5000000, 'premium' => 4951, 'max_si' => 5, 'premium_type' => $third_grid_type, 'relationship' => null,'additional_relationship' => $third_relationship,'unit' => $third_unit],
|
||||||
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $third_grid_id, 'age_from' => 86, 'age_to' => 100, 'grade' => 'G', 'si' => 5000000, 'premium' => 5501, 'max_si' => 5, 'premium_type' => $third_grid_type, 'relationship' => null,'additional_relationship' => $third_relationship,'unit' => $third_unit]
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
// fourth slab
|
||||||
|
$fourth_relationship = '{"self":"NA","spouse":"NA","childrens":"NA","parents":"NA","parents-in-law":2,"either-parents-pil":0}';
|
||||||
|
$fourth_grid_id = 11;
|
||||||
|
$fourth_unit = 'unit1';
|
||||||
|
$fourth_grid_type = 2;
|
||||||
|
$fourth_max_si = 8000000;
|
||||||
|
$fourth_grid_name = 'age band';
|
||||||
|
$fourth_grid_master = ['id' => 4,'policy_type' => 'GMC','ui_type' => $fourth_grid_id,'policy_grid_type' => $fourth_grid_name,'is_dependent_allowed' => 1,'max_dependent_age' => 0,'max_dependent_count' => 1,'basicpay' => 0,'emp_band' => 0];
|
||||||
|
$fourth_slabs = [
|
||||||
|
[ 'id' => 322, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $fourth_grid_id, 'age_from' => 0, 'age_to' => 18, 'grade' => 'A', 'si' => 5000000, 'premium' => 1111, 'max_si' => $fourth_max_si,'premium_type' => $fourth_grid_type, 'relationship' => null,'additional_relationship' => $fourth_relationship,'unit' => $fourth_unit ],
|
||||||
|
[ 'id' => 323, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $fourth_grid_id, 'age_from' => 19, 'age_to' => 25, 'grade' => 'B', 'si' => 5000000, 'premium' => 2222, 'max_si' => $fourth_max_si, 'premium_type' => $fourth_grid_type, 'relationship' => null,'additional_relationship' => $fourth_relationship,'unit' => $fourth_unit],
|
||||||
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $fourth_grid_id, 'age_from' => 26, 'age_to' => 35, 'grade' => 'C', 'si' => 5000000, 'premium' => 3333, 'max_si' => $fourth_max_si, 'premium_type' => $fourth_grid_type, 'relationship' => null,'additional_relationship' => $fourth_relationship,'unit' => $fourth_unit],
|
||||||
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $fourth_grid_id, 'age_from' => 36, 'age_to' => 45, 'grade' => 'D', 'si' => 5000000, 'premium' => 4444, 'max_si' => $fourth_max_si, 'premium_type' => $fourth_grid_type, 'relationship' => null,'additional_relationship' => $fourth_relationship,'unit' => $fourth_unit],
|
||||||
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $fourth_grid_id, 'age_from' => 46, 'age_to' => 55, 'grade' => 'E', 'si' => 5000000, 'premium' => 5555, 'max_si' => $fourth_max_si, 'premium_type' => $fourth_grid_type, 'relationship' => null,'additional_relationship' => $fourth_relationship,'unit' => $fourth_unit],
|
||||||
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $fourth_grid_id, 'age_from' => 56, 'age_to' => 75, 'grade' => 'F', 'si' => 5000000, 'premium' => 6666, 'max_si' => $fourth_max_si, 'premium_type' => $fourth_grid_type, 'relationship' => null,'additional_relationship' => $fourth_relationship,'unit' => $fourth_unit],
|
||||||
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $fourth_grid_id, 'age_from' => 76, 'age_to' => 85, 'grade' => 'G', 'si' => 5000000, 'premium' => 7777, 'max_si' => $fourth_max_si, 'premium_type' => $fourth_grid_type, 'relationship' => null,'additional_relationship' => $fourth_relationship,'unit' => $fourth_unit],
|
||||||
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $fourth_grid_id, 'age_from' => 86, 'age_to' => 100, 'grade' => 'G', 'si' => 5000000, 'premium' => 8888, 'max_si' => $fourth_max_si, 'premium_type' => $fourth_grid_type, 'relationship' => null,'additional_relationship' => $fourth_relationship,'unit' => $fourth_unit],
|
||||||
|
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $fourth_grid_id, 'age_from' => 86, 'age_to' => 100, 'grade' => 'G', 'si' => 8000000, 'premium' => 9999, 'max_si' => 0, 'premium_type' => $fourth_grid_type, 'relationship' => null,'additional_relationship' => $fourth_relationship,'unit' => $fourth_unit]
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
//overall rack rate
|
||||||
|
$over_all_rack_details = [ 'primary' => [ "slab_rates" => $primary_slabs,'grid_master' => $primary_grid_master],
|
||||||
|
'two parent' => ["slab_rates" => $second_slabs,'grid_master' => $second_grid_master],
|
||||||
|
'single parent' => ["slab_rates" => $third_slabs,'grid_master' => $third_grid_master],
|
||||||
|
'double_parent_in_law' => ["slab_rates" => $fourth_slabs,'grid_master' => $fourth_grid_master]
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
// Sample family data
|
||||||
|
$family_details = [
|
||||||
|
[2,'TEST001','John Doe', '01-Jan-1988', 'M', 'Self', '5000000', NULL, '', '', 'G', '', '', '', '', '', '','','unit1'],
|
||||||
|
[1,'TEST001','Jane Doe', '01-Jan-1985', 'F', 'Spouse', 5000000, '01-Jan-2024', '01-Jan-2020', 50000, 'A', 'Manager', '1234567890', 'john.doe@example.com', '0', '', '', '',''],
|
||||||
|
|
||||||
|
// [3,'TEST001','Peter Doe', '01-Jan-1955', 'M', 'Father', '', NULL, '', '', '', '', '', '', '', '', '','',''],
|
||||||
|
[4,'TEST001','Mary Doe', '01-Jan-1953', 'F', 'Mother', '', NULL, '', '', '', '', '', '', '', '', '','',''],
|
||||||
|
[5,'TEST001','Grace Doe', '01-Jan-1954', 'F', 'Mother in law', '', NULL, '', '', '', '', '', '', '', '', '','',''],
|
||||||
|
//[6,'TEST001','George Doe', '01-Jan-1948', 'M', 'Father in law', '', NULL, '', '', '', '', '', '', '', '', '','',''],
|
||||||
|
[7,'TEST001','Alice Doe', '01-Jan-1990', 'F', 'Daughter', 5000000, '01-Jan-2024', '01-Jan-2024', 40000, 'B', 'Supervisor', '9876543210', '', '', '', '','',''],
|
||||||
|
[6,'TEST001','Bob Doe', '01-Jan-1993', 'M', 'son', '50000', NULL, '', '', '', '', '', '', '', '', '','',''],
|
||||||
|
];
|
||||||
|
|
||||||
|
// Sample policy terms
|
||||||
|
$policy_terms = [
|
||||||
|
'family_floater' => true,
|
||||||
|
'family_floaters' => [
|
||||||
|
'self' => 1,
|
||||||
|
'spouse' => 1,
|
||||||
|
'childrens' => 2,
|
||||||
|
'either-parents-pil' => 0,
|
||||||
|
'parents' => 2,
|
||||||
|
'parents-in-law' => 2,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
//re organize over_all_rack_details
|
||||||
|
$all_rack_rates = [];
|
||||||
|
foreach ($over_all_rack_details as $key => $value) {
|
||||||
|
foreach ($value['slab_rates'] as $skey => $svalue) {
|
||||||
|
$svalue['rack_rate_name'] = $key;
|
||||||
|
$svalue['grid_master'] = $value['grid_master'];
|
||||||
|
$all_rack_rates[] = $svalue;
|
||||||
|
}
|
||||||
|
// dd($value['slab_rates']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// dd($all_rack_rates);
|
||||||
|
$policy_details = ['base_policy' => null,"policy_start_date" => "2023-02-02","policy_end_date" => "2024-02-02","policy_terms" => json_encode($policy_terms),'gst' => 5];
|
||||||
|
$file = ['id' => null,'client_id' => 10,'policy_id' => 10,'action' => 'inception','client_branch_id' => 1,'created_by' => 1];
|
||||||
|
$existing_units = ['unit1'];
|
||||||
|
$data = calculate_premium_new(family_data:$family_details,policy_terms: $policy_details,slab_details : $all_rack_rates,fileArr: $file, existing_units:$existing_units);
|
||||||
|
|
||||||
|
//****************************onboard process*******************
|
||||||
|
// $empServiceController = new EmployeeServiceController();
|
||||||
|
// $empServiceController->employeesOnboardProcess(['familiy_data' => $data,'file' => $file]);
|
||||||
|
|
||||||
|
// dd();
|
||||||
|
//******************************** onboard process****************
|
||||||
|
$policy_created_count = 0;
|
||||||
|
echo "\n";
|
||||||
|
$result_to_display = [];
|
||||||
|
foreach ($data as $key => $value)
|
||||||
|
{
|
||||||
|
if(is_array($value))
|
||||||
|
{
|
||||||
|
$result_to_display[$key]['emp_code'] = $value['emp_code'];
|
||||||
|
$result_to_display[$key]['name'] = $value['name'].'('.calculate_days_bw_dates($value['dob'])->y.')';
|
||||||
|
$result_to_display[$key]['relation'] = $value['relationship'];
|
||||||
|
$temp_grid = ($value['temp']['grid_name']);
|
||||||
|
$temp_grid_type = ($value['temp']['premium_type']);
|
||||||
|
$temp_grid_type = ($temp_grid_type == 1 ? 'S' : 'I');
|
||||||
|
$result_to_display[$key]['premium_type'] = $temp_grid.'#'.$value['temp']['grid_id'].'#'.
|
||||||
|
($value['temp']['acting_self'] == true ? 'Self' : 'No' ) .'#'. ($temp_grid_type) ;
|
||||||
|
$result_to_display[$key]['si'] = $value['policy_details']['basic_cover_si'];
|
||||||
|
$result_to_display[$key]['premium'] = $value['policy_details']['premium'];
|
||||||
|
$result_to_display[$key]['policy days'] = (calculate_days_bw_dates($policy_details['policy_start_date'],$policy_details['policy_end_date'])->days + 1);
|
||||||
|
$result_to_display[$key]['no of days'] = $value['policy_details']['days'];
|
||||||
|
$result_to_display[$key]['rata_premimum'] = $value['policy_details']['rata_premimum'];
|
||||||
|
$result_to_display[$key]['gst'] = $value['policy_details']['gst'];
|
||||||
|
|
||||||
|
if(!empty($value['policy_details']['premium'])){ $policy_created_count = $policy_created_count + 1; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TableDisplay::displayTable($result_to_display);
|
||||||
|
$this->assertTrue(($policy_created_count >= 1 || $policy_created_count = 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class TableDisplay
|
||||||
|
{
|
||||||
|
public static function displayTable(array $data)
|
||||||
|
{
|
||||||
|
if (empty($data)) {
|
||||||
|
echo "No data to display.\n";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate column widths
|
||||||
|
$columns = array_keys($data[0]);
|
||||||
|
$widths = array_map(function ($col) use ($data) {
|
||||||
|
$maxWidth = strlen($col);
|
||||||
|
foreach ($data as $row) {
|
||||||
|
$maxWidth = max($maxWidth, strlen($row[$col]));
|
||||||
|
}
|
||||||
|
return $maxWidth;
|
||||||
|
}, $columns);
|
||||||
|
|
||||||
|
// Print header
|
||||||
|
echo str_repeat('-', array_sum($widths) + count($columns) * 3) . PHP_EOL;
|
||||||
|
foreach ($columns as $i => $col) {
|
||||||
|
echo str_pad($col, $widths[$i]) . " | ";
|
||||||
|
}
|
||||||
|
echo PHP_EOL;
|
||||||
|
echo str_repeat('-', array_sum($widths) + count($columns) * 3) . PHP_EOL;
|
||||||
|
|
||||||
|
// Print rows
|
||||||
|
foreach ($data as $row) {
|
||||||
|
foreach ($columns as $i => $col) {
|
||||||
|
echo str_pad($row[$col], $widths[$i]) . " | ";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo PHP_EOL;
|
||||||
|
}
|
||||||
|
echo str_repeat('-', array_sum($widths) + count($columns) * 3) . PHP_EOL;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,11 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>403 Forbidden</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<p>Directory access is forbidden.</p>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
Loading…
Reference in New Issue
Block a user