Feature - Add support for a fiscal year period defined in user settings.

* Add "This fiscal year", "Last fiscal year" as date range options in Transaction Details to filter transactions to those periods
* Add fiscal year ranges to Statistics & Trend Analysis
* Add "fiscal year start date" to user profile settings, allowing the user to select any date of the calendar year as the start of the fiscal year
* Add "fiscal year format" to user profile settings, allowing the user to specify how financial year date labels should appear

Implementation notes:
* The default fiscal year start is January 1 and the default fiscal year display format is "FY 2025"
* Fiscal year start date (month number & day number) are stored together in db as a uint16, high byte & low byte respectively
* February 29 is disallowed as a fiscal year start date, since it is never used as a convention in any country
* Jest is added to the project as a dev dependency, for unit tests in frontend

Signed-off-by: Sebastian Reategui <seb.reategui@gmail.com>
This commit is contained in:
Sebastian Reategui
2025-06-05 12:36:46 +10:00
committed by mayswind
parent 70eea8ff33
commit b94dc8eb83
42 changed files with 3417 additions and 105 deletions
+2 -2
View File
@@ -747,7 +747,7 @@ export const useStatisticsStore = defineStore('statistics', () => {
transactionStatisticsFilter.value.categoricalChartEndTime = 0;
}
} else {
const categoricalChartDateRange = getDateRangeByDateType(transactionStatisticsFilter.value.categoricalChartDateType, userStore.currentUserFirstDayOfWeek);
const categoricalChartDateRange = getDateRangeByDateType(transactionStatisticsFilter.value.categoricalChartDateType, userStore.currentUserFirstDayOfWeek, userStore.currentUserFiscalYearStart);
if (categoricalChartDateRange) {
transactionStatisticsFilter.value.categoricalChartDateType = categoricalChartDateRange.dateType;
@@ -792,7 +792,7 @@ export const useStatisticsStore = defineStore('statistics', () => {
transactionStatisticsFilter.value.trendChartEndYearMonth = '';
}
} else {
const trendChartDateRange = getDateRangeByDateType(transactionStatisticsFilter.value.trendChartDateType, userStore.currentUserFirstDayOfWeek);
const trendChartDateRange = getDateRangeByDateType(transactionStatisticsFilter.value.trendChartDateType, userStore.currentUserFirstDayOfWeek, userStore.currentUserFiscalYearStart);
if (trendChartDateRange) {
transactionStatisticsFilter.value.trendChartDateType = trendChartDateRange.dateType;
+12
View File
@@ -66,6 +66,11 @@ export const useUserStore = defineStore('user', () => {
return isNumber(userInfo.firstDayOfWeek) && WeekDay.valueOf(userInfo.firstDayOfWeek) ? userInfo.firstDayOfWeek : settingsStore.localeDefaultSettings.firstDayOfWeek;
});
const currentUserFiscalYearStart = computed<number>(() => {
const userInfo = currentUserBasicInfo.value || EMPTY_USER_BASIC_INFO;
return userInfo.fiscalYearStart;
});
const currentUserLongDateFormat = computed<number>(() => {
const userInfo = currentUserBasicInfo.value || EMPTY_USER_BASIC_INFO;
return userInfo.longDateFormat;
@@ -86,6 +91,11 @@ export const useUserStore = defineStore('user', () => {
return userInfo.shortTimeFormat;
});
const currentUserFiscalYearFormat = computed<number>(() => {
const userInfo = currentUserBasicInfo.value || EMPTY_USER_BASIC_INFO;
return userInfo.fiscalYearFormat;
});
const currentUserDecimalSeparator = computed<number>(() => {
const userInfo = currentUserBasicInfo.value || EMPTY_USER_BASIC_INFO;
return userInfo.decimalSeparator;
@@ -321,10 +331,12 @@ export const useUserStore = defineStore('user', () => {
currentUserLanguage,
currentUserDefaultCurrency,
currentUserFirstDayOfWeek,
currentUserFiscalYearStart,
currentUserLongDateFormat,
currentUserShortDateFormat,
currentUserLongTimeFormat,
currentUserShortTimeFormat,
currentUserFiscalYearFormat,
currentUserDecimalSeparator,
currentUserDigitGroupingSymbol,
currentUserDigitGrouping,