Skip to content

Instantly share code, notes, and snippets.

@steelman
Last active November 24, 2019 19:20
Show Gist options
  • Save steelman/37d39f3023342c05054be1dac8adc3bb to your computer and use it in GitHub Desktop.
Save steelman/37d39f3023342c05054be1dac8adc3bb to your computer and use it in GitHub Desktop.
Prices versus costs
; Good
~yearly from 2019-11-01
Assets:Checking
Expense:Food 10 apples {=1,00 PLN}
Expense:Food 10 pears {=1,00 PLN}
2019-11-19 Foo
Assets:Checking
Expense:Food 10,0 apples {{=10,0 PLN}}
Expense:Food 10,0 pears {{=10,0 PLN}}
; $ ledger -f /tmp/foo.dat bal
; -10,0 apples
; -10,0 pears Assets:Checking
; 10,0 apples
; 10,0 pears Expense:Food
; --------------------
; 0
; $ ledger -f /tmp/foo.dat -V bal
; PLN-20 Assets:Checking
; PLN20 Expense:Food
; --------------------
; 0
; Odd currency format?
; D 1000.00 PLN fixes the problem.
; $ ledger --add-budget -f /tmp/foo.dat bal
; [empty]
; /Good
; Good
~yearly from 2019-11-01
Assets:Checking -20,00 PLN
Expense:Food 10 apples @=1,00 PLN
Expense:Food 10 pears @=1,00 PLN
2019-11-19 Foo
Assets:Checking -20,00 PLN
Expense:Food 10,0 apples @@=10,0 PLN
Expense:Food 10,0 pears @@=10,0 PLN
; $ ledger -f /tmp/foo.dat bal
; -20,00 PLN Assets:Checking
; 10,0 apples
; 10,0 pears Expense:Food
; --------------------
; -20,00 PLN
; 10,0 apples
; 10,0 pears
; $ ledger -f /tmp/foo.dat -V bal
; -20,00 PLN Assets:Checking
; 20,00 PLN Expense:Food
; --------------------
; 0
; $ ledger --add-budget -f /tmp/foo.dat bal
; [empty]
; /Good
; Good
~yearly from 2019-11-01
Assets:Checking
Expense:Food 10 apples @=1,00 PLN
Expense:Food 10 pears @=1,00 PLN
2019-11-19 Foo
Assets:Checking
Expense:Food 10,0 apples @@=10,0 PLN
Expense:Food 10,0 pears @@=10,0 PLN
; $ ledger -f /tmp/foo.dat bal
; PLN-20 Assets:Checking
; 10,0 apples
; 10,0 pears Expense:Food
; --------------------
; PLN-20
; 10,0 apples
; 10,0 pears
; $ ledger -f /tmp/foo.dat -V bal
; PLN-20 Assets:Checking
; PLN20 Expense:Food
; --------------------
; 0
; $ ledger --add-budget -f /tmp/foo.dat bal
; [empty]
; /Good
; Bad
~yearly from 2019-11-01
Assets:Checking -20,00 PLN
Expense:Food 10 apples {=1,00 PLN}
Expense:Food 10 pears {=1,00 PLN}
2019-11-02 Foo
Assets:Checking -20,00 PLN
Expense:Food 10,0 apples {{=10,0 PLN}}
Expense:Food 10,0 pears {{=10,0 PLN}}
; $ ledger -f /tmp/foo.dat bal
; While parsing file "/tmp/foo.dat", line 61:
; Unbalanced remainder is:
; -20,00 PLN
; 10 apples {=1,00 PLN}
; 10 pears {=1,00 PLN}
; Amount to balance against:
; 10 apples {=1,00 PLN}
; 10 pears {=1,00 PLN}
; While parsing periodic transaction:
; > ~yearly from 2019-11-01
; > Assets:Checking -20,00 PLN
; > Expense:Food 10 apples {=1,00 PLN}
; > Expense:Food 10 pears {=1,00 PLN}
; Error: Transaction does not balance
; While parsing file "/tmp/foo.dat", line 66:
; While balancing transaction from "/tmp/foo.dat", lines 63-66:
; > 2019-11-02 Foo
; > Assets:Checking -20,00 PLN
; > Expense:Food 10,0 apples {{=10,0 PLN}}
; > Expense:Food 10,0 pears {{=10,0 PLN}}
; Unbalanced remainder is:
; -20,00 PLN
; 10,0 apples {=1,00 PLN}
; 10,0 pears {=1,00 PLN}
; Amount to balance against:
; 10,0 apples {=1,00 PLN}
; 10,0 pears {=1,00 PLN}
; Error: Transaction does not balance
; /Bad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment