CHANGE_ENROLLMENT_FILE_UPLOAD_CR : RV
This commit is contained in:
parent
ecf469842a
commit
707d4710d9
@ -2557,6 +2557,7 @@ class ClientController extends AdminController
|
||||
// $data['special_condition_label'] = str_replace(',', '', $this->request->getPost("special_condition_label")) ?? [];
|
||||
// $data['special_condition_input'] = str_replace(',', '', $this->request->getPost("special_condition_input")) ?? [];
|
||||
// $data['multiple_sum_insured'] = str_replace(',', '', $this->request->getPost("multiple_sum_insured")) ?? [];
|
||||
|
||||
$fields = [
|
||||
'waiverofpreexistingdiseases' => false,
|
||||
'waiverof1,2,3&4thyearexclusions' => false,
|
||||
@ -2611,6 +2612,8 @@ class ClientController extends AdminController
|
||||
|
||||
if ($value !== null && $value !== '') {
|
||||
$data[$field] = $needsCleanup ? str_replace(',', '', $value) : $value;
|
||||
}else{
|
||||
$data[$field] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2877,6 +2880,8 @@ class ClientController extends AdminController
|
||||
try {
|
||||
$this->myLogger->logme('error', 'Policy GPA Terms CREATE function called');
|
||||
|
||||
// print_r($this->request->getPost()); die;
|
||||
|
||||
/*** Client Policy Table Primary Key(ID) ***/
|
||||
$client_policy_id = $this->request->getPost("client_policy_id");
|
||||
|
||||
@ -2948,6 +2953,8 @@ class ClientController extends AdminController
|
||||
$value = $this->request->getPost($field);
|
||||
if ($value !== null) {
|
||||
$data[$field] = str_replace(',', '', $value);
|
||||
}else{
|
||||
$data[$field] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2956,6 +2963,8 @@ class ClientController extends AdminController
|
||||
$value = $this->request->getPost($field);
|
||||
if ($value !== null) {
|
||||
$data[$field] = $value;
|
||||
}else{
|
||||
$data[$field] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -199,13 +199,21 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
$totals = round($totals, 2);
|
||||
|
||||
if($export_data['insurer_or_tpa'] == 'insurer') //check CD amt related issue for only insurer, not tpa
|
||||
//check CD amt insufficient only insurer, not tpa // DO NOT REMOVE THIS
|
||||
if($export_data['insurer_or_tpa'] == 'insurer')
|
||||
{
|
||||
if (!empty($cash_balance)) {
|
||||
if ((int) $cash_balance['balance'] < (int) $totals) {
|
||||
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount.');
|
||||
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount. CASH BALANCE : {balance} and TOTAL AMOUNT : {total}', ['balance' => $cash_balance['balance'], 'total' => $totals]);
|
||||
return 0;
|
||||
session()->set('cd_balance', false);
|
||||
session()->set('cd_amount', $cash_balance['balance']);
|
||||
session()->set('excel_file_amt', $totals);
|
||||
}else{
|
||||
session()->set('cd_balance', true);
|
||||
session()->set('cd_amount', $cash_balance['balance']);
|
||||
session()->set('excel_file_amt', $totals);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -700,13 +708,21 @@ class EmpDataServiceController extends BaseController
|
||||
// echo '<pre>';
|
||||
// print_r($ids); die;
|
||||
|
||||
if($export_data['insurer_or_tpa'] == 'insurer') //check CD amt related issue for only insurer, not tpa
|
||||
//check CD amt insufficiend for only insurer, not tpa // DO NOT REMOVE THIS
|
||||
if($export_data['insurer_or_tpa'] == 'insurer')
|
||||
{
|
||||
if (!empty($cash_balance)) {
|
||||
if ((int) $cash_balance['balance'] < (int) $rounded_totals) {
|
||||
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount.');
|
||||
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount. CASH BALANCE : {balance} and TOTAL AMOUNT : {total}', ['balance' => $cash_balance['balance'], 'total' => $totals]);
|
||||
return 0;
|
||||
session()->set('cd_balance', false);
|
||||
session()->set('cd_amount', $cash_balance['balance']);
|
||||
session()->set('excel_file_amt', $rounded_totals);
|
||||
}else{
|
||||
session()->set('cd_balance', true);
|
||||
session()->set('cd_amount', $cash_balance['balance']);
|
||||
session()->set('excel_file_amt', $rounded_totals);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1003,22 +1019,29 @@ class EmpDataServiceController extends BaseController
|
||||
$cash_balance['balance'] = $balance['opening_bal'];
|
||||
}
|
||||
|
||||
// Calculate the total amount from the objects
|
||||
$totals = 0;
|
||||
foreach ($inceptionData as $item) {
|
||||
$totals = $totals + $item->total;
|
||||
}
|
||||
|
||||
|
||||
// Calculate the total amount from the objects
|
||||
$totals = 0;
|
||||
foreach ($inceptionData as $item) {
|
||||
$totals = $totals + $item->total;
|
||||
}
|
||||
$totals = round($totals, 2);
|
||||
|
||||
if($export_data['insurer_or_tpa'] != 'tpa')// check overal emp premium amt with cd balance only for insurer export, not tpa export
|
||||
|
||||
if($export_data['insurer_or_tpa'] != 'tpa')// check overal emp premium amt with cd balance only for insurer export, not tpa export
|
||||
{
|
||||
if (!empty($cash_balance)) {
|
||||
if ((int) $cash_balance['balance'] < (int) $totals) {
|
||||
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount.');
|
||||
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount. CASH BALANCE : {balance} and TOTAL AMOUNT : {total}', ['balance' => $cash_balance['balance'], 'total' => $totals]);
|
||||
return 0;
|
||||
session()->set('cd_balance', false);
|
||||
session()->set('cd_amount', $cash_balance['balance']);
|
||||
session()->set('excel_file_amt', $totals);
|
||||
}else{
|
||||
session()->set('cd_balance', true);
|
||||
session()->set('cd_amount', $cash_balance['balance']);
|
||||
session()->set('excel_file_amt', $totals);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1359,6 +1382,8 @@ class EmpDataServiceController extends BaseController
|
||||
$batch_code = $file['batch_code'];
|
||||
$user_id = $file['created_by'];
|
||||
|
||||
$client_policy_data = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||
|
||||
$insurer_or_tpa = $file['insurer_or_tpa'];
|
||||
if ($insurer_or_tpa == 'tpa') {
|
||||
$id = 'tpa_id';
|
||||
@ -1516,37 +1541,40 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
//--- TPA ID Duplicate check start ---
|
||||
|
||||
$current_tpa_id = $excel_data[$key][13];
|
||||
// Duplicate checking for only GMC's and GPA
|
||||
if(in_array($client_policy_data['policy_type_id'], [1,2,3,4,5])){
|
||||
$current_tpa_id = $excel_data[$key][13];
|
||||
|
||||
if (isset($tpa_id_all[$current_tpa_id])) {
|
||||
if (isset($tpa_id_all[$current_tpa_id])) {
|
||||
|
||||
// Add the current row to errors
|
||||
$errors[$key][] = [
|
||||
'row' => $key,
|
||||
'column' => 13,
|
||||
'db_data' => "Duplicate TPA ID Found",
|
||||
'excel_data' => $current_tpa_id
|
||||
];
|
||||
|
||||
// Add all existing rows with the same TPA ID to errors
|
||||
foreach ($tpa_id_all[$current_tpa_id] as $existing_row) {
|
||||
$errors[$existing_row][] = [
|
||||
'row' => $existing_row,
|
||||
// Add the current row to errors
|
||||
$errors[$key][] = [
|
||||
'row' => $key,
|
||||
'column' => 13,
|
||||
'db_data' => "Duplicate TPA ID Found",
|
||||
'excel_data' => $current_tpa_id
|
||||
];
|
||||
}
|
||||
|
||||
// Add all existing rows with the same TPA ID to errors
|
||||
foreach ($tpa_id_all[$current_tpa_id] as $existing_row) {
|
||||
$errors[$existing_row][] = [
|
||||
'row' => $existing_row,
|
||||
'column' => 13,
|
||||
'db_data' => "Duplicate TPA ID Found",
|
||||
'excel_data' => $current_tpa_id
|
||||
];
|
||||
}
|
||||
|
||||
} else {
|
||||
if($current_tpa_id != "" && $current_tpa_id != null){
|
||||
$tpa_id_all[$current_tpa_id][] = $key;
|
||||
}
|
||||
} else {
|
||||
if($current_tpa_id != "" && $current_tpa_id != null){
|
||||
$tpa_id_all[$current_tpa_id][] = $key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--- TPA ID Duplicate check end ---
|
||||
|
||||
if ($insurer_or_tpa == 'tpa') {
|
||||
if ($insurer_or_tpa == 'tpa' && in_array($client_policy_data['policy_type_id'], [1,2,3,4,5])) {
|
||||
|
||||
if ($excel_data[$key][13] === null) {
|
||||
$missing_id[$key][] = [
|
||||
@ -1688,7 +1716,7 @@ class EmpDataServiceController extends BaseController
|
||||
];
|
||||
}
|
||||
|
||||
if ($insurer_or_tpa == 'tpa') {
|
||||
if ($insurer_or_tpa == 'tpa' && in_array($client_policy_data['policy_type_id'], [1,2,3,4,5])) {
|
||||
|
||||
if ($emp_value['uhid'] != $excel_data[$key][14]) {
|
||||
$errors[$key][] = [
|
||||
@ -1699,7 +1727,7 @@ class EmpDataServiceController extends BaseController
|
||||
];
|
||||
}
|
||||
|
||||
} else if ($insurer_or_tpa == 'insurer') {
|
||||
} else if ($insurer_or_tpa == 'insurer' && in_array($client_policy_data['policy_type_id'], [1,2,3,4,5])) {
|
||||
|
||||
if ($emp_value['tpa_id'] != $excel_data[$key][13]) {
|
||||
$errors[$key][] = [
|
||||
|
||||
@ -305,7 +305,8 @@ class EmployeeController extends AdminController
|
||||
$data['actions'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement'];
|
||||
// $data['actions'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement','enrollment' => 'Enrolment'];
|
||||
|
||||
$data['import_or_export'] = ['import' => 'Import', 'export' => 'Export'];
|
||||
// $data['import_or_export'] = ['import' => 'Import', 'export' => 'Export'];
|
||||
$data['import_or_export'] = ['import' => 'Upload', 'export' => 'Download'];
|
||||
$data['insurer_or_tpa'] = ['insurer' => 'Insurer', 'tpa' => 'TPA'];
|
||||
|
||||
// $data['fileList'] = $this->fileModel
|
||||
|
||||
@ -765,7 +765,12 @@ class PolicyTransactionModel extends Model
|
||||
),
|
||||
2
|
||||
) AS unbilled_amt,
|
||||
created_user.first_name as user_name
|
||||
created_user.first_name as user_name,
|
||||
CASE
|
||||
WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no`
|
||||
WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no`
|
||||
ELSE `policy_transaction`.`policy_no` -- Default fallback
|
||||
END AS `policy_no`
|
||||
|
||||
")
|
||||
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
|
||||
@ -986,7 +991,12 @@ class PolicyTransactionModel extends Model
|
||||
pt_co_share_details.tp_amt AS tp,
|
||||
clients.pan,
|
||||
DATE_FORMAT(policy_transaction.created_at, '%d %b %Y %h:%i %p') AS created_at,
|
||||
user_profiles.first_name as user_name
|
||||
user_profiles.first_name as user_name,
|
||||
CASE
|
||||
WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no`
|
||||
WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no`
|
||||
ELSE `policy_transaction`.`policy_no` -- Default fallback
|
||||
END AS `policy_no`
|
||||
")
|
||||
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
|
||||
->join('clients', 'clients.id = policy_transaction.client_id', 'left')
|
||||
@ -1049,8 +1059,8 @@ class PolicyTransactionModel extends Model
|
||||
|
||||
// Optimize Query Execution
|
||||
$builder->orderBy('policy_transaction.id', 'desc');
|
||||
|
||||
return $builder->get()->getResultArray();
|
||||
$data = $builder->get()->getResultArray();
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
@ -1065,7 +1075,12 @@ class PolicyTransactionModel extends Model
|
||||
client_branch.branch_name as client_branch_name,
|
||||
insurers.name AS insurer_name,
|
||||
insurers.short_name AS insurer_short_name,
|
||||
policy_type.policy_type
|
||||
policy_type.policy_type ,
|
||||
CASE
|
||||
WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no`
|
||||
WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no`
|
||||
ELSE `policy_transaction`.`policy_no` -- Default fallback
|
||||
END AS `policy_no`
|
||||
')
|
||||
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
|
||||
->join('clients', 'policy_transaction.client_id = clients.id', 'left')
|
||||
@ -1228,7 +1243,12 @@ class PolicyTransactionModel extends Model
|
||||
AND co_share_stmt_details.is_active = 1
|
||||
),
|
||||
2
|
||||
) AS variance_amt
|
||||
) AS variance_amt,
|
||||
CASE
|
||||
WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no`
|
||||
WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no`
|
||||
ELSE `policy_transaction`.`policy_no` -- Default fallback
|
||||
END AS `policy_no`
|
||||
|
||||
|
||||
")
|
||||
@ -1317,7 +1337,6 @@ class PolicyTransactionModel extends Model
|
||||
'clients.client_name',
|
||||
'insurers.name AS insurer_name',
|
||||
'policy_type.policy_type',
|
||||
'policy_transaction.policy_no',
|
||||
'policy_transaction.endorsement_no',
|
||||
"CASE
|
||||
WHEN policy_transaction.action_type = 'inception' THEN 'I'
|
||||
@ -1327,7 +1346,12 @@ class PolicyTransactionModel extends Model
|
||||
'pt_co_share_details.bp_amt',
|
||||
'pt_co_share_details.tp_amt',
|
||||
'pt_co_share_details.tep_amt',
|
||||
'policy_transaction.status'
|
||||
'policy_transaction.status',
|
||||
'CASE
|
||||
WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no`
|
||||
WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no`
|
||||
ELSE `policy_transaction`.`policy_no` -- Default fallback
|
||||
END AS `policy_no`'
|
||||
])
|
||||
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
|
||||
->join('clients', 'clients.id = policy_transaction.client_id', 'left')
|
||||
@ -1417,7 +1441,12 @@ class PolicyTransactionModel extends Model
|
||||
policy_transaction.action_type AS action_type_full,
|
||||
pt_co_share_details.exp_amt,
|
||||
pt_co_share_details.variance,
|
||||
policy_transaction.status
|
||||
policy_transaction.status,
|
||||
CASE
|
||||
WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no`
|
||||
WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no`
|
||||
ELSE `policy_transaction`.`policy_no` -- Default fallback
|
||||
END AS `policy_no`
|
||||
")
|
||||
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
|
||||
->join('clients', 'clients.id = policy_transaction.client_id', 'left')
|
||||
@ -1490,7 +1519,6 @@ class PolicyTransactionModel extends Model
|
||||
clients.client_name,
|
||||
insurers.name AS insurer_name,
|
||||
policy_type.policy_type,
|
||||
policy_transaction.policy_no,
|
||||
policy_transaction.endorsement_no,
|
||||
CASE
|
||||
WHEN policy_transaction.action_type = 'inception' THEN 'I'
|
||||
@ -1525,7 +1553,12 @@ class PolicyTransactionModel extends Model
|
||||
inv_payment_details.statement_id = insurer_statements.id
|
||||
AND inv_payment_details.is_active = 1
|
||||
),
|
||||
2) AS outstanding_amount
|
||||
2) AS outstanding_amount,
|
||||
CASE
|
||||
WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no`
|
||||
WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no`
|
||||
ELSE `policy_transaction`.`policy_no` -- Default fallback
|
||||
END AS `policy_no`
|
||||
")
|
||||
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
|
||||
->join('insurer_statements', 'pt_co_share_details.statement_id = insurer_statements.id', 'left')
|
||||
|
||||
@ -62,8 +62,8 @@
|
||||
<!-- <td><?php echo isset($file['policy_name']) ? $file['policy_name'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?> - <?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?></td> -->
|
||||
<td><?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?></td>
|
||||
<td><?php echo $file['event_type'] ?></td>
|
||||
<td><?php echo $file['insurer_or_tpa'] ?></td>
|
||||
<td><?php echo $file['actions'] ?></td>
|
||||
<td><?php echo $insurer_or_tpa[$file['insurer_or_tpa']] ?></td>
|
||||
<td><?php echo $import_or_export[$file['actions']] ?></td>
|
||||
<td><?php echo $file['count'] == null ? '-' : $file['count'] ?></td>
|
||||
|
||||
<td><?php echo format_indian_number($file['amount'])?></td>
|
||||
|
||||
@ -1,5 +1,26 @@
|
||||
<div class="tab-pane fade" id="police-tab">
|
||||
<style>
|
||||
|
||||
.save-indicator {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
background: #28a745;
|
||||
color: white;
|
||||
padding: 2px 8px;
|
||||
border-radius: 10px;
|
||||
font-size: 11px;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s;
|
||||
}
|
||||
|
||||
.save-indicator.show {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="save-indicator" id="saveIndicator">Saved</div>
|
||||
<div class="tab-pane fade" id="police-tab">
|
||||
|
||||
<div class="row float-right" style="padding-bottom: 10px; position: relative;right: 13px;">
|
||||
<button type="button" id="BtnAdd" class="btn btn-primary waves-effect waves-light btnAdd btn-sm" style="position: relative;right: 10px;"><span class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add Policy</button>
|
||||
@ -7,9 +28,8 @@
|
||||
</div>
|
||||
|
||||
<div class="table-responsive" id="table_list">
|
||||
|
||||
<table class="table table-borderless table mb-0" id="table-client-policy">
|
||||
<thead class="thead-light">
|
||||
<table class="table table-borderless table mb-0" id="table-client-policy">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>Insurer</th>
|
||||
<th>Policy</th>
|
||||
@ -198,6 +218,7 @@
|
||||
</div>
|
||||
</div> <!-- end col-->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- end -->
|
||||
|
||||
@ -237,8 +258,7 @@
|
||||
</div>
|
||||
</div><!-- /.modal -->
|
||||
|
||||
<script>
|
||||
|
||||
<script>
|
||||
// $('#inception_type').change(function () {
|
||||
// var open_data = $('#open_date').parent();
|
||||
// var close_data = $('#close_date').parent();
|
||||
@ -259,6 +279,8 @@
|
||||
|
||||
var policy_PrimaryKey = $('#client_id_policy').val();
|
||||
var policy_client = $('#policy_PrimaryKey').val();
|
||||
var submitInterval = null;
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
// Initialize select2
|
||||
@ -325,6 +347,7 @@
|
||||
|
||||
|
||||
if (policy_PrimaryKey !== '') {
|
||||
|
||||
var policyTable = '';
|
||||
var data = <?= isset($client_policy) ? json_encode($client_policy) : '[]' ?>;
|
||||
console.log('client_policy_data',data)
|
||||
@ -395,7 +418,7 @@
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" data-toggle="modal"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" ><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rack Rate</a>`;
|
||||
|
||||
// Conditionally render the delete option based on the role
|
||||
@ -639,7 +662,7 @@
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" data-toggle="modal"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" ><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rack Rate</a>`;
|
||||
|
||||
// Conditionally render the delete option based on the role
|
||||
@ -1106,7 +1129,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function checkDateStatus(inputDate, bg = false) {
|
||||
|
||||
var givenDate = new Date(inputDate);
|
||||
@ -1250,7 +1272,6 @@
|
||||
return result.trim();
|
||||
}
|
||||
|
||||
|
||||
function onlyNumbers(event) {
|
||||
var charcode;
|
||||
charcode = event.which || event.keyCode;
|
||||
@ -1258,7 +1279,6 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function formatNumber(input, maxLength) {
|
||||
|
||||
//console.log("input", input);
|
||||
@ -1350,7 +1370,6 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
$('#policy_type').change(function() {
|
||||
|
||||
$('#insurer').val('').change();
|
||||
@ -2110,6 +2129,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
// for CD master
|
||||
$('#cd_ac_no').change(function(){
|
||||
|
||||
let cd_ac_no = $(this).val();
|
||||
@ -2138,5 +2158,119 @@
|
||||
$('#insurer_branch_id').val(firstPart).trigger('change');
|
||||
$('#insurer_id_for_cd').val(secondPart).trigger('change');
|
||||
}
|
||||
// End
|
||||
|
||||
function numberToWordsIndian(num) {
|
||||
|
||||
num = num.toString();
|
||||
if (typeof num === 'string') {
|
||||
// Remove all commas and convert to number
|
||||
num = parseFloat(num.replace(/,/g, ''));
|
||||
// Check if conversion resulted in NaN
|
||||
if (isNaN(num)) {
|
||||
return "invalid number";
|
||||
}
|
||||
}
|
||||
|
||||
if (num === 0) return "zero";
|
||||
if (num < 0) return "minus " + numberToWordsIndian(-num);
|
||||
|
||||
const ones = [
|
||||
"", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine",
|
||||
"ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen",
|
||||
"seventeen", "eighteen", "nineteen"
|
||||
];
|
||||
|
||||
const tens = [
|
||||
"", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"
|
||||
];
|
||||
|
||||
function convertHundreds(n) {
|
||||
let result = "";
|
||||
|
||||
if (n >= 100) {
|
||||
result += ones[Math.floor(n / 100)] + " hundred";
|
||||
n %= 100;
|
||||
if (n > 0) result += " ";
|
||||
}
|
||||
|
||||
if (n >= 20) {
|
||||
result += tens[Math.floor(n / 10)];
|
||||
n %= 10;
|
||||
if (n > 0) result += " " + ones[n];
|
||||
} else if (n > 0) {
|
||||
result += ones[n];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
let result = "";
|
||||
let crores = Math.floor(num / 10000000);
|
||||
num %= 10000000;
|
||||
|
||||
let lakhs = Math.floor(num / 100000);
|
||||
num %= 100000;
|
||||
|
||||
let thousands = Math.floor(num / 1000);
|
||||
num %= 1000;
|
||||
|
||||
let hundreds = num;
|
||||
|
||||
if (crores > 0) {
|
||||
result += convertHundreds(crores) + " crore";
|
||||
if (lakhs > 0 || thousands > 0 || hundreds > 0) result += " ";
|
||||
}
|
||||
|
||||
if (lakhs > 0) {
|
||||
result += convertHundreds(lakhs) + " lakh";
|
||||
if (thousands > 0 || hundreds > 0) result += " ";
|
||||
}
|
||||
|
||||
if (thousands > 0) {
|
||||
result += convertHundreds(thousands) + " thousand";
|
||||
if (hundreds > 0) result += " ";
|
||||
}
|
||||
|
||||
if (hundreds > 0) {
|
||||
result += convertHundreds(hundreds);
|
||||
}
|
||||
|
||||
return result.trim();
|
||||
}
|
||||
|
||||
// Start the interval
|
||||
function startAutoSubmit(attrId) {
|
||||
if (!submitInterval) {
|
||||
submitInterval = setInterval(function() {
|
||||
if(attrId == "GMC"){
|
||||
autoSaveGmcTerms();
|
||||
}else if(attrId == "GPA"){
|
||||
autoSaveGpaTerms();
|
||||
}else if(attrId == "OTHERS"){
|
||||
autoSaveOtherTerms();
|
||||
}
|
||||
}, 20000);
|
||||
console.log("Auto-submit started.");
|
||||
}
|
||||
}
|
||||
|
||||
// Stop the interval
|
||||
function stopAutoSubmit() {
|
||||
if (submitInterval) {
|
||||
clearInterval(submitInterval);
|
||||
submitInterval = null;
|
||||
console.log("Auto-submit stopped.");
|
||||
}
|
||||
}
|
||||
|
||||
//Tiny Toastr
|
||||
function showTinyToast(attrId = "saveIndicator"){
|
||||
const saveIndicator = document.getElementById(attrId);
|
||||
saveIndicator.classList.add('show');
|
||||
setTimeout(() => {
|
||||
saveIndicator.classList.remove('show');
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -89,7 +89,7 @@ input:checked + .slider:before {
|
||||
<input id="addition_add_day" type="checkbox" name="addition_add_day" <?= (isset($insurer['addition_add_day']) && $insurer['addition_add_day'] == 1) ? 'checked' : '' ?>>
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
<label for="addition_add_day" style="position: relative;top: 30px;left: 82px;">Add one day to date of coverage when Addition/Dependent addition</label>
|
||||
<label for="addition_add_day" style="position: relative;top: 30px;left: 82px;">Add one day to date of coverage when <br> Addition/Dependent addition</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
|
||||
@ -80,7 +80,7 @@
|
||||
<th>S.NO</th>
|
||||
<th>Policy Type</th>
|
||||
<th>Event Type</th>
|
||||
<th>Import/Export</th>
|
||||
<th>Upload/Download</th>
|
||||
<th>Template</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
@ -92,7 +92,7 @@
|
||||
<td><?= $key+1; ?></td>
|
||||
<td><?= $value['policy_type']; ?></td>
|
||||
<td><?= $events[$value['event_name']]; ?></td>
|
||||
<td><?= $value['type_name']; ?></td>
|
||||
<td><?= $value['type_name'] == 'import' ? 'Upload' : 'Download'; ?></td>
|
||||
<td style="overflow: hidden;" class="truncate" ><?= $value['jsoncolumns']; ?></td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
<li class="nav-item">
|
||||
<a href="#template-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="insurer_export_templete">
|
||||
<span class="mr-1"><i class="mdi mdi-file-export font-16"></i></span>
|
||||
<span class="d-none d-sm-inline-block">Insurer Export Templete</span>
|
||||
<span class="d-none d-sm-inline-block">Insurer Download Templete</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
@ -653,10 +653,8 @@
|
||||
|
||||
});
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
$('#import_excel_download').click(function() {
|
||||
|
||||
// Check if the element with ID "import_excel_download" has the href attribute set
|
||||
@ -682,4 +680,87 @@
|
||||
}
|
||||
});
|
||||
|
||||
//------------- CHECK CD BALANCE in SESSION -----------------------------------------------------------------------------------------
|
||||
|
||||
// Global variables
|
||||
var submitInterval = null;
|
||||
var messageShown = false; // Flag to prevent duplicate messages
|
||||
|
||||
//function for checking the session
|
||||
function checkCDBalance() {
|
||||
|
||||
<?php if (session()->has('cd_balance')): ?>
|
||||
var cdBalance = <?php echo json_encode(session()->get('cd_balance')); ?>;
|
||||
var cdAmount = <?php echo json_encode(session()->get('cd_amount')); ?>;
|
||||
var excel_file_amt = <?php echo json_encode(session()->get('excel_file_amt')); ?>;
|
||||
|
||||
console.log("cdBalance : ", cdBalance);
|
||||
console.log("cdAmount : ", cdAmount);
|
||||
console.log("excel_file_amt : ", excel_file_amt);
|
||||
|
||||
// Only show message once and if status is false
|
||||
if (cdBalance === false && !messageShown) {
|
||||
// toastr.warning('Insufficient CD Balance deducated. Please wait the file will be downloaded', 'WARNING');
|
||||
var message1 = 'Insufficient CD Balance deducted. Please wait the file will be downloaded<br>' +
|
||||
'<strong>CD Amount:</strong> ₹' + (cdAmount || 0) + '<br>' +
|
||||
'<strong>Total Amount:</strong> ₹' + (excel_file_amt || 0);
|
||||
|
||||
toastr.warning(message1, 'WARNING', {
|
||||
allowHtml: true,
|
||||
timeOut: 10000,
|
||||
extendedTimeOut: 3000
|
||||
});
|
||||
messageShown = true; // Prevent showing message again
|
||||
stopInterval();
|
||||
} else if (cdBalance === true) {
|
||||
console.log("CD Balance is sufficient");
|
||||
stopInterval();
|
||||
}
|
||||
|
||||
<?php
|
||||
session()->remove('cd_balance');
|
||||
session()->remove('cd_amount');
|
||||
session()->remove('excel_file_amt');
|
||||
?>
|
||||
|
||||
<?php else: ?>
|
||||
console.log("No cd_balance session found");
|
||||
<?php endif; ?>
|
||||
}
|
||||
|
||||
// Start the interval
|
||||
function startInterval() {
|
||||
if (!submitInterval) {
|
||||
messageShown = false; // Reset message flag
|
||||
submitInterval = setInterval(function() {
|
||||
checkCDBalance();
|
||||
}, 2000);
|
||||
console.log("Checking CD balance started...");
|
||||
}
|
||||
}
|
||||
|
||||
// Stop the interval
|
||||
function stopInterval() {
|
||||
if (submitInterval) {
|
||||
clearInterval(submitInterval);
|
||||
submitInterval = null;
|
||||
<?php
|
||||
session()->remove('cd_balance');
|
||||
session()->remove('cd_amount');
|
||||
session()->remove('excel_file_amt');
|
||||
?>
|
||||
console.log("Interval stopped.");
|
||||
}
|
||||
}
|
||||
|
||||
// When click the button to start the interval
|
||||
$(document).ready(function() {
|
||||
$('#emp_form_submit_button_2').on('click', function() {
|
||||
console.log("Submit button clicked, starting interval...");
|
||||
startInterval();
|
||||
});
|
||||
});
|
||||
|
||||
//------------------------------------------------------------------------------------------------------
|
||||
|
||||
</script>
|
||||
File diff suppressed because it is too large
Load Diff
@ -97,8 +97,6 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<div id="policyGMCTerms" style="display:none">
|
||||
<span id="policyGMCTermsClose"
|
||||
style="float: right;font-size: 26px;color: red;margin-top: -42px;margin-left: 3px;margin-right: 7px;">x</span>
|
||||
@ -878,7 +876,6 @@
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
var policy_grid_id = $('#client_id').val();
|
||||
var grid_html = '';
|
||||
@ -1012,7 +1009,6 @@
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var specialConditions = [];
|
||||
|
||||
$(".removeDom").each(function() {
|
||||
@ -1086,7 +1082,6 @@
|
||||
}, 500);
|
||||
});
|
||||
|
||||
|
||||
$('body').on('click', '.btnPolicyMaster', function() {
|
||||
// alert("HELLO");
|
||||
|
||||
@ -1127,18 +1122,16 @@
|
||||
}, 1000);
|
||||
// $('#nameOfThePolicyInGMC').html(' - ' + response.policy_name.name);
|
||||
$('gmc_emp_count').val(response.count);
|
||||
|
||||
|
||||
|
||||
if (response) {
|
||||
|
||||
if (response.emp_count_by_policy != 0) {
|
||||
|
||||
$('#btnGridSubmit1').hide();
|
||||
$('#myButtonSpecialCondition').hide();
|
||||
|
||||
} else {
|
||||
$('#btnGridSubmit1').show();
|
||||
$('#myButtonSpecialCondition').show();
|
||||
startAutoSubmit('GMC');
|
||||
}
|
||||
|
||||
let jsonObject = JSON.parse(response.data);
|
||||
@ -1558,27 +1551,12 @@
|
||||
$("#numberToWordGMC").text("");
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<!-- Jodit RTE -->
|
||||
<script>
|
||||
// $(document).ready(function() {
|
||||
// var editor = new Jodit('#additionalsicknessbenefit', {
|
||||
// buttons: 'bold,italic,underline,|,align,alignCenter,alignRight,alignJustify',
|
||||
// });
|
||||
|
||||
// var editor = new Jodit('#Wellness', {
|
||||
// buttons: 'bold,italic,underline,|,align,alignCenter,alignRight,alignJustify',
|
||||
// });
|
||||
// });
|
||||
//
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<!-- Policy terms Add Special Condition -->
|
||||
<script>
|
||||
|
||||
document.getElementById('myButtonSpecialCondition').addEventListener('click', function(event) {
|
||||
//console.log('specialCondition callback clicked')
|
||||
event.preventDefault();
|
||||
@ -1632,7 +1610,6 @@
|
||||
'multiple_sum_insured'
|
||||
];
|
||||
|
||||
|
||||
function specialCondition(count = 0) {
|
||||
|
||||
//console.log('specialCondition function called')
|
||||
@ -1670,6 +1647,10 @@
|
||||
|
||||
// Close the Policy terms
|
||||
$(document).on('click', '#policyGMCTermsClose', function() {
|
||||
|
||||
//clear the intervel for the autosave
|
||||
stopAutoSubmit();
|
||||
|
||||
$('#policyGMCTerms').css('display', 'none');
|
||||
$('#police-tab').css('display', '');
|
||||
$('.nav.nav-pills.navtab-bg').css('display', '');
|
||||
@ -1930,4 +1911,64 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function autoSaveGmcTerms()
|
||||
{
|
||||
|
||||
console.log("autoSaveGmcTerms function called");
|
||||
|
||||
var specialConditions = [];
|
||||
|
||||
$(".removeDom").each(function() {
|
||||
var isChecked = $(this).find("input[name='special_condition_display[]']").is(":checked");
|
||||
|
||||
if (isChecked) {
|
||||
var label = $(this).find("input[name='special_condition_label[]']").val();
|
||||
var input = $(this).find("input[name='special_condition_input[]']").val();
|
||||
|
||||
specialConditions.push({
|
||||
[label]: input
|
||||
});
|
||||
}
|
||||
});
|
||||
console.log("specialConditions", specialConditions);
|
||||
|
||||
var formData = new FormData($('#policyJsonForm')[0]);
|
||||
console.log("formData", formData);
|
||||
|
||||
var policy_form_action = '<?= base_url("client/policy/policyGMCTerms") ?>';
|
||||
console.log("policy_form_action", policy_form_action);
|
||||
|
||||
formData.append("special_condition_display_value", JSON.stringify(specialConditions));
|
||||
// console.log('formData', formData);
|
||||
formData.forEach((value, key) => {
|
||||
// console.log(key + ':', value);
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: policy_form_action,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
console.log('Auto Save Response : ', res);
|
||||
|
||||
if (res.status == true) {
|
||||
showTinyToast();
|
||||
}else{
|
||||
console.log('Policy terms Dose Not save', 'Error');
|
||||
return;
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
File diff suppressed because it is too large
Load Diff
@ -189,6 +189,7 @@ $(document).on('click', '.close', function() {
|
||||
|
||||
var rarc_rate_json_array = [];
|
||||
|
||||
//Submit function
|
||||
$(document).on('submit', 'form[id^="GridForm_"]', function(event) {
|
||||
console.log('submitted function called')
|
||||
event.preventDefault(); // Prevent the default form submission
|
||||
@ -619,8 +620,6 @@ $('body').on('click', '.btnPolicyModel', function()
|
||||
$('#no_data').html('The policy has no Policy Rack Rate');
|
||||
toastr.warning("The policy has no Policy Rack Rate", "Warning")
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
$(document).on('change', 'select[id^="grid_"]', function(event)
|
||||
|
||||
@ -421,15 +421,15 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<!-- <div class="form-group col-md-3">
|
||||
<label for="bp_cgst">Latest Action Date</label>
|
||||
<input id="last_action_date" type="text" class="form-control" name="last_action_date" placeholder="DD/MM/YYYY">
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<!-- <div class="form-group col-md-3">
|
||||
<label for="fund_received">Fund Recd / Sent to Insurer</label>
|
||||
<input id="fund_received" value="" type="text" class="form-control" name="fund_received">
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label class="switch" style="position: relative;top: 32px;left: 20px;">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user