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

This commit is contained in:
Gowtham M 2024-12-11 16:19:43 +05:30
commit ac1fe778ae
26 changed files with 1453 additions and 396 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) {

View File

@ -315,6 +315,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 +2081,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'])) {
@ -2309,6 +2316,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 +2451,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 +2901,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 +3618,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 +3642,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 +3790,15 @@ class ClientController extends AdminController
dd($days);
}
public function sendextraparam(){
public function sendextraparam()
{
// dd($this->request);
// $employeeRestController = new EmployeeServiceController();
// $employeeRestController->employeesEnrollmentInsert(['file_id' => 721]);
// $r = Jobs::addJob(['job_name' => 'employeesEnrollmentInsert','payload' => ['file_id' => 721]]);
$employeeRestController = new EmployeeServiceController();
$employeeRestController->employeesEnrollmentInsert(['file_id' => 683]);
// $dashBoardController = new DashboardController();
// $client_policy_data = $this->clientPolicyModel->getPolicyDetailsForRemainder($client_id=159, $client_branch_id=126);
@ -3719,6 +3808,28 @@ class ClientController extends AdminController
// $emp_data = $this->employeePolicyModel->getEmployeePolicyForEcard(12);
// $ids = array_column($emp_data, 'id');
// $EmpDataServiceController->sendMailForDownloadingECard($ids);
// $empServiceController = new EmployeeServiceController();
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => '741']);
}
// -------------------------------------------------------------------------------------------------------
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);
}
}
}

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'],
@ -417,54 +457,81 @@ class DashboardController extends AdminController
// Send the mail notification
$mail_result = sendMailNotification::sendMailNotification('member_reminder_mail', $params);
// dd($mail_result);
// $this->myLogger->logme('error', 'Mail sent result: ' . json_encode($mail_result));
$reminder_whole_mail[] = $mail_result;
$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
@ -472,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'],
@ -483,27 +550,33 @@ class DashboardController extends AdminController
// Send the mail notification
$mail_result = sendMailNotification::sendMailNotification('member_reminder_mail', $params);
// $this->myLogger->logme('error', 'Mail sent result: ' . json_encode($mail_result));
$reminder_whole_mail[] = $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']);
}
}
// dd($reminder_whole_mail);
// print_rr($reminder_whole_mail); die;
// Process and queue bulk emails
if (!empty($reminder_whole_mail) && count($reminder_whole_mail) > 0) {
$reminder_whole_mail = array_chunk($reminder_whole_mail, 20);
foreach ($reminder_whole_mail as $key => $value) {
$job_details = new Jobs();
// $job_details = new Jobs();
$r = Jobs::addJob(['job_name' => 'bulk_mail', 'payload' => $value]);
}
}
@ -515,17 +588,21 @@ 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));
if ($client_policy_data) {
$result = $this->sendRemainderMail($client_policy_data);
log_message('error',json_encode($result));
$this->myLogger->logme('error',$result);
$this->myLogger->logme('error', "Manual Remainder Mail sending result: " . ($result ? 'success' : 'failure'));
if ($result) {
@ -552,6 +629,7 @@ class DashboardController extends AdminController
{
return $this->respond(['status' => false, 'code' => 400, 'message' => 'No template found','message2' => 'Failed' ], 200);
}
$emp_data = $this->employeePolicyModel->getEmployeePolicyForEcard($policy_id);
if(count($emp_data) == 0)

View File

@ -108,7 +108,7 @@ class EmployeeController extends AdminController
emp_name : $filterData['emp_name'] ?? null,
status : $filterData['status'] ?? [],
);
log_message('error',json_encode($data['employees']));
// Set getData in $data array with the processed $filterData
$data['getData'] = $filterData;
}
@ -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);

View File

@ -363,7 +363,7 @@ class EmployeeRestController extends AdminController
->where('client_policy_id',$value['policy_details']['client_policy_id'] )
->where('employee_id' , $value['temp']['emp_id'] )
->where('is_active', 1 )
->set(array('premium'=> $value['policy_details']['premium'] , 'rata_premimum'=> $value['policy_details']['rata_premimum'] , 'gst'=> $value['policy_details']['gst'] ))
->set(array('basic_cover_si' => $value['policy_details']['basic_cover_si'],'premium'=> $value['policy_details']['premium'] , 'rata_premimum'=> $value['policy_details']['rata_premimum'] , 'gst'=> $value['policy_details']['gst'] ))
->update();
}
@ -950,11 +950,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
];
@ -2084,11 +2086,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);

View File

@ -1580,9 +1580,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))
@ -1658,7 +1664,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';
}
@ -1668,6 +1675,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';
}
@ -1930,7 +1939,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'];
@ -1980,6 +1989,10 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
$policy_details = $this->clientPolicyModel->where('id', $file['policy_id'])->first();
// dd($policy_details);
//get policy slab rates
// $slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($file['policy_id'],$file['client_id']);
// dd($slab_details);
foreach ($excel_data as $key => $row)
{
@ -2027,7 +2040,7 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
$value['family_floater_key'] = $relation;
$policy_data['basic_cover_si'] = $row[9];
$policy_data['date_coverage'] = $row[13] != "" && $row[13] != null ? change_date_format($row[13],'d-M-Y','Y-m-d') : null;
$policy_data['date_coverage'] = $row[13] != "" && $row[13] != null ? change_date_format($row[13],null,'Y-m-d') : null;
$policy_data['client_policy_id'] = $file['policy_id'];
$employee = $this->employeeModel->checkExistingEmployee($value,$file['client_branch_id']);
@ -2069,6 +2082,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';
@ -2079,6 +2093,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';
}
@ -2087,6 +2103,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'] != '')
{
@ -2095,7 +2115,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'] = [
'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);
}
@ -2103,6 +2130,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

@ -30,6 +30,8 @@ use App\Models\StateModel;
use App\Models\PolicyTypeModel;
use App\Models\CDMasterModel;
use App\Models\ClientDepositModel;
use App\Models\EmployeePolicyModel;
use App\Models\FileModel;
use App\Models\InsurerExcelExportTemplateModel;
use App\Models\SettingsModel;
use App\Models\VehicleModel;
@ -1574,7 +1576,7 @@ class MasterController extends AdminController
$to = $this->request->getPost('to');
$subject = $this->request->getPost('subject');
$mail_content = $this->request->getPost('content');
$common = ['mail_type'=>'test_mail_ui'];
/*****CHOOSE ANY ONE AT A TIME, COMMENT ANOTHER ONE******/
/*****CALLING DIRECLT USING LIB******/
@ -1591,7 +1593,7 @@ class MasterController extends AdminController
/*****CALLING DIRECLT USING LIB******/
/*****CALLING VIA MAIL HELPER******/
$res = MailHelper::send_email(['mail' => $to, 'subject' => $subject, 'message' => $mail_content]);
$res = MailHelper::send_email(['mail' => $to, 'subject' => $subject,'common'=>$common ,'message' => $mail_content]);
return $this->respond(['status' => 'success','code' => 200,'data' => $res],200);
/*****CALLING VIA MAIL HELPER******/
@ -1623,10 +1625,10 @@ class MasterController extends AdminController
["filePath" => ROOTPATH."public/sample_excel/sample_inception.xls","fileName" => "sample_inception.xls"],
["filePath" => ROOTPATH."public/assets/images/login_bg.jpg","fileName" => "login_bg.jpg"]
];
$common = ['mail_type'=>'test_mail_cli'];
$email_id = CLI::getOption('to') ? CLI::getOption('to') : $email_id;
$res = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Mail Via CLI', 'message' => $message,'attachments' => $attachments]);
$res = MailHelper::send_email(['mail' => $email_id, 'subject' => 'Mail Via CLI', 'message' => $message,'attachments' => $attachments,'common'=>$common]);
echo "Inside the master controller";
print_r($res);
}

View File

@ -0,0 +1,125 @@
<?php
namespace App\Helpers;
use App\Models\EmployeePolicyModel;
use App\Models\GmailSentHistoryModel;
use Exception;
class GmailResponseHandler{
private $myLogger;
public function __construct()
{
$this->myLogger = \Config\Services::mylogger();
}
public function receive_and_distribute_param_to_functions($params)
{
try{
$this->store_gmail_response_data($params);
$this->gmail_response_logger($params);
$this->client_id_flag_setter($params);
}
catch(Exception $e)
{
$error = $e->getMessage();
echo "An Error Occured" . $error;
log_message('error',$error);
}
}
public function store_gmail_response_data($params){
// foreach ($params as $key => $value){
// $prepare_data = [
// $key => $value
// ];
// }
// $data = [
// 'email' => isset($params['params']['mail']) ? $params['params']['mail'] : null,
// 'bcc' => isset($params['params']['bcc']) ? json_encode($params['params']['bcc']) : null,
// 'cc' => isset($params['params']['cc']) ? json_encode($params['params']['cc']) : null,
// 'message' => isset($params['params']['message']) ? $params['params']['message'] : null,
// 'attachments' => isset($params['params']['attachments']) ? json_encode($params['params']['attachments']) : null,
// 'client_id' => isset($params['params']['common']['client_id']) ? $params['params']['common']['client_id'] : null,
// 'client_branch_id' => isset($params['params']['common']['client_branch_id']) ? $params['params']['common']['client_branch_id'] : null,
// 'client_policy_id' => isset($params['params']['common']['client_policy_id']) ? $params['params']['common']['client_policy_id'] : null,
// 'employee_policy_id' => isset($params['params']['common']['employee_policy_id']) ? $params['params']['common']['employee_policy_id'] : null,
// 'employee_id' => isset($params['params']['common']['employee_id']) ? $params['params']['common']['employee_id'] : null,
// 'mail_type' => isset($params['params']['common']['mail_type']) ? $params['params']['common']['mail_type'] : null,
// 'gmail_api_status' => isset($params['gmail_api']['status']) ? $params['gmail_api']['status'] : null,
// 'gmail_api_id' => isset($params['gmail_api']['data']['id']) ? $params['gmail_api']['data']['id'] : null
// ];
// Initialize data array
$data = [];
// print_r($params['params']['common']);die();
if (isset($params['params']['common'])) {
foreach ($params['params']['common'] as $key => $value) {
$data[$key] = isset($value) ? $value : null;
}
unset($params['params']['common']);
}
if (isset($params['params'])){
foreach($params['params'] as $key => $value){
$arr = ['bcc','cc','attachments'];
if(in_array($key,$arr)){
$data[$key] = isset($value)?json_encode($value):null;
}else{
$data[$key] = isset($value)?$value:null;
}
}
}
if(isset($params['gmail_api']['status']) && $params['gmail_api']['status'] == 1 ){
$data['gmail_api_status'] = isset($params['gmail_api']['status']) ? $params['gmail_api']['status'] : null;
$data['gmail_api_id'] = isset($params['gmail_api']['data']['id']) ? $params['gmail_api']['data']['id'] : null;
$data['received_message'] = isset($params['gmail_api']['data']['labelIds']) ? json_encode($params['gmail_api']['data']['labelIds']) : null;
}
elseif(isset($params['gmail_api']['status']) && $params['gmail_api']['status'] == false ){
$data['gmail_api_status'] = $params['gmail_api']['status'];
if(isset($params['gmail_api']['data'])){
$data['received_message'] = json_encode($params['gmail_api']['data']);
}
}
$gmailModel = new GmailSentHistoryModel();
$save_status = $gmailModel->insert($data);
}
public function gmail_response_logger($params)
{
$this->myLogger->logme('error',json_encode($params));
}
public function client_id_flag_setter($params)
{
try{
if (isset($params['params']['common']['mail_type'])){
if($params['params']['common']['mail_type'] == 'member_ecard_mail'){
$employeePolicyModel = new EmployeePolicyModel();
$update_status = $employeePolicyModel->where('id',$params['params']['common']['employee_policy_id'])->set('ecard_sent_status',1)->update();
if($update_status){
$this->myLogger->logme('error',"ecard_sent_status updated for ".$params['params']['common']['employee_policy_id']);
}else{
$this->myLogger->logme('error','ecard_sent_status failed to update');
}
}
}
}
catch(Exception $e){
$error = $e->getMessage();
$this->myLogger->logme('error','An Error Occured - '.$error);
}
}
}

View File

