Bug 21282: Sync ordered and spent values with acqui home
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 29 Aug 2018 20:26:14 +0000 (17:26 -0300)
committerFridolin Somers <fridolin.somers@biblibre.com>
Wed, 28 Nov 2018 15:16:33 +0000 (16:16 +0100)
The order list for each fund calculates using the ecost tax excl., but
it should be tax incl.
At the moment this means that the sum on the start page table and the
order list don't match up.

Test plan:
- Create and receive orders
- Values on acqui home and ordered/spent should be the same

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 9d595e36a7844f99fa5d74aad418717d12eeae37)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit a9aec1853871765f1a5d3ca82a0ff24c4bf0263e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

acqui/ordered.pl
acqui/spent.pl
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/ordered.tt
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt

index 28786b1..a5f2e46 100755 (executable)
@@ -54,7 +54,7 @@ my $query = <<EOQ;
 SELECT
     aqorders.biblionumber, aqorders.basketno, aqorders.ordernumber,
     quantity-quantityreceived AS tleft,
-    ecost, budgetdate, entrydate,
+    ecost_tax_included, budgetdate, entrydate,
     aqbasket.booksellerid,
     aqbooksellers.name as vendorname,
     itype,
@@ -92,7 +92,7 @@ while ( my $data = $sth->fetchrow_hashref ) {
         $left = $data->{'quantity'};
     }
     if ( $left && $left > 0 ) {
-        my $subtotal = $left * $data->{'ecost'};
+        my $subtotal = $left * $data->{'ecost_tax_included'};
         $data->{subtotal} = sprintf( "%.2f", $subtotal );
         $data->{'left'} = $left;
         push @ordered, $data;
index 76ed805..e778146 100755 (executable)
@@ -56,14 +56,14 @@ my $query = <<EOQ;
 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)
@@ -95,9 +95,9 @@ my @spent;
 while ( my $data = $sth->fetchrow_hashref ) {
     my $recv = $data->{'quantityreceived'};
     if ( $recv > 0 ) {
-        my $rowtotal = $recv * $data->{'unitprice'};
+        my $rowtotal = $recv * $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;
     }
index c730e84..6d17ac4 100644 (file)
@@ -1,5 +1,6 @@
 [% USE KohaDates %]
 [% USE ItemTypes %]
+[% USE Price %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Acquisitions &rsaquo; Ordered</title>
 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
@@ -72,7 +73,7 @@
            [% order.left %]
        </td>
     <td class="data cell">
-           [% order.ecost %]
+        [% order.ecost_tax_included | $Price %]
        </td>
     <td class="cell">
         <span title="[% order.entrydate %]">[% order.entrydate | $KohaDates %]</span>
index 686f35b..55ca63c 100644 (file)
@@ -1,5 +1,6 @@
 [% USE KohaDates %]
 [% USE ItemTypes %]
+[% USE Price %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Acquisitions &rsaquo; Spent</title>
 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
@@ -73,7 +74,7 @@
                 [% order.quantityreceived %]
             </td>
             <td class="cell">
-                [% order.unitprice %]
+                [% order.unitprice_tax_included | $Price %]
             </td>
             <td class="cell">
                 <span title="[% order.entrydate %]">[% order.entrydate | $KohaDates %]</span>