Make available balance date-dependent
This commit is contained in:
@ -67,10 +67,12 @@ SELECT
|
||||
LEFT JOIN categories ON categories.id = transactions.category_id
|
||||
LEFT JOIN budgets ON budgets.income_category_id = categories.id
|
||||
WHERE budgets.id = @budget_id
|
||||
AND transactions.date < @from_date
|
||||
) - (
|
||||
SELECT SUM(assignments.amount)
|
||||
FROM assignments
|
||||
INNER JOIN categories ON categories.id = assignments.category_id
|
||||
INNER JOIN category_groups ON category_groups.id = categories.category_group_id
|
||||
WHERE category_groups.budget_id = @budget_id
|
||||
AND assignments.date < @from_date
|
||||
))::decimal(12,2);
|
Reference in New Issue
Block a user