summaryrefslogtreecommitdiff
path: root/vedomost/makestat.pl
diff options
context:
space:
mode:
authorIgor <pashev.igor@gmail.com>2009-11-21 18:38:12 +0300
committerIgor <pashev.igor@gmail.com>2009-11-21 18:38:12 +0300
commit8293cefa318f7a4518f69d3bf90704bf7c40da7e (patch)
tree1bc0ce3c8a64d7e014a063410396b1bcf380bf67 /vedomost/makestat.pl
downloadautodocs-8293cefa318f7a4518f69d3bf90704bf7c40da7e.tar.gz
Шаблоны чисто документов
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);
+