GithubHelp home page GithubHelp logo

howeyc / ledger Goto Github PK

View Code? Open in Web Editor NEW
448.0 448.0 43.0 18 MB

Command line double-entry accounting program

Home Page: https://howeyc.github.io/ledger/

License: ISC License

Go 50.26% HTML 12.18% CSS 3.21% Roff 4.94% Shell 0.89% Vim Script 1.20% Makefile 0.14% JavaScript 27.19%
accounting go ledger plaintext plaintext-accounting

ledger's People

Contributors

aquilax avatar athorp96 avatar azinkhan avatar bionoren avatar computerscienceiscool avatar howeyc avatar jrick avatar kalafut avatar musvaage avatar porjo avatar raylai avatar silasb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ledger's Issues

Compilation error

$ go build -ldflags=-s .
parse.go:12:2: use of internal package github.com/howeyc/ledger/internal/github.com/joyt/godate not allowed

How do proceed?

ledger fails to link at build time once OpenBSD removes syscall(2)

OpenBSD is removing the syscall(2) interface soon, and this will break ledger builds on the platform:

$ go install ./ledger     
# github.com/howeyc/ledger/ledger
/home/jrick/src/go/pkg/tool/openbsd_amd64/link: running clang failed: exit status 1
ld: error: undefined symbol: syscall
>>> referenced by zsyscall_openbsd_amd64.s:213 (/home/jrick/src/go/src/syscall/zsyscall_openbsd_amd64.s:213)
>>>               /tmp/go-link-4273625514/go.o:(syscall.libc_syscall_trampoline.abi0)
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Updating to the latest golang.org/x/sys module fixes the build.

Result of register report in reverse order

Two examples:

2020/11/01 Paypal Invoice
    Assets:Checking                                                       68.67
    Assets:Wallet                                                          0.13
    Income:Paypal                                                        -68.80

2020/12/22 Withdraw
    Assets:Funds:Bank                                                   -170.00
    Assets:Wallet                                                        170.00

2020/11/01 Paypal Invoice Assets:Wallet                     68.67      68.67
2020/11/01 Paypal Invoice Assets:Checking                    0.13      68.80
2020/12/22 Withdraw       Assets:Wallet                   -170.00    -101.20
2020/12/22 Withdraw       Assets:Funds:Bank                170.00      68.80

In the register report the order is reversed, it is crediting 68.67 in the wallet, and 0.13 in the checking account.. Why?

Thanks.

Support including dat files

The error I received with lweb:

journal.dat:4: Unable to parse date: include

Consider a file structure that looks like this:

.
├── 2016.dat
├── 2017.dat
├── 2018.dat
├── accounts.dat
├── commodities.dat
├── journal.dat
├── price.db

Where journal.dat serves as the entry point to include all of the other dat files.
Example:

include accounts.dat
include commodities.dat

; Annual journals
include 2016.dat
include 2017.dat
include 2018.dat

import matching

I'm using import function and found that the auto matching of transations to accounts isn't working well for some transactions.

I took a look at the code and can see that it will match accounts using the --set-search value (which defaults to Expense). In my case however, matching works better if I skip that filter i.e. comment this line and consider all account names when attempting to match. That way it picks up transactions from Income accounts (e.g. salary) and Asset accounts (internal transfers).

Would it make sense to include a flag to skip the --set-search value comparison?

typos

accessibility
cast
classifier
commodities
current
elements
hierarchy
probability
separator
supported

$ grep -nr accessability ledger
ledger/ledger/book/src/Introduction.md:5:accessability. The ecosystem of PTA tools includes programs
$ grep -nr casted ledger
ledger/decimal/decimal.go:5:// an int64 casted to Decimal will not work, one of the "New" functions must
$ grep -nr clasifier ledger
ledger/ledger/man/ledger.1:205:for the given transaction. Uses a clasifier that "learns" from existing ledger
$ grep -nr comodities ledger
ledger/ledger/book/src/Web_Portfolio.md:7:accounts to comodities and the shares of the commodity the account represents.
$ grep -nr curent ledger
ledger/parse.go:186:    // try curent date layout
$ grep -nr elemens ledger
ledger/ledger/cmd/static/bootstrap-nightfall.min.css:9: * This version is an extraction with only the dark elemens, or delta, of the
$ grep -nr heirarchy ledger
ledger/ledger/man/ledger.5:58:Accounts use ":" as a separater for heirarchy. All sub-accounts combine up to
$ grep -nr probablility ledger
ledger/ledger/book/src/02_Import.md:5:Matches do not need to be exact matches, it's based on probablility determined
$ grep -nr separater ledger
ledger/ledger/man/ledger.5:58:Accounts use ":" as a separater for heirarchy. All sub-accounts combine up to
$ grep -nr suppored ledger
ledger/date.go:25:// Periods suppored by ledger
$ 

