use Modern::Perl;
use CGI qw( -utf8 );
-use C4::Auth;
-use C4::Output;
-use C4::Budgets;
-use C4::Biblio;
-use C4::Reports;
-use C4::Acquisition; #GetBasket()
+use C4::Auth qw( get_template_and_user );
+use C4::Output qw( output_html_with_http_headers );
+use C4::Budgets qw( GetBudgetsReport GetBudgetHierarchy );
+use C4::Acquisition qw( GetBasket get_rounded_price );
+use C4::Context;
use Koha::Biblios;
-use Koha::DateUtils;
-my $query = new CGI;
+my $query = CGI->new;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
template_name => "reports/orders_by_budget.tt",
query => $query,
type => "intranet",
flagsrequired => { reports => '*' },
- debug => 1,
}
);
$order->{'total_rrp'} = get_rounded_price($order->{'quantity'}) * $order->{'rrp'};
$order->{'total_ecost'} = get_rounded_price($order->{'quantity'}) * $order->{'ecost'};
- # Format the dates and currencies correctly
- $order->{'datereceived'} = output_pref(dt_from_string($order->{'datereceived'}));
- $order->{'entrydate'} = output_pref(dt_from_string($order->{'entrydate'}));
+ # Format the currencies correctly
$total_quantity += $order->{'quantity'};
$total_rrp += $order->{'total_rrp'};
$total_ecost += $order->{'total_ecost'};
# If we are outputting to a file, create it and exit.
else {
my $basename = $params->{"basename"};
- my $sep = $params->{"sep"};
- $sep = "\t" if ($sep eq 'tabulation');
+ my $sep = C4::Context->csv_delimiter(scalar $params->{"sep"});
# TODO Use Text::CSV to generate the CSV file
print $query->header(
$template->param( budgetsloop => \@{$budgetloop},
outputFormatloop => \@outputFormats,
delimiterloop => \@CSVdelimiters,
- delimiterPreference => C4::Context->preference('delimiter')
+ delimiterPreference => C4::Context->preference('CSVDelimiter')
);
}