diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index 1b6385a4..e8ad843e 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -397,21 +397,21 @@ 'params' => null ], - 'total' => [ - 'col_idx' => 23, - 'col_cell_name' => 'X', - 'col_name' => 'Total', - 'is_mandatory' => false, - 'data_type' => '', - 'format' => null, - 'allowed_values' => null, - 'custom' => null, - 'params' => null - ], + // 'total' => [ + // 'col_idx' => 23, + // 'col_cell_name' => 'X', + // 'col_name' => 'Total', + // 'is_mandatory' => false, + // 'data_type' => '', + // 'format' => null, + // 'allowed_values' => null, + // 'custom' => null, + // 'params' => null + // ], 'agreed_amount' => [ - 'col_idx' => 24, - 'col_cell_name' => 'Y', + 'col_idx' => 23, + 'col_cell_name' => 'X', 'col_name' => 'Agreed Amount', 'is_mandatory' => false, 'data_type' => '', @@ -422,8 +422,8 @@ ], 'agreed_bp_percentage' => [ - 'col_idx' => 25, - 'col_cell_name' => 'Z', + 'col_idx' => 24, + 'col_cell_name' => 'Y', 'col_name' => 'Agreed BP Percentage', 'is_mandatory' => false, 'data_type' => '', @@ -434,8 +434,8 @@ ], 'agreed_tp_percentage' => [ - 'col_idx' => 26, - 'col_cell_name' => 'AA', + 'col_idx' => 25, + 'col_cell_name' => 'Z', 'col_name' => 'Agreed TP Percentage', 'is_mandatory' => false, 'data_type' => '', @@ -445,89 +445,89 @@ 'params' => null ], - 'actual_bp_amount' => [ - 'col_idx' => 27, - 'col_cell_name' => 'AB', - 'col_name' => 'Actual BP Amount', - 'is_mandatory' => false, - 'data_type' => '', - 'format' => null, - 'allowed_values' => null, - 'custom' => null, - 'params' => null - ], + // 'actual_bp_amount' => [ + // 'col_idx' => 27, + // 'col_cell_name' => 'AB', + // 'col_name' => 'Actual BP Amount', + // 'is_mandatory' => false, + // 'data_type' => '', + // 'format' => null, + // 'allowed_values' => null, + // 'custom' => null, + // 'params' => null + // ], - 'actual_tp_amount' => [ - 'col_idx' => 28, - 'col_cell_name' => 'AC', - 'col_name' => 'Actual TP Amount', - 'is_mandatory' => false, - 'data_type' => '', - 'format' => null, - 'allowed_values' => null, - 'custom' => null, - 'params' => null - ], + // 'actual_tp_amount' => [ + // 'col_idx' => 28, + // 'col_cell_name' => 'AC', + // 'col_name' => 'Actual TP Amount', + // 'is_mandatory' => false, + // 'data_type' => '', + // 'format' => null, + // 'allowed_values' => null, + // 'custom' => null, + // 'params' => null + // ], - 'actual_bp_percentage' => [ - 'col_idx' => 29, - 'col_cell_name' => 'AD', - 'col_name' => 'Actual BP Percentage', - 'is_mandatory' => false, - 'data_type' => '', - 'format' => null, - 'allowed_values' => null, - 'custom' => null, - 'params' => null - ], + // 'actual_bp_percentage' => [ + // 'col_idx' => 29, + // 'col_cell_name' => 'AD', + // 'col_name' => 'Actual BP Percentage', + // 'is_mandatory' => false, + // 'data_type' => '', + // 'format' => null, + // 'allowed_values' => null, + // 'custom' => null, + // 'params' => null + // ], - 'actual_tp_percentage' => [ - 'col_idx' => 30, - 'col_cell_name' => 'AE', - 'col_name' => 'Actual TP Percentage', - 'is_mandatory' => false, - 'data_type' => '', - 'format' => null, - 'allowed_values' => null, - 'custom' => null, - 'params' => null - ], + // 'actual_tp_percentage' => [ + // 'col_idx' => 30, + // 'col_cell_name' => 'AE', + // 'col_name' => 'Actual TP Percentage', + // 'is_mandatory' => false, + // 'data_type' => '', + // 'format' => null, + // 'allowed_values' => null, + // 'custom' => null, + // 'params' => null + // ], - 'actual_bp_brokerage_amount' => [ - 'col_idx' => 31, - 'col_cell_name' => 'AF', - 'col_name' => 'Actual BP Brokerage Amount', - 'is_mandatory' => false, - 'data_type' => '', - 'format' => null, - 'allowed_values' => null, - 'custom' => null, - 'params' => null - ], + // 'actual_bp_brokerage_amount' => [ + // 'col_idx' => 31, + // 'col_cell_name' => 'AF', + // 'col_name' => 'Actual BP Brokerage Amount', + // 'is_mandatory' => false, + // 'data_type' => '', + // 'format' => null, + // 'allowed_values' => null, + // 'custom' => null, + // 'params' => null + // ], - 'actual_tp_brokerage_amount' => [ - 'col_idx' => 32, - 'col_cell_name' => 'AG', - 'col_name' => 'Actual TP Brokerage Amount', - 'is_mandatory' => false, - 'data_type' => '', - 'format' => null, - 'allowed_values' => null, - 'custom' => null, - 'params' => null - ], + // 'actual_tp_brokerage_amount' => [ + // 'col_idx' => 32, + // 'col_cell_name' => 'AG', + // 'col_name' => 'Actual TP Brokerage Amount', + // 'is_mandatory' => false, + // 'data_type' => '', + // 'format' => null, + // 'allowed_values' => null, + // 'custom' => null, + // 'params' => null + // ], - 'expected_amount' => [ - 'col_idx' => 33, - 'col_cell_name' => 'AH', - 'col_name' => 'Expected Amount', - 'is_mandatory' => true, - 'data_type' => '', - 'format' => null, - 'allowed_values' => null, - 'custom' => null, - 'params' => null - ], + // 'expected_amount' => [ + // 'col_idx' => 33, + // 'col_cell_name' => 'AH', + // 'col_name' => 'Expected Amount', + // 'is_mandatory' => true, + // 'data_type' => '', + // 'format' => null, + // 'allowed_values' => null, + // 'custom' => null, + // 'params' => null + // ], // 'rewards' => [ // 'col_idx' => 34, @@ -4566,18 +4566,25 @@ $cgst = trim($row[20]); $sgst = trim($row[21]); $stamp_duty = trim($row[22]); - $total = trim($row[23]); - $agreed_amount = trim($row[24]); - $agreed_bp_percentage = trim($row[25]); - $agreed_tp_percentage = trim($row[26]); - $actual_bp_amount = trim($row[27]); - $actual_tp_amount = trim($row[28]); - $actual_bp_percentage = trim($row[29]); - $actual_tp_percentage = trim($row[30]); - $actual_bp_brokerage_amount = trim($row[31]); - $actual_tp_brokerage_amount = trim($row[32]); - $expected_amount = trim($row[33]); + // $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]); + // $actual_tp_percentage = trim($row[30]); + // $actual_bp_brokerage_amount = trim($row[31]); + // $actual_tp_brokerage_amount = trim($row[32]); + // $expected_amount = trim($row[33]); // $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; $calculation = calculateMotorPolicyAmounts([ @@ -4591,8 +4598,6 @@ 'agreed_amount' => trim($row[24]), 'agreed_bp_percentage' => trim($row[25]), '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_tp_percentage' => 2.5 ]); @@ -4702,7 +4707,7 @@ 'variance' => 0, 'remark' => null, - 'amount' => $calculation['total_amount'] ?? $total, + 'amount' => $calculation['total_amount'] ?? 0, 'stamp_duty' => $stamp_duty, 'cop_amt' => $base_premium, diff --git a/app/Helpers/excel_util_helper.php b/app/Helpers/excel_util_helper.php index 28ec3083..1c163561 100755 --- a/app/Helpers/excel_util_helper.php +++ b/app/Helpers/excel_util_helper.php @@ -3402,9 +3402,6 @@ if (!function_exists('calculateMotorPolicyAmounts')) { $std_bp_per = floatval($data['standard_bp_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 % $gst_per = ($igst > 0) ? $igst : ($cgst + $sgst); @@ -3447,20 +3444,12 @@ if (!function_exists('calculateMotorPolicyAmounts')) { (($tp * $std_tp_per) / 100); } - // Variance - $variance = - ($actual_bp_amt + $actual_tp_amt) - $expected_amount; // Final return array return [ - 'tp_total' => round($tpTotal, 2), - 'gst_per' => round($gst_per, 2), 'gst_amount' => round($gst_amount, 2), 'total_amount' => round($total_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) { diff --git a/public/sample_excel/sample_bds_bulk_upload_excel.xlsx b/public/sample_excel/sample_bds_bulk_upload_excel.xlsx index b17f79c5..25d1d1be 100644 Binary files a/public/sample_excel/sample_bds_bulk_upload_excel.xlsx and b/public/sample_excel/sample_bds_bulk_upload_excel.xlsx differ