36 |
use Data::Dump qw/dump/; |
use Data::Dump qw/dump/; |
37 |
|
|
38 |
# edit following to set defaults |
# edit following to set defaults |
39 |
my $dsn = 'DBI:Pg:dbname='; |
our $dsn = 'DBI:Pg:dbname='; |
40 |
my $database = 'template1'; |
our $database = 'template1'; |
41 |
my $user = 'dpavlin'; |
our $user = 'dpavlin'; |
42 |
my $passwd = ''; |
our $passwd = ''; |
43 |
my $path = 'sql_reports.xls'; |
our $path = 'sql_reports.xls'; |
44 |
|
|
45 |
my $db_encoding = 'iso-8859-2'; |
our $db_encoding = 'iso-8859-2'; |
46 |
my $xls_date_format = 'dd.mm.yyyy'; |
our $xls_date_format = 'dd.mm.yyyy'; |
47 |
|
|
48 |
my $debug = 1; |
our $debug = 1; |
49 |
|
|
50 |
my $sql_dir = path_translated || '.'; |
my $sql_dir = path_translated || '.'; |
51 |
$sql_dir =~ s,/[^/]+$,,; |
$sql_dir =~ s,/[^/]+$,,; |
54 |
my @sql_files = sort grep { /\.sql$/i && -f "$sql_dir/$_" } readdir(DIR); |
my @sql_files = sort grep { /\.sql$/i && -f "$sql_dir/$_" } readdir(DIR); |
55 |
closedir DIR; |
closedir DIR; |
56 |
|
|
57 |
|
my $config_path = "$sql_dir/config.pl"; |
58 |
|
warn "# using $config_path\n"; |
59 |
|
require $config_path if -e $config_path; |
60 |
|
|
61 |
my $workbook; |
my $workbook; |
62 |
if ($ENV{GATEWAY_INTERFACE} && $ENV{GATEWAY_INTERFACE} =~ m/CGI/i) { |
if ($ENV{GATEWAY_INTERFACE} && $ENV{GATEWAY_INTERFACE} =~ m/CGI/i) { |
63 |
# use as cgi script |
# use as cgi script |
118 |
my $fmt_comment = $workbook->addformat(); # Add a format |
my $fmt_comment = $workbook->addformat(); # Add a format |
119 |
$fmt_comment->set_bold(); |
$fmt_comment->set_bold(); |
120 |
|
|
121 |
|
$comment =~ s/^\s+//; |
122 |
|
$comment =~ s/\s+$//; |
123 |
|
|
124 |
$worksheet->write($row, 0, _c($comment), $fmt_comment); |
$worksheet->write($row, 0, _c($comment), $fmt_comment); |
125 |
$row+=2; |
$row+=2; |
126 |
} |
} |