use C4::Output;
use Modern::Perl;
use CGI qw ( -utf8 );
+use C4::Acquisition;
use Koha::Acquisition::Invoice::Adjustments;
my $dbh = C4::Context->dbh;
SELECT
aqorders.biblionumber, aqorders.basketno, aqorders.ordernumber,
quantity-quantityreceived AS tleft,
- ecost, budgetdate, entrydate,
+ budgetdate, entrydate,
aqbasket.booksellerid,
itype,
title,
aqorders.invoiceid,
aqinvoices.invoicenumber,
quantityreceived,
- unitprice,
+ unitprice_tax_included,
datereceived,
aqbooksellers.name as vendorname
FROM (aqorders, aqbasket)
(datecancellationprinted IS NULL OR
datecancellationprinted='0000-00-00') AND
datereceived IS NOT NULL
- GROUP BY aqorders.ordernumber
+ GROUP BY aqorders.biblionumber, aqorders.basketno, aqorders.ordernumber,
+ tleft,
+ ecost, budgetdate, entrydate,
+ aqbasket.booksellerid,
+ itype,
+ title,
+ aqorders.invoiceid,
+ aqinvoices.invoicenumber,
+ quantityreceived,
+ unitprice,
+ datereceived,
+ aqbooksellers.name
+
EOQ
my $sth = $dbh->prepare($query);
$sth->execute($bookfund);
while ( my $data = $sth->fetchrow_hashref ) {
my $recv = $data->{'quantityreceived'};
if ( $recv > 0 ) {
- my $rowtotal = $recv * $data->{'unitprice'};
+ my $rowtotal = $recv * get_rounded_price($data->{'unitprice_tax_included'});
$data->{'rowtotal'} = sprintf( "%.2f", $rowtotal );
- $data->{'unitprice'} = sprintf( "%.2f", $data->{'unitprice'} );
+ $data->{'unitprice_tax_included'} = sprintf( "%.2f", $data->{'unitprice_tax_included'} );
$subtotal += $rowtotal;
push @spent, $data;
}