Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
velz 2024-12-17 11:29:40 +05:30
commit 7569e57a54
28 changed files with 2132 additions and 731 deletions

View File

@ -26,6 +26,8 @@ $routes->get("updateRemainderDate", "ClientController::updateRemainderDate");
$routes->get("sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail");
$routes->get("sendextraparam", "ClientController::sendextraparam");
// $routes->post("iAgreeForAddOn", "EmployeeRestController::iAgreeForAddOn");
// $routes->get("sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail");
// $routes->post("employeeUpload", "EmployeeRestController::employeeUpload");
$routes->post("add_advertise_image", "AppContentManagementController::add_advertise_image");
$routes->get("add_image_index", "AppContentManagementController::add_image_index");
@ -134,6 +136,11 @@ $routes->group("/client", ["filter" => "authMVC"], function ($routes) {
$routes->get("list/(:any)", "ClientController::listVehicleFiles/$1");
$routes->get("delete/(:any)", "ClientController::deleteVehicleFiles/$1");
});
$routes->group("others", ["filter" => "authMVC"], function ($routes) {
$routes->post("create", "ClientController::createOtherTabContent");
});
});
$routes->group("/employee", ["filter" => "authMVC"], function ($routes) {
@ -448,11 +455,11 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
$routes->get("getFEContent", "EmployeeRestController::getFEContent");
$routes->get("getAdvertisementImage", "EmployeeRestController::getAdvertisementImage");
});
$routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy");
$routes->get("sendPushNotification", "EmployeeRestController::sendPushNotification");
$routes->post("sendEmail", "EmployeeRestController::send_email");
$routes->get("getFamilyPolicyDetails", "EmployeeRestController::getFamilyPolicyDetails");
$routes->get("getBackToEnrolledDetails", "EmployeeRestController::getBackToEnrolledDetails");
// Ticketing System

View File

@ -73,7 +73,7 @@ class ChatBotController extends AdminController
public function getChatResponse()
{
// try {
try {
$emp_code = $this->request->getVar('emp_code');
$client_id = $this->request->getVar('client_id');
$client_branch_id = $this->request->getVar('client_branch_id');
@ -236,9 +236,9 @@ class ChatBotController extends AdminController
return $this->respond(['status' => 'failed','code' => 404,'data' => 'No Data'],404);
}
// } catch (\Throwable $th) {
// return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
// }
} catch (\Throwable $th) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
}
}

View File

