Skip to content

Commit

Permalink
Track reversals of transactions generated by overpayments and year-ends
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuelsmann committed Jul 25, 2023
1 parent d3e934f commit 1355c71
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion sql/modules/EndOfYear.sql
Expand Up @@ -202,7 +202,14 @@ BEGIN
SELECT 'Reversing ' || reference, 'Reversing ' || description,
true, 'ye'
FROM gl WHERE id = (select trans_id from yearend
where transdate = in_end_date and reversed is not true);
where transdate = in_end_date
and reversed is not true);

UPDATE transactions
SET reversing = (select trans_id from yearend
where transdate = in_end_date
and reversed is not true)
WHERE id = currval('id');

INSERT INTO acc_trans (chart_id, amount_bc, curr, amount_tc,
transdate, trans_id, approved)
Expand Down
2 changes: 2 additions & 0 deletions sql/modules/Payment.sql
Expand Up @@ -1649,6 +1649,8 @@ END IF;

t_id := currval('id');

UPDATE transactions SET reversing = in_id WHERE id = t_id;

INSERT INTO voucher (batch_id, trans_id, batch_class)
VALUES (in_batch_id, t_id, CASE WHEN in_account_class = 1 THEN 4 ELSE 7 END);

Expand Down

0 comments on commit 1355c71

Please sign in to comment.