Re: accounting

2021-01-05 Thread Ihor Radchenko
Also, ledger can format output as Elisp sexp (with emacs command). That
should be easier to parse.

Best,
Ihor



Re: accounting

2021-01-05 Thread Eric S Fraga
On Tuesday,  5 Jan 2021 at 16:35, Uwe Brauer wrote:
> Yeah, your solution does not work for the example I had in mind
> but I realize now what I miss: the output should be an org table

If the ledger formatting options cannot help you (they are potentially
quite powerful), all I can suggest is a post-processing script
(e.g. with sed or awk or equivalent) that massages the output from
ledger into a form you like.

Hope you get something working to your satisfaction.  Ledger is an
excellent text based accounting tool.

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.4-166-g291993



[A solution of sorts] (was: accounting)

2021-01-05 Thread Uwe Brauer
>>> "UB" == Uwe Brauer  writes:

>> On Monday,  4 Jan 2021 at 21:01, Uwe Brauer wrote:

>> Yes.

>> Sorry I was brief: I cut and pasted something from one of my files while
>> in a rush!

>> Basically, you could do:

>> #+begin_src ledger :cmdline -V --format "%-20A %14T\n" bal --flat assets 
>> 2010/01/01 * Starting balance
>> assets:bank:savings  1300.00
>> income:starting balances
>> 2010/07/22 * Got paid
>> assets:bank:chequing  1000.00
>> income:salary
>> #+end_src

>> and you would get, as output,


> But I rather prefer to have

> |  340 | expenses | |   |
> |  170 |  | BigBrother  |   |
> |  150 |  | | Jacket|
> |   20 |  | | Shoes |
> |  170 |  | Brother |   |
> |  130 |  | | BigBrother|
> |   40 |  | | ChristmasTree |
> | -340 | income   | |   |
> | -170 |  | BigBrother:Card |   |
> | -170 |  | Brother:Card|   |
> |  |  | |   |
> |--+--+-+---|
> |0 |  | |   |


> Any idea how to achieve this?

Well 10 years ago Eric Schulte posted this 
https://lists.gnu.org/archive/html/emacs-orgmode/2010-08/msg00502.html

#+name: test
#+begin_src ledger 
2010/01/01 * Starting balance
  assets:bank:savings  0
  income:starting balances
2010/07/23 ChristmasTree
  expenses:Brother:ChristmasTree  40.00
  income:Brother:Card
2010/07/24 Jacket
  expenses:BigBrother:Jacket  150.00
  income:BigBrother:Card
2010/07/24 Schuhe
  expenses:BigBrother:Shoes  20
  income:BigBrother:Card
2010/07/23 BigBrother 
  expenses:Brother:BigBrother  130
  income:Brother:Card
#+end_src

#+begin_src emacs-lisp :var ledger=test
  (with-temp-buffer
(insert ledger)
(message ledger)
(org-table-convert-region (point-min) (point-max) 2)
(org-table-to-lisp))
#+end_src

#+RESULTS:
|  340 | expenses|
|  170 | BigBrother  |
|  150 | Jacket  |
|   20 | Shoes   |
|  170 | Brother |
|  130 | BigBrother  |
|   40 | ChristmasTree   |
| -340 | income  |
| -170 | BigBrother:Card |
| -170 | Brother:Card|
|  | |
|0 | |


It is not precisely what I want, but not bad either. If somebody can
come up with a better solution...




Re: accounting

2021-01-05 Thread Uwe Brauer
>>> "CM" == Charles Millar  writes:

> On 1/4/21 3:54 AM, Uwe Brauer wrote:
>> Hi
>> https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-ledger.html
>> Points out how to use ledger within org mode.
>> Is there any simpler solution?
>> Regards
>> Uwe Brauer
>> 
> If "simpler" means just making entries into your ledger.dat file using
> orgmode you may wish to refer to Sacha Chua's capture template for
> that very purpose. She posted it a few years ago.

> https://sachachua.com/blog/2010/11/emacs-recording-ledger-entries-with-org-capture-templates/

Thanks, that looks nice, but I finally think that the example in 
https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-ledger.html

Is fine. The only think I am missing is the output in an org table form


smime.p7s
Description: S/MIME cryptographic signature


Re: accounting

2021-01-05 Thread Uwe Brauer

> On Monday,  4 Jan 2021 at 21:01, Uwe Brauer wrote:

> Yes.

> Sorry I was brief: I cut and pasted something from one of my files while
> in a rush!

> Basically, you could do:

> #+begin_src ledger :cmdline -V --format "%-20A %14T\n" bal --flat assets 
> 2010/01/01 * Starting balance
>   assets:bank:savings  1300.00
>   income:starting balances
> 2010/07/22 * Got paid
>   assets:bank:chequing  1000.00
>   income:salary
> #+end_src

> and you would get, as output,

> #+results:
> : assets:bank:chequing   1000
> : assets:bank:savings1300
> :    2300


