revbank/plugins/grandtotal
Juerd Waalboer 89885a29c1 Remove last references to "EUR"
Except the one in the EPC QR code, because the specification says
that EUR is mandatory.
2019-11-05 01:33:31 +01:00

26 lines
613 B
Perl

#!perl
HELP "grandtotal" => "Summary of all accounts";
sub command :Tab(grandtotal) {
my ($self, $cart, $command) = @_;
return NEXT if $command ne 'grandtotal';
my $pos = 0;
my $neg = 0;
open my $fh, "<", "revbank.accounts";
while (defined(my $line = readline $fh)) {
my $credit = (split " ", $line)[1];
$neg += $credit if $credit < 0;
$pos += $credit if $credit > 0;
}
printf "Total positive: %8.2f\n", $pos;
printf "Total negative: \e[31;1m%8.2f\e[0m\n", $neg;
printf "GRAND TOTAL: \e[1m%8.2f\e[0m\n", $pos + $neg;
return ACCEPT;
}