From 7728eb5706455e640741968aa499eeb1155c6bd7 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Fri, 1 Aug 2025 02:22:18 +0000 Subject: [PATCH] Bug 40537: Show totals in invoice currencies after receiving orders This patch improves the invoice page to also display the total price for received orders in the currency of the invoice. This helps libraries to quickly confirm that invoices match up with what is expected and stored in Koha. To test: 1. Go to Acquisitions and create a vendor and basket if you don't have one already In KTD, go to: http://localhost:8081/cgi-bin/koha/acqui/basket.pl?basketno=1 2. Add a few orders to the basket. Mix up the currencies of the order i.e. add a few orders in GPB, a few in CAD. 3. Close the basket 4. Click the button to Receive shipments 5. Receive your orders and use the invoice currency to receive a. Click Receive for your order b. Check the checkbox to include the order in the receipt c. On the right side of the pop-up, check the checkbox to Change currency d. Enter the invoice price in the foreign currency e. Submit 6. Once all orders are received, click the button to Finish receiving 7. Scroll down to the bottom of the invoice details. Confirm all invoices are totalled as normal, plus there is extra information under the Invoice Price column which shows the totals in the invoice currency. Sponsored-by: Auckland University of Technology --- acqui/invoice.pl | 4 ++++ koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/acqui/invoice.pl b/acqui/invoice.pl index d38a83d217b..628f102acd4 100755 --- a/acqui/invoice.pl +++ b/acqui/invoice.pl @@ -257,6 +257,7 @@ my $total_tax_excluded = 0; my $total_tax_included = 0; my $total_tax_value = 0; my $has_invoice_unitprice; +my $invoice_currency_totals; foreach my $order (@$orders) { my $line = get_infos( $order, $bookseller ); @@ -279,6 +280,8 @@ foreach my $order (@$orders) { $line->{orderline} = $line->{parent_ordernumber}; $has_invoice_unitprice = 1 if $line->{invoice_currency} ne $active_currency->currency; + $invoice_currency_totals->{ $line->{invoice_currency} } += $line->{invoice_unitprice}; + push @orders_loop, $line; } @@ -340,6 +343,7 @@ $template->param( budgets => $budget_loop, budget => GetBudget($shipmentcost_budgetid), has_invoice_unitprice => $has_invoice_unitprice, + invoice_currency_totals => $invoice_currency_totals, ); defined($invoice_files) && $template->param( files => $invoice_files->GetFilesInfo() ); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt index 91ef1acade2..c09bf2a6a66 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt @@ -416,7 +416,11 @@ Total ([% currency.symbol | html %]) [% IF has_invoice_unitprice %] - + + [% FOREACH total IN invoice_currency_totals %] + [% total.value | $Price %] [% total.key | html %] + [% END %] + [% END %] -- 2.39.5