CHANGE_ENROLLMENT_STATUS_AND_REMINDER_MAIL_CHANGE_THE_CODE_CONFLICT_MERAGE : AADHAVAN

This commit is contained in:
aadhavan valli 2024-07-29 18:17:54 +05:30
commit 54c6c78752
34 changed files with 2336 additions and 1213 deletions

View File

@ -14,13 +14,14 @@
# ENVIRONMENT
#--------------------------------------------------------------------
CI_ENVIRONMENT = development
# CI_ENVIRONMENT = development
#--------------------------------------------------------------------
# APP
#--------------------------------------------------------------------
app.baseURL = 'http://localhost/nhance/'
app.baseURL = 'http://localhost/client_changes/nhance/'
app.appTimezone = 'Asia/Kolkata'
# If you have trouble with `.`, you could also use `_`.
# app_baseURL = ''
# app.forceGlobalSecureRequests = false
@ -31,19 +32,74 @@ app.baseURL = 'http://localhost/nhance/'
#--------------------------------------------------------------------
# Dev DB Connection
database.default.hostname = 119.18.54.85
database.default.database = venbaehn_nhance
database.default.username = venbaehn_nhance_user1
database.default.password = 'iM~X7(cR+}A-'
database.default.DBDriver = MySQLi
database.default.DBPrefix =
database.default.port = 3306
database.tests.hostname = 119.18.54.85
database.tests.database = venbaehn_nhance
database.tests.username = venbaehn_nhance_user1
database.tests.password = 'iM~X7(cR+}A-'
database.tests.DBDriver = MySQLi
database.tests.DBPrefix =
database.tests.port = 3306
# Test DB Connection
# database.default.hostname = 119.18.54.85
# database.default.database = venbaehn_nhance_test
# database.default.username = venbaehn_nhance_user1
# database.default.password = 'iM~X7(cR+}A-'
# database.default.DBDriver = MySQLi
# database.default.DBPrefix =
# database.default.port = 3306
database.default.hostname = 119.18.54.85
database.default.database = venbaehn_nhance
database.default.username = venbaehn_nhance_user1
database.default.password = 'iM~X7(cR+}A-'
# database.tests.hostname = 119.18.54.85
# database.tests.database = venbaehn_nhance_test
# database.tests.username = venbaehn_nhance_user1
# database.tests.password = 'iM~X7(cR+}A-'
# database.tests.DBDriver = MySQLi
# database.tests.DBPrefix =
# database.tests.port = 3306
# UAT DB Connection
# database.default.hostname = 119.18.54.85
# database.default.database = venbaehn_nhance_uat
# database.default.username = venbaehn_nhance_user1
# database.default.password = 'iM~X7(cR+}A-'
# database.default.DBDriver = MySQLi
# database.default.DBPrefix =
# database.default.port = 3306
# database.tests.hostname = 119.18.54.85
# database.tests.database = venbaehn_nhance_uat
# database.tests.username = venbaehn_nhance_user1
# database.tests.password = 'iM~X7(cR+}A-'
# database.tests.DBDriver = MySQLi
# database.tests.DBPrefix =
# database.tests.port = 3306
# Local PhpMyAdmin DB Connection
# database.default.hostname = localhost
# database.default.database = nhance
# database.default.username = root
# database.default.password = ''
# database.default.DBDriver = MySQLi
# database.default.DBPrefix =
# database.default.port = 3306
# database.tests.hostname = localhost
# database.tests.database = nhance
# database.tests.username = root
# database.tests.password = ''
# database.tests.DBDriver = MySQLi
# database.tests.DBPrefix =
# database.tests.port = 3306
@ -125,12 +181,12 @@ database.default.password = 'iM~X7(cR+}A-'
#--------------------------------------------------------------------
# session.driver = 'CodeIgniter\Session\Handlers\FileHandler'
# session.cookieName = 'ci_session'
# session.expiration = 7200
session.cookieName = 'ci_session_dev'
session.expiration = 86400
# session.savePath = null
# session.matchIP = false
# session.timeToUpdate = 300
# session.regenerateDestroy = false
session.timeToUpdate = 300
session.regenerateDestroy = true
#--------------------------------------------------------------------
# LOGGER
@ -151,5 +207,10 @@ database.default.password = 'iM~X7(cR+}A-'
GOOGLE_OAUTH_APP_NAME = 'OAuth'
GOOGLE_OAUTH_CLIENT_ID = '696241936560-m2mr272ge7vr2n4q36c22l3d2gdgi90l.apps.googleusercontent.com'
GOOGLE_OAUTH_CLIENT_SECRET = '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'
GOOGLE_OAUTH_REDIRECT_URI = 'http://localhost/nhance/oauth2callback'
GOOGLE_OAUTH_REDIRECT_URI = 'http://localhost/client_changes/nhance/oauth2callback'
GOOGLE_OAUTH_SCOPES = "https://www.googleapis.com/auth/userinfo.email,https://www.googleapis.com/auth/userinfo.profile"
App_Url = https://venbait.in/nhance/app/dev/
POST_ENROLLMENT_APP_LINK = https://venbait.in/nhance/employee/dev/
NHANCE_LOGO = https://venbait.in/nhance/dev/public/assets/images/Nhance_Favi.png

View File

@ -16,6 +16,8 @@ $routes->get("testing", "ClientController::Testing");
$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");
@ -109,6 +111,7 @@ $routes->group("/client", ["filter" => "authMVC"], function ($routes) {
$routes->get("list/(:any)", "ClientController::getClientPolicyById/$1");
$routes->post("policyGMCTerms", "ClientController::policyGMCTerms");
$routes->get("getterms", "ClientController::getterms");
$routes->get("remove/(:any)", "ClientController::removePolicy/$1");
});
$routes->group("kyc", ["filter" => "authMVC"], function ($routes) {
@ -252,7 +255,6 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
$routes->get("fetch-emp-count/(:any)", "EmployeeController::getEmpCount/$1");
$routes->get("init-Emp-onboard/(:any)", "EmployeeController::initiateManualEmployeesOnboardProcess/$1");
$routes->get("full-excel-error-file/(:any)", "EmployeeController::downloadFullExcelErrorFile/$1");
$routes->get("id-card", "EmployeeController::viewECard/$1");
$routes->get("preview-card/(:any)", "EmployeeController::previewTemplate/$1");
$routes->get("export-import-error-list/(:any)", "EmployeeController::errorListExportImport/$1");
$routes->get("has_policy_config_completed/(:any)", "EmployeeController::hasPolicyConfigCompleted/$1");
@ -268,6 +270,8 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
$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->get("remove_rack_rate/(:any)", "ClientController::removeRackRate/$1");
});
$routes->cli('cli/processjob', 'JobWorker::processJob');

View File

