summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorBradley M. Kuhn <bkuhn@ebb.org>2012-11-22 16:45:59 -0500
committerBradley M. Kuhn <bkuhn@ebb.org>2012-11-26 13:54:44 -0500
commit7772e33720db8234d12640996033bcba8ca98e7f (patch)
treec26c797b10e0732e5420718076e412e519c63d41 /contrib
parent60f45c3e2cff809f6c9356e9853cf38070bd3ec6 (diff)
downloadfork-ledger-7772e33720db8234d12640996033bcba8ca98e7f.tar.gz
fork-ledger-7772e33720db8234d12640996033bcba8ca98e7f.tar.bz2
fork-ledger-7772e33720db8234d12640996033bcba8ca98e7f.zip
Include all types of totals that need to be considered when generating fund report.
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/non-profit-audit-reports/fund-report.plx26
1 files changed, 17 insertions, 9 deletions
diff --git a/contrib/non-profit-audit-reports/fund-report.plx b/contrib/non-profit-audit-reports/fund-report.plx
index a463bccf..764080d0 100755
--- a/contrib/non-profit-audit-reports/fund-report.plx
+++ b/contrib/non-profit-audit-reports/fund-report.plx
@@ -64,7 +64,7 @@ while (my $fundLine = <LEDGER_FUNDS>) {
}
close LEDGER_FUNDS;
-# First, get fund list from ending balance
+# First, get fund list from starting balance
@ledgerOptions = (@mainLedgerOptions,
'-V', '-X', '$', '-F', "%-.70A %22.108t\n", '-w', '-s',
'-e', $startDate, 'reg', '^Funds:Restricted:');
@@ -94,7 +94,10 @@ foreach my $fund (keys %funds) {
'-V', '-X', '$', '-F', "%-.70A %22.108t\n", '-w', '-s',
'-b', $startDate, '-e', $endDate, 'reg');
-foreach my $type ('Income', 'Expenses') {
+my @possibleTypes = ('Unearned Income', 'Retained Earnings', 'Retained Costs',
+ 'Accrued:Accounts Payable', 'Accrued:Accounts Receivable');
+
+foreach my $type ('Income', 'Expenses', @possibleTypes) {
foreach my $fund (keys %funds) {
open(LEDGER_INCOME, "-|", $LEDGER_CMD, @ledgerOptions, "^${type}:$fund")
or die "Unable to run $LEDGER_CMD for funds: $!";
@@ -113,15 +116,20 @@ foreach my $type ('Income', 'Expenses') {
my($totStart, $totEnd) = ($ZERO, $ZERO);
foreach my $fund (sort keys %funds) {
- print "Fund: $fund\n";
- print " Balance as of $startDate: ", sprintf("\$%15.2f\n\n", $funds{$fund}{starting});
- print " Income during period: ", sprintf("\$%15.2f\n", $funds{$fund}{Income});
- print " Expenses during period: ", sprintf("\$%15.2f\n\n", $funds{$fund}{Expenses});
- print " Balance as of $endDate: ", sprintf("\$%15.2f\n", $funds{$fund}{ending});
- print "\n\n";
+ my $sanityTotal = $funds{$fund}{starting};
+ print "Fund: $fund\n", sprintf("%-35s\$%26.2f\n\n", "Balance as of $startDate:",
+ $funds{$fund}{starting});
+ foreach my $type ('Income', 'Expenses', @possibleTypes) {
+ my $formattedType = $type; $formattedType =~ s/^Accrued://;
+ next if $type ne 'Income' and $type ne 'Expenses' and $funds{$fund}{$type} == $ZERO;
+ print sprintf("%19s during period: \$%26.2f\n", $formattedType, $funds{$fund}{$type});
+ }
+ print sprintf("\n%-35s\$%26.2f\n", "Balance as of $endDate:",
+ $funds{$fund}{ending}), "\n\n";
# Santity check:
if ($funds{$fund}{ending} !=
- ( ($funds{$fund}{starting} - $funds{$fund}{Income}) - $funds{$fund}{Expenses})) {
+ ($funds{$fund}{starting}
+ - $funds{$fund}{Income} - $funds{$fund}{'Unearned Income'} - $funds{$fund}{Expenses})) {
print "$fund FAILED SANITY CHECK\n\n\n";
die "$fund FAILED SANITY CHECK";
}