CHANGE_REMOVE_COLUMNS_IN_BDS_BULK_UPLOAD

This commit is contained in:
VENKATESHWARAN 2025-12-03 13:06:30 +05:30
parent 2275a56fc4
commit 63dc826605
3 changed files with 113 additions and 119 deletions

View File

@ -397,21 +397,21 @@
'params' => null 'params' => null
], ],
'total' => [ // 'total' => [
'col_idx' => 23, // 'col_idx' => 23,
'col_cell_name' => 'X', // 'col_cell_name' => 'X',
'col_name' => 'Total', // 'col_name' => 'Total',
'is_mandatory' => false, // 'is_mandatory' => false,
'data_type' => '', // 'data_type' => '',
'format' => null, // 'format' => null,
'allowed_values' => null, // 'allowed_values' => null,
'custom' => null, // 'custom' => null,
'params' => null // 'params' => null
], // ],
'agreed_amount' => [ 'agreed_amount' => [
'col_idx' => 24, 'col_idx' => 23,
'col_cell_name' => 'Y', 'col_cell_name' => 'X',
'col_name' => 'Agreed Amount', 'col_name' => 'Agreed Amount',
'is_mandatory' => false, 'is_mandatory' => false,
'data_type' => '', 'data_type' => '',
@ -422,8 +422,8 @@
], ],
'agreed_bp_percentage' => [ 'agreed_bp_percentage' => [
'col_idx' => 25, 'col_idx' => 24,
'col_cell_name' => 'Z', 'col_cell_name' => 'Y',
'col_name' => 'Agreed BP Percentage', 'col_name' => 'Agreed BP Percentage',
'is_mandatory' => false, 'is_mandatory' => false,
'data_type' => '', 'data_type' => '',
@ -434,8 +434,8 @@
], ],
'agreed_tp_percentage' => [ 'agreed_tp_percentage' => [
'col_idx' => 26, 'col_idx' => 25,
'col_cell_name' => 'AA', 'col_cell_name' => 'Z',
'col_name' => 'Agreed TP Percentage', 'col_name' => 'Agreed TP Percentage',
'is_mandatory' => false, 'is_mandatory' => false,
'data_type' => '', 'data_type' => '',
@ -445,89 +445,89 @@
'params' => null 'params' => null
], ],
'actual_bp_amount' => [ // 'actual_bp_amount' => [
'col_idx' => 27, // 'col_idx' => 27,
'col_cell_name' => 'AB', // 'col_cell_name' => 'AB',
'col_name' => 'Actual BP Amount', // 'col_name' => 'Actual BP Amount',
'is_mandatory' => false, // 'is_mandatory' => false,
'data_type' => '', // 'data_type' => '',
'format' => null, // 'format' => null,
'allowed_values' => null, // 'allowed_values' => null,
'custom' => null, // 'custom' => null,
'params' => null // 'params' => null
], // ],
'actual_tp_amount' => [ // 'actual_tp_amount' => [
'col_idx' => 28, // 'col_idx' => 28,
'col_cell_name' => 'AC', // 'col_cell_name' => 'AC',
'col_name' => 'Actual TP Amount', // 'col_name' => 'Actual TP Amount',
'is_mandatory' => false, // 'is_mandatory' => false,
'data_type' => '', // 'data_type' => '',
'format' => null, // 'format' => null,
'allowed_values' => null, // 'allowed_values' => null,
'custom' => null, // 'custom' => null,
'params' => null // 'params' => null
], // ],
'actual_bp_percentage' => [ // 'actual_bp_percentage' => [
'col_idx' => 29, // 'col_idx' => 29,
'col_cell_name' => 'AD', // 'col_cell_name' => 'AD',
'col_name' => 'Actual BP Percentage', // 'col_name' => 'Actual BP Percentage',
'is_mandatory' => false, // 'is_mandatory' => false,
'data_type' => '', // 'data_type' => '',
'format' => null, // 'format' => null,
'allowed_values' => null, // 'allowed_values' => null,
'custom' => null, // 'custom' => null,
'params' => null // 'params' => null
], // ],
'actual_tp_percentage' => [ // 'actual_tp_percentage' => [
'col_idx' => 30, // 'col_idx' => 30,
'col_cell_name' => 'AE', // 'col_cell_name' => 'AE',
'col_name' => 'Actual TP Percentage', // 'col_name' => 'Actual TP Percentage',
'is_mandatory' => false, // 'is_mandatory' => false,
'data_type' => '', // 'data_type' => '',
'format' => null, // 'format' => null,
'allowed_values' => null, // 'allowed_values' => null,
'custom' => null, // 'custom' => null,
'params' => null // 'params' => null
], // ],
'actual_bp_brokerage_amount' => [ // 'actual_bp_brokerage_amount' => [
'col_idx' => 31, // 'col_idx' => 31,
'col_cell_name' => 'AF', // 'col_cell_name' => 'AF',
'col_name' => 'Actual BP Brokerage Amount', // 'col_name' => 'Actual BP Brokerage Amount',
'is_mandatory' => false, // 'is_mandatory' => false,
'data_type' => '', // 'data_type' => '',
'format' => null, // 'format' => null,
'allowed_values' => null, // 'allowed_values' => null,
'custom' => null, // 'custom' => null,
'params' => null // 'params' => null
], // ],
'actual_tp_brokerage_amount' => [ // 'actual_tp_brokerage_amount' => [
'col_idx' => 32, // 'col_idx' => 32,
'col_cell_name' => 'AG', // 'col_cell_name' => 'AG',
'col_name' => 'Actual TP Brokerage Amount', // 'col_name' => 'Actual TP Brokerage Amount',
'is_mandatory' => false, // 'is_mandatory' => false,
'data_type' => '', // 'data_type' => '',
'format' => null, // 'format' => null,
'allowed_values' => null, // 'allowed_values' => null,
'custom' => null, // 'custom' => null,
'params' => null // 'params' => null
], // ],
'expected_amount' => [ // 'expected_amount' => [
'col_idx' => 33, // 'col_idx' => 33,
'col_cell_name' => 'AH', // 'col_cell_name' => 'AH',
'col_name' => 'Expected Amount', // 'col_name' => 'Expected Amount',
'is_mandatory' => true, // 'is_mandatory' => true,
'data_type' => '', // 'data_type' => '',
'format' => null, // 'format' => null,
'allowed_values' => null, // 'allowed_values' => null,
'custom' => null, // 'custom' => null,
'params' => null // 'params' => null
], // ],
// 'rewards' => [ // 'rewards' => [
// 'col_idx' => 34, // 'col_idx' => 34,
@ -4566,18 +4566,25 @@
$cgst = trim($row[20]); $cgst = trim($row[20]);
$sgst = trim($row[21]); $sgst = trim($row[21]);
$stamp_duty = trim($row[22]); $stamp_duty = trim($row[22]);
$total = trim($row[23]); // $total = trim($row[23]);
$agreed_amount = trim($row[24]); $agreed_amount = trim($row[23]);
$agreed_bp_percentage = trim($row[25]); $agreed_bp_percentage = trim($row[24]);
$agreed_tp_percentage = trim($row[26]); $agreed_tp_percentage = trim($row[25]);
$actual_bp_amount = trim($row[27]); // $actual_bp_amount = trim($row[27]);
$actual_tp_amount = trim($row[28]); // $actual_tp_amount = trim($row[28]);
$actual_bp_percentage = trim($row[29]); // $actual_bp_percentage = trim($row[29]);
$actual_tp_percentage = trim($row[30]); // $actual_tp_percentage = trim($row[30]);
$actual_bp_brokerage_amount = trim($row[31]); // $actual_bp_brokerage_amount = trim($row[31]);
$actual_tp_brokerage_amount = trim($row[32]); // $actual_tp_brokerage_amount = trim($row[32]);
$expected_amount = trim($row[33]); // $expected_amount = trim($row[33]);
// $rewards = trim($row[34]); // $rewards = trim($row[34]);
$actual_bp_amount = 0;
$actual_tp_amount = 0;
$actual_bp_percentage = 0;
$actual_tp_percentage = 0;
$actual_bp_brokerage_amount = 0;
$actual_tp_brokerage_amount = 0;
$expected_amount = 0;
$rewards = 0; $rewards = 0;
$calculation = calculateMotorPolicyAmounts([ $calculation = calculateMotorPolicyAmounts([
@ -4591,8 +4598,6 @@
'agreed_amount' => trim($row[24]), 'agreed_amount' => trim($row[24]),
'agreed_bp_percentage' => trim($row[25]), 'agreed_bp_percentage' => trim($row[25]),
'agreed_tp_percentage' => trim($row[26]), 'agreed_tp_percentage' => trim($row[26]),
'actual_bp_brokerage_amount' => trim($row[31]),
'actual_tp_brokerage_amount' => trim($row[32]),
'standard_bp_percentage' => 15.00, 'standard_bp_percentage' => 15.00,
'standard_tp_percentage' => 2.5 'standard_tp_percentage' => 2.5
]); ]);
@ -4702,7 +4707,7 @@
'variance' => 0, 'variance' => 0,
'remark' => null, 'remark' => null,
'amount' => $calculation['total_amount'] ?? $total, 'amount' => $calculation['total_amount'] ?? 0,
'stamp_duty' => $stamp_duty, 'stamp_duty' => $stamp_duty,
'cop_amt' => $base_premium, 'cop_amt' => $base_premium,

View File

@ -3402,9 +3402,6 @@ if (!function_exists('calculateMotorPolicyAmounts')) {
$std_bp_per = floatval($data['standard_bp_percentage'] ?? 0); $std_bp_per = floatval($data['standard_bp_percentage'] ?? 0);
$std_tp_per = floatval($data['standard_tp_percentage'] ?? 0); $std_tp_per = floatval($data['standard_tp_percentage'] ?? 0);
$actual_bp_amt = floatval($data['actual_bp_brokerage_amount'] ?? 0);
$actual_tp_amt = floatval($data['actual_tp_brokerage_amount'] ?? 0);
// Determine GST % // Determine GST %
$gst_per = ($igst > 0) ? $igst : ($cgst + $sgst); $gst_per = ($igst > 0) ? $igst : ($cgst + $sgst);
@ -3447,20 +3444,12 @@ if (!function_exists('calculateMotorPolicyAmounts')) {
(($tp * $std_tp_per) / 100); (($tp * $std_tp_per) / 100);
} }
// Variance
$variance =
($actual_bp_amt + $actual_tp_amt) - $expected_amount;
// Final return array // Final return array
return [ return [
'tp_total' => round($tpTotal, 2),
'gst_per' => round($gst_per, 2),
'gst_amount' => round($gst_amount, 2), 'gst_amount' => round($gst_amount, 2),
'total_amount' => round($total_amount, 2), 'total_amount' => round($total_amount, 2),
'expected_amount' => round($expected_amount, 2), 'expected_amount' => round($expected_amount, 2),
'variance' => round($variance, 2),
'actual_bp_amount'=> $actual_bp_amt,
'actual_tp_amount'=> $actual_tp_amt,
]; ];
} catch (\Throwable $e) { } catch (\Throwable $e) {