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 <clilly@aacpl.net>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Matt Blenkinsop 2026-06-11 16:37:53 +01:00 committed by Pedro Amorim
parent e886c3a7e0
commit b114eb709f
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
3 changed files with 15 additions and 1 deletions

View File

@ -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

View File

@ -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) {

View File

@ -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 @@
<th>Item count</th>
<th>[% tp("Bibliographic record", "Record count") | html %]</th>
<th>Items expected</th>
<th>Total</th>
</tr>
</thead>
<tbody>
@ -112,6 +114,7 @@
<td> [% searchresult.reccount | html %] </td>
<td> [% searchresult.bibcount | html %] </td>
<td> [% searchresult.itemcount | html %] </td>
<td> [% searchresult.totalamount | $Price %] </td>
</tr>
[% END %]
</tbody>