@ -11,7 +11,7 @@ use Firebase\JWT\SignatureInvalidException;
// use Psr\Http\Message\RequestInterface;
use CodeIgniter\HTTP\RequestInterface;
use ReflectionClass;
use Exception;
use App\Models\EmployeeModel;
use App\Models\LevelContactModel;

View File

@ -11,7 +11,6 @@ use PHPMailer\PHPMailer\Exception;
use App\Models\JobModel;
class MailHelper
{
public static function send_email_smtp($params)
@ -94,7 +93,7 @@ class MailHelper
$subject = $params['subject'];
$message = $params['message'];
$attachments = isset($params['attachments']) && count($params['attachments']) ? $params['attachments'] : [];
$common = isset($params['common'])?$params['common']:'';
//check BCC mail
if (isset($params['bcc'])) {
$bcc = $params['bcc'];
@ -118,32 +117,42 @@ class MailHelper
if(isset($params['reply_to']) && !empty($params['reply_to'])){
$reply_to = $params['reply_to'];
}
$MailDataHelper = new GmailResponseHandler();
$res['params'] = $params;
try {
$res = $gmailapi->sendMessage($emaill, $subject, $message, 'no-reply@nhanceindia.in', $reply_to, $cc, $bcc,$attachments);
if($res['status'])
$res['gmail_api'] = $gmailapi->sendMessage($emaill, $subject, $message, 'no-reply@nhanceindia.in', $reply_to, $cc, $bcc,$attachments);
if($res['gmail_api']['status'])
{
$response = $res;
$MailDataHelper->receive_and_distribute_param_to_functions($response);
return json_encode(['status' => 'success','code' => 200, 'message'=>('Email Sent Successfully...'.$emaill),'data' => $res,],200);
}
else
{
$myLogger->logme('error', "mail sent failed - $emaill");
$response = $res;
$MailDataHelper->receive_and_distribute_param_to_functions($response);
return json_encode(['status' => 'failed','code' => 404,'message'=>( 'Email Sent Failed...' . $emaill ),'data' => $res ],404);
}
} catch (Exception $e) {
$msg = $e->getMessage();
$msg['error'] = $e->getMessage();
$msg['params'] = $params;
$myLogger->logme('error', "mail sent failed - $msg");
$response = $msg;
$MailDataHelper->receive_and_distribute_param_to_functions($response);
return json_encode(['status' => 'failed','code' => 500,'data' => $msg],500);
}
}
}
public static function bulk_mail(array $mails = [])
{
// print_r();die;
// print_r($mails);die;
$model = new JobModel();
$start = microtime(true);
$runtime= 0;
@ -156,7 +165,9 @@ class MailHelper
return json_encode(['status' => 'success','code' => 200, 'message'=>'Email Sent Successfully...'],200);
} catch (\Throwable $th) {
return json_encode(['status' => 'failed','code' => 500],500);
$error = $th->getMessage();
log_message('error',$error);
return json_encode(['status' => 'failed','code' => 500,'error'=>$error],500);
}
}

View File

@ -1209,7 +1209,7 @@ if (!function_exists('premium_calculation_manager'))
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
foreach ($temp_slab_rates as $skey => $slab_value)
{
if($slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] ) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
if($slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] ) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null || $slab_value['premium_type'] == 3 ) ))
{
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
@ -1232,7 +1232,7 @@ if (!function_exists('premium_calculation_manager'))
foreach ($temp_slab_rates as $skey => $slab_value)
{
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
if($slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] ) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
if($slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] ) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null || $slab_value['premium_type'] == 3) ))
{
// dd($slab_value);
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
@ -1253,7 +1253,7 @@ if (!function_exists('premium_calculation_manager'))
foreach ($temp_slab_rates as $skey => $slab_value)
{
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
if($slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] ) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
if($slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] ) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null || $slab_value['premium_type'] == 3 ) ))
{
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
@ -1273,7 +1273,7 @@ if (!function_exists('premium_calculation_manager'))
foreach ($temp_slab_rates as $skey => $slab_value)
{
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
if($slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] ) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
if($slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] ) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null || $slab_value['premium_type'] == 3) ))
{
// echo $emp_data['name'];
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
@ -1295,7 +1295,7 @@ if (!function_exists('premium_calculation_manager'))
foreach ($temp_slab_rates as $skey => $slab_value)
{
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
if($slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] ) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
if($slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] ) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null || $slab_value['premium_type'] == 3) ))
{
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
@ -1317,7 +1317,7 @@ if (!function_exists('premium_calculation_manager'))
foreach ($temp_slab_rates as $skey => $slab_value)
{
if($slab_value['grade'] == $employee_received_band && $slab_value['unit'] == $emp_data['unit'] && $slab_value['si'] == $employee_received_si && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] ) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
if($slab_value['grade'] == $employee_received_band && $slab_value['unit'] == $emp_data['unit'] && $slab_value['si'] == $employee_received_si && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] ) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null || $slab_value['premium_type'] == 3) ))
{
// $emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
@ -1339,7 +1339,7 @@ if (!function_exists('premium_calculation_manager'))
foreach ($temp_slab_rates as $skey => $slab_value)
{
if($slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] )) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
if($slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] )) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null || $slab_value['premium_type'] == 3) ))
{
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
@ -1366,7 +1366,7 @@ if (!function_exists('premium_calculation_manager'))
if( $slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] &&
($slab_value['age_from'] <= $max_age && $slab_value['age_to'] >= $max_age) &&
(($slab_value['premium_type'] == 1 &&
( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] )) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ) )
( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] )) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null || $slab_value['premium_type'] == 3) ) )
{
$emp_data['policy_details']['basic_cover_si'] = $employee_received_si;
$emp_data['policy_details']['date_coverage'] = isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date'];
@ -1391,7 +1391,7 @@ if (!function_exists('premium_calculation_manager'))
{
if($slab_value['si'] == $employee_received_si && $slab_value['grade'] == $employee_received_band && $slab_value['unit'] == $emp_data['unit'] && (($slab_value['premium_type'] == 1 &&
( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] )) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] )) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null || $slab_value['premium_type'] == 3) ))
{
//calculate premium based on count
// echo $emp_data['name'];
@ -1420,7 +1420,7 @@ if (!function_exists('premium_calculation_manager'))
$emp_data['policy_details']['basic_cover_si'] = null;
foreach ($temp_slab_rates as $skey => $slab_value)
{
if( $slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] && ((($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) && $slab_value['relationship'] == $employee_relationship) || ($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] ) )) )
if( $slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] && ((($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null || $slab_value['premium_type'] == 3) && $slab_value['relationship'] == $employee_relationship) || ($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] ) )) )
{
$emp_data['policy_details']['basic_cover_si'] = $employee_received_si;
@ -1445,7 +1445,7 @@ if (!function_exists('premium_calculation_manager'))
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
foreach ($temp_slab_rates as $skey => $slab_value)
{
if( $slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && ((($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) && $slab_value['relationship'] == $employee_relationship) || ($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] ) )) )
if( $slab_value['si'] == $employee_received_si && $slab_value['unit'] == $emp_data['unit'] && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && ((($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null || $slab_value['premium_type'] == 3) && $slab_value['relationship'] == $employee_relationship) || ($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['acting_self'] ) )) )
{
$emp_data['policy_details']['basic_cover_si'] = $employee_received_si;
@ -1466,6 +1466,13 @@ if (!function_exists('premium_calculation_manager'))
default:
$myLogger->logme('error',($emp_data['emp_code'].'-'.$emp_data['name'].' - grid type not found'));
}
//this if condition for premium calculated & premium type 3 (familiy floater but premium calculated every individual implemented later) then remove si amount only for dependents (not self)
if($is_match_found && strtolower($emp_data['relationship']) != 'self' && $temp_slab_rates[0]['premium_type'] == 3)
{
//set dependent si to 0
$emp_data['policy_details']['basic_cover_si'] = 0;
}
if(!$is_match_found)
{
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;

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) {
@ -269,6 +215,12 @@ 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;
}
// dd($policy_premium_data);
$policy_name = $inner_item['policy_name'];
if ($inner_item['relationship'] == 'Self') {
@ -282,11 +234,11 @@ class sendMailNotification
$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']));
$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>';
@ -352,6 +304,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) {
@ -393,6 +428,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 +498,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 +518,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 +533,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 +603,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 +794,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 +816,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 +834,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 +904,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

@ -24,9 +24,9 @@ if (!function_exists('generate_uuid')) {
}
}
if (!function_exists('change_date_format')) {
if (!function_exists('change_date_format2')) {
function change_date_format($data, $source_format, $output_format)
function change_date_format2($data, $source_format, $output_format)
{
$data = trim($data);
// echo $data, $source_format, $output_format;return true;
@ -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)
@ -501,3 +503,161 @@ if (!function_exists('isJsonString')) {
return (json_last_error() === JSON_ERROR_NONE); // Check if the last JSON error is "no error"
}
}
if (!function_exists('isValidDate')) {
function isValidDate($date, $format) {
$parsed_date = DateTime::createFromFormat($format, $date);
return $parsed_date && $parsed_date->format($format) === $date;
}
}
if (!function_exists('change_date_format')) {
function change_date_format($date_str, $source_format = null, $output_format = 'Y-m-d') {
$date_str = trim($date_str);
// Allowed date formats
$allowed_formats = [
// Day Month Year (clear unambiguous formats)
'd M Y', // 01 Dec 2024
'd-M-Y', // 01-Dec-2024
'd/M/Y', // 01/Dec/2024
'd.M.Y', // 01.Dec.2024
'd,M,Y', // 01,Dec,2024
// Month Day Year (clear unambiguous formats)
'M d Y', // Dec 01 2024
'M-d-Y', // Dec-01-2024
'M/d/Y', // Dec/01/2024
'M.d.Y', // Dec.01.2024
'M,d,Y', // Dec,01,2024
// Year Month Day (clear unambiguous formats)
'Y M d', // 2024 Dec 01
'Y-M-d', // 2024-Dec-01
'Y/M/d', // 2024/Dec/01
'Y.M.d', // 2024.Dec.01
'Y,M,d', // 2024,Dec,01
// Year Numeric Month Numeric Day
'Y-m-d', // 2024-12-01
'Y/m/d', // 2024/12/01
'Y.m.d', // 2024.12.01
'Y,m,d', // 2024,12,01
];
try {
// Case 1: Source and Output formats are provided
if ($source_format !== null && $output_format !== null) {
$date = DateTime::createFromFormat($source_format, $date_str);
if (!$date) {
throw new Exception("Invalid date string for source format: $source_format");
}
return $date->format($output_format);
}
// Case 2: Source format is provided, Output format is null
if ($source_format !== null && $output_format === null) {
$date = DateTime::createFromFormat($source_format, $date_str);
if (!$date) {
throw new Exception("Invalid date string for source format: $source_format");
}
return $date->format('Y-m-d'); // MySQL default format
}
// Case 3: Source format is null, auto-detect format
if ($source_format === null) {
foreach ($allowed_formats as $format) {
if (isValidDate($date_str, $format)) {
$date = DateTime::createFromFormat($format, $date_str);
return $date->format($output_format); // Default is MySQL format
}
}
// If no format matches, throw an exception
$allowed_placeholders = implode(', ', $allowed_formats);
throw new Exception("Invalid date string format. Allowed formats: $allowed_placeholders");
}
} catch (Exception $e) {
return "Error: " . $e->getMessage();
}
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

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

View File

@ -390,21 +390,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')
@ -149,7 +149,7 @@ class EmployeeModel extends Model
{
return $this->db->table('employee_polices')
->select(' policy_type.long_name as Policy_Name , client_policy.policy_terms as Policy_Terms, client_policy.client_id as ClientId, client_policy.policy_id as PolicyId,client_policy.id as ClientPolicyId, client_policy.open_for_enrollment as OpenForEnrollment, client_policy.is_member_modify_allowed, client_policy.disclaimer,client_policy.policy_type_id , employee_polices.tpa_id as tpa_id , employee_polices.rand_string as rand_string') // Select all columns from both tables
->select(' policy_type.long_name as Policy_Name , client_policy.policy_terms as Policy_Terms, client_policy.client_id as ClientId, client_policy.policy_id as PolicyId,client_policy.id as ClientPolicyId, client_policy.open_for_enrollment as OpenForEnrollment,client_policy.disclaimer,client_policy.policy_type_id , employee_polices.tpa_id as tpa_id , employee_polices.rand_string as rand_string') // Select all columns from both tables
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
->where('client_policy.policy_status', 1)

View File

@ -33,6 +33,8 @@ class EmployeePolicyModel extends Model
"rand_string",
"is_active",
"claim_status",
'ecard_sent_status',
'payable_employee',
];
// Callbacks
@ -125,7 +127,6 @@ class EmployeePolicyModel extends Model
->join('client_branch', 'emp.client_branch_id = client_branch.id') //cm - client master
->orderBy('emp.emp_code', 'ASC')
->orderBy('employee_polices.employee_id', 'ASC');
// Conditionally add where clauses
if ($client_id != 0 && !empty($client_id)) {
$result->where('emp.client_id', $client_id);
@ -194,6 +195,7 @@ class EmployeePolicyModel extends Model
$result->where('employee_polices.is_active', 1)
->where('employee_polices.status', 'active')
->where('employee_polices.tpa_id is not null')
->where('employee_polices.ecard_sent_status',0)
->where('emp.relationship','Self');
return $result->findAll();

View File

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class GmailSentHistoryModel extends Model{
protected $table = 'gmail_sent_history';
protected $primaryKey = 'id';
protected $allowedFields = ["id", "mail", "bcc", "cc", "message", "attachments", "client_id", "client_branch_id", "client_policy_id", "employee_policy_id", "employee_id", "mail_type", "gmail_api_status", "gmail_api_id", "created_by", "created_at", "updated_by", "updated_at", "isactive","received_message"];
}

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>
@ -827,11 +827,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 +1199,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

@ -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

@ -107,7 +107,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 +116,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 +126,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 +143,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 +166,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 +198,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 +210,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 +221,7 @@
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Waiver of Pre-existing Diseases</label>
</div>
<div class="col-md-6">
@ -223,16 +231,16 @@
</div>
<div class="row" style="margin-bottom: 10px;display:none;">
<div class="col-md-6">
<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-4">
<label for="totalSumInsured">Twin Delivery</label>
</div>
<div class="col-md-6">
@ -241,7 +249,7 @@
</div>
<div class="row" style="margin-bottom: 10px;display:none;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Pre and Post natal</label>
</div>
<div class="col-md-6">
@ -250,7 +258,7 @@
</div>
<div class="row" style="margin-bottom: 10px;display:none;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Baby Day 1 Cover</label>
</div>
<div class="col-md-6">
@ -260,7 +268,7 @@
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">9-month waiting Period waived</label>
</div>
<div class="col-md-6">
@ -270,7 +278,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Cover from the date of Joining</label>
</div>
<div class="col-md-6">
@ -279,7 +287,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<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 +298,7 @@
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Waiver of 30 days waiting period</label>
</div>
<div class="col-md-6">
@ -300,7 +308,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Pre Hospitalization Cover</label>
</div>
<div class="col-md-6">
@ -309,7 +317,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Post Hospitalization Cover</label>
</div>
<div class="col-md-6">
@ -318,7 +326,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Congenital Diseases - Internal</label>
</div>
<div class="col-md-6">
@ -328,7 +336,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Congenital Diseases - External</label>
</div>
<div class="col-md-6">
@ -337,7 +345,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Co-Pay/Zone wise Co Pay</label>
</div>
<div class="col-md-6">
@ -347,7 +355,7 @@
</div>
<div class="row" style="margin-bottom: 10px;display:none;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Co-pay Details</label>
</div>
<div class="col-md-6">
@ -356,7 +364,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<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 +373,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Room Rent Limit</label>
</div>
<div class="col-md-6">
@ -374,7 +382,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Proportionate Deduction Clause</label>
</div>
<div class="col-md-6">
@ -387,7 +395,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 +404,7 @@
</div> -->
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Ailment capping</label>
</div>
<div class="col-md-6">
@ -406,7 +414,7 @@
</div>
<div class="row" style="margin-bottom: 10px;display:none;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Ailment capping Details</label>
</div>
<div class="col-md-6">
@ -415,7 +423,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Corporate Buffer</label>
</div>
<div class="col-md-6">
@ -424,7 +432,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Sublimit of Corporate Buffer</label>
</div>
<div class="col-md-6">
@ -433,7 +441,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Ambulance Charges</label>
</div>
<div class="col-md-6">
@ -442,7 +450,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Air Ambulance</label>
</div>
<div class="col-md-6">
@ -451,7 +459,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Family Transportation Benefit</label>
</div>
<div class="col-md-6">
@ -460,7 +468,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Reasonable and Customary Charges</label>
</div>
<div class="col-md-6">
@ -470,7 +478,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Day Care Treatment</label>
</div>
<div class="col-md-6">
@ -480,7 +488,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">AYUSH treatment cover</label>
</div>
<div class="col-md-6">
@ -490,7 +498,7 @@
</div>
<div class="row" style="margin-bottom: 10px;display:none;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">AYUSH treatment cover Limit</label>
</div>
<div class="col-md-6">
@ -499,7 +507,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">ARMD Covered</label>
</div>
<div class="col-md-6">
@ -508,7 +516,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Sum Insured enhancement</label>
</div>
<div class="col-md-6">
@ -518,7 +526,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Automatic Sum Insured reinstatement</label>
</div>
<div class="col-md-6">
@ -527,7 +535,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Additional Sickness Benefit</label>
</div>
<div class="col-md-6">
@ -536,7 +544,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Lasik Surgery</label>
</div>
<div class="col-md-6">
@ -545,7 +553,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Mid Term inclusion</label>
</div>
<div class="col-md-6">
@ -554,7 +562,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">CAPD</label>
</div>
<div class="col-md-6">
@ -563,7 +571,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Organ donor expenses</label>
</div>
<div class="col-md-6">
@ -572,7 +580,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Modern treatments as per IRDAI</label>
</div>
<div class="col-md-6">
@ -581,7 +589,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Wellness</label>
</div>
<div class="col-md-6">
@ -590,7 +598,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Claim Intimation Clause</label>
</div>
<div class="col-md-6">
@ -600,7 +608,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Claim Submission</label>
</div>
<div class="col-md-6">
@ -610,7 +618,7 @@
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Cataract</label>
</div>
<div class="col-md-6">
@ -620,7 +628,7 @@
</div>
<div class="row" style="margin-bottom: 10px;display:none;">
<div class="col-md-6">
<div class="col-md-4">
<label for="totalSumInsured">Cataract Limit</label>
</div>
<div class="col-md-6">
@ -1129,6 +1137,40 @@
$('#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");
@ -1446,7 +1488,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 +1498,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);
}

56
phpqueue.sh Executable file
View File

@ -0,0 +1,56 @@
!/bin/bash
while true; do
echo "Running job at $(date)"
/usr/bin/php /opt/lampp/htdocs/nhance/public/index.php cli/processjob
!/bin/bash
!/bin/bash
# Read the Job_Queue variable from the temporary file
#!/bin/bash
#!/bin/bash
#!/bin/bash
# Define the root directory for the project and PID file path
#!/bin/bash
# Define paths
# ROOT_DIR=$(dirname "$(realpath "$0")")
# JOB_QUEUE_FILE="$ROOT_DIR/job_queue"
# PID_FILE="$ROOT_DIR/phpqueue.pid"
# # Check if the script is already running
# if [[ -f "$PID_FILE" ]] && kill -0 "$(cat $PID_FILE)" 2>/dev/null; then
# echo "phpqueue.sh is already running. Exiting."
# exit 1
# fi
# # Write the current process ID (PID) to the PID file
# echo $$ > "$PID_FILE"
# # Ensure the PID file is removed on script exit
# trap "rm -f $PID_FILE" EXIT
# # Main loop
# while true; do
# # Check if the Job_Queue file exists
# if [[ ! -f "$JOB_QUEUE_FILE" ]]; then
# echo "Job Queue file not found."
# exit 1
# fi
# # Read the value of Job_Queue from the file
# Job_Queue=$(cat "$JOB_QUEUE_FILE")
# if [[ "$Job_Queue" -eq 1 ]]; then
# /usr/bin/php /opt/lampp/htdocs/nhance/public/index.php cli/processjob
# else
# echo "No job to process."
# fi
# # Sleep for 1 second before the next iteration
# sleep 1
# done

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB