From 65d3786d3ff597aab629921d83a968f63566b19d Mon Sep 17 00:00:00 2001 From: "Bradley M. Kuhn" Date: Wed, 12 Oct 2011 17:29:34 -0400 Subject: [PATCH] Switch variable name to be more accurate and make sure totals are done. --- trial-balance-report.plx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/trial-balance-report.plx b/trial-balance-report.plx index 4dac912..fde6be5 100755 --- a/trial-balance-report.plx +++ b/trial-balance-report.plx @@ -72,11 +72,11 @@ open(LEDGER_NEGATIVE, "-|", $LEDGER_CMD, '-d', 'a<0', @ledgerOptions) open(LEDGER_POSITIVE, "-|", $LEDGER_CMD, '-d', 'a>0', @ledgerOptions) or die "Unable to run $LEDGER_CMD -d a<0 @ledgerOptions: $!"; -while (my $negLine = ) { - chomp $negLine; +while (my $postLine = ) { + chomp $postLine; - die "Unable to parse output line from positive_ledger command: $negLine" - unless $negLine =~ /^\s*([^\$]+)\s+\$\s*\s*([\d\.\,]+)/; + die "Unable to parse output line from positive_ledger command: $postLine" + unless $postLine =~ /^\s*([^\$]+)\s+\$\s*\s*([\d\.\,]+)/; my($account, $amount) = ($1, $2); $amount = ParseNumber($amount); $account =~ s/^\s+//; $account =~ s/\s+$//; @@ -97,7 +97,10 @@ foreach my $account (keys %acct) { $acct{$account}{$val} = $ZERO unless defined $acct{$account}{$val}; } print sprintf("%${ACCT_WIDTH}s \$%-.2d \$%-2.d\n", $account, - $acct{$account}{negative}, $acct{$account}{postiive}); + $acct{$account}{negative}, $acct{$account}{positive}); + $totNeg += $acct{$account}{negative}; + $totPos += $acct{$account}{positive}; + } print sprintf("%${ACCT_WIDTH}s \$%-.2d \$%-2.d\n", 'TOTAL', $totNeg, $totPos);