Invalidate running balances when classifying statement line

This commit is contained in:
RunasSudo 2024-11-18 21:16:08 +11:00
parent 06439768ed
commit efa42415a9
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

View File

@ -206,6 +206,20 @@
[statementLine.id, accountPostingId] [statementLine.id, accountPostingId]
); );
// Invalidate running balances
await dbTransaction.execute(
`UPDATE postings
SET running_balance = NULL
FROM (
SELECT postings.id
FROM transactions
JOIN postings ON transactions.id = postings.transaction_id
WHERE DATE(dt) >= DATE($1) AND account IN ($2, $3)
) p
WHERE postings.id = p.id`,
[statementLine.dt, statementLine.source_account, chargeAccount]
);
dbTransaction.commit(); dbTransaction.commit();
// Reload transactions and re-render the table // Reload transactions and re-render the table