Balance assertion for a top level account

2016-02-04 Thread Chris Bennett
Hi there,

I use assertions for account statements, opening & closing balances
etc.

I have quarterly reporting requirements for my business and would like
to add some additional assertions for some of the top level accounts
(Expenses, Income).  I don't seem to be able to make this work.

In a test file:

2015/10/01 Light Refreshments
  MyCompany:Expenses:LightRefreshments   $4.55
  MyCompany:Liabilities:AP:LightRefreshments


$ ledger -f test.ledger bal
   0  MyCompany
   $4.55Expenses:LightRefreshments
  $-4.55Liabilities:AP:LightRefreshments

   0

$ ledger -f test.ledger bal ^MyCompany:Expenses --depth 2
   $4.55  MyCompany:Expenses


But when I assert a balance for the Expense account, it errors:

2015/12/31 MyCompany:Expenses closing balance
  MyCompany:Expenses $0.00 = $4.55
  Equity:Dummy


$ ledger -f test.ledger bal
While parsing posting:
  MyCompany:Expenses $0.00 = $4.55
 ^
Error: Balance assertion off by $4.55

I remember this coming up in the ML in the past, but can't find a
reference.  I want to refactor some of my accounts & transactions, but
want to avoid breaking the resultant value for top level accounts
(since the data has already been reported to the government and I
don't want that to change by my refactoring :)).

Any suggestions on how to do what I want?

Thanks,

Chris

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Balance assertion for a top level account

2016-02-04 Thread Ben Finney
Ben Finney  writes:

> Chris Bennett  writes:
>
> > 2015/12/31 MyCompany:Expenses closing balance
> >   MyCompany:Expenses $0.00 = $4.55
> >   Equity:Dummy
>
> You're asserting “After this transaction that moves $0.00, the balance
> should be $4.55”.

My understanding of this is informed by the Ledger 3 documentation
,
maybe you could explain in those terms what you expect to happen?

-- 
 \  “There's a certain part of the contented majority who love |
  `\anybody who is worth a billion dollars.” —John Kenneth |
_o__)Galbraith, 1992-05-23 |
Ben Finney

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Balance assertion for a top level account

2016-02-04 Thread Chris Bennett
Hi Ben,

Thanks for your reply.

> Yes. You're asserting ???After this transaction that moves $0.00, the
> balance should be $4.55???.

Yep, that's how I've been using that expression for beginning and end
of statement balance assertions, to pre & post declare what the
balance must be at beginning and end of the specified transactions.

ledger3.pdf that I have on hand says:
  6.10.1 Balance assertions
  [..]
Assets:Cash   $-20.00 = $500.00

  This simply asserts that after subtracting $20.00 from Assets:Cash,
  that the resulting total matches $500.00. If not, it is an error.

>$9.10Expenses

The reversal of values for the balance assertion in your example has
doubled the value of Expenses :(

My example works if I specify the leaf account name for the assertion,
but not anything higher.

Thanks,

Chris

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Balance assertion for a top level account

2016-02-04 Thread Ben Finney
Chris Bennett  writes:

> But when I assert a balance for the Expense account, it errors:
>
> 2015/12/31 MyCompany:Expenses closing balance
>   MyCompany:Expenses $0.00 = $4.55
>   Equity:Dummy
>
>
> $ ledger -f test.ledger bal
> While parsing posting:
>   MyCompany:Expenses $0.00 = $4.55
>  ^
> Error: Balance assertion off by $4.55

Yes. You're asserting “After this transaction that moves $0.00, the
balance should be $4.55”.

I think instead you want::

2015/10/01 Light Refreshments
  MyCompany:Expenses:LightRefreshments   $4.55
  MyCompany:Liabilities:AP:LightRefreshments

2015/12/31 MyCompany:Expenses closing balance
  MyCompany:Expenses $4.55 = $0.00
  Equity:Dummy

The second asserts “After this transaction which moves $4.55, the
balance should be $0.00”.

$ ledger -f ~/Documents/finance/foo.ledger balance
  $-4.55  Equity:Dummy
   $4.55  MyCompany
   $9.10Expenses
   $4.55  LightRefreshments
  $-4.55Liabilities:AP:LightRefreshments

   0

But maybe instead you have a mistake in which transactions you specify
for the transactions?

-- 
 \“Don't worry about people stealing your ideas. If your ideas |
  `\ are any good, you'll have to ram them down people's throats.” |
_o__)—Howard Aiken |
Ben Finney

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Getting started; assigning accounts to bank .csv data

2016-02-04 Thread Simon Michael
On 2/1/16 10:13 AM, John Hendy wrote:
> I tried to search the list for more of this sort of question, so
> forgive me if I've missed something. Replying with links pointing me
> in the right direction would be plenty sufficient if this has already
> been discussed!

Welcome John,

There are quite a lot of CSV(/OFX) to *ledger conversion tools,
including non-interactive ones; I'm not sure if you've found them all
yet. Off the top of my head, there's

- Erik Hetzner's https://gitlab.com/egh/ledger-autosync - converts OFX
not CSV, but many banks provide both. Can also download it from the bank
for you (optional).

- My own http://hledger.org/manual.html#csv - converts CSV to
ledger-compatible journal format with more options, eg you can set the
account(s) based on regexps matching the CSV records.




-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Getting started; assigning accounts to bank .csv data

2016-02-04 Thread Simon Michael
Hi Stefano, I agree. Many things should be more straightforward and
better documented.

I think we could pick out a few common tasks to focus our
tool-building/documenting efforts on. Eg:

1. importing bank data and CSV generally. All of the tools and basic
generic workflows for this should be described on one page. Focus on
CSV, but we should mention OFX too (ledger-autosync is arguably best at
this with its download feature).

2. exporting all data and reports as CSV

3. moving data between the ledger-likes (ledger, hledger, beancount...).
Again, all tools and techniques gathered on one page. All existing
formats should be listed. The output of "ledger print" is a sort of
lowest common denominator, I propose we give it a name and decree that
every tool should import this as a basic interchange format. And/or a
standardised CSV representation of it, such as "hledger print -O csv"

4. moving data from and to other accounting tools (gnucash, moneydance,
excel, quick{en,books}, mobile account apps)

5. manual data entry. Editors and their modes, ledger entry, hledger add
and other prompting tools, hledger-web, recurring entry scripts, etc.

6. a catalog of journal entries covering all common transactions




On 2/4/16 12:47 AM, Stefano Zacchiroli wrote:
> I've the feeling that, right now, the lack of a generic framework ---
> generic both on the front of data source (CSV, OFX, weird bank formats,
> etc.) and on that of output formats (ledger, beancount, etc.) --- for
> semi-automatically importing transactions is perhaps the most
> significant limiting factor for the adoption of CLI accounting.
> 
> I went myself through the ad-hoc automation of my work-flow for
> importing transactions from my bank, scripting together the web outside
> of browsers suite [1] and icsv2ledger. It works decently enough for me,
> but the CLI accounting community cannot really expect every newcomer to
> go through that hacking process if it wants the community to flourish.
> 
> [1]: http://weboob.org/
> 
> Martin is right that the most front-end part of the import chain (web
> scraping in most cases) will always remain a case-by-case business. But
> there, communities like weboob can feel that niche quite nicely, if only
> they will manage to grow and be diverse enough. (Right now that
> community is very much skewed toward supporting French banks, with very
> sparse support for other international banks.)
> 
> But the rest of the toolchain, from CSV down to your favorite CLI
> accounting tool can really do better in terms of reference tools and
> automation. I'm sorry I haven't had time/energy to contribute myself to
> ledgerhub, because the design looked pretty solid; I'm looking forward
> to the new rewrite :-)
> 
> 
> 


-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Getting started; assigning accounts to bank .csv data

2016-02-04 Thread Stefano Zacchiroli
On Mon, Feb 01, 2016 at 11:41:03PM -0500, Martin Blais wrote:
> Check out LedgerHub for ideas.
[...]
> The project is being killed right now, rewritten much better and simpler
> and migrated into the Beancount project; if you do end up looking at the
[...]
> In any case, you can't really get away without writing at least some
> code--it's just not realistic, the inputs from different people vary too
> much. There's very little shared code out there (just basic codes for CSV
> files, like the ones you mention) but too few users that share the same
> accounts to generate the critical mass needed for reuse. A while back I
> created the LedgerHub project to host shared importer code and provide a
> framework for doing the above, but never received much contributions and
> honestly I didn't put the care and quality attention to it I should have.

I've the feeling that, right now, the lack of a generic framework ---
generic both on the front of data source (CSV, OFX, weird bank formats,
etc.) and on that of output formats (ledger, beancount, etc.) --- for
semi-automatically importing transactions is perhaps the most
significant limiting factor for the adoption of CLI accounting.

I went myself through the ad-hoc automation of my work-flow for
importing transactions from my bank, scripting together the web outside
of browsers suite [1] and icsv2ledger. It works decently enough for me,
but the CLI accounting community cannot really expect every newcomer to
go through that hacking process if it wants the community to flourish.

[1]: http://weboob.org/

Martin is right that the most front-end part of the import chain (web
scraping in most cases) will always remain a case-by-case business. But
there, communities like weboob can feel that niche quite nicely, if only
they will manage to grow and be diverse enough. (Right now that
community is very much skewed toward supporting French banks, with very
sparse support for other international banks.)

But the rest of the toolchain, from CSV down to your favorite CLI
accounting tool can really do better in terms of reference tools and
automation. I'm sorry I haven't had time/energy to contribute myself to
ledgerhub, because the design looked pretty solid; I'm looking forward
to the new rewrite :-)


-- 
Stefano Zacchiroli  . . . . . . .  z...@upsilon.cc . . . . o . . . o . o
Maître de conférences . . . . . http://upsilon.cc/zack . . . o . . . o o
Former Debian Project Leader . . . . . @zacchiro . . . . o o o . . . o .
« the first rule of tautology club is the first rule of tautology club »

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.