CHANGE_HELPERT : RV
This commit is contained in:
parent
25ab921812
commit
778e2ee0b3
@ -741,7 +741,6 @@ if (!function_exists('check_cd_entry_exist')) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('expected_amount_calc')) {
|
||||
function expected_amount_calc($data, $index)
|
||||
{
|
||||
@ -786,46 +785,3 @@ if (!function_exists('expected_amount_calc')) {
|
||||
return round($expectedAmount, 2); // Optional: round to 2 decimal places
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user