Compare commits
52 Commits
0b3770fb95
...
ed62e72e6a
Author | SHA1 | Date | |
---|---|---|---|
ed62e72e6a | |||
763e27db03 | |||
79a6eecfbd | |||
3f580799c6 | |||
b3defb562f | |||
62b7981224 | |||
0d680275df | |||
a40e2f81ba | |||
d326b3ae43 | |||
4f1db12688 | |||
00c7833706 | |||
2a2fb5764c | |||
bb8383b222 | |||
e02b927b69 | |||
280a2090d9 | |||
aa5238917e | |||
0518163c3e | |||
148390f030 | |||
b111e7023c | |||
541467a2da | |||
b8b2547aab | |||
eb3fbccc85 | |||
f4c232ae35 | |||
3cfcdf6778 | |||
33252739d9 | |||
3913558410 | |||
737ed5bfb2 | |||
eb13bd5a87 | |||
004f749c33 | |||
fd761934e0 | |||
a0c4aedb2d | |||
fa7381fce5 | |||
fa76461926 | |||
3add701d3c | |||
ec470f8ced | |||
0eb583d028 | |||
1bed0f269e | |||
98018bb4bc | |||
40b0afe492 | |||
71c3629898 | |||
db89814498 | |||
9e34360abf | |||
d422e83275 | |||
2d7250e943 | |||
959a8d8fb2 | |||
ed0fbfb5dd | |||
e47ad229eb | |||
d78d6ed1fe | |||
b28c75c00f | |||
4add6292a1 | |||
a7e9c74dd1 | |||
f15d190112 |
Binary file not shown.
@ -199,7 +199,7 @@ impl DbConnection {
|
|||||||
).map(|r: SqliteRow| StatementLine {
|
).map(|r: SqliteRow| StatementLine {
|
||||||
id: Some(r.get("id")),
|
id: Some(r.get("id")),
|
||||||
source_account: r.get("source_account"),
|
source_account: r.get("source_account"),
|
||||||
dt: NaiveDateTime::parse_from_str(r.get("dt"), "%Y-%m-%d").expect("Invalid statement_lines.dt"),
|
dt: NaiveDateTime::parse_from_str(r.get("dt"), "%Y-%m-%d %H:%M:%S.%6f").expect("Invalid statement_lines.dt"),
|
||||||
description: r.get("description"),
|
description: r.get("description"),
|
||||||
quantity: r.get("quantity"),
|
quantity: r.get("quantity"),
|
||||||
balance: r.get("balance"),
|
balance: r.get("balance"),
|
||||||
|
@ -397,7 +397,12 @@ impl ReportingStep for GenerateBalances {
|
|||||||
let mut balances = BalancesAt {
|
let mut balances = BalancesAt {
|
||||||
balances: HashMap::new(),
|
balances: HashMap::new(),
|
||||||
};
|
};
|
||||||
update_balances_from_transactions(&mut balances.balances, transactions.iter());
|
update_balances_from_transactions(
|
||||||
|
&mut balances.balances,
|
||||||
|
transactions
|
||||||
|
.iter()
|
||||||
|
.filter(|t| t.transaction.dt.date() <= self.args.date),
|
||||||
|
);
|
||||||
|
|
||||||
// Store result
|
// Store result
|
||||||
let mut result = ReportingProducts::new();
|
let mut result = ReportingProducts::new();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<!--
|
<!--
|
||||||
DrCr: Web-based double-entry bookkeeping framework
|
DrCr: Web-based double-entry bookkeeping framework
|
||||||
Copyright (C) 2022–2025 Lee Yingtong Li (RunasSudo)
|
Copyright (C) 2022-2025 Lee Yingtong Li (RunasSudo)
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU Affero General Public License as published by
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
@ -62,7 +62,7 @@
|
|||||||
<div class="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3">
|
<div class="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3">
|
||||||
<span class="text-gray-500">{{ db.metadata.reporting_commodity }}</span>
|
<span class="text-gray-500">{{ db.metadata.reporting_commodity }}</span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="bordered-field pl-7" v-model="posting.amount_abs">
|
<input type="text" class="bordered-field pl-7" v-model="posting.amount_abs" @input="onAmountChange(posting)">
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="amount-cr py-1 pl-1"></td>
|
<td class="amount-cr py-1 pl-1"></td>
|
||||||
@ -74,7 +74,7 @@
|
|||||||
<div class="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3">
|
<div class="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3">
|
||||||
<span class="text-gray-500">{{ db.metadata.reporting_commodity }}</span>
|
<span class="text-gray-500">{{ db.metadata.reporting_commodity }}</span>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="bordered-field pl-7" v-model="posting.amount_abs">
|
<input type="text" class="bordered-field pl-7" v-model="posting.amount_abs" @input="onAmountChange(posting)">
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</template>
|
</template>
|
||||||
@ -312,4 +312,15 @@
|
|||||||
|
|
||||||
await getCurrentWindow().close();
|
await getCurrentWindow().close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function onAmountChange(posting: EditingPosting) {
|
||||||
|
// Synchronise the amounts if only two postings
|
||||||
|
if (transaction.postings.length == 2) {
|
||||||
|
for (const otherPosting of transaction.postings) {
|
||||||
|
if (otherPosting !== posting) {
|
||||||
|
otherPosting.amount_abs = posting.amount_abs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -48,8 +48,8 @@
|
|||||||
<td class="py-0.5 px-1 text-gray-900 text-end">{{ pp(Math.abs(assertion.quantity)) }}</td>
|
<td class="py-0.5 px-1 text-gray-900 text-end">{{ pp(Math.abs(assertion.quantity)) }}</td>
|
||||||
<td class="py-0.5 pr-1 text-gray-900">{{ assertion.quantity >= 0 ? 'Dr' : 'Cr' }}</td>
|
<td class="py-0.5 pr-1 text-gray-900">{{ assertion.quantity >= 0 ? 'Dr' : 'Cr' }}</td>
|
||||||
<td class="py-0.5 px-1 text-gray-900">
|
<td class="py-0.5 px-1 text-gray-900">
|
||||||
<CheckIcon class="w-4 h-4" v-if="assertion.is_valid" />
|
<CheckIcon class="w-4 h-4" v-if="assertion.is_valid === true" />
|
||||||
<XMarkIcon class="w-4 h-4 text-red-500" v-if="!assertion.is_valid" />
|
<XMarkIcon class="w-4 h-4 text-red-500" v-if="assertion.is_valid === false" />
|
||||||
</td>
|
</td>
|
||||||
<td class="py-0.5 pl-1 text-gray-900 text-end">
|
<td class="py-0.5 pl-1 text-gray-900 text-end">
|
||||||
<a :href="'/balance-assertions/edit/' + assertion.id" class="text-gray-500 hover:text-gray-700" onclick="return openLinkInNewWindow(this);">
|
<a :href="'/balance-assertions/edit/' + assertion.id" class="text-gray-500 hover:text-gray-700" onclick="return openLinkInNewWindow(this);">
|
||||||
@ -68,6 +68,7 @@
|
|||||||
import { invoke } from '@tauri-apps/api/core';
|
import { invoke } from '@tauri-apps/api/core';
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
|
||||||
|
import { db } from '../db.ts';
|
||||||
import { pp } from '../display.ts';
|
import { pp } from '../display.ts';
|
||||||
|
|
||||||
const balanceAssertions = ref([] as ValidatedBalanceAssertion[]);
|
const balanceAssertions = ref([] as ValidatedBalanceAssertion[]);
|
||||||
@ -83,6 +84,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function load() {
|
async function load() {
|
||||||
|
// Since validating the assertions takes a while, first load them from database
|
||||||
|
const session = await db.load();
|
||||||
|
balanceAssertions.value = await session.select(
|
||||||
|
`SELECT id, dt, description, account, quantity, commodity, NULL as is_valid
|
||||||
|
FROM balance_assertions
|
||||||
|
ORDER BY dt DESC, id DESC`
|
||||||
|
);
|
||||||
|
|
||||||
|
// Then validate them in the background
|
||||||
balanceAssertions.value = JSON.parse(await invoke('get_validated_balance_assertions'));
|
balanceAssertions.value = JSON.parse(await invoke('get_validated_balance_assertions'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<!--
|
<!--
|
||||||
DrCr: Web-based double-entry bookkeeping framework
|
DrCr: Web-based double-entry bookkeeping framework
|
||||||
Copyright (C) 2022–2025 Lee Yingtong Li (RunasSudo)
|
Copyright (C) 2022-2025 Lee Yingtong Li (RunasSudo)
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU Affero General Public License as published by
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
@ -63,6 +63,7 @@
|
|||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { PencilIcon, PlusIcon } from '@heroicons/vue/24/outline';
|
import { PencilIcon, PlusIcon } from '@heroicons/vue/24/outline';
|
||||||
import { invoke } from '@tauri-apps/api/core';
|
import { invoke } from '@tauri-apps/api/core';
|
||||||
|
import { UnlistenFn, listen } from '@tauri-apps/api/event';
|
||||||
import { onUnmounted, ref, watch } from 'vue';
|
import { onUnmounted, ref, watch } from 'vue';
|
||||||
|
|
||||||
import { Transaction } from '../db.ts';
|
import { Transaction } from '../db.ts';
|
||||||
@ -151,9 +152,20 @@
|
|||||||
|
|
||||||
load();
|
load();
|
||||||
|
|
||||||
|
// Refresh transaction list when transaction updated
|
||||||
|
let unlistenTransactionUpdated: UnlistenFn | null = null;
|
||||||
|
(async () => {
|
||||||
|
// Cannot await at top level without <Suspense> therefore do this in an async function
|
||||||
|
unlistenTransactionUpdated = await listen('transaction-updated', async (_event) => { await load(); });
|
||||||
|
})();
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
if (clusterize !== null) {
|
if (clusterize !== null) {
|
||||||
clusterize.destroy();
|
clusterize.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (unlistenTransactionUpdated !== null) {
|
||||||
|
unlistenTransactionUpdated();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<!--
|
<!--
|
||||||
DrCr: Web-based double-entry bookkeeping framework
|
DrCr: Web-based double-entry bookkeeping framework
|
||||||
Copyright (C) 2022–2025 Lee Yingtong Li (RunasSudo)
|
Copyright (C) 2022-2025 Lee Yingtong Li (RunasSudo)
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU Affero General Public License as published by
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
@ -60,12 +60,10 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Clusterize from 'clusterize.js';
|
import Clusterize from 'clusterize.js';
|
||||||
|
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
import { PencilIcon } from '@heroicons/vue/24/outline';
|
import { PencilIcon } from '@heroicons/vue/24/outline';
|
||||||
import { PlusIcon } from '@heroicons/vue/16/solid';
|
import { PlusIcon } from '@heroicons/vue/16/solid';
|
||||||
|
import { UnlistenFn, listen } from '@tauri-apps/api/event';
|
||||||
import { onUnmounted, ref, watch } from 'vue';
|
import { onUnmounted, ref, watch } from 'vue';
|
||||||
|
|
||||||
import { JoinedTransactionPosting, Transaction, db, joinedToTransactions } from '../db.ts';
|
import { JoinedTransactionPosting, Transaction, db, joinedToTransactions } from '../db.ts';
|
||||||
@ -157,9 +155,20 @@
|
|||||||
|
|
||||||
load();
|
load();
|
||||||
|
|
||||||
|
// Refresh transaction list when transaction updated
|
||||||
|
let unlistenTransactionUpdated: UnlistenFn | null = null;
|
||||||
|
(async () => {
|
||||||
|
// Cannot await at top level without <Suspense> therefore do this in an async function
|
||||||
|
unlistenTransactionUpdated = await listen('transaction-updated', async (_event) => { await load(); });
|
||||||
|
})();
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
if (clusterize !== null) {
|
if (clusterize !== null) {
|
||||||
clusterize.destroy();
|
clusterize.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (unlistenTransactionUpdated !== null) {
|
||||||
|
unlistenTransactionUpdated();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user