From d8993c049630148d2f0318213d6c6360275de26d Mon Sep 17 00:00:00 2001 From: Savitra Sirohi Date: Wed, 1 Dec 2010 16:16:03 +0530 Subject: [PATCH 1/2] Bug 5466 - Acquisitions - ability to set currency in order screens Content-Type: text/plain; charset="utf-8" --- acqui/basket.pl | 7 ++++++- acqui/neworderempty.pl | 7 ++++--- koha-tmpl/intranet-tmpl/prog/en/js/acq.js | 7 +++++-- .../prog/en/modules/acqui/neworderempty.tmpl | 19 +++++++++++++++---- 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/acqui/basket.pl b/acqui/basket.pl index 8ea2929..0261e86 100755 --- a/acqui/basket.pl +++ b/acqui/basket.pl @@ -217,6 +217,10 @@ if ( $op eq 'delete_confirm' ) { "loggedinuser: $loggedinuser; creationdate: %s; authorisedby: %s", $basket->{creationdate}, $basket->{authorisedby}; + #to get active currency + my $cur = GetCurrency(); + + my @results = GetOrders( $basketno ); my $gist = $bookseller->{gstrate} // C4::Context->preference("gist") // 0; @@ -310,7 +314,8 @@ if ( $op eq 'delete_confirm' ) { gist_rrp => sprintf( "%.2f", $gist_rrp ), total_rrp_gsti => sprintf( "%.2f", $total_rrp_gsti ), total_est_gsti => sprintf( "%.2f", $total_est_gsti ), - currency => $bookseller->{'listprice'}, +# currency => $bookseller->{'listprice'}, + currency => $cur->{'currency'}, qty_total => $qty_total, GST => $gist, basketgroups => $basketgroups, diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl index 1cba13e..1e90b92 100755 --- a/acqui/neworderempty.pl +++ b/acqui/neworderempty.pl @@ -209,8 +209,9 @@ my $count = scalar @rates; my @loop_currency = (); for ( my $i = 0 ; $i < $count ; $i++ ) { my %line; - $line{currency} = $rates[$i]->{'currency'}; + $line{currcode} = $rates[$i]->{'currency'}; $line{rate} = $rates[$i]->{'rate'}; + $line{selected} = 1 if ($line{currcode} eq $data->{currency}); push @loop_currency, \%line; } @@ -342,7 +343,7 @@ $template->param( name => $bookseller->{'name'}, cur_active_sym => $cur->{'symbol'}, cur_active => $cur->{'currency'}, - currency => $bookseller->{'listprice'} || $cur->{'currency'}, # eg: 'EUR' +# currency => $bookseller->{'listprice'} || $cur->{'currency'}, # eg: 'EUR' loop_currencies => \@loop_currency, orderexists => ( $new eq 'yes' ) ? 0 : 1, title => $data->{'title'}, @@ -354,7 +355,7 @@ $template->param( quantity => $data->{'quantity'}, quantityrec => $data->{'quantity'}, rrp => $data->{'rrp'}, - listprice => sprintf("%.2f", $data->{'listprice'}||$listprice), + listprice => sprintf("%.2f", $data->{'listprice'}||$data->{'price'}||$listprice), total => sprintf("%.2f", ($data->{'ecost'}||0)*($data->{'quantity'}||0) ), ecost => $data->{'ecost'}, notes => $data->{'notes'}, diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js b/koha-tmpl/intranet-tmpl/prog/en/js/acq.js index 326062d..b5ec994 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/acq.js @@ -645,11 +645,14 @@ function calcNeworderTotal(){ var quantity = new Number(f.quantity.value); var discount = new Number(f.discount.value); var listinc = new Number (f.listinc.value); - var currency = f.currency.value; + //var currency = f.currency.value; var applygst = new Number (f.applygst.value); var listprice = new Number(f.listprice.value); var invoiceingst = new Number (f.invoiceincgst.value); - var exchangerate = new Number(f.elements[currency].value); //get exchange rate +// var exchangerate = new Number(f.elements[currency].value); //get exchange rate + var currcode = new String(document.getElementById('currency').value); + var exchangerate = new Number(document.getElementById(currcode).value); + var gst_on=(!listinc && invoiceingst); //do real stuff diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tmpl index 53c0474..76f5a3f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tmpl @@ -143,7 +143,7 @@ ff.submit(); " /> " /> " /> - " /> +" />--> " /> " /> " /> @@ -151,7 +151,7 @@ ff.submit(); " /> - " value="" /> + " name="" value="" />
  1. @@ -279,14 +279,25 @@ ff.submit();
  2. +
  3. + + Currency: + " /> + + + + +
  4. Vendor price: " /> - " onchange="calcNeworderTotal()" /> (entered as ) - + " onchange="calcNeworderTotal()" />
  5. -- 1.7.4