#!/usr/bin/perl
# Copyright 2008 - 2009 BibLibre SARL
-# Copyright 2010 Catalyst IT Limited
+# Copyright 2010,2011 Catalyst IT Limited
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
=cut
-
use C4::Context;
use strict;
use warnings;
use CGI;
use C4::Auth;
use C4::Output;
+use C4::Dates;
-my $dbh = C4::Context->dbh;
-my $input = new CGI;
+my $dbh = C4::Context->dbh;
+my $input = new CGI;
my $fund_id = $input->param('fund');
-my $start = $input->param('start');
-my $end = $input->param('end');
+my $start = $input->param('start');
+my $end = $input->param('end');
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
SELECT
aqorders.basketno, aqorders.ordernumber,
quantity-quantityreceived AS tleft,
- ecost, budgetdate,
+ ecost, budgetdate, entrydate,
aqbasket.booksellerid,
itype,
title
(datecancellationprinted IS NULL OR
datecancellationprinted='0000-00-00') AND
(quantity > quantityreceived OR quantityreceived IS NULL)
+ GROUP BY aqorders.ordernumber
EOQ
my $sth = $dbh->prepare($query);
-$sth->execute( $fund_id);
-if ($sth->err) {
- die "Error occurred fetching records: ".$sth->errstr;
+$sth->execute($fund_id);
+if ( $sth->err ) {
+ die "Error occurred fetching records: " . $sth->errstr;
}
my @ordered;
}
if ( $left && $left > 0 ) {
my $subtotal = $left * $data->{'ecost'};
- $data->{subtotal} = sprintf ("%.2f", $subtotal);
+ $data->{subtotal} = sprintf( "%.2f", $subtotal );
$data->{'left'} = $left;
push @ordered, $data;
$total += $subtotal;
}
+ my $entrydate = C4::Dates->new( $data->{'entrydate'}, 'iso' );
+ $data->{'entrydate'} = $entrydate->output("syspref");
}
-$total = sprintf ("%.2f", $total);
-$template->param(
- ordered => \@ordered,
- total => $total
-);
+$total = sprintf( "%.2f", $total );
+
+$template->{VARS}->{'fund'} = $fund_id;
+$template->{VARS}->{'ordered'} = \@ordered;
+$template->{VARS}->{'total'} = $total;
+
$sth->finish;
-$dbh->disconnect;
output_html_with_http_headers $input, $cookie, $template->output;
# script to show a breakdown of committed and spent budgets
# Copyright 2002-2009 Katipo Communications Limited
-# Copyright 2010 Catalyst IT Limited
+# Copyright 2010,2011 Catalyst IT Limited
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
=cut
-
use C4::Context;
use C4::Auth;
use C4::Output;
+use C4::Dates;
use strict;
+use warnings;
use CGI;
my $dbh = C4::Context->dbh;
GROUP BY aqorders.ordernumber
EOQ
my $sth = $dbh->prepare($query);
-$sth->execute( $bookfund);
-if ($sth->err) {
- die "An error occurred fetching records: ".$sth->errstr;
+$sth->execute($bookfund);
+if ( $sth->err ) {
+ die "An error occurred fetching records: " . $sth->errstr;
}
my $total = 0;
my $toggle;
while ( my $data = $sth->fetchrow_hashref ) {
my $recv = $data->{'quantityreceived'};
if ( $recv > 0 ) {
- my $subtotal = $recv * ($data->{'unitprice'} + $data->{'freight'});
- $data->{'subtotal'} = sprintf ("%.2f", $subtotal);
- $data->{'freight'} = sprintf ("%.2f", $data->{'freight'});
- $data->{'unitprice'} = sprintf ("%.2f", $data->{'unitprice'} );
- $total += $subtotal;
-
- if ($toggle) {
- $toggle = 0;
- }
- else {
- $toggle = 1;
- }
- $data->{'toggle'} = $toggle;
+ my $subtotal = $recv * ( $data->{'unitprice'} + $data->{'freight'} );
+ $data->{'subtotal'} = sprintf( "%.2f", $subtotal );
+ $data->{'freight'} = sprintf( "%.2f", $data->{'freight'} );
+ $data->{'unitprice'} = sprintf( "%.2f", $data->{'unitprice'} );
+ $total += $subtotal;
+ my $entrydate = C4::Dates->new( $data->{'entrydate'}, 'iso' );
+ $data->{'entrydate'} = $entrydate->output("syspref");
+ my $datereceived = C4::Dates->new( $data->{'datereceived'}, 'iso' );
+ $data->{'datereceived'} = $datereceived->output("syspref");
push @spent, $data;
}
}
-$total = sprintf ("%.2f", $total);
+$total = sprintf( "%.2f", $total );
-$template->param(
- spent => \@spent,
- total => $total
-);
-$template->{VARS}->{'fund'} = $bookfund;
+$template->{VARS}->{'fund'} = $bookfund;
+$template->{VARS}->{'spent'} = \@spent;
+$template->{VARS}->{'total'} = $total;
$sth->finish;
-$dbh->disconnect;
output_html_with_http_headers $input, $cookie, $template->output;
[% INCLUDE 'header.inc' %]
[% INCLUDE 'acquisitions-search.inc' %]
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> › Ordered </div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> › Ordered - [% fund %]</div>
<div id="doc3" class="yui-t2">
<div id="yui-main">
<div class="yui-b">
-<h1>Budgets & Bookfunds</h1>
-<h2>Ordered</h2>
+<h1>Bookfunds</h1>
+<h2>Ordered - [% fund %]</h2>
<table cellspacing="0" cellpadding="0" border="0" id="spent" class="collapse">
<thead>
<tr>
<th> Title </th>
<th> Order </th>
+ <th> Vendor </th>
<th> Itemtype </th>
<th> Left on Order </th>
<th> Estimated cost per unit </th>
- <th> Budget Date </th>
+ <th> Date Ordered </th>
<th> Subtotal </th>
</tr>
</thead>
<td class="cell">
<a href=/cgi-bin/koha/acqui/neworderempty.pl?ordernumber=[% order.ordernumber %]&booksellerid=[% order.booksellerid %]&basketno=[% order.basketno %]">[% order.ordernumber %]</a>
</td>
+ <td class="cell">
+ <a href="/cgi-bin/koha/acqui/supplier.pl?supplierid=[% order.booksellerid %]">[% order.booksellerid %]</a>
+ </td>
<td class="cell">
[% order.itype %]
</td>
[% order.ecost %]
</td>
<td class="cell">
- [% order.budgetdate %]
+ [% order.entrydate %]
</td>
<td class="cell" align="right">
[% order.subtotal %]
<td> </td>
<td> </td>
<td> </td>
+ <td> </td>
<td align="right">
[% total %]
</td>