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:
@@ -371,7 +371,15 @@ abstract class Report
|
||||
{
|
||||
switch ($this->getSetting('period')) {
|
||||
case 'yearly':
|
||||
$i = $date->copy()->format($this->getYearlyDateFormat());
|
||||
$financial_year = $this->getFinancialYear($this->year);
|
||||
|
||||
if ($date->greaterThanOrEqualTo($financial_year->getStartDate()) && $date->lessThanOrEqualTo($financial_year->getEndDate())) {
|
||||
if (setting('localisation.financial_year_denote') == 'begins') {
|
||||
$i = $financial_year->getStartDate()->copy()->format($this->getYearlyDateFormat());
|
||||
} else {
|
||||
$i = $financial_year->getEndDate()->copy()->format($this->getYearlyDateFormat());
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case 'quarterly':
|
||||
|
@@ -41,12 +41,18 @@ class Localisation extends Controller
|
||||
'both' => trans('settings.localisation.discount_location.both'),
|
||||
];
|
||||
|
||||
$financial_year_denote_options = [
|
||||
'begins' => trans('settings.localisation.financial_year_denote.begins'),
|
||||
'ends' => trans('settings.localisation.financial_year_denote.ends'),
|
||||
];
|
||||
|
||||
return view('settings.localisation.edit', compact(
|
||||
'timezones',
|
||||
'date_formats',
|
||||
'date_separators',
|
||||
'percent_positions',
|
||||
'discount_locations'
|
||||
'discount_locations',
|
||||
'financial_year_denote_options'
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@@ -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 = [];
|
||||
|
Reference in New Issue
Block a user