FIX_LEADS_FIN_YEAR

This commit is contained in:
velz 2026-02-16 18:13:40 +05:30
parent 6c5ef92f5e
commit c2b9f6ffff

View File

@ -4213,27 +4213,27 @@ class LeadsController extends BaseController
} }
} }
public function getLastFiveFinancialYears() public function getLastFiveFinancialYears(): array
{ {
$currentYear = date('Y'); $year = (int) date('Y');
$currentMonth = date('m'); $month = (int) date('m');
// $month = (int) 5;
// In India, the financial year starts from April (04) // Financial year starts in April
if ($currentMonth < 4) { $currentFYStart = ($month >= 4) ? $year : $year - 1;
$currentYear--; // Adjust year if it's Jan-Mar
}
$financialYears = []; $financialYears = [];
for ($i = 0; $i < 5; $i++) { for ($i = 0; $i < 6; $i++) {
$startYear = $currentYear - $i - 1; $startYear = $currentFYStart - $i;
$endYear = $currentYear - $i; $endYear = $startYear + 1;
$financialYears[] = "$startYear-$endYear"; $financialYears[] = "{$startYear}-{$endYear}";
} }
return $financialYears; return $financialYears;
} }
// ------------ RFQ NON EB FUNCTIONS----------------------------------------------------------------------------------------- // ------------ RFQ NON EB FUNCTIONS-----------------------------------------------------------------------------------------
public function rfqNonEB() public function rfqNonEB()