=================================================================== RCS file: /cvs/RT/Invoicing/report_time,v retrieving revision 1.3 retrieving revision 1.5 diff -u -r1.3 -r1.5 --- RT/Invoicing/report_time 2020/08/04 02:23:48 1.3 +++ RT/Invoicing/report_time 2020/08/04 02:28:24 1.5 @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $AFresh1: report_time,v 1.2 2020/08/04 01:22:44 afresh1 Exp $ +# $AFresh1: report_time,v 1.4 2020/08/04 01:24:44 afresh1 Exp $ use v5.16; use warnings; @@ -74,25 +74,32 @@ } } +my $total = 0; foreach my $date ( sort keys %total ) { + my $subtotal = 0; foreach my $key ( sort keys %{ $total{$date} } ) { my $hours = $total{$date}{$key}->hours; # round to the quarter hour - $hours = sprintf "%.2f", - 25 * sprintf "%.2f", $hours / 25; + $hours = sprintf "%.02f", + 25 * sprintf "%.02f", $hours / 25; - say "$date $hours $key";# if $hours != 0; + say "$date $hours $key" if $hours != 0; + + $subtotal += $hours; + $total += $hours; } + printf "# %s %.02f\n", $date, $subtotal; } +printf "# Total %.02f\n", $total; sub descr_to_key { my ($descr) = @_; my @key = split /\s+/, $descr; - $key[-1] = $conversions{ $key[-1] } - if @key < 3 and $conversions{ $key[-1] }; + $key[-1] = $conversions{ lc $key[-1] } + if @key < 3 and $conversions{ lc $key[-1] }; return "@key"; }