misspelled filenames

$ ls ledger/ledger/cmd/internal/pdr/grammer*
ledger/ledger/cmd/internal/pdr/grammer.peg  ledger/ledger/cmd/internal/pdr/grammer.peg.go
$ 

misspelled filenames cited in comments

$ grep -nr grammer ledger/ledger/cmd/internal/pdr/grammer.peg.go
3:// Code generated by peg -inline -switch grammer.peg DO NOT EDIT.
$ grep -nr grammer ledger/ledger/cmd/internal/pdr/pdr.go
1://go:generate peg -inline -switch grammer.peg
$ 

Suggestion: Support for units/commodities

Unless I'm doing something very wrong, this implementation of ledger does not seem to support USD as a commodity.

If this is the case, I would suggest prioritizing this, as it stops anyone interested in tracking more than one currency (or cryptocurrency) from using this implementation. Depending on the scale of change required, I might be interested in helping with it.

Regardless, this is an awesome project. Keep up the good work, even if these features don't make it into your backlog!

Support sync access by default

ParseLedger() is just a wrapper for ParseLedgerAsync, which means there is no public synchronous parsing API. If my program is going to be blocked anyway waiting for the results of a ledger parse, I don't want to have the overhead of channels and scheduler context switches on top of that.

Could we switch it around - so ParseLedger is where the work actually happens, and ParseLedgerAsync wraps it in a goroutine and channels? I would be happy to submit a pull request

Result of register report in reverse order

2020/11/01 Paypal Invoice
Assets:Checking 68.67
Assets:Wallet 0.13
Income:Paypal -68.80

2020/12/22 Withdraw
Assets:Funds:Bank -170.00
Assets:Wallet 170.00

2020/11/01 Paypal Invoice Assets:Wallet 68.67 68.67
2020/11/01 Paypal Invoice Assets:Checking 0.13 68.80
2020/12/22 Withdraw Assets:Wallet -170.00 -101.20
2020/12/22 Withdraw Assets:Funds:Bank 170.00 68.80

In the register order is reversed, it is crediting 68.67 in the wallet, and 0.13 in the checking account.. Why?

Thanks.

Equity command

Greetings !! Is there any possibility of implementing the equity command, to archive the old journals?

Thanks in advance.

balance panic

Balance panics when columns is set too small. Could it instead work out the minimum columns required for the given display and reset columns to that? And perhaps also output to stderr a message e.g. 'columns 40 is too small, resetting to 45'

ledger balance -f ../data/ledger.ledger --columns 40
panic: strings: negative Repeat count

goroutine 1 [running]:
strings.Repeat({0xa23b08?, 0x23?}, 0x8ce0b4?)
	/usr/lib/golang/src/strings/strings.go:533 +0x4d8
github.com/howeyc/ledger/ledger/cmd.PrintBalances({0xc000100780, 0x4c, 0x32?}, 0x0, 0xffffffffffffffff, 0x28)
	/home/ian/ledger/ledger.git/ledger/cmd/print.go:112 +0x195
github.com/howeyc/ledger/ledger/cmd.glob..func5(0xd22120?, {0xc000071880, 0x0, 0x4})
	/home/ian/ledger/ledger.git/ledger/cmd/printBalance.go:24 +0xff
[...]

No input validation

I created a transaction with no values. after submitting the file was broken because it had an entry with empty amounts.
Offending entry:

-----------8<-----------8<-----------8<-----------8<-----------8<-----------
2019/02/13 jkljlkjl
    Konto
    cash
    bar
----------->8----------->8----------->8----------->8----------->8-----------

This left the entire app broken, there was no (obvious) way to fix this in the webui.
Error message:

-----------8<-----------8<-----------8<-----------8<-----------8<-----------
ledger.dat:18: Unable to balance transaction, more than one account change empty)
----------->8----------->8----------->8----------->8----------->8-----------

How it should be

Either valildate entries before writing or parse broken entries and let me open the form again.
Deleting or ignoring would not be acceptable because the bookkeeping would not be trustworthy anymore

Import matching existing transactions

While importing, I've noticed that if I have two transactions on the same day where payee starts with the same word, only one of them is imported. I can see from the code that it does a simple match against the first word of the payee field. It would be good to improve that e.g use Bayesian classifier on payee string, or simple match on the first 2-3 words?

More forgiving parser

Thanks for this nice tool!

I had some trouble figuring out how to write ledger files. Initially I started with the following, which caused segfaults in lweb:

2016/02/20\tPayee
\tAccountA\t-100
\tAccountB

After a few tries, weird crashes and lweb sending application/x-gzip files my way, I figured out that it has to look like this (only spaces, no tabs, but a double-space before the amount):

2016/02/20 Payee
 AccountA  -100
 AccountB

Maybe the parser could be relaxed a bit, to also accept tabs in the right positions? And/or the readme could be extended by a line explaining what I said above: "only spaces, no tabs, but a double-space before the amount"?

Sc and ledger

Hey @howeyc

i noticed there is an sc and this ledger repo.

for an open science system I need a self hosted sc system but ledger looks also pretty good.

I am Building a gui using gio not Fyne on top . That’s the plan .

would someone be able to tell me if:
Sc can do functions like google sheets where you essentially end up with parametrics. In other words a cell changes and it’s func run that changes other cells. Basically turtle all the way down or up ( I am Australian so down :)

I ask because I can be the parametrics in to sc or ledger using an event WAL style thing. Basically changes are events and consumers listen to events. Hooks on cells then run their func and create new events etc..

thanks and I hope to extend sc and ledge also

Request: move decimal package out of internal

The fact that decimal is in a internal directory means it's impossible for application code in consuming projects to construct *ledger.Transactions at runtime (except by parsing a string representation of them). This makes it hard to build a tool capable of authoring new transactions. Is there a reason that decimal must live in internal?

Regardless, thanks for the great work on this package!

New (-f -) function issue

Hi again,

I'm getting an error when I pass the journal via stdin, it says: "Unable to parse date: include".

Thanks in advance.

duplicate transactions on limport

Regarding the following code in limport command:
if !existingTransaction(generalLedger, csvDate, inputPayeeWords[0])

Would it be possible to add a flag to the import tool to suppress this check? I often have legitimate duplicate transactions in my statements. A flag would work well perhaps?

I'd even recommend that the default is not to filter "duplicates" but to have it as an option behind a flag. Deterministic behavior by default seems preferable. But that's just my opinon since I ran into this and had to work my way through the code to understand what was happening.

CSV import

Disclaimer: I'm just getting started with Ledger and plain text accounting

My bank produces CSV output like this:

Date,Description,Credit,Debit,Balance
07/03/2022,xxxxxxxxxxx,500.00,,739.64
07/03/2022,yyyyyyyyyyy,,-5.00,239.64
07/03/2022,zzzzzzzzz,50.00,,244.64

My initial leger.dat file is just an opening balance:

2022/02/06 * Opening Balance
    Assets:Paywave                   $92.40

After adjusting header row (Date -> Transaction Date, Credit -> Amount), I can import and get Ledger output like this:

$ ./ledger -f ledger.dat import --date-format "02/01/2006" Paywave trans.csv
2022/03/07 xxxxxxxxxxxxxx
    Assets                                                                500.00
    Assets:Paywave                   $92.40                              -500.00

2022/03/07 yyyyyyyyyy
    Assets                                                                500.00
    Assets:Paywave                   $92.40                              -500.00

2022/03/07 zzzzzzzzzz
    Assets                                                                 50.00
    Assets:Paywave                   $92.40                               -50.00

