Negative balances in red.

This commit is contained in:
Juerd Waalboer 2013-02-28 02:07:43 +01:00
parent 6a6ce32791
commit d11d31ec2e
2 changed files with 3 additions and 2 deletions

View file

@ -46,7 +46,8 @@ sub hook_reject {
sub hook_user_balance {
my ($class, $username, $old, $delta, $new) = @_;
my $sign = $delta >= 0 ? '+' : '-';
printf "New balance for %s: %+.2f %s %.2f = \e[1m%+.2f\e[0m %s\n",
my $rood = $new < 0 ? '31;' : '';
printf "New balance for %s: %+.2f %s %.2f = \e[${rood}1m%+.2f\e[0m %s\n",
$username, $old, $sign, abs($delta), $new,
($new < -13.37 ? "\e[5;1m(!!)\e[0m" : "");
}

View file

@ -33,7 +33,7 @@ sub hook_checkout {
}
sub list {
system "sort -f revbank.accounts | grep -v ^# | more";
system "sort -f revbank.accounts | grep -v ^# | perl -pe's/( -[\\d.]+)/\\e[31;1m\$1\\e[0m/' | more";
return ACCEPT;
}