-
Notifications
You must be signed in to change notification settings - Fork 513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for re-write rules (aka ledger "views", allows keeping separate books) (BZ#714) #714
Comments
Comment author: Martin Michlmayr (@tbm) I'd like to propose a feature (for post 3.0) that would make ledger My idea is inspired by SQL views. In SQL, you can can define a Essentially what I'd like to do is to specify a config file in Let's consider some examples of how this would be useful. Example 1) Cash vs accruals basis I have Google ads on my web site and get a small income from this. So in ledger I have transactions like this:
So far so good. The problem is that when I do my tax return, I don't It would be great if I could tell ledger in a config file:
In the example above, this would delete the first two transactions
(Bonus points if I can also re-write the description from "AdSense Example 2) Combining accounts into one - salary, taxes, etc A lot of us are tracking our personal finance. We sometimes get This question was recently asked on this list and I argued in This is another example that could be simplified if ledger would Let's take a simpler example: let's say you receive money from PayPal.
In this case, if I want to know the net income, I have to run:
What I'd like to do is specify a file containing re-write rules so
Then I could run ledger reg on my ledger file and get:
But if I'd specify ledger reg --re-write test, I'd get:
I think such a feature would be very powerful and I can think of many |
Comment author: John Wiegley (@jwiegley) This sounds like a fantastic feature for 3.1, and I think it fits beautifully. One query you can do right now is this one:
This would be phrased as:
The 'any' operator is used to query whether any of the other postings -- in the transaction of a matched posting -- match an expression. But I see that your idea goes much beyond this, to allow reconfiguring transactions, adding and dropping postings, adding and dropping transactions, etc. I think something automated transactions can be extended to do this by adding an expression based rewriter, rather than the simplistic postings-manipulator that it currently provides. |
Comment author: Martin Blais (@blais) A few comments on this ticket: First, Assets:Receivable:AdSense is not really a "receivable." You Second, you could potentially track it by having two separate
I'll admit that it's inelegant to have to duplicate the transactions, Thirdly, about the salary transaction, you cannot realistically |
Comment author: Martin Michlmayr (@tbm) (In reply to comment #2)
This is an interesting observation, but after thinking about it I think I disagree with you. Even though I can see my "account balance" with Google at any time, I cannot access the money. I have to wait for Google to transfer the money to me and they only do it once I reach a certain amount. As such, this is more like a receivable. If Google went out of business, I would not receive my money and would have to write off my receivable. This is different to e.g. a PayPal account where I can request payment at any time.
I agree that this achieves what I'm looking for but I also agree that it's inelegant.
The amounts may vary, but the accounts stay the same. Basically, I just want to be able to specify queries that transform the ledger data. How complicated the queries are are up to me... Before this feature is implemented, it probably makes sense to think about some specific use cases. |
Comment author: Martin Blais (@blais) (In reply to comment #3)
If PayPal went out of business, you would not receive your money and would have to write off the account. If you billed Google Inc. - an opaque entity which hasn't paid you yet - with an invoice for contract work done, that would be a clear receivable IMO, because you are the one tracking the amounts being owed. But this AdSense account has your name all over it, you can even "log in to your account" and see the accrued balance and they're tracking for you. It looks and feels to me much more like a bank account than an amount not received from "another" entity, even if it has restrictions on it. Note that you also can't just get your money from a bank, there's a process, going to the counter, accessing an ATM, etc. - try initiating an outgoing wire transfer without being present in the bank's country, for example, and see how well that goes (basically impossible with most banks, and yup, that's your money you cannot get). It is a small semantic difference, and I'm not sure what unambiguous criteria would define a receivable. I'm not sure there even is a definitive answer. What makes sense to me, is that the factor that decides it is whether you are the one tracking them to pay you or whether there is a remote account with your name on it that takes care of that in your name. Even then that's not decisive, I'm sure you can come up with a counterexample.
I really do think solving the problem of cash vs. accrual accounting more generally is an important one and should have a well-known solution for it. We ought to have a long discussion about just that topic sometime. Maybe it's time for the first worldwide Ledger conference :-) |
Note: the issue was created automatically with bugzilla2github
Bugzilla bug ID: BZ#714
From: Martin Michlmayr (@tbm)
CC: @blais, @thdox
The text was updated successfully, but these errors were encountered: