- if (scalar(@{ $clients{$client}{'work'}{$desc}{'times'} }) > 1) {
- print detail_line($clients{$client}{'work'}{$desc}{'hours'}, 'Total');
+exit;
+
+sub detail_line {
+ my $indent = shift;
+ return sprintf((' ' x $indent) . "%2.2f - %s\n", @_);
+}
+
+sub print_clients_summary {
+ $Text::Wrap::columns = 78;
+ for my $client (sort keys %clients) {
+ print detail_line(2, $clients{$client}{'hours'}, $clients{$client}{'client'});
+ }
+}
+
+sub print_clients {
+ $Text::Wrap::columns = 78;
+ for my $client (sort keys %clients) {
+ print "$clients{$client}{'client'}:\n";
+ print detail_line(2, $clients{$client}{'hours'}, 'Client Total');
+ print "\n";
+
+ for my $desc (sort keys %{ $clients{$client}{'work'} }) {
+ print wrap(' ', ' ', $desc) . "\n";
+
+ for my $time (sort { $a->[1] cmp $b->[1] } @{ $clients{$client}{'work'}{$desc}{'times'} }) {
+ print detail_line(4, $time->[0], $time->[1]);
+ }
+
+ if (scalar(@{ $clients{$client}{'work'}{$desc}{'times'} }) > 1) {
+ print detail_line(4, $clients{$client}{'work'}{$desc}{'hours'}, 'Total');
+ }