@@ -, +, @@ receiving - Create several currencies with different rates - Create an order, close the basket and receive - On the receipt page you will notice a new "change currency" checkbox - Check it - Enter a number and select a currency - Save --- acqui/orderreceive.pl | 7 ++-- .../prog/en/modules/acqui/orderreceive.tt | 37 ++++++++++++++++++++-- 2 files changed, 39 insertions(+), 5 deletions(-) --- a/acqui/orderreceive.pl +++ a/acqui/orderreceive.pl @@ -114,7 +114,8 @@ unless ( $results and @$results) { my $order = $results->[0]; my $order_object = Koha::Acquisition::Orders->find( $ordernumber ); my $basket = $order_object->basket; -my $active_currency = Koha::Acquisition::Currencies->get_active; +my $currencies = Koha::Acquisition::Currencies->search; +my $active_currency = $currencies->get_active; # Check if ACQ framework exists my $acq_fw = GetMarcStructure( 1, 'ACQ', { unsafe => 1 } ); @@ -228,8 +229,8 @@ $template->param( booksellerid => $order->{'booksellerid'}, freight => $freight, name => $bookseller->name, - cur_active_sym => $active_currency->symbol, - cur_active => $active_currency->currency, + active_currency => $active_currency, + currencies => scalar $currencies->search({ rate => { '!=' => 1 } }), invoiceincgst => $bookseller->invoiceincgst, title => $order->{'title'}, author => $order->{'author'}, --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -288,7 +288,7 @@ [% END %] -
  • [% rrp | $Price %] (adjusted for [% cur_active | html %], [% IF (invoiceincgst == 1) %]tax inclusive[% ELSE %]tax exclusive[% END %])
  • +
  • [% rrp | $Price %] (adjusted for [% active_currency.currency | html %], [% IF (invoiceincgst == 1) %]tax inclusive[% ELSE %]tax exclusive[% END %])
  • @@ -296,7 +296,21 @@
  • [% ecost | $Price %] [% IF (invoiceincgst == 1) %](tax inclusive)[% ELSE %](tax exclusive)[% END %]
  • - [% IF (invoiceincgst == 1) %](tax inclusive)[% ELSE %](tax exclusive)[% END %] + + [% IF (invoiceincgst == 1) %](tax inclusive)[% ELSE %](tax exclusive)[% END %] + +
  • +
  • + + + [% IF currencies.count %] + + [% END %]
  • [% IF order_vendornote %] @@ -436,6 +450,25 @@ CheckNItems($(this).val()); }); [% END %] + + $("input[name='change_currency']").on("change", function(){ + if ( $(this).is(":checked") ) { + $("#select_currency").show(); + $("#unitprice").prop("readonly", "true"); + } else { + $("#select_currency").hide(); + $("#unitprice").prop("readonly", ""); + } + }).change(); + + function update_unitprice() { + var rate = Number($("select[name='currency'] option:selected").val()); + var unitprice = $("#unitprice_currency").val(); + var new_unitprice = Number( unitprice * rate ).toFixed(2); + $("#unitprice").val(new_unitprice); + } + $("select[name='currency']").on("change", function(){update_unitprice()} ); + $("#unitprice_currency").on("change", function(){update_unitprice()} ); }); [% END %] --