# Some hledger/PTA-related bash scripts. See also Justfile. alias hl='hledger' alias acc='hledger accounts' alias act='hledger activity' alias add='hledger add' alias areg='hledger aregister' alias bal='hledger balance' alias bar='hledger bar' alias bs='hledger balancesheet' alias bse='hledger balancesheetequity' alias budget='hledger balance --budget' alias cf='hledger cashflow' alias check='hledger check' alias close='hledger close' alias codes='hledger codes' alias comm='hledger commodities' alias desc='hledger descriptions' alias diff='hledger diff' alias files='hledger files' alias iadd='hledger-iadd' alias interest='hledger interest' alias import='hledger import' alias is='hledger incomestatement' alias lots='hledger lots' alias notes='hledger notes' alias payees='hledger payees' alias plot='hledger plot' alias prices='hledger prices' alias print='hledger print' alias reg='hledger register' alias rewrite='hledger rewrite' alias roi='hledger roi' alias stats='hledger stats' alias tags='hledger tags' alias ui='hledger ui' alias web='hledger web' export FINDIR=~/finance export LEDGER_FILE=$FINDIR/2024/2024.journal alias f=$FINDIR/justfile alias all='hledger -f $FINDIR/all.journal' alias 2020='hledger -f $FINDIR/2020/2020.journal' alias 2021='hledger -f $FINDIR/2021/2021.journal' alias 2022='hledger -f $FINDIR/2022/2022.journal' alias 2023='hledger -f $FINDIR/2023/2023.journal' alias 2024='hledger -f $FINDIR/2024/2024.journal' alias jan="hledger -p jan" alias feb="hledger -p feb" alias mar="hledger -p mar" alias apr="hledger -p apr" alias may="hledger -p may" alias jun="hledger -p jun" alias jul="hledger -p jul" alias aug="hledger -p aug" alias sep="hledger -p sep" alias oct="hledger -p oct" alias nov="hledger -p nov" alias dec="hledger -p dec" # time #export TIMELOG=$FINDIR/time.journal export TIMELOG=$FINDIR/time/time-2024.journal alias hours="hledger -f $TIMELOG" alias today='hours -p today' alias yesterday='hours -p yesterday' alias thisweek='hours -p thisweek' alias lastweek='hours -p lastweek' alias thismonth='hours -p thismonth' alias lastmonth='hours -p lastmonth' alias thisyear='hours -p thisyear' alias lastyear='hours -p lastyear' alias janhours="hours -p jan" alias febhours="hours -p feb" alias marhours="hours -p mar" alias aprhours="hours -p apr" alias mayhours="hours -p may" alias junhours="hours -p jun" alias julhours="hours -p jul" alias aughours="hours -p aug" alias sephours="hours -p sep" alias octhours="hours -p oct" alias novhours="hours -p nov" alias dechours="hours -p dec" # old ledger 2.6 scripts BalanceSheet() { echo "Balance sheet as of `date`" echo "totals include sub-accounts" echo ledger -n --balance-format '%10T %2_%-a\n' --display "l<=3" --basis --subtotal $* balance assets echo ledger -n --balance-format '%10T %2_%-a\n' --display "l<=3" --basis --subtotal $* balance liabilities echo ledger -nE --balance-format '%10T %2_%-a\n' --display "l<=4" --basis --subtotal $* balance equity echo echo "`ledger --balance-format '%10T %2_%-a\n' --basis $* balance liabilities equity | tail -1`liabilities + equity" echo ledger --balance-format '%10T %2_%-a\n' --basis $* balance assets liabilities | tail -2 } IncomeStatement() { echo "Income statement for `date +%Y` as of `date`" echo "totals include sub-accounts" echo ledger -n --balance-format '%10(-T) %2_%-a\n' --display "l<=3" --basis --subtotal $* balance income echo ledger -n --balance-format '%10(-T) %2_%-a\n' --display "l<=2" --basis --subtotal $* balance expenses -equity echo ledger --balance-format '%10(-T) %2_%-a\n' --basis $* balance income expenses -equity | tail -2 } # function CashflowStatement () { # echo "Cashflow statement for `date +%Y`" # #echo "(totals include sub-accounts)" # echo # cat <