From b114eb709fc4fee1507f141cb223ffc62670c18e Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Thu, 11 Jun 2026 16:37:53 +0100 Subject: [PATCH] Bug 12278: Add a total column to the table in parcels.pl Test plan: 1. Create an order with multiple items and receive the order in full 2. From the vendor record, click Receive shipments 3. You should be in parcels.pl and the table should show your shipments 4. There will be no column displaying the total 5. Apply patch and restart_all 6. Refresh the page, the column should now be visible showing the total Signed-off-by: Coleen Lilly Signed-off-by: Andrew Fuerste Henry Signed-off-by: Pedro Amorim --- C4/Acquisition.pm | 8 +++++++- acqui/parcels.pl | 5 +++++ koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt | 3 +++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 58c19ca6d1..5372b8f0ba 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -2433,7 +2433,13 @@ sub GetInvoices { ) ) AS is_linked_to_subscriptions, SUM(aqorders.quantityreceived) AS receiveditems, - SUM(aqorders.quantity) AS itemsexpected + SUM(aqorders.quantity) AS itemsexpected, + COALESCE(SUM(aqorders.unitprice_tax_excluded * aqorders.quantity), 0) AS total_tax_excluded, + COALESCE(SUM(aqorders.unitprice_tax_included * aqorders.quantity), 0) AS total_tax_included, + COALESCE( + (SELECT SUM(adj.adjustment) FROM aqinvoice_adjustments adj WHERE adj.invoiceid = aqinvoices.invoiceid), + 0 + ) AS total_adj FROM aqinvoices LEFT JOIN aqbooksellers ON aqbooksellers.id = aqinvoices.booksellerid LEFT JOIN aqorders ON aqorders.invoiceid = aqinvoices.invoiceid diff --git a/acqui/parcels.pl b/acqui/parcels.pl index 27ce71dd96..a52c101682 100755 --- a/acqui/parcels.pl +++ b/acqui/parcels.pl @@ -184,6 +184,10 @@ my $next_page_start = $startfrom + $resultsperpage; my $last_row = ( $next_page_start < $count_parcels ) ? $next_page_start - 1 : $count_parcels - 1; for my $i ( $startfrom .. $last_row ) { my $p = $parcels[$i]; + my $orders_total = + $bookseller->invoiceincgst + ? ( $p->{total_tax_included} // 0 ) + : ( $p->{total_tax_excluded} // 0 ); push @{$loopres}, { @@ -197,6 +201,7 @@ for my $i ( $startfrom .. $last_row ) { bibcount => $p->{receivedbiblios} || 0, reccount => $p->{receiveditems} || 0, itemcount => $p->{itemsexpected} || 0, + totalamount => $orders_total + ( $p->{total_adj} // 0 ) + ( $p->{shipmentcost} // 0 ), }; } if ($count_parcels) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt index bc5c3e9bc4..7fabc5cf9f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt @@ -2,6 +2,7 @@ [% USE Koha %] [% USE Asset %] [% USE KohaDates %] +[% USE Price %] [% PROCESS 'i18n.inc' %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] @@ -94,6 +95,7 @@ Item count [% tp("Bibliographic record", "Record count") | html %] Items expected + Total @@ -112,6 +114,7 @@ [% searchresult.reccount | html %] [% searchresult.bibcount | html %] [% searchresult.itemcount | html %] + [% searchresult.totalamount | $Price %] [% END %]