Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
3aaee53da7
@ -257,6 +257,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->get("getPolicyTerms/(:any)", "ClientController::getPolicyTerms/$1");
|
$routes->get("getPolicyTerms/(:any)", "ClientController::getPolicyTerms/$1");
|
||||||
$routes->get("getPolicyTermsFormJson/(:any)", "ClientController::getPolicyTermsFormJson/$1");
|
$routes->get("getPolicyTermsFormJson/(:any)", "ClientController::getPolicyTermsFormJson/$1");
|
||||||
$routes->get("checkHRNumber/(:any)", "ClientController::checkHRNumber/$1");
|
$routes->get("checkHRNumber/(:any)", "ClientController::checkHRNumber/$1");
|
||||||
|
$routes->get("check_addition_premium_JSON/(:any)", "ClientController::checkAdditionPremiumJSON/$1");
|
||||||
});
|
});
|
||||||
|
|
||||||
$routes->cli('cli/processjob', 'JobWorker::processJob');
|
$routes->cli('cli/processjob', 'JobWorker::processJob');
|
||||||
|
|||||||
@ -669,28 +669,28 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
$policy_terms = $this->clientPolicyModel->where('id', $this->request->getPost('base_policy'))->first();
|
$policy_terms = $this->clientPolicyModel->where('id', $this->request->getPost('base_policy'))->first();
|
||||||
|
|
||||||
if ($this->request->getPost('is_addon') == 2 || $this->request->getPost('is_addon') == 3) {
|
// if ($this->request->getPost('is_addon') == 2 || $this->request->getPost('is_addon') == 3) {
|
||||||
|
|
||||||
if ($this->request->getPost('is_addon') == 3) {
|
// if ($this->request->getPost('is_addon') == 3) {
|
||||||
$policyTerm = $policy_terms['policy_terms'];
|
// $policyTerm = $policy_terms['policy_terms'];
|
||||||
$decoded_policyTerm = json_decode($policyTerm, true);
|
// $decoded_policyTerm = json_decode($policyTerm, true);
|
||||||
$decoded_policyTerm['family_floater'] = 0;
|
// $decoded_policyTerm['family_floater'] = 0;
|
||||||
$decoded_policyTerm['family_floaters']['self'] = 0;
|
// $decoded_policyTerm['family_floaters']['self'] = 0;
|
||||||
$decoded_policyTerm['family_floaters']['spouse'] = 0;
|
// $decoded_policyTerm['family_floaters']['spouse'] = 0;
|
||||||
$decoded_policyTerm['family_floaters']['childrens'] = 0;
|
// $decoded_policyTerm['family_floaters']['childrens'] = 0;
|
||||||
$decoded_policyTerm['family_floaters']['parents'] = 0;
|
// $decoded_policyTerm['family_floaters']['parents'] = 0;
|
||||||
$decoded_policyTerm['family_floaters']['parents-in-law'] = 0;
|
// $decoded_policyTerm['family_floaters']['parents-in-law'] = 0;
|
||||||
$decoded_policyTerm['family_floaters']['either-parents-pil'] = 0;
|
// $decoded_policyTerm['family_floaters']['either-parents-pil'] = 0;
|
||||||
|
|
||||||
$data['policy_terms'] = json_encode($decoded_policyTerm);
|
// $data['policy_terms'] = json_encode($decoded_policyTerm);
|
||||||
} else {
|
// } else {
|
||||||
|
|
||||||
if ($this->request->getPost('policy_type_id') != 3) {
|
// if ($this->request->getPost('policy_type_id') != 3) {
|
||||||
|
|
||||||
$data['policy_terms'] = $policy_terms['policy_terms'];
|
// $data['policy_terms'] = $policy_terms['policy_terms'];
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
$data['policy_no'] = $this->request->getPost('policy_no');
|
$data['policy_no'] = $this->request->getPost('policy_no');
|
||||||
@ -764,25 +764,25 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
$policy_terms = $this->clientPolicyModel->where('id', $this->request->getPost('base_policy'))->first();
|
$policy_terms = $this->clientPolicyModel->where('id', $this->request->getPost('base_policy'))->first();
|
||||||
|
|
||||||
if ( $this->request->getPost('is_addon') == 2 || $this->request->getPost('is_addon') == 3) {
|
// if ( $this->request->getPost('is_addon') == 2 || $this->request->getPost('is_addon') == 3) {
|
||||||
if ($this->request->getPost('is_addon') == 3) {
|
// if ($this->request->getPost('is_addon') == 3) {
|
||||||
$policyTerm = $policy_terms['policy_terms'];
|
// $policyTerm = $policy_terms['policy_terms'];
|
||||||
$decoded_policyTerm = json_decode($policyTerm, true);
|
// $decoded_policyTerm = json_decode($policyTerm, true);
|
||||||
$decoded_policyTerm['family_floater'] =0;
|
// $decoded_policyTerm['family_floater'] =0;
|
||||||
$decoded_policyTerm['family_floaters']['self'] =0;
|
// $decoded_policyTerm['family_floaters']['self'] =0;
|
||||||
$decoded_policyTerm['family_floaters']['spouse'] =0;
|
// $decoded_policyTerm['family_floaters']['spouse'] =0;
|
||||||
$decoded_policyTerm['family_floaters']['childrens'] =0;
|
// $decoded_policyTerm['family_floaters']['childrens'] =0;
|
||||||
$decoded_policyTerm['family_floaters']['parents'] =0;
|
// $decoded_policyTerm['family_floaters']['parents'] =0;
|
||||||
$decoded_policyTerm['family_floaters']['parents-in-law'] =0;
|
// $decoded_policyTerm['family_floaters']['parents-in-law'] =0;
|
||||||
$decoded_policyTerm['family_floaters']['either-parents-pil'] =0;
|
// $decoded_policyTerm['family_floaters']['either-parents-pil'] =0;
|
||||||
|
|
||||||
$data['policy_terms'] = json_encode($decoded_policyTerm);
|
// $data['policy_terms'] = json_encode($decoded_policyTerm);
|
||||||
} else {
|
// } else {
|
||||||
$data['policy_terms'] = $policy_terms['policy_terms'];
|
// $data['policy_terms'] = $policy_terms['policy_terms'];
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
// dd($data);
|
// dd($data);
|
||||||
$data['updated_by'] = get_session_userid();
|
$data['updated_by'] = get_session_userid();
|
||||||
@ -1416,9 +1416,9 @@ class ClientController extends AdminController
|
|||||||
$data['family_floaters']['parents-in-law'] =2;
|
$data['family_floaters']['parents-in-law'] =2;
|
||||||
$data['family_floaters']['either-parents-pil'] =0;
|
$data['family_floaters']['either-parents-pil'] =0;
|
||||||
}else if($temp_family_floaters[$value] == '2EPORPIL'){
|
}else if($temp_family_floaters[$value] == '2EPORPIL'){
|
||||||
$data['family_floaters']['parents'] =1;
|
$data['family_floaters']['parents'] =0;
|
||||||
$data['family_floaters']['parents-in-law'] =1;
|
$data['family_floaters']['parents-in-law'] =0;
|
||||||
$data['family_floaters']['either-parents-pil'] =0;
|
$data['family_floaters']['either-parents-pil'] =2;
|
||||||
}else if($temp_family_floaters[$value] == 'EPORPIL'){
|
}else if($temp_family_floaters[$value] == 'EPORPIL'){
|
||||||
$data['family_floaters']['parents'] =0;
|
$data['family_floaters']['parents'] =0;
|
||||||
$data['family_floaters']['parents-in-law'] =0;
|
$data['family_floaters']['parents-in-law'] =0;
|
||||||
@ -1514,6 +1514,7 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
$record = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
$record = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||||
|
|
||||||
|
|
||||||
// print_r($data);die;
|
// print_r($data);die;
|
||||||
if ($record) {
|
if ($record) {
|
||||||
$update = $this->clientPolicyModel->update($client_policy_id, $dataa);
|
$update = $this->clientPolicyModel->update($client_policy_id, $dataa);
|
||||||
@ -2174,7 +2175,11 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
public function get_cd_ac($client_id, $insurer_id){
|
public function get_cd_ac($client_id, $insurer_id){
|
||||||
|
|
||||||
$cd_data = $this->CDMasterModel->where('client_id', $client_id)->where('insurer_id', $insurer_id)->findAll();
|
$cd_data = $this->CDMasterModel
|
||||||
|
->where('client_id', $client_id)
|
||||||
|
->where('insurer_id', $insurer_id)
|
||||||
|
->where('is_active', 1)
|
||||||
|
->findAll();
|
||||||
|
|
||||||
if($cd_data){
|
if($cd_data){
|
||||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $cd_data], 200);
|
return $this->respond(['status' => true, 'code' => 200, 'data' => $cd_data], 200);
|
||||||
@ -2303,6 +2308,18 @@ class ClientController extends AdminController
|
|||||||
return $this->respond(['status' => false, 'data' => 0, 'message' => 'An error occurred while checking the mobile number. Please try again later.'], 500);
|
return $this->respond(['status' => false, 'data' => 0, 'message' => 'An error occurred while checking the mobile number. Please try again later.'], 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function checkAdditionPremiumJSON($client_id, $client_policy_id){
|
||||||
|
|
||||||
|
$get_additional_rack_rate_relationship_json = $this->policyPremium2Model
|
||||||
|
->where('client_id', $client_id)
|
||||||
|
->where('client_policy_id', $client_policy_id)
|
||||||
|
->where('is_active', 1)
|
||||||
|
->where('additional_relationship IS NOT NULL', null, false)
|
||||||
|
->countAllResults();
|
||||||
|
|
||||||
|
return $this->respond(['status' => true, 'data' => $get_additional_rack_rate_relationship_json, 'message' => "try"], 200);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -94,7 +94,7 @@ class DepositHelper
|
|||||||
// $getLastBalanceQuery = "SELECT balance FROM cash_deposit WHERE client_id = ? AND insurer_id = ? ORDER BY created_at DESC LIMIT 1";
|
// $getLastBalanceQuery = "SELECT balance FROM cash_deposit WHERE client_id = ? AND insurer_id = ? ORDER BY created_at DESC LIMIT 1";
|
||||||
// $getLastBalanceParams = [$clientId, $insurerId];
|
// $getLastBalanceParams = [$clientId, $insurerId];
|
||||||
|
|
||||||
$getLastBalanceQuery = "SELECT balance FROM cash_deposit WHERE cd_ac_no = ? ORDER BY created_at DESC LIMIT 1";
|
$getLastBalanceQuery = "SELECT balance FROM cash_deposit WHERE cd_ac_no = ? AND is_active = 1 ORDER BY created_at DESC LIMIT 1";
|
||||||
$getLastBalanceParams = [$cd_ac_no];
|
$getLastBalanceParams = [$cd_ac_no];
|
||||||
|
|
||||||
$lastBalance = $model->query($getLastBalanceQuery, $getLastBalanceParams)->getRow()->balance ?? null;
|
$lastBalance = $model->query($getLastBalanceQuery, $getLastBalanceParams)->getRow()->balance ?? null;
|
||||||
@ -103,7 +103,7 @@ class DepositHelper
|
|||||||
|
|
||||||
$cd_model = new ClientDepositModel();
|
$cd_model = new ClientDepositModel();
|
||||||
|
|
||||||
$getLastBalanceQuery = "SELECT opening_bal FROM cd_master WHERE client_id = ? AND insurer_id = ? AND cd_ac_no = ? ORDER BY created_at DESC LIMIT 1";
|
$getLastBalanceQuery = "SELECT opening_bal FROM cd_master WHERE client_id = ? AND insurer_id = ? AND cd_ac_no = ? AND is_active = 1 ORDER BY created_at DESC LIMIT 1";
|
||||||
$getLastBalanceParams = [$clientId, $insurerId, $cd_ac_no];
|
$getLastBalanceParams = [$clientId, $insurerId, $cd_ac_no];
|
||||||
|
|
||||||
$lastBalance = $cd_model->query($getLastBalanceQuery, $getLastBalanceParams)->getRow()->opening_bal ?? 0;
|
$lastBalance = $cd_model->query($getLastBalanceQuery, $getLastBalanceParams)->getRow()->opening_bal ?? 0;
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Reader\Exception as SpreadsheetReaderException;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -280,9 +281,9 @@ if (!function_exists('add_totals_row')) {
|
|||||||
$totalSum = 0;
|
$totalSum = 0;
|
||||||
|
|
||||||
foreach ($data as $row) {
|
foreach ($data as $row) {
|
||||||
$gstSum += $row[18];
|
$gstSum += floatval($row[18]);
|
||||||
$proRataPremiumSum += $row[19];
|
$proRataPremiumSum += floatval($row[19]);
|
||||||
$totalSum += $row[20];
|
$totalSum += floatval($row[20]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a new row with sums
|
// Add a new row with sums
|
||||||
@ -535,3 +536,439 @@ if (!function_exists('format_Excel_BasedOn_Client'))
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(!function_exists('generate_excel_second_stage')){
|
||||||
|
|
||||||
|
function generate_excel_second_stage($headers, $data, $filename, $totals = null)
|
||||||
|
{
|
||||||
|
// Create a new Spreadsheet object
|
||||||
|
$spreadsheet = new Spreadsheet();
|
||||||
|
|
||||||
|
// Set the active sheet title
|
||||||
|
$spreadsheet->getActiveSheet()->setTitle('Sheet 1');
|
||||||
|
|
||||||
|
// Set headers into the spreadsheet
|
||||||
|
$headerValues = [];
|
||||||
|
foreach ($headers as $header) {
|
||||||
|
$headerValues[] = $header['column_name'];
|
||||||
|
}
|
||||||
|
$spreadsheet->getActiveSheet()->fromArray([$headerValues], null, 'A1');
|
||||||
|
|
||||||
|
// Set data into the spreadsheet
|
||||||
|
$dataValues = [];
|
||||||
|
$serialNumber = 0; // Initialize serial number
|
||||||
|
foreach ($data as $row) {
|
||||||
|
$serialNumber++; // Increment serial number for each row
|
||||||
|
|
||||||
|
$rowData = [];
|
||||||
|
foreach ($headers as $header) {
|
||||||
|
$fieldName = $header['header_name'];
|
||||||
|
|
||||||
|
if ($fieldName === 'index') {
|
||||||
|
$value = $serialNumber;
|
||||||
|
} else {
|
||||||
|
$value = $row->$fieldName ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$rowData[] = $value;
|
||||||
|
}
|
||||||
|
$dataValues[] = $rowData;
|
||||||
|
}
|
||||||
|
// dd($dataValues, $headerValues);
|
||||||
|
$spreadsheet->getActiveSheet()->fromArray($dataValues, null, 'A2');
|
||||||
|
|
||||||
|
// Add totals if specified
|
||||||
|
if ($totals === 1) {
|
||||||
|
// Call function to add totals row for inception
|
||||||
|
add_totals_row($spreadsheet, $data, $headers);
|
||||||
|
} else if ($totals === 2) {
|
||||||
|
// Call function to add totals row for deletion
|
||||||
|
add_totals_for_deletion($spreadsheet, $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create Excel writer
|
||||||
|
$writer = new Xlsx($spreadsheet);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Save Excel file to the specified path
|
||||||
|
$writer->save($filename);
|
||||||
|
return true; // Return true if file was successfully saved
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Log or handle the exception
|
||||||
|
return false; // Return false if there was an error saving the file
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!function_exists('generate_excel_third_stage')){
|
||||||
|
|
||||||
|
function generate_excel_third_stage($headers, $data, $filename, $totals = null)
|
||||||
|
{
|
||||||
|
// Create a new Spreadsheet object
|
||||||
|
$spreadsheet = new Spreadsheet();
|
||||||
|
|
||||||
|
// Set the active sheet title
|
||||||
|
$spreadsheet->getActiveSheet()->setTitle('Sheet 1');
|
||||||
|
|
||||||
|
$spreadsheet->getActiveSheet()->fromArray([$headers], null, 'A1');
|
||||||
|
|
||||||
|
$spreadsheet->getActiveSheet()->fromArray($data, null, 'A2');
|
||||||
|
|
||||||
|
// Add totals if specified
|
||||||
|
if ($totals === 1) {
|
||||||
|
// Call function to add totals row for inception
|
||||||
|
add_totals_row($spreadsheet, $data, $headers);
|
||||||
|
} else if ($totals === 2) {
|
||||||
|
// Call function to add totals row for deletion
|
||||||
|
add_totals_for_deletion($spreadsheet, $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create Excel writer
|
||||||
|
$writer = new Xlsx($spreadsheet);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Save Excel file to the specified path
|
||||||
|
$writer->save($filename);
|
||||||
|
return true; // Return true if file was successfully saved
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Log or handle the exception
|
||||||
|
return false; // Return false if there was an error saving the file
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(!function_exists('generate_insurer_based_excel')){
|
||||||
|
|
||||||
|
function generate_insurer_based_excel($excel_header_array, $excel_need_data){
|
||||||
|
|
||||||
|
usort($excel_header_array, function($a, $b) {
|
||||||
|
return $a['column_index'] <=> $b['column_index'];
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//construct HEADER
|
||||||
|
$headerValues = [];
|
||||||
|
foreach ($excel_header_array as $header) {
|
||||||
|
$headerValues[] = $header['column_name'];
|
||||||
|
}
|
||||||
|
|
||||||
|
//construct EXCEL DATA
|
||||||
|
$dataValues = [];
|
||||||
|
$serialNumber = 0; // Initialize serial number
|
||||||
|
foreach ($excel_need_data as $row) {
|
||||||
|
$serialNumber++;
|
||||||
|
|
||||||
|
$rowData = [];
|
||||||
|
foreach ($excel_header_array as $header) {
|
||||||
|
$fieldName = $header['header_name'];
|
||||||
|
|
||||||
|
if ($fieldName === 'index') {
|
||||||
|
$value = $serialNumber;
|
||||||
|
} else {
|
||||||
|
$value = $row->$fieldName ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$rowData[] = $value;
|
||||||
|
}
|
||||||
|
$dataValues[] = $rowData;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ['header' => $headerValues, 'data' => $dataValues];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!function_exists('read_first_row_of_excel')){
|
||||||
|
|
||||||
|
function read_first_row_of_excel($file)
|
||||||
|
{
|
||||||
|
if ($file->isValid() && !$file->hasMoved()) {
|
||||||
|
try {
|
||||||
|
$reader = IOFactory::createReaderForFile($file->getPathname());
|
||||||
|
$spreadsheet = $reader->load($file->getPathname());
|
||||||
|
|
||||||
|
// Get the active sheet
|
||||||
|
$sheet = $spreadsheet->getActiveSheet();
|
||||||
|
|
||||||
|
// Initialize the data array
|
||||||
|
$data = [];
|
||||||
|
|
||||||
|
// Iterate through rows to read data (only the first row)
|
||||||
|
$row = $sheet->getRowIterator()->current(); // Get the first row
|
||||||
|
$rowData = [];
|
||||||
|
foreach ($row->getCellIterator() as $cell) {
|
||||||
|
$rowData[] = $cell->getValue();
|
||||||
|
}
|
||||||
|
$data = $rowData; // Assign the first row data to $data
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
|
||||||
|
} catch (SpreadsheetReaderException $e) {
|
||||||
|
error_log('PhpSpreadsheet reader exception: ' . $e->getMessage());
|
||||||
|
return $e->getMessage();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!function_exists('query_construct_for_emp_policy_id')){
|
||||||
|
function query_construct_for_emp_policy_id($employees, $col_index){
|
||||||
|
|
||||||
|
// Load the database connection
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
|
||||||
|
// Start building the query
|
||||||
|
$subQuery = '';
|
||||||
|
foreach ($employees as $index => $employee) {
|
||||||
|
if ($index > 1) {
|
||||||
|
$subQuery .= " UNION ALL ";
|
||||||
|
}
|
||||||
|
if($index == 1){
|
||||||
|
$row_id_alise = ' AS row_id,';
|
||||||
|
$emp_name_alise = 'AS name,';
|
||||||
|
$emp_code_alise = 'AS emp_code,';
|
||||||
|
$emp_dob_alise = 'AS emp_dob,';
|
||||||
|
$emp_gender_alise = 'AS emp_gender,';
|
||||||
|
$pre_existing_alignments_alise = 'AS pre_existing_alignments,';
|
||||||
|
$basic_cover_si_alise = 'AS basic_cover_si,';
|
||||||
|
$emp_relationship_alise = 'AS emp_relationship,';
|
||||||
|
$policy_end_date_alise = 'AS policy_end_date,';
|
||||||
|
$days_alise = 'AS days,';
|
||||||
|
$premium_alise = 'AS premium,';
|
||||||
|
$rata_premimum_alise = 'AS rata_premimum,';
|
||||||
|
$gst_alise = 'AS gst';
|
||||||
|
}else{
|
||||||
|
$row_id_alise = ',';
|
||||||
|
$emp_name_alise = ',';
|
||||||
|
$emp_code_alise = ',';
|
||||||
|
$emp_dob_alise = ',';
|
||||||
|
$emp_gender_alise = ',';
|
||||||
|
$pre_existing_alignments_alise = ',';
|
||||||
|
$basic_cover_si_alise = ',';
|
||||||
|
$emp_relationship_alise = ',';
|
||||||
|
$policy_end_date_alise = ',';
|
||||||
|
$days_alise = ',';
|
||||||
|
$premium_alise = ',';
|
||||||
|
$rata_premimum_alise = ',';
|
||||||
|
$gst_alise = '';
|
||||||
|
}
|
||||||
|
$subQuery .= "SELECT " . intval($index) . $row_id_alise;
|
||||||
|
$subQuery .= "'" . $employee[$col_index['emp_name']] . "'" . $emp_name_alise;
|
||||||
|
$subQuery .= "'" . $employee[$col_index['emp_code']] . "'" . $emp_code_alise;
|
||||||
|
$subQuery .= "'" . $employee[$col_index['emp_dob']] . "'" . $emp_dob_alise;
|
||||||
|
$subQuery .= "'" . $employee[$col_index['emp_gender']] . "'" . $emp_gender_alise;
|
||||||
|
$subQuery .= "'" . $employee[$col_index['pre_existing_alignments']] . "'" . $pre_existing_alignments_alise;
|
||||||
|
$subQuery .= "'" . $employee[$col_index['basic_cover_si']] . "'" . $basic_cover_si_alise;
|
||||||
|
$subQuery .= "'" . $employee[$col_index['emp_relationship']] . "'" . $emp_relationship_alise;
|
||||||
|
$subQuery .= "'" . $employee[$col_index['policy_end_date']] . "'" . $policy_end_date_alise;
|
||||||
|
$subQuery .= "'" . $employee[$col_index['days']] . "'" . $days_alise;
|
||||||
|
$subQuery .= "'" . $employee[$col_index['premium']] . "'" . $premium_alise;
|
||||||
|
$subQuery .= "'" . $employee[$col_index['rata_premimum']] . "'" . $rata_premimum_alise;
|
||||||
|
$subQuery .= "'" . $employee[$col_index['gst']] . "'" . $gst_alise;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Complete the query
|
||||||
|
$mainQuery = "
|
||||||
|
SELECT
|
||||||
|
c.row_id,
|
||||||
|
c.emp_code,
|
||||||
|
c.name,
|
||||||
|
c.emp_dob,
|
||||||
|
c.emp_gender ,
|
||||||
|
c.emp_relationship,
|
||||||
|
c.pre_existing_alignments,
|
||||||
|
c.basic_cover_si ,
|
||||||
|
c.policy_end_date ,
|
||||||
|
c.days ,
|
||||||
|
c.premium ,
|
||||||
|
c.rata_premimum ,
|
||||||
|
c.gst,
|
||||||
|
|
||||||
|
e.emp_code AS db_emp_code,
|
||||||
|
e.name AS db_name ,
|
||||||
|
e.dob as db_dob,
|
||||||
|
e.gender as db_gender,
|
||||||
|
e.relationship as db_emp_relationship,
|
||||||
|
ep.pre_existing_alignments as db_pre_existing_alignments,
|
||||||
|
ep.basic_cover_si as db_basic_cover_si,
|
||||||
|
ep.policy_end_date as db_policy_end_date,
|
||||||
|
ep.days as db_days,
|
||||||
|
ep.premium as db_premium,
|
||||||
|
ep.rata_premimum as db_rata_premimum,
|
||||||
|
ep.gst as db_gst
|
||||||
|
|
||||||
|
FROM ({$subQuery}) AS c
|
||||||
|
LEFT JOIN employees e
|
||||||
|
ON c.emp_code = e.emp_code
|
||||||
|
AND c.name = e.name
|
||||||
|
AND c.emp_dob = e.dob
|
||||||
|
AND c.emp_gender = e.gender
|
||||||
|
AND c.emp_relationship = e.relationship
|
||||||
|
|
||||||
|
LEFT JOIN employee_polices ep
|
||||||
|
ON c.pre_existing_alignments = ep.pre_existing_alignments
|
||||||
|
AND c.basic_cover_si = ep.basic_cover_si
|
||||||
|
AND c.policy_end_date = ep.policy_end_date
|
||||||
|
AND c.days = ep.days
|
||||||
|
AND c.premium = ep.premium
|
||||||
|
AND c.rata_premimum = ep.rata_premimum
|
||||||
|
AND c.gst = ep.gst
|
||||||
|
|
||||||
|
WHERE e.emp_code IS NOT NULL
|
||||||
|
AND e.name IS NOT NULL
|
||||||
|
AND e.dob IS NOT NULL
|
||||||
|
AND e.gender IS NOT NULL
|
||||||
|
AND e.relationship IS NOT NULL
|
||||||
|
AND ep.pre_existing_alignments IS NOT NULL
|
||||||
|
AND ep.basic_cover_si IS NOT NULL
|
||||||
|
AND ep.policy_end_date IS NOT NULL
|
||||||
|
AND ep.days IS NOT NULL
|
||||||
|
AND ep.premium IS NOT NULL
|
||||||
|
AND ep.rata_premimum IS NOT NULL
|
||||||
|
AND ep.gst IS NOT NULL
|
||||||
|
";
|
||||||
|
|
||||||
|
|
||||||
|
// return $mainQuery;
|
||||||
|
// Execute the query
|
||||||
|
$query = $db->query($mainQuery);
|
||||||
|
$result = $query->getResultArray();
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!function_exists('query_construct_second_stage')){
|
||||||
|
function query_construct_second_stage($employees, $col_index){
|
||||||
|
|
||||||
|
// Load the database connection
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
|
||||||
|
// Start building the query
|
||||||
|
$subQuery = '';
|
||||||
|
foreach ($employees as $index => $employee) {
|
||||||
|
if ($index > 1) {
|
||||||
|
$subQuery .= " UNION ALL ";
|
||||||
|
}
|
||||||
|
if($index == 1){
|
||||||
|
$row_id_alise = ' AS row_id,';
|
||||||
|
$emp_name_alise = 'AS name,';
|
||||||
|
$emp_code_alise = 'AS emp_code,';
|
||||||
|
$emp_dob_alise = 'AS emp_dob,';
|
||||||
|
$emp_gender_alise = 'AS emp_gender,';
|
||||||
|
$pre_existing_alignments_alise = 'AS pre_existing_alignments,';
|
||||||
|
$basic_cover_si_alise = 'AS basic_cover_si,';
|
||||||
|
$emp_relationship_alise = 'AS emp_relationship,';
|
||||||
|
$policy_end_date_alise = 'AS policy_end_date,';
|
||||||
|
$days_alise = 'AS days,';
|
||||||
|
$premium_alise = 'AS premium,';
|
||||||
|
$rata_premimum_alise = 'AS rata_premimum,';
|
||||||
|
$gst_alise = 'AS gst';
|
||||||
|
}else{
|
||||||
|
$row_id_alise = ',';
|
||||||
|
$emp_name_alise = ',';
|
||||||
|
$emp_code_alise = ',';
|
||||||
|
$emp_dob_alise = ',';
|
||||||
|
$emp_gender_alise = ',';
|
||||||
|
$pre_existing_alignments_alise = ',';
|
||||||
|
$basic_cover_si_alise = ',';
|
||||||
|
$emp_relationship_alise = ',';
|
||||||
|
$policy_end_date_alise = ',';
|
||||||
|
$days_alise = ',';
|
||||||
|
$premium_alise = ',';
|
||||||
|
$rata_premimum_alise = ',';
|
||||||
|
$gst_alise = '';
|
||||||
|
}
|
||||||
|
$subQuery .= "SELECT " . intval($index) . $row_id_alise;
|
||||||
|
$subQuery .= "'" . $employee[$col_index['emp_name']] . "'" . $emp_name_alise;
|
||||||
|
$subQuery .= "'" . $employee[$col_index['emp_code']] . "'" . $emp_code_alise;
|
||||||
|
$subQuery .= "'" . $employee[$col_index['emp_dob']] . "'" . $emp_dob_alise;
|
||||||
|
$subQuery .= "'" . $employee[$col_index['emp_gender']] . "'" . $emp_gender_alise;
|
||||||
|
$subQuery .= "'" . $employee[$col_index['pre_existing_alignments']] . "'" . $pre_existing_alignments_alise;
|
||||||
|
$subQuery .= "'" . $employee[$col_index['basic_cover_si']] . "'" . $basic_cover_si_alise;
|
||||||
|
$subQuery .= "'" . $employee[$col_index['emp_relationship']] . "'" . $emp_relationship_alise;
|
||||||
|
$subQuery .= "'" . $employee[$col_index['policy_end_date']] . "'" . $policy_end_date_alise;
|
||||||
|
$subQuery .= "'" . $employee[$col_index['days']] . "'" . $days_alise;
|
||||||
|
$subQuery .= "'" . $employee[$col_index['premium']] . "'" . $premium_alise;
|
||||||
|
$subQuery .= "'" . $employee[$col_index['rata_premimum']] . "'" . $rata_premimum_alise;
|
||||||
|
$subQuery .= "'" . $employee[$col_index['gst']] . "'" . $gst_alise;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Complete the query
|
||||||
|
$mainQuery = "
|
||||||
|
SELECT
|
||||||
|
c.row_id,
|
||||||
|
c.emp_code,
|
||||||
|
c.name,
|
||||||
|
c.emp_dob,
|
||||||
|
c.emp_gender ,
|
||||||
|
c.emp_relationship,
|
||||||
|
c.pre_existing_alignments,
|
||||||
|
c.basic_cover_si ,
|
||||||
|
c.policy_end_date ,
|
||||||
|
c.days ,
|
||||||
|
c.premium ,
|
||||||
|
c.rata_premimum ,
|
||||||
|
c.gst,
|
||||||
|
|
||||||
|
e.emp_code AS db_emp_code,
|
||||||
|
e.name AS db_name ,
|
||||||
|
e.dob as db_dob,
|
||||||
|
e.gender as db_gender,
|
||||||
|
e.relationship as db_emp_relationship,
|
||||||
|
ep.pre_existing_alignments as db_pre_existing_alignments,
|
||||||
|
ep.basic_cover_si as db_basic_cover_si,
|
||||||
|
ep.policy_end_date as db_policy_end_date,
|
||||||
|
ep.days as db_days,
|
||||||
|
ep.premium as db_premium,
|
||||||
|
ep.rata_premimum as db_rata_premimum,
|
||||||
|
ep.gst as db_gst
|
||||||
|
|
||||||
|
FROM ({$subQuery}) AS c
|
||||||
|
LEFT JOIN employees e
|
||||||
|
ON c.emp_code = e.emp_code
|
||||||
|
AND c.name = e.name
|
||||||
|
AND c.emp_dob = e.dob
|
||||||
|
AND c.emp_gender = e.gender
|
||||||
|
AND c.emp_relationship = e.relationship
|
||||||
|
|
||||||
|
LEFT JOIN employee_polices ep
|
||||||
|
ON c.pre_existing_alignments = ep.pre_existing_alignments
|
||||||
|
AND c.basic_cover_si = ep.basic_cover_si
|
||||||
|
AND c.policy_end_date = ep.policy_end_date
|
||||||
|
AND c.days = ep.days
|
||||||
|
AND c.premium = ep.premium
|
||||||
|
AND c.rata_premimum = ep.rata_premimum
|
||||||
|
AND c.gst = ep.gst
|
||||||
|
|
||||||
|
WHERE e.emp_code IS NULL
|
||||||
|
AND e.name IS NULL
|
||||||
|
AND e.dob IS NULL
|
||||||
|
AND e.gender IS NULL
|
||||||
|
AND e.relationship IS NULL
|
||||||
|
AND ep.pre_existing_alignments IS NULL
|
||||||
|
AND ep.basic_cover_si IS NULL
|
||||||
|
AND ep.policy_end_date IS NULL
|
||||||
|
AND ep.days IS NULL
|
||||||
|
AND ep.premium IS NULL
|
||||||
|
AND ep.rata_premimum IS NULL
|
||||||
|
AND ep.gst IS NULL
|
||||||
|
";
|
||||||
|
|
||||||
|
|
||||||
|
// return $mainQuery;
|
||||||
|
// Execute the query
|
||||||
|
$query = $db->query($mainQuery);
|
||||||
|
$result = $query->getResultArray();
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -787,6 +787,22 @@ if (!function_exists('calculate_premimum'))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//set primary_rack_rate_acting_self in emp_details_with_empband_max_age_max_count array for policies where self not available and premium type is 1 (i.e.) GMC parents as dep addon policy
|
||||||
|
$transformed_familiy_member_data['temp']['primary_rack_rate_acting_self'] = false;
|
||||||
|
if(!isset($emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['primary_rack_rate_acting_self']) && $current_grid_info['type'] == 'primary')
|
||||||
|
{
|
||||||
|
if(strtolower($transformed_familiy_member_data['relationship']) == 'self')
|
||||||
|
{
|
||||||
|
$transformed_familiy_member_data['temp']['primary_rack_rate_acting_self'] = true;
|
||||||
|
$emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['primary_rack_rate_acting_self'] = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$transformed_familiy_member_data['temp']['primary_rack_rate_acting_self'] = true;
|
||||||
|
$emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['primary_rack_rate_acting_self'] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//generate relationship code
|
//generate relationship code
|
||||||
if($transformed_familiy_member_data['temp']['action'] != 'D' && $transformed_familiy_member_data['temp']['action'] != 'C' && $transformed_familiy_member_data['temp']['action'] != 'SI')
|
if($transformed_familiy_member_data['temp']['action'] != 'D' && $transformed_familiy_member_data['temp']['action'] != 'C' && $transformed_familiy_member_data['temp']['action'] != 'SI')
|
||||||
{
|
{
|
||||||
@ -1013,7 +1029,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
|
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
|
||||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||||
{
|
{
|
||||||
if($slab_value['si'] == $employee_received_si && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
if($slab_value['si'] == $employee_received_si && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||||
{
|
{
|
||||||
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||||
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||||
@ -1036,7 +1052,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||||
{
|
{
|
||||||
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
||||||
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||||
{
|
{
|
||||||
// dd($slab_value);
|
// dd($slab_value);
|
||||||
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||||
@ -1057,7 +1073,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||||
{
|
{
|
||||||
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
||||||
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||||
{
|
{
|
||||||
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||||
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||||
@ -1077,7 +1093,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||||
{
|
{
|
||||||
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
||||||
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||||
{
|
{
|
||||||
// echo $emp_data['name'];
|
// echo $emp_data['name'];
|
||||||
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||||
@ -1099,7 +1115,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||||
{
|
{
|
||||||
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
||||||
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||||
{
|
{
|
||||||
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||||
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||||
@ -1121,7 +1137,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||||
{
|
{
|
||||||
|
|
||||||
if($slab_value['grade'] == $employee_received_band && $slab_value['si'] == $employee_received_si && (($slab_value['premium_type'] == 1 && (strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
if($slab_value['grade'] == $employee_received_band && $slab_value['si'] == $employee_received_si && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||||
{
|
{
|
||||||
// $emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
// $emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||||
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||||
@ -1143,7 +1159,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||||
{
|
{
|
||||||
|
|
||||||
if($slab_value['si'] == $employee_received_si && (($slab_value['premium_type'] == 1 && (strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self'])) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
if($slab_value['si'] == $employee_received_si && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self'])) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||||
{
|
{
|
||||||
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||||
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||||
@ -1170,7 +1186,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
if( $slab_value['si'] == $employee_received_si &&
|
if( $slab_value['si'] == $employee_received_si &&
|
||||||
($slab_value['age_from'] <= $max_age && $slab_value['age_to'] >= $max_age) &&
|
($slab_value['age_from'] <= $max_age && $slab_value['age_to'] >= $max_age) &&
|
||||||
(($slab_value['premium_type'] == 1 &&
|
(($slab_value['premium_type'] == 1 &&
|
||||||
( (strtolower($emp_data['relationship']) == 'self') || ($emp_data['temp']['additional_rack_rate_acting_self']) )) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ) )
|
( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self'])) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ) )
|
||||||
{
|
{
|
||||||
$emp_data['policy_details']['basic_cover_si'] = $employee_received_si;
|
$emp_data['policy_details']['basic_cover_si'] = $employee_received_si;
|
||||||
$emp_data['policy_details']['date_coverage'] = isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date'];
|
$emp_data['policy_details']['date_coverage'] = isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date'];
|
||||||
@ -1195,7 +1211,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
{
|
{
|
||||||
|
|
||||||
if($slab_value['si'] == $employee_received_si && $slab_value['grade'] == $employee_received_band && (($slab_value['premium_type'] == 1 &&
|
if($slab_value['si'] == $employee_received_si && $slab_value['grade'] == $employee_received_band && (($slab_value['premium_type'] == 1 &&
|
||||||
( (strtolower($emp_data['relationship']) == 'self') || ($emp_data['temp']['additional_rack_rate_acting_self']) )) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self'])) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||||
{
|
{
|
||||||
//calculate premium based on count
|
//calculate premium based on count
|
||||||
// echo $emp_data['name'];
|
// echo $emp_data['name'];
|
||||||
@ -1224,7 +1240,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
$emp_data['policy_details']['basic_cover_si'] = null;
|
$emp_data['policy_details']['basic_cover_si'] = null;
|
||||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||||
{
|
{
|
||||||
if( $slab_value['si'] == $employee_received_si && ((($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) && $slab_value['relationship'] == $employee_relationship) || ($slab_value['premium_type'] == 1 && (strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self'] ) )) )
|
if( $slab_value['si'] == $employee_received_si && ((($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) && $slab_value['relationship'] == $employee_relationship) || ($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) )) )
|
||||||
{
|
{
|
||||||
|
|
||||||
$emp_data['policy_details']['basic_cover_si'] = $employee_received_si;
|
$emp_data['policy_details']['basic_cover_si'] = $employee_received_si;
|
||||||
@ -1249,7 +1265,7 @@ if (!function_exists('premium_calculation_manager'))
|
|||||||
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
||||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||||
{
|
{
|
||||||
if( $slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && ((($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) && $slab_value['relationship'] == $employee_relationship) || ($slab_value['premium_type'] == 1 && (strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self']) )) )
|
if( $slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && ((($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) && $slab_value['relationship'] == $employee_relationship) || ($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) )) )
|
||||||
{
|
{
|
||||||
|
|
||||||
$emp_data['policy_details']['basic_cover_si'] = $employee_received_si;
|
$emp_data['policy_details']['basic_cover_si'] = $employee_received_si;
|
||||||
|
|||||||
@ -195,6 +195,7 @@ class ClientPolicyModel extends Model
|
|||||||
->join('policies', 'policies.id = client_policy.policy_id', 'left')
|
->join('policies', 'policies.id = client_policy.policy_id', 'left')
|
||||||
->where('cash_deposit.client_id', $clientId)
|
->where('cash_deposit.client_id', $clientId)
|
||||||
->where('cash_deposit.insurer_id', $insurerId)
|
->where('cash_deposit.insurer_id', $insurerId)
|
||||||
|
->where('cash_deposit.is_active', 1)
|
||||||
->orderBy('cash_deposit.id', 'DESC')
|
->orderBy('cash_deposit.id', 'DESC')
|
||||||
->get()
|
->get()
|
||||||
->getResult();
|
->getResult();
|
||||||
|
|||||||
@ -762,10 +762,8 @@
|
|||||||
success: function(res) {
|
success: function(res) {
|
||||||
|
|
||||||
console.log('client_policy_res', res)
|
console.log('client_policy_res', res)
|
||||||
console.log('gst', res.data.gst);
|
|
||||||
|
|
||||||
var gst = (res.data.gst == 0.00) ? 18 : res.data.gst;
|
var gst = (res.data.gst == 0.00) ? 18 : res.data.gst;
|
||||||
console.log(gst);
|
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
@ -792,7 +790,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$('#tpa').val(tpaValue).change();
|
$('#tpa').val(tpaValue).change();
|
||||||
// $('#policy').val(res.data.policy_id).change();
|
|
||||||
$('#policy_type').val(res.data.is_addon).change();
|
$('#policy_type').val(res.data.is_addon).change();
|
||||||
$('#base_policy').val(res.data.base_policy);
|
$('#base_policy').val(res.data.base_policy);
|
||||||
|
|
||||||
@ -835,24 +832,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (res.data.is_addon == 1 && res.data.base_policy > 0) {
|
|
||||||
|
|
||||||
// $("#insurer").next(".select2-container").css({
|
|
||||||
// 'pointer-events': 'none',
|
|
||||||
// });
|
|
||||||
// $('#select2-insurer-container').css({
|
|
||||||
// 'background-color': '#ebebe0',
|
|
||||||
// });
|
|
||||||
|
|
||||||
// $("#tpa").next(".select2-container").css({
|
|
||||||
// 'pointer-events': 'none',
|
|
||||||
// });
|
|
||||||
// $('#select2-tpa-container').css({
|
|
||||||
// 'background-color': '#ebebe0',
|
|
||||||
// });
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (res.data.is_addon == 2 || res.data.is_addon == 3) {
|
if (res.data.is_addon == 2 || res.data.is_addon == 3) {
|
||||||
|
|
||||||
@ -887,40 +866,12 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var policeOptionHTML = '';
|
|
||||||
$.each(res.policy, function(index, item) {
|
|
||||||
policeOptionHTML += '<option data-id="' + item.policy_type_id +
|
|
||||||
'" value="' + item.id + '" ' + (res.data.policy_id === item.id ?
|
|
||||||
'selected="selected"' : '') + '>' + item.name + '</option>';
|
|
||||||
});
|
|
||||||
$('#policy').html(policeOptionHTML);
|
|
||||||
|
|
||||||
var OptionsHTML = '';
|
|
||||||
OptionsHTML += '<option value="" selected>Select Base Policy</option>';
|
|
||||||
$.each(res.client_policy_list, function(index, item) {
|
|
||||||
|
|
||||||
if (item.client_branch_id == res.data.client_branch_id) {
|
|
||||||
|
|
||||||
OptionsHTML += '<option data-id="' + item.policy_type_id +
|
|
||||||
'" value="' + item.id + '" ' + (res.data.base_policy === item.id ?
|
|
||||||
'selected="selected"' : '') + '>' + item.name + '( ' + item
|
|
||||||
.policy_type + ' )</option>';
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
$('#base_policy').html(OptionsHTML);
|
|
||||||
|
|
||||||
setTimeout(function() {
|
|
||||||
$('#policy').val(res.data.policy_id).change();
|
|
||||||
$('#base_policy').val(res.data.base_policy);
|
|
||||||
$('#base_policy').change();
|
|
||||||
}, 3000);
|
|
||||||
|
|
||||||
|
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
appendCDACNO(res.cd_data, res.data.cd_ac_no)
|
appendCDACNO(res.cd_data, res.data.cd_ac_no) // append and select the current CD Account Number
|
||||||
}, 3000)
|
appendPolicyList(res.policy, res.data.policy_id); // append and select the current policy
|
||||||
|
appendBasePolicyList(res.client_policy_list, res.data.base_policy, res.data.client_branch_id); // append and select the Base palicy
|
||||||
|
}, 2000)
|
||||||
|
|
||||||
$('#client_branch').val(res.data.client_branch_id).change();
|
$('#client_branch').val(res.data.client_branch_id).change();
|
||||||
|
|
||||||
@ -1641,5 +1592,63 @@
|
|||||||
$('#cd_ac_no').append(option);
|
$('#cd_ac_no').append(option);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function appendPolicyList(data, select = null, ) {
|
||||||
|
|
||||||
|
console.log('appendPolicyList', 'function called');
|
||||||
|
console.log('appendPolicyList data', data);
|
||||||
|
console.log('appendPolicyList selected value', select);
|
||||||
|
|
||||||
|
$('#policy').empty();
|
||||||
|
$('#policy').append($('<option>', {
|
||||||
|
value: '',
|
||||||
|
text: 'Select Policy'
|
||||||
|
}));
|
||||||
|
|
||||||
|
$.each(data, function(index, item) {
|
||||||
|
const option = $('<option>', {
|
||||||
|
value: item.id, //policy id primary key
|
||||||
|
text: item.name, // policy name
|
||||||
|
'data-id': item.policy_type_id //policy type id like gpa and gmc
|
||||||
|
});
|
||||||
|
|
||||||
|
if (select === item.id) {
|
||||||
|
option.attr('selected', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#policy').append(option);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function appendBasePolicyList(data, select = null, client_branch_id = null) {
|
||||||
|
|
||||||
|
console.log('appendBasePolicyList', 'function called');
|
||||||
|
console.log('appendBasePolicyList data', data);
|
||||||
|
console.log('appendBasePolicyList selected value', select);
|
||||||
|
|
||||||
|
$('#base_policy').empty();
|
||||||
|
$('#base_policy').append($('<option>', {
|
||||||
|
value: '',
|
||||||
|
text: 'Select Base Policy'
|
||||||
|
}));
|
||||||
|
|
||||||
|
$.each(data, function(index, item) {
|
||||||
|
|
||||||
|
if (item.client_branch_id == client_branch_id) {
|
||||||
|
|
||||||
|
const option = $('<option>', {
|
||||||
|
value: item.id,
|
||||||
|
text: item.name + ' - ' + item.policy_type,
|
||||||
|
'data-id': item.policy_type_id
|
||||||
|
});
|
||||||
|
|
||||||
|
if (select === item.id) {
|
||||||
|
//console.log('selected');
|
||||||
|
option.attr('selected', true);
|
||||||
|
}
|
||||||
|
$('#base_policy').append(option);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -64,6 +64,9 @@
|
|||||||
|
|
||||||
$tool_tip_text = "Live(s) : {$file['employee_count']}" . " | Total premium : ₹ " . format_indian_number($file['total'], 2, ',') . " | Click to reload";
|
$tool_tip_text = "Live(s) : {$file['employee_count']}" . " | Total premium : ₹ " . format_indian_number($file['total'], 2, ',') . " | Click to reload";
|
||||||
echo '<a data-toggle="tooltip" data-placement="top" data-id="' . $file['status'] . '" class="reload" title="' . $tool_tip_text . '" href="#">' . $file['status'] . '</a>';
|
echo '<a data-toggle="tooltip" data-placement="top" data-id="' . $file['status'] . '" class="reload" title="' . $tool_tip_text . '" href="#">' . $file['status'] . '</a>';
|
||||||
|
}else{
|
||||||
|
|
||||||
|
echo '<a data-id="' . $file['status'] . '" class="reload" href="#">' . $file['status'] . '</a>';
|
||||||
}
|
}
|
||||||
} else if ($file['status'] == 'success') {
|
} else if ($file['status'] == 'success') {
|
||||||
|
|
||||||
|
|||||||
@ -746,6 +746,8 @@
|
|||||||
|
|
||||||
$("#policyJsonForm").submit(function(event) {
|
$("#policyJsonForm").submit(function(event) {
|
||||||
|
|
||||||
|
checkAdditionPremiumJSON()
|
||||||
|
|
||||||
|
|
||||||
if (!$('#self').prop('checked')) {
|
if (!$('#self').prop('checked')) {
|
||||||
$('#self_min_age').removeAttr('name');
|
$('#self_min_age').removeAttr('name');
|
||||||
@ -795,6 +797,7 @@
|
|||||||
processData: false,
|
processData: false,
|
||||||
contentType: false,
|
contentType: false,
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
|
|
||||||
$('#policyJsonForm')[0].reset();
|
$('#policyJsonForm')[0].reset();
|
||||||
$('.text-danger-2').html('');
|
$('.text-danger-2').html('');
|
||||||
if (res.status === false) {
|
if (res.status === false) {
|
||||||
@ -828,7 +831,7 @@
|
|||||||
$('.nav.nav-pills.navtab-bg').prev().css('display', '');
|
$('.nav.nav-pills.navtab-bg').prev().css('display', '');
|
||||||
var message = 'Policy Terms Updated successfully';
|
var message = 'Policy Terms Updated successfully';
|
||||||
toastr.success(message, 'Success');
|
toastr.success(message, 'Success');
|
||||||
}, 1000);
|
}, 500);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -984,57 +987,57 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.policy_addon == '3') {
|
// if (response.policy_addon == '3') {
|
||||||
|
|
||||||
$('.jodit-container').prop('disabled', true);
|
// $('.jodit-container').prop('disabled', true);
|
||||||
$('.waiverofpreexistingdiseases').prop('disabled', true);
|
// $('.waiverofpreexistingdiseases').prop('disabled', true);
|
||||||
$('#maternitycoverage').prop('disabled', true);
|
// $('#maternitycoverage').prop('disabled', true);
|
||||||
$('#twindelivery').prop('disabled', true);
|
// $('#twindelivery').prop('disabled', true);
|
||||||
$('#preandpostnatal').prop('disabled', true);
|
// $('#preandpostnatal').prop('disabled', true);
|
||||||
$('#babyday1cover').prop('disabled', true);
|
// $('#babyday1cover').prop('disabled', true);
|
||||||
$('.9monthwaitingperiodwaived').prop('disabled', true);
|
// $('.9monthwaitingperiodwaived').prop('disabled', true);
|
||||||
$('#coverfromthedateofjoining').prop('disabled', true);
|
// $('#coverfromthedateofjoining').prop('disabled', true);
|
||||||
$('.waiverof1234thyearexclusions').prop('disabled', true);
|
// $('.waiverof1234thyearexclusions').prop('disabled', true);
|
||||||
$('.waiverof30dayswaitingperiod').prop('disabled', true);
|
// $('.waiverof30dayswaitingperiod').prop('disabled', true);
|
||||||
$('#prehospitalizationcover').prop('disabled', true);
|
// $('#prehospitalizationcover').prop('disabled', true);
|
||||||
$('#posthospitalizationcover').prop('disabled', true);
|
// $('#posthospitalizationcover').prop('disabled', true);
|
||||||
$('.congenitaldiseasesinternal').prop('disabled', true);
|
// $('.congenitaldiseasesinternal').prop('disabled', true);
|
||||||
$('#congenitaldiseasesexternal').prop('disabled', true);
|
// $('#congenitaldiseasesexternal').prop('disabled', true);
|
||||||
$('#copayzonewisecopay').prop('disabled', true);
|
// $('#copayzonewisecopay').prop('disabled', true);
|
||||||
$('#optionalparentalcopay').prop('disabled', true);
|
// $('#optionalparentalcopay').prop('disabled', true);
|
||||||
$('#bioabsorbablestenttoriclensmultifocallens').prop('disabled', true);
|
// $('#bioabsorbablestenttoriclensmultifocallens').prop('disabled', true);
|
||||||
$('#roomrentlimit').prop('disabled', true);
|
// $('#roomrentlimit').prop('disabled', true);
|
||||||
$('#proportionatedeductionclause').prop('disabled', true);
|
// $('#proportionatedeductionclause').prop('disabled', true);
|
||||||
$('#nursingallowance').prop('disabled', true);
|
// $('#nursingallowance').prop('disabled', true);
|
||||||
$('.ailmentcapping').prop('disabled', true);
|
// $('.ailmentcapping').prop('disabled', true);
|
||||||
$('#ambulancecharges').prop('disabled', true);
|
// $('#ambulancecharges').prop('disabled', true);
|
||||||
$('#airambulance').prop('disabled', true);
|
// $('#airambulance').prop('disabled', true);
|
||||||
$('#familytransportationbenefit').prop('disabled', true);
|
// $('#familytransportationbenefit').prop('disabled', true);
|
||||||
$('.reasonableandcustomarycharges').prop('disabled', true);
|
// $('.reasonableandcustomarycharges').prop('disabled', true);
|
||||||
$('.daycaretreatment').prop('disabled', true);
|
// $('.daycaretreatment').prop('disabled', true);
|
||||||
$('.ayudhtreatmentcover').prop('disabled', true);
|
// $('.ayudhtreatmentcover').prop('disabled', true);
|
||||||
$('#armdcovered').prop('disabled', true);
|
// $('#armdcovered').prop('disabled', true);
|
||||||
$('.suminsuredenhancement').prop('disabled', true);
|
// $('.suminsuredenhancement').prop('disabled', true);
|
||||||
$('#automaticsuminsuredreinstatement').prop('disabled', true);
|
// $('#automaticsuminsuredreinstatement').prop('disabled', true);
|
||||||
$('#lasiksurgery').prop('disabled', true);
|
// $('#lasiksurgery').prop('disabled', true);
|
||||||
$('#midterminclusion').prop('disabled', true);
|
// $('#midterminclusion').prop('disabled', true);
|
||||||
$('#capd').prop('disabled', true);
|
// $('#capd').prop('disabled', true);
|
||||||
$('#organdonorexpenses').prop('disabled', true);
|
// $('#organdonorexpenses').prop('disabled', true);
|
||||||
$('#moderntreatmentsasperirdai').prop('disabled', true);
|
// $('#moderntreatmentsasperirdai').prop('disabled', true);
|
||||||
$('#days_of_discharge').prop('disabled', true);
|
// $('#days_of_discharge').prop('disabled', true);
|
||||||
$('#days_from_dod').prop('disabled', true);
|
// $('#days_from_dod').prop('disabled', true);
|
||||||
$('#corporatebuffer').prop('disabled', true);
|
// $('#corporatebuffer').prop('disabled', true);
|
||||||
$('#sublimitofcorporatebuffer').prop('disabled', true);
|
// $('#sublimitofcorporatebuffer').prop('disabled', true);
|
||||||
|
|
||||||
setTimeout(function() {
|
// setTimeout(function() {
|
||||||
var editor1 = new Jodit('#additionalsicknessbenefit');
|
// var editor1 = new Jodit('#additionalsicknessbenefit');
|
||||||
var editor2 = new Jodit('#Wellness');
|
// var editor2 = new Jodit('#Wellness');
|
||||||
|
|
||||||
editor1.setReadOnly(true);
|
// editor1.setReadOnly(true);
|
||||||
editor2.setReadOnly(true);
|
// editor2.setReadOnly(true);
|
||||||
|
|
||||||
}, 3000);
|
// }, 3000);
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1376,6 +1379,8 @@
|
|||||||
|
|
||||||
$('#family_floaters').change(function () {
|
$('#family_floaters').change(function () {
|
||||||
|
|
||||||
|
checkAdditionPremiumJSON()
|
||||||
|
|
||||||
var family_floaters = $(this).val();
|
var family_floaters = $(this).val();
|
||||||
if($('#family_floaters').val() != 0){
|
if($('#family_floaters').val() != 0){
|
||||||
$('.other-member-age').css('display','');
|
$('.other-member-age').css('display','');
|
||||||
@ -1450,4 +1455,30 @@
|
|||||||
$(button).closest('.row').remove();
|
$(button).closest('.row').remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function checkAdditionPremiumJSON(){
|
||||||
|
|
||||||
|
var client_id = $('#Client_id').val();
|
||||||
|
var client_policy_id = $('#gmc_client_policy_id').val();
|
||||||
|
|
||||||
|
var url = '<?php echo base_url('util/check_addition_premium_JSON/') ?>' + client_id + '/' + client_policy_id;
|
||||||
|
|
||||||
|
$.get(url, function(response) {
|
||||||
|
|
||||||
|
console.log(response);
|
||||||
|
console.log(response.data);
|
||||||
|
|
||||||
|
if (response.data > 0) {
|
||||||
|
console.log('Please change the additional premium relation');
|
||||||
|
Swal.fire("Please change the additional premium relation");
|
||||||
|
}
|
||||||
|
console.log('outer');
|
||||||
|
|
||||||
|
}).fail(function(xhr, status, error) {
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
console.error(status, error);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -1171,7 +1171,6 @@ $('body').on('click', '.btnPolicyModel', function() {
|
|||||||
|
|
||||||
createCheckboxes(res.self, additional_relationship);
|
createCheckboxes(res.self, additional_relationship);
|
||||||
|
|
||||||
|
|
||||||
//console.log('policy_grid_id_value', policy_grid_id_value);
|
//console.log('policy_grid_id_value', policy_grid_id_value);
|
||||||
//console.log('secondary_policy_grid_id_value', secondary_policy_grid_id_value);
|
//console.log('secondary_policy_grid_id_value', secondary_policy_grid_id_value);
|
||||||
|
|
||||||
@ -1823,24 +1822,16 @@ function appendGridtHtml(ui_type = false, secondary = 0, data = false) {
|
|||||||
|
|
||||||
html = `
|
html = `
|
||||||
<div class="form-row" id="removeChild_${Count}" style="width:84%">
|
<div class="form-row" id="removeChild_${Count}" style="width:84%">
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-6">
|
||||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="9_si[]" id="9_si_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="9_si[]" id="9_si_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||||
<div id='sum_insured_number_word_${Count}' class="text-danger-2" ></div>
|
<div id='sum_insured_number_word_${Count}' class="text-danger-2" ></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-6">
|
||||||
<label for="mobile">Grade/Band<span class="text-danger">*</span></label>
|
|
||||||
<input value="${data !== false && data !== undefined && data !== '' ? data.grade : ''}" type="text" class="form-control" placeholder="Enter Grade/Band " name="9_grade[]" id="9_grade" required>
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-3">
|
|
||||||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||||||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="9_premium[]" id="9_premium_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="9_premium[]" id="9_premium_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||||
<div id='premium_number_word_${Count}' class="text-danger-2" ></div>
|
<div id='premium_number_word_${Count}' class="text-danger-2" ></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
|
||||||
<button style="margin-top: 44px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
|
|
||||||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more_${Count}" onclick="appendGridtHtml(9, ${secondary})">+</button>
|
|
||||||
</div>
|
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
} else if (ui_type == '10') {
|
} else if (ui_type == '10') {
|
||||||
@ -2759,7 +2750,7 @@ function si_orbp_change_function() {
|
|||||||
$('#basic_multiplier').removeAttr('required', false);
|
$('#basic_multiplier').removeAttr('required', false);
|
||||||
$('#premium_multiplier').removeAttr('required', false);
|
$('#premium_multiplier').removeAttr('required', false);
|
||||||
$('#basic_pay').removeAttr('required', false);
|
$('#basic_pay').removeAttr('required', false);
|
||||||
$('#gpa_basic_si_first').removeAttr('required', false);
|
$('#gpa_basic_si_first').removeAttr('required', false);
|
||||||
$('#gpa_basic_premium_first').removeAttr('required', false);
|
$('#gpa_basic_premium_first').removeAttr('required', false);
|
||||||
|
|
||||||
$('#gpa_sum_multiplier').attr('required', false);
|
$('#gpa_sum_multiplier').attr('required', false);
|
||||||
@ -2811,7 +2802,8 @@ function getCurrentTime() {
|
|||||||
function createCheckboxes(obj, additional_relationship) {
|
function createCheckboxes(obj, additional_relationship) {
|
||||||
//console.log('createCheckboxes function called');
|
//console.log('createCheckboxes function called');
|
||||||
|
|
||||||
//console.log(additional_relationship);
|
console.log('object', obj);
|
||||||
|
console.log('additional_relationship', additional_relationship);
|
||||||
try {
|
try {
|
||||||
additional_relationship = JSON.parse(additional_relationship);
|
additional_relationship = JSON.parse(additional_relationship);
|
||||||
//console.log(additional_relationship);
|
//console.log(additional_relationship);
|
||||||
@ -2825,10 +2817,17 @@ function createCheckboxes(obj, additional_relationship) {
|
|||||||
let html = ` <div class="col-12">
|
let html = ` <div class="col-12">
|
||||||
<label>Additional Premium Applicable to</label>
|
<label>Additional Premium Applicable to</label>
|
||||||
</div>`;
|
</div>`;
|
||||||
const multiplier = 7; // Adjust this value as needed
|
|
||||||
|
if(obj['either-parents-pil'] && obj['either-parents-pil'] > 0){
|
||||||
|
obj['parents'] = 1;
|
||||||
|
obj['parents-in-law'] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$.each(obj, function(key, value) {
|
$.each(obj, function(key, value) {
|
||||||
if (value > 0 && key != 'either-parents-pil') {
|
|
||||||
|
if (value > 0 && key != 'elders_count' && key != 'either-parents-pil') {
|
||||||
|
|
||||||
const isChecked = additional_relationship && typeof additional_relationship === 'object' && additional_relationship[key] == 1 ? 'checked' : '';
|
const isChecked = additional_relationship && typeof additional_relationship === 'object' && additional_relationship[key] == 1 ? 'checked' : '';
|
||||||
//console.log('isChecked', isChecked);
|
//console.log('isChecked', isChecked);
|
||||||
html += `
|
html += `
|
||||||
@ -2836,7 +2835,6 @@ function createCheckboxes(obj, additional_relationship) {
|
|||||||
<input class="relation_checkbox" type="checkbox" name="${key}" ${isChecked}>
|
<input class="relation_checkbox" type="checkbox" name="${key}" ${isChecked}>
|
||||||
<label style="position: relative;left: 18px;bottom: 30px;">${formatString(key)}</label>
|
<label style="position: relative;left: 18px;bottom: 30px;">${formatString(key)}</label>
|
||||||
</div>`;
|
</div>`;
|
||||||
// //console.log(html);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -3113,4 +3111,5 @@ function checkPolicyTermsSI(callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -391,6 +391,7 @@ function generateTable(rack_rate_type) {
|
|||||||
$('.excel_textarea').val('');
|
$('.excel_textarea').val('');
|
||||||
}
|
}
|
||||||
submitData(rack_rate_type);
|
submitData(rack_rate_type);
|
||||||
|
$('.excel_textarea').val('');
|
||||||
}
|
}
|
||||||
|
|
||||||
function submitData(rack_rate_type) {
|
function submitData(rack_rate_type) {
|
||||||
@ -446,7 +447,6 @@ function submitData(rack_rate_type) {
|
|||||||
// console.log('obj', obj)
|
// console.log('obj', obj)
|
||||||
// console.log('length of the obj', obj.length)
|
// console.log('length of the obj', obj.length)
|
||||||
|
|
||||||
|
|
||||||
if ('sum_insured' in obj) {
|
if ('sum_insured' in obj) {
|
||||||
obj.si = obj.sum_insured;
|
obj.si = obj.sum_insured;
|
||||||
delete obj.sum_insured;
|
delete obj.sum_insured;
|
||||||
@ -491,6 +491,7 @@ function submitData(rack_rate_type) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
console.log(jsonData);
|
console.log(jsonData);
|
||||||
|
console.log('formatType', formatType);
|
||||||
|
|
||||||
if (rack_rate_type == 1) {
|
if (rack_rate_type == 1) {
|
||||||
|
|
||||||
@ -520,7 +521,7 @@ function submitData(rack_rate_type) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (formatType == 1 || formatType == 2) {
|
if (formatType == 1 || formatType == 2 || formatType == 4 || formatType == 6) {
|
||||||
var FirstIndex = jsonData[0]
|
var FirstIndex = jsonData[0]
|
||||||
addGridHTML(false, FirstIndex, formatType, si_or_bp, 0)
|
addGridHTML(false, FirstIndex, formatType, si_or_bp, 0)
|
||||||
jsonData.shift();
|
jsonData.shift();
|
||||||
|
|||||||
@ -2,14 +2,14 @@
|
|||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="row" style="margin-bottom:1rem;">
|
<!-- <div class="row" style="margin-bottom:1rem;">
|
||||||
<div class="col-6" style="align-self: center;">
|
<div class="col-6" style="align-self: center;">
|
||||||
<h4 style="position: relative;">Policy Type List</h4>
|
<h4 style="position: relative;">Policy Type List</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6" style="text-align: right; position: relative;top: 56px;">
|
<div class="col-6" style="text-align: right; position: relative;top: 56px;">
|
||||||
<a href="<?= base_url("master/policy/create"); ?>" type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="" data-placement="top" title="Add" data-trigger="hover">ADD</a>
|
<a href="<?= base_url("master/policy/create"); ?>" type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="" data-placement="top" title="Add" data-trigger="hover">ADD</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> -->
|
||||||
<table class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
|
<table class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
|
||||||
id="tickets-table">
|
id="tickets-table">
|
||||||
<thead class="bg-light">
|
<thead class="bg-light">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user