Compare commits
47 Commits
ed62e72e6a
...
0b3770fb95
Author | SHA1 | Date | |
---|---|---|---|
0b3770fb95 | |||
364c44d60a | |||
4364af9b9a | |||
20773c4640 | |||
233c6d6aa9 | |||
c9c3bc0d2c | |||
b938176b5f | |||
dfdd3b0924 | |||
930213c461 | |||
1b67df61be | |||
53497e7593 | |||
835af70bc7 | |||
706d26e54f | |||
df8ec39e1e | |||
5430c6713f | |||
d44c2a1200 | |||
42eaa015bd | |||
9bb9eaabaf | |||
faa53c625c | |||
1dcb31df57 | |||
f3ad696168 | |||
f76d2a5736 | |||
fed7def6f3 | |||
34fd8233cf | |||
8f1903e532 | |||
407974e440 | |||
35d397f5c9 | |||
38014b7c91 | |||
4ba1317fce | |||
9fe7bf22a6 | |||
412b79ee45 | |||
4e94557370 | |||
798c7d3c07 | |||
bfb41d8d15 | |||
7f188db677 | |||
0f8e3e5d4a | |||
ae26b64d5e | |||
37e9e19c5e | |||
58758b0cb3 | |||
349ecf3d76 | |||
1e33074b4d | |||
161acabb7d | |||
5a1b54f782 | |||
61ed6f82d7 | |||
39617a54ac | |||
de890aeade | |||
0ee500af3e |
BIN
libdrcr/drcr_testing.db
Normal file
BIN
libdrcr/drcr_testing.db
Normal file
Binary file not shown.
@ -199,7 +199,7 @@ impl DbConnection {
|
||||
).map(|r: SqliteRow| StatementLine {
|
||||
id: Some(r.get("id")),
|
||||
source_account: r.get("source_account"),
|
||||
dt: NaiveDateTime::parse_from_str(r.get("dt"), "%Y-%m-%d %H:%M:%S.%6f").expect("Invalid statement_lines.dt"),
|
||||
dt: NaiveDateTime::parse_from_str(r.get("dt"), "%Y-%m-%d").expect("Invalid statement_lines.dt"),
|
||||
description: r.get("description"),
|
||||
quantity: r.get("quantity"),
|
||||
balance: r.get("balance"),
|
||||
|
@ -397,12 +397,7 @@ impl ReportingStep for GenerateBalances {
|
||||
let mut balances = BalancesAt {
|
||||
balances: HashMap::new(),
|
||||
};
|
||||
update_balances_from_transactions(
|
||||
&mut balances.balances,
|
||||
transactions
|
||||
.iter()
|
||||
.filter(|t| t.transaction.dt.date() <= self.args.date),
|
||||
);
|
||||
update_balances_from_transactions(&mut balances.balances, transactions.iter());
|
||||
|
||||
// Store result
|
||||
let mut result = ReportingProducts::new();
|
||||
|
@ -1,6 +1,6 @@
|
||||
<!--
|
||||
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
|
||||
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">
|
||||
<span class="text-gray-500">{{ db.metadata.reporting_commodity }}</span>
|
||||
</div>
|
||||
<input type="text" class="bordered-field pl-7" v-model="posting.amount_abs" @input="onAmountChange(posting)">
|
||||
<input type="text" class="bordered-field pl-7" v-model="posting.amount_abs">
|
||||
</div>
|
||||
</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">
|
||||
<span class="text-gray-500">{{ db.metadata.reporting_commodity }}</span>
|
||||
</div>
|
||||
<input type="text" class="bordered-field pl-7" v-model="posting.amount_abs" @input="onAmountChange(posting)">
|
||||
<input type="text" class="bordered-field pl-7" v-model="posting.amount_abs">
|
||||
</div>
|
||||
</td>
|
||||
</template>
|
||||
@ -312,15 +312,4 @@
|
||||
|
||||
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>
|
||||
|
@ -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 pr-1 text-gray-900">{{ assertion.quantity >= 0 ? 'Dr' : 'Cr' }}</td>
|
||||
<td class="py-0.5 px-1 text-gray-900">
|
||||
<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 === false" />
|
||||
<CheckIcon class="w-4 h-4" v-if="assertion.is_valid" />
|
||||
<XMarkIcon class="w-4 h-4 text-red-500" v-if="!assertion.is_valid" />
|
||||
</td>
|
||||
<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);">
|
||||
@ -68,7 +68,6 @@
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { db } from '../db.ts';
|
||||
import { pp } from '../display.ts';
|
||||
|
||||
const balanceAssertions = ref([] as ValidatedBalanceAssertion[]);
|
||||
@ -84,15 +83,6 @@
|
||||
}
|
||||
|
||||
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'));
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<!--
|
||||
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
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
@ -63,7 +63,6 @@
|
||||
import dayjs from 'dayjs';
|
||||
import { PencilIcon, PlusIcon } from '@heroicons/vue/24/outline';
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import { UnlistenFn, listen } from '@tauri-apps/api/event';
|
||||
import { onUnmounted, ref, watch } from 'vue';
|
||||
|
||||
import { Transaction } from '../db.ts';
|
||||
@ -152,20 +151,9 @@
|
||||
|
||||
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(() => {
|
||||
if (clusterize !== null) {
|
||||
clusterize.destroy();
|
||||
}
|
||||
|
||||
if (unlistenTransactionUpdated !== null) {
|
||||
unlistenTransactionUpdated();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<!--
|
||||
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
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
@ -60,10 +60,12 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import Clusterize from 'clusterize.js';
|
||||
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { PencilIcon } from '@heroicons/vue/24/outline';
|
||||
import { PlusIcon } from '@heroicons/vue/16/solid';
|
||||
import { UnlistenFn, listen } from '@tauri-apps/api/event';
|
||||
|
||||
import { onUnmounted, ref, watch } from 'vue';
|
||||
|
||||
import { JoinedTransactionPosting, Transaction, db, joinedToTransactions } from '../db.ts';
|
||||
@ -155,20 +157,9 @@
|
||||
|
||||
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(() => {
|
||||
if (clusterize !== null) {
|
||||
clusterize.destroy();
|
||||
}
|
||||
|
||||
if (unlistenTransactionUpdated !== null) {
|
||||
unlistenTransactionUpdated();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user