[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: netspend table
From: |
Dr. Arne Babenhauserheide |
Subject: |
Re: netspend table |
Date: |
Sun, 05 Feb 2023 00:46:33 +0100 |
User-agent: |
mu4e 1.8.13; emacs 28.1 |
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
--
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de
signature.asc
Description: PGP signature