setting that named as financial year denote added to localization part and it will be considered on the preparation of reports

This commit is contained in:
Sevan Nerse
2021-02-12 22:00:46 +03:00
parent 9665d8d695
commit 52cf468d70
7 changed files with 37 additions and 4 deletions

View File

@@ -110,14 +110,20 @@ trait DateTime
$financial_start = Date::create($year, $month, $day);
// Check if FS is in last calendar year
if ($now->diffInDays($financial_start, false) > 0) {
if (setting('localisation.financial_year_denote') == 'ends' && $financial_start->dayOfYear != 1) {
$financial_start->subYear();
}
return $financial_start;
}
public function getFinancialYear($year = null)
{
$start = $this->getFinancialStart($year);
return CarbonPeriod::create($start, $start->copy()->addYear()->subDay());
}
public function getFinancialQuarters($year = null)
{
$quarters = [];