Templating reports.pl

This might be of no use... Since it is never called and seems obsolete.
This commit is contained in:
hdl 2002-12-19 15:22:18 +00:00
parent 3c00689334
commit 9d8857f344
4 changed files with 31 additions and 16 deletions

View File

@ -123,8 +123,9 @@ sub circrep {
my $i=0;
my @results;
while (my $data=$sth->fetchrow_hashref){
$results[$i]="$data->{'datetime'}\t$data->{'branch'}";
$i++;
my %tempvalue;
$tempvalue->{'value'}="$data->{'datetime'}\t$data->{'branch'}";
push(@results, \%tempvalue);
}
$sth->finish;
# print $query;

View File

@ -40,13 +40,13 @@ sub stockreport {
my $sth=$dbh->prepare($query);
$sth->execute;
my $count=$sth->fetchrow_hashref;
$results[0]="$count->{'count'}\t Levin";
$results[0]->{'value'}="$count->{'count'}\t Levin";
$sth->finish;
$query="Select count(*) from items where homebranch='F'";
$sth=$dbh->prepare($query);
$sth->execute;
$count=$sth->fetchrow_hashref;
$results[1]="$count->{'count'}\t Foxton";
$results[1]->{'value'}="$count->{'count'}\t Foxton";
$sth->finish;
return(@results);
}

View File

@ -0,0 +1,8 @@
<TMPL_INCLUDE Name="issues-top.inc">
<H1> <TMPL_VAR Name="type"> reports </H1>
<TMPL_LOOP Name="dataloop">
<TMPL_VAR Name="value">
</TMPL_LOOP>
<TMPL_INCLUDE Name="issues-bottom.inc">

View File

@ -28,25 +28,31 @@ use CGI;
use C4::Output;
use C4::Stats;
use C4::Stock;
use HTML::Template;
my $input = new CGI;
print $input->header;
my $type=$input->param('type');
print startpage();
print startmenu('issue');
my @data;
# 2002/12/19 hdl@ifrance.com templating
my $template=gettemplate("reports.tmpl");
#print startpage();
#print startmenu('issue');
# 2002/12/19 hdl@ifrance.com templating end
my @dataloop;
if ($type eq 'search'){
@data=statsreport('search','something');
@dataloop=statsreport('search','something');
}
if ($type eq 'issue'){
@data=statsreport('issue','today');
@dataloop=statsreport('issue','today');
}
if ($type eq 'stock'){
@data=stockreport();
@dataloop=stockreport();
}
print mkheadr(1,"$type reports");
print @data;
print endmenu('issue');
print endpage();
# 2002/12/19 hdl@ifrance.com templating
$template->param( type => $type,
dataloop => \@dataloop);
#print endmenu('issue');
#print endpage();
print "Content-Type: text/html\n\n", $template->output;
# 2002/12/19 hdl@ifrance.com templating