Some issues:

  • empty values should be $0. Second transaction has empty value in input, but re-uses $500 from first transaction - is that a bug?
  • no way to differentiate between a credit transaction and a debit transaction
  • why is it including the opening balance ($92.40) on each source line?

Wishlist: Read Only option on Web Ledger

I enjoy being able to glance at balances via ledger web. But would it be nice in the future to update via the cli and have no access to edit via the browser. This way ledger web functions with multi-user read-only access with reasonable security and accountability reserved as git only editable.

Typo

porfolio needs to be portfolio
image

some issues

I've noticed a couple of issues while using Ledger:

  1. Specifying an invalid --period results in hung process. e.g. ./ledger balance --period blah -f ledger.dat
  2. When filtering transactions using --payee the results are those where the transaction description contains the keyword, not the payee (the account into which money was paid). Should --payee be renamed to --description?

Thanks for your time.

Suggestion: Use `dep` as dependency management tool?

Ledger currently vendors its dependencies, but I imagine that managing the contents of that vendor directory can be a pain, especially if you want to experiment with different dependency versions.

The Go community at large seems to finally be converging on a tool to manage this nightmare: dep. I've been using it for a little while in some of my other projects, and I think that it's a nice addition to any Go project.

The chief value proposition for this project would be making simple edits to the Gopkg.toml to update all of the vendored dependency versions. You could even choose to remove the vendor directory from the repo completely, since dep makes building that vendor directory deterministic.

Of course, I don't even know if this is a pain point for you @howeyc. If not, please disregard.

balance dates wrong format

If I specify a date range that doesn't contain any transactions, I get wrongly formatted date heading:

./ledger balance -f ledger.ledger --period Monthly Expenses Income --begin-date 2022/07/01 --end-date 2022/07/31
0001/01/01 - 0001/01/31
============================================================
------------------------------------------------------------
                                                        0.00

Question. Filters on print report

Hi,

Thank you very much for implementing the filter in the print report, I was going to ask you for that!

How does it work? I just can filter by payee..

ledger -f journal.ldg print Income:Paypal doesn't work..

Thanks!

register dates

I run this command:

./ledger register -f data/ledger.ledger -b "2022/05/01" -e "2022/05/20" Expenses

The results include transactions after 2022/05/01 and before 2022/05/20. I would expect the results to be inclusive of the dates specified.

Wish list

I'm loving using ledger to keep track of my day-to-day expenses. I thought I'd create an issue to list some features I'd like to see.

Command line

  • a common report I run from command line is
$ ledger balance -f ledger.ledger  --period Monthly Expenses Income --begin-date $first_date --end-date $last_date 

It'd be great if there were an additional column that showed the change from previous period for each total as a percentage. For example:

# Month 1
Expenses:Fuel                          410.51

# Month 2
Expenses:Fuel                          310.00   (-24.5%)

# Month 3
Expenses:Fuel                          350.00   (+12.9%)

Web

  • ability to limit any view to a period of time with start/end dates. It should have a configurable default (e.g. last 90 days) and ideally allow selection of date range via a datepicker.

  • ability to toggle display order of transactions oldest/most recent, with a configurable default (I typically want to see most recent at the top)

  • include a 'balance' view similar to CLI balance output, grouped by month/week with the ability to expand/collapse each child account by clicking on the parent account name. For Example:

# Collapsed View
Expenses:Fuel                          410.51

# Expanded View
Expenses:Fuel                          410.51
Expenses:Fuel:Car1                     200.51
Expenses:Fuel:Car2                     210.00
  • further to the last point, when the user clicks on any account name a transaction listing will be displayed filtered by the time period and account

I must stress that this a wish list and I have zero expectations on anyone but myself to implement these features

Integration with CSVQ

https://github.com/mithrandie/csvq is very powerful. It would be cool to have an integration so I could bulk edit the data and do more complex queries.

You can do it via export, CSVQ and import, but it would be nice to bind them together.

Is this of interest? I could work on a PR

Columns width

Hey Chris, there is a little aesthetic problem with the register report, the options "-columns 79 | 80 | 81" are returning 79 columns.

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.