summaryrefslogtreecommitdiff
path: root/contrib/non-profit-audit-reports/demo.sh
diff options
context:
space:
mode:
authorTom Marble <tmarble@info9.net>2012-09-08 00:30:37 -0500
committerTom Marble <tmarble@info9.net>2012-09-08 00:30:37 -0500
commit47130b2dfb2d2489b0dc825d43fe31c2644ac0b6 (patch)
treedce91b5c6d42df99e3e3c087203f872bc66f9cf7 /contrib/non-profit-audit-reports/demo.sh
parentfb601e2a656945cdd32a714b5efc9c483935c338 (diff)
downloadfork-ledger-47130b2dfb2d2489b0dc825d43fe31c2644ac0b6.tar.gz
fork-ledger-47130b2dfb2d2489b0dc825d43fe31c2644ac0b6.tar.bz2
fork-ledger-47130b2dfb2d2489b0dc825d43fe31c2644ac0b6.zip
First pass technical study of creating ODS from ledger
Diffstat (limited to 'contrib/non-profit-audit-reports/demo.sh')
-rwxr-xr-xcontrib/non-profit-audit-reports/demo.sh43
1 files changed, 43 insertions, 0 deletions
diff --git a/contrib/non-profit-audit-reports/demo.sh b/contrib/non-profit-audit-reports/demo.sh
new file mode 100755
index 00000000..6a9dcadf
--- /dev/null
+++ b/contrib/non-profit-audit-reports/demo.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+# demo.sh
+# Demonstrate a non-profit GL export and conversion to ODS
+
+program=$(basename $0)
+dir=$(dirname $0)
+cd $dir
+dir=$(pwd -P)
+export PYTHONPATH=$dir/ooolib2
+
+getcsv=$dir/general-ledger-report.plx
+csv2ods=$dir/csv2ods.py
+
+echo "Demonstrating ledger to ODS export in $dir/tests"
+cd $dir/tests
+sampledata=non-profit-test-data.ledger
+echo " based on the sample data in $sampledata"
+
+$getcsv 2011/03/01 2012/03/01 -f $sampledata
+if [ -e general-ledger.csv ]; then
+ echo "data was exported to: general-ledger.csv"
+else
+ echo "error creating csv file"
+ exit 1
+fi
+
+$csv2ods --verbose --csv general-ledger.csv
+if [ -e general-ledger.ods ]; then
+ echo "csv was converted to: general-ledger.ods"
+else
+ echo "error creating ods file"
+ exit 1
+fi
+
+# create a portable zip file with the spreadsheet
+# and the linked artifacts
+
+echo creating portable zipfile...
+zip -r ../general-ledger.zip general-ledger.ods Financial Projects -x '*.txt'
+
+echo " "
+echo "created general-ledger.zip"
+