#!/usr/bin/perl
-# $Id$
# Copyright 2000-2002 Katipo Communications
#
use C4::Auth;
use CGI;
use C4::Context;
-use HTML::Template;
-use C4::Search;
+
use C4::Output;
use C4::Koha;
-use C4::Interface::CGI::Output;
-use C4::Circulation::Circ2;
+use C4::Circulation;
+use C4::Dates qw/format_date format_date_in_iso/;
=head1 NAME
=head1 DESCRIPTION
-
-=over2
+=over 2
=cut
my $line = $input->param("Line");
my $column = $input->param("Column");
my @filters = $input->param("Filter");
+$filters[0]=format_date_in_iso($filters[0]);
+$filters[1]=format_date_in_iso($filters[1]);
+$filters[2]=format_date_in_iso($filters[2]);
+$filters[3]=format_date_in_iso($filters[3]);
my $podsp = $input->param("PlacedOnDisplay");
my $rodsp = $input->param("ReceivedOnDisplay");
my $aodsp = $input->param("AcquiredOnDisplay"); ##added by mason.
my $del = $input->param("sep");
#warn "calcul : ".$calc;
-my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
- {
- template_name => $fullreportname,
- query => $input,
- type => "intranet",
- authnotrequired => 0,
- flagsrequired => { editcatalogue => 1 },
- debug => 1,
- }
-);
-$template->param( do_it => $do_it );
+my ($template, $borrowernumber, $cookie)
+ = get_template_and_user({template_name => $fullreportname,
+ query => $input,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => {reports => 1},
+ debug => 1,
+ });
+$template->param(do_it => $do_it,
+ DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
+ );
if ($do_it) {
-
- #warn
-"line=$line, col=$column, pod=$podsp, rod=$rodsp, aod=$aodsp, calc=$calc, filters=@filters\n";
-
+ # warn "line=$line, col=$column, pod=$podsp, rod=$rodsp, aod=$aodsp, calc=$calc, filters=@filters\n";
my $results =
calculate( $line, $column, $podsp, $rodsp, $aodsp, $calc, \@filters );
if ( $output eq "screen" ) {
$template->param( mainloop => $results );
output_html_with_http_headers $input, $cookie, $template->output;
- exit(1);
}
else {
print $input->header(
-type => 'application/vnd.sun.xml.calc',
+ -encoding => 'utf-8',
-attachment => "$basename.csv",
-name => "$basename.csv"
);
print $sep. $col->{totalcol};
}
print $sep. @$results[0]->{total};
- exit(1);
}
+ exit(1);
}
else {
my $dbh = C4::Context->dbh;
my %labels;
my %select;
my $req;
- $req =
- $dbh->prepare(
- "SELECT distinctrow id,name FROM aqbooksellers ORDER BY name");
+ $req = $dbh->prepare("SELECT distinctrow id,name FROM aqbooksellers ORDER BY name");
$req->execute;
my @select;
push @select, "";
}
my $CGIBookSellers = CGI::scrolling_list(
-name => 'Filter',
- -id => 'Filter',
+ -id => 'supplier',
-values => \@select,
# -labels => \%select,
}
my $CGIItemTypes = CGI::scrolling_list(
-name => 'Filter',
- -id => 'Filter',
+ -id => 'itemtypes',
-values => \@select,
-labels => \%select,
-size => 1,
}
my $CGIBudget = CGI::scrolling_list(
-name => 'Filter',
- -id => 'Filter',
+ -id => 'budget',
-values => \@select,
-labels => \%select,
-size => 1,
}
my $CGISort1 = CGI::scrolling_list(
-name => 'Filter',
- -id => 'Filter',
+ -id => 'sort1',
-values => \@select,
-size => 1,
-multiple => 0
}
my $CGISort2 = CGI::scrolling_list(
-name => 'Filter',
- -id => 'Filter',
+ -id => 'sort2',
-values => \@select,
-size => 1,
-multiple => 0
my @mime = ( C4::Context->preference("MIME") );
foreach my $mime (@mime) {
-
# warn "".$mime;
}
if ( ( ( $i == 1 ) or ( $i == 3 ) ) and ( @$filters[ $i - 1 ] ) ) {
$cell{err} = 1 if ( @$filters[$i] < @$filters[ $i - 1 ] );
}
- $cell{filter} .= @$filters[$i];
+ # format the dates filters, otherwise just fill as is
+ if ($i>=4) {
+ $cell{filter} .= @$filters[$i];
+ } else {
+ $cell{filter} .= format_date(@$filters[$i]);
+ }
$cell{crit} .= "Placed On From" if ( $i == 0 );
$cell{crit} .= "Placed On To" if ( $i == 1 );
$cell{crit} .= "Received On From" if ( $i == 2 );
# preparing calculation
my $strcalc;
$strcalc .= "SELECT $linefield, $colfield, ";
- $strcalc .= "COUNT( aqorders.ordernumber ) " if ( $process == 1 );
+ $strcalc .= "SUM( aqorders.quantity ) " if ( $process == 1 );
$strcalc .= "SUM( aqorders.quantity * aqorders.listprice ) "
if ( $process == 2 );
$strcalc .= "FROM (aqorders, aqbasket,aqorderbreakdown)