@ -118,6 +118,8 @@ class ClientController extends AdminController
$this->leadsModel = new LeadsModel();
}
//--------------------------------------------------------------------------------------------------------
public function checkDuplicateTableFieldValue()
{
$table = $this->request->getPost('table');
@ -181,7 +183,7 @@ class ClientController extends AdminController
print_rr($attachments);
}
public function testingForReviewMail($client_id = 77, $emp_code = 'EMP001-K1', $mail_active = 1) //this function for only tsesting some logics not use for business logic
public function testingForReviewMail($client_id = 77, $emp_code = 'EMP001-K1', $mail_active = 0) //this function for only tsesting some logics not use for business logic
{
$client_policy_ids = $this->employeeModel
@ -315,6 +317,8 @@ class ClientController extends AdminController
// return $this->respond(['status' => 'success','code' => 200,'data' => [] ], 200);
}
//--------------------------------------------------------------------------------------------------------
public function index()
{
$this->myLogger->logme('error', 'Client list function called');
@ -2079,6 +2083,11 @@ class ClientController extends AdminController
$data['age_ratio']['elders']['min'] = $this->request->getPost("other_member_min_age") ? $this->request->getPost("other_member_min_age") : 0;
$data['age_ratio']['elders']['max'] = $this->request->getPost("other_member_max_age") ? $this->request->getPost("other_member_max_age") : 0;
$data['is_payable_employee']['self'] = $this->request->getPost("is_payable_employee_for_self") ? 1 : 0;
$data['is_payable_employee']['spouse'] = $this->request->getPost("is_payable_employee_for_spouse") ? 1 : 0;
$data['is_payable_employee']['childern'] = $this->request->getPost("is_payable_employee_for_child") ? 1 : 0;
$data['is_payable_employee']['elders'] = $this->request->getPost("is_payable_employee_for_elders") ? 1 : 0;
// if (!in_array("self", $data['family_floaters'])) {
@ -2169,6 +2178,7 @@ class ClientController extends AdminController
$data['preandpostnatal'] = "";
$data['babyday1cover'] = "";
}
$data['9monthwaitingperiodwaived'] = str_replace(',', '', $this->request->getPost("9monthwaitingperiodwaived"));
$data['coverfromthedateofjoining'] = str_replace(',', '', $this->request->getPost("coverfromthedateofjoining"));
$data['waiverof1,2,3&4thyearexclusions'] = $this->request->getPost("waiverof1,2,3&4thyearexclusions");
@ -2309,6 +2319,8 @@ class ClientController extends AdminController
$data['totalSumInsured'] = str_replace(',', '', $this->request->getPost("totalSumInsured"));
$data['age_ratio']['self']['min'] = $this->request->getPost("self_min_age");
$data['age_ratio']['self']['max'] = $this->request->getPost("self_max_age");
$data['is_payable_employee']['self'] = 0;
$data['accidentalDeathBenefit'] = str_replace(',', '', $this->request->getPost("accidentalDeathBenefit"));
$data['permanentTotalDisablement'] = str_replace(',', '', $this->request->getPost("permanentTotalDisablement"));
$data['permanentPartialDisablement'] = $this->request->getPost("permanentPartialDisablement");
@ -2442,11 +2454,11 @@ class ClientController extends AdminController
$termsData = json_decode($termsData['policy_terms']);
if (isset($termsData->sum_insured) && empty($termsData->sum_insured)) {
if (isset($termsData->sum_insured) && $termsData->sum_insured == "" && $termsData->sum_insured == null) {
return $this->respond(['status' => false, 'code' => 200, 'message' => 'The Policy terms Sum Insured field is empty', 'data' => $record], 200);
}
if (isset($termsData->SumInsured) && empty($termsData->sum_insured)) {
if (isset($termsData->sumInsured2) && $termsData->sumInsured2 == "" && $termsData->sumInsured2 == null) {
return $this->respond(['status' => false, 'code' => 200, 'message' => 'The Policy terms Sum Insured field is empty'], 200);
}
@ -2892,6 +2904,13 @@ class ClientController extends AdminController
$client_policy_id = $this->request->getPost("client_policy_id");
$policy_terms = $this->request->getPost("policy_terms");
if (!empty($policy_terms)) {
$policy_terms = json_decode($policy_terms, true);
$policy_terms['is_payable_employee']['self'] = 0;
$policy_terms = json_encode($policy_terms);
}
$record = $this->clientPolicyModel->where('id', $client_policy_id)->first();
if ($record) {
@ -3602,15 +3621,22 @@ class ClientController extends AdminController
dd($result);
}
// ---------------------------------------------------------------------------------------------------------
public function updatePolicyTermsKey()
{
$client_id = $this->request->getGet('client_id');
$data = $this->clientPolicyModel
$query = $this->clientPolicyModel
->where("policy_terms IS NOT NULL AND policy_terms <> ''")
->where('policy_type_id', 2)
->where('is_active', 1)
->findAll();
->where('is_active', 1);
if (!empty($client_id)) {
$query->where('client_id', $client_id);
}
$data = $query->findAll();
for ($i = 0; $i < count($data); $i++) {
if (isset($data[$i]['policy_terms']) && !empty($data[$i]['policy_terms'])) {
@ -3619,49 +3645,110 @@ class ClientController extends AdminController
continue;
}
// Set default value of copayzonewisecopay to "empty"
$ans = isset($policyTerms['copayzonewisecopay']) ? $policyTerms['copayzonewisecopay'] : 'empty';
$is_addon = $data[$i]['is_addon'];
$payable_arr = [];
if (in_array($data[$i]['policy_type_id'], [2,3]) && $is_addon == 1) {
$payable_arr = [ "self" => 0, "spouse" => 0, "childern" => 0, "elders" => 0, ];
} else if ($data[$i]['policy_type_id'] == 3 && $is_addon == 3) {
$payable_arr = ["self" => 1,"spouse" => 1,"childern" => 1,"elders" => 1,];
} else if (in_array($data[$i]['policy_type_id'], [4, 5])) {
$payable_arr = ["self" => 1,"spouse" => 1,"childern" => 1,"elders" => 1,];
}
// Initialize an empty array for the ordered policy terms
$orderedPolicyTerms = [];
// Add copayzonewisecopay and copayzonewisecopaydata if they exist_
if (isset($policyTerms['copayzonewisecopay'])) {
if(in_array($data[$i]['policy_type_id'], [2,3,4,5])){
if(!isset($policyTerms['co_pay_details'])){
// Set default value of copayzonewisecopay to "empty"
$ans = isset($policyTerms['copayzonewisecopay']) ? $policyTerms['copayzonewisecopay'] : 'empty';
$co_pay_details_value = "";
if (strtolower($ans) == "nil" || $ans == 0) {
$policyTerms['copayzonewisecopay'] = 0;
$co_pay_details_value = "";
} elseif ($ans != 'empty' && $ans !== 'Nil' && $ans !== null && $ans != '' && $ans != 0) {
$policyTerms['copayzonewisecopay'] = 1;
$co_pay_details_value = $ans;
// add is_payable_employee for the GMC Policy
if (isset($policyTerms['age_ratio'])) {
if(!isset($policyTerms['is_payable_employee'])){
$aliment_index = array_search('age_ratio', array_keys($policyTerms));
$orderedPolicyTerms[] = [
"key" => "is_payable_employee",
"value" => $payable_arr,
"position" => $aliment_index + 1,
];
}
$co_pay_index = array_search('copayzonewisecopay', array_keys($policyTerms));
$orderedPolicyTerms[] = [
"key" => "co_pay_details",
"value" => $co_pay_details_value,
"position" => $co_pay_index + 1,
];
unset($policyTerms['optionalparentalcopay']);
}
// Add copayzonewisecopay and copayzonewisecopaydata if they exist_
if (isset($policyTerms['copayzonewisecopay'])) {
if(!isset($policyTerms['co_pay_details'])){
$co_pay_details_value = "";
if (strtolower($ans) == "nil" || $ans == 0) {
$policyTerms['copayzonewisecopay'] = 0;
$co_pay_details_value = "";
} elseif ($ans != 'empty' && $ans !== 'Nil' && $ans !== null && $ans != '' && $ans != 0) {
$policyTerms['copayzonewisecopay'] = 1;
$co_pay_details_value = $ans;
}
$co_pay_index = array_search('copayzonewisecopay', array_keys($policyTerms));
$orderedPolicyTerms[] = [
"key" => "co_pay_details",
"value" => $co_pay_details_value,
"position" => $co_pay_index + 2,
];
unset($policyTerms['optionalparentalcopay']);
}
}
// Add ailmentcapping and ailmentcappingdata if they exist
if (isset($policyTerms['ailmentcapping'])) {
if(!isset($policyTerms['ailment_capping_details'])){
$aliment_index = array_search('ailmentcapping', array_keys($policyTerms));
$orderedPolicyTerms[] = [
"key" => "ailment_capping_details",
"value" => "",
"position" => $aliment_index + 3,
];
}
}
}else {
// add is_payable_employee for the GMC Policy
if (isset($policyTerms['age_ratio'])) {
if(!isset($policyTerms['is_payable_employee'])){
$aliment_index = array_search('age_ratio', array_keys($policyTerms));
$orderedPolicyTerms[] = [
"key" => "is_payable_employee",
"value" => [
"self" => 0,
],
"position" => $aliment_index + 1,
];
}
}else{
if(!isset($policyTerms['is_payable_employee'])){
$orderedPolicyTerms[] = [
"key" => "is_payable_employee",
"value" => [
"self" => 0,
],
"position" => 2,
];
}
}
}
// Add ailmentcapping and ailmentcappingdata if they exist_
if (isset($policyTerms['ailmentcapping'])) {
if(!isset($policyTerms['ailment_capping_details'])){
$aliment_index = array_search('ailmentcapping', array_keys($policyTerms));
$orderedPolicyTerms[] = [
"key" => "ailment_capping_details",
"value" => "",
"position" => $aliment_index + 2,
];
}
}
foreach ($orderedPolicyTerms as $term) {
$position = $term['position'];
@ -3706,10 +3793,24 @@ class ClientController extends AdminController
dd($days);
}
public function sendextraparam(){
public function sendextraparam()
{
// $batch_data = [
// 'client_id' => 17,
// 'client_policy_id' => 30,
// 'client_branch_id' => 18,
// ];
// $batch_data['insurer_or_tpa'] = 'insurer';
// $batch_data['insurer_or_tpa'] = 'tpa';
// dd($this->request);
// $employeeRestController = new EmployeeServiceController();
// $employeeRestController->employeesEnrollmentInsert(['file_id' => 715]);
// $employeeRestController->employeesEnrollmentInsert(['file_id' => 721]);
// $r = Jobs::addJob(['job_name' => 'employeesEnrollmentInsert','payload' => ['file_id' => 721]]);
// $dashBoardController = new DashboardController();
// $client_policy_data = $this->clientPolicyModel->getPolicyDetailsForRemainder($client_id=159, $client_branch_id=126);
@ -3719,6 +3820,60 @@ class ClientController extends AdminController
// $emp_data = $this->employeePolicyModel->getEmployeePolicyForEcard(12);
// $ids = array_column($emp_data, 'id');
// $EmpDataServiceController->sendMailForDownloadingECard($ids);
// $EmpDataServiceController = new EmpDataServiceController();
// $EmpDataServiceController->importDeletionValidation(['file_id' => 304]); //for live
// $result = $this->employeePolicyModel->getDeletionEmployeeDataForExportExcel($batch_data);
// print_rr($result); die;
// $empServiceController = new EmployeeServiceController();
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => '741']);
// $PolicyTransactionController = new PolicyTransactionController();
// $res = $PolicyTransactionController->validateInsurerStatement(['file_id' => '36']);
}
// -------------------------------------------------------------------------------------------------------
public function createOtherTabContent()
{
$this->myLogger->logme('error', 'Client Others function called');
$data = $this->request->getPost();
$data['created_by'] = get_session_userid();
$client_id = $data['client_id'];
unset($data['client_id']);
$insert = $this->clientModel->where('id', $client_id)->set($data)->update();
if ($insert) {
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Client others data updated', 'data' => $data], 200);
} else {
return $this->respond(['status' => false, 'code' => 404, 'message' => 'No data to update'], 200);
}
}
// -------------------------------------------------------------------------------------------------------
public function enrollmentAddonSIAmountDropdown($client_policy_id)
{
if(!empty($client_policy_id)){
$client_policy_details = $this->clientPolicyModel->where('id', $client_policy_id)->where('policy_status', 1)->where('is_active', 1)->first();
if(!empty($client_policy_details) && $client_policy_details['policy_type_id'] == 3 && $client_policy_details['is_addon'] == 3){
$base_policy_id = $client_policy_details['base_policy'] ?? 0;
if(!empty($base_policy_id)){
}
}
}
}
}

View File

@ -365,41 +365,81 @@ class DashboardController extends AdminController
foreach ($client_policy_data as $client_policy) {
if (empty($send_mail_for_manual_or_crone)) {
// Fetch client data
$client_data = $this->clientModel->find($client_policy['client_id']);
// Fetch client data
$client_data = $this->clientModel->find($client_policy['client_id']);
// Fetch notification settings
$notification_data = $this->notificationModel
->where('client_id', $client_policy['client_id'])
->where('template_name', 'member_reminder_mail')
->first();
// Fetch notification settings
$notification_data = $this->notificationModel
->where('client_id', $client_policy['client_id'])
->where('template_name', 'member_reminder_mail')
->first();
if ($notification_data && $notification_data['enabled'] == 1 && !empty($notification_data['mail_content'])) {
// $this->myLogger->logme('error', 'Notification data fetched: ' . json_encode($notification_data));
//manaual
if (empty($send_mail_for_manual_or_crone)) {
// Check if notification should be sent
if ($notification_data && $notification_data['enabled'] == 1 && !empty($notification_data['mail_content'])) {
// Check if notification should be sent
$this->myLogger->logme('error', 'Notification should be sent for client policy ID: ' . $client_policy['id']);
// Fetch all employees related to the client policy
$employees = $this->employeePolicyModel
->select('employees.*, employee_polices.id as emp_policy_id')
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
->where('employee_polices.client_policy_id', $client_policy['id'])
->where('employees.emp_status', 'draft')
->where('employees.is_active', 1)
->where('employee_polices.status', 'draft')
->where('employee_polices.is_active', 1)
->where('employees.relationship', 'Self')
->findAll();
$employees = [];
if (in_array($client_policy['policy_type_id'], [2, 4]) || ($client_policy['policy_type_id'] == 3 && $client_policy['is_addon'] == 1)) {
// dd($employees);
// Fetch all employees related to the client policy
$employees = $this->employeePolicyModel
->select('employees.*, employee_polices.id as emp_policy_id')
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
->where('employee_polices.client_policy_id', $client_policy['id'])
->where('employees.is_active', 1)
->where('employee_polices.is_active', 1)
->where('employees.emp_status', 'draft')
->where('employee_polices.status', 'draft')
->where('employees.relationship', 'Self')
->where("employees.email_corporate IS NOT NULL AND employees.email_corporate != ''")
->findAll();
// dd($employees, 'first');
} else if (($client_policy['policy_type_id'] == 3 && $client_policy['is_addon'] == 3) || $client_policy['policy_type_id'] == 5) {
$empDependentData = $this->employeePolicyModel
->select('employees.*, employee_polices.id as emp_policy_id')
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
->where('employee_polices.client_policy_id', $client_policy['id'])
->where('employees.is_active', 1)
->where('employee_polices.is_active', 1)
->where('employees.emp_status', 'draft')
->where('employee_polices.status', 'draft')
->where('employees.relationship !=', 'Self')
->findAll();
$empCodes = array_column($empDependentData, 'emp_code');
// dd($empDependentData, $empCodes,'second');
if (!empty($empCodes)) {
$empSelfData = $this->employeePolicyModel
->select('employees.*, employee_polices.id as emp_policy_id')
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
->whereIn('employees.emp_code', $empCodes)
->where('employees.is_active', 1)
->where('employee_polices.is_active', 1)
->where('employees.relationship', 'Self')
->where("employees.email_corporate IS NOT NULL AND employees.email_corporate != ''")
->findAll();
$employees = array_merge($employees, $empSelfData);
}
}
// dd($employees);
// Process each employee
foreach ($employees as $employee) {
if (!empty($employees) && count($employees) > 0) {
foreach ($employees as $employee) {
if ($employee['emp_status'] == 'draft' && $employee['relationship'] == 'Self') {
$this->myLogger->logme('error', 'Employee status and relationship check passed for employee ID: ' . $employee['id']);
// Mail params
@ -407,8 +447,8 @@ class DashboardController extends AdminController
$params['client_data'] = $client_data;
$params['notification_data'] = $notification_data;
$params['common'] = [
'client_id' => $client_policy['client_id'],
'client_branch_id' => $client_policy['client_branch_id'],
'client_id' => $client_policy['client_id'],
'client_branch_id' => $client_policy['client_branch_id'],
'client_policy_id' => $client_policy['id'],
'employee_policy_id' => $employee['emp_policy_id'],
'employee_id' => $employee['id'],
@ -422,50 +462,76 @@ class DashboardController extends AdminController
$reminder_whole_mail[] = $mail_result[0];
}
}
} else {
$this->myLogger->logme('error', 'Notification was not sent for Client Policy ID: ' . $client_policy['id']);
$this->myLogger->logme('error', 'Notification setup not found or not enabled');
}
} else {
$currentDate = date('d');
$remainder_dates = explode(",", $client_policy['reminder_date']);
} else { // crone
foreach ($remainder_dates as $date) {
if (!empty($client_policy['reminder_date'])) {
if ($currentDate == $date) {
$currentDate = date('d');
$remainder_dates = explode(",", $client_policy['reminder_date']);
$client_data = $this->clientModel->find($client_policy['client_id']);
foreach ($remainder_dates as $date) {
// Fetch notification settings
$notification_data = $this->notificationModel
->where('client_id', $client_policy['client_id'])
->where('template_name', 'member_reminder_mail')
->first();
if ($currentDate == $date) {
// Check if notification should be sent
if ($notification_data && $notification_data['enabled'] == 1 && !empty($notification_data['mail_content'])) {
$this->myLogger->logme('error', 'Notification should be sent for client policy ID: ' . $client_policy['id']);
// echo '4';
// Fetch all employees related to the client policy
$employees = [];
if (in_array($client_policy['policy_type_id'], [2, 4]) || ($client_policy['policy_type_id'] == 3 && $client_policy['is_addon'] == 1)) {
$this->myLogger->logme('error', 'Notification should be sent for client policy ID: ' . $client_policy['id']);
$employees = $this->employeePolicyModel
->select('employees.*, employee_polices.id as emp_policy_id')
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
->where('employee_polices.client_policy_id', $client_policy['id'])
->where('employees.is_active', 1)
->where('employee_polices.is_active', 1)
->where('employees.emp_status', 'draft')
->where('employee_polices.status', 'draft')
->where('employees.relationship', 'Self')
->where("employees.email_corporate IS NOT NULL AND employees.email_corporate != ''")
->findAll();
// Fetch all employees related to the client policy
$employees = $this->employeePolicyModel
->select('employees.*, employee_polices.id as emp_policy_id')
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
->where('employee_polices.client_policy_id', $client_policy['id'])
->where('employees.emp_status', 'draft')
->where('employees.is_active', 1)
->where('employee_polices.status', 'draft')
->where('employee_polices.is_active', 1)
->where('employees.relationship', 'Self')
->findAll();
// dd($employees, 'first');
// Process each employee
foreach ($employees as $employee) {
} else if (($client_policy['policy_type_id'] == 3 && $client_policy['is_addon'] == 3) || $client_policy['policy_type_id'] == 5) {
$empDependentData = $this->employeePolicyModel
->select('employees.*, employee_polices.id as emp_policy_id')
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
->where('employee_polices.client_policy_id', $client_policy['id'])
->where('employees.is_active', 1)
->where('employee_polices.is_active', 1)
->where('employees.emp_status', 'draft')
->where('employee_polices.status', 'draft')
->where('employees.relationship !=', 'Self')
->findAll();
$empCodes = array_column($empDependentData, 'emp_code');
// dd($empDependentData, $empCodes,'second');
if (!empty($empCodes)) {
$empSelfData = $this->employeePolicyModel
->select('employees.*, employee_polices.id as emp_policy_id')
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
->whereIn('employees.emp_code', $empCodes)
->where('employees.is_active', 1)
->where('employee_polices.is_active', 1)
->where('employees.relationship', 'Self')
->where("employees.email_corporate IS NOT NULL AND employees.email_corporate != ''")
->findAll();
$employees = array_merge($employees, $empSelfData);
}
}
// dd($employees);
// Process each employee
foreach ($employees as $employee) {
if ($employee['emp_status'] == 'draft' && $employee['relationship'] == 'Self') {
$this->myLogger->logme('error', 'Employee status and relationship check passed for employee ID: ' . $employee['id']);
// Mail params
@ -473,8 +539,8 @@ class DashboardController extends AdminController
$params['client_data'] = $client_data;
$params['notification_data'] = $notification_data;
$params['common'] = [
'client_id' => $client_policy['client_id'],
'client_branch_id' => $client_policy['client_branch_id'],
'client_id' => $client_policy['client_id'],
'client_branch_id' => $client_policy['client_branch_id'],
'client_policy_id' => $client_policy['id'],
'employee_policy_id' => $employee['emp_policy_id'],
'employee_id' => $employee['id'],
@ -486,13 +552,19 @@ class DashboardController extends AdminController
// $this->myLogger->logme('error', 'Mail sent result: ' . json_encode($mail_result));
$reminder_whole_mail[] = $mail_result[0];
}
}
} else {
// echo '5';
$this->myLogger->logme('error', 'Notification not sent for client policy ID: ' . $client_policy['id']);
}
} else {
$this->myLogger->logme('error', "SEND REMAINDER CRONE --- Remainder date is empty()");
}
}
} else {
$this->myLogger->logme('error', 'Notification setup not found or not enabled');
$this->myLogger->logme('error', 'Notification was not sent for this Client ID: ' . $client_policy['client_id']);
}
}
@ -516,13 +588,13 @@ class DashboardController extends AdminController
}
}
public function sendManualReminder($client_id, $client_branch_id)
public function sendManualReminder($client_id, $client_branch_id, $client_policy_id = null)
{
$this->myLogger->logme('error','Log Works');
$this->myLogger->logme('error', "sendManualRemainder called with client_id: {$client_id}, client_branch_id: {$client_branch_id}");
$client_policy_data = $this->clientPolicyModel->getPolicyDetailsForRemainder($client_id, $client_branch_id);
$client_policy_data = $this->clientPolicyModel->getPolicyDetailsForRemainder($client_id, $client_branch_id, $client_policy_id);
// print_r($client_policy_data); die;
// print_r($this->clientPolicyModel->getLastQuery()); die;
// $this->myLogger->logme('error', "Policy details fetched: " . json_encode($client_policy_data));

View File

@ -751,11 +751,15 @@ class EmpDataServiceController extends BaseController
public function generateExcelForDeletion($export_data)
{
{
// dd($export_data);
$ids = [];
$objects = $this->employeePolicyModel->getDeletionEmployeeDataForExportExcel($export_data);
// dd($objects);
$totals = 0;
foreach ($objects as $obj) {
$ids[] = $obj->endorsement_primarykey;
@ -2932,6 +2936,14 @@ class EmpDataServiceController extends BaseController
$batch_code = $file['batch_code'];
$user_id = $file['created_by'];
$ref_data = [
'client_id' => $client_id,
'client_policy_id' => $client_policy_id,
'client_branch_id' => $client_branch_id,
'insurer_or_tpa' => $file['insurer_or_tpa'],
'event_type' => $file['event_type'],
];
$file_name_with_path = WRITEPATH . "/uploads/import_excel/" . $file['file_name'];
@ -2963,72 +2975,8 @@ class EmpDataServiceController extends BaseController
}
}
$db = \Config\Database::connect();
$sql = "
SELECT DISTINCT
a.id as endorsement_primarykey,
a.group_key,
employee_polices.id as primaryKey,
employees.name AS emp_name,
employees.emp_code AS emp_code,
employees.dob AS emp_dob,
employees.gender AS emp_gender,
employees.relationship AS emp_relationship,
'Has Define' as emp_type,
employee_polices.basic_cover_si,
employee_polices.uhid as risk_id,
employee_polices.policy_end_date,
employee_polices.rata_premimum as premium,
deletiondata.empstatus,
deletiondata.changeevent,
deletiondata.dateofexit,
deletiondata.reasonforexit,
deletiondata.status,
DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) AS no_of_days,
ROUND((employee_polices.rata_premimum * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365, 2) AS pro_rata_premium,
ROUND(((employee_polices.rata_premimum * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365) * 0.18, 2) AS gst,
ROUND(((employee_polices.rata_premimum * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365) + (((employee_polices.rata_premimum * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365) * 0.18), 2) AS total
FROM
emp_endorsement a
LEFT JOIN
employees ON a.emp_code = employees.emp_code and a.pk = employees.id
LEFT JOIN
employee_polices ON employees.id = employee_polices.employee_id
LEFT JOIN(
select aa.emp_code, aa.new_value as 'empstatus', bb.new_value as 'changeevent', cc.new_value as 'dateofexit', dd.new_value as 'reasonforexit', ee.new_value as 'status' from
( SELECT a1.emp_code, a1.field_name, a1.new_value from emp_endorsement as a1 where a1.field_name = 'emp_status') aa
left join
( SELECT b1.emp_code, b1.field_name, b1.new_value from emp_endorsement as b1 where b1.field_name = 'change_event') bb on aa.emp_code = bb.emp_code
left join
( SELECT c1.emp_code, c1.field_name, c1.new_value from emp_endorsement as c1 where c1.field_name = 'date_of_exit') cc on aa.emp_code = cc.emp_code
left join
( SELECT d1.emp_code, d1.field_name, d1.new_value from emp_endorsement as d1 where d1.field_name = 'reason_for_exit') dd on aa.emp_code = dd.emp_code
left JOIN
( SELECT e1.emp_code, e1.field_name, e1.new_value from emp_endorsement as e1 where e1.field_name = 'status') ee on aa.emp_code = ee.emp_code
) as deletiondata on a.emp_code = deletiondata.emp_code
WHERE employee_polices.client_policy_id = '$client_policy_id'
AND employees.client_branch_id = '$client_branch_id'
AND a.actions = 'd'
AND employee_polices.is_active = 1
AND employee_polices.status = 'active'
AND employees.is_active = 1
AND employees.emp_status = 'active'
AND (a.endorsement_id IS NULL OR a.endorsement_id = '')
group by group_key
";
$query = $db->query($sql);
$endorsement_data = $query->getResultArray();
$objects = $this->employeePolicyModel->getDeletionEmployeeDataForExportExcel($ref_data, 1);
$endorsement_data = $objects;
// dd($endorsement_data);

View File

@ -711,16 +711,25 @@ class EmployeeController extends AdminController
public function enrollmentClientList()
{
$data = [];
$client_list = $this->clientModel->findAll();
$branch_list = $this->clientBranchModel->findAll();
$client_list = $this->clientModel->where('clients.is_active', 1)->findAll();
$branch_list = $this->clientBranchModel->where('client_branch.is_active', 1)->findAll();
$policy_list = $this->clientPolicyModel
->select('client_policy.*, policy_type.policy_type')
->join('policy_type', 'client_policy.policy_type_id = policy_type.id')
->where('client_policy.is_active', 1)
->findAll();
$data['client_list'] = $client_list;
$data['branch_list'] = $branch_list;
$data['policy_list'] = $policy_list;
// Get session data if available
$data['selected_client_id'] = session()->get('client_id');
$data['selected_branch_id'] = session()->get('branch_id');
$data['selected_type'] = session()->get('type');
// dd($data);
$this->myLogger->logme('error', 'list called');
return $this->loadLayout('enrollment_list', $data);
@ -1753,9 +1762,11 @@ class EmployeeController extends AdminController
public function update_emp_data()
{
$data = $this->request->getPost();
$data['dob'] = date('Y-m-d', strtotime($data['dob']));
// print_rr($data);
// $data['dob'] = date('Y-m-d', strtotime($data['dob']));
$data['dob'] = change_date_format($data['dob'], 'd/m/Y', 'Y-m-d');
// print_rr($data); die;
// Fetch current employee data
$employee_data = $this->employeeModel->where('id', $data['employee_primary_id'])->first();
@ -1964,5 +1975,50 @@ class EmployeeController extends AdminController
return redirect()->back()->with('error', 'Log file not found.');
}
public function exportToExceltpadata()
{
// Create a new Spreadsheet
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
// Header row
$headers = [
'TPA_NAME', 'SHORT_NAME', 'TPA_BRANCH_NAME', 'TPA_BRANCH_CODE',
'TPA_CONTACT_PERSON_NAME', 'TPA_CONTACT_PERSON_EMAIL', 'TPA_CONTACT_PERSON_MOBILE',
'TPA_CONTACT_PERSON_DESIGNATION', 'IS_DELETED'
];
$sheet->fromArray($headers, NULL, 'A1');
// Data rows
$data = [
["ICICI Lombard Health Care", "IL Health care", "Chennai", "997133", "Heena", "dharanisri@jubiliant.in", "9043955294", "General Manager", "YES"],
["ICICI Lombard Health Care", "IL Health care", "Chennai", "997133", "Mahammad shireen", "mahammad.shireen@icicilombard.com", "8655420732", "Claims head", "NO"],
["Medi Assist Insurance TPA Private Limited", "Medi Assist", "Chennai", "YA0000000348", "Ragavi", "dharanisri@jubiliant.in", "9043955294", "Senior Manager", "YES"],
["Medi Assist Insurance TPA Private Limited", "Medi Assist", "Chennai", "YA0000000348", "Vijayalakshmi", "vijayalakshmi.c@mediassist.in", "7795542162", "Senior Executive | Account Management", "NO"],
["Vidal Health Insurance TPA", "Vidal", "Chennai", "YA0000000349", "vijalakshmi", "vijayalakshmi.c@mediassist.in", "7795542162", "Senior Executive", "NO"],
["Vidal Health Insurance TPA", "Vidal", "Chennai", "YA0000000349", "M.Pushparaj", "pushparaj.moorthy@vidalhealth.com", "8939634456", "Executive", "NO"],
["Digit in-House", "Digit in-House", "Go Digit General Insurance Ltd", "1", "sathish", "sathish.n@vidalhealth.com", "7823913800", "Senior Executive", "NO"],
["Digit in-House", "Digit in-House", "Go Digit General Insurance Ltd", "1", "Mr. Pavan", "TK.Pavankumar@godigit.com", "8754490492", "Strategic Partnerships", "NO"],
["Aditya Birla Health Insurance Co. Limited", "ABHI", "Chennai", "O1", "sathish", "sathish.n@vidalhealth.com", "7823913800", "Senior Executive", "NO"],
["Aditya Birla Health Insurance Co. Limited", "ABHI", "Chennai", "O1", "Jhonson Kj", "jhonson.kj@adityabirlacapital.com", "9900729513", "Executive", "NO"],
["Aditya Birla Health Insurance Co. Limited", "ABHI", "Chennai", "01", "Jhonson Kj", "jhonson.kj@adityabirlacapital.com", "9900729513", "Executive", "NO"],
["R Care Health", "R Care", "Chennai", "01", "Jeevanadam", "Jeevanandam.Kumaran@relianceada.com", "8825982053", "Executive", "NO"],
["IFFCO-TOKIO GENERAL INSURANCE CO. LTD", "ITGI", "Chennai", "01", "Anjali", "Anjali.K@ext.iffcotokio.co.in", "6374270165", "Senior Executive", "NO"],
["Star Health and Allied Insurance", "STAR", "Chennai", "110000", "Mr. Vijay Baskar", "vijayabhaskar.m@starhealth.in", "9840905286", "Area Manager", "NO"],
];
$sheet->fromArray($data, NULL, 'A2');
// Save the file
$filename = 'TPA_Data.xlsx';
$writer = new Xlsx($spreadsheet);
// Set headers for download
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment; filename="' . $filename . '"');
header('Cache-Control: max-age=0');
$writer->save('php://output');
exit;
}
}

View File

@ -28,6 +28,7 @@ use App\Models\UserModel;
use App\Models\FEContentModel;
use App\Models\AddImgModel;
use App\Models\ClientBranchModel;
use App\Models\AuditHistoryModel;
use App\Controllers\Jobs ;
@ -71,6 +72,7 @@ class EmployeeRestController extends AdminController
protected $feContentModel;
protected $addImgModel;
protected $clientBranchModel;
protected $auditHistoryModel;
public function __construct()
@ -94,6 +96,7 @@ class EmployeeRestController extends AdminController
$this->feContentModel = new FEContentModel();
$this->addImgModel = new AddImgModel();
$this->clientBranchModel = new ClientBranchModel();
$this->auditHistoryModel = new AuditHistoryModel();
}
@ -220,8 +223,6 @@ class EmployeeRestController extends AdminController
{
try {
$data = $this->request->getJSON();
if ($data) {
$Count = 0;
@ -245,13 +246,11 @@ class EmployeeRestController extends AdminController
$item->dob = $this->convertDateFormatYMD($item->dob);
$item->emp_status = 'draft';
$employee = $this->employeeModel->insert($item);
if ($employee) {
$Count++;
}
}
}
@ -260,21 +259,15 @@ class EmployeeRestController extends AdminController
if(isset($data[0]->id))
{
$this->createEmployeePolicyData($data[0]->id , $data[0]->emp_code , $data[0]->client_id , $data[0]->client_policy_id , $data[0]->basic_cover_si);
}else{
$this->createEmployeePolicyData($employee , $data[0]->emp_code , $data[0]->client_id , $data[0]->client_policy_id , $data[0]->basic_cover_si);
$this->createEmployeePolicyData($data[0]->id , $data[0]->emp_code , $data[0]->client_id , $data[0]->client_policy_id , $data[0]->basic_cover_si);
}else
{
$payable_employee = $this->getEmployeePayableValue($data[0]->client_policy_id,$data[0]->relationship);
$this->createEmployeePolicyData($employee , $data[0]->emp_code , $data[0]->client_id , $data[0]->client_policy_id , $data[0]->basic_cover_si , $payable_employee);
}
$this->updatePremiumAmount($data[0]->client_policy_id , $data[0]->emp_code , $data[0]->client_branch_id);
$result = [];
return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200);
} else {
@ -288,7 +281,37 @@ class EmployeeRestController extends AdminController
}
public function createEmployeePolicyData($employee_id,$emp_code,$client_id,$client_policy_id,$basic_cover_si = null)
public function getEmployeePayableValue($client_policy_id,$relationship)
{
$terms = $this->clientPolicyModel->where('id',$client_policy_id)->get()->getRow()->policy_terms;
if(isset(json_decode($terms)->is_payable_employee))
{
$is_payable_obj = json_decode($terms)->is_payable_employee;
if ($relationship === 'Mother' || $relationship === 'Father' || $relationship === 'Father in Law' || $relationship === 'Mother in Law')
{
return $is_payable_obj->elders;
}
else if($relationship === 'Son' || $relationship === 'Daughter')
{
return $is_payable_obj->childern;
}
else if($relationship === 'Spouse')
{
return $is_payable_obj->spouse;
}
}else{
return 0;
}
}
public function createEmployeePolicyData($employee_id,$emp_code,$client_id,$client_policy_id,$basic_cover_si = null,$payable_employee = 0)
{
if($basic_cover_si == null)
@ -314,6 +337,7 @@ class EmployeeRestController extends AdminController
$data['employee_id']= $employee_id;
$data['client_policy_id']= $client_policy_id;
$data['basic_cover_si']= $basic_cover_si;
$data['payable_employee']= $payable_employee;
$data['status']= 'draft';
$data['date_coverage'] = $this->getEmployeeCoverageDate($emp_code, $client_policy_id);
@ -687,7 +711,7 @@ class EmployeeRestController extends AdminController
$notification = $this->notificationModel->where('client_id',$client_id)->where('template_name','member_welcome_mail')->first();
$jwt = $this->request->getHeader('Authorization');
$jwt = $this->request->getHeaderLine('Authorization');
$jwtParts = explode(' ', $jwt);
$token = $jwtParts[2];
@ -697,7 +721,6 @@ class EmployeeRestController extends AdminController
// get the employee id from token
$employee_id = $decodedPayload['id'];
// $employee_id = 1;
$client_policy = $this->clientPolicyModel->where('id', $policy_id)->where('client_id', $client_id)->where('client_branch_id', $client_branch_id)->first();
if ($client_policy) {
@ -934,11 +957,13 @@ class EmployeeRestController extends AdminController
}
}
}
$emp_policy_data =[
'employee_id'=>$emp_id,
'client_policy_id'=>$policy_id,
'status'=> 'draft',
'date_coverage' => $date_coverage,
'payable_employee' => check_pay_by_employee_or_company($client_policy['policy_terms'], $dataToInsert[$a]['relationship']),
'basic_cover_si'=>isset($basic_cover_si[$a]) ? $basic_cover_si[$a] : null
];
@ -1133,7 +1158,7 @@ class EmployeeRestController extends AdminController
// Generate Notes string based on familyFloates terms
$array->notes = $this->FloterNotesConvertion($familyFloates);
if($getSlabAndGridData['slab_rates'][0]['premium_type'] == 1)
if($getSlabAndGridData['slab_rates'][0]['premium_type'] == 1 || $getSlabAndGridData['slab_rates'][0]['premium_type'] == 3)
{
$array->floter_text_heading = 'Floater Sum Insured';
$array->floter_text_description = 'This is a floater sum insured. A floater is a type of sum insured that provides coverage to more than one member ot a family at the same time. Simply put, its a single insurance cover for the entire family.';
@ -1150,6 +1175,9 @@ class EmployeeRestController extends AdminController
$floters = $this->FloterConvertion($familyFloates);
$data = [];
$dependent_and_si_value = 0;
$dependent_and_si_premium_value = 0;
$dependent_and_si_gst_value = 0;
foreach ($floters as $familyFloatesValue) {
$dependent = preg_replace('/\d/', '', $familyFloatesValue);
@ -1157,6 +1185,9 @@ class EmployeeRestController extends AdminController
foreach ($empData as $key => $value) {
if ($value['family_floater_key'] === $dependent) {
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow();
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;}
$temp['is_value_exist'] = true;
$temp['data']['family_floater_key'] = $familyFloatesValue;
@ -1212,7 +1243,6 @@ class EmployeeRestController extends AdminController
}
// Add family floter buttons placement data for FE validation
if(count($floters)){
foreach ($floters as $familyFloatesValue) {
@ -1233,6 +1263,9 @@ class EmployeeRestController extends AdminController
$array->mapped_family_floaters = $data;
$array->type = "GMC";
$array->family_floaters_of_dependent_and_si_value = $dependent_and_si_value > 0 ? $dependent_and_si_value : 0;
$array->family_floaters_of_dependent_and_si_premium_value = $dependent_and_si_premium_value > 0 ? round($dependent_and_si_premium_value) : 0;
$array->family_floaters_of_dependent_and_gst_value = $dependent_and_si_gst_value > 0 ? round($dependent_and_si_gst_value) : 0;
$checkGmcParentsPolicyExist = $this->clientPolicyModel->select('client_policy.id as ClientPolicyId , client_policy.client_id as ClientId, client_policy.policy_type_id as policy_type_id, policy_type.long_name as Policy_Name , 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')
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
@ -1325,7 +1358,7 @@ class EmployeeRestController extends AdminController
// Generate Notes string based on familyFloates terms
$array->notes = $this->FloterNotesConvertion($familyFloates);
if($getSlabAndGridData['slab_rates'][0]['premium_type'] == 1)
if($getSlabAndGridData['slab_rates'][0]['premium_type'] == 1 || $getSlabAndGridData['slab_rates'][0]['premium_type'] == 3)
{
$array->floter_text_heading = 'Floater Sum Insured';
$array->floter_text_description = 'This is a floater sum insured. A floater is a type of sum insured that provides coverage to more than one member ot a family at the same time. Simply put, its a single insurance cover for the entire family.';
@ -1345,15 +1378,20 @@ class EmployeeRestController extends AdminController
$floters = $this->FloterConvertion($familyFloates);
$data = [];
$dependent_and_si_value = 0;
$dependent_and_si_premium_value = 0;
$dependent_and_si_gst_value = 0;
foreach ($floters as $familyFloatesValue) {
$dependent = preg_replace('/\d/', '', $familyFloatesValue);
if(count($empData)){
foreach ($empData as $key => $value) {
if ($value['family_floater_key'] === $dependent) {
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow();
// dd( $employee_policy);
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;}
$temp['is_value_exist'] = true;
$temp['data']['family_floater_key'] = $familyFloatesValue;
$temp['data']['employee_id'] = $value['id'];
@ -1422,6 +1460,9 @@ class EmployeeRestController extends AdminController
$array->mapped_family_floaters = $data;
$array->type = "GMC - Parents";
$array->family_floaters_of_dependent_and_si_value = $dependent_and_si_value > 0 ? $dependent_and_si_value : 0;
$array->family_floaters_of_dependent_and_si_premium_value = $dependent_and_si_premium_value > 0 ? round($dependent_and_si_premium_value) : 0;
$array->family_floaters_of_dependent_and_gst_value = $dependent_and_si_gst_value > 0 ? round($dependent_and_si_gst_value) : 0;
return $array;
@ -1539,7 +1580,7 @@ class EmployeeRestController extends AdminController
$string = ucwords($string);
$result .= ' + '.$string;
}else if($value != 0 && $key ==='self') {
$result = 'Allowed memebrs Self ';
$result = 'Allowed members Self ';
}else if($value != 0 && $key ==='childrens') {
if($value > 1){ $result .= ' + '.$value.' Children'; }else{ $result .= ' + '.$value.' Child'; }
}else if($value != 0 && $key ==='elders_count') {
@ -1558,7 +1599,7 @@ class EmployeeRestController extends AdminController
if($first_two_chars == " +"){
$modified_string = substr($result, 3);
return "Allowed memebrs ".$modified_string;
return "Allowed members ".$modified_string;
}else{
return $result;
}
@ -1656,7 +1697,7 @@ class EmployeeRestController extends AdminController
$responce['OpenForEnrollment'] = $array['open_for_enrollment'];
$responce['policy_terms'] = $decodedArray;
$responce['policy_type_id'] = $array['policy_type_id'];
$responce['is_member_modify_allowed'] = $array['is_member_modify_allowed'];
//$responce['is_member_modify_allowed'] = $array['is_member_modify_allowed'];
$responce['disclaimer'] = $array['disclaimer'];
$tpaArray = $this->employeeModel->select('employees.name as name , employee_polices.tpa_id as tpa_id , employee_polices.rand_string as rand_string')
@ -1680,7 +1721,7 @@ class EmployeeRestController extends AdminController
}
if(count($getSlabAndGridData['slab_rates'])){
if($getSlabAndGridData['slab_rates'][0]['premium_type'] == 1)
if($getSlabAndGridData['slab_rates'][0]['premium_type'] == 1 || $getSlabAndGridData['slab_rates'][0]['premium_type'] == 3)
{
$responce['floter_text_heading'] = 'Floater Sum Insured';
}else{
@ -1815,8 +1856,8 @@ class EmployeeRestController extends AdminController
$responce['family_floaters_of_dependent_and_si_array'] = $data;
$responce['family_floaters_of_dependent_and_si_value'] = $dependent_and_si_value > 0 ? $dependent_and_si_value : 0;
$responce['family_floaters_of_dependent_and_si_premium_value'] = $dependent_and_si_premium_value > 0 ? $dependent_and_si_premium_value : 0;
$responce['family_floaters_of_dependent_and_gst_value'] = $dependent_and_si_gst_value > 0 ? $dependent_and_si_gst_value : 0;
$responce['family_floaters_of_dependent_and_si_premium_value'] = $dependent_and_si_premium_value > 0 ? round($dependent_and_si_premium_value) : 0;
$responce['family_floaters_of_dependent_and_gst_value'] = $dependent_and_si_gst_value > 0 ? round($dependent_and_si_gst_value) : 0;
@ -1874,7 +1915,7 @@ class EmployeeRestController extends AdminController
$responce['family_floaters_of_only_si_array'] = $only_si_array;
$responce['family_floaters_of_only_si_value'] = $only_si_value;
$responce['family_floaters_of_only_si_premium_value'] = $only_si_premium_value;
$responce['family_floaters_of_only_si_premium_value'] = round($only_si_premium_value);
$responce['family_floaters_of_only_si_gst_value'] = $only_si_gst_value;
@ -1927,8 +1968,8 @@ class EmployeeRestController extends AdminController
$responce['family_floaters_of_only_si_array'] = $only_si_array;
$responce['family_floaters_of_only_si_value'] = $only_si_value;
$responce['family_floaters_of_only_si_premium_value'] = $only_si_premium_value;
$responce['family_floaters_of_only_si_gst_value'] = $only_si_gst_value;
$responce['family_floaters_of_only_si_premium_value'] = round($only_si_premium_value);
$responce['family_floaters_of_only_si_gst_value'] = round($only_si_gst_value);
if($this->request->getGet('policy') == 'GMC-SI-PARENT-TOPUP'){
@ -1961,13 +2002,6 @@ class EmployeeRestController extends AdminController
$emp_code = $postData['emp_code'];
$client_id = $postData['client_id'];
$this->employeeModel->where('emp_code', $emp_code )
->where('client_id', $client_id )
->where('is_active', 1 )
->where('emp_status', 'draft' )
->set(array('emp_status'=>'enrolled'))
->update();
$empData = $this->employeeModel->where('emp_code', $emp_code )->where('client_id', $client_id ) ->where('is_active', 1 )->findAll();
//for mail common parameter
@ -2000,6 +2034,16 @@ class EmployeeRestController extends AdminController
}
//update Employee table
$this->employeeModel->where('emp_code', $emp_code)->where('client_id', $client_id)->where('is_active', 1)
->groupStart()
->where('emp_status', 'draft')
->orWhere('emp_status', 'enrolled')
->groupEnd()
->set(['emp_status' => 'enrolled'])
->update();
$notification = $this->notificationModel->where('client_id' ,$client_id)->where('template_name', 'member_review_and_summary_mail')->first();
@ -2065,11 +2109,21 @@ class EmployeeRestController extends AdminController
// 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');
$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;
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);
@ -2350,7 +2404,7 @@ class EmployeeRestController extends AdminController
function getEmployeeActiveOrInactivePolicy()
{
if($this->request->getGet('type') == 'Active'){ $policy_status = 1; }else{ $policy_status = 0; }
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.* , policy_type.policy_type as policy_type,insurers.name as insurer_name,tpa.name as tpa_name')
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.* , policy_type.policy_type as policy_type,insurers.name as insurer_name,tpa.name as tpa_name,tpa.network_hospitals as network_hospitals_url')
->join('insurers', 'client_policy.insurer_id = insurers.id', 'left')
->join('tpa', 'client_policy.tpa_id = tpa.id', 'left')
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
@ -2400,6 +2454,7 @@ class EmployeeRestController extends AdminController
$data['policy_no'] = $ClientPolicyValue['policy_no'];
$data['insurer_name'] = $ClientPolicyValue['insurer_name'];
$data['tpa_name'] = $ClientPolicyValue['tpa_name'];
$data['network_hospitals_url'] = $ClientPolicyValue['network_hospitals_url'];
$data['policy_start_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_start_date']);
$data['policy_end_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_end_date']);
// $data['policy_terms'] = $terms;
@ -2429,7 +2484,7 @@ class EmployeeRestController extends AdminController
$si_gst_value = 0;
foreach ($employee_policy as $key => $value) {
if(isset($value['basic_cover_si'])){ $si_value = $value['basic_cover_si']; }
if(isset($value['basic_cover_si'])){ $si_value = ($si_value == 0) ? $value['basic_cover_si'] : $si_value; }
if(isset($value['premium'])){ $si_premium_value = $si_premium_value + $value['premium'];}
if(isset($value['gst'])){ $si_gst_value = $si_gst_value + $value['gst'];}
}
@ -2443,8 +2498,8 @@ class EmployeeRestController extends AdminController
$data['si_value'] = $si_value;
$data['si_premium_value'] = ($ClientPolicyValue['policy_type_id'] == 1 || $ClientPolicyValue['policy_type_id'] == 2) ? 0 : $si_premium_value;
$data['si_gst_value'] = ($ClientPolicyValue['policy_type_id'] == 1 || $ClientPolicyValue['policy_type_id'] == 2) ? 0 : $si_gst_value;
$data['si_premium_value'] = ($ClientPolicyValue['policy_type_id'] == 1 || $ClientPolicyValue['policy_type_id'] == 2) ? 0 : round($si_premium_value);
$data['si_gst_value'] = ($ClientPolicyValue['policy_type_id'] == 1 || $ClientPolicyValue['policy_type_id'] == 2) ? 0 : round($si_gst_value);
$data['EmployeePolicy'] = $employee_policy;
array_push($result, $data);
@ -2463,6 +2518,8 @@ class EmployeeRestController extends AdminController
function policyTermsFiter($terms , $type)
{
$gpa = [
"sumInsured2" => "Sum Insured",
@ -2492,18 +2549,25 @@ class EmployeeRestController extends AdminController
];
$gmc = [
"sum_insured" => "Sum Insured",
"waiverofpreexistingdiseases" => "Waiver of Pre-existing Diseases",
"maternitycoverage" => "Maternity Coverage",
"babyday1cover" => "Baby Day 1 Cover",
"9monthwaitingperiodwaived" => "9-month waiting Period <20>waived",
"coverfromthedateofjoining" => "Cover from the date of Joining",
"waiverof1,2,3&4thyearexclusions" => "Waiver of 1, 2, 3 & 4th year Exclusions",
"waiverof30dayswaitingperiod" => "Waiver of 30 days waiting period",
"9monthwaitingperiodwaived" => "9-month waiting Period waived",
"twindelivery" => "Twin Delivery",
"maternitycoverage" => "Maternity Coverage",
"preandpostnatal" => "Pre and Post natal",
"prehospitalizationcover" => "Pre Hospitalization Cover",
"copayzonewisecopay" => "Co-Pay/Zone wise Co Pay",
"posthospitalizationcover" => "Post Hospitalization Cover ",
"congenitaldiseasesinternal" => "Congenital Diseases - Internal ",
"congenitaldiseasesexternal" => "Congenital Diseases - External ",
"roomrentlimit" => "Room Rent Limit",
"proportionatedeductionclause" => "Proportionate Deduction Clause",
"ayudhtreatmentcover" => "AYUSH treatment covered",
"lasiksurgery" => "Lasik Surgery",
"cataract" => "Cataract",
"ailmentcapping" => "Ailment capping",
"moderntreatmentsasperirdai" => "Modern Treatment "
];
@ -2512,15 +2576,51 @@ class EmployeeRestController extends AdminController
if($type == 'gpa'){
foreach ($gpa as $key => $value) {
if(isset($terms->$key))
$finalarray[$value] = $terms->$key;
{
if($terms->$key == 1)
{
$termsValue = 'Yes';
}else if($terms->$key == 0)
{
$termsValue = 'No';
}else
{
$termsValue = $terms->$key;
}
$finalarray[$value] = $termsValue;
}
}
if(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];
}
}
}else{
foreach ($gmc as $key => $value) {
if(isset($terms->$key))
$finalarray[$value] = $terms->$key;
{
if($terms->$key == 1)
{
$termsValue = 'Yes';
}else if($terms->$key == 0)
{
$termsValue = 'No';
}else
{
$termsValue = $terms->$key;
}
$finalarray[$value] = $termsValue;
}
}
if(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];
}
}
}
return $finalarray;
@ -2585,17 +2685,24 @@ class EmployeeRestController extends AdminController
public function storeFireBase()
{
try {
$json = $this->request->getJSON();
$firebase_token = $json->firebase_token;
$mobile = $json->mobile;
$firebase_token = isset($this->request->getJSON()->firebase_token) ? $this->request->getJSON()->firebase_token : null;
$mobile = isset($this->request->getJSON()->mobile) ? $this->request->getJSON()->mobile : null;
$email_id = isset($this->request->getJSON()->email_id) ? $this->request->getJSON()->email_id : null;
// Ensure the mobile number is provided
if (empty($mobile)) {
return $this->respond(['status' => 'failed', 'code' => 400, 'message' => 'Mobile number is required'], 400);
}
// Fetch employee by mobile number
$employee = $this->employeeModel->where('mobile', $mobile)->first();
// Fetch employee
if (isset($mobile))
{
$employee = $this->employeeModel->where('mobile', $mobile)->where('relationship', 'self')->where('is_active', 1)->first();
} else {
$employee = $this->employeeModel->where('email_corporate', $email_id)->where('relationship', 'self')->where('is_active', 1)->first();
}
if ($employee) {
// Check if firebase_token is provided
@ -2665,59 +2772,223 @@ class EmployeeRestController extends AdminController
// }
public function getFamilyPolicyDetails()
public function getBackToEnrolledDetails()
{
// Get query parameters
$empCode = $this->request->getGet('emp_code');
$clientId = $this->request->getGet('client_id');
$clientBranchId = $this->request->getGet('client_branch_id');
if (!$empCode || !$clientId || !$clientBranchId) {
return $this->fail("emp_code, client_id, and client_branch_id are required parameters.");
}
if (!$empCode || !$clientId || !$clientBranchId) { return $this->fail("emp_code, client_id, and client_branch_id are required parameters."); }
// Fetch employee family details
$employees = $this->employeeModel->select('id,emp_code,name,relationship,dob,emp_status,is_addon_value')->where([
'emp_code' => $empCode,
'client_id' => $clientId,
'client_branch_id' => $clientBranchId,
'is_active' => 1
])->findAll();
//Fetch active employee details
$employees = $this->employeeModel->select('id,emp_code,name,relationship,dob,emp_status,is_addon_value,created_at,updated_at')
->where([
'emp_code' => $empCode,
'client_id' => $clientId,
'client_branch_id' => $clientBranchId,
'is_active' => 1
])
->findAll();
if (empty($employees)) {
return $this->failNotFound("No employees found for the provided parameters.");
}
//Find status of self
$selfEmployee = array_filter($employees, function($employee) { return $employee['relationship'] === 'Self'; });
$data['self_status'] = !empty($selfEmployee) ? array_values($selfEmployee)[0]['emp_status'] : null;
$data['self_enrolled_time'] = !empty($selfEmployee) ? array_values($selfEmployee)[0]['updated_at'] : null;
$data['self_employee_id'] = !empty($selfEmployee) ? array_values($selfEmployee)[0]['id'] : null;
// Collect employee IDs
//Fetch employee policy details
$employeeIds = array_column($employees, 'id');
// Fetch policies related to the employee IDs
$policies = $this->employeePolicyModel->whereIn('employee_id', $employeeIds)->where('is_active',1)->findAll();
if (empty($policies)) {
return $this->failNotFound("No policies found for the provided employees.");
//Find the stage of enrolment process
$employeeStatuses = array_column($employees, 'emp_status');
$employeePolicyStatuses = array_column($policies, 'status');
$uniqueStatuses = array_unique(array_merge($employeeStatuses, $employeePolicyStatuses));
if(count($uniqueStatuses) > 1){ $enrolmentStagekey = 1; }else{ if($uniqueStatuses[0] == 'draft'){ $enrolmentStagekey = 0; }else{ $enrolmentStagekey = 2; } }
$enrolmentStage = ['Draft Only','Intermittent Enrollment','Successful Enrollment'];
$data['enrolment_stage'] = $enrolmentStage[$enrolmentStagekey];
$data['revert_employee_data'] = [];
$data['revert_employee_policy_data'] = [];
if($enrolmentStagekey == 1)
{
//Find active employee history
$empIdsWithoutSelf = $employeeIds;
$key = array_search($data['self_employee_id'], $empIdsWithoutSelf);
unset($empIdsWithoutSelf[$key]);
foreach ($empIdsWithoutSelf as $key => $pk)
{
$retrivedData = $this->retriveOldData($data['self_enrolled_time'],'employees',$pk);
if($retrivedData != false)
array_push($data['revert_employee_data'] , $retrivedData);
}
//Find inactive employee history
$inActiveEmployees = $this->employeeModel->select('id,emp_code,name,relationship,dob,emp_status,is_addon_value,created_at,updated_at')
->where([
'emp_code' => $empCode,
'client_id' => $clientId,
'client_branch_id' => $clientBranchId,
'is_active' => 0
])
->findAll();
$inActiveEmployeeIds = array_column($inActiveEmployees, 'id');
foreach ($inActiveEmployeeIds as $key => $pk)
{
$retrivedData = $this->retriveOldData($data['self_enrolled_time'],'employees',$pk);
if($retrivedData != false)
array_push($data['revert_employee_data'] , $retrivedData);
}
//Merged active and inactive employees , employee_polict history
$mergedEmpIds = array_merge($employeeIds,$inActiveEmployeeIds);
$empPolicyData = $this->employeePolicyModel->whereIn('employee_id', $mergedEmpIds)->findAll();
$employeePolicyIds = array_column($empPolicyData, 'id');
foreach ($employeePolicyIds as $key => $pk)
{
$retrivedData = $this->retriveOldData($data['self_enrolled_time'],'employee_polices',$pk);
if($retrivedData != false)
array_push($data['revert_employee_policy_data'] , $retrivedData);
}
}
// Structure the response
$result = [];
if($this->request->getGet('revert_data') == 1)
{
//update data back to employee
if(count($data['revert_employee_data'])){
foreach ($data['revert_employee_data'] as $key => $val)
{
$this->employeeModel->where('id',$val['id'] )->set($val['data'])->update();
}
}
//update data back to employee policy
if(count($data['revert_employee_policy_data'])){
foreach ($data['revert_employee_policy_data'] as $key => $val)
{
$this->employeePolicyModel->where('id',$val['id'] )->set($val['data'])->update();
}
}
//update enrolled status for self
if(count($data['revert_employee_data']) || count($data['revert_employee_policy_data'])){
$this->employeeModel->where('id',$data['self_employee_id'] )->set(array('emp_status'=>'enrolled'))->update();
$data['retrieve_status'] = 'Data revert successfully';
}else{
$data['retrieve_status'] = 'There is no data to revert';
}
}
// Fetch all policies related to these employees who currently active
$current_employee_data = $this->employeeModel->select('id,emp_code,name,relationship,dob,emp_status,is_addon_value,created_at,updated_at')
->where([
'emp_code' => $empCode,
'client_id' => $clientId,
'client_branch_id' => $clientBranchId,
'is_active' => 1
])
->findAll();
$Ids = array_column($current_employee_data, 'id');
$policies = $this->employeePolicyModel->whereIn('employee_id', $Ids)->where('is_active',1)->findAll();
// Group policies by policy_id
$groupedPolicies = [];
foreach ($policies as $policy) {
$policyEmployees = array_filter($employees, function ($emp) use ($policy) {
return $emp['id'] === $policy['employee_id'];
});
$policyId = $policy['client_policy_id'];
if (!isset($groupedPolicies[$policyId])) {
$groupedPolicies[$policyId] = [
'policy_id' => $policy['id'],
'client_policy_id' => $policy['client_policy_id'],
'uhid' => $policy['uhid'],
'status' => $policy['status'],
'basic_cover_si' => $policy['basic_cover_si'],
'date_coverage' => $policy['date_coverage'],
'policy_end_date' => $policy['policy_end_date'],
'members' => []
];
}
$result[] = [
'policy_id' => $policy['id'],
'client_policy_id' => $policy['client_policy_id'],
'uhid' => $policy['uhid'],
'status' => $policy['status'],
'basic_cover_si' => $policy['basic_cover_si'],
'date_coverage' => $policy['date_coverage'],
'policy_end_date' => $policy['policy_end_date'],
'members' => array_values($policyEmployees),
];
// Add member details to the current policy
foreach ($current_employee_data as $employee) {
if ($employee['id'] === $policy['employee_id']) {
$groupedPolicies[$policyId]['members'][] = [
'id' => $employee['id'],
'emp_code' => $employee['emp_code'],
'name' => $employee['name'],
'relationship' => $employee['relationship'],
'dob' => $employee['dob'],
'emp_status' => $employee['emp_status'],
'is_addon_value' => $employee['is_addon_value']
];
}
}
}
return $this->respond(['family_policies' => $result]);
// Re-index the grouped policies
$data['currentPolicies'] = array_values($groupedPolicies);
return $this->respond(['data' => $data]);
}
public function retriveOldData($self_enrolled_time,$table,$pk)
{
$historyData = $this->auditHistoryModel->where('pk', $pk)->where('table_name',$table)->findAll();
$beforeEnrolled = [];
$afterEnrolled = [];
// Split the array
foreach ($historyData as $val) {
if ($val['created_at'] <= $self_enrolled_time) { $beforeEnrolled[] = $val; } else { $afterEnrolled[] = $val; }
}
if(count($beforeEnrolled) && count($afterEnrolled)){ //After enrolment edited some of the data
$temp['table'] = $table;
$temp['id'] = $pk;
// Extract earliest `old_value` for each `field_name`
$originalValues = [];
foreach ($afterEnrolled as $entry) {
$field = $entry['field_name'];
// If the field is not already in originalValues , update it
if (!isset($originalValues[$field])) {
$originalValues[$field] = $entry['old_value'];
}
}
$temp['data'] = $originalValues;
return $temp;
}else if(!count($beforeEnrolled) && !count($afterEnrolled)){ //After enrolment created new data
$temp['table'] = $table;
$temp['id'] = $pk;
$temp['data'] = ['is_active'=> 0 ];
return $temp;
}else if(!count($beforeEnrolled) && count($afterEnrolled)){ //After enrolment created new data and edited some of the data
$temp['table'] = $table;
$temp['id'] = $pk;
$temp['data'] = ['is_active'=> 0 ];
return $temp;
}else if(count($beforeEnrolled) && !count($afterEnrolled)){ //After enrolment nothing changes from the data
return false;
}
}

View File

@ -1582,9 +1582,15 @@ class EmployeeServiceController extends AdminController
// insert or update in db for inception addition depent addition
public function employeesOnboardProcess($params)
{
{
// dd($params);
$familiy_data = $params['familiy_data'];
$file = $params['file'];
$policy_details = $this->clientPolicyModel->where('id', $file['policy_id'])->first();
// dd($policy_details);
foreach($familiy_data as $fkey => $value)
{
if(is_array($value))
@ -1660,7 +1666,8 @@ class EmployeeServiceController extends AdminController
$policy_data['updated_by'] = $file['created_by'];
$policy_data['id'] = $employee_policy[0]['id'];
$policy_data['status'] = 'active';
$policy_data['payable_employee'] = check_pay_by_employee_or_company($policy_details['policy_terms'], $value['relationship']);
$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';
}
@ -1670,6 +1677,8 @@ class EmployeeServiceController extends AdminController
$policy_data['client_policy_id'] = $file['policy_id'];
$policy_data['created_by'] = $file['created_by'];
$policy_data['status'] = 'active';
$policy_data['payable_employee'] = check_pay_by_employee_or_company($policy_details['policy_terms'], $value['relationship']);
$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';
}
@ -1932,7 +1941,7 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
public function employeesEnrollmentInsert($params)
{
// dd($this->request);
helper('excel_util_helper');
//get file name
$file_id = $params['file_id'];
@ -1984,7 +1993,9 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
// dd($policy_details);
//get policy slab rates
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($file['policy_id'],$file['client_id']);
// $slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($file['policy_id'],$file['client_id']);
// dd($slab_details);
foreach ($excel_data as $key => $row)
{
$is_row_empty = check_row_is_empty_or_null($row);
@ -2073,6 +2084,7 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
$policy_data['updated_by'] = $file['created_by'];
$policy_data['id'] = $employee_policy[0]['id'];
$policy_data['status'] = 'draft';
$policy_data['payable_employee'] = check_pay_by_employee_or_company($policy_details['policy_terms'], $value['relationship']);
$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';
@ -2083,6 +2095,8 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
$policy_data['client_policy_id'] = $file['policy_id'];
$policy_data['created_by'] = $file['created_by'];
$policy_data['status'] = 'draft';
$policy_data['payable_employee'] = check_pay_by_employee_or_company($policy_details['policy_terms'], $value['relationship']);
$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';
}
@ -2091,6 +2105,10 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
$emp_policy_id = $this->employeePolicyModel->getInsertID();
$this->myLogger->logme('error',$log_message);
$employeeRestController = new EmployeeRestController();
$employeeRestController->updatePremiumAmount($file['policy_id'], $value['emp_code'], $file['client_branch_id']);
//save email of self for send mail later
if (isset($notification) && $notification['enabled'] == 1 && $notification['mail_content'] != '')
{
@ -2099,7 +2117,14 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
$params['dataToInsert'] = $value; //holds employee master data
$params['notification'] = $notification;
$params['client_data'] = $client_details;
$params['common'] = [];
$params['common'] = [
'client_id' => $file['client_id'],
'client_branch_id' => $file['client_branch_id'],
'client_policy_id' => $file['policy_id'],
'employee_policy_id' => $emp_policy_id ?? null,
'employee_id' => $emp_id,
'mail_type' => 'member_welcome_mail',
];
//store email and mail content via helper to send notification
$emp_emails[] = sendMailNotification::sendMailNotification('member_welcome_mail', $params);
}
@ -2107,6 +2132,7 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
}// endof if row is empty check
} //end of for loop
// dd($emp_emails);
// for bulk mail queue job push
if (!empty($emp_emails) && count($emp_emails) > 0) {

View File

@ -1744,6 +1744,7 @@ class PolicyTransactionController extends BaseController
$source_data = $this->PTCOShareDetailsModel->getNonReconcileredPolicyTransactions(month:$month,year:$year,insurer_id:$file['insurer_id'],insurer_branch_id:$file['branch_id']);
// var_dump($source_data);die();
// Kint::dump($source_data);//die();
// check policy no,insurer and etc in DB for this month
// if all good return true, otherwise return false with messssage
@ -1752,34 +1753,37 @@ class PolicyTransactionController extends BaseController
$is_row_empty = check_row_is_empty_or_null($excel_row);
if(!$is_row_empty)
{
break;
}
$is_source_found = 0;
$policy_start_date = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[4]);//policy_start_date from excel
$policy_end_date = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[5]);//policy_end_date from excel
$policy_no = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[1]);//policy_end_date from excel
$client_name = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[3]);//clientname from excel
$endorsement_no = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[2]);//policy_end_date from excel
foreach ($source_data as $source_key => $source_row)
{
if( ($policy_no == $source_row['policy_no']) && $endorsement_no == $source_row['endorsement_no'] && change_date_format($policy_start_date,'d/m/Y','Y-m-d') == $source_row['policy_start_date'] && change_date_format($policy_end_date,'d/m/Y','Y-m-d') == $source_row['policy_end_date'] && $client_name == $source_row['client_name'])
$is_source_found = 0;
$policy_start_date = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[4]);//policy_start_date from excel
$policy_end_date = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[5]);//policy_end_date from excel
$policy_no = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[1]);//policy_end_date from excel
$client_name = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[3]);//clientname from excel
$endorsement_no = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[2]);//policy_end_date from excel
foreach ($source_data as $source_key => $source_row)
{
$is_source_found = 1;
unset($source_data[$source_key]);
continue 2;
$source_endorsement_no = $source_row['endorsement_no'] !== null ? $source_row['endorsement_no'] : "";
if( ($policy_no == $source_row['policy_no']) && $endorsement_no == $source_endorsement_no && change_date_format($policy_start_date,'d-m-Y','Y-m-d') == $source_row['policy_start_date'] && change_date_format($policy_end_date,'d-m-Y','Y-m-d') == $source_row['policy_end_date'] && $client_name == $source_row['client_name'])
{
$is_source_found = 1;
unset($source_data[$source_key]);
continue 2;
}
}
if($is_source_found == 0)
{
// echo $excel_key.'-'.$excel_row[1] . '- not found<br>';
$error_data['error_code'] = 1;//match not found
// $error_data['error_data'] = ($error_data['error_data'] ?? []);
$error_data['error_data'] = array_merge($error_data['error_data'],[$excel_row[0]]);//match not found
}
}
if($is_source_found == 0)
{
// echo $excel_key.'-'.$excel_row[1] . '- not found<br>';
$error_data['error_code'] = 1;//match not found
// $error_data['error_data'] = ($error_data['error_data'] ?? []);
$error_data['error_data'] = array_merge($error_data['error_data'],[$excel_row[0]]);//match not found
}
}
// dd($error_data);
if($error_data['error_code'])
{
$status = 'failed';
@ -1850,94 +1854,96 @@ class PolicyTransactionController extends BaseController
$is_row_empty = check_row_is_empty_or_null($excel_row);
if(!$is_row_empty)
{
break;
}
$is_source_found = 0;
$policy_start_date = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[4]);//policy_start_date from excel
$policy_end_date = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[5]);//policy_end_date from excel
$policy_no = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[1]);//policy_end_date from excel
$client_name = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[3]);//clientname from excel
$endorsement_no = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[2]);//policy_end_date from excel
foreach ($source_data as $source_key => $source_row)
{
// Kint::dump(change_date_format($excel_row[3],'d/m/Y','Y-m-d'));
if( ($policy_no == $source_row['policy_no']) && $endorsement_no == $source_row['endorsement_no'] && change_date_format($policy_start_date,'d/m/Y','Y-m-d') == $source_row['policy_start_date'] && change_date_format($policy_end_date,'d/m/Y','Y-m-d') == $source_row['policy_end_date'] && $client_name == $source_row['client_name'])
$is_source_found = 0;
$policy_start_date = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[4]);//policy_start_date from excel
$policy_end_date = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[5]);//policy_end_date from excel
$policy_no = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[1]);//policy_end_date from excel
$client_name = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[3]);//clientname from excel
$endorsement_no = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[2]);//policy_end_date from excel
foreach ($source_data as $source_key => $source_row)
{
$is_source_found = 1;
//calculate percentage first
$total_amt = 0;
$actual_bp_per = trim($excel_row[9]);
$actual_bp_brokerage = trim($excel_row[12]);
$actual_bp_amt = trim($excel_row[6]);
if(($actual_bp_brokerage && $actual_bp_brokerage != 0 && $actual_bp_brokerage != ""))
// Kint::dump(change_date_format($excel_row[3],'d-m-Y','Y-m-d'));
$source_endorsement_no = $source_row['endorsement_no'] !== null ? $source_row['endorsement_no'] : "";
if( ($policy_no == $source_row['policy_no']) && $endorsement_no == $source_endorsement_no && change_date_format($policy_start_date,'d-m-Y','Y-m-d') == $source_row['policy_start_date'] && change_date_format($policy_end_date,'d-m-Y','Y-m-d') == $source_row['policy_end_date'] && $client_name == $source_row['client_name'])
{
$total_amt += $actual_bp_brokerage;
//percentage reverse calculation
if($actual_bp_per == 0 || $actual_bp_per == "")
$is_source_found = 1;
//calculate percentage first
$total_amt = 0;
$actual_bp_per = trim($excel_row[9]);
$actual_bp_brokerage = trim($excel_row[12]);
$actual_bp_amt = trim($excel_row[6]);
if(($actual_bp_brokerage && $actual_bp_brokerage != 0 && $actual_bp_brokerage != ""))
{
$actual_bp_per = round(($actual_bp_brokerage / $actual_bp_amt) * 100,2);
$total_amt += $actual_bp_brokerage;
//percentage reverse calculation
if($actual_bp_per == 0 || $actual_bp_per == "")
{
$actual_bp_per = round(($actual_bp_brokerage / $actual_bp_amt) * 100,2);
}
}
}
else
{
$actual_bp_brokerage = $actual_bp_amt * ($actual_bp_per / 100);
$total_amt += $actual_bp_brokerage;
}
$actual_tp_per = trim($excel_row[10]);
$actual_tp_brokerage = trim($excel_row[13]);
$actual_tp_amt = trim($excel_row[7]);
if($actual_tp_brokerage && $actual_tp_brokerage != 0 && $actual_tp_brokerage != "")
{
$total_amt += $actual_tp_brokerage;
//percentage reverse calculation
if($actual_tp_per == 0 || $actual_tp_per == "")
else
{
$actual_tp_per = ($actual_tp_brokerage / $actual_tp_amt) * 100;
$actual_bp_brokerage = $actual_bp_amt * ($actual_bp_per / 100);
$total_amt += $actual_bp_brokerage;
}
}
else
{
$actual_tp_brokerage = $actual_tp_amt * ($actual_tp_per / 100);
$total_amt += $actual_tp_brokerage;
}
$actual_tep_per = trim($excel_row[11]);
$actual_tep_brokerage = trim($excel_row[14]);
$actual_tep_amt = trim($excel_row[8]);
$actual_tp_per = trim($excel_row[10]);
$actual_tp_brokerage = trim($excel_row[13]);
$actual_tp_amt = trim($excel_row[7]);
if($actual_tep_brokerage && $actual_tep_brokerage != 0 && $actual_tep_brokerage != "")
{
$total_amt += $actual_tep_brokerage;
//percentage reverse calculation
if($actual_tep_per == 0 || $actual_tep_per == "")
if($actual_tp_brokerage && $actual_tp_brokerage != 0 && $actual_tp_brokerage != "")
{
$actual_tep_per = ($actual_tep_brokerage / $actual_tep_amt) * 100;
$total_amt += $actual_tp_brokerage;
//percentage reverse calculation
if($actual_tp_per == 0 || $actual_tp_per == "")
{
$actual_tp_per = ($actual_tp_brokerage / $actual_tp_amt) * 100;
}
}
else
{
$actual_tp_brokerage = $actual_tp_amt * ($actual_tp_per / 100);
$total_amt += $actual_tp_brokerage;
}
$actual_tep_per = trim($excel_row[11]);
$actual_tep_brokerage = trim($excel_row[14]);
$actual_tep_amt = trim($excel_row[8]);
if($actual_tep_brokerage && $actual_tep_brokerage != 0 && $actual_tep_brokerage != "")
{
$total_amt += $actual_tep_brokerage;
//percentage reverse calculation
if($actual_tep_per == 0 || $actual_tep_per == "")
{
$actual_tep_per = ($actual_tep_brokerage / $actual_tep_amt) * 100;
}
}
else
{
$actual_tep_brokerage = $actual_tep_amt * ($actual_tep_per / 100);
$total_amt += $actual_tep_brokerage;
}
//find variance
$variance_amt = $source_row['exp_amt'] - $total_amt;
$data_to_update[] = ['id' => $source_row['id'],'actual_bp_amt' => $actual_bp_amt,'actual_tp_amt' => $actual_tp_amt,'actual_tep_amt' => $actual_tep_amt,'actual_bp_per' => $actual_bp_per,'actual_tp_per' => $actual_tp_per,'actual_tep_per' => $actual_tep_per,'variance' => $variance_amt,'actual_tep_brokerage_amt' => $actual_tep_brokerage,'actual_tp_brokerage_amt' => $actual_tp_brokerage,'actual_bp_brokerage_amt' => $actual_bp_brokerage,'reward' => trim($excel_row[15]),'statement_id' => $file_id];
unset($source_data[$source_key]);
continue 2;
}
else
{
$actual_tep_brokerage = $actual_tep_amt * ($actual_tep_per / 100);
$total_amt += $actual_tep_brokerage;
}
//find variance
$variance_amt = $source_row['exp_amt'] - $total_amt;
$data_to_update[] = ['id' => $source_row['id'],'actual_bp_amt' => $actual_bp_amt,'actual_tp_amt' => $actual_tp_amt,'actual_tep_amt' => $actual_tep_amt,'actual_bp_per' => $actual_bp_per,'actual_tp_per' => $actual_tp_per,'actual_tep_per' => $actual_tep_per,'variance' => $variance_amt,'actual_tep_brokerage_amt' => $actual_tep_brokerage,'actual_tp_brokerage_amt' => $actual_tp_brokerage,'actual_bp_brokerage_amt' => $actual_bp_brokerage,'reward' => trim($excel_row[15]),'statement_id' => $file_id];
unset($source_data[$source_key]);
continue 2;
}
}
}
// dd($data_to_update);
$this->PTCOShareDetailsModel->updateBatch($data_to_update, 'id');
// dd($data_to_update);
// if($error_data['error_code'])

View File

@ -4,7 +4,7 @@
namespace App\Controllers;
use App\Helpers\MailHelper;
use App\Controllers\LoginController;
use App\Helpers\DepositHelper;
use App\Helpers\JWTToken;
@ -97,16 +97,51 @@ class RestAuthenticationController extends AdminController
$email = $this->request->getJSON()->email;
$employeeData = $this->employeeModel->where('email', $email)
->where('relationship', 'self')
->where('emp_status !=', 'truncated')
->where('is_active', 1)
$employeeData = $this->employeeModel->where('email_corporate', $email)->where('relationship', 'self')
->where('emp_status !=', 'truncated')->where('is_active', 1)
->first();
if ($employeeData) {
$otp = random_int(100000, 999999);
$update = $this->employeeModel->where('email_corporate', $email)->where('relationship', 'self')
->where('is_active', 1)->set(array('otp' => $otp ))
->update();
if($update)
{
$common = [
'client_id' => $employeeData['client_id'],
'client_branch_id' => $employeeData['client_branch_id'],
'client_policy_id' => null,
'employee_policy_id' => null,
'employee_id' => $employeeData['id'],
'mail_type' => 'otp_mail',
];
$subject = 'Nhance user verification - OTP';
$mail_content = $otp.' is your verification code for Nhance.';
$res = MailHelper::send_email(['mail' => $employeeData['email_corporate'], 'subject' => $subject ,'common'=>$common ,'message' => $mail_content]);
$this->myLogger->logme("info", $res);
if(json_decode($res)->status == 'success')
{
$result = ['user_verification' => true ,'message' => "Verified Successfully"];
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
}else{
$result = ['user_verification' => false , 'message' => "Mail sending failed , try again"];
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200);
}
}else{
$result = ['user_verification' => false , 'message' => "Verification failed , try again"];
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200);
}
$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"];
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200);
@ -122,8 +157,10 @@ class RestAuthenticationController extends AdminController
{
try {
$otp_verification = $this->request->getJSON()->otp_verification;
$otp_verification = isset($this->request->getJSON()->otp_verification) ? $this->request->getJSON()->otp_verification : null;
$mobile_number = isset($this->request->getJSON()->mobile_number) ? $this->request->getJSON()->mobile_number : null;
$otp = isset($this->request->getJSON()->otp) ? $this->request->getJSON()->otp : null;
$email_id = isset($this->request->getJSON()->email_id) ? $this->request->getJSON()->email_id : null;
if (isset($this->request->getJSON()->login_by_hr))
@ -134,12 +171,12 @@ class RestAuthenticationController extends AdminController
{
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->where('emp_status !=', 'truncated')->where('is_active', 1)->first();
} else {
$employeeData = $this->employeeModel->where('email', $email_id)->where('relationship', 'self')->where('emp_status !=', 'truncated')->where('is_active', 1)->first();
$employeeData = $this->employeeModel->where('email_corporate', $email_id)->where('otp', $otp)->where('relationship', 'self')->where('emp_status !=', 'truncated')->where('is_active', 1)->first();
}
}
if ($employeeData && $otp_verification == true || $employeeData && isset($this->request->getJSON()->login_by_hr)) {
if ($employeeData && $otp_verification == true || $employeeData && isset($this->request->getJSON()->login_by_hr) || $employeeData && isset($this->request->getJSON()->otp) ) {
$auth = HttpRequestHelper::getRequestInfo();
if ($auth) {
$data = [
@ -154,6 +191,11 @@ class RestAuthenticationController extends AdminController
$result = JWTToken::encode($employeeData);
if(isset($this->request->getJSON()->otp)){
$this->employeeModel->where('email_corporate', $email_id)->where('otp', $otp)->where('relationship', 'self')->set(['otp'=>null])->update();
}
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
} else {
@ -256,7 +298,7 @@ class RestAuthenticationController extends AdminController
if (isset($mobile_number)) {
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first();
} else {
$employeeData = $this->employeeModel->where('email', $email_id)->where('relationship', 'self')->first();
$employeeData = $this->employeeModel->where('email_corporate', $email_id)->where('relationship', 'self')->first();
}
$mpin = $this->request->getJSON()->mpin;
@ -299,7 +341,7 @@ class RestAuthenticationController extends AdminController
{
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('mpin', $old_mpin)->where('relationship', 'self')->first();
}else{
$employeeData = $this->employeeModel->where('email', $email_id)->where('mpin', $old_mpin)->where('relationship', 'self')->first();
$employeeData = $this->employeeModel->where('email_corporate', $email_id)->where('mpin', $old_mpin)->where('relationship', 'self')->first();
}
@ -338,7 +380,7 @@ class RestAuthenticationController extends AdminController
{
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first();
}else{
$employeeData = $this->employeeModel->where('email', $email_id)->where('relationship', 'self')->first();
$employeeData = $this->employeeModel->where('email_corporate', $email_id)->where('relationship', 'self')->first();
}
if ($employeeData && $mpin == $employeeData["mpin"]) {
@ -379,7 +421,7 @@ class RestAuthenticationController extends AdminController
{
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first();
}else{
$employeeData = $this->employeeModel->where('email', $email_id)->where('relationship', 'self')->first();
$employeeData = $this->employeeModel->where('email_corporate', $email_id)->where('relationship', 'self')->first();
}

View File

@ -71,39 +71,43 @@ class UserController extends AdminController
$this->userTeamsModel->insert($teamData);
}
$db = \Config\Database::connect();
$tableName = 'hdz_staff';
// Set default values
$admin = 0;
$acm = 0;
$acm_id = null;
if ($userData['role'] == 3) {
$db = \Config\Database::connect();
$tableName = 'hdz_staff';
$admin = 0;
$acm = 1;
$acm_id = $insert;
$password = '12345678'; //Default password
$hashedPassword = password_hash($password, PASSWORD_DEFAULT);
foreach ($temp_team as $key => $value) {
$team = $this->teamModel->where('id', $value)->first();
if ($team['name'] == 'Claims') {
$hdz_staff = [
'emp_code' => $userData['emp_code'],
'fullname' => $userData['first_name'],
'username' => strtolower($userData['first_name']),
'email' => $userData['email'],
'admin' => $admin,
'acm' => $acm,
'acm_id' => $acm_id,
'registration' => time(),
'password' => $hashedPassword,
'active' => 1,
];
$db->table($tableName)->insert($hdz_staff);
}
}
} else if (in_array($userData['role'], [1, 5])) {
$admin = 1;
$acm = 0;
$acm_id = null;
}
$password = '12345678'; // Default password
$hashedPassword = password_hash($password, PASSWORD_DEFAULT);
$hdz_staff = [
'emp_code' => $userData['emp_code'],
'fullname' => $userData['first_name'],
'username' => strtolower($userData['first_name']),
'email' => $userData['email'],
'admin' => $admin,
'acm' => $acm,
'acm_id' => $acm_id,
'registration' => time(),
'password' => $hashedPassword,
'active' => 1,
'department' => 'a:7:{i:0;s:1:"1";i:1;s:1:"2";i:2;s:1:"5";i:3;s:1:"3";i:4;s:1:"9";i:5;s:1:"4";i:6;s:2:"10";}',
];
$db->table($tableName)->insert($hdz_staff);
}
}
$this->myLogger->logme('error', 'User create Successfully created by id {data}', ['data' => get_session_userid()]);
@ -149,33 +153,55 @@ class UserController extends AdminController
}
}
$db = \Config\Database::connect();
$tableName = 'hdz_staff';
$hdz_staff = [
'emp_code' => $userData['emp_code'],
'fullname' => $userData['first_name'],
'username' => strtolower($userData['first_name']),
'email' => $userData['email'],
'registration' => time(),
'active' => 1,
'department' => 'a:7:{i:0;s:1:"1";i:1;s:1:"2";i:2;s:1:"5";i:3;s:1:"3";i:4;s:1:"9";i:5;s:1:"4";i:6;s:2:"10";}',
];
if ($userData['role'] == 3) {
$db = \Config\Database::connect();
$tableName = 'hdz_staff';
$admin = 1;
foreach ($userData['team'] as $key => $value) {
if ($value == 2) {
$hdz_staff = [
'emp_code' => $userData['emp_code'],
'fullname' => $userData['first_name'],
'username' => strtolower($userData['first_name']),
'email' => $userData['email'],
'admin' => $admin,
'registration' => time(),
'active' => 1,
];
$db->table($tableName)->where('emp_code', $userData['emp_code'])
->where('email', $userData['email'])
->set($hdz_staff)
->update();
}
}
$hdz_staff['admin'] = 0;
$hdz_staff['acm'] = 1;
$hdz_staff['acm_id'] = $id;
} elseif (in_array($userData['role'], [1, 5])) {
$hdz_staff['admin'] = 1;
$hdz_staff['acm'] = 0;
$hdz_staff['acm_id'] = null;
} else {
return redirect()->to(base_url('/user/list'));
}
// Check if staff data exists
$staffData = $db->table($tableName)
// ->where('emp_code', $userData['emp_code'])
->where('email', $userData['email'])
->get()->getResult();
if (!empty($staffData)) {
// Update existing record
$db->table($tableName)
// ->where('emp_code', $userData['emp_code'])
->where('email', $userData['email'])
->set($hdz_staff)->update();
} else {
$password = '12345678'; // Default password
$hdz_staff['password'] = password_hash($password, PASSWORD_DEFAULT);
// Insert new record
$db->table($tableName)->insert($hdz_staff);
}
}
return redirect()->to(base_url('/user/list'));

View File

@ -81,76 +81,18 @@ class sendMailNotification
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
if ($emp_data && (isset($notification_data) && $notification_data['enabled'] == 1)) {
if(isset($emp_data['relationship'])){
if ($emp_data['relationship'] == 'Self') {
if(count($emp_data) > 0){
$mail ='';
if ($emp_data['relationship'] == 'Self') {
$employee_name =$emp_data['name'];
$employee_mobile_no =$emp_data['mobile'];
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
$mail_content = str_replace("[[member_mobile]]", $employee_mobile_no, $mail_content);
$mail = $emp_data['email_corporate'];
}
}
}else{
$mail ='';
}
}else{
$employee_name =$emp_data['name'];
$employee_mobile_no =$emp_data['mobile'];
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
$mail_content = str_replace("[[member_mobile]]", $employee_mobile_no, $mail_content);
$mail = $emp_data['email_corporate'];
}
if (isset($mail) && !empty($mail)) {
$wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'common' => $common];
}
}else{
foreach ($emp_data as $key => $value) {
if ($value['relationship'] != 'Self') {
$emp_data = $EmployeeModel->where('client_id', $client_data['id'])->where('emp_code', $value['emp_code'])->where('is_active',1)->findAll();
if(count($emp_data) > 1){
$mail ='';
foreach ($emp_data as $key => $values) {
if ($value['relationship'] == 'Self') {
$employee_name =$values['name'];
$employee_mobile_no =$values['mobile'];
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
$mail_content = str_replace("[[member_mobile]]", $employee_mobile_no, $mail_content);
$mail = $values['email_corporate'];
}
}
}else{
$mail ='';
}
}else{
$employee_name =$value['name'];
$employee_mobile_no =$value['mobile'];
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
$mail_content = str_replace("[[member_mobile]]", $employee_mobile_no, $mail_content);
$mail = $value['email_corporate'];
}
if (isset($mail) && !empty($mail)) {
$wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'common' => $common];
}
}
}
$employee_name =$emp_data['name'];
$employee_mobile_no =$emp_data['mobile'];
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
$mail_content = str_replace("[[member_mobile]]", $employee_mobile_no, $mail_content);
$mail = $emp_data['email_corporate'];
if (count($wholeData) < 1) {
$wholeData = [];
}
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'common' => $common];
return $wholeData;
// }else{
// return "false";
// }
} else if($action == 'member_ecard_mail'){
@ -249,7 +191,11 @@ class sendMailNotification
// echo '<pre>';
// print_r($array_list); die;
foreach ($array_list as $item) {
$payable_employee_array = [];
if (count($item) != 0) {
@ -257,6 +203,7 @@ class sendMailNotification
$temp_data = '';
$policy_name = '';
$is_addon = '';
$rowspan = count($item) ?? 2;
foreach ($item as $inner_item) {
@ -269,6 +216,14 @@ class sendMailNotification
}
//end of getting policy premium data
// dd($policy_premium_data);
if($inner_item['payable_employee'] == 1 && $client_policy_data['policy_type_id'] == 2){
$payable_employee_array['emp_data'][] = $inner_item;
}
// dd($policy_premium_data);
$policy_name = $inner_item['policy_name'];
if ($inner_item['relationship'] == 'Self') {
@ -283,8 +238,19 @@ class sendMailNotification
$gst_forself = '';
// if(checkFamilyFloaters($policy_premium_data, $client_policy_data, $inner_item)){
$si = '₹ ' .format_indian_number($inner_item['basic_cover_si']);
$premium = '₹ ' .format_indian_number(round($inner_item['premium']));
if($policy_premium_data['premium_type'] == 2){
$si = '₹ ' .format_indian_number($inner_item['basic_cover_si']);
}else{
if ($inner_item['relationship'] == 'Self') {
$payable_employee_array['si_amount'] = $inner_item['basic_cover_si'];
$payable_employee_array['self_premium'] = $inner_item['rata_premimum'];
$payable_employee_array['self_gst'] = $inner_item['gst'];
}
empty($inner_item['basic_cover_si']) ? $si = 0 : $si = '₹ ' .format_indian_number($inner_item['basic_cover_si']);
}
$premium = '₹ ' .format_indian_number(round($inner_item['rata_premimum']));
$gst_forself = '₹ ' .format_indian_number(round($inner_item['gst']));
// }
@ -292,8 +258,13 @@ class sendMailNotification
$temp_data .= '<td>' . $inner_item['name'] . ($inner_item['relationship'] == 'Self' ? ' (' . $inner_item['emp_code'] . ')' : '') . '</td>';
$temp_data .= '<td>' . $inner_item['relationship'] . '</td>';
$temp_data .= '<td>' . \DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y') . '</td>';
$temp_data .= '<td>' . $si . '</td>';
if($policy_premium_data['premium_type'] == 2){
$temp_data .= '<td>' . $si . '</td>';
}else{
$temp_data .= (($si != 0 && count($item) != 1) ? ('<td rowspan='.$rowspan.'>' . $si . '</td>') : ($si == 0 ? "" : '<td>' . $si . '</td>') );
}
// Only Display SI Topup and Dependent Addon
if ($inner_item['is_addon'] == 2 || $inner_item['is_addon'] == 3) {
$temp_data .= '<td>' . $premium . '</td>';
@ -352,6 +323,140 @@ class sendMailNotification
$addtional_premium = 0;
$gst = 0;
}
// dd($payable_employee_array);
// dd(count($payable_employee_array['emp_data']));
if(count($payable_employee_array['emp_data']) > 0){
$table_content .= '<div style="text-align: left; font-size: 12px;"><div style="text-align:left;"><h4>Policy Type :';
$temp_data = '';
$is_addon = '';
$rowspan = count($payable_employee_array['emp_data']) ?? 2;
$self_si_amount = $payable_employee_array['si_amount'] ?? 0;
$self_premium = $payable_employee_array['self_premium'] ?? 0;
$self_gst = $payable_employee_array['self_gst'] ?? 0;
// dd($payable_employee_array['si_amount'], $self_si_amount);
foreach ($payable_employee_array['emp_data'] as $inner_item) {
//getting policy premium data
$client_policy_data = $clientPolicyModel->where('id', $inner_item['client_policy_id'])->first();
if($client_policy_data['policy_type_id'] == 1 || $client_policy_data['policy_type_id'] == 6 || $client_policy_data['policy_type_id'] == 7 ){
$policy_premium_data = $PolicyPremium1Model->where('client_policy_id', $inner_item['client_policy_id'])->where('is_active', '1')->first();
}else{
$policy_premium_data = $PolicyPremium2Model->where('client_policy_id', $inner_item['client_policy_id'])->where('is_active', '1')->first();
}
//end of getting policy premium data
// dd($policy_premium_data);
$si = '';
$premium = '';
$gst_forself = '';
if($policy_premium_data['premium_type'] == 2){
$si = '₹ ' .format_indian_number($inner_item['basic_cover_si']);
}else{
empty($self_si_amount) ? $si = 0 : $si = '₹ ' .format_indian_number($self_si_amount);
}
if($policy_premium_data['premium_type'] == 1){
empty($self_premium) ? $premium = 0 : $premium = '₹ ' .format_indian_number($self_premium);
empty($self_gst) ? $gst_forself = 0 : $gst_forself = '₹ ' .format_indian_number($self_gst);
}else{
$premium = '₹ ' .format_indian_number(round($inner_item['rata_premimum']));
$gst_forself = '₹ ' .format_indian_number(round($inner_item['gst']));
}
$temp_data .= '<tr>';
$temp_data .= '<td>' . $inner_item['name'] . ($inner_item['relationship'] == 'Self' ? ' (' . $inner_item['emp_code'] . ')' : '') . '</td>';
$temp_data .= '<td>' . $inner_item['relationship'] . '</td>';
$temp_data .= '<td>' . \DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y') . '</td>';
// dd($si);
if($policy_premium_data['premium_type'] == 2){
$temp_data .= '<td>' . $si . '</td>';
$temp_data .= '<td>' . $premium . '</td>';
$temp_data .= '<td>' . $gst_forself . '</td>';
}else{
if($policy_premium_data['premium_type'] == 1){
$temp_data .= (($si != 0 && count($item) != 1) ? ('<td rowspan='.$rowspan.'>' . $si . '</td>') : ($si == 0 ? "" : '<td>' . $si . '</td>') );
$temp_data .= (($premium != 0 && count($item) != 1) ? ('<td rowspan='.$rowspan.'>' . $premium . '</td>') : ($premium == 0 ? "" : '<td>' . $premium . '</td>') );
$temp_data .= (($gst_forself != 0 && count($item) != 1) ? ('<td rowspan='.$rowspan.'>' . $gst_forself . '</td>') : ($gst_forself == 0 ? "" : '<td>' . $gst_forself . '</td>') );
}else{
$temp_data .= (($si != 0 && count($item) != 1) ? ('<td rowspan='.$rowspan.'>' . $si . '</td>') : ($si == 0 ? "" : '<td>' . $si . '</td>') );
$temp_data .= '<td>' . $premium . '</td>';
$temp_data .= '<td>' . $gst_forself . '</td>';
}
$self_si_amount = 0;
$self_premium = 0;
$self_gst = 0;
}
$temp_data .= '</tr>';
$is_addon = $inner_item['is_addon'];
$addtional_premium = $inner_item['rata_premimum'] + $addtional_premium;
$gst = $inner_item['gst'] + $gst;
}
$policy_name_for_policy_type = $inner_item['policy_name'];
if($client_policy_data['policy_type_id'] == 3 && $client_policy_data['is_addon'] == 3){
$policy_name_for_policy_type = 'Add-On Group Medical Coverage for Parents';
}
$table_content .= $policy_name_for_policy_type . ' ( Payable By Employee ) </h4></div>';
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
// Add text-align: center to the table head
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">';
$table_content .= '<tr>';
$table_content .= '<th>Name</th>';
$table_content .= '<th>Relation</th>';
$table_content .= '<th style="width:15%">Date Of Birth</th>';
$table_content .= '<th>Sum Insured</th>';
$table_content .= '<th>Premium</th>';
$table_content .= '<th>GST</th>';
$table_content .= '</tr>';
$table_content .= '</thead>';
// Add text-align: center to the table body
$table_content .= '<tbody style="text-align: center;">' . $temp_data . '</tbody>';
$table_content .= '</table></div>';
$addon_list_array = [
'policy_name' => $policy_name_for_policy_type . '( Payable By Employee )',
'addtional_premium' => round($addtional_premium),
'gst' => round($gst)
];
$Addon_list[] = $addon_list_array;
$temp_data = '';
$addtional_premium = 0;
$gst = 0;
}
}
if (count($Addon_list) > 0) {
@ -393,6 +498,7 @@ class sendMailNotification
// $table_content .= '<div style="width:100%; text-align:right; font-size: 12px;">' . $sum_total_words . '</div>';
}
// dd($payable_employee_array, $Addon_list);
// print_r($table_content); die;
$mail_content = str_replace("[[member_name]]", $name . ' (' . $emp_code . ')' , $mail_content);
@ -462,6 +568,9 @@ class sendMailNotification
$Addon_list = [];
foreach ($array_list as $item) {
$payable_employee_array = [];
if (count($item) != 0) {
$table_content .= '<div style="text-align: left; font-size: 12px;"><div style="text-align:left;"><h4>Policy Type :';
$temp_data = '';
@ -479,6 +588,10 @@ class sendMailNotification
}
//end of getting policy premium data
if($inner_item['payable_employee'] == 1 && $client_policy_data['policy_type_id'] == 2){
$payable_employee_array[] = $inner_item;
}
$policy_name = $inner_item['policy_name'];
if ($inner_item['relationship'] == 'Self') {
@ -490,11 +603,11 @@ class sendMailNotification
$si = '';
$premium = '';
$gst_forself = '';
if(checkFamilyFloaters($policy_premium_data, $client_policy_data, $inner_item)){
// if(checkFamilyFloaters($policy_premium_data, $client_policy_data, $inner_item)){
$si = '₹ ' .format_indian_number($inner_item['basic_cover_si']);
$premium = '₹ ' .format_indian_number(round($inner_item['premium']));
$gst_forself = '₹ ' .format_indian_number(round($inner_item['gst']));
}
// }
$temp_data .= '<tr>';
$temp_data .= '<td>' . $inner_item['name'] . $emp_code . '</td>';
@ -560,6 +673,90 @@ class sendMailNotification
$addtional_premium = 0;
$gst = 0;
}
if(count($payable_employee_array) > 0){
$table_content .= '<div style="text-align: left; font-size: 12px;"><div style="text-align:left;"><h4>Policy Type :';
$temp_data = '';
$is_addon = '';
foreach ($payable_employee_array as $inner_item) {
//getting policy premium data
$client_policy_data = $clientPolicyModel->where('id', $inner_item['client_policy_id'])->first();
if($client_policy_data['policy_type_id'] == 1 || $client_policy_data['policy_type_id'] == 6 || $client_policy_data['policy_type_id'] == 7 ){
$policy_premium_data = $PolicyPremium1Model->where('client_policy_id', $inner_item['client_policy_id'])->where('is_active', '1')->first();
}else{
$policy_premium_data = $PolicyPremium2Model->where('client_policy_id', $inner_item['client_policy_id'])->where('is_active', '1')->first();
}
//end of getting policy premium data
$si = '';
$premium = '';
$gst_forself = '';
$si = '₹ ' .format_indian_number($inner_item['basic_cover_si']);
$premium = '₹ ' .format_indian_number(round($inner_item['rata_premimum']));
$gst_forself = '₹ ' .format_indian_number(round($inner_item['gst']));
$temp_data .= '<tr>';
$temp_data .= '<td>' . $inner_item['name'] . ($inner_item['relationship'] == 'Self' ? ' (' . $inner_item['emp_code'] . ')' : '') . '</td>';
$temp_data .= '<td>' . $inner_item['relationship'] . '</td>';
$temp_data .= '<td>' . \DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y') . '</td>';
$temp_data .= '<td>' . $si . '</td>';
$temp_data .= '<td>' . $premium . '</td>';
$temp_data .= '<td>' . $gst_forself . '</td>';
$temp_data .= '</tr>';
$is_addon = $inner_item['is_addon'];
$addtional_premium = $inner_item['rata_premimum'] + $addtional_premium;
$gst = $inner_item['gst'] + $gst;
}
$policy_name_for_policy_type = $inner_item['policy_name'];
if($client_policy_data['policy_type_id'] == 3 && $client_policy_data['is_addon'] == 3){
$policy_name_for_policy_type = 'Add-On Group Medical Coverage for Parents';
}
$table_content .= $policy_name_for_policy_type . ' ( Payable By Employee ) </h4></div>';
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
// Add text-align: center to the table head
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">';
$table_content .= '<tr>';
$table_content .= '<th>Name</th>';
$table_content .= '<th>Relation</th>';
$table_content .= '<th style="width:15%">Date Of Birth</th>';
$table_content .= '<th>Sum Insured</th>';
$table_content .= '<th>Premium</th>';
$table_content .= '<th>GST</th>';
$table_content .= '</tr>';
$table_content .= '</thead>';
// Add text-align: center to the table body
$table_content .= '<tbody style="text-align: center;">' . $temp_data . '</tbody>';
$table_content .= '</table></div>';
$addon_list_array = [
'policy_name' => $policy_name_for_policy_type . '( Payable By Employee )',
'addtional_premium' => round($addtional_premium),
'gst' => round($gst)
];
$Addon_list[] = $addon_list_array;
$temp_data = '';
$addtional_premium = 0;
$gst = 0;
}
}
if (count($Addon_list) > 0) {
@ -667,8 +864,11 @@ class sendMailNotification
$gst = 0;
$array_list = $params['array_list'];
$Addon_list = [];
foreach ($array_list as $item) {
$payable_employee_array = [];
if (count($item) != 0) {
$table_content .= '<div style="text-align: left; font-size: 12px;"><div style="text-align:left;"><h4>Policy Type :';
$temp_data = '';
@ -686,6 +886,10 @@ class sendMailNotification
}
//end of getting policy premium data
if($inner_item['payable_employee'] == 1 && $client_policy_data['policy_type_id'] == 2){
$payable_employee_array[] = $inner_item;
}
$policy_name = $inner_item['policy_name'];
if ($inner_item['relationship'] == 'Self') {
@ -700,11 +904,11 @@ class sendMailNotification
// dd($policy_premium_data, $client_policy_data, $inner_item);
if(checkFamilyFloaters($policy_premium_data, $client_policy_data, $inner_item)){
// if(checkFamilyFloaters($policy_premium_data, $client_policy_data, $inner_item)){
$si = '₹ ' .format_indian_number($inner_item['basic_cover_si']);
$premium = '₹ ' .format_indian_number(round($inner_item['premium']));
$gst_forself = '₹ ' .format_indian_number(round($inner_item['gst']));
}
// }
$temp_data .= '<tr>';
$temp_data .= '<td>' . $inner_item['name'] . $emp_code . '</td>';
@ -770,6 +974,89 @@ class sendMailNotification
$addtional_premium = 0;
$gst = 0;
}
if(count($payable_employee_array) > 0){
$table_content .= '<div style="text-align: left; font-size: 12px;"><div style="text-align:left;"><h4>Policy Type :';
$temp_data = '';
$is_addon = '';
foreach ($payable_employee_array as $inner_item) {
//getting policy premium data
$client_policy_data = $clientPolicyModel->where('id', $inner_item['client_policy_id'])->first();
if($client_policy_data['policy_type_id'] == 1 || $client_policy_data['policy_type_id'] == 6 || $client_policy_data['policy_type_id'] == 7 ){
$policy_premium_data = $PolicyPremium1Model->where('client_policy_id', $inner_item['client_policy_id'])->where('is_active', '1')->first();
}else{
$policy_premium_data = $PolicyPremium2Model->where('client_policy_id', $inner_item['client_policy_id'])->where('is_active', '1')->first();
}
//end of getting policy premium data
$si = '';
$premium = '';
$gst_forself = '';
$si = '₹ ' .format_indian_number($inner_item['basic_cover_si']);
$premium = '₹ ' .format_indian_number(round($inner_item['rata_premimum']));
$gst_forself = '₹ ' .format_indian_number(round($inner_item['gst']));
$temp_data .= '<tr>';
$temp_data .= '<td>' . $inner_item['name'] . ($inner_item['relationship'] == 'Self' ? ' (' . $inner_item['emp_code'] . ')' : '') . '</td>';
$temp_data .= '<td>' . $inner_item['relationship'] . '</td>';
$temp_data .= '<td>' . \DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y') . '</td>';
$temp_data .= '<td>' . $si . '</td>';
$temp_data .= '<td>' . $premium . '</td>';
$temp_data .= '<td>' . $gst_forself . '</td>';
$temp_data .= '</tr>';
$is_addon = $inner_item['is_addon'];
$addtional_premium = $inner_item['rata_premimum'] + $addtional_premium;
$gst = $inner_item['gst'] + $gst;
}
$policy_name_for_policy_type = $inner_item['policy_name'];
if($client_policy_data['policy_type_id'] == 3 && $client_policy_data['is_addon'] == 3){
$policy_name_for_policy_type = 'Add-On Group Medical Coverage for Parents';
}
$table_content .= $policy_name_for_policy_type . ' ( Payable By Employee ) </h4></div>';
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
// Add text-align: center to the table head
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">';
$table_content .= '<tr>';
$table_content .= '<th>Name</th>';
$table_content .= '<th>Relation</th>';
$table_content .= '<th style="width:15%">Date Of Birth</th>';
$table_content .= '<th>Sum Insured</th>';
$table_content .= '<th>Premium</th>';
$table_content .= '<th>GST</th>';
$table_content .= '</tr>';
$table_content .= '</thead>';
// Add text-align: center to the table body
$table_content .= '<tbody style="text-align: center;">' . $temp_data . '</tbody>';
$table_content .= '</table></div>';
$addon_list_array = [
'policy_name' => $policy_name_for_policy_type . '( Payable By Employee )',
'addtional_premium' => round($addtional_premium),
'gst' => round($gst)
];
$Addon_list[] = $addon_list_array;
$temp_data = '';
$addtional_premium = 0;
$gst = 0;
}
}
if (count($Addon_list) > 0) {

View File

@ -404,67 +404,68 @@ if(!function_exists('checkFamilyFloaters')){
}
}
if (!function_exists('numberToWords')) {
function numberToWords($number)
{
$words = array(
'0' => 'Zero',
'1' => 'One',
'2' => 'Two',
'3' => 'Three',
'4' => 'Four',
'5' => 'Five',
'6' => 'Six',
'7' => 'Seven',
'8' => 'Eight',
'9' => 'Nine',
'10' => 'Ten',
'11' => 'Eleven',
'12' => 'Twelve',
'13' => 'Thirteen',
'14' => 'Fourteen',
'15' => 'Fifteen',
'16' => 'Sixteen',
'17' => 'Seventeen',
'18' => 'Eighteen',
'19' => 'Nineteen',
'20' => 'Twenty',
'30' => 'Thirty',
'40' => 'Forty',
'50' => 'Fifty',
'60' => 'Sixty',
'70' => 'Seventy',
'80' => 'Eighty',
'90' => 'Ninety'
);
function numberToWords($number)
{
$words = array(
'0' => 'Zero',
'1' => 'One',
'2' => 'Two',
'3' => 'Three',
'4' => 'Four',
'5' => 'Five',
'6' => 'Six',
'7' => 'Seven',
'8' => 'Eight',
'9' => 'Nine',
'10' => 'Ten',
'11' => 'Eleven',
'12' => 'Twelve',
'13' => 'Thirteen',
'14' => 'Fourteen',
'15' => 'Fifteen',
'16' => 'Sixteen',
'17' => 'Seventeen',
'18' => 'Eighteen',
'19' => 'Nineteen',
'20' => 'Twenty',
'30' => 'Thirty',
'40' => 'Forty',
'50' => 'Fifty',
'60' => 'Sixty',
'70' => 'Seventy',
'80' => 'Eighty',
'90' => 'Ninety'
);
if ($number < 21) {
return $words[$number];
}
if ($number < 100) {
$tens = (int)($number / 10) * 10;
$units = $number % 10;
return $words[$tens] . ($units ? ' ' . $words[$units] : '');
}
if ($number < 1000) {
$hundreds = (int)($number / 100);
$remainder = $number % 100;
return $words[$hundreds] . ' Hundred' . ($remainder ? ' and ' . numberToWords($remainder) : '');
}
$levels = array('', ' Thousand', ' Million', ' Billion', ' Trillion', ' Quadrillion', ' Quintillion');
for ($i = 0, $unit = 1; $i < count($levels); $i++, $unit *= 1000) {
if ($number < $unit * 1000) {
$current = (int)($number / $unit);
$remainder = $number % $unit;
return numberToWords($current) . $levels[$i] . ($remainder ? ' ' . numberToWords($remainder) : '');
if ($number < 21) {
return $words[$number];
}
}
return $number; // Fallback for numbers beyond the supported range
if ($number < 100) {
$tens = (int)($number / 10) * 10;
$units = $number % 10;
return $words[$tens] . ($units ? ' ' . $words[$units] : '');
}
if ($number < 1000) {
$hundreds = (int)($number / 100);
$remainder = $number % 100;
return $words[$hundreds] . ' Hundred' . ($remainder ? ' and ' . numberToWords($remainder) : '');
}
$levels = array('', ' Thousand', ' Million', ' Billion', ' Trillion', ' Quadrillion', ' Quintillion');
for ($i = 0, $unit = 1; $i < count($levels); $i++, $unit *= 1000) {
if ($number < $unit * 1000) {
$current = (int)($number / $unit);
$remainder = $number % $unit;
return numberToWords($current) . $levels[$i] . ($remainder ? ' ' . numberToWords($remainder) : '');
}
}
return $number; // Fallback for numbers beyond the supported range
}
}
if (!function_exists('print_rr')) {
@ -493,6 +494,7 @@ if (!function_exists('get_server_details')) {
];
}
}
if (!function_exists('isJsonString')) {
function isJsonString($input)
@ -509,9 +511,7 @@ if (!function_exists('isValidDate')) {
}
}
if (!function_exists('change_date_format'))
{
if (!function_exists('change_date_format')) {
function change_date_format($date_str, $source_format = null, $output_format = 'Y-m-d') {
@ -584,3 +584,80 @@ if (!function_exists('change_date_format'))
return null;
}
}
// if (!function_exists('check_pay_by_employee_or_company'))
// {
// function check_pay_by_employee_or_company($is_payable_employee = null, $relationship = null) {
// $relationship = strtolower(str_replace(" ", "_", $relationship));
// $result = 0;
// if($relationship == 'self'){
// $result = $is_payable_employee['self'] == 1 ? 1 : 0;
// }else if($relationship == 'spouse'){
// $result = $is_payable_employee['spouse'] == 1 ? 1 : 0;
// }else if(in_array($relationship, ['son', 'daughter'])){
// $result = $is_payable_employee['childern'] == 1 ? 1 : 0;
// }else if(in_array($relationship, ['father', 'mother', 'father_in_law', 'mother_in_law'])){
// $result = $is_payable_employee['elders'] == 1 ? 1 : 0;
// }
// return $result;
// }
// }
if (!function_exists('check_pay_by_employee_or_company')) {
function check_pay_by_employee_or_company($policy_terms = null, $relationship = null)
{
// dd($policy_terms, $relationship);
if (!$policy_terms || !($policy_terms = json_decode($policy_terms, true))) {
return 0;
}
// dd($policy_terms, $relationship);
if (!isset($policy_terms['is_payable_employee'])) {
return 0;
}
$is_payable_employee = $policy_terms['is_payable_employee'];
$relationship = strtolower(str_replace(" ", "_", $relationship));
// dd($is_payable_employee, $relationship);
$relationshipMap = [
'self' => 'self',
'spouse' => 'spouse',
'son' => 'childern',
'daughter' => 'childern',
'father' => 'elders',
'mother' => 'elders',
'father_in_law' => 'elders',
'mother_in_law' => 'elders'
];
if (array_key_exists($relationship, $relationshipMap)) {
$key = $relationshipMap[$relationship];
return isset($is_payable_employee[$key]) && $is_payable_employee[$key] == 1 ? 1 : 0;
}
return 0;
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class AuditHistoryModel extends Model
{
protected $table = 'auditing_history';
protected $primaryKey = 'id';
protected $allowedFields = [
"id",
"pk",
"table_name",
"field_name",
"old_value",
"new_value",
"created_by",
"created_at",
];
}
?>

View File

@ -39,6 +39,7 @@ class ClientModel extends Model
"email",
"reply_to",
"mail_domain",
"addon_subheading",
];

View File

@ -54,6 +54,39 @@ class ClientPolicyModel extends Model
"is_member_modify_allowed",
];
// Callbacks
protected $allowCallbacks = true;
protected $beforeInsert = ["checkAndADDCreatedByValue"];
protected $afterInsert = [];
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
protected function checkAndADDCreatedByValue(array $data)
{
// Check if 'updated_by' value is null or empty
if (empty($data['data']['created_by'])) {
// Set 'updated_by' value to the current session user ID
$data['data']['created_by'] = get_session_userid();
}
return $data;
}
protected function checkAndUpdateUpdatedByValue(array $data)
{
// Check if 'updated_by' value is null or empty
if (empty($data['data']['updated_by'])) {
// Set 'updated_by' value to the current session user ID
$data['data']['updated_by'] = get_session_userid();
}
return $data;
}
public function getClientPolicyById($id){
return $this->db->table('client_policy')
@ -390,21 +423,26 @@ public function getCliendDataForExcelFileName($client_policy_id){
}
//for this using in CRONE JOB
public function getPolicyDetailsForRemainder($client_id = null, $branch_id = null)
public function getPolicyDetailsForRemainder($client_id = null, $branch_id = null, $policy_id = null)
{
$builder = $this->table('client_policy')
->where('client_policy.is_addon', 1)
->where('client_policy.open_for_enrollment', 1)
->where('client_policy.inception_type', 2)
->where('client_policy.is_active', 1)
->where('client_policy.policy_status', 1)
->whereIn('client_policy.policy_type_id', [2, 3]);
// ->where('client_policy.is_addon', 1)
// ->where('client_policy.inception_type', 2)
->where('client_policy.open_for_enrollment', 1);
if ($client_id && $branch_id) {
$builder->where('client_policy.client_id', $client_id)
->where('client_policy.client_branch_id', $branch_id);
}
if(empty($policy_id)){
$builder->whereIn('client_policy.policy_type_id', [2, 3, 4, 5]);
}else{
$builder->where('client_policy.id', $policy_id);
}
return $builder->get()->getResultArray();
}

View File

@ -106,7 +106,7 @@ class EmployeeModel extends Model
public function getEmpFamilybyEmpCode(string $client_policy_id = null,string $emp_code = null,string $client_id = null,array $emp_status = [],array $policy_status = [],array $relationship = [],array $client_branch_id = [])
{
$result = $this->select(['employees.id as emp_id', 'employees.client_id','employees.client_branch_id', 'employees.relationship', 'employees.relationship_code', 'employees.change_event', 'employees.emp_code', 'employees.name', 'employees.email_personal', 'employees.email_corporate', 'employees.mobile', 'employees.gender', 'employees.dob', 'employees.doj', 'employees.basic_pay', 'employees.band', 'employees.designation', 'employees.emp_status','employees.unit','employee_polices.id as emp_policy_id', 'employee_polices.employee_id', 'employee_polices.client_policy_id', 'employee_polices.tpa_id', 'employee_polices.uhid', 'employee_polices.batch_code', 'employee_polices.status', 'employee_polices.pre_existing_alignments', 'employee_polices.basic_cover_si', 'employee_polices.date_coverage', 'employee_polices.policy_end_date', 'employee_polices.days', 'employee_polices.premium', 'employee_polices.rata_premimum', 'employee_polices.gst', 'employee_polices.date_of_exit', 'employee_polices.reason_for_exit','policy_type.long_name as policy_name','client_policy.is_addon'])
$result = $this->select(['employees.id as emp_id', 'employees.client_id','employees.client_branch_id', 'employees.relationship', 'employees.relationship_code', 'employees.change_event', 'employees.emp_code', 'employees.name', 'employees.email_personal', 'employees.email_corporate', 'employees.mobile', 'employees.gender', 'employees.dob', 'employees.doj', 'employees.basic_pay', 'employees.band', 'employees.designation', 'employees.emp_status','employees.unit','employee_polices.id as emp_policy_id', 'employee_polices.employee_id', 'employee_polices.client_policy_id', 'employee_polices.tpa_id', 'employee_polices.uhid', 'employee_polices.batch_code', 'employee_polices.status', 'employee_polices.pre_existing_alignments', 'employee_polices.basic_cover_si', 'employee_polices.date_coverage', 'employee_polices.policy_end_date', 'employee_polices.days', 'employee_polices.premium', 'employee_polices.rata_premimum', 'employee_polices.gst', 'employee_polices.date_of_exit', 'employee_polices.reason_for_exit','policy_type.long_name as policy_name','client_policy.is_addon', 'employee_polices.payable_employee'])
->join('employee_polices', 'employee_polices.employee_id = employees.id')
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
->join('policy_type', 'policy_type.id = client_policy.policy_type_id','left')

View File

@ -33,7 +33,8 @@ class EmployeePolicyModel extends Model
"rand_string",
"is_active",
"claim_status",
'ecard_sent_status'
'ecard_sent_status',
'payable_employee',
];
// Callbacks
@ -556,7 +557,7 @@ class EmployeePolicyModel extends Model
}
public function getDeletionEmployeeDataForExportExcel($ref_data)
public function getDeletionEmployeeDataForExportExcel($ref_data, $return_type = 0)
{
$client_id = $ref_data['client_id'];
@ -617,8 +618,7 @@ class EmployeePolicyModel extends Model
employee_polices.basic_cover_si,
employee_polices.uhid as uhid,
employee_polices.policy_end_date,
employee_polices.premium,
employee_polices.rata_premimum as pro_rata_premium,
employee_polices.rata_premimum as premium,
employee_polices.claim_status,
batch_data.emp_policy_id AS emp_policy_id,
@ -713,9 +713,14 @@ class EmployeePolicyModel extends Model
group by group_key
");
$result = $query->getResult();
if($return_type == 1){
$result = $query->getResultArray();
}else{
$result = $query->getResult();
}
// dd($this->db->getLastQuery(), $result);
return $result;
}

View File

@ -88,10 +88,16 @@ body {
<span class="d-none d-sm-inline-block">Policies</span>
</a>
</li>
<li class="nav-item">
<a href="#others-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="others_tab">
<span class="mr-1"><i class="mdi mdi-tag-text-outline"></i></span>
<span class="d-none d-sm-inline-block">Others</span>
</a>
</li>
</ul>
<div class="tab-content">
<?php include('client_others_tab.php'); ?>
<?php include('notification.php'); ?>
<?php include('client_basic_info.php'); ?>
<?php include('client_kyc.php'); ?>
<?php include('client_rm.php'); ?>

View File

@ -0,0 +1,81 @@
<div class="tab-pane fade" id="others-tab">
<div class="row">
<div class="col-12">
<div class="card-body">
<form role="form" class="parsley-examples" method="post" id="others_form" enctype="multipart/form-data">
<input type="hidden" name="client_id" value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-12">
<label for="addon_subheading">Addon Sub-Heading</label>
<textarea class="form-control" id="addon_subheading" name="addon_subheading" rows="1" placeholder="Enter Text"><?= isset($client['addon_subheading']) ? $client['addon_subheading'] : '' ?></textarea>
</div>
</div>
</div>
<div class="form-group text-right m-b-0">
<button type="submit" class="btn btn-primary" id="others_form_submit">Submit</button>
</div>
</form>
</div>
</div> <!-- end col-->
</div>
<!-- end row -->
</div>
<!-- end -->
<script>
$(document).ready(function() {
//for Client Others Form Submit using AJAX
$("#others_form").submit(function(event) {
event.preventDefault();
var isValid = $('#others_form').parsley().validate();
if (!isValid) {
return;
}
if (isValid) {
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var form_action = '<?= base_url("client/others/create"); ?>';
var formData = new FormData($('#others_form')[0]);
$.ajax({
data: formData,
url: form_action,
type: "POST",
dataType: 'json',
processData: false,
contentType: false,
success: function(res) {
console.log(res);
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
if (res.status == true) {
toastr.success(res.message, 'SUCCESS');
} else {
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');
}
});
}
});
});
</script>

View File

@ -175,14 +175,14 @@
<label for="policy_visibility" style="position: relative;bottom: 5px;left: 85px;">Policy Visibilty in Enrollment App</label>
</div>
<div class="form-group col-md-4">
<!-- <div class="form-group col-md-4">
<label class="switch" style="position: relative;top: 43px;left: 20px;">
<input id="is_member_modify_allowed" type="checkbox" name="is_member_modify_allowed" checked>
<span class="slider round" style="height: 27px;"></span>
</label>
<label for="is_member_modify_allowed" style="position: relative;bottom: 5px;left: 85px;"> In Enrollment Member Data Modification Allowed</label>
</div>
</div> -->
</div>
<div id="policy_fields"></div>
@ -257,7 +257,6 @@
}
})
var policy_PrimaryKey = $('#client_id_policy').val();
var policy_client = $('#policy_PrimaryKey').val();
@ -827,11 +826,11 @@
}
// Member Modify Data Enable or Disable
if (res.data.is_member_modify_allowed == 1) {
$('#is_member_modify_allowed').prop('checked', true);
} else {
$('#is_member_modify_allowed').prop('checked', false);
}
// if (res.data.is_member_modify_allowed == 1) {
// $('#is_member_modify_allowed').prop('checked', true);
// } else {
// $('#is_member_modify_allowed').prop('checked', false);
// }
// if (res.data.is_addon != '1' && res.data.is_addon != '0') {
@ -1199,7 +1198,9 @@
} else if (input) {
// console.log( 'input type step 2', typeof input);
// Handle the case where input is a string
number = parseFloat(input.replace(/,/g, ''), 10);
// number = parseFloat(input.replace(/,/g, ''), 10);
number = parseFloat(String(input).replace(/,/g, ''), 10);
} else {
// Handle the case where input is undefined or null
number = NaN; // or handle as needed

View File

@ -217,7 +217,7 @@
<div class="form-group col-md-8">
<label for="name">Name<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="name" placeholder="Ente Name" readonly>
<input type="text" class="form-control" name="name" id="name" placeholder="Ente Name">
</div>
</div>
<div class="form-row">
@ -264,7 +264,7 @@
$(document).ready(function(){
var dob = flatpickr("#dob", {
dateFormat: "d/m/Y",
dateFormat: "d/M/Y",
allowInput: false
});
})

View File

@ -17,7 +17,7 @@
/* background-color: #eb7a76; */
background-color: darkgrey;
/* padding-bottom: 1px; */
padding-top: 10px;
/* padding-top: 10px; */
}
#tickets-table_filter {
@ -59,24 +59,31 @@
</div>
<div class="col-3">
<div id="categoryFilter_11">
<select name="branch_id" class="form-control" id="branch_id">
<select name="branch_id" class="form-control" id="branch_id" onchange="populatePolicies()">
<option value="0">Select Branch</option>
</select>
</div>
</div>
<div class="col-3">
<div id="categoryFilter_14">
<select name="client_policy_id" class="form-control" id="client_policy_id">
<option value="0">Select Policy</option>
</select>
</div>
</div>
<div class="col-1">
<div id="categoryFilter_11">
<a href="#" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="fetchEmpolyeeList(event);"><i class="fa fa-search" aria-hidden="true"></i></a>
<a class="btn btn-primary waves-effect waves-light" onclick="fetchEmpolyeeList(event);" data-toggle="tooltip" data-placement="top" title="Search" id="get-emp-list"><i class="fa fa-search" aria-hidden="true"></i></a>
</div>
</div>
<div class="col-2">
<div class="col-0" style="margin-right: 15px; ">
<div id="categoryFilter_12">
<a href="#" class="btn btn-primary waves-effect waves-light" onclick="sendManualReminder(this)">Send Reminder</a>
<a class="btn btn-primary waves-effect waves-light" onclick="sendManualReminder(this)" data-toggle="tooltip" data-placement="top" title="Send Reminder"><i class="fa fa-bell" aria-hidden="true"></i></a>
</div>
</div>
<div class="col-1">
<div class="col-0">
<div id="categoryFilter_13">
<a class="btn btn-primary waves-effect waves-light" onclick="uploadEnrollmentFile(this)" ><i class="fas fa-file-upload" ></i></a>
<a class="btn btn-primary waves-effect waves-light" onclick="uploadEnrollmentFile(this)" data-toggle="tooltip" data-placement="top" title="Enrollment File Upload"><i class="fas fa-file-upload" ></i></a>
</div>
</div>
@ -84,7 +91,7 @@
<!-- <div class="row" style="margin-bottom: 44px;"> -->
<div class="col-1 text-right view-status-btn" style="position: relative;bottom: 7px;">
<button type="button" class="btn btn-link visa_status_button" onclick="toggleContent()" style="color: #000;">
<button type="button" class="btn btn-link visa_status_button" onclick="toggleContent()" style="color: #000;" data-toggle="tooltip" data-placement="top" title="View Status Card">
Status <i id="toggleIcon" class="fas fa-minus"></i>
</button>
</div>
@ -234,6 +241,7 @@
</div><!-- /.modal -->
<script>
function populateBranches()
{
var clientId = document.getElementById('clients').value;
@ -257,6 +265,38 @@
});
}
function populatePolicies()
{
console.log('populatePolicies function called');
var clientId = document.getElementById('clients').value;
var branchId = document.getElementById('branch_id').value;
var policyDropdown = document.getElementById('client_policy_id');
console.log('clientId', clientId);
console.log('branchId', branchId);
console.log('policyDropdown', policyDropdown);
policyDropdown.innerHTML = '<option value="0">Select Policy</option>';
if (clientId == 0 && branchId == 0) {
return;
}
var policies = <?= json_encode($policy_list) ?>;
console.log('policies', policies);
policies.forEach(policy => {
if (policy.client_id == clientId && policy.client_branch_id == branchId) {
var option = document.createElement('option');
option.value = policy.id;
option.textContent = policy.policy_type + ' - ' + policy.policy_no;
policyDropdown.appendChild(option);
}
});
}
function filterTable(columnIndex, filterValue)
{
var table = $('#tickets-table').DataTable();
@ -408,6 +448,7 @@
$('#clients').select2();
$('#policy_id').select2();
$('#branch_id').select2();
$('#client_policy_id').select2();
var table = $('#tickets-table').DataTable({
dom: 'fBrtip',
buttons: [
@ -704,20 +745,38 @@
var client_id = $('#clients').val()
var client_branch_id = $('#branch_id').val()
var client_policy_id = $('#client_policy_id').val()
console.log('input', input);
console.log('client_id', client_id);
console.log('client_branch_id', client_branch_id);
console.log('client_policy_id', client_policy_id);
if(client_id == 0 && client_branch_id == 0)
{
if (client_id == 0) {
Swal.fire({
title: "warning!",
text: 'Please select the Client and Client Branch.',
title: "Warning!",
text: 'Please select the Client.',
icon: "warning"
});
return false;
}
return false
if (client_branch_id == 0) {
Swal.fire({
title: "Warning!",
text: 'Please select the Client Branch.',
icon: "warning"
});
return false;
}
if (client_policy_id == 0) {
Swal.fire({
title: "Warning!",
text: 'Please select the Client Policy.',
icon: "warning"
});
return false;
}
Swal.fire({
@ -731,7 +790,7 @@
if (result.isConfirmed) {
$.ajax({
url: '<?= base_url("util/send_manual_reminder/") ?>' + client_id + '/' + client_branch_id,
url: '<?= base_url("util/send_manual_reminder/") ?>' + client_id + '/' + client_branch_id + '/' + client_policy_id,
type: "GET",
dataType: 'json',
success: function(res) {

View File

@ -332,7 +332,7 @@ table.dataTable tbody td {
<td><input type="number" class="form-control" name="received_amount[]" placeholder="Enter Amount" required onchange="checkInvAmont(event)"></td>
<td><input type="number" class="form-control" name="tds[]" placeholder="Enter TDS" onchange="checkInvAmont(event)" required></td>
<td><input type="text" class="form-control" name="utr_no[]" placeholder="Enter UTR No" required></td>
<td><input type="text" class="form-control payment_date" name="payment_date[]" value="<?php echo date('d-m-Y'); ?>" placeholder="dd-mm-yyyy" required readonly></td>
<td><input type="text" class="form-control payment_date" name="payment_date[]" value="<?php echo date('d/m/Y'); ?>" placeholder="dd/mm/yyyy" required readonly></td>
<td><i class="fa fa-trash mr-2 font-18 vertical-middle text-danger remove-row" style="text-align: center;"></i></td>
</tr>
</tbody>
@ -515,13 +515,13 @@ table.dataTable tbody td {
<td><input type="number" class="form-control" name="received_amount[]" placeholder="Enter Amount" onchange="checkInvAmont(event)" required></td>
<td><input type="number" class="form-control" name="tds[]" placeholder="Enter TDS" onchange="checkInvAmont(event)" required></td>
<td><input type="text" class="form-control" name="utr_no[]" placeholder="Enter UTR No" required></td>
<td><input type="text" class="form-control payment_date" value="<?php echo date('d-m-Y'); ?>" name="payment_date[]" placeholder="Enter UTR No" required readonly></td>
<td><input type="text" class="form-control payment_date" value="<?php echo date('d/m/Y'); ?>" name="payment_date[]" placeholder="dd/mm/yyyy" required readonly></td>
<td><i class="fa fa-trash mr-2 font-18 vertical-middle text-danger remove-row" style="text-align: center;"></i></td>
`;
tableBody.appendChild(newRow);
$('.payment_date').datepicker({
format: 'dd-mm-yyyy',
format: 'dd/mm/yyyy',
autoclose: true
});
});
@ -579,15 +579,16 @@ function formatDate(date) {
var day = ("0" + date.getDate()).slice(-2);
var month = ("0" + (date.getMonth() + 1)).slice(-2);
var year = date.getFullYear();
return day + "-" + month + "-" + year;
return day + "/" + month + "/" + year;
}
function formatDateToDMY(dateStr) {
// Split the date string by the hyphen
var parts = dateStr.split('-');
return parts[2] + '-' + parts[1] + '-' + parts[0]; // Rearrange to DD-MM-YYYY
return parts[2] + '/' + parts[1] + '/' + parts[0]; // Rearrange to DD-MM-YYYY
}
function showInvoiceStatusModal(event)
{
console.log('############ showInvoiceStatusModal function called ##################');
var modal_received_amt_div = document.getElementById('modal_received_amt_div');
modal_received_amt_div.style.display = 'none';
// alert();
@ -635,7 +636,7 @@ function showInvoiceStatusModal(event)
// Clear existing rows in the payment table
var paymentTableBody = document.querySelector('#payment_table_modal tbody');
console.log('response.data.payments.length', response.data.payments.length)
// Populate payment table rows
if(response.data.payments.length)
{
@ -652,7 +653,7 @@ function showInvoiceStatusModal(event)
`;
});
}
$('.payment_date').datepicker({ format: 'dd-mm-yyyy',autoclose: true});
$('.payment_date').datepicker({ format: 'dd/mm/yyyy',autoclose: true});
// Show the modal
var myModal = new bootstrap.Modal(document.getElementById('invoice_modal'));
myModal.show();
@ -690,7 +691,7 @@ $(document).ready(function(){
$('.payment_date').datepicker({
format: 'dd-mm-yyyy',
format: 'dd/mm/yyyy',
autoclose: true
});
@ -705,7 +706,7 @@ minDate.setDate(today.getDate() - 180);
var maxDate = new Date();
maxDate.setDate(today.getDate() + 180);
$('#invoice_date_modal').datepicker({
format: 'dd-mm-yyyy',
format: 'dd/mm/yyyy',
autoclose: true,
startDate: minDate,
endDate: maxDate

View File

@ -39,6 +39,7 @@
.form-group-client-policy-masters {
display: -webkit-box;
max-width: 100% !important;
margin-left: -23px;
}
.flex-container {
@ -85,9 +86,9 @@
}
.s {
/* margin-left: 30px;
width: 689px; */
margin-left: 141px;
margin-left: 50px;
/* width: 689px; */
/* margin-left: 141px; */
width: 576px;
}
</style>
@ -107,7 +108,7 @@
<div class="form-group">
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="sumInsured">Sum Insured</label>
</div>
<div class="col-md-4">
@ -116,9 +117,9 @@
<div class="col-md-2" style="position: relative;left: 88px;">
<button type="button" class="btn btn-primary si-add-more" onclick="appendGMCSIAddMore()">+</button>
</div>
<div class="col-md-6">
<div class="col-md-4">
</div>
<div class="col-md-6">
<div class="col-md-4">
<div id='numberToWordGMC' class="text-danger-2" ></div>
</div>
</div>
@ -126,16 +127,16 @@
<div id="gmc_si_add_more"></div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Family Floater</label>
</div>
<div class="col-md-6">
<input type="radio" name="family_floater" class="family_floater" value="1"> Yes
<input type="radio" name="family_floater" class="family_floater" value="0" style="margin-left:10px"> No
</div>
<div class="col-md-6">
<div class="col-md-4">
</div>
<div class="col-md-6" style="margin-bottom:10px">
<div class="col-md-8" style="margin-bottom:10px">
<table>
<tbody>
<tr>
@ -143,12 +144,16 @@
<td style="width: 11%;"><input type="checkbox" style="margin-right: 70px;" name="family_floaters[]" value="self" id="self" checked> </td>
<td style="width: 28%;" ><div class="self-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo (isset($self_min_age) && $self_min_age > 0) ? $self_min_age : '18'; ?>" style="width: 35%;;" type="number" name="self_min_age" id="self_min_age" onchange="lowerIsEighteen(this)"></div></td>
<td style="width: 28%;" ><div class="self-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>" style="width: 35%;;" type="number" name="self_max_age" id="self_max_age" onchange="lowerIsEighteen(this)"></div></td>
<td style="width: 11%;"><span class="self-age" style="margin-right: 20px;font-size: 12px;">Is Payable by employee:</span></td>
<td style="width: 11%;"><input class="self-age" type="checkbox" style="margin-right: 70px;" name="is_payable_employee_for_self" id="is_payable_employee_for_self"> </td>
</tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
<tr>
<td style="width: 11%;"><span style="margin-right: 20px;">Spouse:</span></td>
<td style="width: 11%;"><input type="checkbox" style="margin-right: 70px;"name="family_floaters[]" value="spouse" id="spouse"></td>
<td style="width: 28%;" ><div class="spouse-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($spouse_min_age) ? $spouse_min_age : '18'; ?>" style="width: 35%;;" type="number" name="spouse_min_age" id="spouse_min_age" onchange="lowerIsEighteen(this)"></div></td>
<td style="width: 28%;" ><div class="spouse-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($spouse_max_age) ? $spouse_max_age : '60'; ?>" style="width: 35%;;" type="number" name="spouse_max_age" id="spouse_max_age" onchange="lowerIsEighteen(this)"></div></td>
<td style="width: 11%;"><span class="spouse-age" style="margin-right: 20px;font-size: 12px;">Is Payable by employee:</span></td>
<td style="width: 11%;"><input class="spouse-age" type="checkbox" style="margin-right: 70px;" name="is_payable_employee_for_spouse" id="is_payable_employee_for_spouse"> </td>
</tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
<tr>
<td style="width: 11%;"><span for="children">Children:</span></td>
@ -162,6 +167,8 @@
</td>
<td style="width: 28%;" ><div class="child-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($child_min_age) ? $child_min_age : '0'; ?>" style="width: 35%;;" type="number" name="child_min_age" id="child_min_age" oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)"></div></td>
<td style="width: 28%;" ><div class="child-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($child_max_age) ? $child_max_age : '25'; ?>" style="width: 35%;;" type="number" name="child_max_age" id="child_max_age" oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)"></div></td>
<td style="width: 11%;"><span class="child-age" style="margin-right: 20px;font-size: 12px;">Is Payable by employee:</span></td>
<td style="width: 11%;"><input class="child-age" type="checkbox" style="margin-right: 70px;" name="is_payable_employee_for_child" id="is_payable_employee_for_child"> </td>
</tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
</tbody>
</table>
@ -192,6 +199,8 @@
<td style="width: 22%;" ><div class="other-member-age"><span style="margin-right: 20px;">Elders Count:</span><input class="underline-input" id="member_count" style="width: 30%; width: 30%;background: lightgray;" type="number" name="elder_member_count" id="member_count" readonly></div></td>
<td style="width: 28%;" ><div class="other-member-age" style="margin-left: 32px;"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($other_member_min_age) ? $other_member_min_age : '18'; ?>" style="width: 35%;;" type="number" class="underline-input min_age" name="other_member_min_age" id="other_member_min_age" onchange="lowerIsEighteen(this)"></div></td>
<td style="width: 28%;" ><div class="other-member-age" style="margin-left: 17px;"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($other_member_max_age) ? $other_member_max_age : '60'; ?>" style="width: 35%;;" type="number" class="underline-input max_age" name="other_member_max_age" id="other_member_max_age" onchange="lowerIsEighteen(this)"></div></td>
<td style="width: 11%;"><span class="other-member-age" style="margin-right: 20px;font-size: 12px;">Is Payable by employee:</span></td>
<td style="width: 11%;"><input class="other-member-age" type="checkbox" style="margin-right: 70px;" name="is_payable_employee_for_elders" id="is_payable_employee_for_elders"> </td>
</tr>
</tbody>
</table>
@ -202,7 +211,7 @@
<hr>
<!-- <div class="row" style="margin-bottom: 10px;display:none;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Corporate Buffer</label>
</div>
<div class="col-md-6">
@ -213,7 +222,10 @@
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="waiverofpreexistingdiseases_display" id="waiverofpreexistingdiseases_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Waiver of Pre-existing Diseases</label>
</div>
<div class="col-md-6">
@ -223,16 +235,22 @@
</div>
<div class="row" style="margin-bottom: 10px;display:none;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="maternitycoverage_display" id="maternitycoverage_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Maternity Coverage</label>
</div>
<div class="col-md-6">
<div class="col-md-4">
<input type="text" name="maternitycoverage" id="maternitycoverage" class="form-control">
</div>
</div>
<div class="row" style="margin-bottom: 10px;display:none;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="twindelivery_display" id="twindelivery_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Twin Delivery</label>
</div>
<div class="col-md-6">
@ -241,7 +259,10 @@
</div>
<div class="row" style="margin-bottom: 10px;display:none;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="preandpostnatal_display" id="preandpostnatal_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Pre and Post natal</label>
</div>
<div class="col-md-6">
@ -250,7 +271,10 @@
</div>
<div class="row" style="margin-bottom: 10px;display:none;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="babyday1cover_display" id="babyday1cover_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Baby Day 1 Cover</label>
</div>
<div class="col-md-6">
@ -258,9 +282,11 @@
</div>
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="9monthwaitingperiodwaived_display" id="9monthwaitingperiodwaived_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">9-month waiting Period waived</label>
</div>
<div class="col-md-6">
@ -270,7 +296,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="coverfromthedateofjoining_display" id="coverfromthedateofjoining_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Cover from the date of Joining</label>
</div>
<div class="col-md-6">
@ -279,7 +308,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="waiverof1234thyearexclusions_display" id="waiverof1234thyearexclusions_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Waiver of 1, 2, 3 & 4th year Exclusions</label>
</div>
<div class="col-md-6">
@ -290,7 +322,10 @@
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="waiverof30dayswaitingperiod_display" id="waiverof30dayswaitingperiod_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Waiver of 30 days waiting period</label>
</div>
<div class="col-md-6">
@ -300,7 +335,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="prehospitalizationcover_display" id="prehospitalizationcover_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Pre Hospitalization Cover</label>
</div>
<div class="col-md-6">
@ -309,7 +347,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="posthospitalizationcover_display" id="posthospitalizationcover_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Post Hospitalization Cover</label>
</div>
<div class="col-md-6">
@ -318,7 +359,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="congenitaldiseasesinternal_display" id="congenitaldiseasesinternal_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Congenital Diseases - Internal</label>
</div>
<div class="col-md-6">
@ -328,7 +372,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="congenitaldiseasesexternal_display" id="congenitaldiseasesexternal_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Congenital Diseases - External</label>
</div>
<div class="col-md-6">
@ -337,7 +384,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="copayzonewisecopay_display" id="copayzonewisecopay_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Co-Pay/Zone wise Co Pay</label>
</div>
<div class="col-md-6">
@ -346,8 +396,11 @@
</div>
</div>
<div class="row" style="margin-bottom: 10px;display:none;">
<div class="col-md-6">
<div class="row" style="margin-bottom: 10px;display:none;">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="co_pay_details_display" id="co_pay_details_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Co-pay Details</label>
</div>
<div class="col-md-6">
@ -356,7 +409,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="bioabsorbablestenttoriclensmultifocallens_display" id="bioabsorbablestenttoriclensmultifocallens_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Bio absorbable stent / Toric lens/ Multi Focal lens</label>
</div>
<div class="col-md-6">
@ -365,7 +421,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="roomrentlimit_display" id="roomrentlimit_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Room Rent Limit</label>
</div>
<div class="col-md-6">
@ -374,7 +433,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="proportionatedeductionclause_display" id="proportionatedeductionclause_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Proportionate Deduction Clause</label>
</div>
<div class="col-md-6">
@ -387,7 +449,7 @@
</div>
<!-- <div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Nursing Allowance</label>
</div>
<div class="col-md-6">
@ -396,7 +458,10 @@
</div> -->
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="ailmentcapping_display" id="ailmentcapping_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Ailment capping</label>
</div>
<div class="col-md-6">
@ -405,8 +470,11 @@
</div>
</div>
<div class="row" style="margin-bottom: 10px;display:none;">
<div class="col-md-6">
<div class="row" style="margin-bottom: 10px;display:none;">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="ailment_capping_details_display" id="ailment_capping_details_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Ailment capping Details</label>
</div>
<div class="col-md-6">
@ -415,7 +483,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="corporatebuffer_display" id="corporatebuffer_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Corporate Buffer</label>
</div>
<div class="col-md-6">
@ -424,7 +495,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="sublimitofcorporatebuffer_display" id="sublimitofcorporatebuffer_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Sublimit of Corporate Buffer</label>
</div>
<div class="col-md-6">
@ -433,7 +507,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="ambulancecharges_display" id="ambulancecharges_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Ambulance Charges</label>
</div>
<div class="col-md-6">
@ -442,7 +519,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="airambulance_display" id="airambulance_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Air Ambulance</label>
</div>
<div class="col-md-6">
@ -451,7 +531,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="familytransportationbenefit_display" id="familytransportationbenefit_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Family Transportation Benefit</label>
</div>
<div class="col-md-6">
@ -460,7 +543,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="reasonableandcustomarycharges_display" id="reasonableandcustomarycharges_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Reasonable and Customary Charges</label>
</div>
<div class="col-md-6">
@ -470,7 +556,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="daycaretreatment_display" id="daycaretreatment_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Day Care Treatment</label>
</div>
<div class="col-md-6">
@ -480,7 +569,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="ayudhtreatmentcover_display" id="ayudhtreatmentcover_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">AYUSH treatment cover</label>
</div>
<div class="col-md-6">
@ -489,8 +581,11 @@
</div>
</div>
<div class="row" style="margin-bottom: 10px;display:none;">
<div class="col-md-6">
<div class="row" style="margin-bottom: 10px;display:none;">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="ayushTreatmentCoverData_display" id="ayushTreatmentCoverData_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">AYUSH treatment cover Limit</label>
</div>
<div class="col-md-6">
@ -499,7 +594,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="armdcovered_display" id="armdcovered_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">ARMD Covered</label>
</div>
<div class="col-md-6">
@ -508,7 +606,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="suminsuredenhancement_display" id="suminsuredenhancement_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Sum Insured enhancement</label>
</div>
<div class="col-md-6">
@ -518,7 +619,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="automaticsuminsuredreinstatement_display" id="automaticsuminsuredreinstatement_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Automatic Sum Insured reinstatement</label>
</div>
<div class="col-md-6">
@ -527,7 +631,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="additionalsicknessbenefit_display" id="additionalsicknessbenefit_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Additional Sickness Benefit</label>
</div>
<div class="col-md-6">
@ -536,7 +643,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="lasiksurgery_display" id="lasiksurgery_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Lasik Surgery</label>
</div>
<div class="col-md-6">
@ -545,7 +655,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="midterminclusion_display" id="midterminclusion_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Mid Term inclusion</label>
</div>
<div class="col-md-6">
@ -554,7 +667,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="capd_display" id="capd_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">CAPD</label>
</div>
<div class="col-md-6">
@ -563,7 +679,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="organdonorexpenses_display" id="organdonorexpenses_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Organ donor expenses</label>
</div>
<div class="col-md-6">
@ -572,7 +691,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="moderntreatmentsasperirdai_display" id="moderntreatmentsasperirdai_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Modern treatments as per IRDAI</label>
</div>
<div class="col-md-6">
@ -581,7 +703,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="Wellness_display" id="Wellness_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Wellness</label>
</div>
<div class="col-md-6">
@ -590,7 +715,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="days_of_discharge_display" id="days_of_discharge_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Claim Intimation Clause</label>
</div>
<div class="col-md-6">
@ -600,7 +728,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="days_from_dod_display" id="days_from_dod_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Claim Submission</label>
</div>
<div class="col-md-6">
@ -610,7 +741,10 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="cataract_display" id="cataract_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Cataract</label>
</div>
<div class="col-md-6">
@ -619,8 +753,11 @@
</div>
</div>
<div class="row" style="margin-bottom: 10px;display:none;">
<div class="col-md-6">
<div class="row" style="margin-bottom: 10px;display:none;">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="cataractData_display" id="cataractData_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Cataract Limit</label>
</div>
<div class="col-md-6">
@ -1129,8 +1266,43 @@
$('#other_member_max_age').val(jsonObject[key].elders.max);
}
if (key.includes("is_payable_employee")) {
if (jsonObject[key]) {
if (jsonObject[key].self == 0) {
$('#is_payable_employee_for_self').prop('checked', false);
}else {
$('#is_payable_employee_for_self').prop('checked', true);
}
if (jsonObject[key].spouse == 0) {
$('#is_payable_employee_for_spouse').prop('checked', false);
} else {
$('#is_payable_employee_for_spouse').prop('checked', true);
}
if (jsonObject[key].childern == 0) {
$('#is_payable_employee_for_child').prop('checked', false);
} else {
$('#is_payable_employee_for_child').prop('checked', true);
}
if (jsonObject[key].elders == 0) {
$('#is_payable_employee_for_elders').prop('checked', false);
} else {
$('#is_payable_employee_for_elders').prop('checked', true);
}
}
}
});
}
$("#sum_insured").trigger("keyup");
$(".multiple_sum_insured").trigger("keyup");
@ -1308,6 +1480,9 @@
var index = $('.modifyclassinput').length;
var appendElement = `<div class="form-group col-md-6 form-group-client-policy-masters removeDom">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" name="special_condition_display_input[]" id="special_condition_display_input" checked>
</div>
<label for="specialconditionlabel" class="special_condition_label[]" style="width: 450px;position: relative;bottom: 6px;">
<input class="form-control" name="special_condition_label[]" id="special_condition_label[]" style="position: relative;right: 5px;">
<span class="specialConditionClose" style="color: red; float: right;position: relative;bottom: 28px;left: 15px;">X</span>
@ -1446,7 +1621,7 @@
var html = `
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="sumInsured">Additional Sum Insured</label>
</div>
<div class="col-md-4">
@ -1456,9 +1631,9 @@
<button type="button" class="btn btn-danger si-remove-multi" onclick="removeGMCAdditionalSI(this)">x</button>
<button type="button" class="btn btn-primary si-add-more" onclick="appendGMCSIAddMore()">+</button>
</div>
<div class="col-md-6">
<div class="col-md-4">
</div>
<div class="col-md-6">
<div class="col-md-4">
<div class="text-danger-2 numberToWordSumInsured"></div>
</div>
</div>`;

View File

@ -101,7 +101,7 @@
<div class="form-group">
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-6">
<div class="form-group col-md-4">
<label for="emp_code">Policy Premium Type<span
class="text-danger">*</span></label>
<select class="form-control" id="grid" name="policy_grid_id"
@ -109,15 +109,16 @@
</select>
</div>
<div class="form-group col-md-4"
<div class="form-group col-md-6"
style="position: relative; left: 45px; display:none" id="premium_type">
<label for="css"> Premium Calculation </label>
<div style="display: flex; align-items: center;">
<input type="radio" id="individual" name="premium_type" value="2">
<label for="individual" style="position: relative;top: 5px;left: 5px;">
Individual </label>&nbsp;
<label for="individual" style="position: relative;top: 5px;left: 5px;">Individual </label>&nbsp;
<input type="radio" id="single" name="premium_type" value="1">
<label for="single" style="position: relative;top: 5px;left: 5px;"> Family Floater </label>
<input type="radio" id="single_and_individual" name="premium_type" value="3">
<label for="single" style="position: relative;top: 5px;left: 5px;"> Family Floater cum Individual </label>
</div>
</div>
</div>
@ -1899,24 +1900,25 @@ function removebutton(index, type)
function checkDuplicate(unique_id = null)
{
console.log('checkDuplicate unique_id', unique_id)
console.log('checkDuplicate function called')
// console.log('checkDuplicate unique_id', unique_id)
var id = $('#grid')[0];
var container = $('#grid_content_input');
console.log('checkDuplicate id 1', id);
console.log('checkDuplicate container 1', container);
// console.log('checkDuplicate id 1', id);
// console.log('checkDuplicate container 1', container);
if (unique_id) {
id = $('#grid_'+unique_id)[0];
container = $('#grid_content_input_for_additional_'+unique_id);
console.log('checkDuplicate id 2', id);
console.log('checkDuplicate container 2', container);
// console.log('checkDuplicate id 2', id);
// console.log('checkDuplicate container 2', container);
}
console.log('checkDuplicate id 3', id);
console.log('checkDuplicate container 3', container);
// console.log('checkDuplicate id 3', id);
// console.log('checkDuplicate container 3', container);
// var highlightDuplicates = function(duplicateIndices) {
// duplicateIndices.forEach(index => {
@ -2328,7 +2330,7 @@ function checkDuplicate(unique_id = null)
} else if (id.value === '12'){
var siInputs = container.find('input[name="12_si[]"]');
var relationship = container.find('input[name="12_relationship[]"]');
var relationship = container.find('select[name="12_relationship[]"]');
var units = container.find('input[name="12_unit[]"]');
var siValues = [];
@ -2350,9 +2352,15 @@ function checkDuplicate(unique_id = null)
unitValues.push(value);
});
// console.log('siInputs array', siInputs)
// console.log('relationship array', relationship)
// console.log('units array', units)
for (var i = 0; i < siValues.length; i++) {
for (var j = i + 1; j < siValues.length; j++) {
if (unitValues[i] === unitValues[j] && siValues[i] === siValues[j] && relationshipValue[i] === relationshipValue[j]) {
console.log('depulicate si :', siValues[i])
console.log('depulicate relation :', relationshipValue[i])
duplicatesFound = true;
}
}
@ -2364,10 +2372,11 @@ function checkDuplicate(unique_id = null)
} else {
return false;
}
} else if (id.value === '13'){
var siInputs = container.find('input[name="13_si[]"]');
var relationship = container.find('input[name="13_relationship[]"]');
var relationship = container.find('select[name="13_relationship[]"]');
var units = container.find('input[name="13_unit[]"]');
var ageFrom = container.find('input[name="13_age_from[]"]');
var ageTo = container.find('input[name="13_age_to[]"]');
@ -2404,12 +2413,8 @@ function checkDuplicate(unique_id = null)
for (var i = 0; i < siValues.length; i++) {
for (var j = i + 1; j < siValues.length; j++) {
if (unitValues[i] === unitValues[j] &&
siValues[i] === siValues[j] &&
relationshipValue[i] === relationshipValue[j] &&
fromAgeValue[i] === fromAgeValue[j] &&
toAgeValue[i] === toAgeValue[j]
) {
if (unitValues[i] === unitValues[j] && siValues[i] === siValues[j] && relationshipValue[i] === relationshipValue[j] && fromAgeValue[i] === fromAgeValue[j] && toAgeValue[i] === toAgeValue[j])
{
duplicatesFound = true;
}
}
@ -3332,7 +3337,7 @@ function appendNewTab(tabNameData = null, data = null)
<div class="form-group">
<div class="form-row" id="rac_rate_dropdown_${tabId}">
<div class="form-group col-md-6">
<div class="form-group col-md-4">
<label for="emp_code">Policy Premium Type<span
class="text-danger">*</span></label>
<select class="form-control" id="grid_${tabId}" name="policy_grid_id"
@ -3340,7 +3345,7 @@ function appendNewTab(tabNameData = null, data = null)
</select>
</div>
<div class="form-group col-md-4"
<div class="form-group col-md-6"
style="position: relative; left: 45px; display:none" id="premium_type_${tabId}">
<label for="css"> Premium Calculation </label>
<div style="display: flex; align-items: center;">
@ -3349,6 +3354,8 @@ function appendNewTab(tabNameData = null, data = null)
Individual </label>&nbsp;
<input type="radio" id="single_${tabId}" name="premium_type" value="1">
<label for="single" style="position: relative;top: 5px;left: 5px;"> Family Floater </label>
<input type="radio" id="single_and_individual_${tabId}" name="premium_type" value="3">
<label for="single" style="position: relative;top: 5px;left: 5px;"> Family Floater cum Individual </label>
</div>
</div>
</div>
@ -3727,18 +3734,27 @@ function editPolicyPremiumCalculationSetValue(premium_type, unique_id = null)
// 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);
$('#individual_'+unique_id).prop('checked', true);
$('#single_and_individual_'+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);
$('#single_and_individual_'+unique_id).prop('checked', false);
}else if (premium_type === '3') {
// console.log('editPolicyPremiumCalculationSetValue step 3');
$('#single_'+unique_id).prop('checked', false);
$('#individual_'+unique_id).prop('checked', false);
$('#single_and_individual_'+unique_id).prop('checked', true);
} else {
// console.log('editPolicyPremiumCalculationSetValue step 4');
$('#single_'+unique_id).prop('checked', false);
$('#individual_'+unique_id).prop('checked', true);
$('#single_and_individual_'+unique_id).prop('checked', false);
}
}else{
@ -3746,18 +3762,27 @@ function editPolicyPremiumCalculationSetValue(premium_type, unique_id = null)
// console.log('editPolicyPremiumCalculationSetValue step 5');
if (premium_type === '2') {
// console.log('editPolicyPremiumCalculationSetValue step 6');
$('#individual').prop('checked', true);
$('#single').prop('checked', false);
$('#individual').prop('checked', true);
$('#single_and_individual').prop('checked', false);
} else if (premium_type === '1') {
// console.log('editPolicyPremiumCalculationSetValue step 7');
$('#single').prop('checked', true);
$('#individual').prop('checked', false);
$('#single_and_individual').prop('checked', false);
}else if (premium_type === '3') {
// console.log('editPolicyPremiumCalculationSetValue step 7');
$('#single').prop('checked', false);
$('#individual').prop('checked', false);
$('#single_and_individual').prop('checked', true);
} else {
// console.log('editPolicyPremiumCalculationSetValue step 8');
$('#single').prop('checked', false);
$('#individual').prop('checked', true);
$('#single_and_individual').prop('checked', false);
}

View File

@ -41,6 +41,10 @@ table.dataTable tbody td {
padding: 10px;
margin-bottom: 10px;
}
.addbtnStyle{
margin-left: 20px !important;
}
</style>
<style>
@ -240,7 +244,7 @@ table.dataTable tbody td {
</div>
<div class="col-3" id="status_change" style="text-align: right; position: relative;top: 56px; left: 291px;">
<button type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" onclick="hide_list_show_add();">Add</button>
<!-- <button type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" onclick="hide_list_show_add();">Add</button> -->
</div>
</div>
<div>
@ -420,17 +424,27 @@ $(document).ready(function() {
if (ticketsTable.length) {
ticketsTable.DataTable({
scrollX: true,
dom: "<'row'<'col-sm-6'f><'col-sm-5 text-right'B>>" + // Filter left, buttons right
dom: "<'row'<'col-sm-7'f><'col-sm-5 text-right'B>>" + // Filter left, buttons right
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
buttons: [{
extend: 'csv',
text: 'CSV',
title: 'Policy-Tranction-Inception-List',
exportOptions: {
columns: ':not(:last-child)'
},
}, ],
buttons: [
{
extend: 'csv',
text: 'CSV',
title: 'Policy-Tranction-Inception-List',
exportOptions: {
columns: ':not(:last-child)'
},
},
{
text: 'Add',
className: 'buttons-html5 addbtnStyle',
action: function (e, dt, node, config) {
hide_list_show_add();
}
}
],
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB