From 8293cefa318f7a4518f69d3bf90704bf7c40da7e Mon Sep 17 00:00:00 2001 From: Igor Date: Sat, 21 Nov 2009 18:38:12 +0300 Subject: Шаблоны чисто документов MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vedomost/makestat.pl | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 vedomost/makestat.pl (limited to 'vedomost/makestat.pl') 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 = ) +{ + 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); + -- cgit v1.2.3