mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-21 18:24:26 +08:00
support configuring the default behavior of the reconciliation statement button and the default time range for the reconciliation statement page
This commit is contained in:
@@ -214,7 +214,7 @@
|
||||
</v-btn>
|
||||
<v-btn class="px-2 ms-1" density="comfortable" color="default" variant="text"
|
||||
:disabled="loading" :prepend-icon="mdiInvoiceListOutline"
|
||||
@click="showReconciliationStatementCustomDateRangeDialog(element.getAccountOrSubAccount(activeSubAccount[element.id]))"
|
||||
@click="showReconciliationStatementDialog(element.getAccountOrSubAccount(activeSubAccount[element.id]))"
|
||||
v-if="element.type === AccountType.SingleAccount.type || element.getSubAccount(activeSubAccount[element.id])">
|
||||
{{ tt('Reconciliation Statement') }}
|
||||
<v-menu activator="parent" :open-on-hover="true">
|
||||
@@ -224,7 +224,7 @@
|
||||
<v-list-item class="text-sm" density="compact"
|
||||
:value="dateRange.type">
|
||||
<v-list-item-title class="cursor-pointer"
|
||||
@click="showReconciliationStatementCustomDateRangeDialog(element.getAccountOrSubAccount(activeSubAccount[element.id]), dateRange.type)">
|
||||
@click="showReconciliationStatementDialog(element.getAccountOrSubAccount(activeSubAccount[element.id]), dateRange.type)">
|
||||
<div class="d-flex align-center">
|
||||
<span class="text-sm ms-3">{{ dateRange.displayName }}</span>
|
||||
</div>
|
||||
@@ -335,10 +335,12 @@ import { useI18n } from '@/locales/helpers.ts';
|
||||
import { useAccountListPageBase } from '@/views/base/accounts/AccountListPageBase.ts';
|
||||
|
||||
import { useSettingsStore } from '@/stores/setting.ts';
|
||||
import { useUserStore } from '@/stores/user.ts';
|
||||
import { useAccountsStore } from '@/stores/account.ts';
|
||||
|
||||
import { DateRange, DateRangeScene, type LocalizedDateRange, type TimeRangeAndDateType } from '@/core/datetime.ts';
|
||||
import { AccountType, AccountCategory } from '@/core/account.ts';
|
||||
import { DEFAULT_RECONCILIATION_STATEMENT_DATE_RANGE_IN_DESKTOP } from '@/core/statistics.ts';
|
||||
import type { Account } from '@/models/account.ts';
|
||||
|
||||
import { isNumber } from '@/lib/common.ts';
|
||||
@@ -400,6 +402,7 @@ const {
|
||||
} = useAccountListPageBase();
|
||||
|
||||
const settingsStore = useSettingsStore();
|
||||
const userStore = useUserStore();
|
||||
const accountsStore = useAccountsStore();
|
||||
|
||||
const confirmDialog = useTemplateRef<ConfirmDialogType>('confirmDialog');
|
||||
@@ -502,7 +505,7 @@ function accountReconciliationStatementDateRanges(account: Account): LocalizedDa
|
||||
return getAllDateRanges(DateRangeScene.Normal, {
|
||||
includeCustom: true,
|
||||
includeBillingCycle: !!accountsStore.getAccountStatementDate(account.id),
|
||||
includeLastReconciledTimeRange: !!account.lastReconciledTime
|
||||
includeLastReconciledTimeRange: userStore.currentUserUseLastReconciledTime && !!account.lastReconciledTime
|
||||
});
|
||||
}
|
||||
|
||||
@@ -539,7 +542,21 @@ function edit(account: Account): void {
|
||||
});
|
||||
}
|
||||
|
||||
function showReconciliationStatementCustomDateRangeDialog(account: Account, dateRangeType?: number): void {
|
||||
function showReconciliationStatementDialog(account: Account, dateRangeType?: number): void {
|
||||
if (!isNumber(dateRangeType)) {
|
||||
const defualtDateRange = DateRange.valueOf(settingsStore.appSettings.reconciliationStatementButtonDefaultDateRangeTypeInDesktop);
|
||||
|
||||
if (!defualtDateRange) {
|
||||
dateRangeType = DEFAULT_RECONCILIATION_STATEMENT_DATE_RANGE_IN_DESKTOP.type;
|
||||
} else if (defualtDateRange.isBillingCycle && !accountsStore.getAccountStatementDate(account.id)) {
|
||||
dateRangeType = DEFAULT_RECONCILIATION_STATEMENT_DATE_RANGE_IN_DESKTOP.type;
|
||||
} else if (defualtDateRange.isLastReconciledTimeRange && (!userStore.currentUserUseLastReconciledTime || !account.lastReconciledTime)) {
|
||||
dateRangeType = DEFAULT_RECONCILIATION_STATEMENT_DATE_RANGE_IN_DESKTOP.type;
|
||||
} else {
|
||||
dateRangeType = defualtDateRange.type;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isNumber(dateRangeType) || dateRangeType === DateRange.Custom.type) {
|
||||
accountToShowReconciliationStatement.value = account;
|
||||
showCustomDateRangeDialog.value = true;
|
||||
|
||||
Reference in New Issue
Block a user