summaryrefslogtreecommitdiff
path: root/vedomost/makestat.pl
diff options
context:
space:
mode:
Diffstat (limited to 'vedomost/makestat.pl')
-rwxr-xr-xvedomost/makestat.pl44
1 files changed, 44 insertions, 0 deletions
diff --git a/vedomost/makestat.pl b/vedomost/makestat.pl
new file mode 100755
index 0000000..bfcfab8
--- /dev/null
+++ b/vedomost/makestat.pl
@@ -0,0 +1,44 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use utf8;
+use locale;
+use open qw( :utf8 :std :encoding(UTF-8) );
+
+my %items = ();
+
+while (my $s = <STDIN>)
+{
+ if ($s =~ m/^\\indexentry{(.*)\s*@\s*type\s*=\s*([0-9]+)\s*hours\s*=\s*([0-9]+)}{[0-9]+}$/)
+ {
+ if (! exists($items{$1}))
+ { # лк пр лб ...
+ @{$items{$1}} = (0, 0, 0, 0, 0, 0, 0, 0, 0);
+ }
+
+ $items{$1}[$2] += $3;
+
+ }
+}
+
+print "\\def\\stat{\n";
+
+for my $item (sort(keys %items))
+{
+ my @hours = @{$items{$item}};
+ my $row = "\\multicolumn{2}{c|}{} & $item & ";
+ for my $i (0..8)
+ {
+ $row .= ' & ' . ($hours[$i] > 0 ? $hours[$i] : '');
+ }
+ $row .= " \\\\ \n";
+ $row .= "\\hhline{~~-------------}\n\n";
+
+ print $row;
+}
+
+print "}\n";
+
+exit(0);
+