Thanks. I figured out that I have to read a bit accounting again (I
don't want to  use gnucash again, I prefer an org solution). I think
ledger is a reasonable solution (I cannot install currently beancount)


> I'm not saying that this is much prettier than the default but simply
> that you have total control over the formatting of the output so you may
> be able to achieve what you wish.


Yeah, your solution does not work for the example I had in mind
but I realize now what I miss: the output should be an org table


#+name: test
#+begin_src ledger 
2010/01/01 * Starting balance
  assets:bank:savings  0
  income:starting balances
2010/07/23 ChristmasTree
  expenses:Brother:ChristmasTree  40.00
  income:Brother:Card
2010/07/24 Jacket
  expenses:BigBrother:Jacket  150.00
  income:BigBrother:Card
2010/07/24 Schuhe
  expenses:BigBrother:Shoes  20
  income:BigBrother:Card
2010/07/23 BigBrother 
  expenses:Brother:BigBrother  130
  income:Brother:Card
#+end_src

#+RESULTS: test
#+begin_example
 340  expenses
 170BigBrother
 150  Jacket
  20  Shoes
 170Brother
 130  BigBrother
  40  ChristmasTree
-340  income
-170BigBrother:Card
-170Brother:Card

   0
#+end_example


But I rather prefer to have

|  340 | expenses | |   |
|  170 |  | BigBrother  |   |
|  150 |  | | Jacket|
|   20 |  | | Shoes |
|  170 |  | Brother |   |
|  130 |  | | BigBrother|
|   40 |  | | ChristmasTree |
| -340 | income   | |   |
| -170 |  | BigBrother:Card |   |
| -170 |  | Brother:Card|   |
|  |  | |   |
|--+--+-+---|
|0 |  | |   |


Any idea how to achieve this?


smime.p7s
Description: S/MIME cryptographic signature


Re: accounting

2021-01-04 Thread Uwe Brauer

> On 04/01/2021 21:04, Uwe Brauer wrote:

> https://beancount.github.io/

> is the project home page. You can find the documentation here:

> https://beancount.github.io/docs/

> I haven't submitted beancount-mode to any Emacs package repository yet,
> there is still some work I would like to do before doing it. You can
> find it here:

> https://github.com/beancount/beancount-mode

> with some minimal documentation.

> Beancount is distributed as a Python package, thus it should be easily
> installable on any system providing Python 3.6 or later.

Thanks, I am still on Ubuntu 16.04 running 3.5 and call install
beancount, I once tried upgrading python and it caused a lot of other
problems, most likely I have to upgrade Ubuntu, sigh


smime.p7s
Description: S/MIME cryptographic signature


Re: accounting

2021-01-04 Thread Daniele Nicolodi
On 04/01/2021 21:04, Uwe Brauer wrote:
>>>> "DN" == Daniele Nicolodi  writes:
> 
>> On 04/01/2021 09:54, Uwe Brauer wrote:
>>> Hi 
>>> 
>>> https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-ledger.html
>>> 
>>> Points out how to use ledger within org mode.
>>> 
>>> Is there any simpler solution?
> 
>> As other pointed out, you are not describing what you want to
>> accomplish, thus is impossible to suggest anything concrete. However, I
>    > would like to suggest to look at Beancount and beancount-mode as
>> alternatives to Ledger as plain text accounting tools.
> 
> Thanks, it seems that beancount is not in Ubuntu, and beancount-mode is
> not available as a emacs package.
> 
> Do you have any pointers?

https://beancount.github.io/

is the project home page. You can find the documentation here:

https://beancount.github.io/docs/

I haven't submitted beancount-mode to any Emacs package repository yet,
there is still some work I would like to do before doing it. You can
find it here:

https://github.com/beancount/beancount-mode

with some minimal documentation.

Beancount is distributed as a Python package, thus it should be easily
installable on any system providing Python 3.6 or later.

Cheers,
Dan



Re: accounting

2021-01-04 Thread Samuel Wales
i don't know if this is the best, but for some reason i had it so that
ledger goes into a block [used to be example or so, now is ledger],
and then post-process it with a shell source block.  perhaps this will
make more sense [in the distant past it made more sense to me].

when i process it, i call the source block, which means to run the
shell, which calls the ledger command on the data i keep in org.  for
some reason it outputs each line to the minibuffer, which is a bit
slow.  but it is not a big deal.  and i am not sure about searches.


On 1/4/21, Uwe Brauer  wrote:
>>>> "DN" == Daniele Nicolodi  writes:
>
>> On 04/01/2021 09:54, Uwe Brauer wrote:
>>> Hi
>>>
>>>
> https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-ledger.html
>>>
>>> Points out how to use ledger within org mode.
>>>
>>> Is there any simpler solution?
>
>> As other pointed out, you are not describing what you want to
>> accomplish, thus is impossible to suggest anything concrete. However,
> I
>> would like to suggest to look at Beancount and beancount-mode as
>> alternatives to Ledger as plain text accounting tools.
>
> Thanks, it seems that beancount is not in Ubuntu, and beancount-mode is
> not available as a emacs package.
>
> Do you have any pointers?
>
> Thanks
>


-- 
The Kafka Pandemic

Please learn what misopathy is.
https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html



Re: Accounting WAS Emacs-orgmode Digest, Vol 179, Issue 4

2021-01-04 Thread Uwe Brauer
> Also, in practical terms for day to day, rather than input things manually,
> I highly recommend downloading csvs (or similar formats) from your bank and
> using the ruby gem `reckon` which is a bayesian predictor that will learn
> from your ledger on how to expense your bank account entries and then write
> out the ledger file for you. Super handy.

> Overly long blog post here:
> https://daryl.wakatara.com/tracking-your-finances-with-reckon-and-ledger/
> to get you goin if it's not just a formatting thing.

Thanks I will have a look!!!


smime.p7s
Description: S/MIME cryptographic signature


Re: accounting

2021-01-04 Thread Uwe Brauer
>>> "DN" == Daniele Nicolodi  writes:

   > On 04/01/2021 09:54, Uwe Brauer wrote:
   >> Hi 
   >> 
   >> https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-ledger.html
   >> 
   >> Points out how to use ledger within org mode.
   >> 
   >> Is there any simpler solution?

   > As other pointed out, you are not describing what you want to
   > accomplish, thus is impossible to suggest anything concrete. However, I
   > would like to suggest to look at Beancount and beancount-mode as
   > alternatives to Ledger as plain text accounting tools.

Thanks, it seems that beancount is not in Ubuntu, and beancount-mode is
not available as a emacs package.

Do you have any pointers?

Thanks 


smime.p7s
Description: S/MIME cryptographic signature


Re: accounting

2021-01-04 Thread Uwe Brauer
>>> "ESF" == Eric S Fraga  writes:

   > On Monday,  4 Jan 2021 at 13:43, Uwe Brauer wrote:
   >> The example in this link is ok, also the output (the result of the
   >> ledger operation) is not very nicely formatted.

   > ledger does allow you to control, in detail, how the output should be
   > formatted.  The default output is suitable for a console display but you
   > can modify this through appropriate arguments to the ledger command line
   > via babel.  For instance, I have this line in my org file for generating
   > a balance of my assets:

   > ,#+call: year2020[:cmdline -V --format "%-20A %14T\n" bal --flat assets ]()


I am not sure I understand this (I admit I never used ledger, I used for
some time gnucash)

Do you mean this?

#+call: allinone[:cmdline -V --format "%-20A %14T\n" bal --flat assets ]()
#+name: allinone
#+begin_src ledger
2010/01/01 * Starting balance
  assets:bank:savings  1300.00
  income:starting balances
2010/07/22 * Got paid
  assets:bank:chequing  1000.00
  income:salary
2010/07/23 Rent
  expenses:rent  250.00
  assets:bank:chequing
2010/07/24 Food
  expenses:food  150.00
  assets:bank:chequing
2010/07/31 * Interest on bank savings
  assets:bank:savings  3.53
  income:interest
2010/07/31 * Transfer savings
  assets:bank:savings  250.00
  assets:bank:chequing
2010/08/01 got paid again
  assets:bank:chequing  1000.00
  income:salary
#+end_src




smime.p7s
Description: S/MIME cryptographic signature


Re: Accounting WAS Emacs-orgmode Digest, Vol 179, Issue 4

2021-01-04 Thread Daryl Manning
I do not use ledger within org-mode bit use a combo of libraries to make
ledger entries *look* and act like org-mode with folding. I find this work
(for me) much better than trying to mess with babel and having inline
ledger (basically, I treat my ledger file as a... ahem... ledger... I track
personal, budget, stock portfolio this way. It's very flexible and way way
better than using Quicken which does find with my Canuck accounts, but
cannot integrate my SG bank or stock broker.).

So I use `ledger-mode` directly configured like this in my init.el

```
;; == Ledger mode =
(use-package ledger-mode
  :ensure t
  :defer t
  :hook
  (ledger-mode . outline-minor-mode)
  :bind
  (:map ledger-mode-map
("TAB" . org-cycle))
  :config
  (font-lock-add-keywords 'ledger-mode outline-font-lock-keywords)
  :mode
  ("\\.ledger$" . ledger-mode)
  )

This also allows stars to deliineate hierarchy in the ledger and then fold
and unfold like an org doc. Super handy.

So, in one pane on my screen I have the ledger open (the tricky thing is
always setting up accounts and opening balances though there are some nice
tutorials for setting those up (if you have multiple currencies, *do* set
up accounts by currency early

eg.  Assets:CAD:Bank of Montreal
   Assets:SGD:OCBC
and for Liabilities like Credit Cards, lines of credit etc as well

The nice thing about this is you can have the ledger buffer open in one
panel and use C-{COR} for pulling up a balance report in the other pane
which automatically balances when you save the ledger file.

Also, in practical terms for day to day, rather than input things manually,
I highly recommend downloading csvs (or similar formats) from your bank and
using the ruby gem `reckon` which is a bayesian predictor that will learn
from your ledger on how to expense your bank account entries and then write
out the ledger file for you. Super handy.

Overly long blog post here:
https://daryl.wakatara.com/tracking-your-finances-with-reckon-and-ledger/
to get you goin if it's not just a formatting thing.

It also has some suggestions for category setups and the like.

Ledger is a bit steep to get started with but once you've got it setup it
does not require much time (especially with reckon) and is way more
flexible than something like Quicken if you have a complex financial life.

Anyhow, you do need to vinset a little time, but I have to admit I am
pretty impressed with it.

As someone else noted, you can also take a look at beancount, though I
personally still prefer the emacs integration available in ledger.

Hope this helped!

ciao !
Daryl.
PS> Even outside of emacs, I'd personally love to see people build some
more tools on top of the ledger format. I keep wanting to take a shot at
some portfolio tools, but never seem to be able to fit in the time.  =]


On Tue, Jan 5, 2021 at 1:01 AM  wrote:

>
>   19. accounting (Uwe Brauer)
>   20. Re: accounting (Eric S Fraga)
>   21. Re: Org to ConTeXt exporter? (Ludovic Courtès)
>   22. Re: accounting (Dr. Arne Babenhauserheide)
>   23. Re: ob-haskell (Leo)
>   24. Re: accounting (Daniele Nicolodi)
>   25. Re: accounting (Uwe Brauer)
>   26. Re: accounting (Charles Millar)
>   27. Re: accounting (Eric S Fraga)
>
>
>
> --
>
> Message: 19
> Date: Mon, 04 Jan 2021 09:54:00 +0100
> From: Uwe Brauer 
> To: emacs-orgmode@gnu.org
> Subject: accounting
> Message-ID: <87ble56q1j@mat.ucm.es>
> Content-Type: text/plain
>
>
> Hi
>
> https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-ledger.html
>
> Points out how to use ledger within org mode.
>
> Is there any simpler solution?
>
> Regards
>
> Uwe Brauer
>
>
>
>
> ------
>
> Message: 20
> Date: Mon, 04 Jan 2021 09:31:58 +
> From: Eric S Fraga 
> To: emacs-orgmode@gnu.org
> Subject: Re: accounting
> Message-ID: <871rf1m4j5@ucl.ac.uk>
> Content-Type: text/plain
>
> On Monday,  4 Jan 2021 at 09:54, Uwe Brauer wrote:
> > Points out how to use ledger within org mode.
> > Is there any simpler solution?
>
> How do you wish it to be simpler?  What is it you wish to do?
> --
> : Eric S Fraga via Emacs 28.0.50, Org release_9.4.4-166-g291993
>
>
>
> --
>
> Message: 22
> Date: Mon, 04 Jan 2021 11:19:50 +0100
> From: "Dr. Arne Babenhauserheide" 
> To: Uwe Brauer 
> Cc: emacs-orgmode@gnu.org
> Subject: Re: accounting
> Message-ID: <87o8i5t35l@web.de>
> Content-Type: text/plain; charset="utf-8"
>
>
> Uwe Brauer  writes:
>
> > https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-ledger.html
> >
> > Points out how to use ledger within org mode.
> >
> > Is there any simpler solution?
>

Re: accounting

2021-01-04 Thread Eric S Fraga
On Monday,  4 Jan 2021 at 13:43, Uwe Brauer wrote:
> The example in this link is ok, also the output (the result of the
> ledger operation) is not very nicely formatted.

ledger does allow you to control, in detail, how the output should be
formatted.  The default output is suitable for a console display but you
can modify this through appropriate arguments to the ledger command line
via babel.  For instance, I have this line in my org file for generating
a balance of my assets:

,#+call: year2020[:cmdline -V --format "%-20A %14T\n" bal --flat assets ]()

where year2020 is a ledger src block which covers my 2020-21 tax year.

You will need to look at the ledger documentation, which is intensive,
for how to specify the format string.  Ledger does come with an Emacs
info file: (ledger3) Format Strings

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.4-166-g291993



Re: accounting

2021-01-04 Thread Charles Millar

On 1/4/21 3:54 AM, Uwe Brauer wrote:


Hi

https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-ledger.html

Points out how to use ledger within org mode.

Is there any simpler solution?

Regards

Uwe Brauer


If "simpler" means just making entries into your ledger.dat file using 
orgmode you may wish to refer to Sacha Chua's capture template for that 
very purpose. She posted it a few years ago.


https://sachachua.com/blog/2010/11/emacs-recording-ledger-entries-with-org-capture-templates/

Charlie Millar



Re: accounting

2021-01-04 Thread Uwe Brauer
>>> "AB" == Arne Babenhauserheide  writes:

   > Uwe Brauer  writes:

   >> https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-ledger.html
   >> 
   >> Points out how to use ledger within org mode.
   >> 
   >> Is there any simpler solution?

   > Do you mean simpler accounting in org-mode, 


This is what I meant. 

   > or do you mean simpler ledger-integration?

The example in this link is ok, also the output (the result of the
ledger operation) is not very nicely formatted.

   > You can always tangle your ledger-data and use a ledger commandline
   > client. Also Emacs has direct support for ledger. Here’s a setup via
   > use-package:

   > (use-package ledger-mode :ensure t :defer 20
   >   :config
   >   (org-babel-do-load-languages
   >'org-babel-load-languages
   >'((ledger . t

   > Best wishes,
   > Arne


smime.p7s
Description: S/MIME cryptographic signature


Re: accounting

2021-01-04 Thread Daniele Nicolodi
On 04/01/2021 09:54, Uwe Brauer wrote:
> Hi 
> 
> https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-ledger.html
> 
> Points out how to use ledger within org mode.
> 
> Is there any simpler solution?

As other pointed out, you are not describing what you want to
accomplish, thus is impossible to suggest anything concrete. However, I
would like to suggest to look at Beancount and beancount-mode as
alternatives to Ledger as plain text accounting tools.

Cheers,
Dan



Re: accounting

2021-01-04 Thread Dr. Arne Babenhauserheide

Uwe Brauer  writes:

> https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-ledger.html
>
> Points out how to use ledger within org mode.
>
> Is there any simpler solution?

Do you mean simpler accounting in org-mode, or do you mean simpler
ledger-integration?

You can always tangle your ledger-data and use a ledger commandline
client. Also Emacs has direct support for ledger. Here’s a setup via
use-package:

(use-package ledger-mode :ensure t :defer 20
  :config
  (org-babel-do-load-languages
   'org-babel-load-languages
   '((ledger . t

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein
ohne es zu merken


signature.asc
Description: PGP signature


Re: accounting

2021-01-04 Thread Eric S Fraga
On Monday,  4 Jan 2021 at 09:54, Uwe Brauer wrote:
> Points out how to use ledger within org mode.
> Is there any simpler solution?

How do you wish it to be simpler?  What is it you wish to do?
-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.4-166-g291993



accounting

2021-01-04 Thread Uwe Brauer


Hi 

https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-ledger.html

Points out how to use ledger within org mode.

Is there any simpler solution?

Regards

Uwe Brauer 




Re: [O] [PATCH] Add a flat clocktable formatter useful for tables whose CSV export can be imported into accounting/invoiving tools such as Zoho Invoicing.

2013-06-30 Thread Bastien
Hi Ross,

Ross Patterson m...@rpatterson.net writes:

 Bastien b...@gnu.org writes:

 thanks for the patch.  Do you mind filling the copyright
 assignment so we can accept the patch ?

 I already have an FSF Emacs Assignment from 2008-12-22, RT 393650.  Is
 there something else I need to do?

Nope.  I didn't know you had a FSF assignment.

That said, the patch looks more like an add-on to Org for a very
specific use, so putting this code in contrib/ would be better.

Also, `org-clock-clocktable-flat-columns' defines some customizable
values that are hardcoded in `org-clocktable-write-flat'.  Either the
values should not be customizable, or the `org-clocktable-write-flat'
should call them differently?  Just a suggestion.

   http://orgmode.org/cgit.cgi/org-mode.git/plain/request-assign-future.txt

 Also, please have a look at this page with guidance on how
 to submit a patch with a ChangeLog etc.

   http://orgmode.org/worg/org-contribute.html#sec-4-2

 I did a search for such docs on orgmode.org but only found a pointer to
 the list.  Perhaps someone should make these links more obvious.

I promoted the org-contribute.html page in the homepage of Org,
thanks for bringing this up!

-- 
 Bastien



Re: [O] [PATCH] Add a flat clocktable formatter useful for tables whose CSV export can be imported into accounting/invoiving tools such as Zoho Invoicing.

2013-06-28 Thread Bastien
Hi Ross,

thanks for the patch.  Do you mind filling the copyright
assignment so we can accept the patch ?

  http://orgmode.org/cgit.cgi/org-mode.git/plain/request-assign-future.txt

Also, please have a look at this page with guidance on how
to submit a patch with a ChangeLog etc.

  http://orgmode.org/worg/org-contribute.html#sec-4-2

Thanks again,

-- 
 Bastien



Re: [O] [PATCH] Add a flat clocktable formatter useful for tables whose CSV export can be imported into accounting/invoiving tools such as Zoho Invoicing.

2013-06-28 Thread Ross Patterson
Bastien b...@gnu.org writes:

 thanks for the patch.  Do you mind filling the copyright
 assignment so we can accept the patch ?

I already have an FSF Emacs Assignment from 2008-12-22, RT 393650.  Is
there something else I need to do?

   http://orgmode.org/cgit.cgi/org-mode.git/plain/request-assign-future.txt

 Also, please have a look at this page with guidance on how
 to submit a patch with a ChangeLog etc.

   http://orgmode.org/worg/org-contribute.html#sec-4-2

I did a search for such docs on orgmode.org but only found a pointer to
the list.  Perhaps someone should make these links more obvious.

Thanks,
Ross




[O] [PATCH] Add a flat clocktable formatter useful for tables whose CSV export can be imported into accounting/invoiving tools such as Zoho Invoicing.

2013-06-27 Thread Ross Patterson

---
 lisp/org-clock.el |   77 +
 1 file changed, 77 insertions(+)

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 8ac215e..bad653e 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -325,6 +325,14 @@ play with them.
   :group 'org-clocktable
   :type 'plist)
 
+(defcustom org-clock-clocktable-flat-columns
+  '(Invoice Date Invoice Number Customer Name
+Item Name Item Desc Quantity Item Price)
+  Columns for the org-clocktable-write-flat clocktable formatter.
+Default value matches the ZOHO CSV import format.
+  :group 'org-clocktable
+  :type '(repeat string))
+
 (defcustom org-clock-idle-time nil
   When non-nil, resolve open clocks if the user is idle more than X minutes.
   :group 'org-clock
@@ -2546,6 +2554,75 @@ from the dynamic block definition.
   (org-table-delete-column))
 total-time))
 
+(defun org-clocktable-write-flat (ipos tables params)
+  Write out a flat clock table at position IPOS in the current
+buffer.  Useful to render a table which can be exported to CSV and
+then imported into accounting/invoiving tools such as Zoho Invoicing.
+TABLES is a list of tables with clocking data as produced by
+`org-clock-get-table-data'.
+
+PARAMS is the parameter property list obtained from the dynamic block
+definition.  Several parameters are used beyond those used by the
+clocktable dynamic block:
+:customer A string to be inserted into the 'Customer Name' column
+:price A number to be inserted into the 'Item Price' column as a rate
+:number A string to be inserter into the Invoice Number column
+:columns A list which overrides the default CSV columns from
+ `org-clock-clocktable-flat-columns'
+
+Several other columns are calculated automatically:
+Item Name: The path to the parent headline
+Item Desc: The headline
+Quantity: The clocktime.  Useful with the `;t' formatter to get a
+  decimal billable time.
+
+  (let ((date (format-time-string %Y-%m-%d))
+   (customer (plist-get params :customer))
+   (number (plist-get params :number))
+   (price (plist-get params :price))
+   (columns (or (plist-get params :columns)
+org-clock-clocktable-flat-columns)))
+(insert \n|)
+(dolist (column columns)
+  (insert column |))
+(insert \n|-\n)
+(dolist (table tables)
+  (let ((rows (nth 2 table))
+   (parents (list )))
+   (dotimes (row-idx (length rows))
+ (let ((row (nth row-idx rows)))
+   (if (listp row)
+   (progn
+ (dotimes (parent-idx
+   (- (nth 0 (nth (- row-idx 1) rows)) (nth 0 row)))
+   (setcdr (last parents 2) nil))
+ (if (and ( row-idx (- (length rows) 1))
+  ( (nth 0 row) (nth 0 (nth (+ row-idx 1) rows
+ (nconc parents (list (cadr row)))
+   (insert |)
+   (dolist (column columns)
+ (cond
+  ((equal column Invoice Date) (insert date))
+  ((equal column Invoice Number) (insert number))
+  ((equal column Customer Name) (insert customer))
+  ((equal column Item Name)
+   (dotimes (parent-idx (length parents))
+ (insert (nth parent-idx parents))
+ (if (not (or (= parent-idx 0)
+  (= parent-idx (- (length parents) 1
+ (insert /
+  ((equal column Item Desc) (insert (cadr row)))
+  ((equal column Quantity)
+   (insert (org-minutes-to-hh:mm-string (nth 3 row
+  ((equal column Item Price)
+   (insert (format %s price
+ (insert |))
+   (insert \n
+(insert #+TBLFM:  (plist-get params :formula))
+(org-ctrl-c-ctrl-c)
+(goto-char ipos)
+(skip-chars-forward ^|)))
+
 (defun org-clocktable-indent-string (level)
   (if (= level 1)
   
-- 
1.7.9.5




Re: [Orgmode] Personal accounting with emacs, org and...?

2010-07-24 Thread Eric S Fraga
On Fri, 23 Jul 2010 09:29:33 -0700, Eric Schulte schulte.e...@gmail.com 
wrote:
 
 Thanks Eric!
 
 This has now been included in Org-mode.

Excellent.  Many thanks.

 If you get a chance, it would be great to add ob-ledger to the list of
 supported languages on Worg, and if possible to add an ob-ledger
 specific file with a brief usage example -- see existing
 language-specific files linked to from the language table for examples.

Okay.  I'm taking some time off work, and will be striving to stay
away from computers while doing so, so I will try to do something on
this next month.  I've already got a start on such a document.

Thanks again,
eric
-- 
Eric S Fraga
GnuPG: 8F5C 279D 3907 E14A 5C29  570D C891 93D8 FFFC F67D
___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Personal accounting with emacs, org and...?

2010-07-23 Thread Eric Schulte
Thanks Eric!

This has now been included in Org-mode.

If you get a chance, it would be great to add ob-ledger to the list of
supported languages on Worg, and if possible to add an ob-ledger
specific file with a brief usage example -- see existing
language-specific files linked to from the language table for examples.

http://orgmode.org/worg/org-contrib/babel/languages.php

Many Thanks -- Eric

Eric S Fraga ucec...@ucl.ac.uk writes:

 On Thu, 22 Jul 2010 13:43:00 -0700, Eric Schulte schulte.e...@gmail.com 
 wrote:
 
 Eric S Fraga ucec...@ucl.ac.uk writes:

 [...]

  Attached is my simple, linux only, org-babel solution and an example
  org file which uses it.  Note, I've still not had a chance to look at
  the ob-template in Worg so I'm sure my ob-ledger file could be
  improved...
 
 
 After a quick scan your ob-ledger.el file looks great.  I wouldn't feel
 obligated to add all of the functionality listed in the template.  Many
 of our language files (e.g. dot, sass, etc...) are very simple.  I think
 one of the big wins of our new setup is that language support can be
 added in very small increments (e.g. [1]).
 
 Please do let me know when you think this is stable enough for inclusion
 into Org-mode.

 Well, it's stable enough in that I wrote it more than 6 months ago and
 it hasn't changed in that time other than to update to the new babel
 layout.  I don't intend to do anything on it immediately in any case
 as it works for my use case!

 In other words, I'd be happy if it were included in org-mode at your
 discretion.

 Thanks,
 eric

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Personal accounting with emacs, org and...?

2010-07-22 Thread Marcelo de Moraes Serpa
Hey list,

I was wondering if anyone out there manages his personal accounting
with org. I never really managed my personal finances, but I think
it's about time to know where my money comes from and where it is
going (and where the leaks are :P). I would use something like
lessaccounting.com, but I would rather integrate it into my
orgmode-based PIM. Any ideas?

Cheers,

Marcelo.

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Personal accounting with emacs, org and...?

2010-07-22 Thread Russell Adams
On Thu, Jul 22, 2010 at 01:20:58AM -0500, Marcelo de Moraes Serpa wrote:
 Hey list,
 
 I was wondering if anyone out there manages his personal accounting
 with org. I never really managed my personal finances, but I think
 it's about time to know where my money comes from and where it is
 going (and where the leaks are :P). I would use something like
 lessaccounting.com, but I would rather integrate it into my
 orgmode-based PIM. Any ideas?

I use John Wiegley's Ledger (of Remember fame), which is a CLI tool
that does reporting against plain text files.

I do my expense reporting and business accounting in it. Very flexible
and because it is text based, I can use version control and emacs.

Thanks.

--
Russell Adamsrlad...@adamsinfoserv.com

PGP Key ID: 0x1160DCB3   http://www.adamsinfoserv.com/

Fingerprint:1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: Personal accounting with emacs, org and...?

2010-07-22 Thread Gour
On Thu, 22 Jul 2010 01:26:29 -0500
 Russell == Russell Adams rlad...@adamsinfoserv.com wrote:

Russell I do my expense reporting and business accounting in it. Very
Russell flexible and because it is text based, I can use version
Russell control and emacs.

Do you do invoices as well?


Sincerely,
Gour

-- 

Gour  | Hlapicina, Croatia  | GPG key: F96FF5F6



signature.asc
Description: PGP signature
___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Re: Personal accounting with emacs, org and...?

2010-07-22 Thread Russell Adams
On Thu, Jul 22, 2010 at 08:39:54AM +0200, Gour wrote:
 On Thu, 22 Jul 2010 01:26:29 -0500
  Russell == Russell Adams rlad...@adamsinfoserv.com wrote:
 
 Russell I do my expense reporting and business accounting in it. Very
 Russell flexible and because it is text based, I can use version
 Russell control and emacs.
 
 Do you do invoices as well?

I do not invoice from Ledger.

I use a web based system called Freshbooks, and I'd recommend
them.

Ledger comes with few output formats, it is really just a reporting
tool. I built some perl scripts that create expense reports in Latex
from ledger output combined with scanned receipt images, but not
invoicing.

Thanks.

--
Russell Adamsrlad...@adamsinfoserv.com

PGP Key ID: 0x1160DCB3   http://www.adamsinfoserv.com/

Fingerprint:1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Personal accounting with emacs, org and...?

2010-07-22 Thread Eric S Fraga
On Thu, 22 Jul 2010 01:26:29 -0500, Russell Adams rlad...@adamsinfoserv.com 
wrote:
 
 On Thu, Jul 22, 2010 at 01:20:58AM -0500, Marcelo de Moraes Serpa wrote:
  Hey list,
  
  I was wondering if anyone out there manages his personal accounting
  with org. I never really managed my personal finances, but I think
  it's about time to know where my money comes from and where it is
  going (and where the leaks are :P). I would use something like
  lessaccounting.com, but I would rather integrate it into my
  orgmode-based PIM. Any ideas?
 
 I use John Wiegley's Ledger (of Remember fame), which is a CLI tool
 that does reporting against plain text files.
 
 I do my expense reporting and business accounting in it. Very flexible
 and because it is text based, I can use version control and emacs.

and, with org-babel, you can place your ledger entries in an org
file...  I have a simple ob-ledger implementation which doesn't do
tangling yet (as I don't yet know how to provide this level of
support) but it does work for single blocks of ledger entries.
-- 
Eric S Fraga
GnuPG: 8F5C 279D 3907 E14A 5C29  570D C891 93D8 FFFC F67D
___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: Personal accounting with emacs, org and...?

2010-07-22 Thread Matt Lundin
Russell Adams rlad...@adamsinfoserv.com writes:

 On Thu, Jul 22, 2010 at 01:20:58AM -0500, Marcelo de Moraes Serpa wrote:
 Hey list,
 
 I was wondering if anyone out there manages his personal accounting
 with org. I never really managed my personal finances, but I think
 it's about time to know where my money comes from and where it is
 going (and where the leaks are :P). I would use something like
 lessaccounting.com, but I would rather integrate it into my
 orgmode-based PIM. Any ideas?

 I use John Wiegley's Ledger (of Remember fame), which is a CLI tool
 that does reporting against plain text files.

 I do my expense reporting and business accounting in it. Very flexible
 and because it is text based, I can use version control and emacs.


+1 for ledger. It comes bundled with a nice emacs mode (ledger.el) that
makes entering data quite simple.

Matt

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Personal accounting with emacs, org and...?

2010-07-22 Thread Eric Schulte
Eric S Fraga ucec...@ucl.ac.uk writes:

 On Thu, 22 Jul 2010 01:26:29 -0500, Russell Adams rlad...@adamsinfoserv.com 
 wrote:
 
 On Thu, Jul 22, 2010 at 01:20:58AM -0500, Marcelo de Moraes Serpa wrote:
  Hey list,
  
  I was wondering if anyone out there manages his personal accounting
  with org. I never really managed my personal finances, but I think
  it's about time to know where my money comes from and where it is
  going (and where the leaks are :P). I would use something like
  lessaccounting.com, but I would rather integrate it into my
  orgmode-based PIM. Any ideas?
 
 I use John Wiegley's Ledger (of Remember fame), which is a CLI tool
 that does reporting against plain text files.
 
 I do my expense reporting and business accounting in it. Very flexible
 and because it is text based, I can use version control and emacs.

 and, with org-babel, you can place your ledger entries in an org
 file...  I have a simple ob-ledger implementation which doesn't do
 tangling yet (as I don't yet know how to provide this level of
 support) but it does work for single blocks of ledger entries.

Tangling does not require *any* language specific support.  Since the
integration of Babel into Org-mode any type of code block should tangle
just fine.  For example the following minimal org file tangles a code
block of the fictional /schulte/ language to a file eric.sh

--8---cut here---start-8---
* top

#+begin_src schulte :tangle eric.sh
  hello world
#+end_src
--8---cut here---end---8---

It does look like there is fertile ground for Babel-Ledger
integration.

Best -- Eric

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Personal accounting with emacs, org and...?

2010-07-22 Thread Eric S Fraga
On Thu, 22 Jul 2010 10:06:30 -0700, Eric Schulte schulte.e...@gmail.com 
wrote:
 
 Eric S Fraga ucec...@ucl.ac.uk writes:
 
  On Thu, 22 Jul 2010 01:26:29 -0500, Russell Adams 
  rlad...@adamsinfoserv.com wrote:
  
  On Thu, Jul 22, 2010 at 01:20:58AM -0500, Marcelo de Moraes Serpa wrote:
   Hey list,
   
   I was wondering if anyone out there manages his personal accounting
   with org. I never really managed my personal finances, but I think
   it's about time to know where my money comes from and where it is
   going (and where the leaks are :P). I would use something like
   lessaccounting.com, but I would rather integrate it into my
   orgmode-based PIM. Any ideas?
  
  I use John Wiegley's Ledger (of Remember fame), which is a CLI tool
  that does reporting against plain text files.
  
  I do my expense reporting and business accounting in it. Very flexible
  and because it is text based, I can use version control and emacs.
 
  and, with org-babel, you can place your ledger entries in an org
  file...  I have a simple ob-ledger implementation which doesn't do
  tangling yet (as I don't yet know how to provide this level of
  support) but it does work for single blocks of ledger entries.
 
 Tangling does not require *any* language specific support.  Since the
 integration of Babel into Org-mode any type of code block should tangle
 just fine.  For example the following minimal org file tangles a code
 block of the fictional /schulte/ language to a file eric.sh

Yes, thanks, I figured this out on the way home (the advantage of a
long commute is time to play!) before I got your email.  The tangling
works like a charm.  What's even better is that ability to specify the
tangle property as an org property which only affects code blocks
within a certain heading!  Fantastic.

 It does look like there is fertile ground for Babel-Ledger
 integration.

Attached is my simple, linux only, org-babel solution and an example
org file which uses it.  Note, I've still not had a chance to look at
the ob-template in Worg so I'm sure my ob-ledger file could be
improved...

Thanks again all those who have contributed to babel!

eric
;;; ob-ledger.el --- org-babel functions for ledger evaluation

;; Copyright (c) 2009 Eric S Fraga

;; based on code by
;; Copyright (C) 2009 Eric Schulte

;; Author: Eric Schulte
;; Keywords: literate programming, reproducible research
;; Homepage: http://orgmode.org
;; Version: 0.01

;;; License:

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.

;;; Commentary:

;; Org-Babel support for evaluating ledger entries.
;;
;; This differs from most standard languages in that
;;
;; 1) there is no such thing as a session in ledger
;;
;; 2) we are generally only going to return output from the leger program
;;
;; 3) we are adding the cmdline header argument
;;
;; 4) there are no variables

;;; Code:
;; (require 'org-babel)

;;(org-babel-add-interpreter ledger)

;;(add-to-list 'org-babel-tangle-langs '(ledger ledger))

(defvar org-babel-default-header-args:ledger
  '((:results . output) (:cmdline . bal))
  Default arguments to use when evaluating a ledger source block.)

(defun org-babel-execute:ledger (body params)
  Execute a block of Ledger entries with org-babel.  This function is
called by `org-babel-execute-src-block'.
  (message executing Ledger source code block)
  (let ((result-params (split-string (or (cdr (assoc :results params)) )))
(cmdline (cdr (assoc :cmdline params)))
(in-file (make-temp-file org-babel-ledger))
(out-file (make-temp-file org-babel-ledger-output))
)
(with-temp-file in-file (insert body))
(message (concat ledger -f  in-file   cmdline))
(with-output-to-string (shell-command (concat ledger -f  in-file   
cmdlineout-file)))
(with-temp-buffer (insert-file-contents out-file) (buffer-string))
))

(defun org-babel-prep-session:ledger (session params)
  (error Ledger does not support sessions))

(provide 'ob-ledger)
;;; org-babel-ledger.el ends here

* ledger test
*** income and expenses
:PROPERTIES:
:tangle:   account.ledger
:END:
The property for this heading specifies where the tangled output of
the ledger code blocks in what follows should end up.
* income
  The first set of entries relates to income, either monthly pay

Re: [Orgmode] Personal accounting with emacs, org and...?

2010-07-22 Thread Eric Schulte
Eric S Fraga ucec...@ucl.ac.uk writes:

 On Thu, 22 Jul 2010 10:06:30 -0700, Eric Schulte schulte.e...@gmail.com 
 wrote:
[...]
 
 Tangling does not require *any* language specific support.  Since the
 integration of Babel into Org-mode any type of code block should tangle
 just fine.  For example the following minimal org file tangles a code
 block of the fictional /schulte/ language to a file eric.sh

 Yes, thanks, I figured this out on the way home (the advantage of a
 long commute is time to play!) before I got your email.  The tangling
 works like a charm.  What's even better is that ability to specify the
 tangle property as an org property which only affects code blocks
 within a certain heading!  Fantastic.


Great to hear.


 It does look like there is fertile ground for Babel-Ledger
 integration.

 Attached is my simple, linux only, org-babel solution and an example
 org file which uses it.  Note, I've still not had a chance to look at
 the ob-template in Worg so I'm sure my ob-ledger file could be
 improved...


After a quick scan your ob-ledger.el file looks great.  I wouldn't feel
obligated to add all of the functionality listed in the template.  Many
of our language files (e.g. dot, sass, etc...) are very simple.  I think
one of the big wins of our new setup is that language support can be
added in very small increments (e.g. [1]).

Please do let me know when you think this is stable enough for inclusion
into Org-mode.

Cheers -- Eric


 Thanks again all those who have contributed to babel!

 eric


Footnotes: 
[1]  as a mostly unrelated sidebar I've recently started using the
 following 4-line function in place of an ob-javascript.el, for
 embedding javascript in exported html

--8---cut here---start-8---
# Allow for exportation of JS code blocks into html
#+begin_src emacs-lisp :results silent :exports none
  ;; just to let us export the js directly into html
  (defun org-babel-execute:js (body params)
(format script type=\text/javascript\
  !--/*--![CDATA[/*!--*/\n%s\n/*]]*///--
  /script\n body))
#+end_src
--8---cut here---end---8---

Which allows js blocks in an org-mode document like the following to be
exported using the appropriate HTML script tags.

--8---cut here---start-8---
# play with the url of my homepage -- HTML5
#+begin_src js :results html :exports results
  var delay   = 150;
  var index   = 0;
  var word= eschulte/;
  var forward = true;
  function withTlda(str, ind){
  return str.slice(0,ind)+~+str.slice(ind,str.length)}
  function step(){
  window.history.replaceState(, , /+withTlda(word, index));
  if(forward) index++; else index--;
  if(index == (word.length-1) || index == 0) forward = !forward;
  if(forward  index == 1)
  setTimeout('step()', Math.floor(Math.random()*2));
  else
  setTimeout('step()', delay);}
  step();
#+end_src
--8---cut here---end---8---

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Personal accounting with emacs, org and...?

2010-07-22 Thread Eric S Fraga
On Thu, 22 Jul 2010 13:43:00 -0700, Eric Schulte schulte.e...@gmail.com 
wrote:
 
 Eric S Fraga ucec...@ucl.ac.uk writes:

[...]

  Attached is my simple, linux only, org-babel solution and an example
  org file which uses it.  Note, I've still not had a chance to look at
  the ob-template in Worg so I'm sure my ob-ledger file could be
  improved...
 
 
 After a quick scan your ob-ledger.el file looks great.  I wouldn't feel
 obligated to add all of the functionality listed in the template.  Many
 of our language files (e.g. dot, sass, etc...) are very simple.  I think
 one of the big wins of our new setup is that language support can be
 added in very small increments (e.g. [1]).
 
 Please do let me know when you think this is stable enough for inclusion
 into Org-mode.

Well, it's stable enough in that I wrote it more than 6 months ago and
it hasn't changed in that time other than to update to the new babel
layout.  I don't intend to do anything on it immediately in any case
as it works for my use case!

In other words, I'd be happy if it were included in org-mode at your
discretion.

Thanks,
eric
-- 
Eric S Fraga
GnuPG: 8F5C 279D 3907 E14A 5C29  570D C891 93D8 FFFC F67D

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode