summaryrefslogtreecommitdiff
path: root/contrib/non-profit-audit-reports
diff options
context:
space:
mode:
authorBradley M. Kuhn <bkuhn@ebb.org>2012-11-21 13:09:55 -0500
committerBradley M. Kuhn <bkuhn@ebb.org>2012-11-26 13:54:42 -0500
commit01dc0416b9262905e66887b29ccef31d2867b9df (patch)
tree5690c0d7a35c0187c74c26cb094cbc1741818fee /contrib/non-profit-audit-reports
parent287a756ab6c7072349dee8818e9775d67c8847be (diff)
downloadfork-ledger-01dc0416b9262905e66887b29ccef31d2867b9df.tar.gz
fork-ledger-01dc0416b9262905e66887b29ccef31d2867b9df.tar.bz2
fork-ledger-01dc0416b9262905e66887b29ccef31d2867b9df.zip
Support a broader set of possible tags to be placed into the spreadsheet.
I've now made a hard-coded list of potential tags that are supported and will be linked to in the general ledger spreadsheet. This list should probably be in a configuration file of some sort eventually, rather than hard coded. Indeed, note that the hard-coding goes into two different scripts, and thus the lists could easily get out of sync.
Diffstat (limited to 'contrib/non-profit-audit-reports')
-rwxr-xr-xcontrib/non-profit-audit-reports/csv2ods.py5
-rwxr-xr-xcontrib/non-profit-audit-reports/general-ledger-report.plx12
2 files changed, 14 insertions, 3 deletions
diff --git a/contrib/non-profit-audit-reports/csv2ods.py b/contrib/non-profit-audit-reports/csv2ods.py
index f6150158..59571280 100755
--- a/contrib/non-profit-audit-reports/csv2ods.py
+++ b/contrib/non-profit-audit-reports/csv2ods.py
@@ -24,6 +24,9 @@ import sys, os, os.path, optparse
import csv
import ooolib2
+file_fields = [ 'Receipt', 'Invoice', 'Statement', 'Contract', 'PurchaseOrder',
+ 'Approval', 'Check', 'IncomeDistributionAnalysis', 'CurrencyRate' ]
+
def err(msg):
print 'error: %s' % msg
sys.exit(1)
@@ -56,7 +59,7 @@ def csv2ods(csvname, odsname, verbose = False):
if len(val) > 0 and val[0] == '$':
doc.set_cell_value(col + 1, row, 'currency', val[1:])
else:
- if ( (col == 5) and (val != 'Receipt') and len(val) > 0) or ( (col == 6) and (val != 'Invoice') and len(val) > 0):
+ if ((col >= 5) and (not val in file_fields) and len(val) > 0):
linkrel = '../' + val # ../ means remove the name of the *.ods
linkname = os.path.basename(val) # name is just the last component
doc.set_cell_value(col + 1, row, 'link', (linkrel, linkname))
diff --git a/contrib/non-profit-audit-reports/general-ledger-report.plx b/contrib/non-profit-audit-reports/general-ledger-report.plx
index 5286d625..1c293db9 100755
--- a/contrib/non-profit-audit-reports/general-ledger-report.plx
+++ b/contrib/non-profit-audit-reports/general-ledger-report.plx
@@ -107,8 +107,16 @@ foreach my $acct (@sortedAccounts) {
close(GL_TEXT_DATA); die "error reading ledger output for chart of accounts: $!" unless $? == 0;
print GL_CSV_OUT "\n\"ACCOUNT:\",\"$acct\"\n\"PERIOD START:\",\"$beginDate\"\n\"PERIOD END:\",\"$formattedEndDate\"\n";
- print GL_CSV_OUT '"DATE","CHECK NUM","NAME","TRANSACTION AMT","RUNNING TOTAL","Receipt","Invoice"', "\n";
- @acctLedgerOpts = ('-F', '"%(date)","%C","%P","%t","%T","%(tag(\'Receipt\'))","%(tag(\'Invoice\'))"\n', '-w', '--sort', 'd', '-b', $beginDate, '-e', $endDate, @otherLedgerOpts, 'reg', $acct);
+ print GL_CSV_OUT '"DATE","CHECK NUM","NAME","TRANSACTION AMT","RUNNING TOTAL"';
+ my $formatString = '"%(date)","%C","%P","%t","%T"';
+ foreach my $tagField (qw/Receipt Invoice Statement Contract PurchaseOrder Approval Check IncomeDistributionAnalysis CurrencyRate/) {
+ print GL_CSV_OUT ',"', $tagField, '"';
+ $formatString .= ',"%(tag(\'' . $tagField . '\'))"';
+ }
+ $formatString .= "\n";
+ print GL_CSV_OUT "\n";
+
+ @acctLedgerOpts = ('-F', $formatString, '-w', '--sort', 'd', '-b', $beginDate, '-e', $endDate, @otherLedgerOpts, 'reg', $acct);
open(GL_CSV_DATA, "-|", $LEDGER_CMD, @acctLedgerOpts)
or die "Unable to run $LEDGER_CMD @acctLedgerOpts: $!";