Effective dates in Automated Transactions

Skip to first unread message


Sep 22, 2023, 9:54:48 AM9/22/23
to Ledger
I have the following use case I'd like to support:

My bank transactions include income from credit card transactions which are net of fees to the credit card company. I have an automated transaction setup to post the fee portion which means I can track explicitly how much I'm paying in credit card fees. So far so good.

Sometimes I have a prepayment transaction which is for the following year (money received in 2022, but really should be recorded as income in 2023). I'd like to separately correct the transaction from my bank statement to show the income in the next year. Ideally the automated transaction would follow the effective dates of each post in the correct transaction, however this doesn't happen.

Here's an example which shows the issue:

; Automated transaction rule
= expr account =~ /Income:Rooms:Credit Cards/
  [Expenses:Credit Card Fees]  (-amount * 0.02 / (1 - 0.02))
  [Income:Rooms:Credit Cards]  (amount * 0.02 / (1 - 0.02))

; Two transactions direcly from the bank
2022/10/20 Sample Transaction
  Income:Rooms:Credit Cards  EUR -98
  Assets:Bank Account

2022/10/21 Sample Prepayment Transaction
  Income:Rooms:Credit Cards  EUR -196
  Assets:Bank Account

; Manual correcting transaction to move the second receipt from 2022 to 2023
2022/10/21 Prepayment Correction
  Income:Rooms:Credit Cards  EUR 196
  Income:Rooms:Credit Cards:2023 Prepayment  ; [=2023/01/01]

If I ask for the Expenses register I get

% ledger -f prepayment-test.dat reg Expenses --effective --sort d

22-Oct-20 Sample Transaction  [Ex:Credit Card Fees]       EUR 2       EUR 2

22-Oct-21 Sample Prepayment.. [Ex:Credit Card Fees]       EUR 4       EUR 6

22-Oct-21 Prepayment Correc.. [Ex:Credit Card Fees]      EUR -4       EUR 2

                              [Ex:Credit Card Fees]       EUR 4       EUR 6

Ideally the very last posting above would be dated 23-Jan-01 using the effective date from the second posting in the Manual correcting transaction.

If there's already a way to do this - great. Otherwise could it be logged as a feature request?

Thanks in advance,

Reply all
Reply to author
0 new messages