Move sanity checks to the bottom, after report is generated. Also, fix formatting.
This commit is contained in:
parent
7b0e4c4806
commit
cba448b28b
1 changed files with 17 additions and 16 deletions
|
|
@ -109,28 +109,15 @@ foreach my $item (keys %reportFields) {
|
||||||
print STDERR "$item: $reportFields{$item}{total}\n" if $VERBOSE;
|
print STDERR "$item: $reportFields{$item}{total}\n" if $VERBOSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
die "Cash+accounts receivable total does not equal net assets and liabilities total"
|
|
||||||
if ( ($reportFields{'Cash'}{total} + $reportFields{'Accounts Receivable'}{total}) !=
|
|
||||||
($reportFields{'Accounts Payable'}{total} +
|
|
||||||
$reportFields{'Accrued Expenses'}{total} +
|
|
||||||
$reportFields{'Unearned Income, Conference Registration'}{total} +
|
|
||||||
$reportFields{'Unearned Income, Other'}{total} +
|
|
||||||
$reportFields{'Total Net Assets'}{total}));
|
|
||||||
|
|
||||||
die "Total net assets doesn't equal sum of restricted and unrestricted ones!"
|
|
||||||
if ($reportFields{'Total Net Assets'}{total} !=
|
|
||||||
$reportFields{'Unrestricted Net Assets'}{total} +
|
|
||||||
$reportFields{'Temporarily Restricted Net Assets'}{total});
|
|
||||||
|
|
||||||
open(ASSETS, ">", "assets-and-liabilities.txt")
|
open(ASSETS, ">", "assets-and-liabilities.txt")
|
||||||
or die "unable to open assets-and-liabilities.txt for writing: $!";
|
or die "unable to open assets-and-liabilities.txt for writing: $!";
|
||||||
|
|
||||||
print ASSETS "ASSETS\n\n";
|
print ASSETS "ASSETS\n\n";
|
||||||
|
|
||||||
my $formatStr = " %-42s \$%18s\n";
|
my $formatStr = " %-42s \$%13s\n";
|
||||||
my $formatStrTotal = "%-45s \$%12s\n";
|
my $formatStrTotal = "%-45s \$%13s\n";
|
||||||
my $tot = $ZERO;
|
my $tot = $ZERO;
|
||||||
foreach my $item ('Cash', 'Accounts Receivable') {
|
foreach my $item ('Cash', 'Accounts Receivable', 'Loans Receivable') {
|
||||||
next if $reportFields{$item}{total} == $ZERO;
|
next if $reportFields{$item}{total} == $ZERO;
|
||||||
print ASSETS sprintf($formatStr, "$item:", Commify($reportFields{$item}{total}));
|
print ASSETS sprintf($formatStr, "$item:", Commify($reportFields{$item}{total}));
|
||||||
$tot += $reportFields{$item}{total};
|
$tot += $reportFields{$item}{total};
|
||||||
|
|
@ -161,6 +148,20 @@ close ASSETS;
|
||||||
print STDERR "\n";
|
print STDERR "\n";
|
||||||
die "unable to write to Assets-and-liabilities.txt: $!" unless ($? == 0);
|
die "unable to write to Assets-and-liabilities.txt: $!" unless ($? == 0);
|
||||||
|
|
||||||
|
die "Cash+accounts receivable total does not equal net assets and liabilities total"
|
||||||
|
if ( ($reportFields{'Cash'}{total} + $reportFields{'Accounts Receivable'}{total}
|
||||||
|
+ $reportFields{'Loans Receivable'}{total}) !=
|
||||||
|
($reportFields{'Accounts Payable'}{total} +
|
||||||
|
$reportFields{'Accrued Expenses'}{total} +
|
||||||
|
$reportFields{'Unearned Income, Conference Registration'}{total} +
|
||||||
|
$reportFields{'Unearned Income, Other'}{total} +
|
||||||
|
$reportFields{'Total Net Assets'}{total}));
|
||||||
|
|
||||||
|
die "Total net assets doesn't equal sum of restricted and unrestricted ones!"
|
||||||
|
if ($reportFields{'Total Net Assets'}{total} !=
|
||||||
|
$reportFields{'Unrestricted Net Assets'}{total} +
|
||||||
|
$reportFields{'Temporarily Restricted Net Assets'}{total});
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#
|
#
|
||||||
# Local variables:
|
# Local variables:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue