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');
$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()