New issue 199: bean-report hledger/ledger puts link/tag comments before payee/description
https://bitbucket.org/blais/beancount/issues/199/bean-report-hledger-ledger-puts-link-tag
trevorld:
Thanks for your awesome beancount package!
I've come across a bug in the bean-report hledger/ledger export for transactions that have tags or links. In such cases the link/tag comments are placed before the payee/description field in the resulting ledger/hledger files. For example
```
2017-01-01 * "Payee" "Description" ^link #tag
Assets:Cash 200 USD
Equity:Opening
```
gets exported to (H)Ledger as
```
2017-01-01 * ;; Link: ^link ;; Tag: #tag Payee | Description
Assets:Cash 200 USD
Equity:Opening
```
instead of
```
2017-01-01 * Payee | Description ;; Link: ^link ;; Tag: #tag
Assets:Cash 200 USD
Equity:Opening
```
In particular when I import my beancount file into an R data frame via hledger csv export for further querying this bug causes my payee / description info to be lost for any transactions with a tag or link. If I instead import my beancount file into R via ledger csv export the info isn't fully lost but it is much much harder to further parse into payee, description, and tag/link metadata fields than if the bug was fixed. I currently don't want to import my beancount file into R via `bean-query -f csv filename.beancount "SELECT *"` since it seems to be missing the critical account field (as well as tag/link metadata fields).
For your convenience I've attached a minimal beancount file that includes four transactions that should highlight this bug.
```
bean-report min_reproducible_example.beancount hledger > mre.hledger
bean-report min_reproducible_example.beancount ledger > mre.ledger
hledger -f mre.hledger register -Ocsv
ledger -f mre.ledger csv
bean-query -f csv min_reproducible_example.beancount "SELECT *"
```
Thanks for your attention to this matter!