From c2b9f6ffffefc1b5b292242e2850cf343bc79bbc Mon Sep 17 00:00:00 2001 From: velz Date: Mon, 16 Feb 2026 18:13:40 +0530 Subject: [PATCH] FIX_LEADS_FIN_YEAR --- app/Controllers/LeadsController.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index 2deca1f1..41a54446 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -4213,27 +4213,27 @@ class LeadsController extends BaseController } } - public function getLastFiveFinancialYears() + public function getLastFiveFinancialYears(): array { - $currentYear = date('Y'); - $currentMonth = date('m'); + $year = (int) date('Y'); + $month = (int) date('m'); + // $month = (int) 5; - // In India, the financial year starts from April (04) - if ($currentMonth < 4) { - $currentYear--; // Adjust year if it's Jan-Mar - } + // Financial year starts in April + $currentFYStart = ($month >= 4) ? $year : $year - 1; $financialYears = []; - for ($i = 0; $i < 5; $i++) { - $startYear = $currentYear - $i - 1; - $endYear = $currentYear - $i; - $financialYears[] = "$startYear-$endYear"; + for ($i = 0; $i < 6; $i++) { + $startYear = $currentFYStart - $i; + $endYear = $startYear + 1; + $financialYears[] = "{$startYear}-{$endYear}"; } return $financialYears; } + // ------------ RFQ NON EB FUNCTIONS----------------------------------------------------------------------------------------- public function rfqNonEB()