-
-
Notifications
You must be signed in to change notification settings - Fork 320
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 assertions which include subaccounts #290
Comments
I agree we should have some way to assert on the subaccount-inclusive balance. (#195 is another balance assertions wish.) I'm not familiar with how you're using the subaccount here. Can't you easily see what you've paid over time with a report ? |
PS for example, I'm thinking of something like:
|
On Sun, Oct 18, 2015 at 16:53:14 -0700, Simon Michael wrote:
As for how the accounts are used:
which all works fine. I also need an account to pay off bills. My Setting the card == bill account and instead splitting the credit line |
On Sun, Oct 18, 2015 at 20:56:43 -0400, Ben Boeckel wrote:
Maybe adding such a layout should be put into some kind of For example, here is how I handle increases in pledge values on
Where the transaction date is that of the pledge or increase and the And then if the Kickstarter fails:
Having all the clear dates be the same ensures that no assertion is |
Yes please! (But where ? Too big a topic to discuss here, but a good h/ledger cookbook is needed). |
Well, some place on the website would be nice, but I think soliciting advice from the h/ledger lists on how others approach it would be a first step. |
Back to the topic at hand - if you come up with a design for this, let me know. I assume I can't just make it work that way by default, because it would cause unexpected breakage and confusion when switching between Ledger and hledger. |
Maybe use |
I was going to use == for "all commodities, not just one" - how could we cover all four of these cases (or should we ?) |
Well, answering myself, you could do the obvious:
I think not, too hard to remember. |
I don't think multiple commodities is needed; can't you just have multiple assertion transactions? |
We need a way to say that no other commodities are present, too.
|
@simonmichael, I'd agree with @mathstuf that attempt to assert total amount of multi-currency account is nearly impossible without specifying rates of conversion in the same posting. |
That makes sense, thanks for the comment. Asserting a multicommodity zero (account is completely empty) might still be a reason to support ====. Would a |
@simonmichael, agree Note that I'm not sure how to represent right side of multi-currency assertion. I guess it is safe to have zero assertions, but whenever we refer to other value we have to deal with commodities exchange rates. As well multi-currency assertions cannot produce implicit flow.
I just came back to issue with sub-accounts again when I was touching one of my accounts balances:
Worth to mention that with such syntax there is no way to specify different sub-account as a recipient of balance difference. Though I have no such cases I can imagine them:
which is effectively
Though I'd expect that initial implementation should only allow assertion without implicit flow generation. P.S. Actually other way to represent "hold" on account which I use right now is to add sub-account with negative balance and in tree-view of balance see it as available funds:
Updated: I actually assert with positive balance |
This is similar to the way I've done credit lines (my original use case for multi-account assertions):
|
Note that ledger-cli supports them using the global assert directive:
except that they don't work well (ledger/ledger#1679). If correct syntax is difficult to come by, especially if we want to be compatible with ledger-cli, perhaps an assert directive could be used. |
That's a dateless assertion, entirely dependent on parse order; I don't think we want those. |
here: hledger/hledger-lib/Hledger/Data/Journal.hs Line 537 in 2960c92
|
parsing here:
|
About the syntax, could it be possible to represent multi currencies assertions by specifying the different currencies on the right hand side? Something like that:
Here we want to assert that the banking account has $100, 100€, and nothing more. A sign like Then, to assert over sub-accounts as well, we could use another operator like |
Something like that for the parser... diff hledger-lib/Hledger/Read/Common.hs hledger-lib/Hledger/Read/Common.hs
balanceassertionp :: JournalParser m BalanceAssertion
balanceassertionp = do
sourcepos <- genericSourcePos <$> lift getSourcePos
char '='
exact <- optional $ try $ char '='
+ recurse <- optional $ try $ char '*'
lift (skipMany spacenonewline)
a <- amountp <?> "amount (for a balance assertion or assignment)" -- XXX should restrict to a simple amount
return BalanceAssertion
{ baamount = a
+ , barecurse = isJust recurse
, baexact = isJust exact
, baposition = sourcepos
} |
#934 is the latest discussion on that. |
@mildred I mean, #934 is a proposal to allow writing multi-commodity amounts in assertions and elsewhere. (If you have a real need for this feature, do write about it there.) Regarding this issue #290, I have lost the context. Maybe someone can review it and make a recommendation on whether we need subaccount-inclusive assertions and how they should look and work. |
Reminding myself.. here are some distinct, interrelated balance assertion issues under discussion:
[for completeness: we also have]
|
Inviting list discussion |
Sorry, my comments might seem a little difficult to understand. I'm tracking this issue because I have a real need for this. Unfortunately, Iḿ not well versed into Haskell. if I was, I would have made a pull request long ago. So until someone works on this, I'm looking at bits and pieces to decipher the code to eventually make a contribution. I need this feature to ensure that my ledger file is consistent with the amount shown on my bank account. Until then, I make manual checks, when I find the time to, and when I do, I often find surprises... Basically, I have my accounts organized like this:
But in reality, I have only one bank account. I'd like to only have a single place where I store cash too, but there I can arrange for different physical envelopes. I need to make sure that each month, the amount shown on my bank account matches all the ledger accounts under
In the future, I'd also like to reorganize accounts to have a single provisions hierarchy, and different commodities for cash and virtual money on the bank account, so I also need recursive multi commodity assertions. Write something like:
|
So until someone works on this, I'm looking at bits and pieces to decipher the code to eventually make a contribution.
That's appreciated! Feel free to ask for more help on #hledger. Also thanks for the extra details, which make sense.
I wonder why I haven't felt this need myself ? I have ~300 assertions in 2018, excluding opening/closing transactions. It seems my assertions tend to be on accounts which don't have subaccounts. And when reconciling, I tend to just do a one time check of the inclusive account balances in hledger-ui. I don't usually record that as an assertion.
|
Making some progress on this: #974 |
Now in master. https://groups.google.com/d/msg/hledger/47F-ZiajbMU/9edMGm2OBAAJ, http://hledger.org/journal.html#assertions-and-subaccounts
|
Thank you a lot ! |
Ehh... I hoped Anyway thank you. I also wanted this feature. I think I still can associate difference between |
Hmm. I don't love what we have, but everything else so far, including this, seems a bit harder to remember or intuit.
|
I have the current accounts for each credit card:
I would like to assert on the outstanding balance on each card, but there is no way to take the amount paid in bills to the card when asserting on its balance.
Is there a better way to structure the accounts? I'd really like a separate one for the bills to go to so I can see how much I've paid over time, but if there's some other way to do so with a merged account, that'd be fine too.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: