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
@@ -37,6 +37,7 @@ export function useStatisticsTransactionPageBase() {
const showAccountBalance = computed<boolean>(() => settingsStore.appSettings.showAccountBalance);
const defaultCurrency = computed<string>(() => userStore.currentUserDefaultCurrency);
const firstDayOfWeek = computed<number>(() => userStore.currentUserFirstDayOfWeek);
const fiscalYearStart = computed<number>(() => userStore.currentUserFiscalYearStart);
const allDateRanges = computed<LocalizedDateRange[]>(() => {
if (analysisType.value === StatisticsAnalysisType.CategoricalAnalysis) {
@@ -224,6 +225,7 @@ export function useStatisticsTransactionPageBase() {
showAccountBalance,
defaultCurrency,
firstDayOfWeek,
fiscalYearStart,
allDateRanges,
allSortingTypes,
allDateAggregationTypes,
@@ -102,6 +102,7 @@ export function useTransactionListPageBase() {
const currentTimezoneOffsetMinutes = computed<number>(() => getTimezoneOffsetMinutes(settingsStore.appSettings.timeZone));
const firstDayOfWeek = computed<number>(() => userStore.currentUserFirstDayOfWeek);
const fiscalYearStart = computed<number>(() => userStore.currentUserFiscalYearStart);
const defaultCurrency = computed<string>(() => getUnifiedSelectedAccountsCurrencyOrDefaultCurrency(allAccountsMap.value, queryAllFilterAccountIds.value, userStore.currentUserDefaultCurrency));
const showTotalAmountInTransactionListPage = computed<boolean>(() => settingsStore.appSettings.showTotalAmountInTransactionListPage);
const showTagInTransactionListPage = computed<boolean>(() => settingsStore.appSettings.showTagInTransactionListPage);
@@ -365,6 +366,7 @@ export function useTransactionListPageBase() {
// computed states
currentTimezoneOffsetMinutes,
firstDayOfWeek,
fiscalYearStart,
defaultCurrency,
showTotalAmountInTransactionListPage,
showTagInTransactionListPage,
@@ -26,6 +26,7 @@ export function useUserProfilePageBase() {
getAllShortDateFormats,
getAllLongTimeFormats,
getAllShortTimeFormats,
getAllFiscalYearFormats,
getAllDecimalSeparators,
getAllDigitGroupingSymbols,
getAllDigitGroupingTypes,
@@ -60,6 +61,7 @@ export function useUserProfilePageBase() {
const allShortDateFormats = computed<TypeAndDisplayName[]>(() => getAllShortDateFormats());
const allLongTimeFormats = computed<TypeAndDisplayName[]>(() => getAllLongTimeFormats());
const allShortTimeFormats = computed<TypeAndDisplayName[]>(() => getAllShortTimeFormats());
const allFiscalYearFormats = computed<TypeAndDisplayName[]>(() => getAllFiscalYearFormats());
const allDecimalSeparators = computed<TypeAndDisplayName[]>(() => getAllDecimalSeparators());
const allDigitGroupingSymbols = computed<TypeAndDisplayName[]>(() => getAllDigitGroupingSymbols());
const allDigitGroupingTypes = computed<LocalizedDigitGroupingType[]>(() => getAllDigitGroupingTypes());
@@ -99,11 +101,13 @@ export function useUserProfilePageBase() {
newProfile.value.transactionEditScope === oldProfile.value.transactionEditScope &&
newProfile.value.language === oldProfile.value.language &&
newProfile.value.defaultCurrency === oldProfile.value.defaultCurrency &&
newProfile.value.fiscalYearStart === oldProfile.value.fiscalYearStart &&
newProfile.value.firstDayOfWeek === oldProfile.value.firstDayOfWeek &&
newProfile.value.longDateFormat === oldProfile.value.longDateFormat &&
newProfile.value.shortDateFormat === oldProfile.value.shortDateFormat &&
newProfile.value.longTimeFormat === oldProfile.value.longTimeFormat &&
newProfile.value.shortTimeFormat === oldProfile.value.shortTimeFormat &&
newProfile.value.fiscalYearFormat === oldProfile.value.fiscalYearFormat &&
newProfile.value.decimalSeparator === oldProfile.value.decimalSeparator &&
newProfile.value.digitGroupingSymbol === oldProfile.value.digitGroupingSymbol &&
newProfile.value.digitGrouping === oldProfile.value.digitGrouping &&
@@ -194,6 +198,7 @@ export function useUserProfilePageBase() {
allShortDateFormats,
allLongTimeFormats,
allShortTimeFormats,
allFiscalYearFormats,
allDecimalSeparators,
allDigitGroupingSymbols,
allDigitGroupingTypes,
@@ -248,6 +248,7 @@
:end-year-month="query.trendChartEndYearMonth"
:sorting-type="querySortingType"
:date-aggregation-type="trendDateAggregationType"
:fiscal-year-start="fiscalYearStart"
:items="[]"
:skeleton="true"
id-field="id"
@@ -262,6 +263,7 @@
:end-year-month="query.trendChartEndYearMonth"
:sorting-type="querySortingType"
:date-aggregation-type="trendDateAggregationType"
:fiscal-year-start="fiscalYearStart"
:items="trendsAnalysisData && trendsAnalysisData.items && trendsAnalysisData.items.length ? trendsAnalysisData.items : []"
:translate-name="translateNameInTrendsChart"
:show-value="showAmountInChart"
@@ -404,6 +406,7 @@ const {
trendDateAggregationType,
defaultCurrency,
firstDayOfWeek,
fiscalYearStart,
allDateRanges,
allSortingTypes,
allDateAggregationTypes,
@@ -746,7 +749,7 @@ function setDateFilter(dateType: number): void {
}
}
const dateRange = getDateRangeByDateType(dateType, firstDayOfWeek.value);
const dateRange = getDateRangeByDateType(dateType, firstDayOfWeek.value, fiscalYearStart.value);
if (!dateRange) {
return;
@@ -783,7 +786,7 @@ function setCustomDateFilter(startTime: number | string, endTime: number | strin
let changed = false;
if (analysisType.value === StatisticsAnalysisType.CategoricalAnalysis && isNumber(startTime) && isNumber(endTime)) {
const chartDateType = getDateTypeByDateRange(startTime, endTime, firstDayOfWeek.value, DateRangeScene.Normal);
const chartDateType = getDateTypeByDateRange(startTime, endTime, firstDayOfWeek.value, fiscalYearStart.value, DateRangeScene.Normal);
changed = statisticsStore.updateTransactionStatisticsFilter({
categoricalChartDateType: chartDateType,
@@ -793,7 +796,7 @@ function setCustomDateFilter(startTime: number | string, endTime: number | strin
showCustomDateRangeDialog.value = false;
} else if (analysisType.value === StatisticsAnalysisType.TrendAnalysis && isString(startTime) && isString(endTime)) {
const chartDateType = getDateTypeByDateRange(getYearMonthFirstUnixTime(startTime), getYearMonthLastUnixTime(endTime), firstDayOfWeek.value, DateRangeScene.TrendAnalysis);
const chartDateType = getDateTypeByDateRange(getYearMonthFirstUnixTime(startTime), getYearMonthLastUnixTime(endTime), firstDayOfWeek.value, fiscalYearStart.value, DateRangeScene.TrendAnalysis);
changed = statisticsStore.updateTransactionStatisticsFilter({
trendChartDateType: chartDateType,
@@ -819,7 +822,7 @@ function shiftDateRange(scale: number): void {
let changed = false;
if (analysisType.value === StatisticsAnalysisType.CategoricalAnalysis) {
const newDateRange = getShiftedDateRangeAndDateType(query.value.categoricalChartStartTime, query.value.categoricalChartEndTime, scale, firstDayOfWeek.value, DateRangeScene.Normal);
const newDateRange = getShiftedDateRangeAndDateType(query.value.categoricalChartStartTime, query.value.categoricalChartEndTime, scale, firstDayOfWeek.value, fiscalYearStart.value, DateRangeScene.Normal);
changed = statisticsStore.updateTransactionStatisticsFilter({
categoricalChartDateType: newDateRange.dateType,
@@ -827,7 +830,7 @@ function shiftDateRange(scale: number): void {
categoricalChartEndTime: newDateRange.maxTime
});
} else if (analysisType.value === StatisticsAnalysisType.TrendAnalysis) {
const newDateRange = getShiftedDateRangeAndDateType(getYearMonthFirstUnixTime(query.value.trendChartStartYearMonth), getYearMonthLastUnixTime(query.value.trendChartEndYearMonth), scale, firstDayOfWeek.value, DateRangeScene.TrendAnalysis);
const newDateRange = getShiftedDateRangeAndDateType(getYearMonthFirstUnixTime(query.value.trendChartStartYearMonth), getYearMonthLastUnixTime(query.value.trendChartEndYearMonth), scale, firstDayOfWeek.value, fiscalYearStart.value, DateRangeScene.TrendAnalysis);
changed = statisticsStore.updateTransactionStatisticsFilter({
trendChartDateType: newDateRange.dateType,
+9 -8
View File
@@ -780,6 +780,7 @@ const {
currentCalendarDate,
currentTimezoneOffsetMinutes,
firstDayOfWeek,
fiscalYearStart,
defaultCurrency,
showTotalAmountInTransactionListPage,
showTagInTransactionListPage,
@@ -943,7 +944,7 @@ const transactions = computed<Transaction[]>(() => {
});
const recentDateRangeIndex = computed<number>({
get: () => getRecentDateRangeIndex(recentMonthDateRanges.value, query.value.dateType, query.value.minTime, query.value.maxTime, firstDayOfWeek.value),
get: () => getRecentDateRangeIndex(recentMonthDateRanges.value, query.value.dateType, query.value.minTime, query.value.maxTime, firstDayOfWeek.value, fiscalYearStart.value),
set: (value) => {
if (value < 0 || value >= recentMonthDateRanges.value.length) {
value = 0;
@@ -1093,7 +1094,7 @@ function updateUrlWhenChanged(changed: boolean): void {
}
function init(initProps: TransactionListProps): void {
let dateRange: TimeRangeAndDateType | null = getDateRangeByDateType(initProps.initDateType ? parseInt(initProps.initDateType) : undefined, firstDayOfWeek.value);
let dateRange: TimeRangeAndDateType | null = getDateRangeByDateType(initProps.initDateType ? parseInt(initProps.initDateType) : undefined, firstDayOfWeek.value, fiscalYearStart.value);
if (!dateRange && initProps.initDateType && initProps.initMaxTime && initProps.initMinTime &&
(DateRange.isBillingCycle(parseInt(initProps.initDateType)) || initProps.initDateType === DateRange.Custom.type.toString()) &&
@@ -1258,9 +1259,9 @@ function changeDateFilter(dateRange: TimeRangeAndDateType | number | null): void
if (isNumber(dateRange)) {
if (DateRange.isBillingCycle(dateRange)) {
dateRange = getDateRangeByBillingCycleDateType(dateRange, firstDayOfWeek.value, accountsStore.getAccountStatementDate(query.value.accountIds));
dateRange = getDateRangeByBillingCycleDateType(dateRange, firstDayOfWeek.value, fiscalYearStart.value, accountsStore.getAccountStatementDate(query.value.accountIds));
} else {
dateRange = getDateRangeByDateType(dateRange, firstDayOfWeek.value);
dateRange = getDateRangeByDateType(dateRange, firstDayOfWeek.value, fiscalYearStart.value);
}
}
@@ -1296,10 +1297,10 @@ function changeCustomDateFilter(minTime: number, maxTime: number): void {
return;
}
let dateType: number | null = getDateTypeByBillingCycleDateRange(minTime, maxTime, firstDayOfWeek.value, DateRangeScene.Normal, accountsStore.getAccountStatementDate(query.value.accountIds));
let dateType: number | null = getDateTypeByBillingCycleDateRange(minTime, maxTime, firstDayOfWeek.value, fiscalYearStart.value, DateRangeScene.Normal, accountsStore.getAccountStatementDate(query.value.accountIds));
if (!dateType) {
dateType = getDateTypeByDateRange(minTime, maxTime, firstDayOfWeek.value, DateRangeScene.Normal);
dateType = getDateTypeByDateRange(minTime, maxTime, firstDayOfWeek.value, fiscalYearStart.value, DateRangeScene.Normal);
}
if (pageType.value === TransactionListPageType.Calendar.type) {
@@ -1365,11 +1366,11 @@ function shiftDateRange(startTime: number, endTime: number, scale: number): void
let newDateRange: TimeRangeAndDateType | null = null;
if (DateRange.isBillingCycle(query.value.dateType) || query.value.dateType === DateRange.Custom.type) {
newDateRange = getShiftedDateRangeAndDateTypeForBillingCycle(startTime, endTime, scale, firstDayOfWeek.value, DateRangeScene.Normal, accountsStore.getAccountStatementDate(query.value.accountIds));
newDateRange = getShiftedDateRangeAndDateTypeForBillingCycle(startTime, endTime, scale, firstDayOfWeek.value, fiscalYearStart.value, DateRangeScene.Normal, accountsStore.getAccountStatementDate(query.value.accountIds));
}
if (!newDateRange) {
newDateRange = getShiftedDateRangeAndDateType(startTime, endTime, scale, firstDayOfWeek.value, DateRangeScene.Normal);
newDateRange = getShiftedDateRangeAndDateType(startTime, endTime, scale, firstDayOfWeek.value, fiscalYearStart.value, DateRangeScene.Normal);
}
if (pageType.value === TransactionListPageType.Calendar.type) {
@@ -142,6 +142,16 @@
v-model="newProfile.firstDayOfWeek"
/>
</v-col>
<v-col cols="12" md="6">
<fiscal-year-start-select
persistent-placeholder
:disabled="loading || saving"
:label="tt('Fiscal Year Start Date')"
:placeholder="tt('Fiscal Year Start Date')"
v-model="newProfile.fiscalYearStart"
/>
</v-col>
</v-row>
</v-card-text>
@@ -200,6 +210,19 @@
v-model="newProfile.shortTimeFormat"
/>
</v-col>
<v-col cols="12" md="6">
<v-select
item-title="displayName"
item-value="type"
persistent-placeholder
:disabled="loading || saving"
:label="tt('Fiscal Year Format')"
:placeholder="tt('Fiscal Year Format')"
:items="allFiscalYearFormats"
v-model="newProfile.fiscalYearFormat"
/>
</v-col>
</v-row>
</v-card-text>
@@ -375,6 +398,7 @@ const {
allShortDateFormats,
allLongTimeFormats,
allShortTimeFormats,
allFiscalYearFormats,
allDecimalSeparators,
allDigitGroupingSymbols,
allDigitGroupingTypes,
@@ -204,6 +204,7 @@
:end-year-month="query.trendChartEndYearMonth"
:sorting-type="query.sortingType"
:date-aggregation-type="trendDateAggregationType"
:fiscal-year-start="fiscalYearStart"
:items="trendsAnalysisData && trendsAnalysisData.items && trendsAnalysisData.items.length ? trendsAnalysisData.items : []"
:translate-name="translateNameInTrendsChart"
:default-currency="defaultCurrency"
@@ -367,6 +368,7 @@ const {
trendDateAggregationType,
defaultCurrency,
firstDayOfWeek,
fiscalYearStart,
allDateRanges,
allSortingTypes,
allDateAggregationTypes,
@@ -590,7 +592,7 @@ function setDateFilter(dateType: number): void {
}
}
const dateRange = getDateRangeByDateType(dateType, firstDayOfWeek.value);
const dateRange = getDateRangeByDateType(dateType, firstDayOfWeek.value, fiscalYearStart.value);
if (!dateRange) {
return;
@@ -627,7 +629,7 @@ function setCustomDateFilter(startTime: number | string, endTime: number | strin
let changed = false;
if (analysisType.value === StatisticsAnalysisType.CategoricalAnalysis && isNumber(startTime) && isNumber(endTime)) {
const chartDateType = getDateTypeByDateRange(startTime, endTime, firstDayOfWeek.value, DateRangeScene.Normal);
const chartDateType = getDateTypeByDateRange(startTime, endTime, firstDayOfWeek.value, fiscalYearStart.value, DateRangeScene.Normal);
changed = statisticsStore.updateTransactionStatisticsFilter({
categoricalChartDateType: chartDateType,
@@ -637,7 +639,7 @@ function setCustomDateFilter(startTime: number | string, endTime: number | strin
showCustomDateRangeSheet.value = false;
} else if (analysisType.value === StatisticsAnalysisType.TrendAnalysis && isString(startTime) && isString(endTime)) {
const chartDateType = getDateTypeByDateRange(getYearMonthFirstUnixTime(startTime), getYearMonthLastUnixTime(endTime), firstDayOfWeek.value, DateRangeScene.TrendAnalysis);
const chartDateType = getDateTypeByDateRange(getYearMonthFirstUnixTime(startTime), getYearMonthLastUnixTime(endTime), firstDayOfWeek.value, fiscalYearStart.value, DateRangeScene.TrendAnalysis);
changed = statisticsStore.updateTransactionStatisticsFilter({
trendChartDateType: chartDateType,
@@ -661,7 +663,7 @@ function shiftDateRange(scale: number): void {
let changed = false;
if (analysisType.value === StatisticsAnalysisType.CategoricalAnalysis) {
const newDateRange = getShiftedDateRangeAndDateType(query.value.categoricalChartStartTime, query.value.categoricalChartEndTime, scale, firstDayOfWeek.value, DateRangeScene.Normal);
const newDateRange = getShiftedDateRangeAndDateType(query.value.categoricalChartStartTime, query.value.categoricalChartEndTime, scale, firstDayOfWeek.value, fiscalYearStart.value, DateRangeScene.Normal);
changed = statisticsStore.updateTransactionStatisticsFilter({
categoricalChartDateType: newDateRange.dateType,
@@ -669,7 +671,7 @@ function shiftDateRange(scale: number): void {
categoricalChartEndTime: newDateRange.maxTime
});
} else if (analysisType.value === StatisticsAnalysisType.TrendAnalysis) {
const newDateRange = getShiftedDateRangeAndDateType(getYearMonthFirstUnixTime(query.value.trendChartStartYearMonth), getYearMonthLastUnixTime(query.value.trendChartEndYearMonth), scale, firstDayOfWeek.value, DateRangeScene.TrendAnalysis);
const newDateRange = getShiftedDateRangeAndDateType(getYearMonthFirstUnixTime(query.value.trendChartStartYearMonth), getYearMonthLastUnixTime(query.value.trendChartEndYearMonth), scale, firstDayOfWeek.value, fiscalYearStart.value, DateRangeScene.TrendAnalysis);
changed = statisticsStore.updateTransactionStatisticsFilter({
trendChartDateType: newDateRange.dateType,
+13 -12
View File
@@ -671,6 +671,7 @@ const {
currentCalendarDate,
currentTimezoneOffsetMinutes,
firstDayOfWeek,
fiscalYearStart,
defaultCurrency,
showTotalAmountInTransactionListPage,
showTagInTransactionListPage,
@@ -920,7 +921,7 @@ function getCategoryListItemCheckedClass(category: TransactionCategory, queryCat
function init(): void {
const initQuery = props.f7route.query;
let dateRange: TimeRangeAndDateType | null = getDateRangeByDateType(initQuery['dateType'] ? parseInt(initQuery['dateType']) : undefined, firstDayOfWeek.value);
let dateRange: TimeRangeAndDateType | null = getDateRangeByDateType(initQuery['dateType'] ? parseInt(initQuery['dateType']) : undefined, firstDayOfWeek.value, fiscalYearStart.value);
if (!dateRange && initQuery['dateType'] && initQuery['maxTime'] && initQuery['minTime'] &&
(DateRange.isBillingCycle(parseInt(initQuery['dateType'])) || initQuery['dateType'] === DateRange.Custom.type.toString()) &&
@@ -1037,7 +1038,7 @@ function changePageType(type: number): void {
currentCalendarDate.value = getValidMonthDayOrCurrentDayShortDate(query.value.minTime, currentCalendarDate.value);
if (pageType.value === TransactionListPageType.Calendar.type) {
const dateRange = getFullMonthDateRange(query.value.minTime, query.value.maxTime, firstDayOfWeek.value);
const dateRange = getFullMonthDateRange(query.value.minTime, query.value.maxTime, firstDayOfWeek.value, fiscalYearStart.value);
if (dateRange) {
const changed = transactionsStore.updateTransactionListFilter({
@@ -1079,9 +1080,9 @@ function changeDateFilter(dateType: number): void {
let dateRange: TimeRangeAndDateType | null = null;
if (DateRange.isBillingCycle(dateType)) {
dateRange = getDateRangeByBillingCycleDateType(dateType, firstDayOfWeek.value, accountsStore.getAccountStatementDate(query.value.accountIds));
dateRange = getDateRangeByBillingCycleDateType(dateType, firstDayOfWeek.value, fiscalYearStart.value, accountsStore.getAccountStatementDate(query.value.accountIds));
} else {
dateRange = getDateRangeByDateType(dateType, firstDayOfWeek.value);
dateRange = getDateRangeByDateType(dateType, firstDayOfWeek.value, fiscalYearStart.value);
}
if (!dateRange) {
@@ -1090,7 +1091,7 @@ function changeDateFilter(dateType: number): void {
if (pageType.value === TransactionListPageType.Calendar.type) {
currentCalendarDate.value = getValidMonthDayOrCurrentDayShortDate(dateRange.minTime, currentCalendarDate.value);
const fullMonthDateRange = getFullMonthDateRange(dateRange.minTime, dateRange.maxTime, firstDayOfWeek.value);
const fullMonthDateRange = getFullMonthDateRange(dateRange.minTime, dateRange.maxTime, firstDayOfWeek.value, fiscalYearStart.value);
if (fullMonthDateRange) {
dateRange = fullMonthDateRange;
@@ -1116,15 +1117,15 @@ function changeCustomDateFilter(minTime: number, maxTime: number): void {
return;
}
let dateType: number | null = getDateTypeByBillingCycleDateRange(minTime, maxTime, firstDayOfWeek.value, DateRangeScene.Normal, accountsStore.getAccountStatementDate(query.value.accountIds));
let dateType: number | null = getDateTypeByBillingCycleDateRange(minTime, maxTime, firstDayOfWeek.value, fiscalYearStart.value, DateRangeScene.Normal, accountsStore.getAccountStatementDate(query.value.accountIds));
if (!dateType) {
dateType = getDateTypeByDateRange(minTime, maxTime, firstDayOfWeek.value, DateRangeScene.Normal);
dateType = getDateTypeByDateRange(minTime, maxTime, firstDayOfWeek.value, fiscalYearStart.value, DateRangeScene.Normal);
}
if (pageType.value === TransactionListPageType.Calendar.type) {
currentCalendarDate.value = getValidMonthDayOrCurrentDayShortDate(minTime, currentCalendarDate.value);
const dateRange = getFullMonthDateRange(minTime, maxTime, firstDayOfWeek.value);
const dateRange = getFullMonthDateRange(minTime, maxTime, firstDayOfWeek.value, fiscalYearStart.value);
if (dateRange) {
minTime = dateRange.minTime;
@@ -1154,7 +1155,7 @@ function changeCustomMonthDateFilter(yearMonth: string): void {
const minTime = getYearMonthFirstUnixTime(yearMonth);
const maxTime = getYearMonthLastUnixTime(yearMonth);
const dateType = getDateTypeByDateRange(minTime, maxTime, firstDayOfWeek.value, DateRangeScene.Normal);
const dateType = getDateTypeByDateRange(minTime, maxTime, firstDayOfWeek.value, fiscalYearStart.value, DateRangeScene.Normal);
if (pageType.value === TransactionListPageType.Calendar.type) {
currentCalendarDate.value = getValidMonthDayOrCurrentDayShortDate(minTime, currentCalendarDate.value);
@@ -1181,16 +1182,16 @@ function shiftDateRange(minTime: number, maxTime: number, scale: number): void {
let newDateRange: TimeRangeAndDateType | null = null;
if (DateRange.isBillingCycle(query.value.dateType) || query.value.dateType === DateRange.Custom.type) {
newDateRange = getShiftedDateRangeAndDateTypeForBillingCycle(minTime, maxTime, scale, firstDayOfWeek.value, DateRangeScene.Normal, accountsStore.getAccountStatementDate(query.value.accountIds));
newDateRange = getShiftedDateRangeAndDateTypeForBillingCycle(minTime, maxTime, scale, firstDayOfWeek.value, fiscalYearStart.value, DateRangeScene.Normal, accountsStore.getAccountStatementDate(query.value.accountIds));
}
if (!newDateRange) {
newDateRange = getShiftedDateRangeAndDateType(minTime, maxTime, scale, firstDayOfWeek.value, DateRangeScene.Normal);
newDateRange = getShiftedDateRangeAndDateType(minTime, maxTime, scale, firstDayOfWeek.value, fiscalYearStart.value, DateRangeScene.Normal);
}
if (pageType.value === TransactionListPageType.Calendar.type) {
currentCalendarDate.value = getValidMonthDayOrCurrentDayShortDate(newDateRange.minTime, currentCalendarDate.value);
const fullMonthDateRange = getFullMonthDateRange(newDateRange.minTime, newDateRange.maxTime, firstDayOfWeek.value);
const fullMonthDateRange = getFullMonthDateRange(newDateRange.minTime, newDateRange.maxTime, firstDayOfWeek.value, fiscalYearStart.value);
if (fullMonthDateRange) {
newDateRange = fullMonthDateRange;
+39 -1
View File
@@ -202,6 +202,20 @@
v-model="newProfile.firstDayOfWeek">
</list-item-selection-popup>
</f7-list-item>
<f7-list-item
link="#"
class="list-item-with-header-and-title list-item-no-item-after"
:header="tt('Fiscal Year Start Date')"
:title="currentFiscalYearStartDate"
@click="showFiscalYearStartSheet = true"
>
<fiscal-year-start-selection-sheet
v-model:show="showFiscalYearStartSheet"
v-model="newProfile.fiscalYearStart">
</fiscal-year-start-selection-sheet>
</f7-list-item>
</f7-list>
<f7-list form strong inset dividers class="margin-vertical" v-if="!loading">
@@ -284,6 +298,26 @@
v-model="newProfile.shortTimeFormat">
</list-item-selection-popup>
</f7-list-item>
<f7-list-item
link="#"
class="list-item-with-header-and-title list-item-no-item-after"
:header="tt('Fiscal Year Format')"
:title="findDisplayNameByType(allFiscalYearFormats, newProfile.fiscalYearFormat)"
@click="showFiscalYearFormatPopup = true"
>
<list-item-selection-popup value-type="item"
key-field="type" value-field="type"
title-field="displayName"
:title="tt('Fiscal Year Format')"
:enable-filter="true"
:filter-placeholder="tt('Fiscal Year Format')"
:filter-no-items-text="tt('No results')"
:items="allFiscalYearFormats"
v-model:show="showFiscalYearFormatPopup"
v-model="newProfile.fiscalYearFormat">
</list-item-selection-popup>
</f7-list-item>
</f7-list>
<f7-list form strong inset dividers class="margin-vertical" v-if="!loading">
@@ -482,7 +516,7 @@ const props = defineProps<{
f7router: Router.Router;
}>();
const { tt, getAllLanguageOptions, getAllCurrencies, getCurrencyName } = useI18n();
const { tt, getAllLanguageOptions, getAllCurrencies, getCurrencyName, formatFiscalYearStart } = useI18n();
const { showAlert, showToast, routeBackOnError } = useI18nUIComponents();
const {
@@ -499,6 +533,7 @@ const {
allShortDateFormats,
allLongTimeFormats,
allShortTimeFormats,
allFiscalYearFormats,
allDecimalSeparators,
allDigitGroupingSymbols,
allDigitGroupingTypes,
@@ -533,10 +568,12 @@ const showEditableTransactionRangePopup = ref<boolean>(false);
const showLanguagePopup = ref<boolean>(false);
const showDefaultCurrencyPopup = ref<boolean>(false);
const showFirstDayOfWeekPopup = ref<boolean>(false);
const showFiscalYearStartSheet = ref<boolean>(false);
const showLongDateFormatPopup = ref<boolean>(false);
const showShortDateFormatPopup = ref<boolean>(false);
const showLongTimeFormatPopup = ref<boolean>(false);
const showShortTimeFormatPopup = ref<boolean>(false);
const showFiscalYearFormatPopup = ref<boolean>(false);
const showCurrencyDisplayTypePopup = ref<boolean>(false);
const showDigitGroupingPopup = ref<boolean>(false);
const showDigitGroupingSymbolPopup = ref<boolean>(false);
@@ -560,6 +597,7 @@ const currentLanguageName = computed<string>(() => {
});
const currentDayOfWeekName = computed<string | null>(() => findDisplayNameByType(allWeekDays.value, newProfile.value.firstDayOfWeek));
const currentFiscalYearStartDate = computed<string | null>( () => formatFiscalYearStart(newProfile.value.fiscalYearStart) );
function init(): void {
loading.value = true;