diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index c762866e..a272f609 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -5618,17 +5618,18 @@ class PolicyTransactionController extends BaseController $policy_end_date = trim($row[11]); $revenue_type = trim($row[12]); - $base_premium = trim($row[16]); - $non_commission_premium_amount = trim($row[17]); - $tp_premium = trim($row[18]); - $igst = trim($row[19]); - $cgst = trim($row[20]); - $sgst = trim($row[21]); - $stamp_duty = trim($row[22]); + $base_premium = cleanNumber($row[16]); + $non_commission_premium_amount = cleanNumber($row[17]); + $tp_premium = cleanNumber($row[18]); + $igst = cleanNumber($row[19]); + $cgst = cleanNumber($row[20]); + $sgst = cleanNumber($row[21]); + $stamp_duty = cleanNumber($row[22]); + $agreed_amount = cleanNumber($row[23]); + $agreed_bp_percentage = cleanNumber($row[24]); + $agreed_tp_percentage = cleanNumber($row[25]); + // $total = trim($row[23]); - $agreed_amount = trim($row[23]); - $agreed_bp_percentage = trim($row[24]); - $agreed_tp_percentage = trim($row[25]); // $actual_bp_amount = trim($row[27]); // $actual_tp_amount = trim($row[28]); // $actual_bp_percentage = trim($row[29]); @@ -5647,16 +5648,16 @@ class PolicyTransactionController extends BaseController $rewards = 0; $calculation = calculateMotorPolicyAmounts([ - 'base_premium' => trim($row[16]), - 'non_commission_premium_amount' => trim($row[17]), - 'tp_premium' => trim($row[18]), - 'igst' => trim($row[19]), - 'cgst' => trim($row[20]), - 'sgst' => trim($row[21]), - 'stamp_duty' => trim($row[22]), - 'agreed_amount' => trim($row[23]), - 'agreed_bp_percentage' => trim($row[24]), - 'agreed_tp_percentage' => trim($row[25]), + 'base_premium' => $base_premium, + 'non_commission_premium_amount' => $non_commission_premium_amount, + 'tp_premium' => $tp_premium, + 'igst' => $igst, + 'cgst' => $cgst, + 'sgst' => $sgst, + 'stamp_duty' => $stamp_duty, + 'agreed_amount' => $agreed_amount, + 'agreed_bp_percentage' => $agreed_bp_percentage, + 'agreed_tp_percentage' => $agreed_tp_percentage, 'standard_bp_percentage' => 15.00, 'standard_tp_percentage' => 2.5 ]); diff --git a/app/Helpers/excel_util_helper.php b/app/Helpers/excel_util_helper.php index 9419d6e1..f4540849 100755 --- a/app/Helpers/excel_util_helper.php +++ b/app/Helpers/excel_util_helper.php @@ -3072,6 +3072,8 @@ if (!function_exists('validate_mobile_value')) { if (!function_exists('validate_positive_number_value')) { function validate_positive_number_value($value) { + $value = cleanNumber($value); + if ($value === "" || $value === null) { return ['status' => true, 'error' => null]; } diff --git a/app/Helpers/utility_helper.php b/app/Helpers/utility_helper.php index c5237bc5..c0657c30 100755 --- a/app/Helpers/utility_helper.php +++ b/app/Helpers/utility_helper.php @@ -1382,3 +1382,16 @@ if (! function_exists('add_google_calender_event')) { } } } + +if (! function_exists('cleanNumber')) { + + function cleanNumber($value){ + if (empty($value)) { + return 0; + } + + $value = str_replace(',', '', trim($value)); + return is_numeric($value) ? (float)$value : 0; + } + +} \ No newline at end of file