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:
parent
9665d8d695
commit
52cf468d70
@ -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 = [];
|
||||
|
@ -103,6 +103,7 @@ return [
|
||||
'date_separator' => env('SETTING_FALLBACK_LOCALISATION_DATE_SEPARATOR', 'space'),
|
||||
'percent_position' => env('SETTING_FALLBACK_LOCALISATION_PERCENT_POSITION', 'after'),
|
||||
'discount_location' => env('SETTING_FALLBACK_LOCALISATION_DISCOUNT_LOCATION', 'total'),
|
||||
'financial_year_denote' => env('SETTING_FALLBACK_LOCALISATION_FINANCIAL_YEAR_DENOTE', 'ends'),
|
||||
],
|
||||
'invoice' => [
|
||||
'number_prefix' => env('SETTING_FALLBACK_INVOICE_NUMBER_PREFIX', 'INV-'),
|
||||
|
@ -36,6 +36,11 @@ return [
|
||||
'total' => 'At total',
|
||||
'both' => 'Both line and total',
|
||||
],
|
||||
'financial_year_denote' => [
|
||||
'title' => 'Financial Year Denote',
|
||||
'begins' => 'By the year it begins',
|
||||
'ends' => 'By the year it ends',
|
||||
],
|
||||
],
|
||||
|
||||
'invoice' => [
|
||||
|
@ -35,6 +35,11 @@ return [
|
||||
'total' => 'Toplamda',
|
||||
'both' => 'Satırda ve toplamda',
|
||||
],
|
||||
'financial_year_denote' => [
|
||||
'title' => 'Mali Yıl Gösterimi',
|
||||
'begins' => 'Başlangıç Yılı',
|
||||
'ends' => 'Bitiş Yılı',
|
||||
],
|
||||
],
|
||||
|
||||
'invoice' => [
|
||||
|
@ -20,6 +20,8 @@
|
||||
<div class="row">
|
||||
{{ Form::dateGroup('financial_start', trans('settings.localisation.financial_start'), 'calendar', ['id' => 'financial_start', 'class' => 'form-control datepicker', 'show-date-format' => 'j F', 'date-format' => 'd-m', 'autocomplete' => 'off'], setting('localisation.financial_start')) }}
|
||||
|
||||
{{ Form::selectGroup('financial_year_denote', trans('settings.localisation.financial_year_denote.title'), 'calendar', $financial_year_denote_options, setting('localisation.financial_year_denote'), []) }}
|
||||
|
||||
{{ Form::selectGroupGroup('timezone', trans('settings.localisation.timezone'), 'globe', $timezones, setting('localisation.timezone'), []) }}
|
||||
|
||||
{{ Form::selectGroup('date_format', trans('settings.localisation.date.format'), 'calendar', $date_formats, setting('localisation.date_format'), ['autocomplete' => 'off']) }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user