Add script to generate pdf reports.
This commit is contained in:
48
tools/report.sh
Normal file
48
tools/report.sh
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/bin/sh
|
||||
|
||||
CSV_FILE="data.csv"
|
||||
REPORT_MD="report.md"
|
||||
REPORT_PDF="/home/felixm/report.pdf"
|
||||
YEAR="2018-04"
|
||||
HLEDGER="hledger balance -M -V -b $YEAR --depth 1 --transpose -o $CSV_FILE"
|
||||
|
||||
# Networth
|
||||
$HLEDGER -H '^assets'
|
||||
sed -i 's/\$//g' $CSV_FILE
|
||||
python tofig.py $CSV_FILE "figure_1.png"
|
||||
|
||||
$HLEDGER '^assets'
|
||||
sed -i 's/\$//g' $CSV_FILE
|
||||
sed -i 's/assets/cashflow/g' $CSV_FILE
|
||||
python tofig.py $CSV_FILE "figure_2.png" --type bar
|
||||
|
||||
$HLEDGER '^expenses'
|
||||
sed -i 's/\$//g' $CSV_FILE
|
||||
python tofig.py $CSV_FILE "figure_3.png" --type bar
|
||||
|
||||
$HLEDGER '^income'
|
||||
sed -i 's/\$-//g' $CSV_FILE
|
||||
python tofig.py $CSV_FILE "figure_4.png" --type bar
|
||||
|
||||
rm $CSV_FILE
|
||||
|
||||
cat > $REPORT_MD <<- EOM
|
||||
# Financial Report
|
||||
|
||||
# Networth
|
||||

|
||||
|
||||
# Cashflow
|
||||

|
||||
|
||||
# Expenses
|
||||

|
||||
|
||||
# Income
|
||||

|
||||
EOM
|
||||
|
||||
pandoc $REPORT_MD -o $REPORT_PDF
|
||||
rm figure_*
|
||||
rm $REPORT_MD
|
||||
|
||||
Reference in New Issue
Block a user