[Koha-patches] [PATCH 1/2] [SIGNED-OFF] Bug 5466 - Acquisitions - ability to set currency in order screens
Julian Maurice
julian.maurice at biblibre.com
Fri Mar 18 17:11:01 CET 2011
From: Savitra Sirohi <savitra.sirohi at osslabs.biz>
Signed-off-by: Julian Maurice <julian.maurice at biblibre.com>
---
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();
<input type="hidden" name="biblioitemnumber" value="<!-- TMPL_VAR NAME="biblioitemnumber" -->" />
<input type="hidden" name="discount" value="<!-- TMPL_VAR NAME="discount" -->" />
<input type="hidden" name="listinc" value="<!-- TMPL_VAR NAME="listincgst" -->" />
- <input type="hidden" name="currency" value="<!-- TMPL_VAR NAME="currency" -->" />
+<!-- <input type="hidden" name="currency" value="<!-- TMPL_VAR NAME="currency" -->" />-->
<input type="hidden" name="applygst" value="<!-- TMPL_VAR NAME="gstreg" -->" />
<input type="hidden" name="invoiceincgst" value="<!-- TMPL_VAR NAME="invoiceincgst" -->" />
<input type="hidden" name="gstrate" value="<!-- TMPL_VAR NAME="gstrate" -->" />
@@ -151,7 +151,7 @@ ff.submit();
<input type="hidden" name="import_batch_id" value="<!-- TMPL_VAR name="import_batch_id" -->" />
<!-- TMPL_LOOP NAME="loop_currencies" -->
- <input type="hidden" name="<!-- TMPL_VAR NAME="currency" -->" value="<!-- TMPL_VAR NAME="rate" -->" />
+ <input type="hidden" id="<!-- TMPL_VAR NAME="currcode" -->" name="<!-- TMPL_VAR NAME="currcode" -->" value="<!-- TMPL_VAR NAME="rate" -->" />
<!-- /TMPL_LOOP -->
<ol><li>
<!-- TMPL_IF name="biblionumber" -->
@@ -279,14 +279,25 @@ ff.submit();
</select>
<!--/TMPL_IF-->
</li>
+ <li>
+ <!-- TMPL_IF name="close" -->
+ <span class="label">Currency: </span>
+ <input type="hidden" size="10" name="currency" id="currency" value="<!-- TMPL_VAR NAME="currency" -->" /><!-- TMPL_VAR NAME="currency" -->
+ <!-- TMPL_ELSE -->
+ <label for="currency">Currency:</label>
+ <select name="currency" id="currency" onchange="calcNeworderTotal();">
+ <!-- TMPL_LOOP name="loop_currencies" -->
+ <!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR name="currcode" -->" selected="selected"><!-- TMPL_VAR name="currcode" --></option><!-- TMPL_ELSE --><option value="<!-- TMPL_VAR name="currcode" -->"><!-- TMPL_VAR name="currcode" --></option><!-- /TMPL_IF --><!-- /TMPL_LOOP -->
+ </select>
+ <!-- /TMPL_IF-->
+ </li>
<li>
<!-- TMPL_IF name="close" -->
<span class="label">Vendor price: </span>
<input type="hidden" size="20" name="listprice" id="listprice" value="<!-- TMPL_VAR NAME="listprice" -->" /><!-- TMPL_VAR NAME="listprice" -->
<!-- TMPL_ELSE -->
<label for="listprice">Vendor price: </label>
- <input type="text" size="20" name="listprice" id="listprice" value="<!-- TMPL_VAR NAME="listprice" -->" onchange="calcNeworderTotal()" /> (entered as <!-- TMPL_VAR NAME="currency" -->)
-
+ <input type="text" size="20" name="listprice" id="listprice" value="<!-- TMPL_VAR NAME="listprice" -->" onchange="calcNeworderTotal()" />
<!--/TMPL_IF-->
</li>
<!-- TMPL_UNLESS NAME="close" -->
--
1.7.4.1
More information about the Koha-patches
mailing list