emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jude DaShiell <jdashiel@panix.com>
To: "Dr. Arne Babenhauserheide" <arne_bab@web.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: netspend table
Date: Sat, 4 Feb 2023 21:15:49 -0500	[thread overview]
Message-ID: <8694d192-fd4a-36f0-3af3-e92b36aa2197@panix.com> (raw)
In-Reply-To: <87y1pcdilw.fsf@web.de>

Thanks much for your help on this problem.  I've never done anything with
ledger-cli yet and wasn't aware such a package existed.



Jude <jdashiel at panix dot com>
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)

.

On Sun, 5 Feb 2023, Dr. Arne Babenhauserheide wrote:

>
> Jude DaShiell <jdashiel@panix.com> writes:
>
> > This is a running balance table and I don't know what kind of a #TBLFMT
> > line would be useful for that either.
> >
> > | date         | transaction      | amount |   fee | balance |
> > |--------------+------------------+--------+-------+---------|
> > | [2023-01-11] | original balance |  +0.00 | +0.00 | +423.17 |
> > | [2023-01-12] | dunkin           | -18.68 | -1.00 |  403.49 |
> > | [2023-01-13] | WalMart          | -28.68 | -1.00 |  384.88 |
> > | [2023-01-16] | Deposit          |      + |       |  634.88 |
> > | [2023-01-17] | Capris           |      - |     - |  615.34 |
> > | [2023-01-17] | Mcdonalds        |  -4.74 | -1.00 |  609.60 |
> > | [2023-01-18] | verizon          |      - |     - |  543.35 |
> > | [2023-01-26] | dunkin           |      - |     - |  542.37 |
> > | [2023-02-01] | damgoodcafe      | -13.28 | -1.00 |  528.09 |
> > |              |                  |        |       |         |
>
> One thing I could see as useful is a check column to enusre that
>
> balance - amount - fee actually gives the previous balance:
>
> | date         | transaction      | amount |   fee | balance |  check |
> |--------------+------------------+--------+-------+---------+--------|
> | [2023-01-11] | original balance |  +0.00 | +0.00 | +423.17 | 423.17 |
> | [2023-01-12] | dunkin           | -18.68 | -1.00 |  403.49 | 423.17 |
> | [2023-01-13] | WalMart          | -28.68 | -1.00 |  384.88 | 414.56 |
> | [2023-01-16] | Deposit          |      + |       |  634.88 | 634.88 |
> | [2023-01-17] | Capris           |      - |     - |  615.34 | 615.34 |
> | [2023-01-17] | Mcdonalds        |  -4.74 | -1.00 |  609.60 | 615.34 |
> | [2023-01-18] | verizon          |      - |     - |  543.35 | 543.35 |
> | [2023-01-26] | dunkin           |      - |     - |  542.37 | 542.37 |
> | [2023-02-01] | damgoodcafe      | -13.28 | -1.00 |  528.09 | 542.37 |
> |              |                  |        |       |         |      0 |
> #+TBLFM: $6='(- $5 $4 $3);N
>
> As you can see, The balance after WalMart does not add up, so I think
> this could be a good check to have.
>
> > Suggestions for any other improvements I could make on this table will be
> > appreciated and implemented if possible.
>
> I use ledger-cli for such tables which can generate suitable output.
>
> https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-ledger.html
> https://www.ledger-cli.org/3.0/doc/ledger3.html#Org-mode-with-Babel
>
> You could do some clever stuff like
>
> #+name: ledger-to-table
> #+begin_src elisp :var data=""
> (concat "#+name: ledger-results\n"
>           data
>           "#+tblfm: \n"))
> #+end_src
>
> #+begin_src ledger :results raw :post ledger-to-table(*this*) :cmdline --register-format "| %(format_date(date)) | %(payee) | %(display_account) | %(display_amount) | %(display_total) | \n" reg -M --wide --date-format %y-%m-%d
> 2022-06-15 * py2guile
>     ArneBab:Assets:Autorenhonorar:epubli             3.13?
>     ArneBab:Income:sale:nonrpg:epubli
> #+end_src
>
>
>
> #+begin_src elisp :exports results
> (org-babel-do-load-languages
>  'org-babel-load-languages
>  '((ledger . t)         ;this is the important one for this tutorial
>   ))
> nil
> #+end_src
>
> #+RESULTS:
>
> If you use ledger-cli for accounting, you can do pretty clever
> post-processing inside org-mode. Here?s an example that uses
> [[https://www.ledger-cli.org/3.0/doc/ledger3.html#Output-customization][--register-format]] to provide the register results directly as an
> org-mode table:
>
> #+begin_src org
> ,#+name: ledger-to-table
> ,#+begin_src elisp :var data=""
> (concat "#+name: ledger-results\n"
>           data
>           "#+tblfm: \n"))
> ,#+end_src
>
> ,#+begin_src ledger :results raw :post ledger-to-table(*this*) :cmdline --register-format "| %(format_date(date)) | %(payee) | %(display_account) | %(display_amount) | %(display_total) | \n" reg -D --wide --date-format %Y-%m-%d
> 2022-06-15 * py2guile
>     ArneBab:Assets:Autorenhonorar:epubli             3.13?
>     ArneBab:Income:sale:nonrpg:epubli
> ,#+end_src
>
> #+end_src
>
> This results in output like this (evaluated live on every export of this website):
>
> #+name: ledger-to-table
> #+begin_src elisp :var data=""
> (concat "#+name: ledger-results\n"
>           data
>           "#+tblfm: \n"))
> #+end_src
>
> #+begin_src ledger :results raw :post ledger-to-table(*this*) :cmdline --register-format "| %(format_date(date)) | %(payee) | %(display_account) | %(display_amount) | %(display_total) | \n" reg -D --wide --date-format %Y-%m-%d
> 2022-06-15 * py2guile
>     ArneBab:Assets:Autorenhonorar:epubli             3.13?
>     ArneBab:Income:sale:nonrpg:epubli
> #+end_src
>
> #+RESULTS:
> #+name: ledger-results
> | 2022-06-15 | - 2022-06-15 | ArneBab:Assets:Autorenhonorar:epubli | 3.13? | 3.13? |
> | 2022-06-15 | - 2022-06-15 | ArneBab:Income:sale:nonrpg:epubli | -3.13? | 0.00? |
> #+tblfm:
>
>
> Also see
>
> - https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-ledger.html
> - https://www.ledger-cli.org/3.0/doc/ledger3.html#Org-mode-with-Babel
>
>
>
>
> Best wishes,
> Arne
>


  reply	other threads:[~2023-02-05  2:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-04 19:35 netspend table Jude DaShiell
2023-02-04 23:46 ` Dr. Arne Babenhauserheide
2023-02-05  2:15   ` Jude DaShiell [this message]
2023-02-05  8:52     ` Dr. Arne Babenhauserheide
2023-02-08  3:10     ` TRS-80
2023-02-08  3:33 ` TRS-80
2023-02-08  4:08   ` Jude DaShiell
2023-02-08  7:58     ` Dr. Arne Babenhauserheide
2023-02-08 17:20       ` Jude DaShiell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8694d192-fd4a-36f0-3af3-e92b36aa2197@panix.com \
    --to=jdashiel@panix.com \
    --cc=arne_bab@web.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).