Show reconcile button and current reconciling-balance
This commit is contained in:
parent
511081298e
commit
eb9fc722aa
@ -1,7 +1,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, ref } from "vue";
|
import { computed, ref } from "vue";
|
||||||
import { useBudgetsStore } from "../stores/budget";
|
import { useBudgetsStore } from "../stores/budget";
|
||||||
import { Transaction } from "../stores/budget-account";
|
import { Transaction, useAccountStore } from "../stores/budget-account";
|
||||||
import Currency from "./Currency.vue";
|
import Currency from "./Currency.vue";
|
||||||
import TransactionEditRow from "./TransactionEditRow.vue";
|
import TransactionEditRow from "./TransactionEditRow.vue";
|
||||||
import { formatDate } from "../date";
|
import { formatDate } from "../date";
|
||||||
@ -12,31 +12,37 @@ const props = defineProps<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const edit = ref(false);
|
const edit = ref(false);
|
||||||
|
|
||||||
const CurrentBudgetID = computed(()=> useBudgetsStore().CurrentBudgetID);
|
const CurrentBudgetID = computed(() => useBudgetsStore().CurrentBudgetID);
|
||||||
|
const Reconciling = computed(() => useAccountStore().Reconciling);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<tr v-if="!edit" class="{{new Date(transaction.Date) > new Date() ? 'future' : ''}}"
|
<tr
|
||||||
:class="[index % 6 < 3 ? 'bg-gray-300' : 'bg-gray-100']">
|
v-if="!edit"
|
||||||
|
class="{{new Date(transaction.Date) > new Date() ? 'future' : ''}}"
|
||||||
|
:class="[index % 6 < 3 ? 'bg-gray-300' : 'bg-gray-100']"
|
||||||
|
>
|
||||||
<!--:class="[index % 6 < 3 ? index % 6 === 1 ? 'bg-gray-400' : 'bg-gray-300' : index % 6 !== 4 ? 'bg-gray-100' : '']">-->
|
<!--:class="[index % 6 < 3 ? index % 6 === 1 ? 'bg-gray-400' : 'bg-gray-300' : index % 6 !== 4 ? 'bg-gray-100' : '']">-->
|
||||||
<td>{{ formatDate(transaction.Date) }}</td>
|
<td>{{ formatDate(transaction.Date) }}</td>
|
||||||
<td>{{ transaction.TransferAccount ? "Transfer : " + transaction.TransferAccount : transaction.Payee }}</td>
|
<td>{{ transaction.TransferAccount ? "Transfer : " + transaction.TransferAccount : transaction.Payee }}</td>
|
||||||
|
<td>{{ transaction.CategoryGroup ? transaction.CategoryGroup + " : " + transaction.Category : "" }}</td>
|
||||||
<td>
|
<td>
|
||||||
{{ transaction.CategoryGroup ? transaction.CategoryGroup + " : " + transaction.Category : "" }}
|
<a
|
||||||
</td>
|
:href="'/budget/' + CurrentBudgetID + '/transaction/' + transaction.ID"
|
||||||
<td>
|
>{{ transaction.Memo }}</a>
|
||||||
<a :href="'/budget/' + CurrentBudgetID + '/transaction/' + transaction.ID">
|
|
||||||
{{ transaction.Memo }}
|
|
||||||
</a>
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Currency class="block" :value="transaction.Amount" />
|
<Currency class="block" :value="transaction.Amount" />
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>{{ transaction.Status == "Reconciled" ? "✔" : (transaction.Status == "Uncleared" ? "" : "*") }}</td>
|
||||||
{{ transaction.Status == "Reconciled" ? "✔" : (transaction.Status == "Uncleared" ? "" : "*") }}
|
<td class="text-right">
|
||||||
|
{{ transaction.GroupID ? "☀" : "" }}
|
||||||
|
<a @click="edit = true;">✎</a>
|
||||||
|
</td>
|
||||||
|
<td v-if="Reconciling && transaction.Status != 'Reconciled'">
|
||||||
|
<input type="checkbox" v-model="transaction.Reconciled" />
|
||||||
</td>
|
</td>
|
||||||
<td class="text-right">{{ transaction.GroupID ? "☀" : "" }}<a @click="edit = true;">✎</a></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<TransactionEditRow v-if="edit" :transactionid="transaction.ID" />
|
<TransactionEditRow v-if="edit" :transactionid="transaction.ID" />
|
||||||
</template>
|
</template>
|
||||||
|
@ -5,35 +5,39 @@ import TransactionRow from "../components/TransactionRow.vue";
|
|||||||
import TransactionInputRow from "../components/TransactionInputRow.vue";
|
import TransactionInputRow from "../components/TransactionInputRow.vue";
|
||||||
import { useAccountStore } from "../stores/budget-account";
|
import { useAccountStore } from "../stores/budget-account";
|
||||||
import EditAccount from "../dialogs/EditAccount.vue";
|
import EditAccount from "../dialogs/EditAccount.vue";
|
||||||
|
import Button from "../components/Button.vue";
|
||||||
|
|
||||||
const props = defineProps<{
|
defineProps<{
|
||||||
budgetid: string
|
budgetid: string
|
||||||
accountid: string
|
accountid: string
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const accountStore = useAccountStore();
|
const accounts = useAccountStore();
|
||||||
const CurrentAccount = computed(() => accountStore.CurrentAccount);
|
|
||||||
const TransactionsList = computed(() => accountStore.TransactionsList);
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<h1 class="inline">{{ CurrentAccount?.Name }}</h1>
|
<h1 class="inline">{{ accounts.CurrentAccount?.Name }}</h1>
|
||||||
<EditAccount /> <br />
|
<EditAccount /> <br />
|
||||||
|
|
||||||
<span>
|
<span>
|
||||||
Current Balance:
|
Current Balance:
|
||||||
<Currency :value="CurrentAccount?.WorkingBalance" />
|
<Currency :value="accounts.CurrentAccount?.WorkingBalance" />
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span>
|
<span>
|
||||||
Cleared Balance:
|
Cleared Balance:
|
||||||
<Currency :value="CurrentAccount?.ClearedBalance" />
|
<Currency :value="accounts.CurrentAccount?.ClearedBalance" />
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span>
|
<span v-if="accounts.Reconciling">
|
||||||
|
<br />
|
||||||
|
Reconciling
|
||||||
|
</span>
|
||||||
|
<span v-if="!accounts.Reconciling">
|
||||||
Reconciled Balance:
|
Reconciled Balance:
|
||||||
<Currency :value="CurrentAccount?.ReconciledBalance" />
|
<Currency :value="accounts.CurrentAccount?.ReconciledBalance" />
|
||||||
|
<Currency :value="accounts.ReconcilingBalance" />
|
||||||
|
<Button @click="accounts.Reconciling = true" v-if="!accounts.Reconciling">Reconcile</Button>
|
||||||
</span>
|
</span>
|
||||||
<table>
|
<table>
|
||||||
<tr class="font-bold">
|
<tr class="font-bold">
|
||||||
@ -44,10 +48,11 @@ const TransactionsList = computed(() => accountStore.TransactionsList);
|
|||||||
<td class="text-right">Amount</td>
|
<td class="text-right">Amount</td>
|
||||||
<td style="width: 20px;"></td>
|
<td style="width: 20px;"></td>
|
||||||
<td style="width: 40px;"></td>
|
<td style="width: 40px;"></td>
|
||||||
|
<td style="width: 20px;" v-if="accounts.Reconciling">R</td>
|
||||||
</tr>
|
</tr>
|
||||||
<TransactionInputRow :budgetid="budgetid" :accountid="accountid" />
|
<TransactionInputRow :budgetid="budgetid" :accountid="accountid" />
|
||||||
<TransactionRow
|
<TransactionRow
|
||||||
v-for="(transaction, index) in TransactionsList"
|
v-for="(transaction, index) in accounts.TransactionsList"
|
||||||
:transaction="transaction"
|
:transaction="transaction"
|
||||||
:index="index"
|
:index="index"
|
||||||
/>
|
/>
|
||||||
|
@ -4,27 +4,29 @@ import { useBudgetsStore } from "./budget";
|
|||||||
import { useSessionStore } from "./session";
|
import { useSessionStore } from "./session";
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
Accounts: Map<string, Account>,
|
Accounts: Map<string, Account>
|
||||||
CurrentAccountID: string | null,
|
CurrentAccountID: string | null
|
||||||
Categories: Map<string, Category>,
|
Categories: Map<string, Category>
|
||||||
Months: Map<number, Map<number, Map<string, Category>>>,
|
Months: Map<number, Map<number, Map<string, Category>>>
|
||||||
Transactions: Map<string, Transaction>,
|
Transactions: Map<string, Transaction>
|
||||||
Assignments: []
|
Assignments: []
|
||||||
|
Reconciling: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Transaction {
|
export interface Transaction {
|
||||||
ID: string,
|
ID: string
|
||||||
Date: Date,
|
Date: Date
|
||||||
TransferAccount: string,
|
TransferAccount: string
|
||||||
CategoryGroup: string,
|
CategoryGroup: string
|
||||||
Category: string,
|
Category: string
|
||||||
CategoryID: string | undefined,
|
CategoryID: string | undefined
|
||||||
Memo: string,
|
Memo: string
|
||||||
Status: string,
|
Status: string
|
||||||
GroupID: string,
|
GroupID: string
|
||||||
Payee: string,
|
Payee: string
|
||||||
PayeeID: string | undefined,
|
PayeeID: string | undefined
|
||||||
Amount: number,
|
Amount: number
|
||||||
|
Reconciled: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Account {
|
export interface Account {
|
||||||
@ -54,7 +56,8 @@ export const useAccountStore = defineStore("budget/account", {
|
|||||||
Months: new Map<number, Map<number, Map<string, Category>>>(),
|
Months: new Map<number, Map<number, Map<string, Category>>>(),
|
||||||
Categories: new Map<string, Category>(),
|
Categories: new Map<string, Category>(),
|
||||||
Transactions: new Map<string, Transaction>(),
|
Transactions: new Map<string, Transaction>(),
|
||||||
Assignments: []
|
Assignments: [],
|
||||||
|
Reconciling: false,
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
AccountsList(state) {
|
AccountsList(state) {
|
||||||
@ -93,6 +96,14 @@ export const useAccountStore = defineStore("budget/account", {
|
|||||||
|
|
||||||
return state.Accounts.get(state.CurrentAccountID);
|
return state.Accounts.get(state.CurrentAccountID);
|
||||||
},
|
},
|
||||||
|
ReconcilingBalance(state): number {
|
||||||
|
let reconciledBalance = this.CurrentAccount!.ReconciledBalance;
|
||||||
|
for (const transaction of this.TransactionsList) {
|
||||||
|
if(transaction.Reconciled)
|
||||||
|
reconciledBalance += transaction.Amount;
|
||||||
|
}
|
||||||
|
return reconciledBalance;
|
||||||
|
},
|
||||||
OnBudgetAccounts(state) {
|
OnBudgetAccounts(state) {
|
||||||
return [...state.Accounts.values()].filter(x => x.OnBudget);
|
return [...state.Accounts.values()].filter(x => x.OnBudget);
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user