Implement assignment import and clear of budget

This commit is contained in:
2021-12-07 15:18:47 +00:00
parent 6f4bff929e
commit 0b0b20c5ec
12 changed files with 249 additions and 23 deletions

View File

@ -21,6 +21,14 @@ WHERE category_groups.budget_id = $1;
-- name: GetCategoriesWithBalance :many
SELECT categories.id, categories.name, category_groups.name as group,
COALESCE(
(
SELECT SUM(a_hist.amount)
FROM assignments a_hist
WHERE categories.id = a_hist.category_id
AND a_hist.date < @from_date
)
, 0)::decimal(12,2) as balance_assignments,
COALESCE(
(
SELECT SUM(t_hist.amount)