@ -229,15 +229,24 @@ class ClientController extends AdminController
public function removeClient($id = null)
{
$this->myLogger->logme('error','Client Remove function called');
// $data = $this->request->getPost();
$data['updated_by'] = get_session_userid();
$data['is_active'] = 0;
$update = $this->clientModel->update($id,$data);
if($update){
$client_policy_data = $this->clientPolicyModel
->where('policy_status', 1)
->where('Is_active', 1)
->where('client_id', $id)
->countAllResults();
if($client_policy_data == 0){
$data['updated_by'] = get_session_userid();
$data['is_active'] = 0;
$update = $this->clientModel->update($id,$data);
return $this->respond(['status' => true,'code' => 200], 200);
}else{
return $this->respond(['status' => false,'code' => 404], 200);
return $this->respond(['status' => false,'code' => 404, 'message' => 'The Client has active policy'], 200);
}
}
public function removeClientBranch($id = null)
@ -319,6 +328,7 @@ class ClientController extends AdminController
5 => 'Non EB',
6 => 'Refund By Insurer',
7 => 'Opening Amount',
8 => 'Truncated',
];
$data['subTypeOptions'] = $subTypeOptions;
@ -411,6 +421,7 @@ class ClientController extends AdminController
}
$editData['client_policy'] = $clientPoliceData;
$editData['client_policy']['role'] = get_role_id();
$editData['notification'] =$this->notificationModel->select('template_name,enabled')->where('client_id',$id)->findAll();
$editData['placeHolders'] = ['member_name','nhance_logo','tpa_id','ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'post_enrollment_app_link', 'client_name'];
@ -757,8 +768,8 @@ class ClientController extends AdminController
$data['no_of_lives'] = $this->request->getPost('no_of_lives');
$data['policy_status'] = $this->request->getPost('policy_status');
$data['no_of_employees'] = $this->request->getPost('no_of_employees');
$data['earned_premium_date'] = change_date_format($this->request->getPost('earned_premium_date'), 'd-m-Y', 'Y-m-d');
$data['claims_incurred_date'] = change_date_format($this->request->getPost('claims_incurred_date'), 'd-m-Y', 'Y-m-d');
$data['earned_premium_date'] = change_date_format($this->request->getPost('earned_premium_date'), 'd-m-Y', 'Y-m-d') ?? null;
$data['claims_incurred_date'] = change_date_format($this->request->getPost('claims_incurred_date'), 'd-m-Y', 'Y-m-d') ?? null;
$data['incurred_claims_ratio'] = $this->request->getPost('incurred_claims_ratio');
$data['no_lives_at_inception'] = $this->request->getPost('no_lives_at_inception');
$data['premium_paid_at_inception'] = $this->request->getPost('premium_paid_at_inception');
@ -833,6 +844,7 @@ class ClientController extends AdminController
$insert = $this->clientPolicyModel->insert($data);
if($insert){
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($this->request->getPost('client_id'));
$clientPoliceData['role'] = get_role_id();
return $this->respond(['status' => true,'code' => 200,'data' => $clientPoliceData, 'method' => 'CERATE', 'post_data' => $data], 200);
}else{
return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200);
@ -870,8 +882,8 @@ class ClientController extends AdminController
$data['no_of_lives'] = $this->request->getPost('no_of_lives');
$data['policy_status'] = $this->request->getPost('policy_status');
$data['no_of_employees'] = $this->request->getPost('no_of_employees');
$data['earned_premium_date'] = change_date_format($this->request->getPost('earned_premium_date'), 'd-m-Y', 'Y-m-d');
$data['claims_incurred_date'] = change_date_format($this->request->getPost('claims_incurred_date'), 'd-m-Y', 'Y-m-d');
$data['earned_premium_date'] = change_date_format($this->request->getPost('earned_premium_date'), 'd-m-Y', 'Y-m-d') ?? null;
$data['claims_incurred_date'] = change_date_format($this->request->getPost('claims_incurred_date'), 'd-m-Y', 'Y-m-d') ?? null;
$data['incurred_claims_ratio'] = $this->request->getPost('incurred_claims_ratio');
$data['no_lives_at_inception'] = $this->request->getPost('no_lives_at_inception');
$data['premium_paid_at_inception'] = $this->request->getPost('premium_paid_at_inception');
@ -937,7 +949,7 @@ class ClientController extends AdminController
// dd($data);
$data['updated_by'] = get_session_userid();
// print_r($data);die;
// print_r(json_encode($data));die;
$insert = $this->clientPolicyModel->update($id,$data);
$lastQuery = $this->clientPolicyModel->getLastQuery();
@ -946,7 +958,7 @@ class ClientController extends AdminController
if($insert){
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($client_id);
$clientPoliceData['role'] = get_role_id();
// foreach ($clientPoliceData as $key => $value) {
// $clientPoliceData[$key]->policy_start_date = date('d-M-Y', strtotime($value->policy_start_date));
@ -958,6 +970,41 @@ class ClientController extends AdminController
}
}
public function removePolicy($id = null)
{
$this->myLogger->logme('error', 'Client Policy Remove function called');
$data = [
'updated_by' => get_session_userid(),
'is_active' => 0
];
$emp_details = $this->employeePolicyModel
->join('employees', 'employees.id = employee_polices.employee_id')
->where('client_policy_id', $id)
->where('employee_polices.status', 'active')
->where('employee_polices.is_active', 1)
->where('employees.emp_status', 'active')
->where('employees.is_active', 1)
->countAllResults();
if($emp_details == 0){
$update = $this->clientPolicyModel->where('id', $id)->set($data)->update();
if ($update) {
return $this->respond(['status' => true, 'code' => 200], 200);
} else {
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to remove policy'], 200);
}
}else{
return $this->respond(['status' => false, 'code' => 404, 'message' => 'The policy has active employees'], 200);
}
}
public function createClientPolicyPremium()
{
@ -1715,10 +1762,12 @@ class ClientController extends AdminController
$data['family_floaters']['parents-in-law'] =2;
$data['family_floaters']['either-parents-pil'] =0;
}else if($temp_family_floaters[$value] == '2EPORPIL'){
//Parents or PIL (Any two of Father, Mother, MIl, FIL)
$data['family_floaters']['parents'] =0;
$data['family_floaters']['parents-in-law'] =0;
$data['family_floaters']['either-parents-pil'] =2;
}else if($temp_family_floaters[$value] == 'EPORPIL'){
//Either Parents or PIL (Parents or Parents In Law)
$data['family_floaters']['parents'] =0;
$data['family_floaters']['parents-in-law'] =0;
$data['family_floaters']['either-parents-pil'] =1;
@ -2117,7 +2166,8 @@ class ClientController extends AdminController
}
}
public function getClientBranch($client_id){
public function getClientBranch($client_id)
{
$branchs = $this->clientBranchModel
->select('*')
@ -2125,8 +2175,6 @@ class ClientController extends AdminController
->findAll();
return $this->respond(['status' => true,'code' => 200, 'data' => $branchs], 200);
}
public function getClientAllDetailsByUsingClientID($client_id)
@ -2136,7 +2184,7 @@ class ClientController extends AdminController
$builder = $db->table('clients');
$builder->select('
policies.name as policy_name,
policy_type.policy_type,
insurers.name as insurer_name,
insurers.short_name as insurer_short_name,
@ -2150,9 +2198,9 @@ class ClientController extends AdminController
CASE
WHEN client_policy.base_policy IS NULL THEN "Not Appear"
WHEN client_policy.base_policy = 0 THEN "Not Appear"
ELSE (SELECT policies.name
ELSE (SELECT policy_type.policy_type
FROM client_policy AS base_client_policy
JOIN policies ON policies.id = base_client_policy.policy_id
JOIN policy_type ON policy_type.id = base_client_policy.policy_type_id
WHERE base_client_policy.id = client_policy.base_policy)
END as base_policy_name,
@ -2185,13 +2233,11 @@ class ClientController extends AdminController
', false);
$builder->join('client_policy', 'client_policy.client_id = clients.id');
$builder->join('client_branch', 'client_policy.client_branch_id = client_branch.id');
$builder->join('policies', 'policies.id = client_policy.policy_id');
$builder->join('policy_type', 'policy_type.id = policies.policy_type_id');
$builder->join('policy_type', 'policy_type.id = client_policy.policy_type_id');
$builder->join('insurers', 'insurers.id = client_policy.insurer_id');
$builder->join('tpa', 'tpa.id = client_policy.tpa_id');
$builder->where('clients.is_active', 1);
$builder->where('client_policy.is_active', 1);
$builder->where('policies.is_active', 1);
$builder->where('policy_type.is_active', 1);
$builder->where('client_policy.policy_status', 1);
$builder->where('clients.id', $client_id);
@ -2281,8 +2327,6 @@ class ClientController extends AdminController
}
$data['client_policy'] = $client_policy;
$data['client_branch'] = $this->clientModel
@ -2306,10 +2350,7 @@ class ClientController extends AdminController
->get()->getResultArray();
$data['client'] = $this->clientModel
->select('clients.*, states.state as state')
->join('states', 'states.id = clients.state')
->where('clients.id', $client_id)->first();
$data['client'] = $this->clientModel->where('clients.id', $client_id)->first();
$client_rm = $this->clientRMModel
@ -2337,7 +2378,7 @@ class ClientController extends AdminController
$data['heads'] = $heads;
// dd($data);
//$this->loadLayout('client_info', $data);
// $this->loadLayout('client_info', $data);
$html = view('client_info', $data);
@ -2645,7 +2686,7 @@ class ClientController extends AdminController
public function updateRackRateJson()
{
// $client_policy_id = 13;
// $client_policy_id = 12;
$results = $this->policyPremium2Model
->select('*')
@ -2664,6 +2705,7 @@ class ClientController extends AdminController
->get()
->getResultArray();
// dd($results, $results2);
$client_policy_ids = [];
$json = [];
@ -2740,7 +2782,9 @@ class ClientController extends AdminController
$client_policy_id = $result['client_policy_id'];
$client_policy_data = $this->clientPolicyModel->where('id', $client_policy_id)->first();
if($client_policy_data['policy_terms']){
// dd($client_policy_data);
if(isset($client_policy_data) && $client_policy_data['policy_terms']){
$self = 1;
$spouse = 'NA';
@ -2784,4 +2828,38 @@ class ClientController extends AdminController
}
public function removeRackRate($rack_rate_name = null, $client_policy_id = null)
{
$this->myLogger->logme('error', 'Rack Rate Remove function called');
$data = [
'updated_by' => get_session_userid(),
'is_active' => 0
];
$rackRateData = $this->policyPremium2Model
->where('rack_rate_name', $rack_rate_name)
->where('client_policy_id', $client_policy_id)
->where('is_active',1)
->countAllResults();
if($rackRateData > 0){
$update = $this->policyPremium2Model
->where('rack_rate_name', $rack_rate_name)
->where('client_policy_id', $client_policy_id)
->set($data)->update();
if ($update) {
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Rack Rate removed successfully', 'rr_count' => $rackRateData], 200);
} else {
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to remove policy', 'rr_count' => $rackRateData], 200);
}
}else{
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Rack Rate not available', 'rr_count' => $rackRateData], 200);
}
}
}

View File

@ -18,16 +18,17 @@ use App\Models\JobModel;
use App\Models\ClientPolicyModel;
use App\Models\NotificationModel;
use App\Models\EmployeePolicyModel;
use App\Controllers\PendingActionsContrller;
class DashboardController extends AdminController
{
use ResponseTrait;
protected $messageModel;
protected $clientModel;
protected $userMessageModel;
protected $myLogger;
public function __construct()
{
set_session_context('Dashboard');
@ -53,6 +54,19 @@ class DashboardController extends AdminController
->join('auth_history', 'employees.id = auth_history.user_id AND "employee" = auth_history.user_type', 'left')
->findAll();
$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 = [];
foreach ($results as $row) {
@ -62,15 +76,21 @@ class DashboardController extends AdminController
$branchId = $row['client_branch_id'];
$branchName = $row['branch_name'];
$branchCode = $row['branch_code'];
$employeeId = $row['employee_id'];
$employeeName = $row['employee_name'];
$employeeRelationship = $row['relationship'];
$employeeEmpCode = $row['emp_code'];
$employeeEmpStatus = $row['emp_status'];
$employeeUserType = $row['user_type'];
$clientPolicyId = $row['client_policy_id'];
$policyTypeId = $row['policy_type_id'];
$employeeId ='';
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] = [
@ -80,7 +100,7 @@ class DashboardController extends AdminController
'branches' => []
];
}
// Initialize the branch entry if it doesn't exist
if (!isset($groupedData[$clientId]['branches'][$branchId])) {
$groupedData[$clientId]['branches'][$branchId] = [
@ -116,14 +136,14 @@ class DashboardController extends AdminController
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']++;
}
}
}
// Re-index the arrays to match the expected structure
foreach ($groupedData as &$client) {
foreach ($client['branches'] as &$branch) {
@ -136,6 +156,7 @@ class DashboardController extends AdminController
$session = \Config\Services::session();
$session->set('enrollment_data', json_encode($data));
// echo "<pre>";
$data['pendingActionsData'] = $pendingActionsData;
// print_r($data);die;
@ -154,7 +175,7 @@ class DashboardController extends AdminController
$userId = get_session_userid();
$roleId = 5;
$teamId = 1;
if ($userId != null && $roleId != null && $teamId != null) {
$messages = $this->messageModel->getMessagesForUser($userId, $roleId, $teamId);
return $this->respond(['status' => true, 'code' => 200, 'message' => $messages], 200);
@ -163,7 +184,7 @@ class DashboardController extends AdminController
return $this->respond(['status' => false, 'code' => 404, 'message' => 'No data found'], 200);
}
}
public function acknowledgeMessage($messageId)
{
@ -258,4 +279,41 @@ class DashboardController extends AdminController
return json_encode(true);
}
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);
}
}

View File

@ -26,6 +26,7 @@ use App\Models\MessageModel;
use App\Models\UserMessageModel;
use App\Models\CDMasterModel;
use App\Models\InsurerExcelExportTemplateModel;
use App\Models\ClientBranchModel;
use App\Controllers\Jobs;
use App\Controllers\JobWorker;
@ -56,6 +57,7 @@ class EmpDataServiceController extends BaseController
protected $userMessageModel;
protected $CDMasterModel;
protected $excelExportTemplateModel;
protected $clientBranchModel;
public function __construct()
@ -77,6 +79,7 @@ class EmpDataServiceController extends BaseController
$this->userMessageModel = new UserMessageModel();
$this->CDMasterModel = new CDMasterModel();
$this->excelExportTemplateModel = new InsurerExcelExportTemplateModel();
$this->clientBranchModel = new ClientBranchModel();
}
@ -1785,7 +1788,7 @@ class EmpDataServiceController extends BaseController
'endorsement_no' => null,
'client_branch_id' => $client_branch_id,
'count' => $emp_count,
'event' => $file['event_type'],
'event_name' => $file['event_type'],
'policy_name' => $policy_name['policy_name'],
'user_id' => $user_id,
]]);
@ -2830,7 +2833,7 @@ class EmpDataServiceController extends BaseController
'cd_ac_no' => $CD_Account_Number['cd_ac_no'] ?? null,
'endorsement_no' => $endorsement_id ?? null,
'count' => $emp_count,
'event' => $file['event_type'],
'event_name' => $file['event_type'],
'policy_name' => $policy_name['policy_name'],
'user_id' => $user_id,
]]);
@ -3345,7 +3348,7 @@ class EmpDataServiceController extends BaseController
'cd_ac_no' => $CD_Account_Number['cd_ac_no'] ?? null,
'endorsement_no' => $endorsement_id ?? null,
'count' => $emp_count,
'event' => $file['event_type'],
'event_name' => $file['event_type'],
'policy_name' => $policy_name['policy_name'],
'user_id' => $user_id,
]]);
@ -3770,38 +3773,52 @@ class EmpDataServiceController extends BaseController
{
if (!empty($arrayData)) {
$amount = $this->employeePolicyModel->query("
SELECT SUM(rata_premimum + gst) AS total_sum
FROM employee_polices
WHERE id IN (" . implode(',', $arrayData['employeeIds']) . ")
")->getRow();
$insurer_id = $this->clientPolicyModel->where('id', $arrayData['client_policy_id'])->first();
$description = 'The following amount of Rs. ' . round($amount->total_sum, 2) . '/- has been debited for the ' . $arrayData['count'] . ' employees at ' . remove_underscore_capitalize_first_letter($arrayData['event']) . ' to ' . remove_underscore_capitalize_first_letter($arrayData['policy_name']) . '.';
if(get_session_userid() == null){
$client_branch_data = $this->clientBranchModel->where('id', $arrayData['client_branch_id'])->first();
$units = json_decode($client_branch_data['units']);
// dd(json_decode($client_branch_data['units']));
foreach($units as $unit)
{
$amount = $this->employeePolicyModel->query("
SELECT SUM(rata_premimum + gst) AS total_sum
FROM employee_polices
JOIN employees ON employees.id = employee_polices.employee_id
WHERE employees.unit = '$unit'
AND employee_polices.id IN (" . implode(',', $arrayData['employeeIds']) . ")
")->getRow();
if($amount){
$insurer_id = $this->clientPolicyModel->where('id', $arrayData['client_policy_id'])->first();
$description = 'The following amount of Rs. ' . round($amount->total_sum, 2) . '/- has been debited for the ' . $arrayData['count'] . ' employees at ' . remove_underscore_capitalize_first_letter($arrayData['event_name']) . ' to ' . remove_underscore_capitalize_first_letter($arrayData['policy_name']) . '.';
$data = [
'amount' => $amount->total_sum ?? 0,
'sub_type_id' => 4,
'client_id' => $arrayData['client_id'],
'client_policy_id' => $arrayData['client_policy_id'],
'endorsement_no' => $arrayData['endorsement_no'] ?? null,
'cd_ac_no' => $arrayData['cd_ac_no'] ?? null,
'insurer_id' => $insurer_id['insurer_id'],
'unit' => $unit,
'description' => $description,
'transaction_type' => 'Debit',
'updated_by' => $arrayData['user_id'],
'event_name' => $arrayData['event_name'],
'is_active' => 1,
];
$response = DepositHelper::saveDeposit($data, $arrayData['user_id']);
}
}
$data = [
'amount' => $amount->total_sum ?? 0,
'sub_type_id' => 4,
'client_id' => $arrayData['client_id'],
'client_policy_id' => $arrayData['client_policy_id'],
'endorsement_no' => $arrayData['endorsement_no'] ?? null,
'cd_ac_no' => $arrayData['cd_ac_no'] ?? null,
'insurer_id' => $insurer_id['insurer_id'],
'description' => $description,
'transaction_type' => 'Debit',
'updated_by' => $arrayData['user_id'],
'is_active' => 1,
];
$response = DepositHelper::saveDeposit($data, $arrayData['user_id']);
return true;
// print_r($response);
// $query = $this->employeePolicyModel->getLastQuery();
// echo $query . "<br>";
} else {
return 0;
@ -3815,32 +3832,49 @@ class EmpDataServiceController extends BaseController
if (!empty($arrayData)) {
$amount = $this->employeePolicyModel->query("
SELECT SUM(rata_premimum + gst) AS total_sum
FROM employee_polices
WHERE id IN (" . implode(',', $arrayData['employeeIds']) . ")
")->getRow();
$client_branch_data = $this->clientBranchModel->where('id', $arrayData['client_branch_id'])->first();
$units = json_decode($client_branch_data['units']);
$insurer_id = $this->clientPolicyModel->where('id', $arrayData['client_policy_id'])->first();
$description = 'The following amount of ' . round($amount->total_sum, 2) . ' has been credited for the ' . $arrayData['count'] . ' employees at ' . remove_underscore_capitalize_first_letter($arrayData['event']) . ' to ' . remove_underscore_capitalize_first_letter($arrayData['policy_name']) . '.';
foreach($units as $unit)
{
$data = [
$amount = $this->employeePolicyModel->query("
SELECT SUM(rata_premimum + gst) AS total_sum
FROM employee_polices
JOIN employees ON employees.id = employee_polices.employee_id
WHERE employees.unit = '$unit'
AND id IN (" . implode(',', $arrayData['employeeIds']) . ")
")->getRow();
if($amount){
$insurer_id = $this->clientPolicyModel->where('id', $arrayData['client_policy_id'])->first();
$description = 'The following amount of ' . round($amount->total_sum, 2) . ' has been credited for the ' . $arrayData['count'] . ' employees at ' . remove_underscore_capitalize_first_letter($arrayData['event_name']) . ' to ' . remove_underscore_capitalize_first_letter($arrayData['policy_name']) . '.';
$data = [
'amount' => $amount->total_sum,
'sub_type_id' => 4,
'client_id' => $arrayData['client_id'],
'client_policy_id' => $arrayData['client_policy_id'],
'endorsement_no' => $arrayData['endorsement_no'] ?? null,
'cd_ac_no' => $arrayData['cd_ac_no'] ?? null,
'insurer_id' => $insurer_id['insurer_id'],
'unit' => $unit,
'description' => $description,
'transaction_type' => 'Debit',
'updated_by' => $arrayData['user_id'],
'event_name' => $arrayData['event_name'],
'is_active' => 1,
];
$response = DepositHelper::saveDeposit($data, $arrayData['user_id']);
}
}
$msg = "SI Enhancement Cash Deposite Updated Successfully ";
return [$msg];
'amount' => $amount->total_sum,
'sub_type_id' => 4,
'client_id' => $arrayData['client_id'],
'client_policy_id' => $arrayData['client_policy_id'],
'endorsement_no' => $arrayData['endorsement_no'] ?? null,
'cd_ac_no' => $arrayData['cd_ac_no'] ?? null,
'insurer_id' => $insurer_id['insurer_id'],
'description' => $description,
'transaction_type' => 'Debit',
'updated_by' => $arrayData['user_id'],
'is_active' => 1,
];
$response = DepositHelper::saveDeposit($data, $arrayData['user_id']);
$msg = "SI Enhancement Cash Deposite Updated Successfully -- " . $description;
return [$msg, $response];
// print_r($response);
// $query = $this->employeePolicyModel->getLastQuery();
// echo $query . "<br>";
@ -3858,34 +3892,46 @@ class EmpDataServiceController extends BaseController
// echo '<pre>';
// print_r($arrayData); die;
$amount = $this->employeePolicyModel->query("
SELECT SUM(rata_premimum + gst) AS total_sum
FROM employee_polices
WHERE id IN (" . implode(',', $arrayData['employeeIds']) . ")
")->getRow();
$insurer_id = $this->clientPolicyModel->where('id', $arrayData['client_policy_id'])->first();
$description = 'The following amount of ' . round($amount->total_sum, 2) . ' has been credited for the ' . $arrayData['count'] . ' employees at ' . remove_underscore_capitalize_first_letter($arrayData['event']) . ' to ' . remove_underscore_capitalize_first_letter($arrayData['policy_name']) . '.';
$client_branch_data = $this->clientBranchModel->where('id', $arrayData['client_branch_id'])->first();
$units = json_decode($client_branch_data['units']);
$data = [
foreach($units as $unit) {
'amount' => $amount->total_sum,
'sub_type_id' => 3,
'client_id' => $arrayData['client_id'],
'client_policy_id' => $arrayData['client_policy_id'],
'endorsement_no' => $arrayData['endorsement_no'] ?? null,
'cd_ac_no' => $arrayData['cd_ac_no'] ?? null,
'insurer_id' => $insurer_id['insurer_id'],
'description' => $description,
'transaction_type' => 'Credit',
'updated_by' => $arrayData['user_id'],
'is_active' => 1,
];
$response = DepositHelper::saveDeposit($data, $arrayData['user_id']);
$msg = "Deletion Cash Deposite Updated Successfully -- " . $description;
return [$msg, $response];
$amount = $this->employeePolicyModel->query("
SELECT SUM(rata_premimum + gst) AS total_sum
FROM employee_polices
JOIN employees ON employees.id = employee_polices.employee_id
WHERE employees.unit = '$unit'
AND id IN (" . implode(',', $arrayData['employeeIds']) . ")
")->getRow();
if($amount){
return true;
$insurer_id = $this->clientPolicyModel->where('id', $arrayData['client_policy_id'])->first();
$description = 'The following amount of ' . round($amount->total_sum, 2) . ' has been credited for the ' . $arrayData['count'] . ' employees at ' . remove_underscore_capitalize_first_letter($arrayData['event_name']) . ' to ' . remove_underscore_capitalize_first_letter($arrayData['policy_name']) . '.';
$data = [
'amount' => $amount->total_sum,
'sub_type_id' => 3,
'client_id' => $arrayData['client_id'],
'client_policy_id' => $arrayData['client_policy_id'],
'endorsement_no' => $arrayData['endorsement_no'] ?? null,
'cd_ac_no' => $arrayData['cd_ac_no'] ?? null,
'insurer_id' => $insurer_id['insurer_id'],
'description' => $description,
'transaction_type' => 'Credit',
'updated_by' => $arrayData['user_id'],
'event_name' => $arrayData['event_name'],
'is_active' => 1,
];
$response = DepositHelper::saveDeposit($data, $arrayData['user_id']);
}
}
$msg = "Deletion Cash Deposite Updated Successfully -- ";
return [$msg];
// print_r($response);
// $query = $this->employeePolicyModel->getLastQuery();
// echo $query . "<br>";
@ -4062,12 +4108,9 @@ class EmpDataServiceController extends BaseController
return $result;
}
// -----------------------------------------------------------------------------------
public function readExcelToArray($file)
{
if ($file->isValid() && !$file->hasMoved()) {
@ -4102,8 +4145,6 @@ class EmpDataServiceController extends BaseController
}
}
public function insertBatchFileAndBatchListForImportExcel($data, $ids)
{
@ -4126,7 +4167,6 @@ class EmpDataServiceController extends BaseController
return true;
}
public function sendMailForDownloadingECard(array $ids)
{
@ -4283,7 +4323,6 @@ class EmpDataServiceController extends BaseController
public function getDataByFileId($file_id, $status = 'success')
{
$data = $this->batchFileModel
->select('batch_files.*, clients.client_name, clients.short_name, policy_type.policy_type as policy_name, client_branch.branch_name')
->join('clients', 'clients.id = batch_files.client_id')
@ -4293,7 +4332,6 @@ class EmpDataServiceController extends BaseController
->where('batch_files.id', $file_id)
->first();
if($status == 'success'){
$msg_txt = $data['client_name'] . '( ' . $data['branch_name'] . ' )' . ' - ' . $data['policy_name'] . ' - ' . $data['event_type'] . ' - ' . $data['actions'] . ' - ' . $data['insurer_or_tpa'];
@ -4313,8 +4351,6 @@ class EmpDataServiceController extends BaseController
public function setPullNotification($data)
{
$array = ['message_text' => $data['msg_txt'], 'action_url' => $data['url'], 'msg_status' => $data['status'], 'msg_title' => $data['title']];
$jsonEncodeData = json_encode($array);
@ -4327,66 +4363,37 @@ class EmpDataServiceController extends BaseController
'message_type' => '1to1',
];
$this->messageModel->insert($msg_data);
}
public function updatajson()
{
// $columns = [
// ["column_index" => 0, "column_name" => "MEMBERID / EMPID", "db_column_name" => "emp_code"],
// ["column_index" => 1, "column_name" => "UHID", "db_column_name" => "uhid"],
// ["column_index" => 2, "column_name" => "GRADE", "db_column_name" => null],
// ["column_index" => 0, "column_name" => "SR NO", "db_column_name" => 'index'],
// ["column_index" => 1, "column_name" => "EmployeeId", "db_column_name" => "emp_code"],
// ["column_index" => 2, "column_name" => "UHID", "db_column_name" => "uhid"],
// ["column_index" => 3, "column_name" => "DOJ", "db_column_name" => "emp_doj"],
// ["column_index" => 4, "column_name" => "INSURED NAME", "db_column_name" => "insured_name"],
// ["column_index" => 5, "column_name" => "ADDRESS 1", "db_column_name" => null],
// ["column_index" => 6, "column_name" => "ADDRESS 2", "db_column_name" => null],
// ["column_index" => 7, "column_name" => "CITY", "db_column_name" => null],
// ["column_index" => 8, "column_name" => "STATE", "db_column_name" => null],
// ["column_index" => 9, "column_name" => "PINCODE", "db_column_name" => null],
// ["column_index" => 10, "column_name" => "Age", "db_column_name" => "emp_age"],
// ["column_index" => 11, "column_name" => "DOB", "db_column_name" => "emp_dob"],
// ["column_index" => 12, "column_name" => "RELATION SHIP", "db_column_name" => "emp_relationship"],
// ["column_index" => 13, "column_name" => "Gender", "db_column_name" => "emp_gender"],
// ["column_index" => 14, "column_name" => "DOC", "db_column_name" => "doc"],
// ["column_index" => 15, "column_name" => "DOE", "db_column_name" => "doe"],
// ["column_index" => 16, "column_name" => "SUM INSURED", "db_column_name" => "basic_cover_si"],
// ["column_index" => 17, "column_name" => "PROPOSER NAME", "db_column_name" => null],
// ["column_index" => 18, "column_name" => "DOS", "db_column_name" => "dos"],
// ["column_index" => 19, "column_name" => "MOBILE NO", "db_column_name" => null],
// ["column_index" => 20, "column_name" => "EMAIL ID", "db_column_name" => null],
// ["column_index" => 21, "column_name" => "FATHER/HUSBAND NAME", "db_column_name" => null],
// ["column_index" => 22, "column_name" => "REMARKS", "db_column_name" => null],
// ["column_index" => 23, "column_name" => "FLAG STATUS", "db_column_name" => "flag_status"],
// ["column_index" => 24, "column_name" => "EXCEPTIONS", "db_column_name" => "exceptions"],
// ["column_index" => 25, "column_name" => "ABHA", "db_column_name" => null]
// ];
// $columns = [
// ["column_index" => 0, "column_name" => "Sr.No", "db_column_name" => "index"],
// ["column_index" => 1, "column_name" => "Tata Aig Ref. No", "db_column_name" => "uhid"],
// ["column_index" => 2, "column_name" => "EMP ID", "db_column_name" => "emp_code"],
// ["column_index" => 3, "column_name" => "Name of Insured", "db_column_name" => "emp_name"],
// ["column_index" => 4, "column_name" => "GC Current Details", "db_column_name" => "old_value"],
// ["column_index" => 5, "column_name" => "Modified Details", "db_column_name" => "new_value"],
// ["column_index" => 6, "column_name" => "Revision W.E.F (DD/MM/YYYY)", "db_column_name" => null],
// ["column_index" => 7, "column_name" => "NEW TTD", "db_column_name" => null],
// ["column_index" => 8, "column_name" => "New Category's", "db_column_name" => null],
// ["column_index" => 9, "column_name" => "Remarks", "db_column_name" => "remarks"],
// ["column_index" => 10, "column_name" => "DOC", "db_column_name" => null],
// ["column_index" => 11, "column_name" => "Errors", "db_column_name" => null]
// ["column_index" => 4, "column_name" => "Name OF Insured", "db_column_name" => "emp_name"],
// ["column_index" => 5, "column_name" => "Age", "db_column_name" => "emp_age"],
// ["column_index" => 6, "column_name" => "Gender", "db_column_name" => "emp_gender"],
// ["column_index" => 7, "column_name" => "DOC", "db_column_name" => null],
// ["column_index" => 8, "column_name" => "TOTALSI", "db_column_name" => "basic_cover_si"],
// ["column_index" => 9, "column_name" => "DOS", "db_column_name" => "dateofexit"],
// ["column_index" => 10, "column_name" => "Mobile", "db_column_name" => 'emp_mobile'],
// ["column_index" => 11, "column_name" => "EmailID", "db_column_name" => 'emp_email_c'],
// ["column_index" => 12, "column_name" => "REMARKS", "db_column_name" => "remarks"],
// ["column_index" => 13, "column_name" => "FLAG STATUS", "db_column_name" => null],
// ["column_index" => 14, "column_name" => "EXCEPTIONS", "db_column_name" => null],
// ["column_index" => 15, "column_name" => "ABHA", "db_column_name" => null]
// ];
// $json = json_encode($columns);
// $this->excelExportTemplateModel->where('id', 31)->set('jsoncolumns', $json)->update();
// $this->excelExportTemplateModel->where('id', 37)->set('jsoncolumns', $json)->update();
}
}

View File

@ -7,6 +7,8 @@ use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Helpers\DepositHelper;
use App\Models\EmployeeModel;
use App\Models\EmployeePolicyModel;
@ -21,6 +23,7 @@ use App\Models\ClientPolicyModel;
use App\Models\TPAModel;
use App\Models\InsurerExcelExportTemplateModel;
use App\Models\InsurerModel;
use App\Models\ClientDepositModel;
use App\Controllers\Jobs;
@ -58,6 +61,7 @@ class EmployeeController extends AdminController
protected $policiesModel;
protected $excelExportTemplateModel;
protected $insurerModel;
protected $cashDepositModel;
public function __construct()
{
@ -76,13 +80,14 @@ class EmployeeController extends AdminController
$this->TPAModel = new TPAModel();
$this->policiesModel = new PolicesModel();
$this->insurerModel = new InsurerModel();
$this->cashDepositModel = new ClientDepositModel();
}
public function list()
{
// $model = new UserModel();
$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())) {
$filterData = $this->request->getGet();
$data['employees'] = $this->employeePolicyModel->getEmployeePolicy(
@ -247,7 +252,7 @@ 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'];
//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'];
@ -433,7 +438,7 @@ class EmployeeController extends AdminController
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);
@ -555,7 +560,7 @@ class EmployeeController extends AdminController
$batch_data['status'] = 'pending';
$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);
@ -818,7 +823,6 @@ class EmployeeController extends AdminController
return redirect()->to(base_url('/employee/upload'));
}
public function downloadFileList($file_id = null)
{
// $actionType = $this->request->getGet();
@ -852,7 +856,6 @@ class EmployeeController extends AdminController
}
}
public function featchEmpList()
{
$client_id = $this->request->getGet('client_id');
@ -864,7 +867,6 @@ class EmployeeController extends AdminController
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => $html], 200);
}
public function viewUploadedEmployeeList()
{
@ -913,7 +915,6 @@ class EmployeeController extends AdminController
}
}
public function getEmpCount($id = null)
{
@ -928,7 +929,6 @@ class EmployeeController extends AdminController
}
public function downloadFullExcelErrorFile($file_id, $rowIndex = 1, $colIndex = 1)
{
// Get file data from the database
@ -1162,115 +1162,56 @@ class EmployeeController extends AdminController
{
// $this->loadLayout('ecard_template/default_ecard');
$empDataServiceController = new EmpDataServiceController();
$file_name = generate_filename("TCS", 'inception', 'export', 'insurer', 'policy', 'branch');
$export_data = [
'client_id' => 12,
'client_policy_id' => 12,
'client_branch_id' => 1,
'insurer_or_tpa' => 'insurer',
'event_type' => 'inception',
'actions' => 'export',
'file_name' => $file_name,
];
$template_json = $this->clientPolicyModel
->select('insurer_excel_export_template.jsoncolumns')
->join('insurer_excel_export_template', 'insurer_excel_export_template.insurer_id = client_policy.insurer_id and insurer_excel_export_template.policy_type_id = client_policy.policy_type_id')
->where('client_policy.id', $export_data['client_policy_id'])
->where('insurer_excel_export_template.event_name', $export_data['event_type'])
->where('insurer_excel_export_template.type_name', $export_data['actions'])
->first();
$template_array = json_decode($template_json['jsoncolumns'], true);
// dd($template_array);
$objects = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($export_data);
$totals = 0;
foreach ($objects as $item) {
$totals += $item->total;
}
dd($objects, $totals);
$excel_data_info = generate_insurer_based_excel($template_array, $objects);
// Generate Excel file
$tempFile = tmpfile();
$success = generate_excel($excel_data_info['header'], $excel_data_info['data'], $tempFile, 1);
// If Excel generation is successful
if ($success) {
$random_number_count = 4;
$export_data['batch_code'] = generate_random_string($random_number_count);
$export_data['created_by'] = get_session_userid();
$insert = $this->batchFileModel->insert($export_data);
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
$batch_code = $batch_file_batch_code['batch_code'];
// $this->insertBatchList(['batch_code' => $batch_code, 'batch_list_data' => $objects ]);
$job_details = new Jobs();
$r = Jobs::addJob(['job_name' => 'insertBatchList', 'payload' => ['batch_code' => $batch_code, 'user_id' => get_session_userid(), 'batch_list_data' => $objects]]);
// If batch operation is successful
if (true) {
// Clear the output buffer to avoid any unwanted output
if (ob_get_level()) {
ob_end_clean();
}
// Set headers for Excel file download
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment; filename="' . $export_data['file_name'] . '"');
header('Content-Transfer-Encoding: binary');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Expires: 0');
// Output file contents
rewind($tempFile);
fpassthru($tempFile);
// Close and remove temporary file
fclose($tempFile);
return true; // Excel file successfully generated and exported
} else {
return false; // Batch operation failed
}
}
$data = [
'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,
];
$empDataServiceController = new EmpDataServiceController();
$empData= $empDataServiceController->cashDepositCalculationForInception($data);
}
public function truncateFileData() //truncateFileDataIn DB (de activate rows)
//truncateFileDataIn DB (de activate rows)
public function truncateFileData($file_id, $role_id = null)
{
$file_id = $this->request->uri->getSegment(3);
// $file_id = 112;
$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';
// $result = [];
// !dd($file);
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']);
// ~dd($result);
if (count($result)) {
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'File data already processed'], 200);
if (count($result) && $role_id == null) {
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 {
//update emp and emp plocies
@ -1283,9 +1224,30 @@ class EmployeeController extends AdminController
//update file status
$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);
}
} else if ($file['action'] == 'si_enhancement' || $file['action'] == 'correction' || $file['action'] == 'deletion') {
$res = $this->empEndorsementModel->select(['count(id) as count'])
->where('emp_endorsement.file_id', $file_id)
->groupStart()
@ -1294,18 +1256,48 @@ class EmployeeController extends AdminController
->groupEnd()
->get()
->getResult();
// print_r($this->empEndorsementModel->getLastQuery());
// 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
$this->empEndorsementModel->where('file_id', $file_id)
->set(['status' => 'truncated'])
->update();
//update file status
$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);
} 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);
}
}
}
}

View File

@ -954,7 +954,7 @@ class EmployeeRestController extends AdminController
public function getEmployeePolicy()
{
// try {
try {
$id = $this->request->getGet('id');
$emp_code = $this->request->getGet('emp_code');
@ -1114,21 +1114,21 @@ class EmployeeRestController extends AdminController
// Add family floter buttons placement data for FE validation
if(count($floters)){
foreach ($floters as $familyFloatesValue) {
foreach ($floters as $familyFloatesValue) {
$temp2['is_value_exist'] = false;
$temp2['data']['family_floater_key'] = $familyFloatesValue;
$temp2['data']['client_policy_id'] = $array->ClientPolicyId;
$temp2['data']['button_name'] = 'Add '.ucfirst(str_replace('_', ' ', preg_replace('/\d/', '', $familyFloatesValue)));
$temp2['data']['form_type'] = preg_replace('/\d/', '', $familyFloatesValue);
$temp2['data']['age_validation'] = $this->getAgeRange($decodedArray,$familyFloatesValue);
$temp2['is_value_exist'] = false;
$temp2['data']['family_floater_key'] = $familyFloatesValue;
$temp2['data']['client_policy_id'] = $array->ClientPolicyId;
$temp2['data']['button_name'] = 'Add '.ucfirst(str_replace('_', ' ', preg_replace('/\d/', '', $familyFloatesValue)));
$temp2['data']['form_type'] = preg_replace('/\d/', '', $familyFloatesValue);
$temp2['data']['age_validation'] = $this->getAgeRange($decodedArray,$familyFloatesValue);
array_push($data,$temp2);
array_push($data,$temp2);
}
}
}
$array->mapped_family_floaters = $data;
$array->type = "Group Medical Coverage";
@ -1164,9 +1164,9 @@ class EmployeeRestController extends AdminController
}else{
return $this->respond(['status' => 'failed','code' => 404,'data' => []], 200);
}
// } catch (\Exception $e) {
// return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
// }
} catch (\Exception $e) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
}
}
@ -1178,6 +1178,7 @@ class EmployeeRestController extends AdminController
->where('client_branch_id',$client_branch_id)
->where('is_active', 1 )
->where('is_addon_value',0)->findAll();
// return $employeeData;
foreach ($GmcParrentsPolicy as $key => $array) {
@ -1241,6 +1242,7 @@ class EmployeeRestController extends AdminController
// Convert familyFloaters terms data to plain array
$floters = $this->FloterConvertion($familyFloates);
$data = [];
foreach ($floters as $familyFloatesValue) {
$dependent = preg_replace('/\d/', '', $familyFloatesValue);
@ -1363,8 +1365,10 @@ class EmployeeRestController extends AdminController
$result = ' ';
foreach ($array as $key => $value) {
if ($value > 0) {
if($value != 0 && $key ==='either-parents-pil') {
if($value == 1 && $key ==='either-parents-pil') {
$result .= ' + Either 2 Parents or 2 Parents in law';
}if($value == 2 && $key ==='either-parents-pil') {
$result .= ' + Any 2 of Parents and Parents in law';
}else if($value != 0 && $key ==='spouse') {
$string = str_replace('-', ' ', $key);
$string = ucwords($string);
@ -1373,15 +1377,29 @@ class EmployeeRestController extends AdminController
$result = 'Can Add Self ';
}else if($value != 0 && $key ==='childrens') {
if($value > 1){ $result .= ' + '.$value.' Children'; }else{ $result .= ' + '.$value.' Child'; }
}else if($value != 0 && $key ==='elders_count') {
}else{
$string = str_replace('-', ' ', $key);
$string = ucwords($string);
$result .= ' + '.$value.' '.$string;
}
}
}
$first_two_chars = substr($result, 0, 3);
if($first_two_chars == " +"){
$modified_string = substr($result, 3);
return "Can Add ".$modified_string;
}else{
return $result;
}
return substr($result, 0, 2) !== " +";
return $result;
}
public function getClientDetails()
@ -1874,7 +1892,7 @@ class EmployeeRestController extends AdminController
{
$transformed_famility_details = transform_db_data_to_excel($family);
// print_r($transformed_famility_details);die();
$data = calculate_premimum($transformed_famility_details,$policy_terms,$slab_details,$file,$default_si);
$data = calculate_premium($transformed_famility_details,$policy_terms,$slab_details,$file,$default_si);
// dd($data);
$employee_data_group_by_family[$emp_id] = $data;
@ -2404,7 +2422,8 @@ class EmployeeRestController extends AdminController
$firebase->send($message);
return $this->response->setJSON(['status' => 'success']);
} catch (MessagingException $e) {
return $this->response->setJSON(['status' => 'error', 'message' => $e->getMessage()]);
//return $this->response->setJSON(['status' => 'error', 'message' => $e->getMessage()]);
log_message('error', $e->getMessage());
}
}

View File

@ -161,7 +161,7 @@ class EmployeeServiceController extends AdminController
'format' => null,
'allowed_values' => null,
'custom' => 'check_si',
'params' => ['row', 'policy_terms', 'slab_details']
'params' => ['row', 'policy_details', 'slab_details']
],
'doc' => [
'col_idx' => 7,
@ -1496,17 +1496,43 @@ class EmployeeServiceController extends AdminController
if(!count($existing_endorsements))
{
//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)
{
if($slab_value['si'] == $row[3])
if($pre_rack_rate_name != $slab_value['rack_rate_name'])
{
$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' => $slab_value['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']);
break;
$pre_rack_rate_name = $slab_value['rack_rate_name'];
$rack_rate_json = json_decode($slab_value['additional_relationship']);
if(in_array(strtolower($employee['relationship']), $rack_rate_json) && $rack_rate_json[ strtolower($employee['relationship']) ] != 0 && $rack_rate_json[ strtolower($employee['relationship']) ] != NA)
{
$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']);
}
@ -1522,109 +1548,114 @@ class EmployeeServiceController extends AdminController
// insert or update in db for inception addition depent addition
public function employeesOnboardProcess($params)
public function employeesOnboardProcess($params)
{
$familiy_data = $params['familiy_data'];
$file = $params['file'];
foreach($familiy_data as $fkey => $value)
{
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(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(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')
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)
{
$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']);
$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(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
}
else{ $emp_policy_id = $employee_policy[0]['id']; }
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);
$this->myLogger->logme('error',$log_message);
}// if end
}// for end
}// is array check end
}// for end
}//function end

View File

@ -1062,10 +1062,9 @@ class MasterController extends AdminController
//start CD Master list
public function CDMasterList()
{
$data['CD_Master_Data'] = $this->CDMasterModel->getCDMasterList();
$data['insurers'] = $this->insurerModel->findAll();
$data['clients'] = $this->clientModel->findAll();
$data['insurers'] = $this->insurerModel->where('is_active', 1)->findAll();
$data['clients'] = $this->clientModel->where('is_active', 1)->findAll();
$this->loadLayout('cd_master_list', $data);
}
@ -1087,6 +1086,7 @@ class MasterController extends AdminController
'insurer_id' => $data['insurer_id'],
'description' => 'opening Amount',
'transaction_type' => 'Credit',
'event_name' => null,
'updated_by' => 1,
];
@ -1157,7 +1157,12 @@ class MasterController extends AdminController
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']));
if ($cd_data) {
@ -1169,7 +1174,10 @@ class MasterController extends AdminController
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){
return $this->respond(['status' => true, 'message' => 'The CD Account Number is Already Exist', 'code' => 200], 200);
@ -1184,7 +1192,18 @@ class MasterController extends AdminController
$this->myLogger->logme('error','CDMaster Remove function called');
$data['updated_by'] = get_session_userid();
$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){
return $this->respond(['status' => true,'code' => 200], 200);
}else{

View File

@ -7,7 +7,6 @@ use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Helpers\DepositHelper;
use App\Helpers\MailHelper;
use App\Helpers\sendMailNotification;
@ -43,10 +42,10 @@ class PendingActionsController extends AdminController
public function __construct()
{
//section
//session
set_session_context('PendingActionsController Called');
//services
//log services
$this->myLogger = \Config\Services::mylogger();
$this->db = \Config\Database::connect();
@ -60,7 +59,7 @@ class PendingActionsController extends AdminController
$this->empEndorsementModel = new EmpEndorsementModel();
}
//for AJAX
public function getPendingActions()
{
//get pending actions like inception, corrections,deletions,SI enhanccnement to users
@ -71,12 +70,144 @@ class PendingActionsController extends AdminController
$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];
$data = ['inception' => $inception, 'correction' => $correction, 'si_enhancement' => $si_enhancement, 'deletion' => $deletion, 'tpa' => $tpa, 'uhid' => $uhid, 'policy' => $PolicyRenewalData];
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()
@ -121,7 +252,6 @@ class PendingActionsController extends AdminController
return $results;
}
public function getPendingActionForCorrection()
{
@ -152,6 +282,7 @@ class PendingActionsController extends AdminController
clients.id as client_id,
client_branch.id as branch_id,
client_branch.branch_name,
policy_type.policy_type as policy_name,
emp_endorsement.id,
emp_endorsement.pk,
emp_endorsement.endorsement_id,
@ -161,10 +292,20 @@ class PendingActionsController extends AdminController
emp_endorsement.actions,
emp_endorsement.name,
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('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')
->where([
'emp_endorsement.actions' => 'c',
@ -195,14 +336,16 @@ class PendingActionsController extends AdminController
$results = $query->getResultArray();
$filteredResults = array_filter($results, function ($value) {
return $value['subquery_count'] != 0;
});
$filteredResults = [];
foreach ($results as $value) {
if ($value['subquery_count'] != 0) {
$filteredResults[] = $value;
}
}
return $filteredResults;
}
public function getPendingActionForSIEnhancement()
{
@ -282,14 +425,16 @@ class PendingActionsController extends AdminController
$results = $query->getResultArray();
$filteredResults = array_filter($results, function ($value) {
return $value['subquery_count'] != 0;
});
$filteredResults = [];
foreach ($results as $value) {
if ($value['subquery_count'] != 0) {
$filteredResults[] = $value;
}
}
return $filteredResults;
}
public function getPendingActionForDeletion()
{
@ -369,14 +514,16 @@ class PendingActionsController extends AdminController
// Fetch the results
$results = $query->getResultArray();
$filteredResults = array_filter($results, function ($value) {
return $value['subquery_count'] != 0;
});
$filteredResults = [];
foreach ($results as $value) {
if ($value['subquery_count'] != 0) {
$filteredResults[] = $value;
}
}
return $filteredResults;
}
public function getPendingActionForUHIDEmpty()
{
// Subquery for batch_export_count
@ -425,7 +572,6 @@ class PendingActionsController extends AdminController
return $results;
}
public function getPendingActionForTPAIDEmpty()
{
@ -483,4 +629,86 @@ class PendingActionsController extends AdminController
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()
{
}
}

View File

@ -125,14 +125,12 @@ class RestAuthenticationController extends AdminController
{
try {
$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();
if ($HrData) {
$id= $HrData["id"];
$otp = $this->hrModel->where('id', $id)->set('otp', $randomNumber)->update();
$result = ['user_verification' => true ,'message' => "Verified Successfully", 'otp'=>$randomNumber];
$result = ['user_verification' => true ,'message' => "Verified Successfully"];
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
} else {
$result = ['user_verification' => false , 'message' => "User not found"];
@ -149,10 +147,10 @@ class RestAuthenticationController extends AdminController
{
try {
$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();
if ($hrData && $otp == $hrData["otp"]) {
if ($hrData && $otp_verification == true) {
$auth = HttpRequestHelper::getRequestInfo();
if ($auth) {
$data = [
@ -163,10 +161,10 @@ class RestAuthenticationController extends AdminController
'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')
->join('client_branch', 'level_contacts.ref_id = client_branch.id', 'left')
@ -174,7 +172,7 @@ class RestAuthenticationController extends AdminController
->find();
$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 {
return $this->respond(['status' => 'failed','code' => 404,'data' => "Invalid OTP"],200);
}

View File

@ -54,7 +54,9 @@ class DepositHelper
'cd_ac_no' => $data['cd_ac_no'],
'endorsement_no' => $data['endorsement_no'],
'insurer_id' => $data['insurer_id'],
'unit' => $data['unit'] ?? null,
'description' => $data['description'],
'event_name' => $data['event_name'],
'transaction_type' => $data['transaction_type'],
'is_active' => 1,
'created_by' => $loggedInUserID,

View File

@ -225,11 +225,19 @@ if(!function_exists('check_employee_band'))
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' => '');
$is_si_found = false;
$is_age_slab_found = false;
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];
@ -868,25 +876,11 @@ if (!function_exists('calculate_premium'))
if (!function_exists('calculate_premium_new'))
{
function calculate_premium_new(array $family_data,array $policy_terms,array $slab_details,array $fileArr,string $default_si = null,array $existing_units)
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 = [];
$pre_name = '';
$pre_grid_master = [];
foreach ($slab_details 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;
}
$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);
@ -899,8 +893,8 @@ if (!function_exists('calculate_premium_new'))
{
// dd($slab);
$res = compare_incoming_family_slab_with_configured_slab($slab,$incoming_familiy_composition);
kint::dump($key);
kint::dump($res);
// kint::dump($key);
// kint::dump($res);
if($res['is_applicable'])
{
@ -972,9 +966,9 @@ if (!function_exists('calculate_premium_new'))
// // 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;
}
@ -1041,6 +1035,7 @@ if (!function_exists('transform_excel_data_to_db'))
$result['temp'] = [];
if(isset($memArr['temp'])) $result['temp'] = array_merge($result['temp'],$memArr['temp']);
$result['temp']['grid_type'] = $actionArr['grid_info']['type'];
$result['temp']['band'] = $result['band'];
$result['temp']['grid_id'] = $actionArr['grid_info']['grid_id'];
$result['temp']['action'] = isset($memArr['current_action']) ? $memArr['current_action'] : $current_column_action;
$result['temp']['source'] = isset($memArr['temp']['source']) ? $memArr['temp']['source'] : 'excel';
@ -1062,7 +1057,7 @@ if (!function_exists('premium_calculation_manager'))
{
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();
// grid type
@ -1143,7 +1138,28 @@ if (!function_exists('premium_calculation_manager'))
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;
case "2":
//GPA - Flat Rate for all SI
@ -1905,8 +1921,8 @@ if(!function_exists('compare_incoming_family_slab_with_configured_slab'))
$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);
// kint::dump($incoming_familiy_composition);
// kint::dump($configured_familiy_composition);
unset($configured_familiy_composition['either-parents-pil']);
unset($configured_familiy_composition['elders_count']);
@ -2023,4 +2039,59 @@ if(!function_exists('check_unit'))
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;
}
}

View File

@ -42,7 +42,7 @@ class CDMasterModel extends Model
protected function checkAndADDCreatedByValue(array $data)
{
// Check if 'updated_by' value is null or empty
if (empty($data['data']['created_by'])) {
if (empty($data['data']['created_by'])) {
// Set 'updated_by' value to the current session user ID
$data['data']['created_by'] = get_session_userid();
}
@ -53,7 +53,7 @@ class CDMasterModel extends Model
protected function checkAndUpdateUpdatedByValue(array $data)
{
// Check if 'updated_by' value is null or empty
if (empty($data['data']['updated_by'])) {
if (empty($data['data']['updated_by'])) {
// Set 'updated_by' value to the current session user ID
$data['data']['updated_by'] = get_session_userid();
}
@ -65,31 +65,37 @@ class CDMasterModel extends Model
{
$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')
->join('clients', 'clients.id = cd_master.client_id')
->join('insurers', 'insurers.id = cd_master.insurer_id')
->join('user_profiles', 'user_profiles.id = cd_master.created_by')
->join(
'(SELECT cd_master.cd_ac_no, COUNT(client_policy.cd_ac_no) AS cd_ac_no_count
->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('insurers', 'insurers.id = cd_master.insurer_id')
->join('user_profiles', 'user_profiles.id = cd_master.created_by')
->join(
'(SELECT cd_master.cd_ac_no, COUNT(client_policy.cd_ac_no) AS cd_ac_no_count
FROM cd_master
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',
'cd_ac_counts.cd_ac_no = cd_master.cd_ac_no',
'left'
)
->join(
'(SELECT cd_master.cd_ac_no, COUNT(cash_deposit.cd_ac_no) AS cd_ac_no_count_cd_tranction
'cd_ac_counts.cd_ac_no = cd_master.cd_ac_no',
'left'
)
->join(
'(SELECT cd_master.cd_ac_no, COUNT(cash_deposit.cd_ac_no) AS cd_ac_no_count_cd_tranction
FROM cd_master
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',
'cd_ac_counts_for_cdt.cd_ac_no = cd_master.cd_ac_no',
'left'
)
->where('cd_master.is_active', 1)
->get();
'cd_ac_counts_for_cdt.cd_ac_no = cd_master.cd_ac_no',
'left'
)
->where('cd_master.is_active', 1)
->where('clients.is_active', 1)
->where('insurers.is_active', 1)
->where('user_profiles.is_active', 1)
->get();
$result = $query->getResultArray();
return $result;
}
}

View File

@ -25,6 +25,8 @@ class ClientDepositModel extends Model
"client_policy_id",
"cd_ac_no",
"endorsement_no",
"event_name",
"unit",
];

View File

@ -50,6 +50,7 @@ class ClientPolicyModel extends Model
"cd_ac_no",
"gst",
"enrolment_visibility",
"is_active",
];
public function getClientPolicyById($id){

View File

@ -190,4 +190,24 @@ class EmployeeModel extends Model
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;
}
}

View File

@ -130,7 +130,15 @@ class EmployeePolicyModel extends Model
$result->where('employee_polices.client_policy_id', $policy_id);
}
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)) {
$result->where('emp.emp_code', $emp_code);

View File

@ -50,9 +50,9 @@ class PolicesModel extends Model
{
// echo '2';
$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();

View File

@ -35,9 +35,9 @@ body {
</style>
<div class="row" id="client_add">
<div class="row" id="client_add" style="margin-top: -32px;">
<div class="col-12">
<div class="card">
<!-- <div class="card"> -->
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
@ -50,10 +50,10 @@ body {
<ul class="nav nav-pills navtab-bg">
<li class="nav-item">
<a href="#endorsement-dash-tab" data-toggle="tab" aria-expanded="false"
class="nav-link px-3 py-2 active" id="endorsement_tab">
<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">Endorsement</span>
<span class="d-none d-sm-inline-block">Pending Actions</span>
</a>
</li>
<li class="nav-item">
@ -64,13 +64,11 @@ body {
</li>
</ul>
<div class="tab-content">
<?php include('enrollment_dash.php'); ?>
<?php include('endorsement_dash.php'); ?>
<?php include('enrollment_dash.php'); ?>
<?php include('endorsement_dash.php'); ?>
</div>
</div>
</div>
<!-- </div> -->
</div>
</div>

View File

@ -57,17 +57,25 @@ table.dataTable thead th {
<td><?php echo date('d-M-Y h:i A', strtotime($row['created_at'])) ?> by
<?php echo $row['user_name']; ?></td>
<td>
<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 } ?>
<?php if($row['cd_ac_no_count'] > 0 && $row['cd_ac_no_count_cd_tranction'] > 1) {?>
<div class="btn-group dropdown">
<!-- <a href="javascript: void(0);"class="dropdown-toggle arrow-none btn btn-light btn-sm"aria-expanded="false"></i></a> -->
</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>
</tr>
<?php } ?>

View File

@ -216,6 +216,7 @@ $(document).ready(function() {
var branchTable = '';
var data = <?= isset($client_branch) ? json_encode($client_branch) : '[]' ?>;
console.log('branch data', data)
var role = data.role
delete data.role;
console.log(role)

View File

@ -8,7 +8,8 @@
<div class="row" style="padding-top: 20px;margin-bottom: 18px;">
<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 class="col-6">
@ -35,16 +36,15 @@
<div class="card-body" style="position: relative;bottom: 25px;">
<div class="row">
<!--
<div class="col-6">
<table>
<tr>
<td style="font-size: 18px;"> <strong> <?= $client['client_name'] ?> (
<?= $client['short_name'] ?> ) </strong></td>
<td style="font-size: 18px;"></td>
</tr>
</table>
</div>
</div> -->
<div class="col-6">
@ -62,18 +62,16 @@
<div class="row">
<div class="col-6">
<!-- <div class="col-6">
<table>
<tr>
<td style="padding: 3px;"><label>Address :</label>
<?= $client['address1'] ?> <br> <?= $client['address2'] ?></td>
<td style="padding: 3px;"></td>
</tr>
<tr>
<td style="padding: 3px;"><?= $client['city'] ?>, <?= $client['state'] ?> -
<?= $client['pincode'] ?></td>
<td style="padding: 3px;"></td>
</tr>
</table>
</div>
</div> -->
<div class="col-6">
<table>
@ -142,7 +140,7 @@
data-id="<?= htmlspecialchars($value['policy_terms']) ?>"
data-toggle="modal" data-target="#bs-example-modal-lg">
<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['tpa_short_name'] ?></td>
<td><?= $value['policy_start_date'] ?> / <?= $value['policy_end_date'] ?>

View File

@ -81,83 +81,91 @@ table.dataTable thead th {
<div id="append_client_info"></div>
<script>
$(document).ready(function(){
$(document).ready(function()
{
$('#tickets-table').DataTable({
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
buttons: [{
extend: 'csv',
text: 'CSV',
title: 'ClientList',
className: 'my_class',
exportOptions: {
columns: ':not(:last-child)'
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
buttons: [{
extend: 'csv',
text: 'CSV',
title: 'ClientList',
className: 'my_class',
exportOptions: {
columns: ':not(:last-child)'
},
}],
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
}],
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
},
paging: true ,
// pagingType: 'full_numbers'
});
paging: true ,
// pagingType: 'full_numbers'
});
})
function removeClient(element) {
function removeClient(element)
{
Swal.fire({
title: "Are you sure?",
text: "You need to remove this client.",
icon: "info",
showCancelButton: true,
confirmButtonColor: "#3085d6",
confirmButtonText: "Yes",
}).then((result) => {
title: "Are you sure?",
text: "You need to remove this client.",
icon: "info",
showCancelButton: true,
confirmButtonColor: "#3085d6",
confirmButtonText: "Yes",
}).then((result) => {
if (result.isConfirmed) {
var id = element.getAttribute('data-id');
var form_action = '<?= base_url("client/remove/") ?>' + id;
$.ajax({
url: form_action,
type: "GET",
dataType: 'json',
processData: false,
contentType: false,
success: function(res) {
// console.log(res.status == true);
if(res){
if (res.status == true) {
toastr.success('Client removed successfully.', 'success');
location.reload();
} else {
toastr.warning('Failed to remove client.', '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');
if (result.isConfirmed) {
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var id = element.getAttribute('data-id');
var form_action = '<?= base_url("client/remove/") ?>' + id;
$.ajax({
url: form_action,
type: "GET",
dataType: 'json',
processData: false,
contentType: false,
success: function(res) {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
if(res){
if (res.status == true) {
toastr.success('Client removed successfully.', 'success');
location.reload();
} else {
Swal.fire({
title: "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() {
$('.loader').fadeIn();

View File

@ -281,9 +281,12 @@
if (policy_PrimaryKey !== '') {
var policyTable = '';
var data = <?= isset($client_policy) ? json_encode($client_policy) : '[]' ?>;
// //console.log('client_policy_data',data)
data.forEach(function(item) {
// //console.log(item.open_for_enrollment);
console.log('client_policy_data',data)
var role = data.role
delete data.role;
$.each(data, function(index, item) {
console.log('step 1');
var patternGMC = /gmc/i; // Case insensitive pattern for 'gmc'
var patternGPA = /gpa/i; // Case insensitive pattern for 'gpa'
var subject = item.policy_type_name;
@ -330,27 +333,38 @@
var policy_name_data = `${item.policy_type_name ?? ''}` + ' - ' + `${item.policy_no ?? ''}`;
policyTable += `
<tr>
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
<td>${policy_name_data}</td>
<td>${item.branch_name ? item.branch_name : ' - '}</td>
<td>${tpaValue}</td>
<td>${(item.open_date)} / ${(item.close_date)}</td>
<td style="text-align: center;">${(enrollmentStatus)}</td>
<td>${checkDateStatus(item.close_date, 1)}</td>
<td>
<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">
<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>
policyTable += `
<tr>
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
<td>${policy_name_data}</td>
<td>${item.branch_name ? item.branch_name : ' - '}</td>
<td>${tpaValue}</td>
<td>${(item.open_date)} / ${(item.close_date)}</td>
<td style="text-align: center;">${(enrollmentStatus)}</td>
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
<td>
<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">
<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>
</td>
</tr>
`;
</td>
</tr>
`;
});
$('#policy_table').append(policyTable);
@ -481,7 +495,7 @@
contentType: false,
success: function(res) {
console.log(res);
console.log('client policy response', res);
$('#policy_form')[0].reset();
if (res.status === false) {
@ -508,7 +522,7 @@
$('#policy_table tr').remove();
var policyTable = '';
$.each(res.data, function(index, item) {
console.log(item);
var patternGMC = /gmc/i; // Case insensitive pattern for 'gmc'
var patternGPA = /gpa/i; // Case insensitive pattern for 'gpa'
var subject = item.policy_type_name;
@ -564,16 +578,17 @@
<td>${policy_name_data}</td>
<td>${item.branch_name}</td>
<td>${tpaValue}</td>
<td>${rearrangeDateFormat(item.open_date)} / ${rearrangeDateFormat(item.close_date)}</td>
<td>${rearrangeDateFormat(item.open_date)} / ${rearrangeDateFormat(item.close_date)}</td>
<td style="text-align: center;">${(enrollmentStatus)}</td>
<td>${checkDateStatus(item.close_date, 1)}</td>
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
<td>
<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">
<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>
<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>
</td>
@ -777,7 +792,6 @@
// $('#end_date').val(rearrangeDateFormat(res.data.policy_end_date));
$('#close_date').val(rearrangeDateFormat(res.data.close_date));
$('#reminder_date').val(rearrangeDateFormat(res.data.reminder_date));
$('#policy_status').val(checkDateStatus(res.data.policy_close_date));
$('#gst_no').val(gst);
$('#policy_status_field').show();
@ -1017,14 +1031,14 @@
//for date convert to indian formate like this 'yyyy-mm-dd' to this 'dd-mm-yyyy'
function rearrangeDateFormat(inputDate) {
if (inputDate !== null) {
var dateComponents = inputDate.split("-");
var rearrangedDate = dateComponents[2] + "-" + dateComponents[1] + "-" + dateComponents[0];
return rearrangedDate;
} else {
return '00-00-0000';
}
if (inputDate !== null) {
var dateComponents = inputDate.split("-");
var rearrangedDate = dateComponents[2] + "-" + dateComponents[1] + "-" + dateComponents[0];
return rearrangedDate;
} else {
return '00-00-0000';
}
}
function checkDateStatus(inputDate, bg = false) {
@ -1478,8 +1492,8 @@
$('#insurer').val(res.data.insurer_branch_id + '-' + res.data.insurer_id).change();
$('#tpa').val(res.data.tpa_branch_id + '-' + res.data.tpa_id).change();
$('#policy_no').val(res.data.policy_no).change();
$('#open_date').val(rearrangeDateFormat(res.data.open_date)).change();
$('#close_date').val(rearrangeDateFormat(res.data.close_date)).change();
// $('#open_date').val(rearrangeDateFormat(res.data.open_date)).change();
// $('#close_date').val(rearrangeDateFormat(res.data.close_date)).change();
}
},
@ -1592,7 +1606,8 @@
}
// append Base Policy to the dropdown for edit only
function appendBasePolicyList(data, select = null) {
function appendBasePolicyList(data, select = null)
{
console.log('appendBasePolicyList', 'function called');
console.log('appendBasePolicyList data', data);
@ -1619,4 +1634,65 @@
});
}
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>

View File

@ -1,4 +1,390 @@
<div class="tab-pane active show" id="endorsement-dash-tab">
<style>
<h1>Endorsement</h1>
</div>
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">&nbsp;<span class="f-right"></span></p>
<p class="m-b-1">&nbsp;<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">&nbsp;<span class="f-right"></span></p>
<p class="m-b-1">&nbsp;<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">&nbsp;<span class="f-right"></span></p>
<p class="m-b-1">&nbsp;<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>

View File

@ -93,26 +93,15 @@
class="mdi mdi-dots-horizontal"></i></a>
<div class="dropdown-menu dropdown-menu-right">
<?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']])) ?>"
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>
<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>
<?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"
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>
<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" 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>
<?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>
@ -256,6 +245,7 @@ $('body').on('click', '.upload_button', function() {
$('#file_upload_actions').val(fileId.action)
})
$('body').on('click', '.truncate', function(event) {
event.preventDefault();
// console.log(event);
@ -273,40 +263,29 @@ $('body').on('click', '.truncate', function(event) {
if (result.isConfirmed) {
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var apiURL = '<?php echo base_url(); ?>' + 'employee/truncate/' + fileId;
var apiURL = '<?php echo base_url(); ?>employee/truncate/' + fileId;
$.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);
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}, 1000);
if (response.code === 200 && response.dataStatus === true && response
.data !== "") {
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
Swal.fire({
title: "Deleted!",
// text: "Data from truncated",
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"
});
console.error('No data found', response);
handleNoDataFound(response, fileId);
} else {
Swal.fire({
title: "Failed!",
text: 'Something went wrong! Try later',
@ -324,13 +303,77 @@ $('body').on('click', '.truncate', function(event) {
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() {
@ -392,7 +435,6 @@ $('#uploadForm').submit(function() {
});
})
$('body').on('click', '.reload', function() {
console.log('status');

View File

@ -243,9 +243,6 @@
let PNCount = parseInt(localStorage.getItem('pullNotificationCount'));
let PACount = parseInt(localStorage.getItem('pendingActionCount'));
console.log('PNCount', PNCount);
console.log('PACount', PACount);
totalcount = PNCount + PACount
$('#notification_count').html(totalcount);
@ -319,30 +316,99 @@
}
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');
messagesList.empty();
console.log(response.inception)
console.log('correction', typeof response.inception)
if (response.inception) {
if (Array.isArray(response.inception)) {
response.inception.forEach(function(item, index) {
$.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">&times;</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);
});
} else {
console.log('response.inception is undefined or null');
}
if (response.correction) {
$.each(response.correction, 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,
actions: 'inception'
event: 'correction',
actions: 'export',
insurer_or_tpa: 'tpa',
};
const queryString = objectToQueryString(queryParams);
var url = 'employee/upload?' + queryString
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
////console.log(url)
@ -351,16 +417,101 @@
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
var toast_status_word = 'Info';
var title = 'Correction Pending';
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;
// 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">&times;</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}">
@ -373,7 +524,7 @@
</button>
</div>
<div class="toast-body" style="${toast_body_css}">
<strong>Inception Pending</strong><br><br>
<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>
@ -387,182 +538,17 @@
messagesList.append(html);
});
} else {
console.log('response.inception is not an array:', response.inception);
}
} else {
console.log('response.inception is undefined or null');
}
console.log(response.correction)
console.log('correction', typeof response.correction)
}
if (response.correction) {
if (Array.isArray(response.correction)) {
response.correction.forEach(function(item, index) {
if (item.batch_export_count == 0 || item.batch_import_count == 0) {
var queryParams = {
client_id: item.client_id,
client_branch_id: item.branch_id,
event: 'correction',
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 = 'Correction 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 = '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">&times;</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) {
if (Array.isArray(response.deletion)) {
response.deletion.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: '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">&times;</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.deletion is undefined or null');
}
if (response.si_enhancement) {
if (Array.isArray(response.si_enhancement)) {
response.si_enhancement.forEach(function(item, index) {
if (item.batch_export_count == 0 || item.batch_import_count == 0) {
$.each(response.si_enhancement, function(index, item) {
if (item.batch_export_count == 0 || item.batch_import_count == 0) {
var queryParams = {
@ -631,92 +617,88 @@
}
});
}
}else{
console.log('response.si_enhancement is undefined or null');
}
if (response.tpa) {
if (Array.isArray(response.tpa)) {
response.tpa.forEach(function(item, index) {
if (item.batch_export_count == 0 || item.batch_import_count == 0) {
$.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',
};
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);
const queryString = objectToQueryString(queryParams);
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
////console.log(url)
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';
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')) {
if (!item.branch_name.toLowerCase().includes('branch')) {
//console.log(item.branch_name)
item.branch_name += ' branch';
}
//console.log(item.branch_name)
item.branch_name += ' branch';
}
////console.log(item.branch_name);
////console.log(item.branch_name);
// if (item.batch_export_count > 0) {
// if (item.batch_export_count > 0) {
// title = 'TPA Import Pending';
// }
// title = 'TPA Import Pending';
// }
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
////console.log(toast_body_data);
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">&times;</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>
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">&times;</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>
</li>`
</div>
</li>`
messagesList.append(html);
messagesList.append(html);
}
});
}
}
});
}else{
console.log('response.tpa is undefined or null');
}
if (response.uhid) {
if (Array.isArray(response.uhid)) {
response.uhid.forEach(function(item, index) {
if (item.batch_export_count == 0 || item.batch_import_count == 0) {
$.each(response.uhid, function(index, item) {
if (item.batch_export_count == 0 || item.batch_import_count == 0) {
var queryParams = {
@ -731,7 +713,7 @@
const queryString = objectToQueryString(queryParams);
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
////console.log(url)
//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;';
@ -781,9 +763,8 @@
messagesList.append(html);
}
});
}
}
});
}else{
console.log('response.uhid is undefined or null');
}

View File

@ -557,56 +557,61 @@
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
<i class="fas fa-user-tie"></i>
<span class="badge badge-success badge-pill float-right">2</span>
<span> Members </span>
<span> Action on Policies </span>
</a>
<div class="collapse" id="sidebarDashboards">
<ul class="nav-second-level">
<li>
<a href="<?= base_url('/employee/upload') ?>">Upload</a>
<a href="<?= base_url('/employee/upload') ?>">View Inception</a>
</li>
<li>
<a href="<?= base_url('/employee/list') ?>">List</a>
<a href="<?= base_url('/employee/list') ?>">View Members</a>
</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') ?>">Enrollment List</a>
<a href="<?= base_url('/employee/enrollment-list') ?>">View Enrollment</a>
</li>
</ul>
</div>
</li>
<li>
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
<i class="ri-database-2-line"></i>
<span class="badge badge-success badge-pill float-right">2</span>
<span> Masters </span>
</a>
<div class="collapse" id="sidebarDashboards">
<ul class="nav-second-level">
<li>
<a href="<?= base_url('/master/insurer/list') ?>">Insurer</a>
</li>
<li>
<a href="<?= base_url('/master/tpa/list') ?>">TPA</a>
</li>
<li>
<a href="<?= base_url('/master/kyc/list') ?>">KYC</a>
</li>
<li>
<a href="<?= base_url('/master/policy/list') ?>">Policy</a>
</li>
<li>
<a href="<?= base_url('/master/cash_deposite/list') ?>">CD Master</a>
</li>
<li>
<a href="<?= base_url('/user/list') ?>"> Users </a>
</li>
</ul>
</div>
</li>
<?php if(get_role_id() == 1 || get_role_id() == 5) { ?>
<li>
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
<i class="ri-database-2-line"></i>
<span class="badge badge-success badge-pill float-right">2</span>
<span> Masters </span>
</a>
<div class="collapse" id="sidebarDashboards">
<ul class="nav-second-level">
<li>
<a href="<?= base_url('/master/insurer/list') ?>">Insurer</a>
</li>
<li>
<a href="<?= base_url('/master/tpa/list') ?>">TPA</a>
</li>
<li>
<a href="<?= base_url('/master/kyc/list') ?>">KYC</a>
</li>
<li>
<a href="<?= base_url('/master/policy/list') ?>">Policy</a>
</li>
<li>
<a href="<?= base_url('/master/cash_deposite/list') ?>">CD Master</a>
</li>
<li>
<a href="<?= base_url('/user/list') ?>"> Users </a>
</li>
</ul>
</div>
</li>
<?php } ?>
<li>
<?php
$sessionData = get_session_userdata();

View File

@ -1254,13 +1254,15 @@
<!-- Jodit RTE -->
<script>
$(document).ready(function() {
var editor = new Jodit('#additionalsicknessbenefit', {
$(document).ready(function()
{
var editor = new Jodit('#additionalsicknessbenefit',
{
buttons: 'bold,italic,underline,|,align,alignCenter,alignRight,alignJustify',
});
var editor = new Jodit('#Wellness', {
var editor = new Jodit('#Wellness',
{
buttons: 'bold,italic,underline,|,align,alignCenter,alignRight,alignJustify',
});
});
@ -1270,16 +1272,15 @@
<!-- Policy terms Add Special Condition -->
<script>
document.getElementById('myButtonSpecialCondition').addEventListener('click', function(event) {
document.getElementById('myButtonSpecialCondition').addEventListener('click', function(event)
{
//console.log('specialCondition callback clicked')
event.preventDefault();
specialCondition();
});
function specialCondition(count = 0) {
function specialCondition(count = 0)
{
//console.log('specialCondition function called')
@ -1307,12 +1308,11 @@
}
}
$(document).on('click', '.specialConditionClose', function() {
$(document).on('click', '.specialConditionClose', function()
{
$(this)[0].parentNode.parentNode.remove();
});
// Close the Policy terms
$(document).on('click', '#policyGMCTermsClose', function() {
$('#policyGMCTerms').css('display', 'none');
@ -1336,17 +1336,17 @@
// }
$('#self').change(function () {
$('#self').change(function ()
{
if ($(this).prop('checked')) {
$('.self-age').css('display','');
}else{
$('.self-age').css('display','none');
}
})
});
$('#spouse').change(function () {
$('#spouse').change(function ()
{
if ($(this).prop('checked')) {
$('.spouse-age').css('display','');
if($('#spouse_min_age').val() < 17 || $('#spouse_min_age').val() == '' ){
@ -1358,10 +1358,10 @@
}else{
$('.spouse-age').css('display','none');
}
})
});
$('#children').change(function () {
$('#children').change(function ()
{
if ($(this).val() != 0) {
$('.child-age').css('display','');
@ -1374,10 +1374,10 @@
}else{
$('.child-age').css('display','none');
}
})
});
$('#family_floaters').change(function () {
$('#family_floaters').change(function ()
{
checkAdditionPremiumJSON()
@ -1410,10 +1410,10 @@
}else if(family_floaters == '4EPORPIL'){
$('#member_count').val(4);
}
})
});
function lowerIsEighteen(params) {
function lowerIsEighteen(params)
{
var value = $(params).val();
if (value < 18) {
@ -1423,8 +1423,8 @@
}
}
function appendGMCSIAddMore(data = null){
function appendGMCSIAddMore(data = null)
{
console.log('function called')
@ -1450,13 +1450,14 @@
$('#gmc_si_add_more').append(html);
}
function removeGMCAdditionalSI(button) {
function removeGMCAdditionalSI(button)
{
console.log('remove clicked');
$(button).closest('.row').remove();
}
function checkAdditionPremiumJSON(){
function checkAdditionPremiumJSON()
{
var client_id = $('#Client_id').val();
var client_policy_id = $('#gmc_client_policy_id').val();
@ -1469,8 +1470,8 @@
console.log(response.data);
if (response.data > 0) {
console.log('Please change the additional premium relation');
Swal.fire("Please change the additional premium relation");
console.log('Any changes made in the policy term for family floater, please update the rack rate configuration.');
Swal.fire("Any changes made in the policy term for family floater, please update the rack rate configuration.");
}
console.log('outer');

View File

@ -37,7 +37,7 @@
<h4 class="modal-title" id="myLargeModalLabel">Rack Rate <span id="PolicyNameForTitle"></span></h4>
</div>
<div class="col-md-5" style="position: relative;left: 20px;" id="add_new_rack_rate_tab_div">
<button class="btn btn-info waves-effect waves-light mr-1 float-right" id="add_new_rack_rate_tab" onclick="appendNewTab()">Add Tab</button>
<button class="btn btn-info waves-effect waves-light mr-1 float-right" id="add_new_rack_rate_tab" onclick="appendNewTab()">Add Rack Rate</button>
</div>
<div class="col-md-1" style="position: relative;top: 10px;">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
@ -155,7 +155,6 @@ $(document).on('click', '.close', function() {
console.log("Tab panes removed");
});
var rarc_rate_json_array = [];
$(document).on('submit', 'form[id^="GridForm_"]', function(event) {
@ -193,9 +192,9 @@ $(document).on('submit', 'form[id^="GridForm_"]', function(event) {
// Create FormData object
var formData = new FormData(form[0]);
// for (var pair of formData.entries()) {
// console.log(pair[0] + ': ' + pair[1]);
// }
for (var pair of formData.entries()) {
console.log(pair[0] + ': ' + pair[1]);
}
let desiredKeys = ["self", "spouse", "childrens", "parents", "parents-in-law"];
@ -289,6 +288,7 @@ var client_policy_for_additional_rack_rate = '';
var terms_si_amount_array = [];
var unit_length = 0;
$('body').on('click', '.btnPolicyModel', function()
{
$('#tab_content .tab-pane').not('#primary_rack_rate_tab').remove();
@ -314,6 +314,9 @@ $('body').on('click', '.btnPolicyModel', function()
$('#rack_rate_one').show()
}
$('#rack_rate_one').click();
$.ajax({
url: '<?= base_url("util/policy-premium") ?>',
type: "GET",
@ -326,7 +329,9 @@ $('body').on('click', '.btnPolicyModel', function()
// console.log('rack rate responce.premium data parsed', JSON.parse(res.premiumData));
var data_for_the_rack_rate = JSON.parse(res.premiumData) ?? [];
var groupedData = groupByRackRateName(data_for_the_rack_rate);
var groupedData = groupByRackRateName(data_for_the_rack_rate) ?? [];
console.log('groupedData', groupedData)
if(policy_type_string == 'GMC'){
if (res.self == "") {
@ -363,24 +368,39 @@ $('body').on('click', '.btnPolicyModel', function()
var premium_type_for_primary_rr = [];
var first = 0;
premiumData = []
if(policy_type_string == 'GMC'){
$.each(groupedData, function(index, item){
if(index !== 'Primary'){
appendNewTab(index, item)
}else{
premiumData = item;
}
});
}else{
$.each(groupedData, function(index, item){
if(index == 'Primary'){
premiumData = item;
}
});
premiumData = [];
try {
if (policy_type_string == 'GMC') {
$.each(groupedData, function(index, item) {
if (index !== 'Primary') {
appendNewTab(index, item);
} else {
premiumData = item;
}
});
} else {
$.each(groupedData, function(index, item) {
if (index == 'Primary') {
premiumData = item;
}
});
}
} catch (error) {
console.error('An error occurred:', error);
console.error('Error Name:', error.name);
console.error('Error Message:', error.message);
console.error('Error Stack:', error.stack);
// Optional: handle the error in a user-friendly way
console.error('An error occurred while processing the data. Please try again.');
}
console.log('premiumData for primary rack rate', premiumData);
if (premiumData.length > 0) {
if (premiumData.length > 0 && premiumData != 'undefined') {
$.each(premiumData, function(index, item) {
policy_grid_id_value = item.policy_grid_id;
@ -413,6 +433,7 @@ $('body').on('click', '.btnPolicyModel', function()
checkboxdata = checkboxDataObject;
}
console.log('before create checkbox')
createCheckboxes(checkboxdata, additional_relationship, null, policy_type_id);
appendGridData(res.data, policy_grid_id_value);
if(premiumData[0]){
@ -433,7 +454,7 @@ $('body').on('click', '.btnPolicyModel', function()
premiumData.shift();
$.each(premiumData, function(index, item) {
if (item.si_or_bp == '1') {
console.log('gpa basic pay items', item)
console.log('gpa basic pay items', item);
appendGridtHtml('1', null, item);
} else {
appendGridtHtml(item.policy_grid_id, null, item);
@ -452,7 +473,7 @@ $('body').on('click', '.btnPolicyModel', function()
$('#4_si').trigger('keyup');
$('input[name="gpa_si"]').each(function() {
console.log('gpa_si[]', $(this));
// console.log('gpa_si[]', $(this));
$(this).trigger('keyup');
});
@ -485,7 +506,6 @@ $('body').on('click', '.btnPolicyModel', function()
});
$(`input[name="${first}_si[]"]`).each(function() {
// console.log(first+'_si[]', $(this));
$(this).trigger('keyup');
@ -518,6 +538,8 @@ $('body').on('click', '.btnPolicyModel', function()
});
console.log(rarc_rate_json_array);
$(document).on('change', 'select[id^="grid_"]', function(event)
{
@ -543,6 +565,7 @@ $(document).on('change', 'select[id^="grid_"]', function(event)
dataType: 'json',
success: function(res) {
console.log('change response', res)
if (res.data[0].policy_type == "GPA") {
$('#si_or_bp').val('2');
@ -564,6 +587,8 @@ $(document).on('change', 'select[id^="grid_"]', function(event)
});
})
//--------------------------------------------------------------------------------------------------------
$('#grid').change(function()
{
console.log('unit_length', unit_length)
@ -590,6 +615,7 @@ $('#grid').change(function()
dataType: 'json',
success: function(res) {
console.log('change response', res)
if (res.data[0].policy_type == "GPA") {
$('#si_or_bp').val('2');
@ -616,29 +642,19 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
console.log('addGridHTML si_or_bp', si_or_bp);
console.log('addGridHTML event', event);
console.log('addGridHTML ui_type', ui_type);
var secondaryValue = unique_id;
secondaryValue = unique_id;
// console.log('typeof secondaryValue');
// console.log(typeof secondaryValue);
// if(event.id){
// var unique_id = event.id.split('_');
// if (unique_id.length > 1) {
// secondaryValue = unique_id[1];
// secondaryValue = String(secondaryValue);
// }
// }
// console.log('unique_id', unique_id)
// console.log('secondaryValue', secondaryValue)
var grid_container = document.getElementById('grid_content_input');
// console.log(grid_container);
console.log('step 1', grid_container);
if (secondaryValue != false) {
grid_container_id = 'grid_content_input_' + secondaryValue;
grid_container_id = 'grid_content_input_for_additional_' + secondaryValue;
grid_container = document.getElementById(grid_container_id);
console.log('step 2', grid_container);
}
console.log('step 3', grid_container);
var id_var = 'grid_';
@ -649,8 +665,6 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
var dataIdValue = event.value;
}
$(grid_container).empty();
if (dataIdValue == '1') {
for (var i = 1; i <= 13; i++) {
$('#' + id_var + i).remove();
@ -814,8 +828,8 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
} else if (dataIdValue == '3') {
console.log('secondaryValue type 3 step 1', secondaryValue)
console.log('secondaryValue type 3', secondaryValue)
// console.log('secondaryValue type 3 step 1', secondaryValue)
// console.log('secondaryValue type 3', secondaryValue)
for (var i = 1; i <= 13; i++) {
$('#' + id_var + i).remove();
@ -927,13 +941,13 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
grid_html = `
<div class="form-row" id="${id_var}6" style="/*width:84%*/">
<div class="form-group col-md-4 unitDiv">
<div class="form-group col-md-4">
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="6_si" id="6_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
<div id='sum_insured_number_word' class="text-danger-2" ></div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<div class="form-group col-md-4 unitDiv">
<label for="mobile">Units<span class="text-danger">*</span></label>
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}" type="text" class="form-control" placeholder="Enter Unit" name="6_unit[]" id="6_unit" required>
</div>
@ -1230,8 +1244,9 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
}
// console.log('grid_container', grid_container)
console.log('grid_container step 4', grid_container)
// console.log('grid_html', grid_html)
$(grid_container).empty();
grid_container.insertAdjacentHTML('beforeend', grid_html);
if (dataIdValue == '1') {
@ -1244,7 +1259,7 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
// });
}
if(unit_length == 1 || unit_length == 0){
if(unit_length == 1 || unit_length == 0){
$('.unitDiv').hide();
$('.unitDiv').find('input').removeAttr('required');
@ -1280,7 +1295,7 @@ function appendGridtHtml(ui_type = false, secondary = false, data = false)
// console.log('container', container);
if (secondary != false && secondary != 'false' && secondary != null && secondary != 'null') {
container_id = 'grid_content_input_' + secondary;
container_id = 'grid_content_input_for_additional_' + secondary;
console.log('container', container_id);
container = document.getElementById(container_id);
console.log('container', container);
@ -1568,16 +1583,16 @@ function appendGridtHtml(ui_type = false, secondary = false, data = false)
<div class="form-row" id="removeChild_${Count}" style="/*width:84%*/">
<div class="form-group col-md-4 unitDiv">
<label for="mobile">Units<span class="text-danger">*</span></label>
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}" type="text" class="form-control" placeholder="Enter unit" name="unit" id="9_unit_${Count}" required>
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}" type="text" class="form-control" placeholder="Enter unit" name="gpa_unit" id="9_unit_${Count}" required>
</div>
<div class="form-group col-md-4">
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="9_si[]" id="9_si_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="gpa_si" id="9_si_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
<div id='sum_insured_number_word_${Count}' class="text-danger-2" ></div>
</div>
<div class="form-group col-md-4">
<label for="mobile">Premium<span class="text-danger">*</span></label>
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="9_premium[]" id="9_premium_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="gpa_premium" id="9_premium_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
<div id='premium_number_word_${Count}' class="text-danger-2" ></div>
</div>
</div>`;
@ -1712,7 +1727,7 @@ function appendGridtHtml(ui_type = false, secondary = false, data = false)
<option value="father" ${data !== false && data !== undefined && data !== '' && data.relationship === 'father' ? 'selected' : ''}>Father</option>
<option value="mother" ${data !== false && data !== undefined && data !== '' && data.relationship === 'mother' ? 'selected' : ''}>Mother</option>
<option value="father-in-law" ${data !== false && data !== undefined && data !== '' && data.relationship === 'father-in-law' ? 'selected' : ''}>Father in Law</option>
<option value="mother-in-law" ${dappendGridtHtmlata !== false && data !== undefined && data !== '' && data.relationship === 'mother-in-law' ? 'selected' : ''}>Mother in Law</option>
<option value="mother-in-law" ${data !== false && data !== undefined && data !== '' && data.relationship === 'mother-in-law' ? 'selected' : ''}>Mother in Law</option>
<option value="child" ${data !== false && data !== undefined && data !== '' && data.relationship === 'child' ? 'selected' : ''}>Child</option>
</select>
</div>
@ -1761,10 +1776,11 @@ function appendGridtHtml(ui_type = false, secondary = false, data = false)
}
function removebutton(index, type)
{
console.log('remove button function called')
if (index == 0) {
var inputs = document.querySelectorAll('#grid_' + type + ' input');
inputs.forEach(function(input) {
@ -1803,7 +1819,7 @@ function checkDuplicate(unique_id = null)
if (unique_id) {
id = $('#grid_'+unique_id)[0];
container = $('#grid_content_input_'+unique_id);
container = $('#grid_content_input_for_additional_'+unique_id);
console.log('checkDuplicate id 2', id);
console.log('checkDuplicate container 2', container);
@ -2580,8 +2596,8 @@ function getCurrentTime()
function createCheckboxes(obj, additional_relationship = [], unique_id = null, policy_type = null)
{
console.log('object', obj);
console.log('additional_relationship', additional_relationship);
console.log('createCheckboxes function object', obj);
console.log('createCheckboxes function additional_relationship', additional_relationship);
if (typeof additional_relationship === 'string') {
additional_relationship = JSON.parse(additional_relationship);
@ -2658,6 +2674,7 @@ function createCheckboxes(obj, additional_relationship = [], unique_id = null, p
}
if (obj['childrens'] > 0) {
let childrensValue = additional_relationship['childrens'] || 'NA';
html += `
@ -2763,86 +2780,11 @@ function createCheckboxes(obj, additional_relationship = [], unique_id = null, p
}
}
function formatString(str)
{
return str.split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ');
}
$('#del_btn').click(function()
{
//console.log('delete btn clicked');
Swal.fire({
title: "Are you sure?",
text: "You need to Delete this!",
icon: "warning",
showCancelButton: true,
confirmButtonColor: "#3085d6",
confirmButtonText: "Yes",
}).then((result) => {
//console.log('after then entered');
if (result.isConfirmed) {
//console.log('isConfirmed entered');
var client_policy_id = $('#client_policy_id_2').val();
//console.log('client_policy_id', client_policy_id)
var rack_rate_type = $('#rack_rate_type_2').val();
//console.log('rack_rate_type', rack_rate_type)
var client_id = $('#Client_id_2').val();
//console.log('client_id', client_id)
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
$.ajax({
url: '<?php echo base_url('util/delete-additional-rack-rate/'); ?>' + client_id + '/' + client_policy_id + '/' + rack_rate_type,
type: 'GET',
success: function(res) {
//console.log('ajax success entered');
//console.log(res);
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
if (res.status === true) {
$('#additional_grid_content_input').empty();
$('#additional_grid').val('');
$('#individual_2').prop('checked', true)
$('#single_2').prop('checked', false)
$('input[type="checkbox"]').prop('checked', false);
toastr.success(res.message, 'Success');
} else if (res.status === false) {
toastr.warning(res.message, 'Warning');
return;
}
},
error: function(xhr, status, error) {
//console.log('ajax error entered');
console.error(xhr.responseText);
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}
});
// Removed the duplicated loader hiding code here
}
//console.log('after then entered end or cancel');
});
//console.log('delete btn clicked end');
});
function checkCheckboxes()
{
@ -2916,7 +2858,7 @@ function checkPolicyTermsSI(unique_id = null)
if (unique_id) {
id = $('#grid_'+unique_id)[0];
container = $('#grid_content_input_'+unique_id);
container = $('#grid_content_input_for_additional_'+unique_id);
}
console.log(id);
@ -3018,6 +2960,9 @@ function checkPolicyTermsSI(unique_id = null)
function appendNewTab(tabNameData = null, data = null)
{
console.log('appendNewTab function called');
console.log('tabNameData', tabNameData);
console.log('data', data);
let tabName = tabNameData;
if(tabNameData == null){
@ -3049,6 +2994,7 @@ function appendNewTab(tabNameData = null, data = null)
newTabLink.classList.add('nav-link', 'nav-link', 'px-3', 'py-2');
newTabLink.setAttribute('data-toggle', 'tab');
newTabLink.setAttribute('href', `#${tabId}`);
newSpan.setAttribute('id', `link_${tabId}`);
// newTabLink.textContent = tabName;
newTabLink.appendChild(newSpan);
@ -3101,7 +3047,7 @@ function appendNewTab(tabNameData = null, data = null)
<a href="#" id="copyfromexcel_${tabId}" onclick="copyFromExcel(this, '${tabId}')">Copy from excel</a>
<hr>
<div class="form-row" id="grid_content_input_${tabId}" style="display: true;">
<div class="form-row" id="grid_content_input_for_additional_${tabId}" style="display: true;">
</div>
@ -3116,7 +3062,7 @@ function appendNewTab(tabNameData = null, data = null)
<div class="form-group text-right m-b-0" id="hide_smbt_btn_${tabId}">
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnGridSubmit_2_${tabId}">Submit</button>
<a class="btn btn-danger waves-effect waves-light mr-1" id="btnGridremove_2_${tabId}" onclick="removeTab(this)">Delete</a>
<a class="btn btn-danger waves-effect waves-light mr-1" id="btnGridremove_2_${tabId}" onclick="removeTab(this, '${tabId}', '${tabName}')">Delete</a>
<a class="btn btn-secondary waves-effect waves-light mr-1" id="btnGridrename_${tabId}" onclick="renameRackRateTab(this)">Rename</a>
</div>
</form>`;
@ -3129,14 +3075,20 @@ function appendNewTab(tabNameData = null, data = null)
if(data){
addGridHTML(false, data[0], data[0].policy_grid_id, false, tabId);
policy_grid_id = data[0].policy_grid_id
additional_relationship = data[0].additional_relationship;
premium_type = data[0].premium_type;
// data.shift();
$.each(data, function(index, item) {
// console.log(item)
policy_grid_id = item.policy_grid_id
additional_relationship = item.additional_relationship;
premium_type = item.premium_type;
appendGridtHtml(item.policy_grid_id, tabId, item);
});
// if(data.length > 1){
$.each(data, function(index, item) {
// console.log(item)
policy_grid_id = item.policy_grid_id
additional_relationship = item.additional_relationship;
premium_type = item.premium_type;
appendGridtHtml(item.policy_grid_id, tabId, item);
});
// }
}
appendGridData(rack_rate_array, policy_grid_id, tabId);
@ -3145,14 +3097,18 @@ function appendNewTab(tabNameData = null, data = null)
hideShowSubmitButton(employee_count, tabId);
editPolicyPremiumCalculationSetValue(premium_type, tabId);
if(data == null){
$('#link_'+tabId).click();
}
}
}
function appendGridData(data, policy_grid_id_value = null, unique_id = null)
{
console.log('policy_grid_id_value', policy_grid_id_value)
console.log(data)
{
console.log('appendGridData function called');
console.log('appendGridData policy_grid_id_value', policy_grid_id_value)
console.log('appendGridData data', data)
var rack_rate_id = $('#grid');
@ -3217,19 +3173,18 @@ function hideShowSubmitButton(emp_count, unique_id = null)
}
function removeTab(input)
{
console.log(input)
secondaryValue = ''
if(input.id){
var unique_id = input.id.split('_');
if (unique_id.length > 1) {
secondaryValue = unique_id[2];
}
}
function removeTab(input, tabID, tabName)
{
var client_policy_id = $('#client_policy_id_'+tabID).val();
console.log('removeTab input', input)
console.log('removeTab tabID', tabID)
console.log('removeTab tabName', tabName)
console.log('removeTab client_policy_id', client_policy_id)
Swal.fire({
title: "Are you sure?",
text: "You need to remove this Tab.",
text: "You want to remove this Rack Rate.",
icon: "info",
showCancelButton: true,
confirmButtonColor: "#3085d6",
@ -3238,9 +3193,63 @@ function removeTab(input)
if (result.isConfirmed) {
$('#'+secondaryValue).remove();
$('#list_'+secondaryValue).remove();
$('#'+tabID).remove();
$('#list_'+tabID).remove();
$('#rack_rate_one').click();
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var form_action = '<?= base_url("util/remove_rack_rate/") ?>' + tabName + '/' + client_policy_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) {
Swal.fire({
title: "Success",
text: res.message,
icon: "success"
});
// toastr.success('Policy removed successfully.', 'success');
} else {
if(res.rr_count > 0){
Swal.fire({
title: "warning!",
text: res.message,
icon: "warning"
});
}else{
Swal.fire({
title: "Success",
text: 'Rack Rate removed successfully',
icon: "success"
});
}
// 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');
}
});
}
});
@ -3256,7 +3265,7 @@ function copyFromExcel(input, unique_id = null)
var grid_content_from_excel = $('#grid_content_from_excel');
if(unique_id){
grid_content_input = $('#grid_content_input_'+unique_id);
grid_content_input = $('#grid_content_input_for_additional_'+unique_id);
grid_content_from_excel = $('#grid_content_from_excel_'+unique_id);
}
@ -3276,7 +3285,7 @@ function renameRackRateTab(input)
{
console.log(input)
console.log(input.id)
var newTabName = prompt('Enter the tab name')
var newTabName = prompt('Enter rack rate name:')
console.log(newTabName)
secondaryValue = '';
if(input.id){
@ -3317,56 +3326,46 @@ function editPolicyPremiumCalculationSetValue(premium_type, unique_id = null)
if(unique_id){
// console.log('editPolicyPremiumCalculationSetValue step 1');
if (premium_type === '2') {
// console.log('editPolicyPremiumCalculationSetValue step 2');
$('#individual_'+unique_id).prop('checked', true);
$('#single_'+unique_id).prop('checked', false);
} else if (premium_type === '1') {
// console.log('editPolicyPremiumCalculationSetValue step 3');
$('#single_'+unique_id).prop('checked', true);
$('#individual_'+unique_id).prop('checked', false);
} else {
// console.log('editPolicyPremiumCalculationSetValue step 4');
$('#single_'+unique_id).prop('checked', false);
$('#individual_'+unique_id).prop('checked', true);
}
}else{
// console.log('editPolicyPremiumCalculationSetValue step 5');
if (premium_type === '2') {
// console.log('editPolicyPremiumCalculationSetValue step 6');
$('#individual').prop('checked', true);
$('#single').prop('checked', false);
} else if (premium_type === '1') {
// console.log('editPolicyPremiumCalculationSetValue step 7');
$('#single').prop('checked', true);
$('#individual').prop('checked', false);
} else {
// console.log('editPolicyPremiumCalculationSetValue step 8');
$('#single').prop('checked', false);
$('#individual').prop('checked', true);
}
}
}
function hideUnitFieldInABranchHaveSingleUnit()
{
$('input[name="11_max_si[]"]').each(function() {
$(this)
});
}
function checkFamiliFloatersKeysDuplicate(rarc_rate_json_array, formObject)
{

View File

@ -77,7 +77,7 @@
</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(event);">+</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>
@ -170,6 +170,10 @@
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']);
});
@ -483,7 +487,8 @@
const suggestionBox = document.getElementById("suggestion-box");
const suggestionsList = document.getElementById("suggestions");
function addRowToTable() {
function addRowToTable(default_data = false) {
console.log(default_data);
const tableBody = document.getElementById("emptablebody");
const existingRowCount = tableBody.rows.length;
@ -507,7 +512,7 @@ const suggestionsList = document.getElementById("suggestions");
// Name (assuming you want an input field)
newCell = document.createElement("td");
newCell.innerHTML = '';
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);
@ -517,14 +522,14 @@ const suggestionsList = document.getElementById("suggestions");
// 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 = ''; // 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 = ''; // Adjust for your needs
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);
@ -532,7 +537,7 @@ const suggestionsList = document.getElementById("suggestions");
// relationship (assuming you want a date input field)
newCell = document.createElement("td");
newCell.innerHTML = ''; // Adjust for your needs
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);
@ -540,33 +545,34 @@ const suggestionsList = document.getElementById("suggestions");
// SI (assuming you want a date input field)
newCell = document.createElement("td");
newCell.innerHTML = ''; // Adjust for your needs
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 = ''; // Adjust for your needs
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 = ''; // Adjust for your needs
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 = ''; // Adjust for your needs
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 = ''; // Adjust for your needs
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);

View File

@ -107,7 +107,7 @@
<thead class="bg-light">
<tr>
<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">Endorsement No</th>
<th class="font-weight-medium">Sub Type</th>
@ -122,6 +122,7 @@
<?php foreach($depositdata as $row) { ?>
<tr id="<?php echo $row->id;?>">
<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

View File

@ -27,58 +27,61 @@ class PremiumCalculationTestNew extends CIUnitTestCase
//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],
[ '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],
[ '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],
[ '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],
[ '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],
[ '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],
[ '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],
[ '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],
[ '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],
[ '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]
[ '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 ],
[ '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],
[ '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],
[ '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],
[ '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],
[ '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],
[ '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],
[ '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]
[ '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 ],
[ '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],
[ '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],
[ '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],
[ '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],
[ '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],
[ '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],
[ '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]
[ '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]
];
@ -86,20 +89,21 @@ class PremiumCalculationTestNew extends CIUnitTestCase
// 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 ],
[ '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],
[ '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],
[ '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],
[ '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],
[ '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],
[ '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],
[ '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],
[ '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]
[ '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]
];
@ -113,15 +117,15 @@ class PremiumCalculationTestNew extends CIUnitTestCase
// Sample family data
$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', '', '', ''],
[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, '', '', '', '', '', '', '', '', '',''],
// [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
@ -146,9 +150,13 @@ class PremiumCalculationTestNew extends CIUnitTestCase
}
// 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];
$data = calculate_premimum_new($family_details,$policy_details,$all_rack_rates,$file);
$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]);