Formatting changes, and added total for restricted funds.

This commit is contained in:
Bradley M. Kuhn 2011-11-01 12:41:15 -04:00
parent 3485f0b847
commit e4f3434a95

View file

@ -107,23 +107,26 @@ foreach my $type ('Income', 'Expenses') {
} }
} }
my $format = "%-${ACCT_WIDTH}.${ACCT_WIDTH}s \$%11.2f \$%11.2f\n"; my($totStart, $totEnd) = ($ZERO, $ZERO);
my($totDeb, $totCred) = ($ZERO, $ZERO);
foreach my $fund (sort keys %funds) { foreach my $fund (sort keys %funds) {
print "Fund: $fund\n"; print "Fund: $fund\n";
print " Balance as of $startDate: ", sprintf("\$%11.2f\n\n", $funds{$fund}{starting}); print " Balance as of $startDate: ", sprintf("\$%15.2f\n\n", $funds{$fund}{starting});
print " Income during period: ", sprintf("\$%11.2f\n", $funds{$fund}{Income}); print " Income during period: ", sprintf("\$%15.2f\n", $funds{$fund}{Income});
print " Expenses during period: ", sprintf("\$%11.2f\n\n", $funds{$fund}{Expenses}); print " Expenses during period: ", sprintf("\$%15.2f\n\n", $funds{$fund}{Expenses});
print " Balance as of $endDate: ", sprintf("\$%11.2f\n", $funds{$fund}{ending}); print " Balance as of $endDate: ", sprintf("\$%15.2f\n", $funds{$fund}{ending});
print "\n\n"; print "\n\n";
# Santity check: # Santity check:
if ($funds{$fund}{ending} == if ($funds{$fund}{ending} !=
($funds{$fund}{starting} + $funds{$fund}{Income} + $funds{$fund}{Expenses})) { ( ($funds{$fund}{starting} - $funds{$fund}{Income}) - $funds{$fund}{Expenses})) {
print "$fund FAILED SANITY CHECK\n\n\n"; print "$fund FAILED SANITY CHECK\n\n\n";
die "$fund FAILED SANITY CHECK"; die "$fund FAILED SANITY CHECK";
} }
$totStart += $funds{$fund}{starting};
$totEnd += $funds{$fund}{ending};
} }
print "\n\n\nTotal Restricted Funds as of $startDate: ", sprintf("\$%15.2f\n", $totStart);
print "\nTotal Restricted Funds as of $endDate: ", sprintf("\$%15.2f\n", $totEnd);
############################################################################### ###############################################################################
# #
# Local variables: # Local variables: