-
Notifications
You must be signed in to change notification settings - Fork 1
/
reports.txt
executable file
·59 lines (49 loc) · 2.1 KB
/
reports.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Each paragraph consists of explanations ('# ...') and the cmd itself (last line).
# Show the current journal status.
led bal
# Show all transactions involving Food.
led reg Food
# Show total donations.
led bal Donations
led reg Donations
# Show current net worth.
led bal Assets Liabilities
# Show expenses of last months.
# Group by month (--monthly or -M).
# Collapse transcations with multiple postings (--collapse or -n).
# Average (--average or -A).
# <TOTAL> lines represent the running average.
MONTH=`date +"%Y/%m/01" -d "6 months ago"`
MONTH=2041/10/01 # just for the example
led --period "from $MONTH" -M -n -A reg ^Expenses
#
# Visualize using gnuplot (uncomment to activate)
##led -j -M -n -p "from $MONTH" reg ^Expenses
##ledplot -j -M -n -p "from $MONTH" reg ^Expenses
# Show net gain of last 6 months.
# Group by month (--monthly or -M).
# Collapse transcations with multiple postings (--collapse or -n)
MONTH=`date +"%Y/%m/01" -d "6 months ago"`
MONTH=2041/10/01 # just for the example
led --period "from $MONTH" -M -n reg Assets Receivables
# ONLY WORKS AFTER HAVING COMPLETED THE CHAPTER ON THE JOURNAL UPDATE!
#
# Show the balance of last month. This won't work until you have updated the
# journal to contain data for April 2042.
ledlm bal
# ONLY WORKS AFTER HAVING COMPLETED THE CHAPTER ON THE JOURNAL UPDATE!
#
# Show expenses/income from last month. This won't work until you have updated
# the journal to contain data for April 2042.
ledlm bal ^Expenses ^Income
echo ""
ledlm bal --percent --sort "abs(total)" --depth 2 ^Expenses
# Show the saving rate (incomve vs expenses). This is done by first calucalting
# the total income and then calculating the percentage of the total outcome.
# A bit of Ledger magic is used for the actual calculation.
# Remember that the income is negative because it *comes* from somewhere else
# (negative; less money in the account) and *goes* to our wallet/bank account
# (positive; more money in the account).
TOTAL=`led bal -n --format "%(display_total)" ^Income`
echo "Total income since dawn of time: $TOTAL; Saving rate is:"
led bal -n -t "percent(a, $TOTAL)" ^Expenses ^Income