summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorBradley M. Kuhn <bkuhn@ebb.org>2012-11-25 13:26:27 -0500
committerBradley M. Kuhn <bkuhn@ebb.org>2012-11-26 13:54:47 -0500
commitdf6428f549a3a82d52bb18b1e71b468e35b2c444 (patch)
tree43cc6b3ff6e3c098fa164b9af01cd4e6ab85bebc /contrib
parent4f8ea18fec539c6b2e48fa7125bceaa795e899de (diff)
downloadfork-ledger-df6428f549a3a82d52bb18b1e71b468e35b2c444.tar.gz
fork-ledger-df6428f549a3a82d52bb18b1e71b468e35b2c444.tar.bz2
fork-ledger-df6428f549a3a82d52bb18b1e71b468e35b2c444.zip
Adapted for use with Ledger 3.
Includes forcing of -V so all currency is in default.
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/non-profit-audit-reports/cash-receipts-and-disbursments-journals.plx22
1 files changed, 14 insertions, 8 deletions
diff --git a/contrib/non-profit-audit-reports/cash-receipts-and-disbursments-journals.plx b/contrib/non-profit-audit-reports/cash-receipts-and-disbursments-journals.plx
index c1c8d833..346e4064 100755
--- a/contrib/non-profit-audit-reports/cash-receipts-and-disbursments-journals.plx
+++ b/contrib/non-profit-audit-reports/cash-receipts-and-disbursments-journals.plx
@@ -4,7 +4,7 @@
# Script to generate a General Ledger report that accountants like
# using Ledger.
#
-# Copyright (C) 2011, Bradley M. Kuhn
+# Copyright (C) 2011, 2012 Bradley M. Kuhn
#
# This program gives you software freedom; you can copy, modify, convey,
# and/or redistribute it under the terms of the GNU General Public License
@@ -28,7 +28,7 @@ use Math::BigFloat;
use Date::Manip;
use File::Temp qw/tempfile/;
-my $LEDGER_CMD = "/usr/bin/ledger";
+my $LEDGER_CMD = "/usr/local/bin/ledger";
my $ACCT_WIDTH = 75;
@@ -54,7 +54,7 @@ if (@ARGV < 2) {
my($beginDate, $endDate, @otherLedgerOpts) = @ARGV;
-my(@chartOfAccountsOpts) = ('--wide-register-format', "%150A\n", '-w', '-s',
+my(@chartOfAccountsOpts) = ('-V', '-F', "%150A\n", '-w', '-s',
'-b', $beginDate, '-e', $endDate, @otherLedgerOpts, 'reg');
open(CHART_DATA, "-|", $LEDGER_CMD, @chartOfAccountsOpts)
@@ -90,7 +90,7 @@ foreach my $acct (@accounts) {
print TEXT_OUT "\n\nACCOUNT: $acct\nFROM: $beginDate TO $formattedEndDate\n\n";
print CSV_OUT "\n\"ACCOUNT:\",\"$acct\"\n\"PERIOD START:\",\"$beginDate\"\n\"PERIOD END:\",\"$formattedEndDate\"\n";
- print CSV_OUT '"DATE","CHECK NUM","NAME","ACCOUNT","AMOUNT"', "\n";
+ print CSV_OUT '"DATE","CHECK NUM","NAME","ACCOUNT","AMOUNT"';
my @entryLedgerOpts = ('-l', $typeData->{query},
'-b', $beginDate, '-e', $endDate, @otherLedgerOpts, 'print', $acct);
@@ -106,12 +106,18 @@ foreach my $acct (@accounts) {
goto SKIP_REGISTER_COMMANDS if (-z $tempFile);
- my @txtRegLedgerOpts = ('-f', $tempFile, '--wide-register-format',
- "%D %-.70P %-.10C %-.80A %18t\n%/%68|%15|%-.80A %18t\n", '-w', '--sort', 'd',
+ my @txtRegLedgerOpts = ('-f', $tempFile, '-V', '-F',
+ "%(date) %-.70P %-.10C %-.80A %18t\n", '-w', '--sort', 'd',
'-b', $beginDate, '-e', $endDate, 'reg');
- my @csvRegLedgerOpts = ('-f', $tempFile, '--wide-register-format',
- '\n"%D","%C","%P","%A","%t"\n%/"","","","%A","%t"\n', '-w', '--sort', 'd',
+ my $formatString = '\n"%(date)","%C","%P","%A","%t"\n%/"","","","%A","%t"';
+ foreach my $tagField (qw/Receipt Invoice Statement Contract PurchaseOrder Approval Check IncomeDistributionAnalysis CurrencyRate/) {
+ print CSV_OUT ',"', $tagField, '"';
+ $formatString .= ',"%(tag(\'' . $tagField . '\'))"';
+ }
+ $formatString .= "\n";
+ print CSV_OUT "\n";
+ my @csvRegLedgerOpts = ('-f', $tempFile, '-V', '-F', $formatString, '-w', '--sort', 'd',
'-b', $beginDate, '-e', $endDate, 'reg');