FIX_FAMILY_FLOATER

This commit is contained in:
Srinivas-Saravanan 2025-05-29 15:25:30 +05:30
parent 1d2481f5b3
commit 0cce649fac
4 changed files with 1014 additions and 1175 deletions

View File

@ -493,11 +493,9 @@ class PolicyTransactionController extends BaseController
'actual_bp_brokerage_amt' => $data['actual_bp_brokerage_amt'][$index] ?? 0,
'actual_tp_brokerage_amt' => $data['actual_tp_brokerage_amt'][$index] ?? 0,
'actual_tep_brokerage_amt' => $data['actual_tep_brokerage_amt'][$index] ?? 0,
'exp_amt' => $data['exp_amt'][$index] ?? 0,
'amount' => $data['total'][$index] ?? 0,
'exp_amt' => isset($data['exp_amt'][$index]) && !empty($data['exp_amt'][$index]) ? $data['exp_amt'][$index] : expected_amount_calc($data, $index), 'amount' => $data['total'][$index] ?? 0,
'stamp_duty' => $data['stamp_duty'][$index] ?? 0,
'cop_amt' => $data['co_premium'][$index] ?? 0,
'variance' => $data['variance'][$index] ?? 0,
'cop_amt' => isset($data['co_premium'][$index]) && !empty($data['co_premium'][$index]) ? $data['co_premium'][$index] : ($data['base_premium'][$index] ?? 0), 'variance' => $data['variance'][$index] ?? 0,
'reward' => $data['reward'][$index] ?? null,
'created_by' => get_session_userid() ?? null,
'updated_by' => get_session_userid() ?? null,

File diff suppressed because it is too large Load Diff

View File

@ -743,3 +743,42 @@ if (!function_exists('check_cd_entry_exist')) {
if (!function_exists('expected_amount_calc')) {
function expected_amount_calc($data, $index)
{
$agreed_amount = (int)($data['agreed_amount'][$index] ?? 0);
$agreed_bp_per = (int)$data['agreed_bp'][$index] ?? 0;
$agreed_tp_per = (int)$data['agreed_tp'][$index] ?? 0;
$agreed_tep_per = (int)$data['agreed_ter'][$index] ?? 0;
$standard_bp_per = (int)$data['standard_bp'][$index] ?? 0;
$standard_tp_per = (int)$data['standard_tp'][$index] ?? 0;
$standard_tep_per = (int)$data['standard_ter'][$index] ?? 0;
$base_premium = (int)$data['base_premium'][$index] ?? 0;
$third_part_premium = (int)$data['tp_premium'][$index] ?? 0;
$terrisom_premium = (int)$data['ter_premium'][$index] ?? 0;
$sum_of_agreed_premium =$agreed_bp_per + $agreed_tp_per + $agreed_tep_per;
$expectedAmount = 0;
if ($agreed_amount > 0) {
$expectedAmount = $agreed_amount;
} elseif ($sum_of_agreed_premium > 0) {
$sum_of_bp_amt = ($base_premium * $agreed_bp_per) / 100;
$sum_of_tp_amt = ($third_part_premium * $agreed_tp_per) / 100;
$sum_of_tep_amt = ($terrisom_premium * $agreed_tep_per) / 100;
$expectedAmount = $sum_of_bp_amt + $sum_of_tp_amt + $sum_of_tep_amt;
} else {
$sum_of_bp_amt = ($base_premium * $standard_bp_per) / 100;
$sum_of_tp_amt = ($third_part_premium * $standard_tp_per) / 100;
$sum_of_tep_amt = ($terrisom_premium * $standard_tep_per) / 100;
$expectedAmount = $sum_of_bp_amt + $sum_of_tp_amt + $sum_of_tep_amt;
}
return $expectedAmount;
}
}

View File

@ -140,8 +140,8 @@
</div>
<div class="col-md-6">
<input type="radio" name="family_floater" class="family_floater" value="1"> Yes
<input type="radio" name="family_floater" class="family_floater" value="0" style="margin-left:10px">No
<input type="radio" id="familyFloaterYes" name="family_floater" class="family_floater" value="1"> Yes
<input type="radio" id="familyFloaterNo" name="family_floater" class="family_floater" value="0" style="margin-left:10px">No
</div>
<div class="col-md-4">
@ -1207,6 +1207,21 @@
}
}
if (key === "family_floater") {
if (jsonObject[key] === "Floater") {
setTimeout(() => {
$("#familyFloaterYes").prop("checked", true);
}, 100); // delay in milliseconds
} else {
$("#familyFloaterNo").prop("checked", true);
}
}
if (key.includes("family_floaters")) {
let checkboxes = document.querySelectorAll(
@ -1279,6 +1294,7 @@
element.parentElement.parentElement
.parentElement.nextElementSibling.style
.display = '';
// alert('family floater');
} else if (element.name ===
"waiverofpreexistingdiseases") {
element.parentElement.parentElement