Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have a way to use --cost option for income-expense reports #110

Open
avh4 opened this issue Jan 5, 2023 · 1 comment
Open

Have a way to use --cost option for income-expense reports #110

avh4 opened this issue Jan 5, 2023 · 1 comment

Comments

@avh4
Copy link

avh4 commented Jan 5, 2023

Is your feature request related to a problem? Please describe.

I'm tracking billable hours with entries that (after csv import) look like:

2023-01-01 Billable hours
    revenue:hours    -8.00 hr @ $7.25
    assets:billable

Currently hledger-flow report produces income-expense reports with hledger --file import/user/all-years.journal --period 2023 incomestatement --pretty-tables --depth 2 which results in showing the "hour amount" balances for the "revenue:hours" account.

For my standard report, I want to use hledger's --cost option so that those reports only show the dollar amounts instead of hours.

I'd be happy if hledger-flow simply did this by default, or if there were some way to define additional hledger options to use for the income-expense report (or for reports in general).

Version and Runtime Information

hledger-flow 0.14.4 darwin x86_64 ghc 9.0 UNKNOWN

If your request includes commands you ran and the output, please also include
the runtime options with --show-options e.g:

$ hledger-flow --show-options import
RuntimeOptions {baseDir = "/home/user/finances/", importRunDir = "./", importStartYear = Nothing, onlyNewFiles = False, hfVersion = "hledger-flow 0.14.4 darwin x86_64 ghc 9.0 UNKNOWN", hledgerInfo = HledgerInfo {hlPath = "/home/user/.nix-profile/bin/hledger", hlVersion = "hledger 1.25, mac-x86_64"}, sysInfo = SystemInfo {os = "darwin", arch = "x86_64", compilerName = "ghc", compilerVersion = Version {versionBranch = [9,0], versionTags = []}, cores = 8, availableCores = 8}, verbose = False, showOptions = True, sequential = False, batchSize = 200}
Collecting input files from /home/user/finances/import/
Found 12 input files in 0.005646s. Proceeding with import...
Wrote include files for 12 journals in 0.014143s
Imported 12/12 journals in 0.136004s

Our Example Statements Repository

FYI, we have a repo with some example transactions which you can use to run hledger-flow on:
https://github.com/apauley/hledger-flow-example

Can you give examples of what you would like by running hledger-flow on these files?

Example csv file:

date,hours,rate,comment
2023-01-01,8.00,7.25,

Example rules file:

skip 1
fields date,_hours,_rate,comment

account1 revenue:hours
amount1 -%_hours hr @ $%_rate
account2 assets:billable

Describe the solution you'd like

One of:

  • hledger-flow uses --cost in all reports by default
  • there's some way to use a config file or an environment variable or a command-line option to make heldger-flow use --cost (or perhaps any arbitrary additional hledger options) in the income-expense reports (or perhaps in all reports)
  • have a new report that's the same as income-expense, but includes --cost

Describe alternatives you've considered

  • I'm installing hledger-flow with nix, so I could possibly apply a patch to https://github.com/apauley/hledger-flow/blob/master/src/Hledger/Flow/Reports.hs#L65 to build a custom version of hledger-flow. Imo, this isn't ideal since I'd prefer for my files to remain 100% compatible with the official hledger-flow version.
  • I could make my own shell script that generates the report, but will have to duplicate the work hledger-flow already does of iterating over each available year. (Possibly a separate feature request, it would be cool to have a way to define new reports that heldger-flow would run for all years.)

Additional context
Add any other context or screenshots about the feature request here.

@avh4
Copy link
Author

avh4 commented Jan 5, 2023

Ah, I found a workaround, to run this script (note: needs bash; it won't work in zsh) after running hledger-flow report:

for i in reports/*/*/income-expenses.txt; do
  cmd="$(head -n1 "$i")"
  (echo "$cmd --cost"; echo; $cmd --cost) > "$i"
done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant