Merge branch 'dev' of bitbucket.org:jubilian/nhance-enrollment into dev

This commit is contained in:
VENKATESHWARAN 2025-01-24 12:03:19 +05:30
commit 2831c27409
69 changed files with 218 additions and 383 deletions

View File

@ -1,249 +0,0 @@
#--------------------------------------------------------------------
# Example Environment Configuration file
#
# This file can be used as a starting point for your own
# custom .env files, and contains most of the possible settings
# available in a default install.
#
# By default, all of the settings are commented out. If you want
# to override the setting, you must un-comment it by removing the '#'
# at the beginning of the line.
#--------------------------------------------------------------------
#--------------------------------------------------------------------
# ENVIRONMENT
#--------------------------------------------------------------------
# CI_ENVIRONMENT = development
#--------------------------------------------------------------------
# APP
#--------------------------------------------------------------------
app.baseURL = 'http://localhost/zohomail/nhance-enrollment/'
helpdeskURL = 'http://localhost/zohomail/helpdesk'
app.appTimezone = 'Asia/Kolkata'
# If you have trouble with `.`, you could also use `_`.
# app_baseURL = ''
# app.forceGlobalSecureRequests = false
# app.CSPEnabled = false
#--------------------------------------------------------------------
# DATABASE
#--------------------------------------------------------------------
# Dev DB Connection
database.default.hostname = 119.18.54.85
database.default.database = venbaehn_nhance
database.default.username = nhenroll_user1
database.default.password = '}Rrf3CM6oWq4'
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 = nhenroll_user1
database.tests.password = '}Rrf3CM6oWq4'
database.tests.DBDriver = MySQLi
database.tests.DBPrefix =
database.tests.port = 3306
#Nhance Live DB Connection
# database.default.hostname = stagingdb.cp2o2ggwgbzh.ap-south-1.rds.amazonaws.com
# database.default.database = nhance_live
# database.default.username = stagedbadmin
# database.default.password = 'c924#!8380'
# database.default.DBDriver = MySQLi
# database.default.DBPrefix =
# database.default.port = 3306
# database.tests.hostname = stagingdb.cp2o2ggwgbzh.ap-south-1.rds.amazonaws.com
# database.tests.database = nhance_live
# database.tests.username = stagedbadmin
# database.tests.password = 'c924#!8380'
# 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.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 PHP MyAdmin 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
#--------------------------------------------------------------------
# CONTENT SECURITY POLICY
#--------------------------------------------------------------------
# contentsecuritypolicy.reportOnly = false
# contentsecuritypolicy.defaultSrc = 'none'
# contentsecuritypolicy.scriptSrc = 'self'
# contentsecuritypolicy.styleSrc = 'self'
# contentsecuritypolicy.imageSrc = 'self'
# contentsecuritypolicy.baseURI = null
# contentsecuritypolicy.childSrc = null
# contentsecuritypolicy.connectSrc = 'self'
# contentsecuritypolicy.fontSrc = null
# contentsecuritypolicy.formAction = null
# contentsecuritypolicy.frameAncestors = null
# contentsecuritypolicy.frameSrc = null
# contentsecuritypolicy.mediaSrc = null
# contentsecuritypolicy.objectSrc = null
# contentsecuritypolicy.pluginTypes = null
# contentsecuritypolicy.reportURI = null
# contentsecuritypolicy.sandbox = false
# contentsecuritypolicy.upgradeInsecureRequests = false
# contentsecuritypolicy.styleNonceTag = '{csp-style-nonce}'
# contentsecuritypolicy.scriptNonceTag = '{csp-script-nonce}'
# contentsecuritypolicy.autoNonce = true
#--------------------------------------------------------------------
# COOKIE
#--------------------------------------------------------------------
# cookie.prefix = ''
# cookie.expires = 0
# cookie.path = '/'
# cookie.domain = ''
# cookie.secure = false
# cookie.httponly = false
# cookie.samesite = 'Lax'
# cookie.raw = false
#--------------------------------------------------------------------
# ENCRYPTION
#--------------------------------------------------------------------
# encryption.key =
# encryption.driver = OpenSSL
# encryption.blockSize = 16
# encryption.digest = SHA512
#--------------------------------------------------------------------
# HONEYPOT
#--------------------------------------------------------------------
# honeypot.hidden = 'true'
# honeypot.label = 'Fill This Field'
# honeypot.name = 'honeypot'
# honeypot.template = '<label>{label}</label><input type="text" name="{name}" value=""/>'
# honeypot.container = '<div style="display:none">{template}</div>'
#--------------------------------------------------------------------
# SECURITY
#--------------------------------------------------------------------
# security.csrfProtection = 'cookie'
# security.tokenRandomize = false
# security.tokenName = 'csrf_token_name'
# security.headerName = 'X-CSRF-TOKEN'
# security.cookieName = 'csrf_cookie_name'
# security.expires = 7200
# security.regenerate = true
# security.redirect = false
# security.samesite = 'Lax'
#--------------------------------------------------------------------
# SESSION
#--------------------------------------------------------------------
# session.driver = 'CodeIgniter\Session\Handlers\FileHandler'
session.cookieName = 'ci_session_for_zomail'
session.expiration = 86400
# session.savePath = null
# session.matchIP = false
session.timeToUpdate = 300
session.regenerateDestroy = true
#--------------------------------------------------------------------
# LOGGER
#--------------------------------------------------------------------
# logger.threshold = 4
#--------------------------------------------------------------------
# CURLRequest
#--------------------------------------------------------------------
# curlrequest.shareOptions = true
#--------------------------------------------------------------------
# Google-OAUTH-Credentials
#--------------------------------------------------------------------
#MY OAUTH
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/zohomail/nhance-enrollment/oauth2callback'
GOOGLE_OAUTH_SCOPES = "https://www.googleapis.com/auth/userinfo.email,https://www.googleapis.com/auth/userinfo.profile,https://www.googleapis.com/auth/drive.file"
# GDRIVE_ROOT_FOLDER_ID = '1M0GH3GbNUOYZLNeHXA5U7C_P2NSx7F7O'
GDRIVE_ROOT_FOLDER_ID = '1t4Qf2zen-j05tHtSaLoxupB92BoOOJ-4'
#Nhance OAUTH
# GOOGLE_OAUTH_APP_NAME = 'OAuth'
# GOOGLE_OAUTH_CLIENT_ID = '508866094093-n8l9fkevuc7vp50evicvhogiiibsc30m.apps.googleusercontent.com'
# GOOGLE_OAUTH_CLIENT_SECRET = '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'
# GOOGLE_OAUTH_REDIRECT_URI = 'http://localhost/zohomail/nhance-enrollment/oauth2callback'
# GOOGLE_OAUTH_SCOPES = "https://www.googleapis.com/auth/userinfo.email,https://www.googleapis.com/auth/userinfo.profile,https://www.googleapis.com/auth/drive.file"
# GDRIVE_ROOT_FOLDER_ID = '1M0GH3GbNUOYZLNeHXA5U7C_P2NSx7F7O'
App_Url = https://venbait.in/nhance-enrollment/app/dev/
POST_ENROLLMENT_APP_LINK = https://venbait.in/nhance/employee/dev/
NHANCE_LOGO = https://venbait.in/nhance-enrollment/dev/public/assets/images/Nhance_Favi.png
hepldeskURL = 'hepldesk'

0
README.md Normal file → Executable file
View File

View File

@ -437,7 +437,7 @@ $routes->group("/api", ["filter" => "authJWT"], function ($routes) {
$routes->post("logined", "RestAuthenticationController::logined");
$routes->post("getId", "RestAuthenticationController::getUserIdFromToken");
});
// $routes->get("getEmployeePolicy", "EmployeeRestController::getEmployeePolicy");
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
$routes->post("getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData");

View File

@ -29,6 +29,7 @@ use App\Models\FEContentModel;
use App\Models\AddImgModel;
use App\Models\ClientBranchModel;
use App\Models\AuditHistoryModel;
use App\Models\SIMappingModel;
use App\Controllers\Jobs ;
@ -49,8 +50,6 @@ use Kreait\Firebase\Messaging\CloudMessage;
use Kreait\Firebase\Messaging\Notification;
use Kreait\Firebase\Exception\MessagingException;
use Kint\Kint;
class EmployeeRestController extends AdminController
{
@ -75,6 +74,7 @@ class EmployeeRestController extends AdminController
protected $addImgModel;
protected $clientBranchModel;
protected $auditHistoryModel;
protected $siMappingModel;
public function __construct()
@ -99,6 +99,7 @@ class EmployeeRestController extends AdminController
$this->addImgModel = new AddImgModel();
$this->clientBranchModel = new ClientBranchModel();
$this->auditHistoryModel = new AuditHistoryModel();
$this->siMappingModel = new SIMappingModel();
}
@ -1080,13 +1081,14 @@ class EmployeeRestController extends AdminController
$id = $this->request->getGet('id');
$emp_code = $this->request->getGet('emp_code');
$client_id = $this->request->getGet('client_id');
$client_branch_id = $this->request->getGet('client_branch_id');
$client_branch_id = $this->request->getGet('client_branch_id');
$login_by_hr = $this->request->getGet('login_by_hr');
// This is an array containing keys to be removed from the terms and conditions array
$keysToRemove = ["removable_keys"];
// Retrieve employee policy data by passing the employee primary key
$empPolicy = $this->employeeModel->getEmployeePolicy($id);
// dd($empPolicy);
// Retrieve employee and dependents data by passing the employee code
$employeeData = $this->employeeModel->where('emp_code',$emp_code)
->where('client_id',$client_id)
@ -1114,7 +1116,7 @@ class EmployeeRestController extends AdminController
$array->GridMaster = $getSlabAndGridData['grid_master'];
if($array->tpa_id != null){
$array->eCardDownload = base_url('download-e-card/') . $array->rand_string;
$array->eCardDownload = base_url('download-e-card/') . $array->rand_string.'/1';
}else{ $array->eCardDownload = null; }
@ -1123,9 +1125,19 @@ class EmployeeRestController extends AdminController
if($array->policy_type_id == 1 && $this->request->getGet('policy') == 'GPA')
{
$si_value = 0;
$si_premium_value = 0;
$si_gst_value = 0;
// Filter employee data where the family_floater_key is 'self'
$selfData = array_filter($empData, fn($arr) => trim(strtolower($arr['family_floater_key'])) === 'self');
$employee_policy = $this->employeePolicyModel->where('employee_id',$selfData[0]['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow();
$si_value = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : 0;
if(isset($employee_policy->payable_employee) && $employee_policy->payable_employee == 1)
{
$si_premium_value = $si_premium_value + $employee_policy->rata_premimum;
$si_gst_value = $si_gst_value + $employee_policy->gst;
}
$self['is_value_exist'] = true;
$self['data']['family_floater_key'] = 'self';
@ -1139,14 +1151,17 @@ class EmployeeRestController extends AdminController
$array->mapped_family_floaters = $self;
$array->type = 'GPA';
$array->si_value = $si_value;
$array->si_premium_value = $si_premium_value;
$array->si_gst_value = $si_gst_value;
$res = [];
array_push($res,$array);
$EDLIPolicy = $this->getAdditionalGPAPolicy($employeeData,6,$emp_code,$client_id,$client_branch_id);
$EDLIPolicy = $this->getAdditionalGPAPolicy($employeeData,6,$emp_code,$client_id,$client_branch_id,$login_by_hr);
if($EDLIPolicy){ array_push($res,$EDLIPolicy); }
$GTLIPolicy = $this->getAdditionalGPAPolicy($employeeData,7,$emp_code,$client_id,$client_branch_id);
$GTLIPolicy = $this->getAdditionalGPAPolicy($employeeData,7,$emp_code,$client_id,$client_branch_id,$login_by_hr);
if($GTLIPolicy){ array_push($res,$GTLIPolicy); }
return $this->respond(['status' => 'success','code' => 200,'data' => $res ], 200);
@ -1198,8 +1213,11 @@ class EmployeeRestController extends AdminController
if ($value['family_floater_key'] === $dependent) {
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow();
if(isset($employee_policy->basic_cover_si)){ $dependent_and_si_value = ($dependent_and_si_value == 0) ? $employee_policy->basic_cover_si : $dependent_and_si_value; }
if(isset($employee_policy->rata_premimum)){ $dependent_and_si_premium_value = $dependent_and_si_premium_value + $employee_policy->rata_premimum;}
if(isset($employee_policy->gst)){ $dependent_and_si_gst_value = $dependent_and_si_gst_value + $employee_policy->gst;}
if(isset($employee_policy->payable_employee) && $employee_policy->payable_employee == 1)
{
if(isset($employee_policy->rata_premimum)){ $dependent_and_si_premium_value = $dependent_and_si_premium_value + $employee_policy->rata_premimum;}
if(isset($employee_policy->gst)){ $dependent_and_si_gst_value = $dependent_and_si_gst_value + $employee_policy->gst;}
}
$temp['is_value_exist'] = true;
$temp['data']['family_floater_key'] = $familyFloatesValue;
@ -1353,7 +1371,7 @@ class EmployeeRestController extends AdminController
{
if($tpaArray[0]->tpa_id != null)
$array->eCardDownload = base_url('download-e-card/') . $tpaArray[0]->rand_string;
$array->eCardDownload = base_url('download-e-card/') . $tpaArray[0]->rand_string.'/1';
else
$array->eCardDownload = null;
@ -1401,8 +1419,11 @@ class EmployeeRestController extends AdminController
if ($value['family_floater_key'] === $dependent) {
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow();
if(isset($employee_policy->basic_cover_si)){ $dependent_and_si_value = ($dependent_and_si_value == 0) ? $employee_policy->basic_cover_si : $dependent_and_si_value; }
if(isset($employee_policy->rata_premimum)){ $dependent_and_si_premium_value = $dependent_and_si_premium_value + $employee_policy->rata_premimum;}
if(isset($employee_policy->gst)){ $dependent_and_si_gst_value = $dependent_and_si_gst_value + $employee_policy->gst;}
if(isset($employee_policy->payable_employee) && $employee_policy->payable_employee == 1)
{
if(isset($employee_policy->rata_premimum)){ $dependent_and_si_premium_value = $dependent_and_si_premium_value + $employee_policy->rata_premimum;}
if(isset($employee_policy->gst)){ $dependent_and_si_gst_value = $dependent_and_si_gst_value + $employee_policy->gst;}
}
$temp['is_value_exist'] = true;
$temp['data']['family_floater_key'] = $familyFloatesValue;
@ -1483,7 +1504,7 @@ class EmployeeRestController extends AdminController
}
public function getAdditionalGPAPolicy($empData,$policy_type,$emp_code,$client_id,$client_branch_id)
public function getAdditionalGPAPolicy($empData,$policy_type,$emp_code,$client_id,$client_branch_id,$login_by_hr)
{
$checkPolicyExist = $this->clientPolicyModel->select('client_policy.id as ClientPolicyId , client_policy.client_id as ClientId, client_policy.policy_type_id as policy_type_id, client_policy.is_addon as is_addon , client_policy.open_for_enrollment as OpenForEnrollment , client_policy.inception_type as inception_type , client_policy.policy_terms as Policy_Terms , client_policy.enrolment_visibility')
->where('client_policy.policy_type_id', $policy_type )
@ -1500,18 +1521,32 @@ class EmployeeRestController extends AdminController
$decodedArray = json_decode($array->Policy_Terms);
$array->Policy_Terms = $decodedArray;
$si_value = 0;
$si_premium_value = 0;
$si_gst_value = 0;
// Filter employee data where the family_floater_key is 'self'
$selfData = array_filter($empData, fn($arr) => trim(strtolower($arr['family_floater_key'])) === 'self');
$employee_policy = $this->employeePolicyModel->where('employee_id',$selfData[0]['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow();
$si_value = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : 0;
if(isset($employee_policy->payable_employee) && $employee_policy->payable_employee == 1)
{
$si_premium_value = $si_premium_value + $employee_policy->rata_premimum;
$si_gst_value = $si_gst_value + $employee_policy->gst;
}
$policyTypeData = $this->policyTypeModel->where('id',$policy_type)->get()->getRow();
$array->type = $policyTypeData->policy_type;
$array->Policy_Name = $policyTypeData->long_name;
$array->si_value = $si_value;
$array->si_premium_value = $si_premium_value;
$array->si_gst_value = $si_gst_value;
if($employee_policy){
if($employee_policy->tpa_id != null){
$array->eCardDownload = base_url('download-e-card/') . $employee_policy->rand_string;
$array->eCardDownload = base_url('download-e-card/') . $employee_policy->rand_string.'/1';
}else{ $array->eCardDownload = null; }
$self['is_value_exist'] = true;
@ -1525,10 +1560,20 @@ class EmployeeRestController extends AdminController
$self['data']['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : 0;
$array->mapped_family_floaters = $self;
if($array->enrolment_visibility == 1)
if (isset($login_by_hr) && $login_by_hr == true)
{
return $array;
else
return false;
}else{
if($array->enrolment_visibility == 1)
return $array;
else
return false;
}
}else{
return false;
@ -1637,6 +1682,55 @@ class EmployeeRestController extends AdminController
} catch (\Exception $e) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
}
}
public function getSiMappedArray($policy_id,$base_policy_id)
{
$selfGMC = $this->employeeModel->select('employees.name , employee_polices.basic_cover_si')
->join('employee_polices', 'employees.id = employee_polices.employee_id')
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id AND client_policy.policy_type_id = 2')
->where('employees.is_active', 1)
->where('employees.emp_code', $this->request->getGet('emp_code'))
->where('employees.client_id', $this->request->getGet('client_id'))
->where('employees.client_branch_id', $this->request->getGet('client_branch_id'))
->where('employees.family_floater_key', 'self')
->get()
->getRow();
if($selfGMC)
{
$selfSi = $selfGMC->basic_cover_si;
// Fetch the value
$policySiAmounts = $this->siMappingModel
->where('policy_id', $policy_id)
->where('base_policy_id', $base_policy_id)
->where('base_policy_si_amount', $selfSi)
->get()
->getRow();
if($policySiAmounts && isset($policySiAmounts->policy_si_amounts))
{
// Decode the JSON string into a PHP array
$amountsArray = json_decode($policySiAmounts->policy_si_amounts, true);
// Convert the array into the desired format
$formattedArray = array_map(function ($amount) {
return ['si' => (int) $amount]; // Cast to integer for proper JSON format
}, $amountsArray);
// Output or return the result
return $formattedArray;
}else{
return false;
}
}else{
return false;
}
}
public function getAddOnPolicy()
@ -1725,7 +1819,7 @@ class EmployeeRestController extends AdminController
if(count($tpaArray))
{
if($tpaArray[0]->tpa_id != null)
$responce['eCardDownload'] = base_url('download-e-card/') . $tpaArray[0]->rand_string;
$responce['eCardDownload'] = base_url('download-e-card/') . $tpaArray[0]->rand_string.'/1';
else
$responce['eCardDownload'] = null;
@ -1746,30 +1840,11 @@ class EmployeeRestController extends AdminController
if($array['is_addon'] == 3 && $array['policy_type_id'] == 3)//dependent add on policy
{
if($this->request->getGet('client_id') == 8) // This changes only for client "sterling"
{
$selfGMC = $this->employeeModel->select('employees.name , employee_polices.basic_cover_si')
->join('employee_polices', 'employees.id = employee_polices.employee_id')
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id AND client_policy.policy_type_id = 2')
->where('employees.is_active', 1)
->where('employees.emp_code', $this->request->getGet('emp_code'))
->where('employees.client_id', $this->request->getGet('client_id'))
->where('employees.client_branch_id', $this->request->getGet('client_branch_id'))
->where('employees.family_floater_key', 'self')
->get()
->getRow();
$selfSi = $selfGMC->basic_cover_si;
$filteredSlabRates = array_filter($responce['SlabRates'], function ($rate) use ($selfSi) {
return $rate['si'] === $selfSi;
});
// To reindex the array to have a proper 0 index
$responce['SlabRates'] = array_values($filteredSlabRates);
}
$siArray = $this->getSiMappedArray($array['id'],$array['base_policy']);
$responce['SlabRates'] = is_array($siArray) ? $siArray : $responce['SlabRates'];
// Map family floaters that already exist in the employee table
$familyFloates = $policy_terms->family_floaters;
// remove parent and parent-in-law from familyFloaters
@ -1791,8 +1866,11 @@ class EmployeeRestController extends AdminController
if ($value['family_floater_key'] === $dependent) {
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow();
if(isset($employee_policy->basic_cover_si)){ $dependent_and_si_value = ($dependent_and_si_value == 0) ? $employee_policy->basic_cover_si : $dependent_and_si_value; }
if(isset($employee_policy->rata_premimum)){ $dependent_and_si_premium_value = $dependent_and_si_premium_value + $employee_policy->rata_premimum;}
if(isset($employee_policy->gst)){ $dependent_and_si_gst_value = $dependent_and_si_gst_value + $employee_policy->gst;}
if(isset($employee_policy->payable_employee) && $employee_policy->payable_employee == 1)
{
if(isset($employee_policy->rata_premimum)){ $dependent_and_si_premium_value = $dependent_and_si_premium_value + $employee_policy->rata_premimum;}
if(isset($employee_policy->gst)){ $dependent_and_si_gst_value = $dependent_and_si_gst_value + $employee_policy->gst;}
}
$temp['is_value_exist'] = true;
$temp['data']['family_floater_key'] = $familyFloatesValue;
@ -1912,8 +1990,11 @@ class EmployeeRestController extends AdminController
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow();
if(isset($employee_policy->basic_cover_si)){ $only_si_value = ($only_si_value == 0) ? $employee_policy->basic_cover_si : $only_si_value; }
if(isset($employee_policy->rata_premimum)){ $only_si_premium_value = $only_si_premium_value + $employee_policy->rata_premimum;}
if(isset($employee_policy->gst)){ $only_si_gst_value = $only_si_gst_value + $employee_policy->gst;}
if(isset($employee_policy->payable_employee) && $employee_policy->payable_employee == 1)
{
if(isset($employee_policy->rata_premimum)){ $only_si_premium_value = $only_si_premium_value + $employee_policy->rata_premimum;}
if(isset($employee_policy->gst)){ $only_si_gst_value = $only_si_gst_value + $employee_policy->gst;}
}
$temp3['is_value_exist'] = true;
$temp3['data']['employee_id'] = $value['id'];
$temp3['data']['relationship'] = $value['relationship'];
@ -1965,8 +2046,11 @@ class EmployeeRestController extends AdminController
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->where('is_active', 1 )->get()->getRow();
if(isset($employee_policy->basic_cover_si)){ $only_si_value = ($only_si_value == 0) ? $employee_policy->basic_cover_si : $only_si_value; }
if(isset($employee_policy->rata_premimum)){ $only_si_premium_value = $only_si_premium_value + $employee_policy->rata_premimum;}
if(isset($employee_policy->gst)){ $only_si_gst_value = $only_si_gst_value + $employee_policy->gst;}
if(isset($employee_policy->payable_employee) && $employee_policy->payable_employee == 1)
{
if(isset($employee_policy->rata_premimum)){ $only_si_premium_value = $only_si_premium_value + $employee_policy->rata_premimum;}
if(isset($employee_policy->gst)){ $only_si_gst_value = $only_si_gst_value + $employee_policy->gst;}
}
$temp3['is_value_exist'] = true;
$temp3['data']['employee_id'] = $value['id'];
$temp3['data']['relationship'] = $value['relationship'];
@ -2138,88 +2222,88 @@ class EmployeeRestController extends AdminController
//Post method - which receives client_policy id and empcode of the family.
//Pull records againest emp code and calculate premium
// retun array
public function calculatePremium($clientPolicyId = null , $empCode = null, $default_si = null , $client_branch_id = null)//family level
{
// dd($clientPolicyId, $empCode, $default_si, $client_branch_id);
helper('excel_util_helper');
if($this->request){ //
$client_policy_id = $this->request->getVar('client_policy_id') ?? $clientPolicyId;
$emp_code = $this->request->getVar('emp_code') ?? $empCode;
$default_si = $this->request->getVar('si') ?? $default_si;// si amt which choosed in add on policy
$client_branch_id = $this->request->getVar('client_branch_id') ?? $client_branch_id;
}else{
//Cli and enrollment
$client_policy_id = $clientPolicyId;
$emp_code = $empCode;
$default_si = $default_si;// si amt which choosed in add on policy
$client_branch_id =$client_branch_id;
}
// dd($client_policy_id);
$client_id = ($this->clientPolicyModel->select('client_id')->find($client_policy_id))['client_id'];
// get policy and rack details
$policy_terms = $this->clientPolicyModel->getPolicyDetails($client_id,$client_policy_id);
$policy_type = $policy_terms[0]->is_addon;
$base_policy = $policy_terms[0]->base_policy;
$policy_terms = (array) $policy_terms[0];// convert obj to array
//get policy slab rates
$slab_details = $this->policesModel->getPolicySlabRatesForEmpOnboard($client_policy_id,$client_id);
// print_r($slab_details);die();
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(client_id: $client_id,client_policy_id: $client_policy_id,emp_code: $emp_code,emp_status:['draft','enrolled'],policy_status:['draft','enrolled']);
// kint::dump($existing_famility_details);
//get the Auto SI amount
$auto_si_data = update_si_with_auto_si($client_id, $client_policy_id, $emp_code, $client_branch_id, $existing_famility_details);
log_message('error', '----- Auto SI Amount : {data} -----', ['data' => $auto_si_data]);
//Change the basic cover si to the auto si amount if the auto_si_amount is not null
if(!empty($auto_si_data)){
foreach ($existing_famility_details as $emp_code => &$records) {
$records['basic_cover_si'] = $auto_si_data;
}
unset($record);
}
// dd($existing_famility_details);
if(!count($existing_famility_details) && $policy_type == 2)//top up addon only
{
//get basepolicy id then pull emplist from base policy if only current policy is DA addon policy and emplist is zero
// echo 'inside';
$client_policy_id = $base_policy;
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(client_id: $client_id,client_policy_id: $client_policy_id,emp_code: $emp_code,emp_status:['draft','enrolled'],policy_status:['draft','enrolled']);
}
$file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception'];
// dd($this->employeeModel->getLastQuery());
// print_r($existing_famility_details);die();
$employee_data_group_by_family = data_group_by_family($existing_famility_details,$data_source = 'db');
// print_rr(($employee_data_group_by_family));die();
$existing_units = $this->clientBranchModel->getExisitingUnits(client_id: $client_id,client_branch_id: $client_branch_id);
foreach ($employee_data_group_by_family as $emp_id => $family)
{
$transformed_famility_details = transform_db_data_to_excel($family);
$data = calculate_premium_new(family_data: $transformed_famility_details,policy_terms:$policy_terms,slab_details:$slab_details,fileArr: $file,existing_units: $existing_units,default_si : $default_si);
$employee_data_group_by_family[$emp_id] = $data;
}
if($clientPolicyId != null && $empCode != null)
{ // dd ($employee_data_group_by_family);
return $employee_data_group_by_family;
}else{
// dd ($employee_data_group_by_family);
return $this->respond(['status' => 'success','code' => (count($employee_data_group_by_family) ? 200 : 404),'data' => [$employee_data_group_by_family] ], 200);
}
public function calculatePremium($clientPolicyId = null , $empCode = null, $default_si = null , $client_branch_id = null)//family level
{
// dd($clientPolicyId, $empCode, $default_si, $client_branch_id);
helper('excel_util_helper');
if($this->request){ //
$client_policy_id = $this->request->getVar('client_policy_id') ?? $clientPolicyId;
$emp_code = $this->request->getVar('emp_code') ?? $empCode;
$default_si = $this->request->getVar('si') ?? $default_si;// si amt which choosed in add on policy
$client_branch_id = $this->request->getVar('client_branch_id') ?? $client_branch_id;
}else{
//Cli and enrollment
$client_policy_id = $clientPolicyId;
$emp_code = $empCode;
$default_si = $default_si;// si amt which choosed in add on policy
$client_branch_id =$client_branch_id;
}
// dd($client_policy_id);
$client_id = ($this->clientPolicyModel->select('client_id')->find($client_policy_id))['client_id'];
// get policy and rack details
$policy_terms = $this->clientPolicyModel->getPolicyDetails($client_id,$client_policy_id);
$policy_type = $policy_terms[0]->is_addon;
$base_policy = $policy_terms[0]->base_policy;
$policy_terms = (array) $policy_terms[0];// convert obj to array
//get policy slab rates
$slab_details = $this->policesModel->getPolicySlabRatesForEmpOnboard($client_policy_id,$client_id);
// print_r($slab_details);die();
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(client_id: $client_id,client_policy_id: $client_policy_id,emp_code: $emp_code,emp_status:['draft','enrolled'],policy_status:['draft','enrolled']);
// kint::dump($existing_famility_details);
//get the Auto SI amount
$auto_si_data = update_si_with_auto_si($client_id, $client_policy_id, $emp_code, $client_branch_id, $existing_famility_details);
log_message('error', '----- Auto SI Amount : {data} -----', ['data' => $auto_si_data]);
//Change the basic cover si to the auto si amount if the auto_si_amount is not null
if(!empty($auto_si_data)){
foreach ($existing_famility_details as $emp_code => &$records) {
$records['basic_cover_si'] = $auto_si_data;
}
unset($record);
}
// dd($existing_famility_details);
if(!count($existing_famility_details) && $policy_type == 2)//top up addon only
{
//get basepolicy id then pull emplist from base policy if only current policy is DA addon policy and emplist is zero
// echo 'inside';
$client_policy_id = $base_policy;
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(client_id: $client_id,client_policy_id: $client_policy_id,emp_code: $emp_code,emp_status:['draft','enrolled'],policy_status:['draft','enrolled']);
}
$file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception'];
// dd($this->employeeModel->getLastQuery());
// print_r($existing_famility_details);die();
$employee_data_group_by_family = data_group_by_family($existing_famility_details,$data_source = 'db');
// print_rr(($employee_data_group_by_family));die();
$existing_units = $this->clientBranchModel->getExisitingUnits(client_id: $client_id,client_branch_id: $client_branch_id);
foreach ($employee_data_group_by_family as $emp_id => $family)
{
$transformed_famility_details = transform_db_data_to_excel($family);
$data = calculate_premium_new(family_data: $transformed_famility_details,policy_terms:$policy_terms,slab_details:$slab_details,fileArr: $file,existing_units: $existing_units,default_si : $default_si);
$employee_data_group_by_family[$emp_id] = $data;
}
if($clientPolicyId != null && $empCode != null)
{ // dd ($employee_data_group_by_family);
return $employee_data_group_by_family;
}else{
// dd ($employee_data_group_by_family);
return $this->respond(['status' => 'success','code' => (count($employee_data_group_by_family) ? 200 : 404),'data' => [$employee_data_group_by_family] ], 200);
}
}
@ -2536,7 +2620,7 @@ class EmployeeRestController extends AdminController
if($employee_policy[0]['tpa_id'] != null)
$data['eCardDownload'] = base_url('download-e-card/') . $employee_policy[0]['rand_string'];
$data['eCardDownload'] = base_url('download-e-card/') . $employee_policy[0]['rand_string'].'/1';
else
$data['eCardDownload'] = null;
@ -2635,7 +2719,7 @@ class EmployeeRestController extends AdminController
$finalarray[$value] = $termsValue;
}
}
if(is_array($terms->gpa_special_condition_label) && is_array($terms->gpa_special_condition_input)){
if(isset(($terms->gpa_special_condition_label)) && is_array($terms->gpa_special_condition_label) && is_array($terms->gpa_special_condition_input)){
for ($i=0; $i < count($terms->gpa_special_condition_label); $i++) {
$finalarray[$terms->gpa_special_condition_label[$i]] = $terms->gpa_special_condition_input[$i];
}
@ -2657,7 +2741,7 @@ class EmployeeRestController extends AdminController
$finalarray[$value] = $termsValue;
}
}
if(is_array($terms->special_condition_label) && is_array($terms->special_condition_input)){
if(isset(($terms->special_condition_label)) && is_array($terms->special_condition_label) && is_array($terms->special_condition_input)){
for ($i=0; $i < count($terms->special_condition_label); $i++) {
$finalarray[$terms->special_condition_label[$i]] = $terms->special_condition_input[$i];
}

0
app/Controllers/GoogleDriveController.php Normal file → Executable file
View File

0
app/Controllers/LeadsController.php Normal file → Executable file
View File

0
app/Controllers/PolicyTransactionController.php Normal file → Executable file
View File

0
app/Helpers/ExcelMergeHelper.php Normal file → Executable file
View File

0
app/Helpers/ExcelSanitizeHelper.php Normal file → Executable file
View File

0
app/Helpers/GmailResponseHandler.php Normal file → Executable file
View File

0
app/Helpers/drive_helper.php Normal file → Executable file
View File

0
app/Libraries/MyGoogleDrive.php Normal file → Executable file
View File

0
app/Models/AuditHistoryModel.php Normal file → Executable file
View File

0
app/Models/AutoSIModel.php Normal file → Executable file
View File

0
app/Models/COShareStmtDetailsModel.php Normal file → Executable file
View File

0
app/Models/EndorsementModel.php Normal file → Executable file
View File

0
app/Models/GmailSentHistoryModel.php Normal file → Executable file
View File

0
app/Models/InsurerStatements.php Normal file → Executable file
View File

0
app/Models/InvPaymentDetailsModel.php Normal file → Executable file
View File

0
app/Models/LeadsModel.php Normal file → Executable file
View File

0
app/Models/MailAttachmentModel.php Normal file → Executable file
View File

0
app/Models/PTCOShareDetailsModel.php Normal file → Executable file
View File

0
app/Models/PTFileModel.php Normal file → Executable file
View File

0
app/Models/PolicyTransactionModel.php Normal file → Executable file
View File

0
app/Models/PolicyTransactionStatusModel.php Normal file → Executable file
View File

0
app/Models/RFQModel.php Normal file → Executable file
View File

0
app/Models/SIMappingModel.php Normal file → Executable file
View File

0
app/Models/VehicleModel.php Normal file → Executable file
View File

0
app/Views/bds_dash.php Normal file → Executable file
View File

0
app/Views/business_team_list.php Normal file → Executable file
View File

0
app/Views/client_others_tab.php Normal file → Executable file
View File

0
app/Views/dms_search.php Normal file → Executable file
View File

0
app/Views/drive_file_upload.php Normal file → Executable file
View File

0
app/Views/finance_team_list.php Normal file → Executable file
View File

0
app/Views/insurer_statement_list.php Normal file → Executable file
View File

0
app/Views/leads_form.php Normal file → Executable file
View File

0
app/Views/leads_list.php Normal file → Executable file
View File

0
app/Views/log_content_view.php Normal file → Executable file
View File

0
app/Views/log_view.php Normal file → Executable file
View File

0
app/Views/outstanding_report_list.php Normal file → Executable file
View File

0
app/Views/policy_transaction_endorsement_form.php Normal file → Executable file
View File

0
app/Views/policy_transaction_endorsement_list.php Normal file → Executable file
View File

0
app/Views/policy_transaction_inception_form.php Normal file → Executable file
View File

0
app/Views/policy_transaction_inception_list.php Normal file → Executable file
View File

0
app/Views/pt_form_file_upload_tab.php Normal file → Executable file
View File

0
app/Views/rack_rate_auto_si.php Normal file → Executable file
View File

0
app/Views/report_bds.php Normal file → Executable file
View File

0
app/Views/report_bds_filter.php Normal file → Executable file
View File

0
app/Views/report_bds_old.php Normal file → Executable file
View File

0
app/Views/si_mapping.php Normal file → Executable file
View File

0
app/Views/test_members_list.php Normal file → Executable file
View File

0
app/Views/variance_report_list.php Normal file → Executable file
View File

0
app/Views/vehicle_details.php Normal file → Executable file
View File

0
app/Views/vehicle_docs.php Normal file → Executable file
View File

0
app/Views/vehicle_master_list.php Normal file → Executable file
View File

0
app/Views/view_rfq.php Normal file → Executable file
View File

0
nhance-app-google-drive.json Normal file → Executable file
View File

0
public/assets/images/chatbot.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 9.8 KiB

After

Width:  |  Height:  |  Size: 9.8 KiB

0
public/assets/images/login_bg.jpg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 219 KiB

After

Width:  |  Height:  |  Size: 219 KiB

0
public/oauth-412703-c47b73db19c0.json Normal file → Executable file
View File

0
public/sample_excel/insurer_stament_sample.xlsx Normal file → Executable file
View File

0
public/sample_import_excel/sample_import_Addition.xlsx Normal file → Executable file
View File

0
public/sample_import_excel/sample_import_Deletion.xlsx Normal file → Executable file
View File

View File

View File

View File

View File

0
tests/unit/LeadsControllerTest.php Normal file → Executable file
View File